@deephaven/code-studio 0.29.0 → 0.29.1-relative-base-url.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/assets/{index.962cedc6.js → index.cae5241c.js} +4 -4
- package/build/assets/index.cae5241c.js.map +1 -0
- package/build/assets/{index.6d40befa.css → index.ce6ce2f2.css} +1 -1
- package/build/assets/monaco.614a47c6.css +1 -0
- package/build/assets/{monaco.1292e04e.js → monaco.f95ee3d0.js} +8 -8
- package/build/assets/{monaco.1292e04e.js.map → monaco.f95ee3d0.js.map} +1 -1
- package/build/assets/vendor.c53844f2.css +1 -0
- package/build/index.html +10 -10
- package/package.json +26 -26
- package/build/assets/index.962cedc6.js.map +0 -1
- package/build/assets/monaco.8607667d.css +0 -1
- package/build/assets/vendor.2939dda5.css +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{B as D,A as w,R as Q,P as Yg,C as h,D as gt,E as $,F as T,G as wi,H as _l,I as be,J as Je,K as te,L as Te,M as Ge,N as Xg,O as jg,Q as Sd,S as kl,T as Zg,U as Qg,V as Se,W as $a,X as Jn,Y as Eu,Z as ut,_ as wd,$ as Jg,a0 as ef,a1 as tf,a2 as nf,a3 as fe,a4 as Hc,a5 as vd,a6 as sf,a7 as of,a8 as yu,a9 as tt,aa as za,ab as Ol,ac as Uc,ad as rf,ae as Yn,af as lf,ag as af,ah as df,ai as cf,aj as Wa,ak as hf,al as uf,am as mf,an as Vc,ao as pf,ap as gf,aq as Bc,ar as ff,as as Cf,at as bf,au as Sf,av as wf,aw as Mt,ax as Iu,ay as vf,az as Ru,aA as Tf,aB as Du,aC as Ef,aD as yf,aE as If,aF as Rf,aG as Df,aH as Mf,aI as Nf,aJ as Ff,aK as $c,aL as xf}from"./vendor.cbc1eaf5.js";import{e as bs,l as Bi,K as Sn,a as zc,b as qn,_ as _f,W as kf}from"./monaco.
|
|
1
|
+
import{B as D,A as w,R as Q,P as Yg,C as h,D as gt,E as $,F as T,G as wi,H as _l,I as be,J as Je,K as te,L as Te,M as Ge,N as Xg,O as jg,Q as Sd,S as kl,T as Zg,U as Qg,V as Se,W as $a,X as Jn,Y as Eu,Z as ut,_ as wd,$ as Jg,a0 as ef,a1 as tf,a2 as nf,a3 as fe,a4 as Hc,a5 as vd,a6 as sf,a7 as of,a8 as yu,a9 as tt,aa as za,ab as Ol,ac as Uc,ad as rf,ae as Yn,af as lf,ag as af,ah as df,ai as cf,aj as Wa,ak as hf,al as uf,am as mf,an as Vc,ao as pf,ap as gf,aq as Bc,ar as ff,as as Cf,at as bf,au as Sf,av as wf,aw as Mt,ax as Iu,ay as vf,az as Ru,aA as Tf,aB as Du,aC as Ef,aD as yf,aE as If,aF as Rf,aG as Df,aH as Mf,aI as Nf,aJ as Ff,aK as $c,aL as xf}from"./vendor.cbc1eaf5.js";import{e as bs,l as Bi,K as Sn,a as zc,b as qn,_ as _f,W as kf}from"./monaco.f95ee3d0.js";import{P as ul,b as Of,h as Af,p as Lf,o as Pf,s as Hf,t as Uf,c as va}from"./plotly.eb715493.js";import"./helpers.162e09a8.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))s(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const r of o.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&s(r)}).observe(document,{childList:!0,subtree:!0});function n(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerpolicy&&(o.referrerPolicy=i.referrerpolicy),i.crossorigin==="use-credentials"?o.credentials="include":i.crossorigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function s(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();const Vf="#1a171a",Bf="#f0f0ee",$f="#fcd65b",zf="#9edc6f",Wf="#76d9e4",Gf="#aa9af4",Kf="#f37e3f",qf="#f95d84",Yf="#4878ea",Xf="#5b5a5c",jf="#9edc6f",Zf="#fcd65b",Qf="#f37e3f",Jf="#f95d84",eC="#fcfcfa",tC="#929192",nC="#373438",sC="#1a171a",iC="#f0f0ee",oC="0.15s",rC={"gray-100":"#fcfcfa","gray-200":"#f0f0ee","gray-300":"#c0bfbf","gray-400":"#929192","gray-500":"#5b5a5c","gray-600":"#555356","gray-700":"#403e41","gray-800":"#373438","gray-850":"#322f33","gray-900":"#211f22",black:Vf,white:Bf,yellow:$f,green:zf,blue:Wf,purple:Gf,orange:Kf,red:qf,primary:Yf,"primary-hover":"#235de6","primary-dark":"#343e5d",secondary:Xf,success:jf,info:Zf,warning:Qf,danger:Jf,light:eC,mid:tC,dark:nC,"text-muted":"#929192","content-bg":"#2d2a2e",background:sC,foreground:iC,transition:oC},lC={transitionMs:150,transitionMidMs:200,transitionLongMs:300,transitionSlowMs:1e3},ze=Object.freeze({...lC,...rC});class An extends w.exports.Component{constructor(e){super(e),this.handleEnter=this.handleEnter.bind(this),this.handleExit=this.handleExit.bind(this),this.handleBlur=this.handleBlur.bind(this),this.element=document.createElement("div"),this.element.className="popper-container",this.container=Q.createRef(),this.rAF=0;const{isShown:n}=this.props;this.state={show:n,popper:null}}componentDidUpdate(e){const{isShown:n}=this.props;e.isShown!==n&&(n?(cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{this.show()})):this.hide())}componentWillUnmount(){this.destroyPopper(!1)}getVisibleElement(e){return e==null||e.clientHeight>0||e.clientWidth>0?e:this.getVisibleElement(e.parentElement)}initPopper(){let{popper:e}=this.state;const{closeOnBlur:n,referenceObject:s}=this.props;if(e||this.container.current===null)return;let{options:i}=this.props;i={placement:"auto",modifiers:{preventOverflow:{boundariesElement:"viewport"}},...i},document.body.appendChild(this.element);let o=this.getVisibleElement(this.container.current);o==null&&(o=this.container.current),e=new Yg(s||o,this.element,i),e.scheduleUpdate(),cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{if(n&&!this.element.contains(document.activeElement)){const r=this.element.firstElementChild;r instanceof HTMLElement&&r.focus()}}),this.setState({popper:e})}destroyPopper(e=!0){cancelAnimationFrame(this.rAF);const{popper:n}=this.state;!n||(n.destroy(),document.body.contains(this.element)&&document.body.removeChild(this.element),e&&this.setState({popper:null}))}show(){this.initPopper(),this.setState({show:!0})}hide(){this.setState({show:!1})}scheduleUpdate(){const{popper:e}=this.state;e&&e.scheduleUpdate()}handleBlur(e){e.relatedTarget instanceof HTMLElement&&(this.element.contains(e.relatedTarget)||this.hide())}handleEnter(){const{onEntered:e}=this.props;e()}handleExit(){const{onExited:e}=this.props,{show:n}=this.state;n||this.destroyPopper(),e()}renderContent(){const{className:e,children:n,timeout:s,interactive:i,closeOnBlur:o}=this.props,{show:r}=this.state;return h(gt,{in:r,timeout:s,classNames:"popper-transition",onEntered:this.handleEnter,onExited:this.handleExit,children:h("div",{onClick:l=>{l.stopPropagation()},onKeyDown:l=>{l.key==="Escape"&&this.hide()},className:$("popper",{interactive:i},e),onBlur:o?this.handleBlur:void 0,tabIndex:o?-1:void 0,role:"presentation",children:T("div",{className:"popper-content",children:[n,h("div",{className:"popper-arrow","x-arrow":""})]})})})}render(){const{popper:e}=this.state,{"data-testid":n}=this.props;return h("div",{className:"popper-parent-container",ref:this.container,style:{display:"none"},"data-testid":n,children:e&&wi.createPortal(this.renderContent(),this.element)})}}An.propTypes={children:D.exports.node.isRequired,options:D.exports.shape({}),className:D.exports.string,timeout:D.exports.number,onEntered:D.exports.func,onExited:D.exports.func,isShown:D.exports.bool,closeOnBlur:D.exports.bool,interactive:D.exports.bool,referenceObject:D.exports.shape({}),"data-testid":D.exports.string};An.defaultProps={options:{},className:"",timeout:ze.transitionMs,onEntered(){},onExited(){},isShown:!1,interactive:!1,closeOnBlur:!1,referenceObject:null,"data-testid":void 0};const aC=-1,Mu=0,Nu=1,Td=2,Fu=3,xu=4;Object.freeze({SILENT:aC,ERROR:Mu,WARN:Nu,INFO:Td,DEBUG:Fu,DEBUG2:xu});const Rn=()=>{};class Wc{constructor(e,n){this.name=e,this.prefix=e!=null?`[${e}]`:"",this.error=Rn,this.warn=Rn,this.log=Rn,this.info=Rn,this.debug=Rn,this.debug2=Rn,this.level=n,this.setLogLevel(n)}setLogLevel(e){if(!Number.isFinite(e)){console.warn(`Expected a number for log level. Received: ${e}. Ignoring`);return}this.level=e,this.error=e>=Mu?console.error.bind(console,this.prefix):Rn,this.warn=e>=Nu?console.warn.bind(console,this.prefix):Rn,this.log=e>=Td?console.log.bind(console,this.prefix):Rn,this.info=this.log,this.debug=e>=Fu?console.debug.bind(console,this.prefix):Rn,this.debug2=e>=xu?console.debug.bind(console,this.prefix):Rn}}class dC extends Wc{constructor(e=Td){super(null,e),this.modules={}}module(e){return this.modules[e]==null&&(this.modules[e]=new Wc(e,this.level)),this.modules[e]}setLogLevel(e){if(super.setLogLevel(e),this.modules==null)return;const n=Object.keys(this.modules);for(let s=0;s<n.length;s+=1)this.modules[n[s]].setLogLevel(e)}}const J=new dC;var Vt=(t=>(t.DEBUG="D",t.LOG="L",t.WARN="W",t.ERROR="E",t.UNCAUGHT_ERROR="U",t))(Vt||{});function No(t,e){return new CustomEvent(t,{detail:e})}class cC{constructor(){this.isEnabled=!1,this.handleUncaughtError=e=>{const n=[];e.error!=null&&n.push(e.error),e.message&&n.push(e.message),this.eventTarget.dispatchEvent(No("U",n))},this.debug=console.debug,this.log=console.log,this.warn=console.warn,this.error=console.error,this.eventTarget=new _l}enable(){this.isEnabled||(console.debug=(...e)=>{this.eventTarget.dispatchEvent(No("D",e)),this.debug.apply(console,e)},console.log=(...e)=>{this.eventTarget.dispatchEvent(No("L",e)),this.log.apply(console,e)},console.warn=(...e)=>{this.eventTarget.dispatchEvent(No("W",e)),this.warn.apply(console,e)},console.error=(...e)=>{this.eventTarget.dispatchEvent(No("E",e)),this.error.apply(console,e)},window.addEventListener("error",this.handleUncaughtError),J.setLogLevel(J.level),this.isEnabled=!0)}disable(){!this.isEnabled||(console.debug=this.debug,console.log=this.log,console.warn=this.warn,console.error=this.error,window.removeEventListener("error",this.handleUncaughtError),J.setLogLevel(J.level),this.isEnabled=!1)}addEventListener(e,n){this.eventTarget.addEventListener(e,n)}removeEventListener(e,n){this.eventTarget.removeEventListener(e,n)}}class ml{static formatMessages(e){return e.map(s=>{if(typeof s=="string")return s;let i="";try{i=JSON.stringify(s)}catch{i=s.toString()}return i==="{}"?s.toString():i}).join(" ")}static formatStack(e,n){if(e==="")return"";let s=e.split(`
|
|
2
2
|
`).map(i=>i.trim());switch(n){case Vt.ERROR:s=s.splice(e[0]==="Error"?4:3);break;case Vt.UNCAUGHT_ERROR:s=s.splice(e[0]==="Error"?3:2);break}return s!=null?` ${s.join(`
|
|
3
3
|
`)}`:""}constructor(e){this.history=[],this.offset=0,this.limit=1e4,this.isEnabled=!1,this.proxy=e,this.addHistory=this.addHistory.bind(this)}enable(){this.isEnabled||(this.proxy.addEventListener(Vt.DEBUG,this.addHistory),this.proxy.addEventListener(Vt.LOG,this.addHistory),this.proxy.addEventListener(Vt.WARN,this.addHistory),this.proxy.addEventListener(Vt.ERROR,this.addHistory),this.proxy.addEventListener(Vt.UNCAUGHT_ERROR,this.addHistory),this.isEnabled=!0)}disable(){!this.isEnabled||(this.proxy.removeEventListener(Vt.DEBUG,this.addHistory),this.proxy.removeEventListener(Vt.LOG,this.addHistory),this.proxy.removeEventListener(Vt.WARN,this.addHistory),this.proxy.removeEventListener(Vt.ERROR,this.addHistory),this.proxy.removeEventListener(Vt.UNCAUGHT_ERROR,this.addHistory),this.isEnabled=!1)}addHistory({type:e,detail:n}){const s={type:e,messages:n,time:new Date};switch(e){case Vt.ERROR:case Vt.UNCAUGHT_ERROR:s.stack=Error().stack;break}this.history[this.offset%this.limit]=s,this.offset+=1}getHistory(){if(this.offset>this.limit){const e=this.offset%this.limit;this.history=this.history.slice(e).concat(this.history.slice(0,e)),this.offset=this.limit}return this.history}getFormattedHistory(){return this.getHistory().map(n=>`${n.time.toISOString()} ${n.type} ${ml.formatMessages(n.messages)}`+(n.stack!=null?`
|
|
4
4
|
${ml.formatStack(n.stack,n.type)}`:"")).join(`
|
|
@@ -39,9 +39,9 @@ ${l} does not exist yet.`}if(i){const{widgetName:r}=this.props;return`${r} is un
|
|
|
39
39
|
${cl.makeCirclePath(s,i,pu)}
|
|
40
40
|
${cl.makeCirclePath(o,r,pu)}`,I=`link-select-clip-${l}`,R=Math.atan2(r-v,o-S),N=R-mu+Math.PI,F=R+mu+Math.PI,H=o+Math.cos(R)*uu,U=r+Math.sin(R)*uu,x=H+Math.cos(N)*Jr,A=U+Math.sin(N)*Jr,k=H+Math.cos(F)*Jr,W=U+Math.sin(F)*Jr,X=`${H},${U} ${x},${A} ${k},${W}`,V=.25*s+.5*S+.25*o,L=.25*i+.5*v+.25*r,K=S-s+(o-S),P=(v-i+(r-v))/K;let Z=20/Math.sqrt(1+P**2),se=Z*P,ae=Z*-1,j=se*-1;Number.isFinite(P)?P>0?(Z*=-1,se*=-1,ae*=-1,j*=-1,ae-=50-10*(Math.abs(u)%Hs),j+=10*(Math.abs(u)%Hs),Z-=50-10*(Math.abs(u)%Hs),se+=10*(Math.abs(u)%Hs)):P<0?(ae+=10*(Math.abs(u)%Hs),j+=10*(Math.abs(u)%Hs),Z+=10*(Math.abs(u)%Hs),se+=10*(Math.abs(u)%Hs)):(ae=15,j=10,Z=-25,se=10):(ae=10,j=5,Z=10,se=-35);let he="";return e!==void 0&&(e==="startsWith"?he="a*":e==="endsWith"?he="*z":he=_.getFilterOperatorString(e)),T(Te,{children:[T("svg",{className:$(t,{hovering:d}),children:[h("clipPath",{id:I,children:h("path",{d:E,clipRule:"evenodd"})}),h("path",{className:"link-select",d:y,onClick:this.handleClick,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave,clipPath:`url(#${I})`}),h("path",{className:"link-background",d:y}),h("path",{className:"link-foreground",d:y}),h("circle",{className:"link-dot",cx:s,cy:i,r:"5"}),h("polygon",{className:"link-triangle",points:X})]}),a!=null&&n&&T(Te,{children:[h(z,{kind:"primary",className:"btn-fab btn-operator",style:{top:L+(P>=0?se:j),left:V+(P>=0?Z:ae)},onClick:()=>{},icon:T("div",{className:"fa-md fa-layers",children:[h("b",{children:he}),h(te,{icon:Xn,transform:"right-8 down-9 shrink-5"})]}),tooltip:"Change comparison operator",children:h(_n,{actions:this.getDropdownActions,popperOptions:{placement:"bottom-start"}})}),h(z,{kind:"primary",className:"btn-fab btn-delete",style:{top:L+(P<0?se:j),left:V+(P<0?Z:ae)},onClick:this.handleDelete,icon:un,tooltip:"Delete"})]})]})}};let Ig=cl;Ig.defaultProps={className:"",isSelected:!1,onClick(){},onDelete(){}};const Ua=J.module("LinkerOverlayContent");class Rg extends w.exports.Component{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=Q.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,n){Ua.error("componentDidCatch",e,n)}componentWillUnmount(){window.removeEventListener("blur",this.handleBlur,!0),window.removeEventListener("mousemove",this.handleMouseMove,!0),window.removeEventListener("mouseup",this.handleMouseUp,!0),window.removeEventListener("keydown",this.handleKeyDown,!0),window.removeEventListener("keyup",this.handleKeyUp,!0),window.removeEventListener("resize",this.handleResize,!0)}getPointFromLinkPoint(e){const{panelManager:n}=this.props,{panelId:s,columnName:i}=e,o=n.getOpenedPanelById(s);if(o!=null){if(!vg(o))throw new Error(`Panel does not have getCoordinateForColumn method: ${s}`);try{const l=o.getCoordinateForColumn(i);if(l!=null)return l}catch{Ua.error("Could not get coordinate for column",i,o)}}const r=n.getContainerByPanelId(s);if(r==null)throw new Error(`Unable to find panel container for id: ${s}`);return oe.getTabPoint(r)}handleOperatorChanged(e,n){const{links:s,onLinksUpdated:i}=this.props,o=s.map(r=>r.id===e?{...r,operator:n}:r);i(o)}handleBlur(){this.setState({mode:"select"})}handleResize(){const{dialog:e}=this.state;if(e&&this.dialogRef.current){const n=this.dialogRef.current.getBoundingClientRect(),s=tt(e.x,0,window.innerWidth-n.width),i=tt(e.y,0,window.innerHeight-n.height);this.setState({dialog:{x:s,y:i}})}}handleMouseMove(e){const{offset:n,isDragging:s}=this.state;if(this.setState({mouse:{x:e.clientX,y:e.clientY}}),s&&this.dialogRef.current){const i=this.dialogRef.current.getBoundingClientRect(),o=tt(window.innerWidth-(e.clientX+i.width+n.x),0,window.innerWidth-i.width),r=tt(window.innerHeight-(e.clientY+i.height+n.y),0,window.innerHeight-i.height);this.setState({dialog:{x:o,y:r}})}}handleMouseDown(e){const n={x:0,y:0};if(this.dialogRef.current){const s=this.dialogRef.current.getBoundingClientRect();n.x=s.right-(s.width+e.clientX),n.y=s.bottom-(s.height+e.clientY)}this.setState({isDragging:!0,offset:n})}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:n,onLinkDeleted:s}=this.props;e.preventDefault(),n.forEach(i=>s(i))}}handleKeyUp(e){e.key==="Alt"&&(e.preventDefault(),this.setState({mode:"select"}))}handleEscapePressed(){const{onCancel:e}=this.props;e()}render(){const{disabled:e,links:n,selectedIds:s,messageText:i,onLinkSelected:o,onLinkDeleted:r,onAllLinksDeleted:l,onDone:a}=this.props,{mouse:d,dialog:c,isDragging:u,mode:m}=this.state,p=n.map(g=>{var f,b;try{const{id:C,type:S,isReversed:v,start:y,end:E,operator:I}=g,R=y.columnType;let[N,F]=this.getPointFromLinkPoint(y),H=(f=d==null?void 0:d.x)!=null?f:N,U=(b=d==null?void 0:d.y)!=null?b:F;if(E!=null&&([H,U]=this.getPointFromLinkPoint(E)),v!=null&&v){const[A,k]=[N,F];[N,F]=[H,U],[H,U]=[A,k]}const x=$("linker-link",{disabled:e},{"link-filter-source":S==="filterSource"},{"link-invalid":S==="invalid"},{interactive:g.end==null},{"link-is-selected":s.has(C)},{"danger-delete":m==="delete"});return{x1:N,y1:F,x2:H,y2:U,id:C,className:x,operator:I,startColumnType:R}}catch(C){return Ua.warn("Unable to get point for link",g,C),null}}).filter(g=>g!=null);return T("div",{className:$("linker-overlay",{"danger-delete":m==="delete"}),children:[p.map(({x1:g,y1:f,x2:b,y2:C,id:S,className:v,operator:y,startColumnType:E})=>h(Ig,{className:v,id:S,x1:g,y1:f,x2:b,y2:C,onClick:o,onDelete:r,isSelected:s.has(S),operator:y,startColumnType:E,onOperatorChanged:this.handleOperatorChanged},S)),T("div",{className:$("linker-toast-dialog",{dragging:u}),ref:this.dialogRef,style:{bottom:c==null?void 0:c.y,right:c==null?void 0:c.x},children:[h(z,{draggable:!0,kind:"inline",className:"btn-drag-handle",icon:ar,onClick:()=>{},onMouseDown:this.handleMouseDown,children:!u&&h(qe,{children:"Drag to reposition"})}),h("div",{className:"toast-body",children:i}),T("div",{className:"toast-footer",children:[h(z,{kind:"secondary",onClick:l,children:"Clear All"}),h(z,{kind:"primary",onClick:a,children:"Done"})]})]}),h(de,{actions:[{action:this.handleEscapePressed,shortcut:vs.LINKER_CLOSE,isGlobal:!0}]})]})}}Rg.defaultProps={disabled:"false"};const kt=J.module("Linker"),B2=(t,e)=>({activeTool:Xl(t),isolatedLinkerPanelId:fc(t,e.localDashboardId),links:So(t,e.localDashboardId),timeZone:dr(t)}),$2=Mt(B2,{setActiveTool:Zl,setDashboardLinks:bc,addDashboardLinks:K1,deleteDashboardLinks:q1,setDashboardIsolatedLinkerPanelId:ug,setDashboardColumnSelectionValidator:Y1});class z2 extends w.exports.Component{constructor(e){super(e),this.getCachedLinks=Se((n,s,i)=>{const o=[...n];return s!=null&&s.start!=null&&o.push(s),i!==void 0?o.filter(r=>{var l,a;return((l=r==null?void 0:r.start)==null?void 0:l.panelId)===i||((a=r==null?void 0:r.end)==null?void 0:a.panelId)===i||(r==null?void 0:r.end)==null}):o}),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:n,layout:s}=this.props;s!==e.layout&&(this.stopListening(e.layout),this.startListening(s)),n!==e.activeTool&&(this.updateSelectionValidators(),n===Xt.DEFAULT&&this.reset())}componentDidCatch(e,n){kt.error("componentDidCatch",e,n)}componentWillUnmount(){const{layout:e}=this.props;this.stopListening(e)}startListening(e){e.on("stateChanged",this.handleLayoutStateChanged);const{eventHub:n}=e;n.on(Rt.COLUMN_SELECTED,this.handleGridColumnSelect),n.on(Rt.DATA_SELECTED,this.handleUpdateValues),n.on(Rt.STATE_CHANGED,this.handleStateChange),n.on(oo.COLUMN_SELECTED,this.handleChartColumnSelect),n.on(De.CLONED,this.handlePanelCloned),n.on(Pe.COLUMN_SELECTED,this.handleFilterColumnSelect),n.on(Pe.COLUMNS_CHANGED,this.handleColumnsChanged),n.on(De.CLOSE,this.handlePanelClosed),n.on(De.CLOSED,this.handlePanelClosed),n.on(De.DRAGGING,this.handlePanelDragging),n.on(De.DROPPED,this.handlePanelDropped)}stopListening(e){e.off("stateChanged",this.handleLayoutStateChanged);const{eventHub:n}=e;n.off(Rt.COLUMN_SELECTED,this.handleGridColumnSelect),n.off(Rt.DATA_SELECTED,this.handleUpdateValues),n.off(Rt.STATE_CHANGED,this.handleStateChange),n.off(oo.COLUMN_SELECTED,this.handleChartColumnSelect),n.off(De.CLONED,this.handlePanelCloned),n.off(Pe.COLUMN_SELECTED,this.handleFilterColumnSelect),n.off(Pe.COLUMNS_CHANGED,this.handleColumnsChanged),n.off(De.CLOSE,this.handlePanelClosed),n.off(De.CLOSED,this.handlePanelClosed),n.off(De.DRAGGING,this.handlePanelDragging),n.off(De.DROPPED,this.handlePanelDropped)}reset(){this.setState({linkInProgress:void 0,selectedIds:new Set})}handleCancel(){const{linkInProgress:e}=this.state;if(e==null){const{setActiveTool:n}=this.props;n(Xt.DEFAULT)}this.setState({linkInProgress:void 0})}handleDone(){const{setActiveTool:e}=this.props;e(Xt.DEFAULT)}handleChartColumnSelect(e,n){this.columnSelected(e,n,!0)}handleFilterColumnSelect(e,n){kt.debug("handleFilterColumnSelect",this.isOverlayShown());const{links:s,localDashboardId:i,setActiveTool:o,setDashboardIsolatedLinkerPanelId:r}=this.props,l=oe.getIdFromPanel(e),a=s.filter(d=>{var c,u;return((c=d.start)==null?void 0:c.panelId)===l||((u=d.end)==null?void 0:u.panelId)===l});if(!this.isOverlayShown()&&l!=null){o(Xt.LINKER),r(i,l),a.length===0&&this.columnSelected(e,n,!0,l);return}this.columnSelected(e,n,!0)}handleColumnsChanged(e,n){kt.debug("handleColumnsChanged",e,n);const{links:s}=this.props,i=oe.getIdFromPanel(e);if(i==null){kt.error("Invalid panelId",e);return}const o=s.filter(({start:r,end:l})=>r.panelId===i&&ui.findColumn(n,r)==null||l!=null&&l.panelId===i&&ui.findColumn(n,l)==null);this.deleteLinks(o)}handleGridColumnSelect(e,n){if(!du(n)){kt.debug2("Column is not filterable");return}this.columnSelected(e,n)}columnSelected(e,n,s=!1,i){if(i===void 0&&!this.isOverlayShown())return;const{isolatedLinkerPanelId:o}=this.props,{linkInProgress:r}=this.state,l=oe.getIdFromPanel(e);if(l==null)return;const a=oe.getComponentNameFromPanel(e),{name:d,type:c}=n;if(r==null||r.start==null){const u={id:Ge.generate(),start:{panelId:l,panelComponent:a,columnName:d,columnType:c},type:"invalid",isReversed:s};kt.debug("starting link",u),this.setState({linkInProgress:u})}else{const{links:u}=this.props,{start:m,id:p,isReversed:g}=r,f={panelId:l,panelComponent:a,columnName:d,columnType:c},b=ui.getLinkType(g!==void 0&&g?f:m,g!==void 0&&g?m:f,i!=null?i:o);switch(b){case"invalid":kt.debug("Ignore invalid link connection",r,f);return;case"filterSource":{const S=g!==void 0&&g?m.panelId:f.panelId,v=u.filter(({end:y})=>(y==null?void 0:y.panelId)===S);this.deleteLinks(v);break}}const C={start:g!==void 0&&g?f:m,end:g!==void 0&&g?m:f,id:p,type:b,operator:q.eq};kt.info("creating link",C),this.setState({linkInProgress:void 0,selectedIds:new Set([p])},()=>{this.addLinks([C])})}}unsetFilterValueForLink(e){const{panelManager:n}=this.props;if(e.end){const{end:s}=e,{panelId:i,columnName:o,columnType:r}=s,l=n.getOpenedPanelById(i);l?au(l)?l.unsetFilterValue(o,r):kt.debug("endPanel.unsetFilterValue not implemented",l):kt.debug("endPanel no longer exists, ignoring unsetFilterValue",i)}}setPanelFilterMap(e,n){kt.debug("Set filter data for panel:",e,n);const{panelManager:s}=this.props,i=s.getOpenedPanelById(e);i?au(i)?i.setFilterMap(n):kt.debug("panel.setFilterMap not implemented",e,i):kt.debug("panel no longer exists, ignoring setFilterMap",e)}addLinks(e){const{addDashboardLinks:n,localDashboardId:s}=this.props;n(s,e)}deleteLinks(e,n=!1){const{localDashboardId:s}=this.props;if(e.forEach(i=>this.unsetFilterValueForLink(i)),n){const{setDashboardLinks:i}=this.props;i(s,[])}else if(e.length>0){const{deleteDashboardLinks:i}=this.props;i(s,e.map(({id:o})=>o))}}handleAllLinksDeleted(){const{links:e,isolatedLinkerPanelId:n}=this.props;if(n===void 0)this.deleteLinks(e,!0);else{const s=e.filter(i=>{var o,r;return((o=i==null?void 0:i.start)==null?void 0:o.panelId)===n||((r=i==null?void 0:i.end)==null?void 0:r.panelId)===n});this.deleteLinks(s)}this.reset()}handleLinkDeleted(e){const{links:n}=this.props,s=n.find(i=>i.id===e);s?this.deleteLinks([s]):kt.error("Unable to find link to delete",e)}handleUpdateValues(e,n){const s=oe.getIdFromPanel(e),{links:i,timeZone:o}=this.props,r=new Map;for(let l=0;l<i.length;l+=1){const{start:a,end:d,operator:c}=i[l];if(a.panelId===s&&d!=null){const{panelId:u,columnName:m,columnType:p}=d,g=r.has(u)?r.get(u):new Map,f=g.has(m)===!0?g.get(m).filterList:[],{visibleIndex:b,isExpandable:C,isGrouped:S}=n[a.columnName];let{value:v}=n[a.columnName],y=`${v}`;v===null&&C&&S&&(v=void 0),p!=null&&_.isDateType(p)&&(y=new ot({timeZone:o,showTimeZone:!1,showTSeparator:!0,defaultDateTimeFormatString:es.FULL_DATE_FORMAT}).format(v));const E={operator:c,text:y,value:v,startColumnIndex:b};f.push(E),g.set(m,{columnType:p,filterList:f}),r.set(u,g)}}r.forEach((l,a)=>{this.setPanelFilterMap(a,l)})}handlePanelCloned(e,n){const{links:s}=this.props,i=oe.getIdFromPanel(e),o=n.id;if(i!=null){const r=ui.cloneLinksForPanel(s,i,o);this.addLinks(r)}}handlePanelDragging(e){const{links:n}=this.props;for(let s=0;s<n.length;s+=1){const i=n[s],{start:o,end:r}=i;if(o.panelId===e||(r==null?void 0:r.panelId)===e){this.setState({isDraggingPanel:!0});return}}}handlePanelDropped(){this.setState({isDraggingPanel:!1})}handlePanelClosed(e){kt.debug(`Panel ${e} closed, deleting links.`),this.deleteLinksForPanelId(e)}handleLinkSelected(e){this.setState({selectedIds:new Set([e])})}handleLinksUpdated(e){const{localDashboardId:n,setDashboardLinks:s}=this.props;s(n,e)}handleLayoutStateChanged(){this.forceUpdate()}handleStateChange(){this.forceUpdate()}handleExited(){const{localDashboardId:e,setDashboardIsolatedLinkerPanelId:n}=this.props;n(e,void 0)}deleteLinksForPanelId(e){const{links:n}=this.props;for(let s=0;s<n.length;s+=1){const i=n[s],{start:o,end:r,id:l}=i;(o.panelId===e||(r==null?void 0:r.panelId)===e)&&this.handleLinkDeleted(l)}}isOverlayShown(){const{activeTool:e}=this.props;return e===Xt.LINKER}updateSelectionValidators(){const{activeTool:e,setDashboardColumnSelectionValidator:n,localDashboardId:s}=this.props;switch(e){case Xt.LINKER:n(s,this.isColumnSelectionValid);break;default:n(s,void 0);break}}updateLinkInProgressType(e,n="invalid"){this.setState({linkInProgress:{...e,type:n}})}isColumnSelectionValid(e,n){const{linkInProgress:s}=this.state,{isolatedLinkerPanelId:i}=this.props;if(n==null)return(s==null?void 0:s.start)!=null&&this.updateLinkInProgressType(s),!1;if(!du(n))return kt.debug2("Column is not filterable",n.description),(s==null?void 0:s.start)!=null&&this.updateLinkInProgressType(s,"invalid"),!1;if((s==null?void 0:s.start)==null)return!0;const{isReversed:o,start:r}=s,l=oe.getIdFromPanel(e);if(l==null)return!1;const a={panelId:l,panelComponent:oe.getComponentNameFromPanel(e),columnName:n.name,columnType:n.type},d=o!==void 0&&o?ui.getLinkType(a,r,i):ui.getLinkType(r,a,i);return this.updateLinkInProgressType(s,d),d!=="invalid"}render(){const{links:e,isolatedLinkerPanelId:n,panelManager:s}=this.props,{linkInProgress:i,selectedIds:o,isDraggingPanel:r}=this.state,l=this.isOverlayShown(),a=i!=null&&i.start!=null,d=n===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 r?null:h(gt,{in:l,timeout:ze.transitionMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,onExited:this.handleExited,children:h(Rg,{disabled:a,panelManager:s,links:this.getCachedLinks(e,i,n),selectedIds:o,messageText:d,onLinkSelected:this.handleLinkSelected,onLinkDeleted:this.handleLinkDeleted,onAllLinksDeleted:this.handleAllLinksDeleted,onLinksUpdated:this.handleLinksUpdated,onDone:this.handleDone,onCancel:this.handleCancel})})}}const W2=$2(z2);function G2(t){Xs(t);const{id:e,layout:n,panelManager:s}=t;return h(W2,{layout:n,localDashboardId:e,panelManager:s})}const md=class{static getNewMarkdownTitle(t){let e=`${md.DEFAULT_TITLE}`,n=0;for(;t.indexOf(e)>=0;)n+=1,e=`${md.DEFAULT_TITLE}-${n}`;return e}};let Zo=md;Zo.DEFAULT_TITLE="Note";Zo.DEFAULT_CONTENT=`# Markdown Note
|
|
41
41
|
|
|
42
|
-
This note can be edited using **markdown** for styling.`;function K2(t){Xs(t);const{id:e,layout:n,panelManager:s,registerComponent:i}=t,o=w.exports.useCallback(l=>{const{title:a,componentState:d,props:c}=l;let{panelState:u=null}=c;return d!=null&&({panelState:u=null}=d),a==null||u==null||u.content==null||u.content.length===0||u.content===Zo.DEFAULT_CONTENT?null:Zd(l)},[]),r=w.exports.useCallback(({title:l="",metadata:a={},id:d=Ge.generate(),focusElement:c=oe.DEFAULT_FOCUS_SELECTOR,createNewStack:u=!1,dragEvent:m=null}={})=>{const p=s.getOpenedPanelConfigsOfType(Lo.COMPONENT),g=s.getClosedPanelConfigsOfType(Lo.COMPONENT),f=p.map(y=>{var E;return(E=y.title)!=null?E:""}),b=l!=null&&l!==""?l:Zo.getNewMarkdownTitle(f),C=g.length>0?null:Zo.DEFAULT_CONTENT,S={type:"react-component",component:Lo.COMPONENT,props:{id:d,metadata:a,panelState:{content:C},localDashboardId:e},title:b,id:d},{root:v}=n;oe.openComponent({root:v,config:S,focusElement:c,createNewStack:u,dragEvent:m})},[e,n,s]);return w.exports.useEffect(function(){const a=[i(Lo.COMPONENT,Lo,Qd,o)];return()=>{a.forEach(d=>d())}},[o,i]),Xe(n.eventHub,ag.OPEN,r),null}function q2(t){Xs(t);const{hydrate:e,id:n,layout:s,registerComponent:i}=t,o=w.exports.useCallback(({dragEvent:r,fetch:l,panelId:a=Ge.generate(),widget:d})=>{const{name:c,type:u}=d;if(u!==dh.VariableType.PANDAS)return;const m={name:c,table:c},p=()=>l().then(b=>uc.makeModel(b)),g={type:"react-component",component:jo.COMPONENT,props:{localDashboardId:n,id:a,metadata:m,makeModel:p},title:c,id:a},{root:f}=s;oe.openComponent({root:f,config:g,dragEvent:r})},[n,s]);return w.exports.useEffect(function(){const l=[i(jo.COMPONENT,jo,e)];return()=>{l.forEach(a=>a())}},[e,i]),Xe(s.eventHub,De.OPEN,o),null}class Tn{}Tn.DROPDOWN_FILTER="ControlType.DROPDOWN_FILTER";Tn.INPUT_FILTER="ControlType.INPUT_FILTER";Tn.MARKDOWN="ControlType.MARKDOWN";Tn.FILTER_SET_MANAGER="ControlType.FILTER_SET_MANAGER";const Y2=D.exports.shape({state:D.exports.shape({panelState:D.exports.shape({})})}),X2=D.exports.shape({panelId:D.exports.string.isRequired,columnName:D.exports.string.isRequired,columnType:D.exports.string.isRequired}),gu=D.exports.shape({panelId:D.exports.string.isRequired,columnName:D.exports.string.isRequired}),Dg=D.exports.shape({start:gu,end:gu,id:D.exports.string,isReversed:D.exports.bool}),j2=D.exports.arrayOf(Dg),Z2=D.exports.shape({name:D.exports.string.isRequired,operateAs:D.exports.string.isRequired,groups:D.exports.arrayOf(D.exports.string).isRequired,permissions:D.exports.shape({isSuperUser:D.exports.bool.isRequired,isQueryViewOnly:D.exports.bool.isRequired,isNonInteractive:D.exports.bool.isRequired,canUsePanels:D.exports.bool.isRequired,canCreateDashboard:D.exports.bool.isRequired,canCreateCodeStudio:D.exports.bool.isRequired,canCreateQueryMonitor:D.exports.bool.isRequired,canCopy:D.exports.bool.isRequired,canDownloadCsv:D.exports.bool.isRequired}).isRequired});Object.freeze({LinkPoint:X2,Link:Dg,Links:j2,Panel:Y2,User:Z2});const Q2=(t,e)=>t[e]===null?null:D.exports.bool,J2=(t,e)=>t[e]===null?null:D.exports.string;Object.freeze({nullableBoolean:Q2,nullableString:J2});J.module("StorageTableViewportUpdater");class fu{static makeSortConfig(e,n){return{column:e,direction:n}}static makeFilterConfig(e){const n=[],s=[];return e.forEach((i,o)=>{n.push(i),o>0&&s.push(jt.and)}),{filterItems:n,filterOperators:s}}static combineFilterConfigs(e,n,s=jt.and){return{filterItems:[...e.filterItems,...n.filterItems],filterOperators:[...e.filterOperators,s,...n.filterOperators]}}static makeFilterItem(e,n,s){return{columnName:e,type:n,value:s}}}const Va=J.module("PouchStorageTable"),ey="Deephaven.";Ru.plugin(Tf);function ty(t,e){switch(t){case q.in:case q.contains:return{$regex:new RegExp(`${e}`)};case q.inIgnoreCase:return{$regex:new RegExp(`${e}`,"i")};case q.eq:return{$eq:e};case q.notEq:return{$neq:e};case q.greaterThan:return{$gt:e};case q.greaterThanOrEqualTo:return{$gte:e};case q.lessThan:return{$lt:e};case q.lessThanOrEqualTo:return{$lte:e};case q.startsWith:return{$regex:new RegExp(`^(?${e}).*`)};default:throw new Error(`Unsupported type: ${t}`)}}function ny(t){const{filterItems:e,filterOperators:n}=t;let s=null;for(let i=0;i<e.length;i+=1){const o=e[i],{columnName:r,type:l,value:a}=o,d={[r]:ty(l,a)};if(i===0)s=d;else if(s!==null&&i-1<n.length){const c=n[i-1];if(c===jt.and)s={$and:[s,d]};else if(c===jt.or)s={$or:[s,d]};else throw new Error(`Unexpected filter operator ${c}, ${d}`)}}if(s==null)throw new Error(`Invalid filter config ${t}`);return s}function Ba(t=[]){return{$and:[...t.map(e=>ny(e)),{name:{$gt:null}},{id:{$gt:null}}]}}function sy(t,e=!1){var n;return[{id:e?"desc":"asc"},...(n=t==null?void 0:t.map(s=>({[s.column]:s.direction})))!=null?n:[]]}class iy{constructor(e){this.listeners=[],this.itemListeners=new Map,this.currentSize=0,this.currentReverse=!1,this.currentFilter=null,this.currentSort=null,this.db=new Ru(`${ey}${e}`),this.db._remote=!1,this.db.changes({live:!0,since:"now",include_docs:!0}).on("change",this.dbUpdate.bind(this)),this.db.createIndex({index:{fields:["id","name"]}}),this.refreshInfo()}onUpdate(e){return this.listeners=[...this.listeners,e],()=>{this.listeners=this.listeners.filter(n=>n!==e)}}onItemUpdate(e,n){return this.itemListeners.has(e)||this.itemListeners.set(e,[]),this.itemListeners.set(e,[...this.itemListeners.get(e),n]),this.refreshItem(e),()=>{this.itemListeners.set(e,this.itemListeners.get(e).filter(s=>s!==n))}}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(){var e;return this.viewportUpdatePromise||this.refreshData(),(e=this.viewportUpdatePromise)!=null?e:Promise.resolve({items:[],offset:0})}async put(e){const n={...e,_id:e.id};return await this.db.put(n),n}sendUpdate(){var s;const{listeners:e}=this,n=(s=this.currentViewportData)!=null?s:{items:[],offset:0};for(let i=0;i<e.length;i+=1)e[i](n)}sendItemUpdate(e){const n=this.itemListeners.get(e.id);if(n!==void 0)for(let s=0;s<n.length;s+=1)n[s](e)}dbUpdate(e){Va.debug("Update received",e),this.refreshInfo(),e.doc!==void 0&&this.sendItemUpdate(e.doc),this.refreshData()}async refreshInfo(){var e,n;try{(e=this.infoUpdatePromise)==null||e.cancel(),this.infoUpdatePromise=ye.makeCancelable(this.db.find({selector:Ba((n=this.currentFilter)!=null?n:[]),fields:[]}));const s=await this.infoUpdatePromise;this.currentSize=s.docs.length,this.sendUpdate()}catch(s){if(!ye.isCanceled(s))throw Va.error("Unable to refreshInfo",s),s}}async refreshData(){var e,n;if(!!this.currentViewport)try{const{currentViewport:s}=this,i=sy(this.currentSort,this.currentReverse);(e=this.viewportUpdatePromise)==null||e.cancel(),this.viewportUpdatePromise=ye.makeCancelable(this.db.find({selector:Ba((n=this.currentFilter)!=null?n:[]),skip:s.top,limit:s.bottom-s.top+1,sort:i,fields:["id","name"]}).then(r=>({items:r.docs,offset:s.top})));const o=await this.viewportUpdatePromise;return this.currentViewportData=o,this.sendUpdate(),o}catch(s){if(!ye.isCanceled(s))throw Va.error("Unable to refreshData",s),s}}async refreshItem(e){const s=(await this.db.find({selector:{id:e},limit:1})).docs[0];return s!==void 0&&this.sendItemUpdate(s),s}async getSnapshot(e){const n=new Map,s=[{id:this.currentReverse?"desc":"asc"}];return await Promise.all(e.map(async([i,o])=>{var l;const r=o-i+1;return this.db.find({selector:Ba((l=this.currentFilter)!=null?l:[]),skip:i,limit:r,sort:s,fields:["id","name"]}).then(a=>{for(let d=0;d<r;d+=1){const c=i+d;n.set(c,a.docs[d])}})})),n}}class Cu extends iy{constructor(e){super(`CommandHistoryStorage.${e}`)}setSearch(e){this.setFilters(e?[fu.makeFilterConfig([fu.makeFilterItem("name",q.contains,e)])]:[])}}const bu=J.module("PouchCommandHistoryStorage");class oy{constructor(){this.updateTableMap=new Map}getUpdateTable(e){return this.updateTableMap.has(e)||this.updateTableMap.set(e,new Cu(e)),this.updateTableMap.get(e)}async getTable(e){return new Cu(e)}async addItem(e,n,s,i){return this.updateItem(e,{id:`${new Date().getTime()}`,name:s,data:i})}async updateItem(e,n){const s=this.getUpdateTable(e),i=await s.refreshItem(n.id),o={...i!=null?i:{},...n};return bu.debug("Updating item",o),await s.put(o),bu.debug("Update saved"),n}listenItem(e,n,s){return this.getUpdateTable(e).onItemUpdate(n,s)}}const Mg="SET_LAYOUT_STORAGE",ry=t=>({type:Mg,payload:t}),Ng="/ide/assets/community-wordmark-app.d2c5c1eb.svg";const ly=J.module("FormattingSectionContent");function ay(t){return t.formatString!=null}function pd(t){const e=t==null?void 0:t.querySelector("input, select, textarea");e&&e.focus()}function Fg(t,e){return t.defaultFormatString===e.defaultFormatString}function dy(t,e){return Fg(t,e)}function cy(t,e){return Fg(t,e)}function xg(t){return t!==""&&In.isValidColumnName(t)}function Ws(t,e){if(!t||e.formatString==null||!ay(e))return!1;switch(t){case"datetime":return ot.isValid(e);case"decimal":return _e.isValid(e);case"int":return et.isValid(e);default:return ly.warn("Trying to validate format of unknown type"),!0}}function _g(t){const{id:e,isNewRule:n,...s}=t;return s}function kg(t){return xg(t.columnName)&&Ws(t.columnType,t.format)}function Og(t){const{timestamp:e,timeZone:n,showTimeZone:s,showTSeparator:i,isGlobalOptions:o,legacyGlobalFormat:r}=t,l=new hn([],{timeZone:n,showTimeZone:s,showTSeparator:i}),a=o?ot.getGlobalFormats(s,i):ot.getFormats(s,i);return r!=null&&!a.includes(r)&&a.unshift(r),h(Te,{children:a.map(d=>{const c=ot.makeFormat("",d,ot.TYPE_GLOBAL);return h("option",{value:d,"data-testid":"time-format",children:l.getFormattedString(e,_.dataType.DATETIME,"",c)},d)})})}function hy(){return h(Te,{children:Nn.TIME_ZONES.map(t=>{const{label:e,value:n}=t;return h("option",{value:n,children:e},n)})})}const ii=J.module("FormattingSectionContent"),Ag=class extends w.exports.PureComponent{constructor(t){super(t),this.getCachedDateTimeFormatOptions=be((c,u,m,p=!1,g)=>{const{timestampAtMenuOpen:f}=this.state;return h(Og,{timestamp:f,timeZone:c,showTimeZone:u,showTSeparator:m,isGlobalOptions:p,legacyGlobalFormat:g})}),this.debouncedCommitChanges=Je(this.commitChanges.bind(this),Ag.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:e,defaultDateTimeFormat:n,defaultDecimalFormatOptions:s,defaultIntegerFormatOptions:i,showTimeZone:o,showTSeparator:r,timeZone:l,truncateNumbersWithPound:a}=t,d=e.map((c,u)=>({...c,id:u}));this.containerRef=Q.createRef(),this.state={formatSettings:d,showTimeZone:o,showTSeparator:r,timeZone:l,defaultDateTimeFormat:n,defaultDecimalFormatOptions:s,defaultIntegerFormatOptions:i,truncateNumbersWithPound:a,timestampAtMenuOpen:new Date}}componentDidMount(){pd(this.containerRef.current)}componentWillUnmount(){this.debouncedCommitChanges.flush()}handleDefaultDateTimeFormatChange(t){ii.debug("handleDefaultDateTimeFormatChange",t.target.value),this.setState({defaultDateTimeFormat:t.target.value},()=>{this.debouncedCommitChanges()})}handleDefaultDecimalFormatChange(t){ii.debug("handleDefaultDecimalFormatChange",t.target.value),this.setState({defaultDecimalFormatOptions:{defaultFormatString:t.target.value}},()=>{this.debouncedCommitChanges()})}handleDefaultIntegerFormatChange(t){ii.debug("handleDefaultIntegerFormatChange",t.target.value),this.setState({defaultIntegerFormatOptions:{defaultFormatString:t.target.value}},()=>{this.debouncedCommitChanges()})}handleShowTimeZoneChange(){this.setState(t=>({showTimeZone:!t.showTimeZone}),()=>{this.debouncedCommitChanges()})}handleShowTSeparatorChange(){this.setState(t=>({showTSeparator:!t.showTSeparator}),()=>{this.debouncedCommitChanges()})}handleTimeZoneChange(t){this.setState({timeZone:t.target.value},()=>{this.debouncedCommitChanges()})}handleResetDateTimeFormat(){const{defaults:t}=this.props,{defaultDateTimeFormat:e,showTimeZone:n,showTSeparator:s}=t;ii.debug("handleResetDateTimeFormat"),this.setState({defaultDateTimeFormat:e,showTimeZone:n,showTSeparator:s},()=>{this.debouncedCommitChanges()})}handleResetTimeZone(){const{defaults:t}=this.props,{timeZone:e}=t;ii.debug("handleResetTimeZone"),this.setState({timeZone:e},()=>{this.debouncedCommitChanges()})}handleResetDecimalFormat(){const{defaults:t}=this.props,{defaultDecimalFormatOptions:e}=t;ii.debug("handleResetDecimalFormat"),this.setState({defaultDecimalFormatOptions:e},()=>{this.debouncedCommitChanges()})}handleResetIntegerFormat(){const{defaults:t}=this.props,{defaultIntegerFormatOptions:e}=t;ii.debug("handleResetIntegerFormat"),this.setState({defaultIntegerFormatOptions:e},()=>{this.debouncedCommitChanges()})}handleTruncateNumbersWithPoundChange(){this.setState(t=>({truncateNumbersWithPound:!t.truncateNumbersWithPound}),()=>{this.debouncedCommitChanges()})}commitChanges(){var m;const{formatSettings:t,defaultDateTimeFormat:e,showTimeZone:n,showTSeparator:s,timeZone:i,defaultDecimalFormatOptions:o,defaultIntegerFormatOptions:r,truncateNumbersWithPound:l}=this.state,a=(m=t.filter(kg).map(_g))!=null?m:[],{settings:d,saveSettings:c}=this.props,u={...d,formatter:a,defaultDateTimeFormat:e,showTimeZone:n,showTSeparator:s,timeZone:i,truncateNumbersWithPound:l};Ws(_.dataType.DECIMAL,_e.makeCustomFormat(o.defaultFormatString))&&(u.defaultDecimalFormatOptions=o),Ws(_.dataType.INT,et.makeCustomFormat(r.defaultFormatString))&&(u.defaultIntegerFormatOptions=r),c(u)}render(){const{defaults:t}=this.props,{defaultDateTimeFormat:e,defaultDecimalFormatOptions:n,defaultIntegerFormatOptions:s,timeZone:i,showTimeZone:o,showTSeparator:r,truncateNumbersWithPound:l}=this.state,{defaultFormatString:a=_e.DEFAULT_FORMAT_STRING}=n!=null?n:{},{defaultFormatString:d=et.DEFAULT_FORMAT_STRING}=s!=null?s:{},c=i===t.timeZone,u=r===t.showTSeparator&&o===t.showTimeZone&&e===t.defaultDateTimeFormat,m=dy(n,t.defaultDecimalFormatOptions),p=cy(s,t.defaultIntegerFormatOptions);return h("div",{className:"app-settings-formatting-section",ref:this.containerRef,children:T("div",{className:"container-fluid p-0",children:[h("div",{children:"Default formatting for column types"}),h("div",{className:"app-settings-menu-description mb-3",children:"Applies a formatting rule to all columns of a set type."}),T("div",{className:"form-row mb-2",children:[h("label",{className:"col-form-label col-3",htmlFor:"select-reset-timezone",children:"Time zone"}),h("div",{className:"col pr-0",children:h("select",{className:"custom-select",value:i,onChange:this.handleTimeZoneChange,id:"select-reset-timezone",children:h(hy,{})})}),h("div",{className:"col-1 btn-col",children:h(z,{kind:"ghost",icon:mi,onClick:this.handleResetTimeZone,tooltip:"Reset Time Zone",className:$("btn-reset","btn-reset-time-zone",{hidden:c})})})]}),T("div",{className:"form-row mb-2",children:[h("label",{className:"col-form-label col-3",htmlFor:"select-default-time-format",children:"DateTime"}),h("div",{className:"col pr-0",children:h("select",{className:"custom-select",value:e,onChange:this.handleDefaultDateTimeFormatChange,id:"select-default-time-format",children:this.getCachedDateTimeFormatOptions(i,o,r,!0,e)})}),h("div",{className:"col-1 btn-col",children:h(z,{kind:"ghost",icon:mi,onClick:this.handleResetDateTimeFormat,tooltip:"Reset DateTime Options",className:$("btn-reset","btn-reset-date-time",{hidden:u})})})]}),h("div",{className:"form-row",children:h("div",{className:"offset-3 col-9",children:h(vt,{checked:o!=null?o:null,onChange:this.handleShowTimeZoneChange,children:"Show time zone in dates"})})}),h("div",{className:"form-row mb-3",children:h("div",{className:"offset-3 col-9",children:h(vt,{checked:r!=null?r:null,onChange:this.handleShowTSeparatorChange,children:"Show 'T' separator"})})}),T("div",{className:"form-row mb-2",children:[h("label",{className:"col-form-label col-3",htmlFor:"default-decimal-format-input",children:"Decimal"}),h("div",{className:"col pr-0",children:h("input",{className:$("form-control","flex-grow-1","default-decimal-format-input",{"is-invalid":!Ws(_.dataType.DECIMAL,_e.makeCustomFormat(a))}),"data-lpignore":!0,placeholder:_e.DEFAULT_FORMAT_STRING,type:"text",id:"default-decimal-format-input",value:a,onChange:this.handleDefaultDecimalFormatChange})}),h("div",{className:"col-1 btn-col",children:h(z,{kind:"ghost",icon:mi,onClick:this.handleResetDecimalFormat,tooltip:"Reset Decimal Formatting",className:$("btn-reset","btn-reset-decimal",{hidden:m}),"data-testid":"btn-reset-decimal"})})]}),T("div",{className:"form-row mb-2",children:[h("label",{className:"col-form-label col-3",htmlFor:"default-integer-format-input",children:"Integer"}),h("div",{className:"col pr-0",children:h("input",{className:$("form-control","flex-grow-1","default-integer-format-input",{"is-invalid":!Ws(_.dataType.INT,et.makeCustomFormat(d))}),"data-lpignore":!0,placeholder:et.DEFAULT_FORMAT_STRING,type:"text",id:"default-integer-format-input",value:d,onChange:this.handleDefaultIntegerFormatChange})}),h("div",{className:"col-1 btn-col",children:h(z,{kind:"ghost",icon:mi,onClick:this.handleResetIntegerFormat,tooltip:"Reset Integer Formatting",className:$("btn-reset","btn-reset-integer",{hidden:p}),"data-testid":"btn-reset-integer"})})]}),h("div",{className:"form-row mb-3",children:h("div",{className:"offset-3 col-9",children:h(vt,{checked:l!=null?l:null,onChange:this.handleTruncateNumbersWithPoundChange,children:"Truncate numbers with #"})})})]})})}};let Nc=Ag;Nc.defaultProps={scrollTo:()=>{},defaults:{defaultDateTimeFormat:ot.DEFAULT_DATETIME_FORMAT_STRING,defaultDecimalFormatOptions:{defaultFormatString:_e.DEFAULT_FORMAT_STRING},defaultIntegerFormatOptions:{defaultFormatString:et.DEFAULT_FORMAT_STRING},showTimeZone:!1,showTSeparator:!0,timeZone:ot.DEFAULT_TIME_ZONE_ID}};Nc.inputDebounceTime=250;const uy=t=>({formatter:$m(t),defaultDateTimeFormat:Um(t),defaultDecimalFormatOptions:Vm(t),defaultIntegerFormatOptions:Bm(t),showTimeZone:zm(t),showTSeparator:Wm(t),truncateNumbersWithPound:Gm(t),timeZone:dr(t),settings:Nt(t)}),my=Mt(uy,{saveSettings:jl})(Nc);function py(){const[t,e]=w.exports.useState(!1),n=()=>{e(!t)};return T(z,{kind:"ghost",onClick:n,icon:HC,children:["Legal Notices",T(sr,{isOpen:t,toggle:n,className:"theme-bg-light",children:[h(or,{toggle:n,children:"Legal Notice"}),T(ir,{children:[h("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,495; 9,836,494; 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,353,893; 10,346,394; 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; and 10,783,191. Other patents pending."}),T("p",{children:["\xA9 2016-",new Date().getFullYear()," Deephaven Data Labs LLC. Patent Pending."]})]})]})]})}function Qo(t){const{children:e,isExpanded:n,sectionKey:s,title:i,onToggle:o}=t;return T(Te,{children:[h("div",{children:T(z,{kind:"ghost",className:"btn-collapse-trigger",onClick:()=>o(s),children:[h("div",{className:"flex-grow-1",children:i}),h("div",{className:"flex-shrink-0",children:h(te,{transform:n?"flip-v":"",icon:Xn})})]})}),h(Ad,{in:n,autoFocusOnShow:!0,children:e})]})}Qo.propTypes={children:D.exports.node,isExpanded:D.exports.bool.isRequired,sectionKey:D.exports.string.isRequired,title:D.exports.node.isRequired,onToggle:D.exports.func};Qo.defaultProps={children:null,onToggle:()=>{}};function gy({shortcut:t,displayText:e,categoryName:n,onChange:s}){const[i,o]=w.exports.useState(e),[r,l]=w.exports.useState(t.getKeyState()),[a,d]=w.exports.useState(!1),[c,u]=w.exports.useState("");w.exports.useEffect(function(){o(e),l(t.getKeyState())},[e,t]),w.exports.useEffect(function(){o(qt.getDisplayText(r)),t.matchesKeyState(r)&&d(!1)},[r,t]),w.exports.useEffect(function(){if(a){if(!qt.isValidKeyState(r)){qt.isAllowedKey(r.keyValue)?u("Must contain a modifier key"):u("Must contain an allowed action key");return}const y=Le.getConflictingShortcuts(r).filter(E=>E.id.startsWith(n)&&E!==t).map(E=>E.name);if(y.length){u(`Conflicts with ${y.join(", ")}`);return}u("")}else u("")},[a,r,n,t]);function m(v){if(v.stopPropagation(),v.preventDefault(),t.isEditable&&!v.repeat){const y=qt.getKeyStateFromEvent(v),E=qt.createKeyState([ge.BACKSPACE]);qt.doKeyStatesMatch(y,E)?l(qt.NULL_KEY_STATE):l(y)}}function p(v){v.stopPropagation(),v.preventDefault(),t.matchesKeyState(r)||d(!0)}function g(){We.disableAllActions()}function f(){We.enableAllActions()}function b(){t.setKeyState(r),d(!1),s(t)}function C(){const v=t.getKeyState();l(v),d(!1)}function S(){d(!0),l(t.getDefaultKeyState())}return T(Te,{children:[T("div",{className:"shortcut-item-container",children:[T("label",{className:"shortcut-item-name",children:[t.name,t.tooltip!==void 0&&h(qe,{children:t.tooltip})]}),T("div",{className:"shortcut-item-input-container",children:[h("input",{className:$("form-control",{"is-invalid":c}),onKeyDown:m,onKeyUp:p,onFocus:g,onBlur:f,disabled:!t.isEditable,value:i,readOnly:!0}),!qt.doKeyStatesMatch(r,t.getDefaultKeyState())&&!c&&h(z,{className:"reset-to-default-button",kind:"ghost",icon:h(te,{icon:mi,transform:{rotate:90,flipX:!0}}),tooltip:"Reset to default",onClick:S})]})]}),a&&T("div",{className:$("shortcut-item-message-container",{"is-invalid":c}),children:[h("div",{className:"shortcut-item-message",children:c}),T("div",{className:"shortcut-item-message-buttons",children:[qt.isValidKeyState(r)&&h(z,{kind:"ghost",onClick:b,children:"Confirm"}),h(z,{kind:"ghost",onClick:C,children:"Undo"})]})]})]})}function fy({shortcutOverrides:t={},settings:e,saveSettings:n}){const s=w.exports.useCallback(l=>{const a=qt.isMacPlatform,d={mac:{...t.mac},windows:{...t.windows}},c=a?d.mac:d.windows;l.forEach(u=>{u.isDefault()?delete c[u.id]:c[u.id]=u.getKeyState()}),n({...e,shortcutOverrides:d})},[e,n,t]);let i=Array.from(Le.shortcutsByCategory.entries()).map(([l,a])=>({name:l,shortcuts:a}));const o=i.findIndex(l=>l.name.toUpperCase()==="GLOBAL"),r=i.splice(o,1);return i=i.concat(r),T(Te,{children:[h("div",{className:"app-settings-menu-description",children:"Customize shortcuts below. Assigning shortcuts that conflict with the browser or IDE shortcuts may cause unintended behavior"}),i.map(l=>h(Cy,{name:l.name,shortcuts:l.shortcuts,saveShortcutOverrides:s},l.name))]})}function Cy({name:t,shortcuts:e,saveShortcutOverrides:n}){function s(a){return a.split("_").map(d=>`${d[0].toUpperCase()}${d.slice(1).toLowerCase()}`).join(" ")}const[i,o]=w.exports.useState(e);function r(a){const d=i.filter(u=>u!==a&&!u.isNull()&&u.matchesKeyState(a.getKeyState()));d.forEach(u=>u.setToNull());const c=[a,...d];n(c),o(u=>[...u])}const l=w.exports.useMemo(()=>i.map(a=>a.getDisplayText()),[i]);return T("div",{className:"mt-3",children:[h("div",{className:"font-weight-bold",children:s(t)}),i.map((a,d)=>h(gy,{shortcut:a,displayText:l[d],categoryName:t,onChange:r},a.id))]})}const by=t=>({settings:Nt(t),shortcutOverrides:F0(t)}),Sy={saveSettings:jl},wy=Mt(by,Sy)(fy),gd=new cC,fd=new ml(gd);function vy(){J.setLogLevel(parseInt("2",10)),gd.enable(),fd.enable(),window!=null&&(window.DHLog=J,window.DHLogProxy=gd,window.DHLogHistory=fd)}const Ty="yyyy-MM-dd-HHmmss";function Lg(t,e="root",n=new Map([[t,""]])){const s={};return Object.entries(t).forEach(([i,o])=>{try{JSON.stringify(o),s[i]=o}catch{const l=o;if(typeof o=="bigint")s[i]=o.toString();else if(n.has(l))s[i]=`Circular ref to ${n.get(l)}`;else{const a=`${e}.${i}`;n.set(l,a),s[i]=Lg(o,a,n)}}}),s}function Ey(){const t=Ql.getState();return JSON.stringify(Lg(t),null,2)}function yy(t){const e={uiVersion:"0.29.0",userAgent:navigator.userAgent,...t};return JSON.stringify(e,null,2)}async function Iy(t=`${M.i18n.DateTimeFormat.format(Ty,new Date)}_support_logs`,e){const n=new Du,s=n.folder(t);s.file("console.txt",fd.getFormattedHistory()),s.file("redux.json",Ey()),s.file("metadata.json",yy(e));const i=await n.generateAsync({type:"blob"}),o=document.createElement("a");o.href=URL.createObjectURL(i),o.download=`${t}.zip`,o.click()}const Ry=[{value:_.dataType.DATETIME,label:"DateTime"},{value:_.dataType.DECIMAL,label:"Decimal"},{value:_.dataType.INT,label:"Integer"}];function Dy(){const t=Ry.map(e=>h("option",{value:e.value,children:e.label},`key-columnType-${e.value}`));return T(Te,{children:[h("option",{disabled:!0,value:"",children:"Select Type"},"key-columnType-placeholder"),t]})}const Pg=class extends w.exports.PureComponent{constructor(t){super(t),this.getCachedColumnTypeOptions=be(()=>h(Dy,{})),this.getCachedDateTimeFormatOptions=be((c,u,m,p=!1,g)=>{const{timestampAtMenuOpen:f}=this.state;return h(Og,{timestamp:f,timeZone:c,showTimeZone:u,showTSeparator:m,isGlobalOptions:p,legacyGlobalFormat:g})}),this.debouncedCommitChanges=Je(this.commitChanges.bind(this),Pg.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:e,defaultDateTimeFormat:n,defaultDecimalFormatOptions:s,defaultIntegerFormatOptions:i,showTimeZone:o,showTSeparator:r,timeZone:l,truncateNumbersWithPound:a}=t,d=e.map((c,u)=>({...c,id:u}));this.containerRef=Q.createRef(),this.addFormatRuleButtonRef=Q.createRef(),this.lastFormatRuleIndex=d.length,this.state={formatSettings:d,formatRulesChanged:!1,showTimeZone:o,showTSeparator:r,timeZone:l,defaultDateTimeFormat:n,defaultDecimalFormatOptions:s,defaultIntegerFormatOptions:i,truncateNumbersWithPound:a,timestampAtMenuOpen:new Date}}componentDidMount(){pd(this.containerRef.current)}componentWillUnmount(){this.debouncedCommitChanges.flush()}isDuplicateRule(t){var n;const{formatSettings:e}=this.state;return(n=e.some(s=>s.id!==t.id&&s.columnName===t.columnName&&s.columnType===t.columnType))!=null?n:!1}getAutoIncrementFormatRuleIndex(){const{lastFormatRuleIndex:t}=this;return this.lastFormatRuleIndex+=1,t}handleFormatRuleChange(t,e,n){this.setState(s=>{const{formatSettings:i}=s;O(i);const o=[...i];let r={};e==="columnType"&&(r={format:""});const l={...o[t],...r,[e]:n};return o[t]=l,{formatSettings:o}},()=>{this.debouncedCommitChanges()})}handleFormatRuleCreate(){this.setState(t=>{const{formatSettings:e}=t,n={columnType:_.dataType.DATETIME,columnName:"",format:{},id:this.getAutoIncrementFormatRuleIndex(),isNewRule:!0};return{formatSettings:e!=null?[...e,n]:[n],formatRulesChanged:!0}})}handleFormatRuleDelete(t){this.setState(e=>{const{formatSettings:n}=e;return{formatSettings:n.filter((i,o)=>o!==t),formatRulesChanged:!0}},()=>{this.debouncedCommitChanges()})}handleFormatRuleEntered(t){this.scrollToFormatBlockBottom(),pd(t)}commitChanges(){var m;const{formatSettings:t,defaultDateTimeFormat:e,showTimeZone:n,showTSeparator:s,timeZone:i,defaultDecimalFormatOptions:o,defaultIntegerFormatOptions:r,truncateNumbersWithPound:l}=this.state,a=(m=t.filter(kg).map(_g))!=null?m:[],{settings:d,saveSettings:c}=this.props,u={...d,formatter:a,defaultDateTimeFormat:e,showTimeZone:n,showTSeparator:s,timeZone:i,truncateNumbersWithPound:l};Ws(_.dataType.DECIMAL,_e.makeCustomFormat(o.defaultFormatString))&&(u.defaultDecimalFormatOptions=o),Ws(_.dataType.INT,et.makeCustomFormat(r.defaultFormatString))&&(u.defaultIntegerFormatOptions=r),c(u)}scrollToFormatBlockBottom(){var e,n,s,i;const{scrollTo:t}=this.props;t(0,((n=(e=this.addFormatRuleButtonRef.current)==null?void 0:e.offsetHeight)!=null?n:0)+((i=(s=this.addFormatRuleButtonRef.current)==null?void 0:s.offsetTop)!=null?i:0))}getRuleError(t){const e={hasColumnNameError:!1,hasFormatError:!1,message:""},n=[];return t.isNewRule!==void 0&&t.isNewRule||(this.isDuplicateRule(t)&&(e.hasColumnNameError=!0,n.push("Duplicate column name/type combo.")),xg(t.columnName)||(e.hasColumnNameError=!0,n.push("Column names must start with a letter or underscore and contain only alphanumeric characters or underscores.")),t.format.formatString!==void 0&&t.format.formatString.length===0?(e.hasFormatError=!0,n.push("Empty formatting rule.")):Ws(t.columnType,t.format)||(e.hasFormatError=!0,n.push("Invalid formatting rule.")),e.message=n.join(`
|
|
42
|
+
This note can be edited using **markdown** for styling.`;function K2(t){Xs(t);const{id:e,layout:n,panelManager:s,registerComponent:i}=t,o=w.exports.useCallback(l=>{const{title:a,componentState:d,props:c}=l;let{panelState:u=null}=c;return d!=null&&({panelState:u=null}=d),a==null||u==null||u.content==null||u.content.length===0||u.content===Zo.DEFAULT_CONTENT?null:Zd(l)},[]),r=w.exports.useCallback(({title:l="",metadata:a={},id:d=Ge.generate(),focusElement:c=oe.DEFAULT_FOCUS_SELECTOR,createNewStack:u=!1,dragEvent:m=null}={})=>{const p=s.getOpenedPanelConfigsOfType(Lo.COMPONENT),g=s.getClosedPanelConfigsOfType(Lo.COMPONENT),f=p.map(y=>{var E;return(E=y.title)!=null?E:""}),b=l!=null&&l!==""?l:Zo.getNewMarkdownTitle(f),C=g.length>0?null:Zo.DEFAULT_CONTENT,S={type:"react-component",component:Lo.COMPONENT,props:{id:d,metadata:a,panelState:{content:C},localDashboardId:e},title:b,id:d},{root:v}=n;oe.openComponent({root:v,config:S,focusElement:c,createNewStack:u,dragEvent:m})},[e,n,s]);return w.exports.useEffect(function(){const a=[i(Lo.COMPONENT,Lo,Qd,o)];return()=>{a.forEach(d=>d())}},[o,i]),Xe(n.eventHub,ag.OPEN,r),null}function q2(t){Xs(t);const{hydrate:e,id:n,layout:s,registerComponent:i}=t,o=w.exports.useCallback(({dragEvent:r,fetch:l,panelId:a=Ge.generate(),widget:d})=>{const{name:c,type:u}=d;if(u!==dh.VariableType.PANDAS)return;const m={name:c,table:c},p=()=>l().then(b=>uc.makeModel(b)),g={type:"react-component",component:jo.COMPONENT,props:{localDashboardId:n,id:a,metadata:m,makeModel:p},title:c,id:a},{root:f}=s;oe.openComponent({root:f,config:g,dragEvent:r})},[n,s]);return w.exports.useEffect(function(){const l=[i(jo.COMPONENT,jo,e)];return()=>{l.forEach(a=>a())}},[e,i]),Xe(s.eventHub,De.OPEN,o),null}class Tn{}Tn.DROPDOWN_FILTER="ControlType.DROPDOWN_FILTER";Tn.INPUT_FILTER="ControlType.INPUT_FILTER";Tn.MARKDOWN="ControlType.MARKDOWN";Tn.FILTER_SET_MANAGER="ControlType.FILTER_SET_MANAGER";const Y2=D.exports.shape({state:D.exports.shape({panelState:D.exports.shape({})})}),X2=D.exports.shape({panelId:D.exports.string.isRequired,columnName:D.exports.string.isRequired,columnType:D.exports.string.isRequired}),gu=D.exports.shape({panelId:D.exports.string.isRequired,columnName:D.exports.string.isRequired}),Dg=D.exports.shape({start:gu,end:gu,id:D.exports.string,isReversed:D.exports.bool}),j2=D.exports.arrayOf(Dg),Z2=D.exports.shape({name:D.exports.string.isRequired,operateAs:D.exports.string.isRequired,groups:D.exports.arrayOf(D.exports.string).isRequired,permissions:D.exports.shape({isSuperUser:D.exports.bool.isRequired,isQueryViewOnly:D.exports.bool.isRequired,isNonInteractive:D.exports.bool.isRequired,canUsePanels:D.exports.bool.isRequired,canCreateDashboard:D.exports.bool.isRequired,canCreateCodeStudio:D.exports.bool.isRequired,canCreateQueryMonitor:D.exports.bool.isRequired,canCopy:D.exports.bool.isRequired,canDownloadCsv:D.exports.bool.isRequired}).isRequired});Object.freeze({LinkPoint:X2,Link:Dg,Links:j2,Panel:Y2,User:Z2});const Q2=(t,e)=>t[e]===null?null:D.exports.bool,J2=(t,e)=>t[e]===null?null:D.exports.string;Object.freeze({nullableBoolean:Q2,nullableString:J2});J.module("StorageTableViewportUpdater");class fu{static makeSortConfig(e,n){return{column:e,direction:n}}static makeFilterConfig(e){const n=[],s=[];return e.forEach((i,o)=>{n.push(i),o>0&&s.push(jt.and)}),{filterItems:n,filterOperators:s}}static combineFilterConfigs(e,n,s=jt.and){return{filterItems:[...e.filterItems,...n.filterItems],filterOperators:[...e.filterOperators,s,...n.filterOperators]}}static makeFilterItem(e,n,s){return{columnName:e,type:n,value:s}}}const Va=J.module("PouchStorageTable"),ey="Deephaven.";Ru.plugin(Tf);function ty(t,e){switch(t){case q.in:case q.contains:return{$regex:new RegExp(`${e}`)};case q.inIgnoreCase:return{$regex:new RegExp(`${e}`,"i")};case q.eq:return{$eq:e};case q.notEq:return{$neq:e};case q.greaterThan:return{$gt:e};case q.greaterThanOrEqualTo:return{$gte:e};case q.lessThan:return{$lt:e};case q.lessThanOrEqualTo:return{$lte:e};case q.startsWith:return{$regex:new RegExp(`^(?${e}).*`)};default:throw new Error(`Unsupported type: ${t}`)}}function ny(t){const{filterItems:e,filterOperators:n}=t;let s=null;for(let i=0;i<e.length;i+=1){const o=e[i],{columnName:r,type:l,value:a}=o,d={[r]:ty(l,a)};if(i===0)s=d;else if(s!==null&&i-1<n.length){const c=n[i-1];if(c===jt.and)s={$and:[s,d]};else if(c===jt.or)s={$or:[s,d]};else throw new Error(`Unexpected filter operator ${c}, ${d}`)}}if(s==null)throw new Error(`Invalid filter config ${t}`);return s}function Ba(t=[]){return{$and:[...t.map(e=>ny(e)),{name:{$gt:null}},{id:{$gt:null}}]}}function sy(t,e=!1){var n;return[{id:e?"desc":"asc"},...(n=t==null?void 0:t.map(s=>({[s.column]:s.direction})))!=null?n:[]]}class iy{constructor(e){this.listeners=[],this.itemListeners=new Map,this.currentSize=0,this.currentReverse=!1,this.currentFilter=null,this.currentSort=null,this.db=new Ru(`${ey}${e}`),this.db._remote=!1,this.db.changes({live:!0,since:"now",include_docs:!0}).on("change",this.dbUpdate.bind(this)),this.db.createIndex({index:{fields:["id","name"]}}),this.refreshInfo()}onUpdate(e){return this.listeners=[...this.listeners,e],()=>{this.listeners=this.listeners.filter(n=>n!==e)}}onItemUpdate(e,n){return this.itemListeners.has(e)||this.itemListeners.set(e,[]),this.itemListeners.set(e,[...this.itemListeners.get(e),n]),this.refreshItem(e),()=>{this.itemListeners.set(e,this.itemListeners.get(e).filter(s=>s!==n))}}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(){var e;return this.viewportUpdatePromise||this.refreshData(),(e=this.viewportUpdatePromise)!=null?e:Promise.resolve({items:[],offset:0})}async put(e){const n={...e,_id:e.id};return await this.db.put(n),n}sendUpdate(){var s;const{listeners:e}=this,n=(s=this.currentViewportData)!=null?s:{items:[],offset:0};for(let i=0;i<e.length;i+=1)e[i](n)}sendItemUpdate(e){const n=this.itemListeners.get(e.id);if(n!==void 0)for(let s=0;s<n.length;s+=1)n[s](e)}dbUpdate(e){Va.debug("Update received",e),this.refreshInfo(),e.doc!==void 0&&this.sendItemUpdate(e.doc),this.refreshData()}async refreshInfo(){var e,n;try{(e=this.infoUpdatePromise)==null||e.cancel(),this.infoUpdatePromise=ye.makeCancelable(this.db.find({selector:Ba((n=this.currentFilter)!=null?n:[]),fields:[]}));const s=await this.infoUpdatePromise;this.currentSize=s.docs.length,this.sendUpdate()}catch(s){if(!ye.isCanceled(s))throw Va.error("Unable to refreshInfo",s),s}}async refreshData(){var e,n;if(!!this.currentViewport)try{const{currentViewport:s}=this,i=sy(this.currentSort,this.currentReverse);(e=this.viewportUpdatePromise)==null||e.cancel(),this.viewportUpdatePromise=ye.makeCancelable(this.db.find({selector:Ba((n=this.currentFilter)!=null?n:[]),skip:s.top,limit:s.bottom-s.top+1,sort:i,fields:["id","name"]}).then(r=>({items:r.docs,offset:s.top})));const o=await this.viewportUpdatePromise;return this.currentViewportData=o,this.sendUpdate(),o}catch(s){if(!ye.isCanceled(s))throw Va.error("Unable to refreshData",s),s}}async refreshItem(e){const s=(await this.db.find({selector:{id:e},limit:1})).docs[0];return s!==void 0&&this.sendItemUpdate(s),s}async getSnapshot(e){const n=new Map,s=[{id:this.currentReverse?"desc":"asc"}];return await Promise.all(e.map(async([i,o])=>{var l;const r=o-i+1;return this.db.find({selector:Ba((l=this.currentFilter)!=null?l:[]),skip:i,limit:r,sort:s,fields:["id","name"]}).then(a=>{for(let d=0;d<r;d+=1){const c=i+d;n.set(c,a.docs[d])}})})),n}}class Cu extends iy{constructor(e){super(`CommandHistoryStorage.${e}`)}setSearch(e){this.setFilters(e?[fu.makeFilterConfig([fu.makeFilterItem("name",q.contains,e)])]:[])}}const bu=J.module("PouchCommandHistoryStorage");class oy{constructor(){this.updateTableMap=new Map}getUpdateTable(e){return this.updateTableMap.has(e)||this.updateTableMap.set(e,new Cu(e)),this.updateTableMap.get(e)}async getTable(e){return new Cu(e)}async addItem(e,n,s,i){return this.updateItem(e,{id:`${new Date().getTime()}`,name:s,data:i})}async updateItem(e,n){const s=this.getUpdateTable(e),i=await s.refreshItem(n.id),o={...i!=null?i:{},...n};return bu.debug("Updating item",o),await s.put(o),bu.debug("Update saved"),n}listenItem(e,n,s){return this.getUpdateTable(e).onItemUpdate(n,s)}}const Mg="SET_LAYOUT_STORAGE",ry=t=>({type:Mg,payload:t}),Ng=""+new URL("community-wordmark-app.d2c5c1eb.svg",import.meta.url).href;const ly=J.module("FormattingSectionContent");function ay(t){return t.formatString!=null}function pd(t){const e=t==null?void 0:t.querySelector("input, select, textarea");e&&e.focus()}function Fg(t,e){return t.defaultFormatString===e.defaultFormatString}function dy(t,e){return Fg(t,e)}function cy(t,e){return Fg(t,e)}function xg(t){return t!==""&&In.isValidColumnName(t)}function Ws(t,e){if(!t||e.formatString==null||!ay(e))return!1;switch(t){case"datetime":return ot.isValid(e);case"decimal":return _e.isValid(e);case"int":return et.isValid(e);default:return ly.warn("Trying to validate format of unknown type"),!0}}function _g(t){const{id:e,isNewRule:n,...s}=t;return s}function kg(t){return xg(t.columnName)&&Ws(t.columnType,t.format)}function Og(t){const{timestamp:e,timeZone:n,showTimeZone:s,showTSeparator:i,isGlobalOptions:o,legacyGlobalFormat:r}=t,l=new hn([],{timeZone:n,showTimeZone:s,showTSeparator:i}),a=o?ot.getGlobalFormats(s,i):ot.getFormats(s,i);return r!=null&&!a.includes(r)&&a.unshift(r),h(Te,{children:a.map(d=>{const c=ot.makeFormat("",d,ot.TYPE_GLOBAL);return h("option",{value:d,"data-testid":"time-format",children:l.getFormattedString(e,_.dataType.DATETIME,"",c)},d)})})}function hy(){return h(Te,{children:Nn.TIME_ZONES.map(t=>{const{label:e,value:n}=t;return h("option",{value:n,children:e},n)})})}const ii=J.module("FormattingSectionContent"),Ag=class extends w.exports.PureComponent{constructor(t){super(t),this.getCachedDateTimeFormatOptions=be((c,u,m,p=!1,g)=>{const{timestampAtMenuOpen:f}=this.state;return h(Og,{timestamp:f,timeZone:c,showTimeZone:u,showTSeparator:m,isGlobalOptions:p,legacyGlobalFormat:g})}),this.debouncedCommitChanges=Je(this.commitChanges.bind(this),Ag.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:e,defaultDateTimeFormat:n,defaultDecimalFormatOptions:s,defaultIntegerFormatOptions:i,showTimeZone:o,showTSeparator:r,timeZone:l,truncateNumbersWithPound:a}=t,d=e.map((c,u)=>({...c,id:u}));this.containerRef=Q.createRef(),this.state={formatSettings:d,showTimeZone:o,showTSeparator:r,timeZone:l,defaultDateTimeFormat:n,defaultDecimalFormatOptions:s,defaultIntegerFormatOptions:i,truncateNumbersWithPound:a,timestampAtMenuOpen:new Date}}componentDidMount(){pd(this.containerRef.current)}componentWillUnmount(){this.debouncedCommitChanges.flush()}handleDefaultDateTimeFormatChange(t){ii.debug("handleDefaultDateTimeFormatChange",t.target.value),this.setState({defaultDateTimeFormat:t.target.value},()=>{this.debouncedCommitChanges()})}handleDefaultDecimalFormatChange(t){ii.debug("handleDefaultDecimalFormatChange",t.target.value),this.setState({defaultDecimalFormatOptions:{defaultFormatString:t.target.value}},()=>{this.debouncedCommitChanges()})}handleDefaultIntegerFormatChange(t){ii.debug("handleDefaultIntegerFormatChange",t.target.value),this.setState({defaultIntegerFormatOptions:{defaultFormatString:t.target.value}},()=>{this.debouncedCommitChanges()})}handleShowTimeZoneChange(){this.setState(t=>({showTimeZone:!t.showTimeZone}),()=>{this.debouncedCommitChanges()})}handleShowTSeparatorChange(){this.setState(t=>({showTSeparator:!t.showTSeparator}),()=>{this.debouncedCommitChanges()})}handleTimeZoneChange(t){this.setState({timeZone:t.target.value},()=>{this.debouncedCommitChanges()})}handleResetDateTimeFormat(){const{defaults:t}=this.props,{defaultDateTimeFormat:e,showTimeZone:n,showTSeparator:s}=t;ii.debug("handleResetDateTimeFormat"),this.setState({defaultDateTimeFormat:e,showTimeZone:n,showTSeparator:s},()=>{this.debouncedCommitChanges()})}handleResetTimeZone(){const{defaults:t}=this.props,{timeZone:e}=t;ii.debug("handleResetTimeZone"),this.setState({timeZone:e},()=>{this.debouncedCommitChanges()})}handleResetDecimalFormat(){const{defaults:t}=this.props,{defaultDecimalFormatOptions:e}=t;ii.debug("handleResetDecimalFormat"),this.setState({defaultDecimalFormatOptions:e},()=>{this.debouncedCommitChanges()})}handleResetIntegerFormat(){const{defaults:t}=this.props,{defaultIntegerFormatOptions:e}=t;ii.debug("handleResetIntegerFormat"),this.setState({defaultIntegerFormatOptions:e},()=>{this.debouncedCommitChanges()})}handleTruncateNumbersWithPoundChange(){this.setState(t=>({truncateNumbersWithPound:!t.truncateNumbersWithPound}),()=>{this.debouncedCommitChanges()})}commitChanges(){var m;const{formatSettings:t,defaultDateTimeFormat:e,showTimeZone:n,showTSeparator:s,timeZone:i,defaultDecimalFormatOptions:o,defaultIntegerFormatOptions:r,truncateNumbersWithPound:l}=this.state,a=(m=t.filter(kg).map(_g))!=null?m:[],{settings:d,saveSettings:c}=this.props,u={...d,formatter:a,defaultDateTimeFormat:e,showTimeZone:n,showTSeparator:s,timeZone:i,truncateNumbersWithPound:l};Ws(_.dataType.DECIMAL,_e.makeCustomFormat(o.defaultFormatString))&&(u.defaultDecimalFormatOptions=o),Ws(_.dataType.INT,et.makeCustomFormat(r.defaultFormatString))&&(u.defaultIntegerFormatOptions=r),c(u)}render(){const{defaults:t}=this.props,{defaultDateTimeFormat:e,defaultDecimalFormatOptions:n,defaultIntegerFormatOptions:s,timeZone:i,showTimeZone:o,showTSeparator:r,truncateNumbersWithPound:l}=this.state,{defaultFormatString:a=_e.DEFAULT_FORMAT_STRING}=n!=null?n:{},{defaultFormatString:d=et.DEFAULT_FORMAT_STRING}=s!=null?s:{},c=i===t.timeZone,u=r===t.showTSeparator&&o===t.showTimeZone&&e===t.defaultDateTimeFormat,m=dy(n,t.defaultDecimalFormatOptions),p=cy(s,t.defaultIntegerFormatOptions);return h("div",{className:"app-settings-formatting-section",ref:this.containerRef,children:T("div",{className:"container-fluid p-0",children:[h("div",{children:"Default formatting for column types"}),h("div",{className:"app-settings-menu-description mb-3",children:"Applies a formatting rule to all columns of a set type."}),T("div",{className:"form-row mb-2",children:[h("label",{className:"col-form-label col-3",htmlFor:"select-reset-timezone",children:"Time zone"}),h("div",{className:"col pr-0",children:h("select",{className:"custom-select",value:i,onChange:this.handleTimeZoneChange,id:"select-reset-timezone",children:h(hy,{})})}),h("div",{className:"col-1 btn-col",children:h(z,{kind:"ghost",icon:mi,onClick:this.handleResetTimeZone,tooltip:"Reset Time Zone",className:$("btn-reset","btn-reset-time-zone",{hidden:c})})})]}),T("div",{className:"form-row mb-2",children:[h("label",{className:"col-form-label col-3",htmlFor:"select-default-time-format",children:"DateTime"}),h("div",{className:"col pr-0",children:h("select",{className:"custom-select",value:e,onChange:this.handleDefaultDateTimeFormatChange,id:"select-default-time-format",children:this.getCachedDateTimeFormatOptions(i,o,r,!0,e)})}),h("div",{className:"col-1 btn-col",children:h(z,{kind:"ghost",icon:mi,onClick:this.handleResetDateTimeFormat,tooltip:"Reset DateTime Options",className:$("btn-reset","btn-reset-date-time",{hidden:u})})})]}),h("div",{className:"form-row",children:h("div",{className:"offset-3 col-9",children:h(vt,{checked:o!=null?o:null,onChange:this.handleShowTimeZoneChange,children:"Show time zone in dates"})})}),h("div",{className:"form-row mb-3",children:h("div",{className:"offset-3 col-9",children:h(vt,{checked:r!=null?r:null,onChange:this.handleShowTSeparatorChange,children:"Show 'T' separator"})})}),T("div",{className:"form-row mb-2",children:[h("label",{className:"col-form-label col-3",htmlFor:"default-decimal-format-input",children:"Decimal"}),h("div",{className:"col pr-0",children:h("input",{className:$("form-control","flex-grow-1","default-decimal-format-input",{"is-invalid":!Ws(_.dataType.DECIMAL,_e.makeCustomFormat(a))}),"data-lpignore":!0,placeholder:_e.DEFAULT_FORMAT_STRING,type:"text",id:"default-decimal-format-input",value:a,onChange:this.handleDefaultDecimalFormatChange})}),h("div",{className:"col-1 btn-col",children:h(z,{kind:"ghost",icon:mi,onClick:this.handleResetDecimalFormat,tooltip:"Reset Decimal Formatting",className:$("btn-reset","btn-reset-decimal",{hidden:m}),"data-testid":"btn-reset-decimal"})})]}),T("div",{className:"form-row mb-2",children:[h("label",{className:"col-form-label col-3",htmlFor:"default-integer-format-input",children:"Integer"}),h("div",{className:"col pr-0",children:h("input",{className:$("form-control","flex-grow-1","default-integer-format-input",{"is-invalid":!Ws(_.dataType.INT,et.makeCustomFormat(d))}),"data-lpignore":!0,placeholder:et.DEFAULT_FORMAT_STRING,type:"text",id:"default-integer-format-input",value:d,onChange:this.handleDefaultIntegerFormatChange})}),h("div",{className:"col-1 btn-col",children:h(z,{kind:"ghost",icon:mi,onClick:this.handleResetIntegerFormat,tooltip:"Reset Integer Formatting",className:$("btn-reset","btn-reset-integer",{hidden:p}),"data-testid":"btn-reset-integer"})})]}),h("div",{className:"form-row mb-3",children:h("div",{className:"offset-3 col-9",children:h(vt,{checked:l!=null?l:null,onChange:this.handleTruncateNumbersWithPoundChange,children:"Truncate numbers with #"})})})]})})}};let Nc=Ag;Nc.defaultProps={scrollTo:()=>{},defaults:{defaultDateTimeFormat:ot.DEFAULT_DATETIME_FORMAT_STRING,defaultDecimalFormatOptions:{defaultFormatString:_e.DEFAULT_FORMAT_STRING},defaultIntegerFormatOptions:{defaultFormatString:et.DEFAULT_FORMAT_STRING},showTimeZone:!1,showTSeparator:!0,timeZone:ot.DEFAULT_TIME_ZONE_ID}};Nc.inputDebounceTime=250;const uy=t=>({formatter:$m(t),defaultDateTimeFormat:Um(t),defaultDecimalFormatOptions:Vm(t),defaultIntegerFormatOptions:Bm(t),showTimeZone:zm(t),showTSeparator:Wm(t),truncateNumbersWithPound:Gm(t),timeZone:dr(t),settings:Nt(t)}),my=Mt(uy,{saveSettings:jl})(Nc);function py(){const[t,e]=w.exports.useState(!1),n=()=>{e(!t)};return T(z,{kind:"ghost",onClick:n,icon:HC,children:["Legal Notices",T(sr,{isOpen:t,toggle:n,className:"theme-bg-light",children:[h(or,{toggle:n,children:"Legal Notice"}),T(ir,{children:[h("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,495; 9,836,494; 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,353,893; 10,346,394; 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; and 10,783,191. Other patents pending."}),T("p",{children:["\xA9 2016-",new Date().getFullYear()," Deephaven Data Labs LLC. Patent Pending."]})]})]})]})}function Qo(t){const{children:e,isExpanded:n,sectionKey:s,title:i,onToggle:o}=t;return T(Te,{children:[h("div",{children:T(z,{kind:"ghost",className:"btn-collapse-trigger",onClick:()=>o(s),children:[h("div",{className:"flex-grow-1",children:i}),h("div",{className:"flex-shrink-0",children:h(te,{transform:n?"flip-v":"",icon:Xn})})]})}),h(Ad,{in:n,autoFocusOnShow:!0,children:e})]})}Qo.propTypes={children:D.exports.node,isExpanded:D.exports.bool.isRequired,sectionKey:D.exports.string.isRequired,title:D.exports.node.isRequired,onToggle:D.exports.func};Qo.defaultProps={children:null,onToggle:()=>{}};function gy({shortcut:t,displayText:e,categoryName:n,onChange:s}){const[i,o]=w.exports.useState(e),[r,l]=w.exports.useState(t.getKeyState()),[a,d]=w.exports.useState(!1),[c,u]=w.exports.useState("");w.exports.useEffect(function(){o(e),l(t.getKeyState())},[e,t]),w.exports.useEffect(function(){o(qt.getDisplayText(r)),t.matchesKeyState(r)&&d(!1)},[r,t]),w.exports.useEffect(function(){if(a){if(!qt.isValidKeyState(r)){qt.isAllowedKey(r.keyValue)?u("Must contain a modifier key"):u("Must contain an allowed action key");return}const y=Le.getConflictingShortcuts(r).filter(E=>E.id.startsWith(n)&&E!==t).map(E=>E.name);if(y.length){u(`Conflicts with ${y.join(", ")}`);return}u("")}else u("")},[a,r,n,t]);function m(v){if(v.stopPropagation(),v.preventDefault(),t.isEditable&&!v.repeat){const y=qt.getKeyStateFromEvent(v),E=qt.createKeyState([ge.BACKSPACE]);qt.doKeyStatesMatch(y,E)?l(qt.NULL_KEY_STATE):l(y)}}function p(v){v.stopPropagation(),v.preventDefault(),t.matchesKeyState(r)||d(!0)}function g(){We.disableAllActions()}function f(){We.enableAllActions()}function b(){t.setKeyState(r),d(!1),s(t)}function C(){const v=t.getKeyState();l(v),d(!1)}function S(){d(!0),l(t.getDefaultKeyState())}return T(Te,{children:[T("div",{className:"shortcut-item-container",children:[T("label",{className:"shortcut-item-name",children:[t.name,t.tooltip!==void 0&&h(qe,{children:t.tooltip})]}),T("div",{className:"shortcut-item-input-container",children:[h("input",{className:$("form-control",{"is-invalid":c}),onKeyDown:m,onKeyUp:p,onFocus:g,onBlur:f,disabled:!t.isEditable,value:i,readOnly:!0}),!qt.doKeyStatesMatch(r,t.getDefaultKeyState())&&!c&&h(z,{className:"reset-to-default-button",kind:"ghost",icon:h(te,{icon:mi,transform:{rotate:90,flipX:!0}}),tooltip:"Reset to default",onClick:S})]})]}),a&&T("div",{className:$("shortcut-item-message-container",{"is-invalid":c}),children:[h("div",{className:"shortcut-item-message",children:c}),T("div",{className:"shortcut-item-message-buttons",children:[qt.isValidKeyState(r)&&h(z,{kind:"ghost",onClick:b,children:"Confirm"}),h(z,{kind:"ghost",onClick:C,children:"Undo"})]})]})]})}function fy({shortcutOverrides:t={},settings:e,saveSettings:n}){const s=w.exports.useCallback(l=>{const a=qt.isMacPlatform,d={mac:{...t.mac},windows:{...t.windows}},c=a?d.mac:d.windows;l.forEach(u=>{u.isDefault()?delete c[u.id]:c[u.id]=u.getKeyState()}),n({...e,shortcutOverrides:d})},[e,n,t]);let i=Array.from(Le.shortcutsByCategory.entries()).map(([l,a])=>({name:l,shortcuts:a}));const o=i.findIndex(l=>l.name.toUpperCase()==="GLOBAL"),r=i.splice(o,1);return i=i.concat(r),T(Te,{children:[h("div",{className:"app-settings-menu-description",children:"Customize shortcuts below. Assigning shortcuts that conflict with the browser or IDE shortcuts may cause unintended behavior"}),i.map(l=>h(Cy,{name:l.name,shortcuts:l.shortcuts,saveShortcutOverrides:s},l.name))]})}function Cy({name:t,shortcuts:e,saveShortcutOverrides:n}){function s(a){return a.split("_").map(d=>`${d[0].toUpperCase()}${d.slice(1).toLowerCase()}`).join(" ")}const[i,o]=w.exports.useState(e);function r(a){const d=i.filter(u=>u!==a&&!u.isNull()&&u.matchesKeyState(a.getKeyState()));d.forEach(u=>u.setToNull());const c=[a,...d];n(c),o(u=>[...u])}const l=w.exports.useMemo(()=>i.map(a=>a.getDisplayText()),[i]);return T("div",{className:"mt-3",children:[h("div",{className:"font-weight-bold",children:s(t)}),i.map((a,d)=>h(gy,{shortcut:a,displayText:l[d],categoryName:t,onChange:r},a.id))]})}const by=t=>({settings:Nt(t),shortcutOverrides:F0(t)}),Sy={saveSettings:jl},wy=Mt(by,Sy)(fy),gd=new cC,fd=new ml(gd);function vy(){J.setLogLevel(parseInt("2",10)),gd.enable(),fd.enable(),window!=null&&(window.DHLog=J,window.DHLogProxy=gd,window.DHLogHistory=fd)}const Ty="yyyy-MM-dd-HHmmss";function Lg(t,e="root",n=new Map([[t,""]])){const s={};return Object.entries(t).forEach(([i,o])=>{try{JSON.stringify(o),s[i]=o}catch{const l=o;if(typeof o=="bigint")s[i]=o.toString();else if(n.has(l))s[i]=`Circular ref to ${n.get(l)}`;else{const a=`${e}.${i}`;n.set(l,a),s[i]=Lg(o,a,n)}}}),s}function Ey(){const t=Ql.getState();return JSON.stringify(Lg(t),null,2)}function yy(t){const e={uiVersion:"0.29.0",userAgent:navigator.userAgent,...t};return JSON.stringify(e,null,2)}async function Iy(t=`${M.i18n.DateTimeFormat.format(Ty,new Date)}_support_logs`,e){const n=new Du,s=n.folder(t);s.file("console.txt",fd.getFormattedHistory()),s.file("redux.json",Ey()),s.file("metadata.json",yy(e));const i=await n.generateAsync({type:"blob"}),o=document.createElement("a");o.href=URL.createObjectURL(i),o.download=`${t}.zip`,o.click()}const Ry=[{value:_.dataType.DATETIME,label:"DateTime"},{value:_.dataType.DECIMAL,label:"Decimal"},{value:_.dataType.INT,label:"Integer"}];function Dy(){const t=Ry.map(e=>h("option",{value:e.value,children:e.label},`key-columnType-${e.value}`));return T(Te,{children:[h("option",{disabled:!0,value:"",children:"Select Type"},"key-columnType-placeholder"),t]})}const Pg=class extends w.exports.PureComponent{constructor(t){super(t),this.getCachedColumnTypeOptions=be(()=>h(Dy,{})),this.getCachedDateTimeFormatOptions=be((c,u,m,p=!1,g)=>{const{timestampAtMenuOpen:f}=this.state;return h(Og,{timestamp:f,timeZone:c,showTimeZone:u,showTSeparator:m,isGlobalOptions:p,legacyGlobalFormat:g})}),this.debouncedCommitChanges=Je(this.commitChanges.bind(this),Pg.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:e,defaultDateTimeFormat:n,defaultDecimalFormatOptions:s,defaultIntegerFormatOptions:i,showTimeZone:o,showTSeparator:r,timeZone:l,truncateNumbersWithPound:a}=t,d=e.map((c,u)=>({...c,id:u}));this.containerRef=Q.createRef(),this.addFormatRuleButtonRef=Q.createRef(),this.lastFormatRuleIndex=d.length,this.state={formatSettings:d,formatRulesChanged:!1,showTimeZone:o,showTSeparator:r,timeZone:l,defaultDateTimeFormat:n,defaultDecimalFormatOptions:s,defaultIntegerFormatOptions:i,truncateNumbersWithPound:a,timestampAtMenuOpen:new Date}}componentDidMount(){pd(this.containerRef.current)}componentWillUnmount(){this.debouncedCommitChanges.flush()}isDuplicateRule(t){var n;const{formatSettings:e}=this.state;return(n=e.some(s=>s.id!==t.id&&s.columnName===t.columnName&&s.columnType===t.columnType))!=null?n:!1}getAutoIncrementFormatRuleIndex(){const{lastFormatRuleIndex:t}=this;return this.lastFormatRuleIndex+=1,t}handleFormatRuleChange(t,e,n){this.setState(s=>{const{formatSettings:i}=s;O(i);const o=[...i];let r={};e==="columnType"&&(r={format:""});const l={...o[t],...r,[e]:n};return o[t]=l,{formatSettings:o}},()=>{this.debouncedCommitChanges()})}handleFormatRuleCreate(){this.setState(t=>{const{formatSettings:e}=t,n={columnType:_.dataType.DATETIME,columnName:"",format:{},id:this.getAutoIncrementFormatRuleIndex(),isNewRule:!0};return{formatSettings:e!=null?[...e,n]:[n],formatRulesChanged:!0}})}handleFormatRuleDelete(t){this.setState(e=>{const{formatSettings:n}=e;return{formatSettings:n.filter((i,o)=>o!==t),formatRulesChanged:!0}},()=>{this.debouncedCommitChanges()})}handleFormatRuleEntered(t){this.scrollToFormatBlockBottom(),pd(t)}commitChanges(){var m;const{formatSettings:t,defaultDateTimeFormat:e,showTimeZone:n,showTSeparator:s,timeZone:i,defaultDecimalFormatOptions:o,defaultIntegerFormatOptions:r,truncateNumbersWithPound:l}=this.state,a=(m=t.filter(kg).map(_g))!=null?m:[],{settings:d,saveSettings:c}=this.props,u={...d,formatter:a,defaultDateTimeFormat:e,showTimeZone:n,showTSeparator:s,timeZone:i,truncateNumbersWithPound:l};Ws(_.dataType.DECIMAL,_e.makeCustomFormat(o.defaultFormatString))&&(u.defaultDecimalFormatOptions=o),Ws(_.dataType.INT,et.makeCustomFormat(r.defaultFormatString))&&(u.defaultIntegerFormatOptions=r),c(u)}scrollToFormatBlockBottom(){var e,n,s,i;const{scrollTo:t}=this.props;t(0,((n=(e=this.addFormatRuleButtonRef.current)==null?void 0:e.offsetHeight)!=null?n:0)+((i=(s=this.addFormatRuleButtonRef.current)==null?void 0:s.offsetTop)!=null?i:0))}getRuleError(t){const e={hasColumnNameError:!1,hasFormatError:!1,message:""},n=[];return t.isNewRule!==void 0&&t.isNewRule||(this.isDuplicateRule(t)&&(e.hasColumnNameError=!0,n.push("Duplicate column name/type combo.")),xg(t.columnName)||(e.hasColumnNameError=!0,n.push("Column names must start with a letter or underscore and contain only alphanumeric characters or underscores.")),t.format.formatString!==void 0&&t.format.formatString.length===0?(e.hasFormatError=!0,n.push("Empty formatting rule.")):Ws(t.columnType,t.format)||(e.hasFormatError=!0,n.push("Invalid formatting rule.")),e.message=n.join(`
|
|
43
43
|
`)),e}renderFormatRule(t,e){const n=`input-${t}-columnName`,s=`input-${t}-columnType`,i=`input-${t}-format`,o=this.getCachedColumnTypeOptions(),r=c=>this.handleFormatRuleChange(t,"columnName",c.target.value),l=()=>this.handleFormatRuleChange(t,"isNewRule",!1),a=c=>this.handleFormatRuleChange(t,"columnType",c.target.value),d=this.getRuleError(e);return T("fieldset",{className:"container-fluid format-rule-container",children:[T("div",{className:"form-row",children:[T("div",{className:"form-group col-7 mb-2",children:[h("label",{htmlFor:n,children:"Column Name"}),h("input",{id:n,className:$("form-control",{"is-invalid":d.hasColumnNameError}),"data-lpignore":!0,type:"text",value:e.columnName,onChange:r,onBlur:l})]}),T("div",{className:"form-group col mb-2",children:[h(z,{kind:"ghost",className:"btn-delete-format-rule float-right",tabIndex:-1,onClick:()=>this.handleFormatRuleDelete(t),icon:un,tooltip:"Delete","aria-label":"Delete Format Rule"}),h("label",{htmlFor:s,children:"Column Type"}),h("select",{id:s,className:"custom-select",value:e.columnType,onChange:a,children:o})]})]}),h("div",{className:"form-row",children:T("div",{className:"form-group col-12 d-flex mb-2",children:[h("label",{className:"flex-shrink-0 col-form-label mr-3",htmlFor:i,children:"Formatting Rule"}),this.renderFormatRuleInput(t,e.columnType,i,e.format,d.hasFormatError)]})}),h("div",{className:"form-row",children:h("div",{className:"form-group col-12 d-flex mb-2",children:d.message&&h("p",{className:"text-danger",children:d.message})})})]},t)}renderFormatRuleInput(t,e,n,s,i){switch(_.getNormalizedType(e)){case _.dataType.DATETIME:return this.renderDateTimeFormatRuleInput(t,n,s,i);case _.dataType.DECIMAL:return this.renderDecimalFormatRuleInput(t,n,s,i);case _.dataType.INT:return this.renderIntegerFormatRuleInput(t,n,s,i);default:throw new Error(`Unrecognized column type: ${e}`)}}renderDateTimeFormatRuleInput(t,e,n,s){var a;const{showTimeZone:i,showTSeparator:o,timeZone:r}=this.state,l=(a=n.formatString)!=null?a:"";return T("select",{className:$("custom-select",{"is-invalid":s}),value:l,id:e,onChange:d=>{const c=ot.makeFormat("",d.target.value,ot.TYPE_GLOBAL);this.handleFormatRuleChange(t,"format",c)},children:[h("option",{value:"",disabled:!0,children:"Select format"},"default"),this.getCachedDateTimeFormatOptions(r,i,o)]})}renderIntegerFormatRuleInput(t,e,n,s){var o;const i=(o=n.formatString)!=null?o:"";return h("input",{className:$("form-control","flex-grow-1",{"is-invalid":s}),"data-lpignore":!0,id:e,placeholder:et.DEFAULT_FORMAT_STRING,type:"text",value:i,onChange:r=>{const l=et.makeFormat("",r.target.value,et.TYPE_GLOBAL,void 0);this.handleFormatRuleChange(t,"format",l)}})}renderDecimalFormatRuleInput(t,e,n,s){var o;const i=(o=n.formatString)!=null?o:"";return h("input",{className:$("form-control","flex-grow-1",{"is-invalid":s}),"data-lpignore":!0,id:e,placeholder:_e.DEFAULT_FORMAT_STRING,type:"text",value:i,onChange:r=>{const l=_e.makeFormat("",r.target.value,_e.TYPE_GLOBAL,void 0);this.handleFormatRuleChange(t,"format",l)}})}render(){const{formatRulesChanged:t,formatSettings:e}=this.state,n=e.map((i,o)=>h(gt,{classNames:"fade",timeout:ze.transitionMs,onEnter:this.handleFormatRuleEntered,children:this.renderFormatRule(o,i)},i.id)),s=h(z,{kind:"ghost",className:"mb-3",onClick:this.handleFormatRuleCreate,ref:this.addFormatRuleButtonRef,icon:qs,children:"Add New Rule"});return T("div",{className:"app-settings-formatting-section",ref:this.containerRef,children:[h("div",{children:"Default formatting for matched column names"}),h("div",{className:"app-settings-menu-description mb-3",children:"Applies a formatting rule to all columns that match a specified name and type."}),h(Ef,{appear:t,enter:t,exit:t,children:n}),s]})}};let Fc=Pg;Fc.defaultProps={scrollTo:()=>{},defaults:{defaultDateTimeFormat:ot.DEFAULT_DATETIME_FORMAT_STRING,defaultDecimalFormatOptions:{defaultFormatString:_e.DEFAULT_FORMAT_STRING},defaultIntegerFormatOptions:{defaultFormatString:et.DEFAULT_FORMAT_STRING},showTimeZone:!1,showTSeparator:!0,timeZone:ot.DEFAULT_TIME_ZONE_ID}};Fc.inputDebounceTime=250;const My=t=>({formatter:$m(t),defaultDateTimeFormat:Um(t),defaultDecimalFormatOptions:Vm(t),defaultIntegerFormatOptions:Bm(t),showTimeZone:zm(t),showTSeparator:Wm(t),truncateNumbersWithPound:Gm(t),timeZone:dr(t),settings:Nt(t)}),Ny=Mt(My,{saveSettings:jl})(Fc),gs=class extends w.exports.Component{constructor(t){super(t),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.menuContentRef=Q.createRef(),this.state={expandedSectionKey:gs.FORMATTING_SECTION_KEY}}static focusFirstInputInContainer(t){const e=t==null?void 0:t.querySelector("input, select, textarea");e&&e.focus()}componentDidMount(){gs.focusFirstInputInContainer(this.menuContentRef.current)}isSectionExpanded(t){const{expandedSectionKey:e}=this.state;return e===t}handleScrollTo(t,e){var n;(n=this.menuContentRef.current)==null||n.scrollTo(t,e)}handleSectionToggle(t){this.setState(e=>({expandedSectionKey:e.expandedSectionKey===t?void 0:t}))}handleClose(){const{onDone:t}=this.props;t()}handleExportSupportLogs(){const{serverConfigValues:t}=this.props;Iy(void 0,Object.fromEntries(t))}render(){const t="0.29.0",e="https://github.com/deephaven/web-client-ui/",n="https://deephaven.io/core/docs/",{serverConfigValues:s}=this.props,i=s.get("barrage.version"),o=s.get("java.version"),r=s.get("deephaven.version"),l=(a,d)=>T(Te,{children:[h("div",{children:a}),h("div",{children:d})]});return T("div",{className:"app-settings-menu",children:[T("header",{className:"app-settings-menu-header",children:[h("div",{className:"flex-spacer"}),h(z,{kind:"ghost",className:"btn-close-settings-menu",onClick:this.handleClose,icon:h(te,{icon:ao,transform:"grow-4"}),tooltip:"Close"})]}),T("div",{className:"app-settings-menu-content",ref:this.menuContentRef,children:[h("h5",{children:"Settings"}),h("hr",{className:"my-0"}),h(Qo,{sectionKey:gs.FORMATTING_SECTION_KEY,isExpanded:this.isSectionExpanded(gs.FORMATTING_SECTION_KEY),title:T(Te,{children:[h(te,{icon:tb,transform:"grow-4",className:"mr-2"}),"Default Formatting & Time zone"]}),onToggle:this.handleSectionToggle,children:h(my,{})}),h(Qo,{sectionKey:gs.COLUMN_SPECIFIC_SECTION_KEY,isExpanded:this.isSectionExpanded(gs.COLUMN_SPECIFIC_SECTION_KEY),title:T(Te,{children:[h(te,{icon:UC,transform:"grow-4",className:"mr-2"}),"Column Specific Formatting Rules"]}),onToggle:this.handleSectionToggle,children:h(Ny,{scrollTo:this.handleScrollTo})}),h(Qo,{sectionKey:gs.SHORTCUT_SECTION_KEY,isExpanded:this.isSectionExpanded(gs.SHORTCUT_SECTION_KEY),title:T(Te,{children:[h(te,{icon:YC,transform:"grow-2"})," ","Keyboard Shortcuts"]}),onToggle:this.handleSectionToggle,children:h(wy,{})}),T("div",{className:"app-settings-footer",children:[T("div",{className:"app-settings-footer-section",children:[T("div",{className:"app-settings-footer-item",children:[h("div",{className:"font-weight-bold",children:"Support"}),T("div",{children:["GitHub:\xA0",h("a",{href:e,className:"custom-link",target:"_blank",rel:"noopener noreferrer",children:e})]}),h(z,{kind:"tertiary",className:"mt-2 py-2",onClick:this.handleExportSupportLogs,children:"Export Logs"})]}),T("div",{className:"app-settings-footer-item",children:[h("div",{className:"font-weight-bold",children:"Documentation"}),h("a",{target:"_blank",rel:"noreferrer noopener",href:n,className:"custom-link",children:n})]}),T("div",{className:"app-settings-footer-item",children:[h("div",{className:"font-weight-bold",children:"Version"}),T("span",{className:"d-inline-block text-muted",children:[r," ",h(te,{icon:LC}),T(qe,{interactive:!0,children:[T("div",{className:"detailed-server-config",children:[l("Engine Version",r),l("Web UI Version",t),l("Java Version",o),l("Barrage Version",i)]}),h(Ul,{tooltip:"Copy version numbers",copy:`Engine Version: ${r}
|
|
44
44
|
Web UI Version: ${t}
|
|
45
45
|
Java Version: ${o}
|
|
46
|
-
Barrage Version: ${i}`,children:"Copy Versions"})]})]})]}),h("div",{className:"app-settings-footer-item",children:h(py,{})})]}),h("div",{className:"app-settings-footer-section",children:h("div",{className:"logo",children:h("a",{target:"_blank",rel:"noreferrer noopener",href:"https://deephaven.io",className:"d-inline-block custom-link p-1",children:h("img",{src:Ng,alt:"Deephaven Data Labs",width:"230px"})})})})]})]})]})}};let vo=gs;vo.defaultProps={onDone:()=>{}};vo.FORMATTING_SECTION_KEY="SettingsMenu.formatting";vo.COLUMN_SPECIFIC_SECTION_KEY="SettingsMenu.columnFormatting";vo.APPLICATION_SECTION_KEY="ApplicationMenu.settings";vo.SHORTCUT_SECTION_KEY="SettingsMenu.shortcuts";const Su=10;function Yi(t){const{forwardedProps:{menuItem:{action:e,title:n,disabled:s},iconElement:i,displayShortcut:o,isMouseSelected:r,isKeyboardSelected:l,closeMenu:a}}=t,d=w.exports.useRef(),c=w.exports.useRef(),u=w.exports.useRef(null),[m,p]=w.exports.useState(!1),g=w.exports.useCallback(C=>{d.current!=null&&c.current!=null&&u.current&&(Math.abs(d.current-C.clientX)>=Su||Math.abs(c.current-C.clientY)>=Su)&&(p(!0),window.removeEventListener("mousemove",g),a(),e(C),u.current=null)},[e,a]);function f(C){d.current=C.clientX,c.current=C.clientY,u.current=C.target,window.addEventListener("mousemove",g)}function b(C){u.current===C.target&&(p(!0),a(),e(),window.removeEventListener("mousemove",g)),u.current=null}return w.exports.useEffect(function(){return function(){return window.removeEventListener("mousemove",g)}},[g]),T("button",{type:"button",className:$("btn-context-menu",{disabled:s},{active:r&&!s},{"keyboard-active":l&&!s}),onMouseDown:f,onMouseUp:b,disabled:m,children:[h("span",{className:$("icon"),children:i}),h("span",{className:"title",children:n}),h("span",{className:"shortcut",children:o})]})}function xc(t){const{handleControlSelect:e,handleToolSelect:n,onClearFilter:s}=t,i=w.exports.useMemo(()=>[{title:"Input Filter",icon:pb,menuElement:h(Yi,{}),action:o=>{e(Tn.INPUT_FILTER,o)},order:10},{title:"Dropdown Filter",icon:zu,menuElement:h(Yi,{}),action:o=>{e(Tn.DROPDOWN_FILTER,o)},order:15},{title:"Markdown Widget",icon:zC,menuElement:h(Yi,{}),action:o=>{e(Tn.MARKDOWN,o)},order:20},{title:"Filter Sets",icon:Ka,menuElement:h(Yi,{}),action:o=>{e(Tn.FILTER_SET_MANAGER,o)},order:25},{disabled:!0,menuElement:h("div",{className:"context-menu-group-header",children:"Tools"}),order:30},{title:"Linker",icon:Rd,action:()=>{n(Xt.LINKER)},order:40,shortcut:vs.LINKER},{disabled:!0,menuElement:h("div",{className:"context-menu-group-header",children:"Actions"}),order:50},{title:"Clear All Filters",icon:cb,action:()=>{s()},order:60,shortcut:dn.TABLE.CLEAR_ALL_FILTERS}],[e,n,s]);return h(_n,{popperClassName:"controls-menu-popper",actions:i})}xc.propTypes={handleControlSelect:D.exports.func,handleToolSelect:D.exports.func,onClearFilter:D.exports.func};xc.defaultProps={handleControlSelect:()=>{},handleToolSelect:()=>{},onClearFilter:()=>{}};Yi.propTypes={forwardedProps:D.exports.shape({iconElement:D.exports.node,displayShortcut:D.exports.string,isMouseSelected:D.exports.bool.isRequired,isKeyboardSelected:D.exports.bool.isRequired,closeMenu:D.exports.func.isRequired,menuItem:D.exports.shape({action:D.exports.func,title:D.exports.string,disabled:D.exports.bool}).isRequired})};Yi.defaultProps={forwardedProps:null};const Fy=Ys(Mg,null),xy={layoutStorage:Fy},_y=t=>t.layoutStorage,ky=t=>t.serverConfigValues;Object.entries(xy).map(([t,e])=>po.register(t,e));const wu=10;function Oy(t){const{onExportLayout:e,onImportLayout:n,onResetLayout:s,onSelect:i,widgets:o=[]}=t,[r,l]=w.exports.useState(!1),[a,d]=w.exports.useState(""),c=w.exports.useRef(null),u=w.exports.useRef(),m=w.exports.useCallback((y,E)=>{y!=null&&i(y,E)},[i]),p=w.exports.useCallback(y=>{d(y.target.value)},[]),g=w.exports.useCallback(y=>{u.current!=null&&(Math.abs(u.current.x-y.clientX)>=wu||Math.abs(u.current.y-y.clientY)>=wu)&&(l(!0),window.removeEventListener("mousemove",g),m(u.current.widget,y),u.current=void 0)},[u,m]),f=w.exports.useCallback((y,E)=>{u.current={x:y.clientX,y:y.clientY,widget:E},window.addEventListener("mousemove",g)},[g]),b=w.exports.useCallback((y,E)=>{var I;window.removeEventListener("mousemove",g),((I=u.current)==null?void 0:I.widget)===E&&(l(!0),m(E)),u.current=void 0},[g,u,m]),C=w.exports.useMemo(()=>o.filter(y=>{var E;return a?(E=y.name)==null?void 0:E.toLowerCase().includes(a.toLowerCase()):!0}),[a,o]).sort((y,E)=>{var I,R,N;return(N=(R=y.name)==null?void 0:R.localeCompare((I=E.name)!=null?I:""))!=null?N:0}),S=w.exports.useMemo(()=>C.map(y=>{var E,I;return h("li",{children:T(z,{kind:"ghost","data-testid":`panel-list-item-${(E=y.name)!=null?E:""}-button`,onMouseDown:R=>{f(R,y)},onMouseUp:R=>{b(R,y)},onKeyDown:R=>{(R.key==="Enter"||R.key===" ")&&m(y)},disabled:r,onClick:()=>{},children:[h(um,{type:y.type})," ",(I=y.name)!=null?I:""]})},y.name)}),[C,r,f,b,m]),v=w.exports.useMemo(()=>S.length===0?h("span",{children:"No bound variables found."}):null,[S]);return T("div",{className:"widget-list-container d-flex flex-column",children:[h("div",{className:"widget-list-header",children:h(Es,{value:a,placeholder:"Find Table, Plot or Widget",onChange:p,ref:c})}),T("ul",{className:"widget-list flex-grow-1",children:[v&&h("li",{className:"widget-list-message",children:v}),!v&&S]}),h("div",{children:h("hr",{})}),T("div",{className:"widget-list-footer",children:[T(z,{kind:"ghost",onClick:e,children:[T("div",{className:"fa-md fa-layers",children:[h(te,{mask:qa,icon:Kc,transform:"right-5 down-5"}),h(te,{icon:Kc,transform:"right-8 down-6"})]}),"Export Layout"]}),T(z,{kind:"ghost",onClick:n,children:[T("div",{className:"fa-md fa-layers",children:[h(te,{mask:qa,icon:Ga,transform:"right-5 down-5"}),h(te,{icon:Ga,transform:"right-8 down-6"})]}),"Import Layout"]}),h(z,{kind:"ghost",icon:mi,onClick:s,tooltip:"Reset Layout"})]})]})}const Ay=async(t,e,n)=>{let s,i,o,r;if(rl(e)?(s=e.settings,i=e.table,o=void 0,r=e.tableSettings):(s={},i="",o=e.figure,r={}),n!==void 0&&(n.tableSettings!=null&&(r=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 d={title:o,name:o,type:M.VariableType.FIGURE},c=await t.getObject(d);return so.makeModel(s,c)}const l={title:o,name:i,type:M.VariableType.TABLE},a=await t.getObject(l);return ie.applyTableSettings(a,r,dr(Ql.getState())),so.makeModelFromSettings(s,a)},Ly=async(t,e,n=M.VariableType.TABLE)=>{const{table:s}=e,i={title:s,name:s,type:n},o=await t.getObject(i);return uc.makeModel(o)};function Py({onAutoFillClick:t=()=>{}}){return T("div",{className:"empty-dashboard-container",children:[T("div",{className:"hint-container",children:[h(te,{icon:ku})," ",h("br",{}),"Use the panel list to add objects from a query."]}),T("div",{className:"empty-dashboard",children:[h("div",{className:"add-panels-hint",children:"Drag Panels Here"}),h(z,{kind:"tertiary",onClick:t,children:"Auto fill objects"})]})]})}function Hy(t){return t.version===2}function Uy(t){return Array.isArray(t)}const el=J.module("UserLayoutUtils"),Vy={layoutConfig:[{type:"column",content:[{type:"row",height:40,content:[{type:"stack",content:[{type:"react-component",component:qi.COMPONENT,title:qi.TITLE,isClosable:!1},{type:"react-component",component:Fl.COMPONENT,title:Fl.TITLE,isClosable:!1}]},{type:"stack",width:25,content:[{type:"react-component",component:Dl.COMPONENT,title:Dl.TITLE,isClosable:!1},{type:"react-component",component:Ml.COMPONENT,title:Ml.TITLE,isClosable:!1}]}]},{type:"row",content:[{type:"stack",title:"Notebooks",content:[]}]}]}],links:[],filterSets:[],version:2},By={layoutConfig:[],links:[],filterSets:[],version:2};function Hg(t){if(Hy(t))return t;if(Uy(t))return{layoutConfig:t,links:[],filterSets:[],version:2};throw new Error(`Unexpected layout import format: ${t}`)}async function $y(t,e=!0){try{const n=await t.getLayouts();if(n.length>0)try{const s=await t.getLayout(n[0]);return Hg(s)}catch(s){el.error("Unable to load layout",n[0],":",s),el.warn("No valid layouts found, falling back to default layout")}}catch(n){el.error("Unable to fetch layout list",n),el.warn("Falling back to default layout")}return e?Vy:By}function zy(t){const{filterSets:e,layoutConfig:n,links:s}=t;return{filterSets:e,layoutConfig:n,links:s,version:2}}const hl={exportLayout:zy,getDefaultLayout:$y,normalizeLayout:Hg},tl=J.module("DownloadServiceWorkerUtils"),Ug=class{static registerOnLoaded(){new URL("/ide/",window.location.href).origin===window.location.origin&&("serviceWorker"in navigator?window.addEventListener("load",()=>{const e=new URL("/ide/download/serviceWorker.js",window.location.href);navigator.serviceWorker.register(e).then(n=>{n.update(),tl.info("Registering service worker on ",e,n)}).catch(n=>{tl.error("Failed to register service worker",n)})}):tl.info("Service worker is not supported."))}static async getServiceWorker(){if("serviceWorker"in navigator){const e=(await navigator.serviceWorker.getRegistrations()).find(n=>n.scope.endsWith(Ug.DOWNLOAD_PATH));if(e&&e.active)return tl.info("Download service worker is active."),e.active;throw new Error("Can not find download service worker.")}throw new Error("Download service worker is not available.")}static unregisterSW(){}};let xl=Ug;xl.DOWNLOAD_PATH="/download/";const Vg={react:Q},Wy=yf(Vg),Gy=If({requires:Wy}),Ky=Rf.createRequires(Vg),qy=Df({requires:Ky}),Yy=J.module("PluginUtils");class Cd{static loadComponentPlugin(e){if("".split(",").includes(e)){const o=Q.lazy(()=>_f(()=>import(`./internal/${e}`),[])),r=Q.forwardRef((l,a)=>h(w.exports.Suspense,{fallback:h("div",{children:"Loading Plugin..."}),children:h(o,{ref:a,...l})}));return r.pluginName=e,r.displayName="Local Plugin",r}const n=new URL("/ide/plugins/",`${window.location}`),s=new URL(`${e}.js`,n),i=Q.forwardRef((o,r)=>h(Gy,{url:s,render:({err:l,Component:a})=>{if(l!=null&&l!==""){const d=`Error loading plugin ${e} from ${s} due to ${l}`;return Yy.error(d),h("div",{className:"error-message",children:`${d}`})}return h(a,{ref:r,...o})}}));return i.pluginName=e,i.displayName="Plugin",i}static async loadModulePlugin(e){return await qy(e)}static async loadJson(e){return new Promise((n,s)=>{const i=new XMLHttpRequest;i.addEventListener("load",()=>{try{const o=JSON.parse(i.responseText);n(o)}catch(o){s(o)}}),i.addEventListener("error",o=>{s(o)}),i.open("GET",e),i.send()})}}const Ut=J.module("AppMainContainer");class Jo extends w.exports.Component{constructor(e){super(e),this.getDashboardPlugins=Se(n=>[...n.entries()].filter(([,s])=>s.DashboardPlugin!=null).map(([s,{DashboardPlugin:i}])=>h(i,{},s))),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.importElement=Q.createRef(),this.state={contextActions:[{action:()=>{this.handleToolSelect(Xt.LINKER)},shortcut:vs.LINKER,isGlobal:!0},{action:()=>{this.sendClearFilter()},shortcut:dn.TABLE.CLEAR_ALL_FILTERS,isGlobal:!0},{action:()=>{Ut.debug("Consume unhandled save shortcut")},shortcut:vs.SAVE,isGlobal:!0}],isPanelsMenuShown:!1,isSettingsMenuShown:!1,widgets:[]}}static handleWindowBeforeUnload(e){e.preventDefault(),e.returnValue=""}static hydrateConsole(e,n){return id.hydrate({...e,unzip:s=>Du.loadAsync(s).then(i=>Object.values(i.files))},n)}componentDidMount(){this.initWidgets(),window.addEventListener("beforeunload",Jo.handleWindowBeforeUnload)}componentDidUpdate(e){const{dashboardData:n}=this.props;e.dashboardData!==n&&this.handleDataChange(n)}componentWillUnmount(){this.deinitWidgets(),window.removeEventListener("beforeunload",Jo.handleWindowBeforeUnload)}initWidgets(){const{connection:e}=this.props;if(e.subscribeToFieldUpdates==null){Ut.warn("subscribeToFieldUpdates not supported, not initializing widgets");return}this.widgetListenerRemover=e.subscribeToFieldUpdates(n=>{Ut.debug("Got updates",n),this.setState(({widgets:s})=>{const{updated:i,created:o,removed:r}=n,l=[...i,...r],a=s.filter(c=>!l.some(u=>u.name===c.name));return[...i,...o].forEach(c=>{c.name!=null&&c.name!==""&&a.push(c)}),{widgets:a}})})}deinitWidgets(){var e;(e=this.widgetListenerRemover)==null||e.call(this)}openNotebookFromURL(){const{match:e}=this.props,{notebookPath:n}=e.params;if(n){const{session:s,sessionConfig:i}=this.props;if(s==null||i==null){Ut.error("No session available to open notebook URL",n);return}const o={id:`/${n}`,itemName:`/${n}`},r=i.type,l={value:null,language:r};this.emitLayoutEvent(Ae.SELECT_NOTEBOOK,s,r,l,o,!0)}}sendClearFilter(){this.emitLayoutEvent(Pe.CLEAR_ALL_FILTERS)}emitLayoutEvent(e,...n){var s;(s=this.goldenLayout)==null||s.eventHub.emit(e,...n)}handleError(e){ye.isCanceled(e)||Ut.error(e)}handleSettingsMenuHide(){this.setState({isSettingsMenuShown:!1})}handleSettingsMenuShow(){this.setState({isSettingsMenuShown:!0})}handleControlSelect(e,n=null){switch(Ut.debug("handleControlSelect",e),e){case Tn.DROPDOWN_FILTER:this.emitLayoutEvent(Pe.OPEN_DROPDOWN,{title:"DropdownFilter",type:e,createNewStack:!0,dragEvent:n});break;case Tn.INPUT_FILTER:this.emitLayoutEvent(Pe.OPEN_INPUT,{title:"InputFilter",type:e,createNewStack:!0,dragEvent:n});break;case Tn.MARKDOWN:this.emitLayoutEvent(ag.OPEN,{title:"Markdown",type:e,dragEvent:n});break;case Tn.FILTER_SET_MANAGER:this.emitLayoutEvent(Pe.OPEN_FILTER_SET_MANAGER,{title:"FilterSets",type:e,dragEvent:n});break;default:throw new Error(`Unrecognized control type ${e}`)}}handleToolSelect(e){Ut.debug("handleToolSelect",e);const{activeTool:n,setActiveTool:s}=this.props;s(n===e?Xt.DEFAULT:e)}handleClearFilter(){this.sendClearFilter()}handleDataChange(e){const{updateWorkspaceData:n}=this.props,{closed:s,filterSets:i,links:o}=e;n({closed:s,filterSets:i,links:o})}handleGoldenLayoutChange(e){this.goldenLayout=e}handleLayoutConfigChange(e){const{updateWorkspaceData:n}=this.props;n({layoutConfig:e})}handleWidgetMenuClick(){this.setState(({isPanelsMenuShown:e})=>({isPanelsMenuShown:!e}))}handleWidgetSelect(e,n){this.setState({isPanelsMenuShown:!1}),Ut.debug("handleWidgetSelect",e,n),this.openWidget(e,n)}handleWidgetsMenuClose(){this.setState({isPanelsMenuShown:!1})}handleAutoFillClick(){const{widgets:e}=this.state;Ut.debug("handleAutoFillClick",e);const n=e.sort((s,i)=>s.title!=null&&i.title!=null?s.title.localeCompare(i.title):0);for(let s=0;s<n.length;s+=1)this.openWidget(n[s])}handleExportLayoutClick(){Ut.info("handleExportLayoutClick"),this.setState({isPanelsMenuShown:!1});try{const{workspace:e}=this.props,{data:n}=e,s=hl.exportLayout(n);Ut.info("handleExportLayoutClick exportedConfig",s);const i=new Blob([JSON.stringify(s)],{type:"application/json"}),o=M.i18n.DateTimeFormat.format("yyyy-MM-dd-HHmmss",new Date),r=document.createElement("a");r.href=URL.createObjectURL(i),r.download=`deephaven-app-layout-${o}.json`,r.click()}catch(e){Ut.error("Unable to export layout",e)}}handleImportLayoutClick(){Ut.info("handleImportLayoutClick"),this.setState({isPanelsMenuShown:!1}),this.importElement.current!=null&&(this.importElement.current.value="",this.importElement.current.click())}handleResetLayoutClick(){Ut.info("handleResetLayoutClick"),this.setState({isPanelsMenuShown:!1}),this.resetLayout()}handleImportLayoutFiles(e){var n;e.stopPropagation(),e.preventDefault(),e.target.files!=null&&this.importLayoutFile((n=e.target.files)==null?void 0:n[0])}async importLayoutFile(e){try{const{updateDashboardData:n,updateWorkspaceData:s}=this.props,i=await e.text(),o=JSON.parse(i),{filterSets:r,layoutConfig:l,links:a}=hl.normalizeLayout(o);s({layoutConfig:l}),n(Fn,{filterSets:r,links:a})}catch(n){Ut.error("Unable to import layout",n)}}async resetLayout(){const{layoutStorage:e,session:n}=this.props,{filterSets:s,layoutConfig:i,links:o}=await hl.getDefaultLayout(e,n!==void 0),{updateDashboardData:r,updateWorkspaceData:l}=this.props;l({layoutConfig:i}),r(Fn,{filterSets:s,links:o})}handlePaste(e){if(e.target instanceof HTMLElement&&e.target.closest(".monaco-editor"))return;const{clipboardData:n}=e,s=n.getData("Text"),i=/“|”/g;i.test(s)&&(e.preventDefault(),e.stopPropagation(),document.execCommand("insertText",!1,s.replace(i,'"')))}handleLoadTablePlugin(e){const{plugins:n}=this.props,s=n.get(e);return s!=null&&s.TablePlugin!=null?s.TablePlugin:Cd.loadComponentPlugin(e)}hydrateDefault(e,n){const{connection:s}=this.props,{metadata:i}=e;if((i==null?void 0:i.type)!=null&&((i==null?void 0:i.id)!=null||(i==null?void 0:i.name)!=null)){const o=i.id!=null?{type:i.type,id:i.id}:{type:i.type,name:i.name,title:i.name};return{fetch:()=>s.getObject(o),localDashboardId:n,...e}}return id.hydrate(e,n)}hydrateGrid(e,n){var s;return this.hydrateTable(e,n,(s=e.metadata.type)!=null?s:M.VariableType.TABLE)}hydratePandas(e,n){return this.hydrateTable(e,n,M.VariableType.PANDAS)}hydrateTable(e,n,s=M.VariableType.TABLE){const{connection:i}=this.props;return{...e,getDownloadWorker:xl.getServiceWorker,loadPlugin:this.handleLoadTablePlugin,localDashboardId:n,makeModel:()=>Ly(i,e.metadata,s)}}hydrateChart(e,n){const{connection:s}=this.props;return{...e,localDashboardId:n,makeModel:()=>{const{metadata:i,panelState:o}=e;return Ay(s,i,o)}}}openWidget(e,n){const{connection:s}=this.props;this.emitLayoutEvent(De.OPEN,{dragEvent:n,fetch:()=>s.getObject(e),widget:e})}render(){const{activeTool:e,plugins:n,user:s,workspace:i,serverConfigValues:o}=this.props,{data:r}=i,{layoutConfig:l}=r,{permissions:a}=s,{canUsePanels:d}=a,{contextActions:c,isPanelsMenuShown:u,isSettingsMenuShown:m,widgets:p}=this.state,g=this.getDashboardPlugins(n);return T("div",{className:$("app-main-tabs","w-100","h-100","d-flex","flex-column",e?`active-tool-${e.toLowerCase()}`:""),onPaste:this.handlePaste,tabIndex:-1,children:[h("nav",{className:"nav-container",children:T("div",{className:"app-main-top-nav-menus",children:[h("img",{src:Ng,alt:"Deephaven Data Labs",width:"115px",className:"ml-1"}),T("div",{children:[T(z,{kind:"ghost",className:"btn-panels-menu",icon:wb,onClick:()=>{},children:["Controls",h(xc,{handleControlSelect:this.handleControlSelect,handleToolSelect:this.handleToolSelect,onClearFilter:this.handleClearFilter})]}),d&&T(z,{kind:"ghost",className:"btn-panels-menu btn-show-panels","data-testid":"app-main-panels-button",onClick:this.handleWidgetMenuClick,icon:fb,children:["Panels",h(An,{isShown:u,className:"panels-menu-popper",onExited:this.handleWidgetsMenuClose,closeOnBlur:!0,interactive:!0,children:h(Oy,{widgets:p,onExportLayout:this.handleExportLayoutClick,onImportLayout:this.handleImportLayoutClick,onResetLayout:this.handleResetLayoutClick,onSelect:this.handleWidgetSelect})})]}),h(z,{kind:"ghost",className:$("btn-settings-menu",{"text-warning":s.operateAs!==s.name}),onClick:this.handleSettingsMenuShow,icon:h(te,{icon:lr,transform:"grow-3 right-1 down-1"}),tooltip:"User Settings"})]})]})}),T(Mv,{emptyDashboard:h(Py,{onAutoFillClick:this.handleAutoFillClick}),id:Fn,layoutConfig:l,onGoldenLayoutChange:this.handleGoldenLayoutChange,onLayoutConfigChange:this.handleLayoutConfigChange,onLayoutInitialized:this.openNotebookFromURL,hydrate:this.hydrateDefault,children:[h(U2,{hydrate:this.hydrateGrid,getDownloadWorker:xl.getServiceWorker,loadPlugin:this.handleLoadTablePlugin}),h(k2,{hydrate:this.hydrateChart}),h(O2,{}),h(L2,{hydrateConsole:Jo.hydrateConsole,notebooksUrl:new URL("/notebooks/",`${window.location}`).href}),h(P2,{}),h(q2,{hydrate:this.hydratePandas}),h(K2,{}),h(G2,{}),g]}),h(gt,{in:m,timeout:ze.transitionMidMs,classNames:"slide-left",mountOnEnter:!0,unmountOnExit:!0,children:h(vo,{serverConfigValues:o,onDone:this.handleSettingsMenuHide})}),h(de,{actions:c}),h("input",{ref:this.importElement,type:"file",accept:".json",style:{display:"none"},onChange:this.handleImportLayoutFiles})]})}}const Xy=t=>{var e,n;return{activeTool:Xl(t),dashboardData:Qt(t,Fn),layoutStorage:_y(t),plugins:_0(t),connection:z1(t,Fn),session:(e=Ei(t,Fn))==null?void 0:e.session,sessionConfig:(n=Ei(t,Fn))==null?void 0:n.config,user:Lm(t),workspace:Yl(t),serverConfigValues:ky(t)}},jy=Mt(Xy,{setActiveTool:Zl,updateDashboardData:ns,updateWorkspaceData:tp})(Mf(Jo));function Zy(){return T("div",{className:"app",children:[h(jy,{}),h(Xu,{})]})}const Qy=J.module("LocalWorkspaceStorage"),qo=class{static async makeDefaultWorkspaceData(t,e){const{filterSets:n,links:s,layoutConfig:i}=await hl.getDefaultLayout(t,e==null?void 0:e.isConsoleAvailable);return{settings:{defaultDateTimeFormat:ot.DEFAULT_DATETIME_FORMAT_STRING,formatter:[],timeZone:ot.DEFAULT_TIME_ZONE_ID,showTimeZone:!1,showTSeparator:!0,disableMoveConfirmation:!1,defaultDecimalFormatOptions:{defaultFormatString:_e.DEFAULT_FORMAT_STRING},defaultIntegerFormatOptions:{defaultFormatString:et.DEFAULT_FORMAT_STRING},truncateNumbersWithPound:!1,defaultNotebookSettings:{isMinimapEnabled:!1}},layoutConfig:i,closed:[{}],links:s,filterSets:n}}static async makeDefaultWorkspace(t,e){return{data:await qo.makeDefaultWorkspaceData(t,e)}}constructor(t){this.layoutStorage=t}async load(t){var e;try{return JSON.parse((e=localStorage.getItem(qo.STORAGE_KEY))!=null?e:"")}catch{return Qy.info("Unable to load workspace data, initializing to default data"),qo.makeDefaultWorkspace(this.layoutStorage,t)}}async save(t){return localStorage.setItem(qo.STORAGE_KEY,JSON.stringify(t)),t}};let Bg=qo;Bg.STORAGE_KEY="deephaven.WorkspaceStorage";class Jy extends Error{constructor(){super(...arguments),this.isNoConsolesError=!0}}function eI(t){return t.isNoConsolesError}const Gs=J.module("SessionUtils");var $g=(t=>(t.ANONYMOUS="anonymous",t.PARENT="parent",t))($g||{});function tI(){return new URL("/jsapi",`${window.location}`)}function zg(){const t=tI();return`${t.protocol}//${t.host}`}function nI(){switch(new URLSearchParams(window.location.search).get("authProvider")){case"parent":return"parent";default:return"anonymous"}}function sI(){const t=zg();return Gs.info(`Starting connection to '${t}'...`),new M.IdeConnection(t)}async function iI(t){Gs.info("Getting console types...");const e=await t.getConsoleTypes();if(Gs.info("Available types:",e),e.length===0)throw new Jy("No console types available");const n=e[0];Gs.info("Starting session with type",n);const s=await t.startSession(n),i={type:n,id:Ge.generate()};return Gs.info("Console session established",i),{session:s,config:i,connection:t}}function oI(){const t=zg();return Gs.info("createCoreClient",t),new M.CoreClient(t)}async function rI(){if(window.opener==null)throw new Error("window.opener is null, unable to send auth request.");return new Promise(t=>{const e=n=>{const{data:s}=n;if(Gs.debug("Received message",s),(s==null?void 0:s.message)!=="loginOptions"){Gs.debug("Ignore received message",s);return}window.removeEventListener("message",e),t(s.payload)};window.addEventListener("message",e),window.opener.postMessage("requestLoginOptionsFromParent","*")})}async function lI(t){switch(t){case"parent":return rI();case"anonymous":return{type:M.CoreClient.LOGIN_TYPE_ANONYMOUS};default:throw new Error(`Unknown auth type: ${t}`)}}class aI{constructor(e,n=""){this.storageService=e,this.root=n}async getLayouts(){return(await this.storageService.listItems(this.root,"*.json")).map(n=>n.basename)}async getLayout(e){const s=await(await this.storageService.loadFile(`${this.root}/${e}`)).text();return JSON.parse(s)}}const Uo=J.module("GrpcFileStorageTable"),bd=class{constructor(t,e="",n=e){this.currentSize=0,this.listeners=[],this.childTables=new Map,this.storageService=t,this.baseRoot=e,this.root=n,n===e&&(this.doRefresh=Je(this.doRefresh.bind(this),bd.REFRESH_DEBOUNCE))}removeBaseRoot(t){return pe.removeRoot(this.baseRoot,t)}getViewportData(){var t;return this.viewportUpdatePromise||this.refreshInternal(),(t=this.viewportUpdatePromise)!=null?t:Promise.resolve({items:[],offset:0})}getSnapshot(t){throw new Error("Method not implemented.")}get size(){return this.currentSize}setExpanded(t,e){const n=t.split("/");let s=n.shift();if((s===void 0||s==="")&&(s=n.shift()),s===void 0||s==="")throw new Error(`Invalid path: ${t}`);const i=n.join("/");if(e){if(!this.childTables.has(s)){const o=new bd(this.storageService,this.baseRoot,`${this.root}/${s}`);this.childTables.set(s,o)}if(i){const o=this.childTables.get(s);o==null||o.setExpanded(i,e)}}else if(this.childTables.has(s))if(i){const o=this.childTables.get(s);o==null||o.setExpanded(i,e)}else this.childTables.delete(s);this.currentViewport&&this.refreshInternal()}collapseAll(){this.childTables.clear(),this.currentViewport&&this.refreshInternal()}setSearch(t){throw new Error("Method not implemented.")}setViewport(t){this.currentViewport=t,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(t){return this.listeners=[...this.listeners,t],()=>{this.listeners=this.listeners.filter(e=>e!==t)}}doRefresh(t){Uo.debug2("doRefresh",this.root),t(this.fetchData())}refresh(){var n;Uo.debug2("refresh",this.root),(n=this.viewportUpdatePromise)==null||n.cancel();const t=new Promise(s=>{this.doRefresh(s)}),e=ye.makeCancelable(t.then(s=>{if(this.viewportUpdatePromise!==e)throw new to;return this.currentViewportData=s,this.sendUpdate(),s}));e.catch(s=>{ye.isCanceled(s)||Uo.error("Error updating viewport",s)}),this.viewportUpdatePromise=e}refreshInternal(){try{this.refresh()}catch(t){ye.isCanceled(t)||Uo.error("Unable to refresh data",t)}}async fetchData(){const{currentViewport:t}=this;if(!t)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:r}=i;if(r===this.removeBaseRoot(`${this.root}/${o}`)&&i.type==="directory"){const l=this.childTables.get(o);if(l!=null){l.setViewport({top:0,bottom:t.bottom-s});const a=await l.getViewportData();n.splice(s+1,0,...a.items)}}}return this.currentSize=n.length,Uo.debug2(this.root,"items",n,t),n=n.slice(t.top,t.bottom),{items:n,offset:t.top}}sendUpdate(){var n;const{listeners:t}=this,e=(n=this.currentViewportData)!=null?n:{items:[],offset:0};for(let s=0;s<t.length;s+=1)t[s](e)}};let Wg=bd;Wg.REFRESH_DEBOUNCE=50;const dI=J.module("GrpcFileStorage"),Gg=class{constructor(t,e=""){this.tables=[],this.refreshTables=Jn(()=>{this.tables.forEach(n=>n.refresh())},Gg.REFRESH_THROTTLE),this.storageService=t,this.root=e}removeRoot(t){return pe.removeRoot(this.root,t)}addRoot(t){return pe.addRoot(this.root,t)}async createDirectory(t){return await this.storageService.createDirectory(this.addRoot(t)),this.refreshTables(),{type:"directory",id:t,filename:t,basename:pe.getBaseName(t)}}async getTable(){const t=new Wg(this.storageService,this.root);return this.tables.push(t),t}async saveFile(t){const e=dh.storage.FileContents.text(t.content);return await this.storageService.saveFile(this.addRoot(t.filename),e,!0),this.refreshTables(),t}async loadFile(t){const n=await(await this.storageService.loadFile(this.addRoot(t))).text();return{filename:t,basename:pe.getBaseName(t),content:n}}async deleteFile(t){await this.storageService.deleteItem(this.addRoot(t)),this.refreshTables()}async moveFile(t,e){await this.storageService.moveItem(this.addRoot(t),this.addRoot(e)),this.refreshTables()}async info(t){const e=await this.storageService.listItems(this.addRoot(pe.getPath(t)),pe.getBaseName(t));if(e.length===0)throw new Tc;if(e.length>1)throw dI.error("More than one matching file found, should never happen.",e),new Error("More than one matching file found");const n=e[0];return{filename:this.removeRoot(n.filename),basename:n.basename,id:this.removeRoot(n.filename),type:n.type}}};let Kg=Gg;Kg.REFRESH_THROTTLE=150;const Ks=J.module("AppInit");async function cI(){Ks.debug("Loading plugins...");try{const t=await Cd.loadJson("/js-plugins/manifest.json");Ks.debug("Plugin manifest loaded:",t);const e=[];for(let i=0;i<t.plugins.length;i+=1){const{name:o,main:r}=t.plugins[i],l=`/js-plugins/${o}/${r}`;e.push(Cd.loadModulePlugin(l))}const n=await Promise.all(e),s=new Map;for(let i=0;i<n.length;i+=1){const{name:o}=t.plugins[i];s.set(o,n[i])}return Ks.info("Plugins loaded:",s),s}catch(t){return Ks.error("Unable to load plugins:",t),new Map}}async function hI(t){let e;try{e=await iI(t)}catch(n){if(!eI(n))throw n}return e}function _c(t){const{workspace:e,setActiveTool:n,setCommandHistoryStorage:s,setDashboardData:i,setFileStorage:o,setLayoutStorage:r,setDashboardConnection:l,setDashboardSessionWrapper:a,setPlugins:d,setUser:c,setWorkspace:u,setWorkspaceStorage:m,setServerConfigValues:p}=t,[g,f]=w.exports.useState(),[b,C]=w.exports.useState(!0),S=w.exports.useCallback(async()=>{var R,N;try{Ks.info("Initializing Web UI","0.29.0",navigator.userAgent);const F=oI(),H=nI();Ks.info(`Login using auth type ${H}...`),await F.login(await lI(H));const U=await cI(),x=await(H===$g.ANONYMOUS&&F.getAsIdeConnection==null?sI():F.getAsIdeConnection());x.addEventListener(M.IdeConnection.HACK_CONNECTION_FAILURE,He=>{var Ct;const{detail:dt}=He;Ks.error("Connection failure",`${JSON.stringify(dt)}`),f(`Unable to connect: ${(Ct=dt.details)!=null?Ct:"Unknown Error"}`)});const A=await hI(x),k="user",W=F.getStorageService(),X=new aI(W,"/layouts"),V=new Kg(W,"/notebooks"),L=new Bg(X),K=new oy,Y=await L.load({isConsoleAvailable:A!==void 0}),{data:P}=Y,{settings:G}=P;G.defaultDecimalFormatOptions===void 0&&(G.defaultDecimalFormatOptions={defaultFormatString:_e.DEFAULT_FORMAT_STRING}),G.defaultIntegerFormatOptions===void 0&&(G.defaultIntegerFormatOptions={defaultFormatString:et.DEFAULT_FORMAT_STRING}),G.truncateNumbersWithPound===void 0&&(G.truncateNumbersWithPound=!1);const{shortcutOverrides:Z={}}=G,ae=qt.isMacPlatform?(R=Z.mac)!=null?R:{}:(N=Z.windows)!=null?N:{};Object.entries(ae).forEach(([He,dt])=>{var Ct;(Ct=Le.get(He))==null||Ct.setKeyState(dt)});const j={filterSets:P.filterSets,links:P.links},he=await F.getServerConfigValues(),Ce=new Map(he),Re={name:k,operateAs:k,groups:[],permissions:{isSuperUser:!1,isQueryViewOnly:!1,isNonInteractive:!1,canUsePanels:!0,canCreateDashboard:!0,canCreateCodeStudio:!0,canCreateQueryMonitor:!0,canCopy:Ce.get("internal.webClient.appInit.canCopy")!=="false",canDownloadCsv:Ce.get("internal.webClient.appInit.canDownloadCsv")!=="false"}};n(Xt.DEFAULT),p(Ce),s(K),i(Fn,j),o(V),r(X),l(Fn,x),A!==void 0&&a(Fn,A),d(U),c(Re),m(L),u(Y)}catch(F){Ks.error(F),f(F)}},[n,s,i,o,r,l,a,d,c,u,m,p]),v=w.exports.useCallback(()=>{document.fonts!=null?document.fonts.ready.then(()=>{C(!1)}):C(!1)},[]);w.exports.useEffect(function(){S(),v()},[S,v]);const y=e==null&&g==null||b,E=!y&&g==null,I=g!=null?`${g}`:null;return T(Te,{children:[E&&h(Zy,{}),h(Bl,{isLoading:y,isLoaded:E,errorMessage:I}),T("div",{id:"preload-fonts",style:{visibility:"hidden",position:"absolute",top:-1e4},children:[h("p",{className:"fira-sans-regular",children:"preload"}),h("p",{className:"fira-sans-semibold",children:"preload"}),h("p",{className:"fira-mono",children:"preload"})]})]})}_c.propTypes={workspace:D.exports.shape({}),workspaceStorage:D.exports.shape({close:D.exports.func}),setActiveTool:D.exports.func.isRequired,setCommandHistoryStorage:D.exports.func.isRequired,setDashboardData:D.exports.func.isRequired,setFileStorage:D.exports.func.isRequired,setLayoutStorage:D.exports.func.isRequired,setDashboardConnection:D.exports.func.isRequired,setDashboardSessionWrapper:D.exports.func.isRequired,setPlugins:D.exports.func.isRequired,setUser:D.exports.func.isRequired,setWorkspace:D.exports.func.isRequired,setWorkspaceStorage:D.exports.func.isRequired};_c.defaultProps={workspace:null,workspaceStorage:null};const uI=t=>({workspace:Yl(t),workspaceStorage:N0(t)}),vu=Mt(uI,{setActiveTool:Zl,setCommandHistoryStorage:A0,setDashboardData:Ip,setFileStorage:L0,setLayoutStorage:ry,setDashboardConnection:W1,setDashboardSessionWrapper:G1,setPlugins:H0,setUser:k0,setWorkspace:ep,setWorkspaceStorage:O0,setServerConfigValues:U0})(_c);function mI(){return h(Nf,{basename:"/ide/",children:T(Ff,{children:[h($c,{exact:!0,path:"/",component:vu}),h($c,{path:"/notebook/:notebookPath+",component:vu}),h(xf,{from:"*",to:"/"})]})})}Boolean(window.location.hostname==="localhost"||window.location.hostname==="[::1]"||window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/));function pI(){"serviceWorker"in navigator&&navigator.serviceWorker.getRegistrations().then(t=>{t.forEach(e=>{e.scope.endsWith("/download/")||e.unregister()})})}vy();wi.render(h(yu,{store:Ql,children:h(mI,{})}),document.getElementById("root"));pI();xl.registerOnLoaded();at.init({getWorker:()=>new kf});window["__react-beautiful-dnd-disable-dev-warnings"]=!0;
|
|
47
|
-
//# sourceMappingURL=index.
|
|
46
|
+
Barrage Version: ${i}`,children:"Copy Versions"})]})]})]}),h("div",{className:"app-settings-footer-item",children:h(py,{})})]}),h("div",{className:"app-settings-footer-section",children:h("div",{className:"logo",children:h("a",{target:"_blank",rel:"noreferrer noopener",href:"https://deephaven.io",className:"d-inline-block custom-link p-1",children:h("img",{src:Ng,alt:"Deephaven Data Labs",width:"230px"})})})})]})]})]})}};let vo=gs;vo.defaultProps={onDone:()=>{}};vo.FORMATTING_SECTION_KEY="SettingsMenu.formatting";vo.COLUMN_SPECIFIC_SECTION_KEY="SettingsMenu.columnFormatting";vo.APPLICATION_SECTION_KEY="ApplicationMenu.settings";vo.SHORTCUT_SECTION_KEY="SettingsMenu.shortcuts";const Su=10;function Yi(t){const{forwardedProps:{menuItem:{action:e,title:n,disabled:s},iconElement:i,displayShortcut:o,isMouseSelected:r,isKeyboardSelected:l,closeMenu:a}}=t,d=w.exports.useRef(),c=w.exports.useRef(),u=w.exports.useRef(null),[m,p]=w.exports.useState(!1),g=w.exports.useCallback(C=>{d.current!=null&&c.current!=null&&u.current&&(Math.abs(d.current-C.clientX)>=Su||Math.abs(c.current-C.clientY)>=Su)&&(p(!0),window.removeEventListener("mousemove",g),a(),e(C),u.current=null)},[e,a]);function f(C){d.current=C.clientX,c.current=C.clientY,u.current=C.target,window.addEventListener("mousemove",g)}function b(C){u.current===C.target&&(p(!0),a(),e(),window.removeEventListener("mousemove",g)),u.current=null}return w.exports.useEffect(function(){return function(){return window.removeEventListener("mousemove",g)}},[g]),T("button",{type:"button",className:$("btn-context-menu",{disabled:s},{active:r&&!s},{"keyboard-active":l&&!s}),onMouseDown:f,onMouseUp:b,disabled:m,children:[h("span",{className:$("icon"),children:i}),h("span",{className:"title",children:n}),h("span",{className:"shortcut",children:o})]})}function xc(t){const{handleControlSelect:e,handleToolSelect:n,onClearFilter:s}=t,i=w.exports.useMemo(()=>[{title:"Input Filter",icon:pb,menuElement:h(Yi,{}),action:o=>{e(Tn.INPUT_FILTER,o)},order:10},{title:"Dropdown Filter",icon:zu,menuElement:h(Yi,{}),action:o=>{e(Tn.DROPDOWN_FILTER,o)},order:15},{title:"Markdown Widget",icon:zC,menuElement:h(Yi,{}),action:o=>{e(Tn.MARKDOWN,o)},order:20},{title:"Filter Sets",icon:Ka,menuElement:h(Yi,{}),action:o=>{e(Tn.FILTER_SET_MANAGER,o)},order:25},{disabled:!0,menuElement:h("div",{className:"context-menu-group-header",children:"Tools"}),order:30},{title:"Linker",icon:Rd,action:()=>{n(Xt.LINKER)},order:40,shortcut:vs.LINKER},{disabled:!0,menuElement:h("div",{className:"context-menu-group-header",children:"Actions"}),order:50},{title:"Clear All Filters",icon:cb,action:()=>{s()},order:60,shortcut:dn.TABLE.CLEAR_ALL_FILTERS}],[e,n,s]);return h(_n,{popperClassName:"controls-menu-popper",actions:i})}xc.propTypes={handleControlSelect:D.exports.func,handleToolSelect:D.exports.func,onClearFilter:D.exports.func};xc.defaultProps={handleControlSelect:()=>{},handleToolSelect:()=>{},onClearFilter:()=>{}};Yi.propTypes={forwardedProps:D.exports.shape({iconElement:D.exports.node,displayShortcut:D.exports.string,isMouseSelected:D.exports.bool.isRequired,isKeyboardSelected:D.exports.bool.isRequired,closeMenu:D.exports.func.isRequired,menuItem:D.exports.shape({action:D.exports.func,title:D.exports.string,disabled:D.exports.bool}).isRequired})};Yi.defaultProps={forwardedProps:null};const Fy=Ys(Mg,null),xy={layoutStorage:Fy},_y=t=>t.layoutStorage,ky=t=>t.serverConfigValues;Object.entries(xy).map(([t,e])=>po.register(t,e));const wu=10;function Oy(t){const{onExportLayout:e,onImportLayout:n,onResetLayout:s,onSelect:i,widgets:o=[]}=t,[r,l]=w.exports.useState(!1),[a,d]=w.exports.useState(""),c=w.exports.useRef(null),u=w.exports.useRef(),m=w.exports.useCallback((y,E)=>{y!=null&&i(y,E)},[i]),p=w.exports.useCallback(y=>{d(y.target.value)},[]),g=w.exports.useCallback(y=>{u.current!=null&&(Math.abs(u.current.x-y.clientX)>=wu||Math.abs(u.current.y-y.clientY)>=wu)&&(l(!0),window.removeEventListener("mousemove",g),m(u.current.widget,y),u.current=void 0)},[u,m]),f=w.exports.useCallback((y,E)=>{u.current={x:y.clientX,y:y.clientY,widget:E},window.addEventListener("mousemove",g)},[g]),b=w.exports.useCallback((y,E)=>{var I;window.removeEventListener("mousemove",g),((I=u.current)==null?void 0:I.widget)===E&&(l(!0),m(E)),u.current=void 0},[g,u,m]),C=w.exports.useMemo(()=>o.filter(y=>{var E;return a?(E=y.name)==null?void 0:E.toLowerCase().includes(a.toLowerCase()):!0}),[a,o]).sort((y,E)=>{var I,R,N;return(N=(R=y.name)==null?void 0:R.localeCompare((I=E.name)!=null?I:""))!=null?N:0}),S=w.exports.useMemo(()=>C.map(y=>{var E,I;return h("li",{children:T(z,{kind:"ghost","data-testid":`panel-list-item-${(E=y.name)!=null?E:""}-button`,onMouseDown:R=>{f(R,y)},onMouseUp:R=>{b(R,y)},onKeyDown:R=>{(R.key==="Enter"||R.key===" ")&&m(y)},disabled:r,onClick:()=>{},children:[h(um,{type:y.type})," ",(I=y.name)!=null?I:""]})},y.name)}),[C,r,f,b,m]),v=w.exports.useMemo(()=>S.length===0?h("span",{children:"No bound variables found."}):null,[S]);return T("div",{className:"widget-list-container d-flex flex-column",children:[h("div",{className:"widget-list-header",children:h(Es,{value:a,placeholder:"Find Table, Plot or Widget",onChange:p,ref:c})}),T("ul",{className:"widget-list flex-grow-1",children:[v&&h("li",{className:"widget-list-message",children:v}),!v&&S]}),h("div",{children:h("hr",{})}),T("div",{className:"widget-list-footer",children:[T(z,{kind:"ghost",onClick:e,children:[T("div",{className:"fa-md fa-layers",children:[h(te,{mask:qa,icon:Kc,transform:"right-5 down-5"}),h(te,{icon:Kc,transform:"right-8 down-6"})]}),"Export Layout"]}),T(z,{kind:"ghost",onClick:n,children:[T("div",{className:"fa-md fa-layers",children:[h(te,{mask:qa,icon:Ga,transform:"right-5 down-5"}),h(te,{icon:Ga,transform:"right-8 down-6"})]}),"Import Layout"]}),h(z,{kind:"ghost",icon:mi,onClick:s,tooltip:"Reset Layout"})]})]})}const Ay=async(t,e,n)=>{let s,i,o,r;if(rl(e)?(s=e.settings,i=e.table,o=void 0,r=e.tableSettings):(s={},i="",o=e.figure,r={}),n!==void 0&&(n.tableSettings!=null&&(r=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 d={title:o,name:o,type:M.VariableType.FIGURE},c=await t.getObject(d);return so.makeModel(s,c)}const l={title:o,name:i,type:M.VariableType.TABLE},a=await t.getObject(l);return ie.applyTableSettings(a,r,dr(Ql.getState())),so.makeModelFromSettings(s,a)},Ly=async(t,e,n=M.VariableType.TABLE)=>{const{table:s}=e,i={title:s,name:s,type:n},o=await t.getObject(i);return uc.makeModel(o)};function Py({onAutoFillClick:t=()=>{}}){return T("div",{className:"empty-dashboard-container",children:[T("div",{className:"hint-container",children:[h(te,{icon:ku})," ",h("br",{}),"Use the panel list to add objects from a query."]}),T("div",{className:"empty-dashboard",children:[h("div",{className:"add-panels-hint",children:"Drag Panels Here"}),h(z,{kind:"tertiary",onClick:t,children:"Auto fill objects"})]})]})}function Hy(t){return t.version===2}function Uy(t){return Array.isArray(t)}const el=J.module("UserLayoutUtils"),Vy={layoutConfig:[{type:"column",content:[{type:"row",height:40,content:[{type:"stack",content:[{type:"react-component",component:qi.COMPONENT,title:qi.TITLE,isClosable:!1},{type:"react-component",component:Fl.COMPONENT,title:Fl.TITLE,isClosable:!1}]},{type:"stack",width:25,content:[{type:"react-component",component:Dl.COMPONENT,title:Dl.TITLE,isClosable:!1},{type:"react-component",component:Ml.COMPONENT,title:Ml.TITLE,isClosable:!1}]}]},{type:"row",content:[{type:"stack",title:"Notebooks",content:[]}]}]}],links:[],filterSets:[],version:2},By={layoutConfig:[],links:[],filterSets:[],version:2};function Hg(t){if(Hy(t))return t;if(Uy(t))return{layoutConfig:t,links:[],filterSets:[],version:2};throw new Error(`Unexpected layout import format: ${t}`)}async function $y(t,e=!0){try{const n=await t.getLayouts();if(n.length>0)try{const s=await t.getLayout(n[0]);return Hg(s)}catch(s){el.error("Unable to load layout",n[0],":",s),el.warn("No valid layouts found, falling back to default layout")}}catch(n){el.error("Unable to fetch layout list",n),el.warn("Falling back to default layout")}return e?Vy:By}function zy(t){const{filterSets:e,layoutConfig:n,links:s}=t;return{filterSets:e,layoutConfig:n,links:s,version:2}}const hl={exportLayout:zy,getDefaultLayout:$y,normalizeLayout:Hg},tl=J.module("DownloadServiceWorkerUtils"),Ug=class{static registerOnLoaded(){new URL("./",window.location.href).origin===window.location.origin&&("serviceWorker"in navigator?window.addEventListener("load",()=>{const e=new URL("./download/serviceWorker.js",window.location.href);navigator.serviceWorker.register(e).then(n=>{n.update(),tl.info("Registering service worker on ",e,n)}).catch(n=>{tl.error("Failed to register service worker",n)})}):tl.info("Service worker is not supported."))}static async getServiceWorker(){if("serviceWorker"in navigator){const e=(await navigator.serviceWorker.getRegistrations()).find(n=>n.scope.endsWith(Ug.DOWNLOAD_PATH));if(e&&e.active)return tl.info("Download service worker is active."),e.active;throw new Error("Can not find download service worker.")}throw new Error("Download service worker is not available.")}static unregisterSW(){}};let xl=Ug;xl.DOWNLOAD_PATH="/download/";const Vg={react:Q},Wy=yf(Vg),Gy=If({requires:Wy}),Ky=Rf.createRequires(Vg),qy=Df({requires:Ky}),Yy=J.module("PluginUtils");class Cd{static loadComponentPlugin(e){if("".split(",").includes(e)){const o=Q.lazy(()=>_f(()=>import(`./internal/${e}`),[],import.meta.url)),r=Q.forwardRef((l,a)=>h(w.exports.Suspense,{fallback:h("div",{children:"Loading Plugin..."}),children:h(o,{ref:a,...l})}));return r.pluginName=e,r.displayName="Local Plugin",r}const n=new URL("./plugins/",`${window.location}`),s=new URL(`${e}.js`,n),i=Q.forwardRef((o,r)=>h(Gy,{url:s,render:({err:l,Component:a})=>{if(l!=null&&l!==""){const d=`Error loading plugin ${e} from ${s} due to ${l}`;return Yy.error(d),h("div",{className:"error-message",children:`${d}`})}return h(a,{ref:r,...o})}}));return i.pluginName=e,i.displayName="Plugin",i}static async loadModulePlugin(e){return await qy(e)}static async loadJson(e){return new Promise((n,s)=>{const i=new XMLHttpRequest;i.addEventListener("load",()=>{try{const o=JSON.parse(i.responseText);n(o)}catch(o){s(o)}}),i.addEventListener("error",o=>{s(o)}),i.open("GET",e),i.send()})}}const Ut=J.module("AppMainContainer");class Jo extends w.exports.Component{constructor(e){super(e),this.getDashboardPlugins=Se(n=>[...n.entries()].filter(([,s])=>s.DashboardPlugin!=null).map(([s,{DashboardPlugin:i}])=>h(i,{},s))),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.importElement=Q.createRef(),this.state={contextActions:[{action:()=>{this.handleToolSelect(Xt.LINKER)},shortcut:vs.LINKER,isGlobal:!0},{action:()=>{this.sendClearFilter()},shortcut:dn.TABLE.CLEAR_ALL_FILTERS,isGlobal:!0},{action:()=>{Ut.debug("Consume unhandled save shortcut")},shortcut:vs.SAVE,isGlobal:!0}],isPanelsMenuShown:!1,isSettingsMenuShown:!1,widgets:[]}}static handleWindowBeforeUnload(e){e.preventDefault(),e.returnValue=""}static hydrateConsole(e,n){return id.hydrate({...e,unzip:s=>Du.loadAsync(s).then(i=>Object.values(i.files))},n)}componentDidMount(){this.initWidgets(),window.addEventListener("beforeunload",Jo.handleWindowBeforeUnload)}componentDidUpdate(e){const{dashboardData:n}=this.props;e.dashboardData!==n&&this.handleDataChange(n)}componentWillUnmount(){this.deinitWidgets(),window.removeEventListener("beforeunload",Jo.handleWindowBeforeUnload)}initWidgets(){const{connection:e}=this.props;if(e.subscribeToFieldUpdates==null){Ut.warn("subscribeToFieldUpdates not supported, not initializing widgets");return}this.widgetListenerRemover=e.subscribeToFieldUpdates(n=>{Ut.debug("Got updates",n),this.setState(({widgets:s})=>{const{updated:i,created:o,removed:r}=n,l=[...i,...r],a=s.filter(c=>!l.some(u=>u.name===c.name));return[...i,...o].forEach(c=>{c.name!=null&&c.name!==""&&a.push(c)}),{widgets:a}})})}deinitWidgets(){var e;(e=this.widgetListenerRemover)==null||e.call(this)}openNotebookFromURL(){const{match:e}=this.props,{notebookPath:n}=e.params;if(n){const{session:s,sessionConfig:i}=this.props;if(s==null||i==null){Ut.error("No session available to open notebook URL",n);return}const o={id:`/${n}`,itemName:`/${n}`},r=i.type,l={value:null,language:r};this.emitLayoutEvent(Ae.SELECT_NOTEBOOK,s,r,l,o,!0)}}sendClearFilter(){this.emitLayoutEvent(Pe.CLEAR_ALL_FILTERS)}emitLayoutEvent(e,...n){var s;(s=this.goldenLayout)==null||s.eventHub.emit(e,...n)}handleError(e){ye.isCanceled(e)||Ut.error(e)}handleSettingsMenuHide(){this.setState({isSettingsMenuShown:!1})}handleSettingsMenuShow(){this.setState({isSettingsMenuShown:!0})}handleControlSelect(e,n=null){switch(Ut.debug("handleControlSelect",e),e){case Tn.DROPDOWN_FILTER:this.emitLayoutEvent(Pe.OPEN_DROPDOWN,{title:"DropdownFilter",type:e,createNewStack:!0,dragEvent:n});break;case Tn.INPUT_FILTER:this.emitLayoutEvent(Pe.OPEN_INPUT,{title:"InputFilter",type:e,createNewStack:!0,dragEvent:n});break;case Tn.MARKDOWN:this.emitLayoutEvent(ag.OPEN,{title:"Markdown",type:e,dragEvent:n});break;case Tn.FILTER_SET_MANAGER:this.emitLayoutEvent(Pe.OPEN_FILTER_SET_MANAGER,{title:"FilterSets",type:e,dragEvent:n});break;default:throw new Error(`Unrecognized control type ${e}`)}}handleToolSelect(e){Ut.debug("handleToolSelect",e);const{activeTool:n,setActiveTool:s}=this.props;s(n===e?Xt.DEFAULT:e)}handleClearFilter(){this.sendClearFilter()}handleDataChange(e){const{updateWorkspaceData:n}=this.props,{closed:s,filterSets:i,links:o}=e;n({closed:s,filterSets:i,links:o})}handleGoldenLayoutChange(e){this.goldenLayout=e}handleLayoutConfigChange(e){const{updateWorkspaceData:n}=this.props;n({layoutConfig:e})}handleWidgetMenuClick(){this.setState(({isPanelsMenuShown:e})=>({isPanelsMenuShown:!e}))}handleWidgetSelect(e,n){this.setState({isPanelsMenuShown:!1}),Ut.debug("handleWidgetSelect",e,n),this.openWidget(e,n)}handleWidgetsMenuClose(){this.setState({isPanelsMenuShown:!1})}handleAutoFillClick(){const{widgets:e}=this.state;Ut.debug("handleAutoFillClick",e);const n=e.sort((s,i)=>s.title!=null&&i.title!=null?s.title.localeCompare(i.title):0);for(let s=0;s<n.length;s+=1)this.openWidget(n[s])}handleExportLayoutClick(){Ut.info("handleExportLayoutClick"),this.setState({isPanelsMenuShown:!1});try{const{workspace:e}=this.props,{data:n}=e,s=hl.exportLayout(n);Ut.info("handleExportLayoutClick exportedConfig",s);const i=new Blob([JSON.stringify(s)],{type:"application/json"}),o=M.i18n.DateTimeFormat.format("yyyy-MM-dd-HHmmss",new Date),r=document.createElement("a");r.href=URL.createObjectURL(i),r.download=`deephaven-app-layout-${o}.json`,r.click()}catch(e){Ut.error("Unable to export layout",e)}}handleImportLayoutClick(){Ut.info("handleImportLayoutClick"),this.setState({isPanelsMenuShown:!1}),this.importElement.current!=null&&(this.importElement.current.value="",this.importElement.current.click())}handleResetLayoutClick(){Ut.info("handleResetLayoutClick"),this.setState({isPanelsMenuShown:!1}),this.resetLayout()}handleImportLayoutFiles(e){var n;e.stopPropagation(),e.preventDefault(),e.target.files!=null&&this.importLayoutFile((n=e.target.files)==null?void 0:n[0])}async importLayoutFile(e){try{const{updateDashboardData:n,updateWorkspaceData:s}=this.props,i=await e.text(),o=JSON.parse(i),{filterSets:r,layoutConfig:l,links:a}=hl.normalizeLayout(o);s({layoutConfig:l}),n(Fn,{filterSets:r,links:a})}catch(n){Ut.error("Unable to import layout",n)}}async resetLayout(){const{layoutStorage:e,session:n}=this.props,{filterSets:s,layoutConfig:i,links:o}=await hl.getDefaultLayout(e,n!==void 0),{updateDashboardData:r,updateWorkspaceData:l}=this.props;l({layoutConfig:i}),r(Fn,{filterSets:s,links:o})}handlePaste(e){if(e.target instanceof HTMLElement&&e.target.closest(".monaco-editor"))return;const{clipboardData:n}=e,s=n.getData("Text"),i=/“|”/g;i.test(s)&&(e.preventDefault(),e.stopPropagation(),document.execCommand("insertText",!1,s.replace(i,'"')))}handleLoadTablePlugin(e){const{plugins:n}=this.props,s=n.get(e);return s!=null&&s.TablePlugin!=null?s.TablePlugin:Cd.loadComponentPlugin(e)}hydrateDefault(e,n){const{connection:s}=this.props,{metadata:i}=e;if((i==null?void 0:i.type)!=null&&((i==null?void 0:i.id)!=null||(i==null?void 0:i.name)!=null)){const o=i.id!=null?{type:i.type,id:i.id}:{type:i.type,name:i.name,title:i.name};return{fetch:()=>s.getObject(o),localDashboardId:n,...e}}return id.hydrate(e,n)}hydrateGrid(e,n){var s;return this.hydrateTable(e,n,(s=e.metadata.type)!=null?s:M.VariableType.TABLE)}hydratePandas(e,n){return this.hydrateTable(e,n,M.VariableType.PANDAS)}hydrateTable(e,n,s=M.VariableType.TABLE){const{connection:i}=this.props;return{...e,getDownloadWorker:xl.getServiceWorker,loadPlugin:this.handleLoadTablePlugin,localDashboardId:n,makeModel:()=>Ly(i,e.metadata,s)}}hydrateChart(e,n){const{connection:s}=this.props;return{...e,localDashboardId:n,makeModel:()=>{const{metadata:i,panelState:o}=e;return Ay(s,i,o)}}}openWidget(e,n){const{connection:s}=this.props;this.emitLayoutEvent(De.OPEN,{dragEvent:n,fetch:()=>s.getObject(e),widget:e})}render(){const{activeTool:e,plugins:n,user:s,workspace:i,serverConfigValues:o}=this.props,{data:r}=i,{layoutConfig:l}=r,{permissions:a}=s,{canUsePanels:d}=a,{contextActions:c,isPanelsMenuShown:u,isSettingsMenuShown:m,widgets:p}=this.state,g=this.getDashboardPlugins(n);return T("div",{className:$("app-main-tabs","w-100","h-100","d-flex","flex-column",e?`active-tool-${e.toLowerCase()}`:""),onPaste:this.handlePaste,tabIndex:-1,children:[h("nav",{className:"nav-container",children:T("div",{className:"app-main-top-nav-menus",children:[h("img",{src:Ng,alt:"Deephaven Data Labs",width:"115px",className:"ml-1"}),T("div",{children:[T(z,{kind:"ghost",className:"btn-panels-menu",icon:wb,onClick:()=>{},children:["Controls",h(xc,{handleControlSelect:this.handleControlSelect,handleToolSelect:this.handleToolSelect,onClearFilter:this.handleClearFilter})]}),d&&T(z,{kind:"ghost",className:"btn-panels-menu btn-show-panels","data-testid":"app-main-panels-button",onClick:this.handleWidgetMenuClick,icon:fb,children:["Panels",h(An,{isShown:u,className:"panels-menu-popper",onExited:this.handleWidgetsMenuClose,closeOnBlur:!0,interactive:!0,children:h(Oy,{widgets:p,onExportLayout:this.handleExportLayoutClick,onImportLayout:this.handleImportLayoutClick,onResetLayout:this.handleResetLayoutClick,onSelect:this.handleWidgetSelect})})]}),h(z,{kind:"ghost",className:$("btn-settings-menu",{"text-warning":s.operateAs!==s.name}),onClick:this.handleSettingsMenuShow,icon:h(te,{icon:lr,transform:"grow-3 right-1 down-1"}),tooltip:"User Settings"})]})]})}),T(Mv,{emptyDashboard:h(Py,{onAutoFillClick:this.handleAutoFillClick}),id:Fn,layoutConfig:l,onGoldenLayoutChange:this.handleGoldenLayoutChange,onLayoutConfigChange:this.handleLayoutConfigChange,onLayoutInitialized:this.openNotebookFromURL,hydrate:this.hydrateDefault,children:[h(U2,{hydrate:this.hydrateGrid,getDownloadWorker:xl.getServiceWorker,loadPlugin:this.handleLoadTablePlugin}),h(k2,{hydrate:this.hydrateChart}),h(O2,{}),h(L2,{hydrateConsole:Jo.hydrateConsole,notebooksUrl:new URL("../notebooks/",`${window.location}`).href}),h(P2,{}),h(q2,{hydrate:this.hydratePandas}),h(K2,{}),h(G2,{}),g]}),h(gt,{in:m,timeout:ze.transitionMidMs,classNames:"slide-left",mountOnEnter:!0,unmountOnExit:!0,children:h(vo,{serverConfigValues:o,onDone:this.handleSettingsMenuHide})}),h(de,{actions:c}),h("input",{ref:this.importElement,type:"file",accept:".json",style:{display:"none"},onChange:this.handleImportLayoutFiles})]})}}const Xy=t=>{var e,n;return{activeTool:Xl(t),dashboardData:Qt(t,Fn),layoutStorage:_y(t),plugins:_0(t),connection:z1(t,Fn),session:(e=Ei(t,Fn))==null?void 0:e.session,sessionConfig:(n=Ei(t,Fn))==null?void 0:n.config,user:Lm(t),workspace:Yl(t),serverConfigValues:ky(t)}},jy=Mt(Xy,{setActiveTool:Zl,updateDashboardData:ns,updateWorkspaceData:tp})(Mf(Jo));function Zy(){return T("div",{className:"app",children:[h(jy,{}),h(Xu,{})]})}const Qy=J.module("LocalWorkspaceStorage"),qo=class{static async makeDefaultWorkspaceData(t,e){const{filterSets:n,links:s,layoutConfig:i}=await hl.getDefaultLayout(t,e==null?void 0:e.isConsoleAvailable);return{settings:{defaultDateTimeFormat:ot.DEFAULT_DATETIME_FORMAT_STRING,formatter:[],timeZone:ot.DEFAULT_TIME_ZONE_ID,showTimeZone:!1,showTSeparator:!0,disableMoveConfirmation:!1,defaultDecimalFormatOptions:{defaultFormatString:_e.DEFAULT_FORMAT_STRING},defaultIntegerFormatOptions:{defaultFormatString:et.DEFAULT_FORMAT_STRING},truncateNumbersWithPound:!1,defaultNotebookSettings:{isMinimapEnabled:!1}},layoutConfig:i,closed:[{}],links:s,filterSets:n}}static async makeDefaultWorkspace(t,e){return{data:await qo.makeDefaultWorkspaceData(t,e)}}constructor(t){this.layoutStorage=t}async load(t){var e;try{return JSON.parse((e=localStorage.getItem(qo.STORAGE_KEY))!=null?e:"")}catch{return Qy.info("Unable to load workspace data, initializing to default data"),qo.makeDefaultWorkspace(this.layoutStorage,t)}}async save(t){return localStorage.setItem(qo.STORAGE_KEY,JSON.stringify(t)),t}};let Bg=qo;Bg.STORAGE_KEY="deephaven.WorkspaceStorage";class Jy extends Error{constructor(){super(...arguments),this.isNoConsolesError=!0}}function eI(t){return t.isNoConsolesError}const Gs=J.module("SessionUtils");var $g=(t=>(t.ANONYMOUS="anonymous",t.PARENT="parent",t))($g||{});function tI(){return new URL("/jsapi",`${window.location}`)}function zg(){const t=tI();return`${t.protocol}//${t.host}`}function nI(){switch(new URLSearchParams(window.location.search).get("authProvider")){case"parent":return"parent";default:return"anonymous"}}function sI(){const t=zg();return Gs.info(`Starting connection to '${t}'...`),new M.IdeConnection(t)}async function iI(t){Gs.info("Getting console types...");const e=await t.getConsoleTypes();if(Gs.info("Available types:",e),e.length===0)throw new Jy("No console types available");const n=e[0];Gs.info("Starting session with type",n);const s=await t.startSession(n),i={type:n,id:Ge.generate()};return Gs.info("Console session established",i),{session:s,config:i,connection:t}}function oI(){const t=zg();return Gs.info("createCoreClient",t),new M.CoreClient(t)}async function rI(){if(window.opener==null)throw new Error("window.opener is null, unable to send auth request.");return new Promise(t=>{const e=n=>{const{data:s}=n;if(Gs.debug("Received message",s),(s==null?void 0:s.message)!=="loginOptions"){Gs.debug("Ignore received message",s);return}window.removeEventListener("message",e),t(s.payload)};window.addEventListener("message",e),window.opener.postMessage("requestLoginOptionsFromParent","*")})}async function lI(t){switch(t){case"parent":return rI();case"anonymous":return{type:M.CoreClient.LOGIN_TYPE_ANONYMOUS};default:throw new Error(`Unknown auth type: ${t}`)}}class aI{constructor(e,n=""){this.storageService=e,this.root=n}async getLayouts(){return(await this.storageService.listItems(this.root,"*.json")).map(n=>n.basename)}async getLayout(e){const s=await(await this.storageService.loadFile(`${this.root}/${e}`)).text();return JSON.parse(s)}}const Uo=J.module("GrpcFileStorageTable"),bd=class{constructor(t,e="",n=e){this.currentSize=0,this.listeners=[],this.childTables=new Map,this.storageService=t,this.baseRoot=e,this.root=n,n===e&&(this.doRefresh=Je(this.doRefresh.bind(this),bd.REFRESH_DEBOUNCE))}removeBaseRoot(t){return pe.removeRoot(this.baseRoot,t)}getViewportData(){var t;return this.viewportUpdatePromise||this.refreshInternal(),(t=this.viewportUpdatePromise)!=null?t:Promise.resolve({items:[],offset:0})}getSnapshot(t){throw new Error("Method not implemented.")}get size(){return this.currentSize}setExpanded(t,e){const n=t.split("/");let s=n.shift();if((s===void 0||s==="")&&(s=n.shift()),s===void 0||s==="")throw new Error(`Invalid path: ${t}`);const i=n.join("/");if(e){if(!this.childTables.has(s)){const o=new bd(this.storageService,this.baseRoot,`${this.root}/${s}`);this.childTables.set(s,o)}if(i){const o=this.childTables.get(s);o==null||o.setExpanded(i,e)}}else if(this.childTables.has(s))if(i){const o=this.childTables.get(s);o==null||o.setExpanded(i,e)}else this.childTables.delete(s);this.currentViewport&&this.refreshInternal()}collapseAll(){this.childTables.clear(),this.currentViewport&&this.refreshInternal()}setSearch(t){throw new Error("Method not implemented.")}setViewport(t){this.currentViewport=t,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(t){return this.listeners=[...this.listeners,t],()=>{this.listeners=this.listeners.filter(e=>e!==t)}}doRefresh(t){Uo.debug2("doRefresh",this.root),t(this.fetchData())}refresh(){var n;Uo.debug2("refresh",this.root),(n=this.viewportUpdatePromise)==null||n.cancel();const t=new Promise(s=>{this.doRefresh(s)}),e=ye.makeCancelable(t.then(s=>{if(this.viewportUpdatePromise!==e)throw new to;return this.currentViewportData=s,this.sendUpdate(),s}));e.catch(s=>{ye.isCanceled(s)||Uo.error("Error updating viewport",s)}),this.viewportUpdatePromise=e}refreshInternal(){try{this.refresh()}catch(t){ye.isCanceled(t)||Uo.error("Unable to refresh data",t)}}async fetchData(){const{currentViewport:t}=this;if(!t)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:r}=i;if(r===this.removeBaseRoot(`${this.root}/${o}`)&&i.type==="directory"){const l=this.childTables.get(o);if(l!=null){l.setViewport({top:0,bottom:t.bottom-s});const a=await l.getViewportData();n.splice(s+1,0,...a.items)}}}return this.currentSize=n.length,Uo.debug2(this.root,"items",n,t),n=n.slice(t.top,t.bottom),{items:n,offset:t.top}}sendUpdate(){var n;const{listeners:t}=this,e=(n=this.currentViewportData)!=null?n:{items:[],offset:0};for(let s=0;s<t.length;s+=1)t[s](e)}};let Wg=bd;Wg.REFRESH_DEBOUNCE=50;const dI=J.module("GrpcFileStorage"),Gg=class{constructor(t,e=""){this.tables=[],this.refreshTables=Jn(()=>{this.tables.forEach(n=>n.refresh())},Gg.REFRESH_THROTTLE),this.storageService=t,this.root=e}removeRoot(t){return pe.removeRoot(this.root,t)}addRoot(t){return pe.addRoot(this.root,t)}async createDirectory(t){return await this.storageService.createDirectory(this.addRoot(t)),this.refreshTables(),{type:"directory",id:t,filename:t,basename:pe.getBaseName(t)}}async getTable(){const t=new Wg(this.storageService,this.root);return this.tables.push(t),t}async saveFile(t){const e=dh.storage.FileContents.text(t.content);return await this.storageService.saveFile(this.addRoot(t.filename),e,!0),this.refreshTables(),t}async loadFile(t){const n=await(await this.storageService.loadFile(this.addRoot(t))).text();return{filename:t,basename:pe.getBaseName(t),content:n}}async deleteFile(t){await this.storageService.deleteItem(this.addRoot(t)),this.refreshTables()}async moveFile(t,e){await this.storageService.moveItem(this.addRoot(t),this.addRoot(e)),this.refreshTables()}async info(t){const e=await this.storageService.listItems(this.addRoot(pe.getPath(t)),pe.getBaseName(t));if(e.length===0)throw new Tc;if(e.length>1)throw dI.error("More than one matching file found, should never happen.",e),new Error("More than one matching file found");const n=e[0];return{filename:this.removeRoot(n.filename),basename:n.basename,id:this.removeRoot(n.filename),type:n.type}}};let Kg=Gg;Kg.REFRESH_THROTTLE=150;const Ks=J.module("AppInit");async function cI(){Ks.debug("Loading plugins...");try{const t=await Cd.loadJson("../js-plugins/manifest.json");Ks.debug("Plugin manifest loaded:",t);const e=[];for(let i=0;i<t.plugins.length;i+=1){const{name:o,main:r}=t.plugins[i],l=`../js-plugins/${o}/${r}`;e.push(Cd.loadModulePlugin(l))}const n=await Promise.all(e),s=new Map;for(let i=0;i<n.length;i+=1){const{name:o}=t.plugins[i];s.set(o,n[i])}return Ks.info("Plugins loaded:",s),s}catch(t){return Ks.error("Unable to load plugins:",t),new Map}}async function hI(t){let e;try{e=await iI(t)}catch(n){if(!eI(n))throw n}return e}function _c(t){const{workspace:e,setActiveTool:n,setCommandHistoryStorage:s,setDashboardData:i,setFileStorage:o,setLayoutStorage:r,setDashboardConnection:l,setDashboardSessionWrapper:a,setPlugins:d,setUser:c,setWorkspace:u,setWorkspaceStorage:m,setServerConfigValues:p}=t,[g,f]=w.exports.useState(),[b,C]=w.exports.useState(!0),S=w.exports.useCallback(async()=>{var R,N;try{Ks.info("Initializing Web UI","0.29.0",navigator.userAgent);const F=oI(),H=nI();Ks.info(`Login using auth type ${H}...`),await F.login(await lI(H));const U=await cI(),x=await(H===$g.ANONYMOUS&&F.getAsIdeConnection==null?sI():F.getAsIdeConnection());x.addEventListener(M.IdeConnection.HACK_CONNECTION_FAILURE,He=>{var Ct;const{detail:dt}=He;Ks.error("Connection failure",`${JSON.stringify(dt)}`),f(`Unable to connect: ${(Ct=dt.details)!=null?Ct:"Unknown Error"}`)});const A=await hI(x),k="user",W=F.getStorageService(),X=new aI(W,"../layouts"),V=new Kg(W,"../notebooks"),L=new Bg(X),K=new oy,Y=await L.load({isConsoleAvailable:A!==void 0}),{data:P}=Y,{settings:G}=P;G.defaultDecimalFormatOptions===void 0&&(G.defaultDecimalFormatOptions={defaultFormatString:_e.DEFAULT_FORMAT_STRING}),G.defaultIntegerFormatOptions===void 0&&(G.defaultIntegerFormatOptions={defaultFormatString:et.DEFAULT_FORMAT_STRING}),G.truncateNumbersWithPound===void 0&&(G.truncateNumbersWithPound=!1);const{shortcutOverrides:Z={}}=G,ae=qt.isMacPlatform?(R=Z.mac)!=null?R:{}:(N=Z.windows)!=null?N:{};Object.entries(ae).forEach(([He,dt])=>{var Ct;(Ct=Le.get(He))==null||Ct.setKeyState(dt)});const j={filterSets:P.filterSets,links:P.links},he=await F.getServerConfigValues(),Ce=new Map(he),Re={name:k,operateAs:k,groups:[],permissions:{isSuperUser:!1,isQueryViewOnly:!1,isNonInteractive:!1,canUsePanels:!0,canCreateDashboard:!0,canCreateCodeStudio:!0,canCreateQueryMonitor:!0,canCopy:Ce.get("internal.webClient.appInit.canCopy")!=="false",canDownloadCsv:Ce.get("internal.webClient.appInit.canDownloadCsv")!=="false"}};n(Xt.DEFAULT),p(Ce),s(K),i(Fn,j),o(V),r(X),l(Fn,x),A!==void 0&&a(Fn,A),d(U),c(Re),m(L),u(Y)}catch(F){Ks.error(F),f(F)}},[n,s,i,o,r,l,a,d,c,u,m,p]),v=w.exports.useCallback(()=>{document.fonts!=null?document.fonts.ready.then(()=>{C(!1)}):C(!1)},[]);w.exports.useEffect(function(){S(),v()},[S,v]);const y=e==null&&g==null||b,E=!y&&g==null,I=g!=null?`${g}`:null;return T(Te,{children:[E&&h(Zy,{}),h(Bl,{isLoading:y,isLoaded:E,errorMessage:I}),T("div",{id:"preload-fonts",style:{visibility:"hidden",position:"absolute",top:-1e4},children:[h("p",{className:"fira-sans-regular",children:"preload"}),h("p",{className:"fira-sans-semibold",children:"preload"}),h("p",{className:"fira-mono",children:"preload"})]})]})}_c.propTypes={workspace:D.exports.shape({}),workspaceStorage:D.exports.shape({close:D.exports.func}),setActiveTool:D.exports.func.isRequired,setCommandHistoryStorage:D.exports.func.isRequired,setDashboardData:D.exports.func.isRequired,setFileStorage:D.exports.func.isRequired,setLayoutStorage:D.exports.func.isRequired,setDashboardConnection:D.exports.func.isRequired,setDashboardSessionWrapper:D.exports.func.isRequired,setPlugins:D.exports.func.isRequired,setUser:D.exports.func.isRequired,setWorkspace:D.exports.func.isRequired,setWorkspaceStorage:D.exports.func.isRequired};_c.defaultProps={workspace:null,workspaceStorage:null};const uI=t=>({workspace:Yl(t),workspaceStorage:N0(t)}),vu=Mt(uI,{setActiveTool:Zl,setCommandHistoryStorage:A0,setDashboardData:Ip,setFileStorage:L0,setLayoutStorage:ry,setDashboardConnection:W1,setDashboardSessionWrapper:G1,setPlugins:H0,setUser:k0,setWorkspace:ep,setWorkspaceStorage:O0,setServerConfigValues:U0})(_c);function mI(){return h(Nf,{basename:"./",children:T(Ff,{children:[h($c,{exact:!0,path:"/",component:vu}),h($c,{path:"/notebook/:notebookPath+",component:vu}),h(xf,{from:"*",to:"/"})]})})}Boolean(window.location.hostname==="localhost"||window.location.hostname==="[::1]"||window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/));function pI(){"serviceWorker"in navigator&&navigator.serviceWorker.getRegistrations().then(t=>{t.forEach(e=>{e.scope.endsWith("/download/")||e.unregister()})})}vy();wi.render(h(yu,{store:Ql,children:h(mI,{})}),document.getElementById("root"));pI();xl.registerOnLoaded();at.init({getWorker:()=>new kf});window["__react-beautiful-dnd-disable-dev-warnings"]=!0;
|
|
47
|
+
//# sourceMappingURL=index.cae5241c.js.map
|