@deephaven/code-studio 0.59.1-beta.3 → 0.59.1-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. package/build/assets/{AppRoot-8c5918a3.js → AppRoot-bc9433b4.js} +3 -3
  2. package/build/assets/{AppRoot-8c5918a3.js.map → AppRoot-bc9433b4.js.map} +1 -1
  3. package/build/assets/{ControlType-7b1ad7ef.js → ControlType-b475cfe6.js} +2 -2
  4. package/build/assets/{ControlType-7b1ad7ef.js.map → ControlType-b475cfe6.js.map} +1 -1
  5. package/build/assets/{FontBootstrap-abaccda2.js → FontBootstrap-5b595a14.js} +2 -2
  6. package/build/assets/{FontBootstrap-abaccda2.js.map → FontBootstrap-5b595a14.js.map} +1 -1
  7. package/build/assets/FontBootstrap-91f346e2.css +1 -0
  8. package/build/assets/{IrisGrid-03e8a663.js → IrisGrid-49222932.js} +2 -2
  9. package/build/assets/{IrisGrid-03e8a663.js.map → IrisGrid-49222932.js.map} +1 -1
  10. package/build/assets/{IrisGridModelFactory-62a7c163.js → IrisGridModelFactory-aa9601b0.js} +2 -2
  11. package/build/assets/{IrisGridModelFactory-62a7c163.js.map → IrisGridModelFactory-aa9601b0.js.map} +1 -1
  12. package/build/assets/{StyleGuideRoot-a6410c3f.js → StyleGuideRoot-42cc11d1.js} +2 -2
  13. package/build/assets/{StyleGuideRoot-a6410c3f.js.map → StyleGuideRoot-42cc11d1.js.map} +1 -1
  14. package/build/assets/{index-777e0869.js → index-c8c58d11.js} +2 -2
  15. package/build/assets/{index-777e0869.js.map → index-c8c58d11.js.map} +1 -1
  16. package/build/assets/{index-8d403870.js → index-e89a2b92.js} +2 -2
  17. package/build/assets/{index-8d403870.js.map → index-e89a2b92.js.map} +1 -1
  18. package/build/assets/{index-b119fb34.js → index-fb867b42.js} +2 -2
  19. package/build/assets/{index-b119fb34.js.map → index-fb867b42.js.map} +1 -1
  20. package/build/assets/{usePlugins-051cda02.js → usePlugins-660df156.js} +2 -2
  21. package/build/assets/{usePlugins-051cda02.js.map → usePlugins-660df156.js.map} +1 -1
  22. package/build/assets/{useUser-f0d8b080.js → useUser-84d4eed4.js} +2 -2
  23. package/build/assets/{useUser-f0d8b080.js.map → useUser-84d4eed4.js.map} +1 -1
  24. package/build/index.html +1 -1
  25. package/package.json +31 -31
  26. package/build/assets/FontBootstrap-dda4f49b.css +0 -1
@@ -1,6 +1,6 @@
1
- import{P as bt,I as zt,r as m,C as n,J as te,K as Fe,H as X,L as Te,F,M as f,G as x,N as vt,D as St,T as Jt,O as Xt,Q as Qt,S as es,U as ts,V as ss,W as fe,X as ns,Y as os}from"./vendor-a758141f.js";import{_ as as,W as rs}from"./monaco-1410cbed.js";import{O as ce,P as K,T as M,D as is,I as P,a as k,b as W,u as yt,F as ls,c as D,d as cs,S as de,B as S,C as ge,e as U,f as Ee,g as Tt,K as ds,h as We,i as us,j as hs,G as Ce,k as Ct,l as ms,r as ps,m as fs,n as gs,o as bs,p as Be,q as vs,s as _,t as Ss,v as ys,w as Ts,x as Ge,y as Cs,z as Ve,A as ws,E as xs,H as Ds,J as Fs,L as Es,M as Rs,N as Ns}from"./usePlugins-051cda02.js";import{L as A,v as Z,a as js,M as Os,b as Is,c as Ls,d as Ps,l as ks,e as we,f as As,T as ie,g as Ms,h as Us,i as _s,j as $s,k as Ks,m as Ws,n as Bs,o as Gs,p as Vs,q as Hs,r as Zs,s as qs,t as Ys,u as zs,w as Js,x as He,y as Ze,z as qe,A as Xs,B as Qs,C as en,D as tn,E as sn,F as Ye,G as nn,H as on}from"./index-777e0869.js";import{C as an,B as rn,m as ln,a as cn,T as dn,L as wt,D as un,b as hn,I as mn,u as pn,c as fn,d as gn,g as bn,l as vn}from"./useUser-f0d8b080.js";import{u as Re,g as Sn,a as xt,b as Dt,c as Ft,d as Et,e as Rt,f as yn,h as Nt,i as Tn,j as Cn,s as jt,k as wn,C as G,T as ue,r as xn,O as Dn,l as ze,L as Je,m as Xe,F as Qe,n as Ot,o as Fn,p as En,q as Rn,t as Nn,v as et,w as jn,x as It,N as On,I as oe,M as In,y as Ln,z as Pn,A as H,B as kn,D as An,E as Mn,G as Un,H as _n,J as $n,K as Kn,P as Wn,Q as Bn,R as Gn,S as Vn,U as Hn,V as Zn}from"./ControlType-7b1ad7ef.js";class tt{static makeSortConfig(e,t){return{column:e,direction:t}}static makeFilterConfig(e){var t=[],s=[];return e.forEach((a,r)=>{t.push(a),r>0&&s.push(ce.and)}),{filterItems:t,filterOperators:s}}static combineFilterConfigs(e,t){var s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ce.and;return{filterItems:[...e.filterItems,...t.filterItems],filterOperators:[...e.filterOperators,s,...t.filterOperators]}}static makeFilterItem(e,t,s){return{columnName:e,type:t,value:s}}}function qn(o,e,t){if(o.length>e){var s=o.length-t;return{toKeep:o.slice(s),toPrune:o.slice(0,s)}}return{toKeep:o,toPrune:[]}}function st(o,e){var t=Object.keys(o);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(o);e&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(o,a).enumerable})),t.push.apply(t,s)}return t}function nt(o){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?st(Object(t),!0).forEach(function(s){N(o,s,t[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(t)):st(Object(t)).forEach(function(s){Object.defineProperty(o,s,Object.getOwnPropertyDescriptor(t,s))})}return o}function ot(o,e,t,s,a,r,i){try{var c=o[r](i),l=c.value}catch(d){t(d);return}c.done?e(l):Promise.resolve(l).then(s,a)}function $(o){return function(){var e=this,t=arguments;return new Promise(function(s,a){var r=o.apply(e,t);function i(l){ot(r,s,a,i,c,"next",l)}function c(l){ot(r,s,a,i,c,"throw",l)}i(void 0)})}}function N(o,e,t){return e=Yn(e),e in o?Object.defineProperty(o,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):o[e]=t,o}function Yn(o){var e=zn(o,"string");return typeof e=="symbol"?e:String(e)}function zn(o,e){if(typeof o!="object"||o===null)return o;var t=o[Symbol.toPrimitive];if(t!==void 0){var s=t.call(o,e||"default");if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(o)}var be=A.module("PouchStorageTable"),Jn="Deephaven.";bt.plugin(zt);function Xn(o,e){switch(o){case M.in:case M.contains:return{$regex:new RegExp("".concat(e))};case M.inIgnoreCase:return{$regex:new RegExp("".concat(e),"i")};case M.eq:return{$eq:e};case M.notEq:return{$neq:e};case M.greaterThan:return{$gt:e};case M.greaterThanOrEqualTo:return{$gte:e};case M.lessThan:return{$lt:e};case M.lessThanOrEqualTo:return{$lte:e};case M.startsWith:return{$regex:new RegExp("^(?".concat(e,").*"))};default:throw new Error("Unsupported type: ".concat(o))}}function Qn(o){for(var{filterItems:e,filterOperators:t}=o,s=null,a=0;a<e.length;a+=1){var r=e[a],{columnName:i,type:c,value:l}=r,d={[i]:Xn(c,l)};if(a===0)s=d;else if(s!==null&&a-1<t.length){var h=t[a-1];if(h===ce.and)s={$and:[s,d]};else if(h===ce.or)s={$or:[s,d]};else throw new Error("Unexpected filter operator ".concat(h,", ").concat(d))}}if(s==null)throw new Error("Invalid filter config ".concat(o));return s}function ve(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return{$and:[...o.map(e=>Qn(e)),{name:{$gt:null}},{id:{$gt:null}}]}}function eo(o){var e,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return[{id:t?"desc":"asc"},...(e=o?.map(s=>({[s.column]:s.direction})))!==null&&e!==void 0?e:[]]}class to{constructor(e,t){N(this,"db",void 0),N(this,"changes",void 0),N(this,"listeners",[]),N(this,"itemListeners",new Map),N(this,"currentSize",0),N(this,"currentViewport",void 0),N(this,"currentReverse",!1),N(this,"currentFilter",null),N(this,"currentSort",null),N(this,"infoUpdatePromise",void 0),N(this,"viewportUpdatePromise",void 0),N(this,"currentViewportData",void 0),this.db=new bt("".concat(Jn).concat(e),t),this.db._remote=!1,this.listenForChanges(),this.db.createIndex({index:{fields:["id","name"]}}),this.refreshInfo()}listenForChanges(){this.changes=this.db.changes({live:!0,since:"now",include_docs:!0}).on("change",this.dbUpdate.bind(this))}onUpdate(e){return this.listeners=[...this.listeners,e],()=>{this.listeners=this.listeners.filter(t=>t!==e)}}onItemUpdate(e,t){return this.itemListeners.has(e)||this.itemListeners.set(e,[]),this.itemListeners.set(e,[...this.itemListeners.get(e),t]),this.refreshItem(e),()=>{this.itemListeners.set(e,this.itemListeners.get(e).filter(s=>s!==t))}}close(){this.listeners=[]}get size(){return this.currentSize}get viewport(){return this.currentViewport}setReversed(e){this.currentReverse=e,this.currentViewportData=void 0,this.refreshData()}setViewport(e){this.currentViewport=e,this.refreshInfo(),this.refreshData()}setSorts(e){this.currentSort=e,this.currentViewportData=void 0,this.refreshData()}setFilters(e){this.currentFilter=e,this.currentViewportData=void 0,this.refreshInfo(),this.refreshData()}get data(){return this.currentViewportData}getViewportData(){var e=this;return $(function*(){var t;return e.viewportUpdatePromise||e.refreshData(),(t=e.viewportUpdatePromise)!==null&&t!==void 0?t:Promise.resolve({items:[],offset:0})})()}put(e){var t=this;return $(function*(){var s=nt(nt({},e),{},{_id:e.id});return yield t.db.put(s),s})()}sendUpdate(){for(var e,{listeners:t}=this,s=(e=this.currentViewportData)!==null&&e!==void 0?e:{items:[],offset:0},a=0;a<t.length;a+=1)t[a](s)}sendItemUpdate(e){var t=this.itemListeners.get(e.id);if(t!==void 0)for(var s=0;s<t.length;s+=1)t[s](e)}dbUpdate(e){be.debug("Update received",e),this.refreshInfo(),e.doc!==void 0&&this.sendItemUpdate(e.doc),this.refreshData()}fetchInfo(e){var t=this;return $(function*(){return t.db.find({selector:e,fields:[]})})()}refreshInfo(){var e=this;return $(function*(){try{var t,s;(t=e.infoUpdatePromise)===null||t===void 0||t.cancel(),e.infoUpdatePromise=K.makeCancelable(e.fetchInfo(ve((s=e.currentFilter)!==null&&s!==void 0?s:[])));var a=yield e.infoUpdatePromise;e.currentSize=a.docs.length,e.sendUpdate()}catch(r){if(!K.isCanceled(r))throw be.error("Unable to refreshInfo",r),r}})()}fetchViewportData(e,t,s){var a=this;return $(function*(){return a.db.find({selector:t,skip:e.top,limit:e.bottom-e.top+1,sort:s,fields:["id","name"]}).then(r=>({items:r.docs,offset:e.top}))})()}refreshData(){var e=this;return $(function*(){if(e.currentViewport)try{var t,s,a=ve((t=e.currentFilter)!==null&&t!==void 0?t:[]),r=eo(e.currentSort,e.currentReverse);(s=e.viewportUpdatePromise)===null||s===void 0||s.cancel(),e.viewportUpdatePromise=K.makeCancelable(e.fetchViewportData(e.currentViewport,a,r));var i=yield e.viewportUpdatePromise;return e.currentViewportData=i,e.sendUpdate(),i}catch(c){if(!K.isCanceled(c))throw be.error("Unable to refreshData",c),c}})()}refreshItem(e){var t=this;return $(function*(){var s=yield t.db.find({selector:{id:e},limit:1}),a=s.docs[0];return a!==void 0&&t.sendItemUpdate(a),a})()}getSnapshot(e){var t=this;return $(function*(){var s=new Map,a=[{id:t.currentReverse?"desc":"asc"}];return yield Promise.all(e.map(function(){var r=$(function*(i){var c,[l,d]=i,h=d-l+1;return t.db.find({selector:ve((c=t.currentFilter)!==null&&c!==void 0?c:[]),skip:l,limit:h,sort:a,fields:["id","name"]}).then(u=>{for(var g=0;g<h;g+=1){var y=l+g;s.set(y,u.docs[g])}})});return function(i){return r.apply(this,arguments)}}())),s})()}}const so=to;function at(o,e){var t=Object.keys(o);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(o);e&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(o,a).enumerable})),t.push.apply(t,s)}return t}function ae(o){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?at(Object(t),!0).forEach(function(s){Lt(o,s,t[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(t)):at(Object(t)).forEach(function(s){Object.defineProperty(o,s,Object.getOwnPropertyDescriptor(t,s))})}return o}function rt(o,e,t,s,a,r,i){try{var c=o[r](i),l=c.value}catch(d){t(d);return}c.done?e(l):Promise.resolve(l).then(s,a)}function Q(o){return function(){var e=this,t=arguments;return new Promise(function(s,a){var r=o.apply(e,t);function i(l){rt(r,s,a,i,c,"next",l)}function c(l){rt(r,s,a,i,c,"throw",l)}i(void 0)})}}function Lt(o,e,t){return e=no(e),e in o?Object.defineProperty(o,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):o[e]=t,o}function no(o){var e=oo(o,"string");return typeof e=="symbol"?e:String(e)}function oo(o,e){if(typeof o!="object"||o===null)return o;var t=o[Symbol.toPrimitive];if(t!==void 0){var s=t.call(o,e||"default");if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(o)}var ao=2500,ro=2e3,O=A.module("PouchCommandHistoryTable");class io extends so{constructor(e,t){var s;super("CommandHistoryStorage.".concat(e),{auto_compaction:!0,revs_limit:1}),Lt(this,"searchText",void 0),this.cache=t,this.cache.tableRegistry.has(this.cacheKey)||this.cache.tableRegistry.set(this.cacheKey,new Set),O.debug("Adding table to registry",this.cacheKey),(s=this.cache.tableRegistry.get(this.cacheKey))===null||s===void 0||s.add(this)}get cacheKey(){return this.db.name}setSearch(e){O.debug("Setting search filters",e),this.searchText=e.trim().toLowerCase(),this.setFilters(e?[tt.makeFilterConfig([tt.makeFilterItem("name",M.contains,e)])]:[])}dbUpdate(e){O.debug("Clearing cache and refreshing data",e),this.cache.response.delete(this.cacheKey),super.dbUpdate(e)}fetchData(e){var t=this;return Q(function*(){return K.withTimeout(0,Q(function*(){t.cache.response.has(t.cacheKey)?O.debug("Fetching from cache",t.searchText,t.viewport):(O.debug("Fetching from PouchDB",t.searchText,t.viewport),t.cache.response.set(t.cacheKey,t.db.allDocs({include_docs:!0}).then(a=>{var r=a.rows.map(l=>l.doc).filter(l=>{var{name:d}=l;return d});O.debug("Fetched ".concat(r.length," command history items"));var{toKeep:i,toPrune:c}=qn(r,ao,ro);return c.length&&t.pruneItems(c),{docs:i}})));var s=t.cache.response.get(t.cacheKey);return t.searchText==null||t.searchText===""?s:ae(ae({},s),{},{docs:(yield s).docs.filter(a=>{var{name:r}=a;return r.toLowerCase().includes(t.searchText)})})}))})()}fetchInfo(e){var t=this;return Q(function*(){return t.fetchData(e)})()}fetchViewportData(e,t,s){var a=this;return Q(function*(){var r=yield a.fetchData(t);O.debug("Fetching viewport data",e.top,e.bottom+1,s,r);var i=typeof s[0]=="object"&&s[0].id==="desc",c=i?r.docs.slice(0).reverse():r.docs,l=c.slice(e.top,e.bottom+1);return{items:l,offset:e.top}})()}pruneItems(e){var t=this;return Q(function*(){if(t.cache.isPruning.get(t.cacheKey)===!0){O.debug("Pruning already in progress. Skipping.");return}try{O.debug("Pruning ".concat(e.length," command history items"));var s=t.cache.pauseChangeListeners(t.cacheKey);t.cache.isPruning.set(t.cacheKey,!0),yield t.db.bulkDocs(e.map(a=>ae(ae({},a),{},{_deleted:!0}))),t.cache.isPruning.set(t.cacheKey,!1),s(),O.debug("Finished pruning command history items")}catch(a){O.error("An error occurred while pruning db",a)}})()}close(){var e,t,s;O.debug("Closing table",this,(e=this.cache.tableRegistry.get(this.cacheKey))===null||e===void 0?void 0:e.size),(t=this.cache.tableRegistry.get(this.cacheKey))===null||t===void 0||t.delete(this),(s=this.changes)===null||s===void 0||s.cancel(),super.close()}}const it=io;function Se(o,e,t){return e=lo(e),e in o?Object.defineProperty(o,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):o[e]=t,o}function lo(o){var e=co(o,"string");return typeof e=="symbol"?e:String(e)}function co(o,e){if(typeof o!="object"||o===null)return o;var t=o[Symbol.toPrimitive];if(t!==void 0){var s=t.call(o,e||"default");if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(o)}var lt=A.module("PouchCommandHistoryCache");class uo{constructor(){Se(this,"isPruning",void 0),Se(this,"response",void 0),Se(this,"tableRegistry",void 0),this.isPruning=new Map,this.response=new Map,this.tableRegistry=new Map}pauseChangeListeners(e){var t,s=[];return(t=this.tableRegistry.get(e))===null||t===void 0||t.forEach(a=>{a.changes&&(lt.debug("Pausing event listeners on '".concat(e,"' table"),a),a.changes.cancel(),s.push(a))}),()=>{s.forEach(a=>{var r,i;(r=(i=this.tableRegistry.get(e))===null||i===void 0?void 0:i.has(a))!==null&&r!==void 0&&r&&(lt.debug("Resuming event listeners on '".concat(e,"' table"),a),a.listenForChanges())})}}}const ho=uo;function ct(o,e){var t=Object.keys(o);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(o);e&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(o,a).enumerable})),t.push.apply(t,s)}return t}function dt(o){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ct(Object(t),!0).forEach(function(s){xe(o,s,t[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(t)):ct(Object(t)).forEach(function(s){Object.defineProperty(o,s,Object.getOwnPropertyDescriptor(t,s))})}return o}function ut(o,e,t,s,a,r,i){try{var c=o[r](i),l=c.value}catch(d){t(d);return}c.done?e(l):Promise.resolve(l).then(s,a)}function ye(o){return function(){var e=this,t=arguments;return new Promise(function(s,a){var r=o.apply(e,t);function i(l){ut(r,s,a,i,c,"next",l)}function c(l){ut(r,s,a,i,c,"throw",l)}i(void 0)})}}function xe(o,e,t){return e=mo(e),e in o?Object.defineProperty(o,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):o[e]=t,o}function mo(o){var e=po(o,"string");return typeof e=="symbol"?e:String(e)}function po(o,e){if(typeof o!="object"||o===null)return o;var t=o[Symbol.toPrimitive];if(t!==void 0){var s=t.call(o,e||"default");if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(o)}var ht=A.module("PouchCommandHistoryStorage");class fo{constructor(){xe(this,"cache",new ho),xe(this,"updateTableMap",new Map)}getUpdateTable(e){return this.updateTableMap.has(e)||this.updateTableMap.set(e,new it(e,this.cache)),this.updateTableMap.get(e)}getTable(e){var t=this;return ye(function*(){return new it(e,t.cache)})()}addItem(e,t,s,a){var r=this;return ye(function*(){return r.updateItem(e,{id:"".concat(new Date().getTime()),name:s,data:a})})()}updateItem(e,t){var s=this;return ye(function*(){var a=s.getUpdateTable(e),r=yield a.refreshItem(t.id),i=dt(dt({},r??{}),t);return ht.debug("Updating item",i),yield a.put(i),ht.debug("Update saved"),t})()}listenItem(e,t,s){var a=this.getUpdateTable(e);return a.onItemUpdate(t,s)}}const Pt="SET_LAYOUT_STORAGE",go=o=>({type:Pt,payload:o});var{dh:bo}=globalThis;const B=bo;const vo=A.module("SettingsUtils");function So(o){return o.formatString!=null}function De(o){const e=o?.querySelector("input, select, textarea");e&&e.focus()}function kt(o,e){return o.defaultFormatString===e.defaultFormatString}function yo(o,e){return kt(o,e)}function To(o,e){return kt(o,e)}function At(o){return o!==""&&is.isValidColumnName(o)}function q(o,e,t){if(!e||t.formatString==null||!So(t))return!1;switch(e){case"datetime":return W.isValid(o,t);case"decimal":return k.isValid(o,t);case"int":return P.isValid(o,t);default:return vo.warn("Trying to validate format of unknown type"),!0}}function Co(o){const{id:e,isNewRule:t,...s}=o;return s}function wo(o,e){return At(e.columnName)&&q(o,e.columnType,e.format)}function Mt(o){const{timestamp:e,timeZone:t,showTimeZone:s,showTSeparator:a,isGlobalOptions:r,legacyGlobalFormat:i}=o,c=yt(),l=m.useMemo(()=>new ls(c,[],{timeZone:t,showTimeZone:s,showTSeparator:a}),[c,s,a,t]),d=r?W.getGlobalFormats(s,a):W.getFormats(s,a);return i!=null&&!d.includes(i)&&d.unshift(i),n.jsx(n.Fragment,{children:d.map(h=>{const u=W.makeFormat("",h,W.TYPE_GLOBAL);return n.jsx("option",{value:h,"data-testid":"time-format",children:l.getFormattedString(e,D.dataType.DATETIME,"",u)},h)})})}function xo(){return n.jsx(n.Fragment,{children:cs.TIME_ZONES.map(o=>{const{label:e,value:t}=o;return n.jsx("option",{value:t,children:e},t)})})}const V=A.module("FormattingSectionContent");class Ne extends m.PureComponent{static defaultProps={scrollTo:()=>{}};static inputDebounceTime=250;constructor(e){super(e),this.debouncedCommitChanges=Fe(this.commitChanges.bind(this),Ne.inputDebounceTime),this.queueUpdate=this.queueUpdate.bind(this),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{defaultDateTimeFormat:t,defaultDecimalFormatOptions:s,defaultIntegerFormatOptions:a,showTimeZone:r,showTSeparator:i,timeZone:c,truncateNumbersWithPound:l}=e;this.containerRef=X.createRef(),this.pendingUpdates=[],this.state={showTimeZone:r,showTSeparator:i,timeZone:c,defaultDateTimeFormat:t,defaultDecimalFormatOptions:s,defaultIntegerFormatOptions:a,truncateNumbersWithPound:l,timestampAtMenuOpen:new Date}}componentDidMount(){De(this.containerRef.current)}componentWillUnmount(){this.debouncedCommitChanges.flush()}debouncedCommitChanges;pendingUpdates;containerRef;getCachedDateTimeFormatOptions=Te((e,t,s,a=!1,r)=>{const{timestampAtMenuOpen:i}=this.state;return n.jsx(Mt,{timestamp:i,timeZone:e,showTimeZone:t,showTSeparator:s,isGlobalOptions:a,legacyGlobalFormat:r})});queueUpdate(e){this.pendingUpdates.push(e),this.debouncedCommitChanges()}handleDefaultDateTimeFormatChange(e){V.debug("handleDefaultDateTimeFormatChange",e);const t={defaultDateTimeFormat:e};this.setState(t),this.queueUpdate(t)}handleDefaultDecimalFormatChange(e){V.debug("handleDefaultDecimalFormatChange",e.target.value);const t={defaultDecimalFormatOptions:{defaultFormatString:e.target.value}};this.setState(t),q(dh,D.dataType.DECIMAL,k.makeCustomFormat(e.target.value))&&this.queueUpdate(t)}handleDefaultIntegerFormatChange(e){V.debug("handleDefaultIntegerFormatChange",e.target.value);const t={defaultIntegerFormatOptions:{defaultFormatString:e.target.value}};this.setState(t),q(dh,D.dataType.INT,P.makeCustomFormat(e.target.value))&&this.queueUpdate(t)}handleShowTimeZoneChange(){const{showTimeZone:e}=this.state,t={showTimeZone:!e};this.setState(t),this.queueUpdate(t)}handleShowTSeparatorChange(){const{showTSeparator:e}=this.state,t={showTSeparator:!e};this.setState(t),this.queueUpdate(t)}handleTimeZoneChange(e){const t={timeZone:e};this.setState(t),this.queueUpdate(t)}handleResetDateTimeFormat(){const{defaults:e}=this.props,{defaultDateTimeFormat:t,showTimeZone:s,showTSeparator:a}=e;V.debug("handleResetDateTimeFormat"),this.setState({defaultDateTimeFormat:t,showTimeZone:s,showTSeparator:a}),this.queueUpdate({defaultDateTimeFormat:void 0,showTimeZone:void 0,showTSeparator:void 0})}handleResetTimeZone(){const{defaults:e}=this.props,{timeZone:t}=e;V.debug("handleResetTimeZone"),this.setState({timeZone:t}),this.queueUpdate({timeZone:void 0})}handleResetDecimalFormat(){const{defaults:e}=this.props,{defaultDecimalFormatOptions:t}=e;V.debug("handleResetDecimalFormat"),this.setState({defaultDecimalFormatOptions:t}),this.queueUpdate({defaultDecimalFormatOptions:void 0})}handleResetIntegerFormat(){const{defaults:e}=this.props,{defaultIntegerFormatOptions:t}=e;V.debug("handleResetIntegerFormat"),this.setState({defaultIntegerFormatOptions:t}),this.queueUpdate({defaultIntegerFormatOptions:void 0})}handleTruncateNumbersWithPoundChange(){const{truncateNumbersWithPound:e}=this.state,t={truncateNumbersWithPound:e!==!0};this.setState(t),this.queueUpdate(t)}commitChanges(){const{updateSettings:e}=this.props,t=this.pendingUpdates.reduce((s,a)=>({...s,...a}),{});this.pendingUpdates=[],e(t)}render(){const{defaults:e,dh:t}=this.props,{defaultDateTimeFormat:s,defaultDecimalFormatOptions:a,defaultIntegerFormatOptions:r,timeZone:i,showTimeZone:c,showTSeparator:l,truncateNumbersWithPound:d}=this.state,{defaultFormatString:h=k.DEFAULT_FORMAT_STRING}=a??{},{defaultFormatString:u=P.DEFAULT_FORMAT_STRING}=r??{},g=i===e.timeZone,y=l===e.showTSeparator&&c===e.showTimeZone&&s===e.defaultDateTimeFormat,v=yo(a,e.defaultDecimalFormatOptions),E=To(r,e.defaultIntegerFormatOptions);return n.jsx("div",{className:"app-settings-formatting-section",ref:this.containerRef,children:n.jsxs("div",{className:"container-fluid p-0",children:[n.jsx("div",{className:"app-settings-menu-description mb-3",children:"Choose the default formatting rule to apply to all table columns based on their type."}),n.jsxs("div",{className:"form-row mb-2",children:[n.jsx("label",{className:"col-form-label col-3",htmlFor:"select-reset-timezone",children:"Time zone"}),n.jsx("div",{className:"col pr-0",children:n.jsx(de,{className:"custom-select",value:i,onChange:this.handleTimeZoneChange,id:"select-reset-timezone",children:n.jsx(xo,{})})}),n.jsx("div",{className:"col-1 btn-col",children:n.jsx(S,{kind:"ghost",icon:Z,onClick:this.handleResetTimeZone,tooltip:"Reset Time Zone",className:F("btn-reset","btn-reset-time-zone",{hidden:g})})})]}),n.jsxs("div",{className:"form-row mb-2",children:[n.jsx("label",{className:"col-form-label col-3",htmlFor:"select-default-time-format",children:"DateTime"}),n.jsx("div",{className:"col pr-0",children:n.jsx(de,{className:"custom-select",value:s,onChange:this.handleDefaultDateTimeFormatChange,id:"select-default-time-format",children:this.getCachedDateTimeFormatOptions(i,c,l,!0,s)})}),n.jsx("div",{className:"col-1 btn-col",children:n.jsx(S,{kind:"ghost",icon:Z,onClick:this.handleResetDateTimeFormat,tooltip:"Reset DateTime Options",className:F("btn-reset","btn-reset-date-time",{hidden:y})})})]}),n.jsx("div",{className:"form-row",children:n.jsx("div",{className:"offset-3 col-9",children:n.jsx(ge,{checked:c??null,onChange:this.handleShowTimeZoneChange,children:"Show time zone in dates"})})}),n.jsx("div",{className:"form-row mb-3",children:n.jsx("div",{className:"offset-3 col-9",children:n.jsx(ge,{checked:l??null,onChange:this.handleShowTSeparatorChange,children:"Show 'T' separator"})})}),n.jsxs("div",{className:"form-row mb-2",children:[n.jsx("label",{className:"col-form-label col-3",htmlFor:"default-decimal-format-input",children:"Decimal"}),n.jsx("div",{className:"col pr-0",children:n.jsx("input",{className:F("form-control","flex-grow-1","default-decimal-format-input",{"is-invalid":!q(t,D.dataType.DECIMAL,k.makeCustomFormat(h))}),"data-lpignore":!0,placeholder:k.DEFAULT_FORMAT_STRING,type:"text",id:"default-decimal-format-input",value:h,onChange:this.handleDefaultDecimalFormatChange})}),n.jsx("div",{className:"col-1 btn-col",children:n.jsx(S,{kind:"ghost",icon:Z,onClick:this.handleResetDecimalFormat,tooltip:"Reset Decimal Formatting",className:F("btn-reset","btn-reset-decimal",{hidden:v}),"data-testid":"btn-reset-decimal"})})]}),n.jsxs("div",{className:"form-row mb-2",children:[n.jsx("label",{className:"col-form-label col-3",htmlFor:"default-integer-format-input",children:"Integer"}),n.jsx("div",{className:"col pr-0",children:n.jsx("input",{className:F("form-control","flex-grow-1","default-integer-format-input",{"is-invalid":!q(t,D.dataType.INT,P.makeCustomFormat(u))}),"data-lpignore":!0,placeholder:P.DEFAULT_FORMAT_STRING,type:"text",id:"default-integer-format-input",value:u,onChange:this.handleDefaultIntegerFormatChange})}),n.jsx("div",{className:"col-1 btn-col",children:n.jsx(S,{kind:"ghost",icon:Z,onClick:this.handleResetIntegerFormat,tooltip:"Reset Integer Formatting",className:F("btn-reset","btn-reset-integer",{hidden:E}),"data-testid":"btn-reset-integer"})})]}),n.jsx("div",{className:"form-row mb-3",children:n.jsx("div",{className:"offset-3 col-9",children:n.jsx(ge,{checked:d??null,onChange:this.handleTruncateNumbersWithPoundChange,children:"Show truncated numbers as ###"})})})]})})}}const Do=o=>({defaultDateTimeFormat:Sn(o),defaultDecimalFormatOptions:xt(o),defaultIntegerFormatOptions:Dt(o),dh:Ft(o),showTimeZone:Et(o),showTSeparator:Rt(o),truncateNumbersWithPound:yn(o),timeZone:Nt(o),defaults:Tn(o)}),Fo=te(Do,{updateSettings:Re})(Ne);function Eo(){const[o,e]=m.useState(!1),t=()=>{e(!o)};return n.jsxs(n.Fragment,{children:[n.jsx(S,{kind:"ghost",onClick:t,icon:js,children:"Legal Notices"}),n.jsxs(Os,{isOpen:o,toggle:t,children:[n.jsx(Is,{toggle:t,children:"Legal Notice"}),n.jsxs(Ls,{children:[n.jsx("p",{children:"Deephaven software is protected by U.S. Patent Nos. 9,612,959; 9,613,018; 9,613,109; 9,619,210; 9,633,060; 9,639,570; 9,672,238; 9,679,006; 9,690,821; 9,710,511; 9,760,591; 9,805,084; 9,836,494; 9,836,495; 9,886,469; 9,898,496; 9,934,266; 10,002,153; 10,002,154; 10,002,155; 10,003,673; 10,019,138; 10,069,943; 10,176,211; 10,198,465; 10,198,466; 10,198,469; 10,212,257; 10,241,960; 10,241,965; 10,242,040; 10,242,041; 10,346,394; 10,353,893; 10,452,649; 10,496,639; 10,540,351; 10,552,412; 10,565,194; 10,565,206; 10,572,474; 10,621,168; 10,642,829; 10,657,184; 10,678,787; 10,691,686; 10,783,191; 10,866,943; 10,909,183; 10,915,526; 10,922,311; 10,929,394; 11,023,462; 11,126,662; 11,151,133; 11,238,036; 11,249,994; 11,263,211; 11,449,557; 11,514,037; 11,556,528; and 11,574,018. Other patents pending."}),n.jsxs("p",{children:["© 2016-",new Date().getFullYear()," Deephaven Data Labs LLC. Patent Pending."]})]})]})]})}function Y(o){const{children:e,isExpanded:t,sectionKey:s,title:a,onToggle:r}=o;return n.jsxs(n.Fragment,{children:[n.jsx("div",{children:n.jsxs(S,{kind:"ghost",className:"btn-collapse-trigger",onClick:()=>r(s),children:[n.jsx("div",{className:"flex-grow-1",children:a}),n.jsx("div",{className:"flex-shrink-0",children:n.jsx(x,{transform:t?"flip-v":"",icon:Ps})})]})}),n.jsx(an,{in:t,autoFocusOnShow:!0,children:e})]})}Y.propTypes={children:f.node,isExpanded:f.bool.isRequired,sectionKey:f.string.isRequired,title:f.node.isRequired,onToggle:f.func};Y.defaultProps={children:null,onToggle:()=>{}};function Ro({shortcut:o,displayText:e,categoryName:t,onChange:s}){const[a,r]=m.useState(e),[i,c]=m.useState(o.getKeyState()),[l,d]=m.useState(!1),[h,u]=m.useState("");m.useEffect(function(){r(e),c(o.getKeyState())},[e,o]),m.useEffect(function(){r(U.getDisplayText(i)),o.matchesKeyState(i)&&d(!1)},[i,o]),m.useEffect(function(){if(l){if(!U.isValidKeyState(i)){U.isAllowedKey(i.keyValue)?u("Must contain a modifier key"):u("Must contain an allowed action key");return}const p=Ee.getConflictingShortcuts(i).filter(b=>b.id.startsWith(t)&&b!==o).map(b=>b.name);if(p.length){u(`Conflicts with ${p.join(", ")}`);return}u("")}else u("")},[l,i,t,o]);function g(C){if(C.stopPropagation(),C.preventDefault(),o.isEditable&&!C.repeat){const p=U.getKeyStateFromEvent(C),b=U.createKeyState([ds.BACKSPACE]);U.doKeyStatesMatch(p,b)?c(U.NULL_KEY_STATE):c(p)}}function y(C){C.stopPropagation(),C.preventDefault(),o.matchesKeyState(i)||d(!0)}function v(){We.disableAllActions()}function E(){We.enableAllActions()}function R(){o.setKeyState(i),d(!1),s(o)}function T(){const C=o.getKeyState();c(C),d(!1)}function j(){d(!0),c(o.getDefaultKeyState())}return n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"shortcut-item-container",children:[n.jsxs("label",{className:"shortcut-item-name",children:[o.name,o.tooltip!==void 0&&n.jsx(Tt,{children:o.tooltip})]}),n.jsxs("div",{className:"shortcut-item-input-container",children:[n.jsx("input",{className:F("form-control",{"is-invalid":h}),onKeyDown:g,onKeyUp:y,onFocus:v,onBlur:E,disabled:!o.isEditable,value:a,readOnly:!0}),!U.doKeyStatesMatch(i,o.getDefaultKeyState())&&!h&&n.jsx(S,{className:"reset-to-default-button",kind:"ghost",icon:n.jsx(x,{icon:Z,transform:{rotate:90,flipX:!0}}),tooltip:"Reset to default",onClick:j})]})]}),l&&n.jsxs("div",{className:F("shortcut-item-message-container",{"is-invalid":h}),children:[n.jsx("div",{className:"shortcut-item-message",children:h}),n.jsxs("div",{className:"shortcut-item-message-buttons",children:[U.isValidKeyState(i)&&n.jsx(S,{kind:"ghost",onClick:R,children:"Confirm"}),n.jsx(S,{kind:"ghost",onClick:T,children:"Undo"})]})]})]})}function No({shortcutOverrides:o={},updateSettings:e}){const t=m.useCallback(i=>{const c=U.isMacPlatform,l={mac:{...o.mac},windows:{...o.windows}},d=c?l.mac:l.windows;i.forEach(h=>{h.isDefault()?delete d[h.id]:d[h.id]=h.getKeyState()}),e({shortcutOverrides:l})},[e,o]);let s=Array.from(Ee.shortcutsByCategory.entries()).map(([i,c])=>({name:i,shortcuts:c}));const a=s.findIndex(i=>i.name.toUpperCase()==="GLOBAL"),r=s.splice(a,1);return s=s.concat(r),n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"app-settings-menu-description",children:"Customize shortcuts below. To prevent unexpected results, avoid conflicting shortcuts with the browser or IDE editor."}),s.map(i=>n.jsx(jo,{name:i.name,shortcuts:i.shortcuts,saveShortcutOverrides:t},i.name))]})}function jo({name:o,shortcuts:e,saveShortcutOverrides:t}){function s(l){return l.split("_").map(d=>`${d[0].toUpperCase()}${d.slice(1).toLowerCase()}`).join(" ")}const[a,r]=m.useState(e);function i(l){const d=a.filter(u=>u!==l&&!u.isNull()&&u.matchesKeyState(l.getKeyState()));d.forEach(u=>u.setToNull());const h=[l,...d];t(h),r(u=>[...u])}const c=m.useMemo(()=>a.map(l=>l.getDisplayText()),[a]);return n.jsxs("div",{className:"mt-3",children:[n.jsx("div",{className:"font-weight-bold",children:s(o)}),a.map((l,d)=>n.jsx(Ro,{shortcut:l,displayText:c[d],categoryName:o,onChange:i},l.id))]})}const Oo=o=>({shortcutOverrides:Cn(o)}),Io={updateSettings:Re},Lo=te(Oo,Io)(No),Po="yyyy-MM-dd-HHmmss";function Ut(o,e="root",t=new Map([[o,""]])){const s={};return Object.entries(o).forEach(([a,r])=>{try{JSON.stringify(r),s[a]=r}catch{const c=r;if(typeof r=="bigint")s[a]=r.toString();else if(t.has(c))s[a]=`Circular ref to ${t.get(c)}`;else{const l=`${e}.${a}`;t.set(c,l),s[a]=Ut(r,l,t)}}}),s}function ko(){const o=jt.getState();return JSON.stringify(Ut(o),null,2)}function Ao(o){const e={uiVersion:"0.59.0",userAgent:navigator.userAgent,...o};return JSON.stringify(e,null,2)}async function Mo(o=`${B.i18n.DateTimeFormat.format(Po,new Date)}_support_logs`,e){const t=new vt,s=t.folder(o);s.file("console.txt",ks.getFormattedHistory()),s.file("redux.json",ko()),s.file("metadata.json",Ao(e));const a=await t.generateAsync({type:"blob"}),r=document.createElement("a");r.href=URL.createObjectURL(a),r.download=`${o}.zip`,r.click()}const Uo=[{value:D.dataType.DATETIME,label:"DateTime"},{value:D.dataType.DECIMAL,label:"Decimal"},{value:D.dataType.INT,label:"Integer"}];function _o(){const o=Uo.map(e=>n.jsx("option",{value:e.value,children:e.label},`key-columnType-${e.value}`));return n.jsxs(n.Fragment,{children:[n.jsx("option",{disabled:!0,value:"",children:"Select Type"},"key-columnType-placeholder"),o]})}class je extends m.PureComponent{static defaultProps={scrollTo:()=>{}};static inputDebounceTime=250;constructor(e){super(e),this.debouncedCommitChanges=Fe(this.commitChanges.bind(this),je.inputDebounceTime),this.handleFormatRuleEntered=this.handleFormatRuleEntered.bind(this),this.handleFormatRuleChange=this.handleFormatRuleChange.bind(this),this.handleFormatRuleCreate=this.handleFormatRuleCreate.bind(this),this.handleFormatRuleDelete=this.handleFormatRuleDelete.bind(this);const{formatter:t,showTimeZone:s,showTSeparator:a,timeZone:r}=e,i=t.map((c,l)=>({...c,id:l}));this.containerRef=X.createRef(),this.addFormatRuleButtonRef=X.createRef(),this.lastFormatRuleIndex=i.length,this.state={formatSettings:i,formatRulesChanged:!1,showTimeZone:s,showTSeparator:a,timeZone:r,timestampAtMenuOpen:new Date}}componentDidMount(){De(this.containerRef.current)}componentWillUnmount(){this.debouncedCommitChanges.flush()}debouncedCommitChanges;containerRef;addFormatRuleButtonRef;lastFormatRuleIndex;isDuplicateRule(e){const{formatSettings:t}=this.state;return t.some(s=>s.id!==e.id&&s.columnName===e.columnName&&s.columnType===e.columnType)??!1}getAutoIncrementFormatRuleIndex(){const{lastFormatRuleIndex:e}=this;return this.lastFormatRuleIndex+=1,e}getCachedColumnTypeOptions=Te(()=>n.jsx(_o,{}));getCachedDateTimeFormatOptions=Te((e,t,s,a=!1,r)=>{const{timestampAtMenuOpen:i}=this.state;return n.jsx(Mt,{timestamp:i,timeZone:e,showTimeZone:t,showTSeparator:s,isGlobalOptions:a,legacyGlobalFormat:r})});handleFormatRuleChange(e,t,s){this.setState(a=>{const{formatSettings:r}=a;we(r);const i=[...r];let c={};t==="columnType"&&(c={format:this.makeDefaultFormatterItemByType(s)});const l={...i[e],...c,[t]:s};return i[e]=l,{formatSettings:i}},()=>{this.debouncedCommitChanges()})}handleFormatRuleCreate(){this.setState(e=>{const{formatSettings:t}=e,s={columnType:D.dataType.DATETIME,columnName:"",format:{},id:this.getAutoIncrementFormatRuleIndex(),isNewRule:!0};return{formatSettings:[...t,s],formatRulesChanged:!0}})}handleFormatRuleDelete(e){this.setState(t=>{const{formatSettings:s}=t;return{formatSettings:s.filter((r,i)=>i!==e),formatRulesChanged:!0}},()=>{this.debouncedCommitChanges()})}handleFormatRuleEntered(e){this.scrollToFormatBlockBottom(),De(e)}commitChanges(){const{formatSettings:e}=this.state,{dh:t}=this.props,s=e.filter(i=>wo(t,i)).map(Co)??[],{updateSettings:a}=this.props;a({formatter:s})}scrollToFormatBlockBottom(){const{scrollTo:e}=this.props;e(0,(this.addFormatRuleButtonRef.current?.offsetHeight??0)+(this.addFormatRuleButtonRef.current?.offsetTop??0))}getRuleError(e){const{dh:t}=this.props,s={hasColumnNameError:!1,hasFormatError:!1,message:""},a=[];return e.isNewRule!==void 0&&e.isNewRule||(this.isDuplicateRule(e)&&(s.hasColumnNameError=!0,a.push("Duplicate column name/type combo.")),At(e.columnName)||(s.hasColumnNameError=!0,a.push("Column names must start with a letter or underscore and contain only alphanumeric characters or underscores.")),e.format.formatString!==void 0&&e.format.formatString.length===0?(s.hasFormatError=!0,a.push("Empty formatting rule.")):q(t,e.columnType,e.format)||(s.hasFormatError=!0,a.push("Invalid formatting rule.")),s.message=a.join(`
1
+ import{P as bt,I as zt,r as m,C as n,J as te,K as Fe,H as X,L as Te,F,M as f,G as x,N as vt,D as St,T as Jt,O as Xt,Q as Qt,S as es,U as ts,V as ss,W as fe,X as ns,Y as os}from"./vendor-a758141f.js";import{_ as as,W as rs}from"./monaco-1410cbed.js";import{O as ce,P as K,T as M,D as is,I as P,a as k,b as W,u as yt,F as ls,c as D,d as cs,S as de,B as S,C as ge,e as U,f as Ee,g as Tt,K as ds,h as We,i as us,j as hs,G as Ce,k as Ct,l as ms,r as ps,m as fs,n as gs,o as bs,p as Be,q as vs,s as _,t as Ss,v as ys,w as Ts,x as Ge,y as Cs,z as Ve,A as ws,E as xs,H as Ds,J as Fs,L as Es,M as Rs,N as Ns}from"./usePlugins-660df156.js";import{L as A,v as Z,a as js,M as Os,b as Is,c as Ls,d as Ps,l as ks,e as we,f as As,T as ie,g as Ms,h as Us,i as _s,j as $s,k as Ks,m as Ws,n as Bs,o as Gs,p as Vs,q as Hs,r as Zs,s as qs,t as Ys,u as zs,w as Js,x as He,y as Ze,z as qe,A as Xs,B as Qs,C as en,D as tn,E as sn,F as Ye,G as nn,H as on}from"./index-c8c58d11.js";import{C as an,B as rn,m as ln,a as cn,T as dn,L as wt,D as un,b as hn,I as mn,u as pn,c as fn,d as gn,g as bn,l as vn}from"./useUser-84d4eed4.js";import{u as Re,g as Sn,a as xt,b as Dt,c as Ft,d as Et,e as Rt,f as yn,h as Nt,i as Tn,j as Cn,s as jt,k as wn,C as G,T as ue,r as xn,O as Dn,l as ze,L as Je,m as Xe,F as Qe,n as Ot,o as Fn,p as En,q as Rn,t as Nn,v as et,w as jn,x as It,N as On,I as oe,M as In,y as Ln,z as Pn,A as H,B as kn,D as An,E as Mn,G as Un,H as _n,J as $n,K as Kn,P as Wn,Q as Bn,R as Gn,S as Vn,U as Hn,V as Zn}from"./ControlType-b475cfe6.js";class tt{static makeSortConfig(e,t){return{column:e,direction:t}}static makeFilterConfig(e){var t=[],s=[];return e.forEach((a,r)=>{t.push(a),r>0&&s.push(ce.and)}),{filterItems:t,filterOperators:s}}static combineFilterConfigs(e,t){var s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ce.and;return{filterItems:[...e.filterItems,...t.filterItems],filterOperators:[...e.filterOperators,s,...t.filterOperators]}}static makeFilterItem(e,t,s){return{columnName:e,type:t,value:s}}}function qn(o,e,t){if(o.length>e){var s=o.length-t;return{toKeep:o.slice(s),toPrune:o.slice(0,s)}}return{toKeep:o,toPrune:[]}}function st(o,e){var t=Object.keys(o);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(o);e&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(o,a).enumerable})),t.push.apply(t,s)}return t}function nt(o){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?st(Object(t),!0).forEach(function(s){N(o,s,t[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(t)):st(Object(t)).forEach(function(s){Object.defineProperty(o,s,Object.getOwnPropertyDescriptor(t,s))})}return o}function ot(o,e,t,s,a,r,i){try{var c=o[r](i),l=c.value}catch(d){t(d);return}c.done?e(l):Promise.resolve(l).then(s,a)}function $(o){return function(){var e=this,t=arguments;return new Promise(function(s,a){var r=o.apply(e,t);function i(l){ot(r,s,a,i,c,"next",l)}function c(l){ot(r,s,a,i,c,"throw",l)}i(void 0)})}}function N(o,e,t){return e=Yn(e),e in o?Object.defineProperty(o,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):o[e]=t,o}function Yn(o){var e=zn(o,"string");return typeof e=="symbol"?e:String(e)}function zn(o,e){if(typeof o!="object"||o===null)return o;var t=o[Symbol.toPrimitive];if(t!==void 0){var s=t.call(o,e||"default");if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(o)}var be=A.module("PouchStorageTable"),Jn="Deephaven.";bt.plugin(zt);function Xn(o,e){switch(o){case M.in:case M.contains:return{$regex:new RegExp("".concat(e))};case M.inIgnoreCase:return{$regex:new RegExp("".concat(e),"i")};case M.eq:return{$eq:e};case M.notEq:return{$neq:e};case M.greaterThan:return{$gt:e};case M.greaterThanOrEqualTo:return{$gte:e};case M.lessThan:return{$lt:e};case M.lessThanOrEqualTo:return{$lte:e};case M.startsWith:return{$regex:new RegExp("^(?".concat(e,").*"))};default:throw new Error("Unsupported type: ".concat(o))}}function Qn(o){for(var{filterItems:e,filterOperators:t}=o,s=null,a=0;a<e.length;a+=1){var r=e[a],{columnName:i,type:c,value:l}=r,d={[i]:Xn(c,l)};if(a===0)s=d;else if(s!==null&&a-1<t.length){var h=t[a-1];if(h===ce.and)s={$and:[s,d]};else if(h===ce.or)s={$or:[s,d]};else throw new Error("Unexpected filter operator ".concat(h,", ").concat(d))}}if(s==null)throw new Error("Invalid filter config ".concat(o));return s}function ve(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return{$and:[...o.map(e=>Qn(e)),{name:{$gt:null}},{id:{$gt:null}}]}}function eo(o){var e,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return[{id:t?"desc":"asc"},...(e=o?.map(s=>({[s.column]:s.direction})))!==null&&e!==void 0?e:[]]}class to{constructor(e,t){N(this,"db",void 0),N(this,"changes",void 0),N(this,"listeners",[]),N(this,"itemListeners",new Map),N(this,"currentSize",0),N(this,"currentViewport",void 0),N(this,"currentReverse",!1),N(this,"currentFilter",null),N(this,"currentSort",null),N(this,"infoUpdatePromise",void 0),N(this,"viewportUpdatePromise",void 0),N(this,"currentViewportData",void 0),this.db=new bt("".concat(Jn).concat(e),t),this.db._remote=!1,this.listenForChanges(),this.db.createIndex({index:{fields:["id","name"]}}),this.refreshInfo()}listenForChanges(){this.changes=this.db.changes({live:!0,since:"now",include_docs:!0}).on("change",this.dbUpdate.bind(this))}onUpdate(e){return this.listeners=[...this.listeners,e],()=>{this.listeners=this.listeners.filter(t=>t!==e)}}onItemUpdate(e,t){return this.itemListeners.has(e)||this.itemListeners.set(e,[]),this.itemListeners.set(e,[...this.itemListeners.get(e),t]),this.refreshItem(e),()=>{this.itemListeners.set(e,this.itemListeners.get(e).filter(s=>s!==t))}}close(){this.listeners=[]}get size(){return this.currentSize}get viewport(){return this.currentViewport}setReversed(e){this.currentReverse=e,this.currentViewportData=void 0,this.refreshData()}setViewport(e){this.currentViewport=e,this.refreshInfo(),this.refreshData()}setSorts(e){this.currentSort=e,this.currentViewportData=void 0,this.refreshData()}setFilters(e){this.currentFilter=e,this.currentViewportData=void 0,this.refreshInfo(),this.refreshData()}get data(){return this.currentViewportData}getViewportData(){var e=this;return $(function*(){var t;return e.viewportUpdatePromise||e.refreshData(),(t=e.viewportUpdatePromise)!==null&&t!==void 0?t:Promise.resolve({items:[],offset:0})})()}put(e){var t=this;return $(function*(){var s=nt(nt({},e),{},{_id:e.id});return yield t.db.put(s),s})()}sendUpdate(){for(var e,{listeners:t}=this,s=(e=this.currentViewportData)!==null&&e!==void 0?e:{items:[],offset:0},a=0;a<t.length;a+=1)t[a](s)}sendItemUpdate(e){var t=this.itemListeners.get(e.id);if(t!==void 0)for(var s=0;s<t.length;s+=1)t[s](e)}dbUpdate(e){be.debug("Update received",e),this.refreshInfo(),e.doc!==void 0&&this.sendItemUpdate(e.doc),this.refreshData()}fetchInfo(e){var t=this;return $(function*(){return t.db.find({selector:e,fields:[]})})()}refreshInfo(){var e=this;return $(function*(){try{var t,s;(t=e.infoUpdatePromise)===null||t===void 0||t.cancel(),e.infoUpdatePromise=K.makeCancelable(e.fetchInfo(ve((s=e.currentFilter)!==null&&s!==void 0?s:[])));var a=yield e.infoUpdatePromise;e.currentSize=a.docs.length,e.sendUpdate()}catch(r){if(!K.isCanceled(r))throw be.error("Unable to refreshInfo",r),r}})()}fetchViewportData(e,t,s){var a=this;return $(function*(){return a.db.find({selector:t,skip:e.top,limit:e.bottom-e.top+1,sort:s,fields:["id","name"]}).then(r=>({items:r.docs,offset:e.top}))})()}refreshData(){var e=this;return $(function*(){if(e.currentViewport)try{var t,s,a=ve((t=e.currentFilter)!==null&&t!==void 0?t:[]),r=eo(e.currentSort,e.currentReverse);(s=e.viewportUpdatePromise)===null||s===void 0||s.cancel(),e.viewportUpdatePromise=K.makeCancelable(e.fetchViewportData(e.currentViewport,a,r));var i=yield e.viewportUpdatePromise;return e.currentViewportData=i,e.sendUpdate(),i}catch(c){if(!K.isCanceled(c))throw be.error("Unable to refreshData",c),c}})()}refreshItem(e){var t=this;return $(function*(){var s=yield t.db.find({selector:{id:e},limit:1}),a=s.docs[0];return a!==void 0&&t.sendItemUpdate(a),a})()}getSnapshot(e){var t=this;return $(function*(){var s=new Map,a=[{id:t.currentReverse?"desc":"asc"}];return yield Promise.all(e.map(function(){var r=$(function*(i){var c,[l,d]=i,h=d-l+1;return t.db.find({selector:ve((c=t.currentFilter)!==null&&c!==void 0?c:[]),skip:l,limit:h,sort:a,fields:["id","name"]}).then(u=>{for(var g=0;g<h;g+=1){var y=l+g;s.set(y,u.docs[g])}})});return function(i){return r.apply(this,arguments)}}())),s})()}}const so=to;function at(o,e){var t=Object.keys(o);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(o);e&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(o,a).enumerable})),t.push.apply(t,s)}return t}function ae(o){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?at(Object(t),!0).forEach(function(s){Lt(o,s,t[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(t)):at(Object(t)).forEach(function(s){Object.defineProperty(o,s,Object.getOwnPropertyDescriptor(t,s))})}return o}function rt(o,e,t,s,a,r,i){try{var c=o[r](i),l=c.value}catch(d){t(d);return}c.done?e(l):Promise.resolve(l).then(s,a)}function Q(o){return function(){var e=this,t=arguments;return new Promise(function(s,a){var r=o.apply(e,t);function i(l){rt(r,s,a,i,c,"next",l)}function c(l){rt(r,s,a,i,c,"throw",l)}i(void 0)})}}function Lt(o,e,t){return e=no(e),e in o?Object.defineProperty(o,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):o[e]=t,o}function no(o){var e=oo(o,"string");return typeof e=="symbol"?e:String(e)}function oo(o,e){if(typeof o!="object"||o===null)return o;var t=o[Symbol.toPrimitive];if(t!==void 0){var s=t.call(o,e||"default");if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(o)}var ao=2500,ro=2e3,O=A.module("PouchCommandHistoryTable");class io extends so{constructor(e,t){var s;super("CommandHistoryStorage.".concat(e),{auto_compaction:!0,revs_limit:1}),Lt(this,"searchText",void 0),this.cache=t,this.cache.tableRegistry.has(this.cacheKey)||this.cache.tableRegistry.set(this.cacheKey,new Set),O.debug("Adding table to registry",this.cacheKey),(s=this.cache.tableRegistry.get(this.cacheKey))===null||s===void 0||s.add(this)}get cacheKey(){return this.db.name}setSearch(e){O.debug("Setting search filters",e),this.searchText=e.trim().toLowerCase(),this.setFilters(e?[tt.makeFilterConfig([tt.makeFilterItem("name",M.contains,e)])]:[])}dbUpdate(e){O.debug("Clearing cache and refreshing data",e),this.cache.response.delete(this.cacheKey),super.dbUpdate(e)}fetchData(e){var t=this;return Q(function*(){return K.withTimeout(0,Q(function*(){t.cache.response.has(t.cacheKey)?O.debug("Fetching from cache",t.searchText,t.viewport):(O.debug("Fetching from PouchDB",t.searchText,t.viewport),t.cache.response.set(t.cacheKey,t.db.allDocs({include_docs:!0}).then(a=>{var r=a.rows.map(l=>l.doc).filter(l=>{var{name:d}=l;return d});O.debug("Fetched ".concat(r.length," command history items"));var{toKeep:i,toPrune:c}=qn(r,ao,ro);return c.length&&t.pruneItems(c),{docs:i}})));var s=t.cache.response.get(t.cacheKey);return t.searchText==null||t.searchText===""?s:ae(ae({},s),{},{docs:(yield s).docs.filter(a=>{var{name:r}=a;return r.toLowerCase().includes(t.searchText)})})}))})()}fetchInfo(e){var t=this;return Q(function*(){return t.fetchData(e)})()}fetchViewportData(e,t,s){var a=this;return Q(function*(){var r=yield a.fetchData(t);O.debug("Fetching viewport data",e.top,e.bottom+1,s,r);var i=typeof s[0]=="object"&&s[0].id==="desc",c=i?r.docs.slice(0).reverse():r.docs,l=c.slice(e.top,e.bottom+1);return{items:l,offset:e.top}})()}pruneItems(e){var t=this;return Q(function*(){if(t.cache.isPruning.get(t.cacheKey)===!0){O.debug("Pruning already in progress. Skipping.");return}try{O.debug("Pruning ".concat(e.length," command history items"));var s=t.cache.pauseChangeListeners(t.cacheKey);t.cache.isPruning.set(t.cacheKey,!0),yield t.db.bulkDocs(e.map(a=>ae(ae({},a),{},{_deleted:!0}))),t.cache.isPruning.set(t.cacheKey,!1),s(),O.debug("Finished pruning command history items")}catch(a){O.error("An error occurred while pruning db",a)}})()}close(){var e,t,s;O.debug("Closing table",this,(e=this.cache.tableRegistry.get(this.cacheKey))===null||e===void 0?void 0:e.size),(t=this.cache.tableRegistry.get(this.cacheKey))===null||t===void 0||t.delete(this),(s=this.changes)===null||s===void 0||s.cancel(),super.close()}}const it=io;function Se(o,e,t){return e=lo(e),e in o?Object.defineProperty(o,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):o[e]=t,o}function lo(o){var e=co(o,"string");return typeof e=="symbol"?e:String(e)}function co(o,e){if(typeof o!="object"||o===null)return o;var t=o[Symbol.toPrimitive];if(t!==void 0){var s=t.call(o,e||"default");if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(o)}var lt=A.module("PouchCommandHistoryCache");class uo{constructor(){Se(this,"isPruning",void 0),Se(this,"response",void 0),Se(this,"tableRegistry",void 0),this.isPruning=new Map,this.response=new Map,this.tableRegistry=new Map}pauseChangeListeners(e){var t,s=[];return(t=this.tableRegistry.get(e))===null||t===void 0||t.forEach(a=>{a.changes&&(lt.debug("Pausing event listeners on '".concat(e,"' table"),a),a.changes.cancel(),s.push(a))}),()=>{s.forEach(a=>{var r,i;(r=(i=this.tableRegistry.get(e))===null||i===void 0?void 0:i.has(a))!==null&&r!==void 0&&r&&(lt.debug("Resuming event listeners on '".concat(e,"' table"),a),a.listenForChanges())})}}}const ho=uo;function ct(o,e){var t=Object.keys(o);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(o);e&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(o,a).enumerable})),t.push.apply(t,s)}return t}function dt(o){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ct(Object(t),!0).forEach(function(s){xe(o,s,t[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(t)):ct(Object(t)).forEach(function(s){Object.defineProperty(o,s,Object.getOwnPropertyDescriptor(t,s))})}return o}function ut(o,e,t,s,a,r,i){try{var c=o[r](i),l=c.value}catch(d){t(d);return}c.done?e(l):Promise.resolve(l).then(s,a)}function ye(o){return function(){var e=this,t=arguments;return new Promise(function(s,a){var r=o.apply(e,t);function i(l){ut(r,s,a,i,c,"next",l)}function c(l){ut(r,s,a,i,c,"throw",l)}i(void 0)})}}function xe(o,e,t){return e=mo(e),e in o?Object.defineProperty(o,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):o[e]=t,o}function mo(o){var e=po(o,"string");return typeof e=="symbol"?e:String(e)}function po(o,e){if(typeof o!="object"||o===null)return o;var t=o[Symbol.toPrimitive];if(t!==void 0){var s=t.call(o,e||"default");if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(o)}var ht=A.module("PouchCommandHistoryStorage");class fo{constructor(){xe(this,"cache",new ho),xe(this,"updateTableMap",new Map)}getUpdateTable(e){return this.updateTableMap.has(e)||this.updateTableMap.set(e,new it(e,this.cache)),this.updateTableMap.get(e)}getTable(e){var t=this;return ye(function*(){return new it(e,t.cache)})()}addItem(e,t,s,a){var r=this;return ye(function*(){return r.updateItem(e,{id:"".concat(new Date().getTime()),name:s,data:a})})()}updateItem(e,t){var s=this;return ye(function*(){var a=s.getUpdateTable(e),r=yield a.refreshItem(t.id),i=dt(dt({},r??{}),t);return ht.debug("Updating item",i),yield a.put(i),ht.debug("Update saved"),t})()}listenItem(e,t,s){var a=this.getUpdateTable(e);return a.onItemUpdate(t,s)}}const Pt="SET_LAYOUT_STORAGE",go=o=>({type:Pt,payload:o});var{dh:bo}=globalThis;const B=bo;const vo=A.module("SettingsUtils");function So(o){return o.formatString!=null}function De(o){const e=o?.querySelector("input, select, textarea");e&&e.focus()}function kt(o,e){return o.defaultFormatString===e.defaultFormatString}function yo(o,e){return kt(o,e)}function To(o,e){return kt(o,e)}function At(o){return o!==""&&is.isValidColumnName(o)}function q(o,e,t){if(!e||t.formatString==null||!So(t))return!1;switch(e){case"datetime":return W.isValid(o,t);case"decimal":return k.isValid(o,t);case"int":return P.isValid(o,t);default:return vo.warn("Trying to validate format of unknown type"),!0}}function Co(o){const{id:e,isNewRule:t,...s}=o;return s}function wo(o,e){return At(e.columnName)&&q(o,e.columnType,e.format)}function Mt(o){const{timestamp:e,timeZone:t,showTimeZone:s,showTSeparator:a,isGlobalOptions:r,legacyGlobalFormat:i}=o,c=yt(),l=m.useMemo(()=>new ls(c,[],{timeZone:t,showTimeZone:s,showTSeparator:a}),[c,s,a,t]),d=r?W.getGlobalFormats(s,a):W.getFormats(s,a);return i!=null&&!d.includes(i)&&d.unshift(i),n.jsx(n.Fragment,{children:d.map(h=>{const u=W.makeFormat("",h,W.TYPE_GLOBAL);return n.jsx("option",{value:h,"data-testid":"time-format",children:l.getFormattedString(e,D.dataType.DATETIME,"",u)},h)})})}function xo(){return n.jsx(n.Fragment,{children:cs.TIME_ZONES.map(o=>{const{label:e,value:t}=o;return n.jsx("option",{value:t,children:e},t)})})}const V=A.module("FormattingSectionContent");class Ne extends m.PureComponent{static defaultProps={scrollTo:()=>{}};static inputDebounceTime=250;constructor(e){super(e),this.debouncedCommitChanges=Fe(this.commitChanges.bind(this),Ne.inputDebounceTime),this.queueUpdate=this.queueUpdate.bind(this),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{defaultDateTimeFormat:t,defaultDecimalFormatOptions:s,defaultIntegerFormatOptions:a,showTimeZone:r,showTSeparator:i,timeZone:c,truncateNumbersWithPound:l}=e;this.containerRef=X.createRef(),this.pendingUpdates=[],this.state={showTimeZone:r,showTSeparator:i,timeZone:c,defaultDateTimeFormat:t,defaultDecimalFormatOptions:s,defaultIntegerFormatOptions:a,truncateNumbersWithPound:l,timestampAtMenuOpen:new Date}}componentDidMount(){De(this.containerRef.current)}componentWillUnmount(){this.debouncedCommitChanges.flush()}debouncedCommitChanges;pendingUpdates;containerRef;getCachedDateTimeFormatOptions=Te((e,t,s,a=!1,r)=>{const{timestampAtMenuOpen:i}=this.state;return n.jsx(Mt,{timestamp:i,timeZone:e,showTimeZone:t,showTSeparator:s,isGlobalOptions:a,legacyGlobalFormat:r})});queueUpdate(e){this.pendingUpdates.push(e),this.debouncedCommitChanges()}handleDefaultDateTimeFormatChange(e){V.debug("handleDefaultDateTimeFormatChange",e);const t={defaultDateTimeFormat:e};this.setState(t),this.queueUpdate(t)}handleDefaultDecimalFormatChange(e){V.debug("handleDefaultDecimalFormatChange",e.target.value);const t={defaultDecimalFormatOptions:{defaultFormatString:e.target.value}};this.setState(t),q(dh,D.dataType.DECIMAL,k.makeCustomFormat(e.target.value))&&this.queueUpdate(t)}handleDefaultIntegerFormatChange(e){V.debug("handleDefaultIntegerFormatChange",e.target.value);const t={defaultIntegerFormatOptions:{defaultFormatString:e.target.value}};this.setState(t),q(dh,D.dataType.INT,P.makeCustomFormat(e.target.value))&&this.queueUpdate(t)}handleShowTimeZoneChange(){const{showTimeZone:e}=this.state,t={showTimeZone:!e};this.setState(t),this.queueUpdate(t)}handleShowTSeparatorChange(){const{showTSeparator:e}=this.state,t={showTSeparator:!e};this.setState(t),this.queueUpdate(t)}handleTimeZoneChange(e){const t={timeZone:e};this.setState(t),this.queueUpdate(t)}handleResetDateTimeFormat(){const{defaults:e}=this.props,{defaultDateTimeFormat:t,showTimeZone:s,showTSeparator:a}=e;V.debug("handleResetDateTimeFormat"),this.setState({defaultDateTimeFormat:t,showTimeZone:s,showTSeparator:a}),this.queueUpdate({defaultDateTimeFormat:void 0,showTimeZone:void 0,showTSeparator:void 0})}handleResetTimeZone(){const{defaults:e}=this.props,{timeZone:t}=e;V.debug("handleResetTimeZone"),this.setState({timeZone:t}),this.queueUpdate({timeZone:void 0})}handleResetDecimalFormat(){const{defaults:e}=this.props,{defaultDecimalFormatOptions:t}=e;V.debug("handleResetDecimalFormat"),this.setState({defaultDecimalFormatOptions:t}),this.queueUpdate({defaultDecimalFormatOptions:void 0})}handleResetIntegerFormat(){const{defaults:e}=this.props,{defaultIntegerFormatOptions:t}=e;V.debug("handleResetIntegerFormat"),this.setState({defaultIntegerFormatOptions:t}),this.queueUpdate({defaultIntegerFormatOptions:void 0})}handleTruncateNumbersWithPoundChange(){const{truncateNumbersWithPound:e}=this.state,t={truncateNumbersWithPound:e!==!0};this.setState(t),this.queueUpdate(t)}commitChanges(){const{updateSettings:e}=this.props,t=this.pendingUpdates.reduce((s,a)=>({...s,...a}),{});this.pendingUpdates=[],e(t)}render(){const{defaults:e,dh:t}=this.props,{defaultDateTimeFormat:s,defaultDecimalFormatOptions:a,defaultIntegerFormatOptions:r,timeZone:i,showTimeZone:c,showTSeparator:l,truncateNumbersWithPound:d}=this.state,{defaultFormatString:h=k.DEFAULT_FORMAT_STRING}=a??{},{defaultFormatString:u=P.DEFAULT_FORMAT_STRING}=r??{},g=i===e.timeZone,y=l===e.showTSeparator&&c===e.showTimeZone&&s===e.defaultDateTimeFormat,v=yo(a,e.defaultDecimalFormatOptions),E=To(r,e.defaultIntegerFormatOptions);return n.jsx("div",{className:"app-settings-formatting-section",ref:this.containerRef,children:n.jsxs("div",{className:"container-fluid p-0",children:[n.jsx("div",{className:"app-settings-menu-description mb-3",children:"Choose the default formatting rule to apply to all table columns based on their type."}),n.jsxs("div",{className:"form-row mb-2",children:[n.jsx("label",{className:"col-form-label col-3",htmlFor:"select-reset-timezone",children:"Time zone"}),n.jsx("div",{className:"col pr-0",children:n.jsx(de,{className:"custom-select",value:i,onChange:this.handleTimeZoneChange,id:"select-reset-timezone",children:n.jsx(xo,{})})}),n.jsx("div",{className:"col-1 btn-col",children:n.jsx(S,{kind:"ghost",icon:Z,onClick:this.handleResetTimeZone,tooltip:"Reset Time Zone",className:F("btn-reset","btn-reset-time-zone",{hidden:g})})})]}),n.jsxs("div",{className:"form-row mb-2",children:[n.jsx("label",{className:"col-form-label col-3",htmlFor:"select-default-time-format",children:"DateTime"}),n.jsx("div",{className:"col pr-0",children:n.jsx(de,{className:"custom-select",value:s,onChange:this.handleDefaultDateTimeFormatChange,id:"select-default-time-format",children:this.getCachedDateTimeFormatOptions(i,c,l,!0,s)})}),n.jsx("div",{className:"col-1 btn-col",children:n.jsx(S,{kind:"ghost",icon:Z,onClick:this.handleResetDateTimeFormat,tooltip:"Reset DateTime Options",className:F("btn-reset","btn-reset-date-time",{hidden:y})})})]}),n.jsx("div",{className:"form-row",children:n.jsx("div",{className:"offset-3 col-9",children:n.jsx(ge,{checked:c??null,onChange:this.handleShowTimeZoneChange,children:"Show time zone in dates"})})}),n.jsx("div",{className:"form-row mb-3",children:n.jsx("div",{className:"offset-3 col-9",children:n.jsx(ge,{checked:l??null,onChange:this.handleShowTSeparatorChange,children:"Show 'T' separator"})})}),n.jsxs("div",{className:"form-row mb-2",children:[n.jsx("label",{className:"col-form-label col-3",htmlFor:"default-decimal-format-input",children:"Decimal"}),n.jsx("div",{className:"col pr-0",children:n.jsx("input",{className:F("form-control","flex-grow-1","default-decimal-format-input",{"is-invalid":!q(t,D.dataType.DECIMAL,k.makeCustomFormat(h))}),"data-lpignore":!0,placeholder:k.DEFAULT_FORMAT_STRING,type:"text",id:"default-decimal-format-input",value:h,onChange:this.handleDefaultDecimalFormatChange})}),n.jsx("div",{className:"col-1 btn-col",children:n.jsx(S,{kind:"ghost",icon:Z,onClick:this.handleResetDecimalFormat,tooltip:"Reset Decimal Formatting",className:F("btn-reset","btn-reset-decimal",{hidden:v}),"data-testid":"btn-reset-decimal"})})]}),n.jsxs("div",{className:"form-row mb-2",children:[n.jsx("label",{className:"col-form-label col-3",htmlFor:"default-integer-format-input",children:"Integer"}),n.jsx("div",{className:"col pr-0",children:n.jsx("input",{className:F("form-control","flex-grow-1","default-integer-format-input",{"is-invalid":!q(t,D.dataType.INT,P.makeCustomFormat(u))}),"data-lpignore":!0,placeholder:P.DEFAULT_FORMAT_STRING,type:"text",id:"default-integer-format-input",value:u,onChange:this.handleDefaultIntegerFormatChange})}),n.jsx("div",{className:"col-1 btn-col",children:n.jsx(S,{kind:"ghost",icon:Z,onClick:this.handleResetIntegerFormat,tooltip:"Reset Integer Formatting",className:F("btn-reset","btn-reset-integer",{hidden:E}),"data-testid":"btn-reset-integer"})})]}),n.jsx("div",{className:"form-row mb-3",children:n.jsx("div",{className:"offset-3 col-9",children:n.jsx(ge,{checked:d??null,onChange:this.handleTruncateNumbersWithPoundChange,children:"Show truncated numbers as ###"})})})]})})}}const Do=o=>({defaultDateTimeFormat:Sn(o),defaultDecimalFormatOptions:xt(o),defaultIntegerFormatOptions:Dt(o),dh:Ft(o),showTimeZone:Et(o),showTSeparator:Rt(o),truncateNumbersWithPound:yn(o),timeZone:Nt(o),defaults:Tn(o)}),Fo=te(Do,{updateSettings:Re})(Ne);function Eo(){const[o,e]=m.useState(!1),t=()=>{e(!o)};return n.jsxs(n.Fragment,{children:[n.jsx(S,{kind:"ghost",onClick:t,icon:js,children:"Legal Notices"}),n.jsxs(Os,{isOpen:o,toggle:t,children:[n.jsx(Is,{toggle:t,children:"Legal Notice"}),n.jsxs(Ls,{children:[n.jsx("p",{children:"Deephaven software is protected by U.S. Patent Nos. 9,612,959; 9,613,018; 9,613,109; 9,619,210; 9,633,060; 9,639,570; 9,672,238; 9,679,006; 9,690,821; 9,710,511; 9,760,591; 9,805,084; 9,836,494; 9,836,495; 9,886,469; 9,898,496; 9,934,266; 10,002,153; 10,002,154; 10,002,155; 10,003,673; 10,019,138; 10,069,943; 10,176,211; 10,198,465; 10,198,466; 10,198,469; 10,212,257; 10,241,960; 10,241,965; 10,242,040; 10,242,041; 10,346,394; 10,353,893; 10,452,649; 10,496,639; 10,540,351; 10,552,412; 10,565,194; 10,565,206; 10,572,474; 10,621,168; 10,642,829; 10,657,184; 10,678,787; 10,691,686; 10,783,191; 10,866,943; 10,909,183; 10,915,526; 10,922,311; 10,929,394; 11,023,462; 11,126,662; 11,151,133; 11,238,036; 11,249,994; 11,263,211; 11,449,557; 11,514,037; 11,556,528; and 11,574,018. Other patents pending."}),n.jsxs("p",{children:["© 2016-",new Date().getFullYear()," Deephaven Data Labs LLC. Patent Pending."]})]})]})]})}function Y(o){const{children:e,isExpanded:t,sectionKey:s,title:a,onToggle:r}=o;return n.jsxs(n.Fragment,{children:[n.jsx("div",{children:n.jsxs(S,{kind:"ghost",className:"btn-collapse-trigger",onClick:()=>r(s),children:[n.jsx("div",{className:"flex-grow-1",children:a}),n.jsx("div",{className:"flex-shrink-0",children:n.jsx(x,{transform:t?"flip-v":"",icon:Ps})})]})}),n.jsx(an,{in:t,autoFocusOnShow:!0,children:e})]})}Y.propTypes={children:f.node,isExpanded:f.bool.isRequired,sectionKey:f.string.isRequired,title:f.node.isRequired,onToggle:f.func};Y.defaultProps={children:null,onToggle:()=>{}};function Ro({shortcut:o,displayText:e,categoryName:t,onChange:s}){const[a,r]=m.useState(e),[i,c]=m.useState(o.getKeyState()),[l,d]=m.useState(!1),[h,u]=m.useState("");m.useEffect(function(){r(e),c(o.getKeyState())},[e,o]),m.useEffect(function(){r(U.getDisplayText(i)),o.matchesKeyState(i)&&d(!1)},[i,o]),m.useEffect(function(){if(l){if(!U.isValidKeyState(i)){U.isAllowedKey(i.keyValue)?u("Must contain a modifier key"):u("Must contain an allowed action key");return}const p=Ee.getConflictingShortcuts(i).filter(b=>b.id.startsWith(t)&&b!==o).map(b=>b.name);if(p.length){u(`Conflicts with ${p.join(", ")}`);return}u("")}else u("")},[l,i,t,o]);function g(C){if(C.stopPropagation(),C.preventDefault(),o.isEditable&&!C.repeat){const p=U.getKeyStateFromEvent(C),b=U.createKeyState([ds.BACKSPACE]);U.doKeyStatesMatch(p,b)?c(U.NULL_KEY_STATE):c(p)}}function y(C){C.stopPropagation(),C.preventDefault(),o.matchesKeyState(i)||d(!0)}function v(){We.disableAllActions()}function E(){We.enableAllActions()}function R(){o.setKeyState(i),d(!1),s(o)}function T(){const C=o.getKeyState();c(C),d(!1)}function j(){d(!0),c(o.getDefaultKeyState())}return n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"shortcut-item-container",children:[n.jsxs("label",{className:"shortcut-item-name",children:[o.name,o.tooltip!==void 0&&n.jsx(Tt,{children:o.tooltip})]}),n.jsxs("div",{className:"shortcut-item-input-container",children:[n.jsx("input",{className:F("form-control",{"is-invalid":h}),onKeyDown:g,onKeyUp:y,onFocus:v,onBlur:E,disabled:!o.isEditable,value:a,readOnly:!0}),!U.doKeyStatesMatch(i,o.getDefaultKeyState())&&!h&&n.jsx(S,{className:"reset-to-default-button",kind:"ghost",icon:n.jsx(x,{icon:Z,transform:{rotate:90,flipX:!0}}),tooltip:"Reset to default",onClick:j})]})]}),l&&n.jsxs("div",{className:F("shortcut-item-message-container",{"is-invalid":h}),children:[n.jsx("div",{className:"shortcut-item-message",children:h}),n.jsxs("div",{className:"shortcut-item-message-buttons",children:[U.isValidKeyState(i)&&n.jsx(S,{kind:"ghost",onClick:R,children:"Confirm"}),n.jsx(S,{kind:"ghost",onClick:T,children:"Undo"})]})]})]})}function No({shortcutOverrides:o={},updateSettings:e}){const t=m.useCallback(i=>{const c=U.isMacPlatform,l={mac:{...o.mac},windows:{...o.windows}},d=c?l.mac:l.windows;i.forEach(h=>{h.isDefault()?delete d[h.id]:d[h.id]=h.getKeyState()}),e({shortcutOverrides:l})},[e,o]);let s=Array.from(Ee.shortcutsByCategory.entries()).map(([i,c])=>({name:i,shortcuts:c}));const a=s.findIndex(i=>i.name.toUpperCase()==="GLOBAL"),r=s.splice(a,1);return s=s.concat(r),n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"app-settings-menu-description",children:"Customize shortcuts below. To prevent unexpected results, avoid conflicting shortcuts with the browser or IDE editor."}),s.map(i=>n.jsx(jo,{name:i.name,shortcuts:i.shortcuts,saveShortcutOverrides:t},i.name))]})}function jo({name:o,shortcuts:e,saveShortcutOverrides:t}){function s(l){return l.split("_").map(d=>`${d[0].toUpperCase()}${d.slice(1).toLowerCase()}`).join(" ")}const[a,r]=m.useState(e);function i(l){const d=a.filter(u=>u!==l&&!u.isNull()&&u.matchesKeyState(l.getKeyState()));d.forEach(u=>u.setToNull());const h=[l,...d];t(h),r(u=>[...u])}const c=m.useMemo(()=>a.map(l=>l.getDisplayText()),[a]);return n.jsxs("div",{className:"mt-3",children:[n.jsx("div",{className:"font-weight-bold",children:s(o)}),a.map((l,d)=>n.jsx(Ro,{shortcut:l,displayText:c[d],categoryName:o,onChange:i},l.id))]})}const Oo=o=>({shortcutOverrides:Cn(o)}),Io={updateSettings:Re},Lo=te(Oo,Io)(No),Po="yyyy-MM-dd-HHmmss";function Ut(o,e="root",t=new Map([[o,""]])){const s={};return Object.entries(o).forEach(([a,r])=>{try{JSON.stringify(r),s[a]=r}catch{const c=r;if(typeof r=="bigint")s[a]=r.toString();else if(t.has(c))s[a]=`Circular ref to ${t.get(c)}`;else{const l=`${e}.${a}`;t.set(c,l),s[a]=Ut(r,l,t)}}}),s}function ko(){const o=jt.getState();return JSON.stringify(Ut(o),null,2)}function Ao(o){const e={uiVersion:"0.59.0",userAgent:navigator.userAgent,...o};return JSON.stringify(e,null,2)}async function Mo(o=`${B.i18n.DateTimeFormat.format(Po,new Date)}_support_logs`,e){const t=new vt,s=t.folder(o);s.file("console.txt",ks.getFormattedHistory()),s.file("redux.json",ko()),s.file("metadata.json",Ao(e));const a=await t.generateAsync({type:"blob"}),r=document.createElement("a");r.href=URL.createObjectURL(a),r.download=`${o}.zip`,r.click()}const Uo=[{value:D.dataType.DATETIME,label:"DateTime"},{value:D.dataType.DECIMAL,label:"Decimal"},{value:D.dataType.INT,label:"Integer"}];function _o(){const o=Uo.map(e=>n.jsx("option",{value:e.value,children:e.label},`key-columnType-${e.value}`));return n.jsxs(n.Fragment,{children:[n.jsx("option",{disabled:!0,value:"",children:"Select Type"},"key-columnType-placeholder"),o]})}class je extends m.PureComponent{static defaultProps={scrollTo:()=>{}};static inputDebounceTime=250;constructor(e){super(e),this.debouncedCommitChanges=Fe(this.commitChanges.bind(this),je.inputDebounceTime),this.handleFormatRuleEntered=this.handleFormatRuleEntered.bind(this),this.handleFormatRuleChange=this.handleFormatRuleChange.bind(this),this.handleFormatRuleCreate=this.handleFormatRuleCreate.bind(this),this.handleFormatRuleDelete=this.handleFormatRuleDelete.bind(this);const{formatter:t,showTimeZone:s,showTSeparator:a,timeZone:r}=e,i=t.map((c,l)=>({...c,id:l}));this.containerRef=X.createRef(),this.addFormatRuleButtonRef=X.createRef(),this.lastFormatRuleIndex=i.length,this.state={formatSettings:i,formatRulesChanged:!1,showTimeZone:s,showTSeparator:a,timeZone:r,timestampAtMenuOpen:new Date}}componentDidMount(){De(this.containerRef.current)}componentWillUnmount(){this.debouncedCommitChanges.flush()}debouncedCommitChanges;containerRef;addFormatRuleButtonRef;lastFormatRuleIndex;isDuplicateRule(e){const{formatSettings:t}=this.state;return t.some(s=>s.id!==e.id&&s.columnName===e.columnName&&s.columnType===e.columnType)??!1}getAutoIncrementFormatRuleIndex(){const{lastFormatRuleIndex:e}=this;return this.lastFormatRuleIndex+=1,e}getCachedColumnTypeOptions=Te(()=>n.jsx(_o,{}));getCachedDateTimeFormatOptions=Te((e,t,s,a=!1,r)=>{const{timestampAtMenuOpen:i}=this.state;return n.jsx(Mt,{timestamp:i,timeZone:e,showTimeZone:t,showTSeparator:s,isGlobalOptions:a,legacyGlobalFormat:r})});handleFormatRuleChange(e,t,s){this.setState(a=>{const{formatSettings:r}=a;we(r);const i=[...r];let c={};t==="columnType"&&(c={format:this.makeDefaultFormatterItemByType(s)});const l={...i[e],...c,[t]:s};return i[e]=l,{formatSettings:i}},()=>{this.debouncedCommitChanges()})}handleFormatRuleCreate(){this.setState(e=>{const{formatSettings:t}=e,s={columnType:D.dataType.DATETIME,columnName:"",format:{},id:this.getAutoIncrementFormatRuleIndex(),isNewRule:!0};return{formatSettings:[...t,s],formatRulesChanged:!0}})}handleFormatRuleDelete(e){this.setState(t=>{const{formatSettings:s}=t;return{formatSettings:s.filter((r,i)=>i!==e),formatRulesChanged:!0}},()=>{this.debouncedCommitChanges()})}handleFormatRuleEntered(e){this.scrollToFormatBlockBottom(),De(e)}commitChanges(){const{formatSettings:e}=this.state,{dh:t}=this.props,s=e.filter(i=>wo(t,i)).map(Co)??[],{updateSettings:a}=this.props;a({formatter:s})}scrollToFormatBlockBottom(){const{scrollTo:e}=this.props;e(0,(this.addFormatRuleButtonRef.current?.offsetHeight??0)+(this.addFormatRuleButtonRef.current?.offsetTop??0))}getRuleError(e){const{dh:t}=this.props,s={hasColumnNameError:!1,hasFormatError:!1,message:""},a=[];return e.isNewRule!==void 0&&e.isNewRule||(this.isDuplicateRule(e)&&(s.hasColumnNameError=!0,a.push("Duplicate column name/type combo.")),At(e.columnName)||(s.hasColumnNameError=!0,a.push("Column names must start with a letter or underscore and contain only alphanumeric characters or underscores.")),e.format.formatString!==void 0&&e.format.formatString.length===0?(s.hasFormatError=!0,a.push("Empty formatting rule.")):q(t,e.columnType,e.format)||(s.hasFormatError=!0,a.push("Invalid formatting rule.")),s.message=a.join(`
2
2
  `)),s}makeDefaultFormatterItemByType(e){switch(D.getNormalizedType(e)){case D.dataType.INT:{const{defaultIntegerFormatOptions:t}=this.props,{defaultFormatString:s}=t;return P.makeFormat("",s??P.DEFAULT_FORMAT_STRING,P.TYPE_GLOBAL,void 0)}case D.dataType.DECIMAL:{const{defaultDecimalFormatOptions:t}=this.props,{defaultFormatString:s}=t;return k.makeFormat("",s??k.DEFAULT_FORMAT_STRING,k.TYPE_GLOBAL,void 0)}default:return""}}renderFormatRule(e,t){const s=`input-${e}-columnName`,a=`input-${e}-columnType`,r=`input-${e}-format`,i=this.getCachedColumnTypeOptions(),c=u=>this.handleFormatRuleChange(e,"columnName",u.target.value),l=()=>this.handleFormatRuleChange(e,"isNewRule",!1),d=u=>this.handleFormatRuleChange(e,"columnType",u),h=this.getRuleError(t);return n.jsxs("fieldset",{className:"container-fluid format-rule-container",children:[n.jsxs("div",{className:"form-row",children:[n.jsxs("div",{className:"form-group col-7 mb-2",children:[n.jsx("label",{htmlFor:s,children:"Column Name"}),n.jsx("input",{id:s,className:F("form-control",{"is-invalid":h.hasColumnNameError}),"data-lpignore":!0,type:"text",value:t.columnName,onChange:c,onBlur:l})]}),n.jsxs("div",{className:"form-group col mb-2",children:[n.jsx(S,{kind:"ghost",className:"btn-delete-format-rule float-right",tabIndex:-1,onClick:()=>this.handleFormatRuleDelete(e),icon:As,tooltip:"Delete","aria-label":"Delete Format Rule"}),n.jsx("label",{htmlFor:a,children:"Column Type"}),n.jsx(de,{id:a,className:"custom-select",value:t.columnType,onChange:d,children:i})]})]}),n.jsx("div",{className:"form-row",children:n.jsxs("div",{className:"form-group col-12 d-flex mb-2",children:[n.jsx("label",{className:"flex-shrink-0 col-form-label mr-3",htmlFor:r,children:"Formatting Rule"}),this.renderFormatRuleInput(e,t.columnType,r,t.format,h.hasFormatError)]})}),n.jsx("div",{className:"form-row",children:n.jsx("div",{className:"form-group col-12 d-flex mb-2",children:h.message&&n.jsx("p",{className:"text-danger",children:h.message})})})]},e)}renderFormatRuleInput(e,t,s,a,r){switch(D.getNormalizedType(t)){case D.dataType.DATETIME:return this.renderDateTimeFormatRuleInput(e,s,a,r);case D.dataType.DECIMAL:return this.renderDecimalFormatRuleInput(e,s,a,r);case D.dataType.INT:return this.renderIntegerFormatRuleInput(e,s,a,r);default:throw new Error(`Unrecognized column type: ${t}`)}}renderDateTimeFormatRuleInput(e,t,s,a){const{showTimeZone:r,showTSeparator:i,timeZone:c}=this.state,l=s.formatString??"";return n.jsxs(de,{className:F("custom-select",{"is-invalid":a}),value:l,id:t,onChange:d=>{const h=W.makeFormat("",d,W.TYPE_GLOBAL);this.handleFormatRuleChange(e,"format",h)},children:[n.jsx("option",{value:"",disabled:!0,children:"Select format"},"default"),this.getCachedDateTimeFormatOptions(c,r,i)]})}renderIntegerFormatRuleInput(e,t,s,a){const{defaultIntegerFormatOptions:r}=this.props;we(r);const{defaultFormatString:i}=r,c=s.formatString??"";return n.jsx("input",{className:F("form-control","flex-grow-1",{"is-invalid":a}),"data-lpignore":!0,id:t,placeholder:i??P.DEFAULT_FORMAT_STRING,type:"text",value:c,onChange:l=>{const d=P.makeFormat("",l.target.value,P.TYPE_GLOBAL,void 0);this.handleFormatRuleChange(e,"format",d)}})}renderDecimalFormatRuleInput(e,t,s,a){const{defaultDecimalFormatOptions:r}=this.props,{defaultFormatString:i}=r,c=s.formatString??"";return n.jsx("input",{className:F("form-control","flex-grow-1",{"is-invalid":a}),"data-lpignore":!0,id:t,placeholder:i??k.DEFAULT_FORMAT_STRING,type:"text",value:c,onChange:l=>{const d=k.makeFormat("",l.target.value,k.TYPE_GLOBAL,void 0);this.handleFormatRuleChange(e,"format",d)}})}render(){const{formatRulesChanged:e,formatSettings:t}=this.state,s=t.map((r,i)=>n.jsx(St,{classNames:"fade",timeout:ie.transitionMs,onEnter:this.handleFormatRuleEntered,children:this.renderFormatRule(i,r)},r.id)),a=n.jsx(S,{kind:"ghost",className:"mb-3",onClick:this.handleFormatRuleCreate,ref:this.addFormatRuleButtonRef,icon:Ms,children:"Add New Rule"});return n.jsxs("div",{className:"app-settings-formatting-section",ref:this.containerRef,children:[n.jsx("div",{className:"app-settings-menu-description mb-3",children:"Customize the formatting of table columns by applying rules based on matching both a column name and column type."}),n.jsx(Jt,{appear:e,enter:e,exit:e,children:s}),a]})}}const $o=o=>({formatter:wn(o),defaultDecimalFormatOptions:xt(o),defaultIntegerFormatOptions:Dt(o),dh:Ft(o),showTimeZone:Et(o),showTSeparator:Rt(o),timeZone:Nt(o)}),Ko=te($o,{updateSettings:Re})(je);class I extends m.Component{static defaultProps={onDone:()=>{}};static FORMATTING_SECTION_KEY="SettingsMenu.formatting";static COLUMN_SPECIFIC_SECTION_KEY="SettingsMenu.columnFormatting";static APPLICATION_SECTION_KEY="ApplicationMenu.settings";static SHORTCUT_SECTION_KEY="SettingsMenu.shortcuts";static THEME_SECTION_KEY="SettingsMenu.theme";static focusFirstInputInContainer(e){const t=e?.querySelector("input, select, textarea");t&&t.focus()}constructor(e){super(e),this.handleClose=this.handleClose.bind(this),this.handleScrollTo=this.handleScrollTo.bind(this),this.handleSectionToggle=this.handleSectionToggle.bind(this),this.handleExportSupportLogs=this.handleExportSupportLogs.bind(this),this.handleLogout=this.handleLogout.bind(this),this.menuContentRef=X.createRef(),this.broadcastChannel=new BroadcastChannel(rn),this.state={expandedSectionKey:I.FORMATTING_SECTION_KEY}}componentDidMount(){I.focusFirstInputInContainer(this.menuContentRef.current)}componentWillUnmount(){this.broadcastChannel.close()}menuContentRef;broadcastChannel;isSectionExpanded(e){const{expandedSectionKey:t}=this.state;return t===e}handleLogout(){this.broadcastChannel.postMessage(ln(cn))}handleScrollTo(e,t){this.menuContentRef.current?.scrollTo(e,t)}handleSectionToggle(e){this.setState(t=>({expandedSectionKey:t.expandedSectionKey===e?void 0:e}))}handleClose(){const{onDone:e}=this.props;e()}handleExportSupportLogs(){const{serverConfigValues:e}=this.props;Mo(void 0,Object.fromEntries(e))}render(){const e="0.59.0",t="https://github.com/deephaven/web-client-ui/",s="https://deephaven.io/core/docs/",{serverConfigValues:a,user:r}=this.props,i=a.get("barrage.version"),c=a.get("java.version"),l=a.get("deephaven.version"),d=(y,v)=>n.jsxs(n.Fragment,{children:[n.jsx("div",{children:y}),n.jsx("div",{children:v})]}),h=r.displayName??r.name,u=r.image!=null&&r.image!=="",g=h!=="";return n.jsxs("div",{className:"app-settings-menu",children:[n.jsxs("header",{className:"app-settings-menu-header",children:[n.jsxs("div",{className:"user-info",children:[n.jsxs("div",{className:"user-image",children:[!u&&n.jsx(x,{icon:Us,transform:"grow-8"}),u&&n.jsx("img",{src:r.image,alt:h})]}),n.jsxs("div",{className:"user-details",children:[g&&n.jsxs("div",{className:"user-name",children:[h,r.operateAs!=null&&r.name!==r.operateAs&&n.jsxs(n.Fragment,{children:[n.jsxs("span",{className:"font-weight-light font-italic",children:[" ","as"," "]}),n.jsxs("span",{className:"operating-as-user",children:[n.jsx(x,{icon:_s,className:"mr-1"}),r.operateAs]})]})]}),r.permissions.canLogout&&n.jsx("button",{type:"button",className:"btn btn-link",onClick:this.handleLogout,children:"logout"})]})]}),n.jsx(S,{kind:"ghost",className:"btn-close-settings-menu",onClick:this.handleClose,icon:n.jsx(x,{icon:$s,transform:"grow-4"}),tooltip:"Close"})]}),n.jsxs("div",{className:"app-settings-menu-content",ref:this.menuContentRef,children:[n.jsx("h5",{children:"Settings"}),n.jsx("hr",{className:"my-0"}),n.jsx(Y,{sectionKey:I.FORMATTING_SECTION_KEY,isExpanded:this.isSectionExpanded(I.FORMATTING_SECTION_KEY),title:n.jsxs(n.Fragment,{children:[n.jsx(x,{icon:Ks,transform:"grow-4",className:"mr-2"}),"Default Format & Time zone"]}),onToggle:this.handleSectionToggle,children:n.jsx(Fo,{})}),n.jsx(Y,{sectionKey:I.COLUMN_SPECIFIC_SECTION_KEY,isExpanded:this.isSectionExpanded(I.COLUMN_SPECIFIC_SECTION_KEY),title:n.jsxs(n.Fragment,{children:[n.jsx(x,{icon:Ws,transform:"grow-4",className:"mr-2"}),"Format by Column Name & Type"]}),onToggle:this.handleSectionToggle,children:n.jsx(Ko,{scrollTo:this.handleScrollTo})}),n.jsx(us.Consumer,{children:y=>(we(y,"ThemeContext value is null"),y.themes.length>1?n.jsx(Y,{sectionKey:I.THEME_SECTION_KEY,isExpanded:this.isSectionExpanded(I.THEME_SECTION_KEY),onToggle:this.handleSectionToggle,title:n.jsxs(n.Fragment,{children:[n.jsx(x,{icon:Bs,transform:"grow-4",className:"mr-2"}),"Theme"]}),children:n.jsx(dn,{})}):null)}),n.jsx(Y,{sectionKey:I.SHORTCUT_SECTION_KEY,isExpanded:this.isSectionExpanded(I.SHORTCUT_SECTION_KEY),title:n.jsxs(n.Fragment,{children:[n.jsx(x,{icon:Gs,transform:"grow-2"})," ","Keyboard Shortcuts"]}),onToggle:this.handleSectionToggle,children:n.jsx(Lo,{})}),n.jsxs("div",{className:"app-settings-footer",children:[n.jsxs("div",{className:"app-settings-footer-section",children:[n.jsxs("div",{className:"app-settings-footer-item",children:[n.jsx("div",{className:"font-weight-bold",children:"Support"}),n.jsxs("div",{children:["GitHub: ",n.jsx("a",{href:t,className:"custom-link",target:"_blank",rel:"noopener noreferrer",children:t})]}),n.jsx(S,{kind:"tertiary",className:"mt-2 py-2",onClick:this.handleExportSupportLogs,children:"Export Logs"})]}),n.jsxs("div",{className:"app-settings-footer-item",children:[n.jsx("div",{className:"font-weight-bold",children:"Documentation"}),n.jsx("a",{target:"_blank",rel:"noreferrer noopener",href:s,className:"custom-link",children:s})]}),n.jsxs("div",{className:"app-settings-footer-item",children:[n.jsx("div",{className:"font-weight-bold",children:"Version"}),n.jsxs("span",{className:"d-inline-block text-muted",children:[l," ",n.jsx(x,{icon:Vs}),n.jsxs(Tt,{interactive:!0,children:[n.jsxs("div",{className:"detailed-server-config",children:[d("Engine Version",l),d("Web UI Version",e),d("Java Version",c),d("Barrage Version",i)]}),n.jsx(hs,{tooltip:"Copy version numbers",copy:`Engine Version: ${l}
3
3
  Web UI Version: ${e}
4
4
  Java Version: ${c}
5
- Barrage Version: ${i}`,children:"Copy Versions"})]})]})]}),n.jsx("div",{className:"app-settings-footer-item",children:n.jsx(Eo,{})})]}),n.jsx("div",{className:"app-settings-footer-section",children:n.jsx("a",{target:"_blank",rel:"noreferrer noopener",href:"https://deephaven.io",style:{display:"block",width:"61.8%"},children:n.jsx(wt,{})})})]})]})]})}}const mt=10;function z(o){const{forwardedProps:{menuItem:{action:e,title:t,disabled:s},iconElement:a,displayShortcut:r,isMouseSelected:i,isKeyboardSelected:c,closeMenu:l}}=o,d=m.useRef(),h=m.useRef(),u=m.useRef(null),[g,y]=m.useState(!1),v=m.useCallback(T=>{d.current!=null&&h.current!=null&&u.current&&(Math.abs(d.current-T.clientX)>=mt||Math.abs(h.current-T.clientY)>=mt)&&(y(!0),window.removeEventListener("mousemove",v),l(),e(T),u.current=null)},[e,l]);function E(T){d.current=T.clientX,h.current=T.clientY,u.current=T.target,window.addEventListener("mousemove",v)}function R(T){u.current===T.target&&(y(!0),l(),e(),window.removeEventListener("mousemove",v)),u.current=null}return m.useEffect(function(){return function(){return window.removeEventListener("mousemove",v)}},[v]),n.jsxs("button",{type:"button",className:F("btn-context-menu",{disabled:s},{active:i&&!s},{"keyboard-active":c&&!s}),onMouseDown:E,onMouseUp:R,disabled:g,children:[n.jsx("span",{className:F("icon"),children:a}),n.jsx("span",{className:"title",children:t}),n.jsx("span",{className:"shortcut",children:r})]})}function Oe(o){const{handleControlSelect:e,handleToolSelect:t,onClearFilter:s}=o,a=m.useMemo(()=>[{title:"Input Filter",icon:Hs,menuElement:n.jsx(z,{}),action:r=>{e(G.INPUT_FILTER,r)},order:10},{title:"Dropdown Filter",icon:Zs,menuElement:n.jsx(z,{}),action:r=>{e(G.DROPDOWN_FILTER,r)},order:15},{title:"Markdown Widget",icon:qs,menuElement:n.jsx(z,{}),action:r=>{e(G.MARKDOWN,r)},order:20},{title:"Filter Sets",icon:Ys,menuElement:n.jsx(z,{}),action:r=>{e(G.FILTER_SET_MANAGER,r)},order:25},{disabled:!0,menuElement:n.jsx("div",{className:"context-menu-group-header",children:"Tools"}),order:30},{title:"Linker",icon:zs,action:()=>{t(ue.LINKER)},order:40,shortcut:Ce.LINKER},{disabled:!0,menuElement:n.jsx("div",{className:"context-menu-group-header",children:"Actions"}),order:50},{title:"Clear All Filters",icon:Js,action:()=>{s()},order:60,shortcut:Ct.TABLE.CLEAR_ALL_FILTERS}],[e,t,s]);return n.jsx(ms,{popperClassName:"controls-menu-popper",actions:a})}Oe.propTypes={handleControlSelect:f.func,handleToolSelect:f.func,onClearFilter:f.func};Oe.defaultProps={handleControlSelect:()=>{},handleToolSelect:()=>{},onClearFilter:()=>{}};z.propTypes={forwardedProps:f.shape({iconElement:f.node,displayShortcut:f.string,isMouseSelected:f.bool.isRequired,isKeyboardSelected:f.bool.isRequired,closeMenu:f.func.isRequired,menuItem:f.shape({action:f.func,title:f.string,disabled:f.bool}).isRequired})};z.defaultProps={forwardedProps:null};const Wo=xn(Pt,null),Bo={layoutStorage:Wo},Go=o=>o.layoutStorage,Vo=o=>o.serverConfigValues;Object.entries(Bo).map(([o,e])=>ps.register(o,e));const pt=10;function Ho(o){const{onExportLayout:e,onImportLayout:t,onResetLayout:s,onSelect:a,widgets:r=[]}=o,[i,c]=m.useState(!1),[l,d]=m.useState(""),h=m.useRef(null),u=m.useRef(),g=m.useCallback((p,b)=>{p!=null&&a(p,b)},[a]),y=m.useCallback(p=>{d(p.target.value)},[]),v=m.useCallback(p=>{u.current!=null&&(Math.abs(u.current.x-p.clientX)>=pt||Math.abs(u.current.y-p.clientY)>=pt)&&(c(!0),window.removeEventListener("mousemove",v),g(u.current.widget,p),u.current=void 0)},[u,g]),E=m.useCallback((p,b)=>{u.current={x:p.clientX,y:p.clientY,widget:b},window.addEventListener("mousemove",v)},[v]),R=m.useCallback((p,b)=>{window.removeEventListener("mousemove",v),u.current?.widget===b&&(c(!0),g(b)),u.current=void 0},[v,u,g]),T=m.useMemo(()=>r.filter(p=>l?p.name?.toLowerCase().includes(l.toLowerCase()):!0),[l,r]).sort((p,b)=>p.name?.localeCompare(b.name??"")??0),j=m.useMemo(()=>T.map(p=>n.jsx("li",{children:n.jsxs(S,{kind:"ghost","data-testid":`panel-list-item-${p.name??""}-button`,onMouseDown:b=>{E(b,p)},onMouseUp:b=>{R(b,p)},onKeyDown:b=>{(b.key==="Enter"||b.key===" ")&&g(p)},disabled:i,onClick:()=>{},children:[n.jsx(Dn,{type:p.type})," ",p.name??""]})},p.name)),[T,i,E,R,g]),C=m.useMemo(()=>j.length===0?n.jsx("span",{children:"No bound variables found."}):null,[j]);return n.jsxs("div",{className:"widget-list-container d-flex flex-column",children:[n.jsx("div",{className:"widget-list-header",children:n.jsx(fs,{value:l,placeholder:"Find Table, Plot or Widget",onChange:y,ref:h})}),n.jsxs("ul",{className:"widget-list flex-grow-1",children:[C&&n.jsx("li",{className:"widget-list-message",children:C}),!C&&j]}),n.jsx("div",{children:n.jsx("hr",{})}),n.jsxs("div",{className:"widget-list-footer",children:[n.jsxs(S,{kind:"ghost",onClick:e,children:[n.jsxs("div",{className:"fa-md fa-layers",children:[n.jsx(x,{mask:He,icon:Ze,transform:"right-5 down-5"}),n.jsx(x,{icon:Ze,transform:"right-8 down-6"})]}),"Export Layout"]}),n.jsxs(S,{kind:"ghost",onClick:t,children:[n.jsxs("div",{className:"fa-md fa-layers",children:[n.jsx(x,{mask:He,icon:qe,transform:"right-5 down-5"}),n.jsx(x,{icon:qe,transform:"right-8 down-6"})]}),"Import Layout"]}),n.jsx(S,{kind:"ghost",icon:Z,onClick:s,tooltip:"Reset Layout"})]})]})}function Zo({onAutoFillClick:o=()=>{}}){return n.jsxs("div",{className:"empty-dashboard-container",children:[n.jsxs("div",{className:"hint-container",children:[n.jsx(x,{icon:Xs})," ",n.jsx("br",{}),"Use the panel list to add objects from a query."]}),n.jsxs("div",{className:"empty-dashboard",children:[n.jsx("div",{className:"add-panels-hint",children:"Drag Panels Here"}),n.jsx(S,{kind:"tertiary",onClick:o,children:"Auto fill objects"})]})]})}function qo(o){return o.version===2}function Yo(o){return Array.isArray(o)}const re=A.module("UserLayoutUtils"),zo={layoutConfig:[{type:"column",content:[{type:"row",height:40,content:[{type:"stack",content:[{type:"react-component",component:ze.COMPONENT,title:ze.TITLE,isClosable:!1},{type:"react-component",component:Je.COMPONENT,title:Je.TITLE,isClosable:!1}]},{type:"stack",width:25,content:[{type:"react-component",component:Xe.COMPONENT,title:Xe.TITLE,isClosable:!1},{type:"react-component",component:Qe.COMPONENT,title:Qe.TITLE,isClosable:!1}]}]},{type:"row",content:[{type:"stack",title:"Notebooks",content:[]}]}]}],links:[],filterSets:[],version:2},Jo={layoutConfig:[],links:[],filterSets:[],version:2};function _t(o){if(qo(o))return o;if(Yo(o))return{layoutConfig:o,links:[],filterSets:[],version:2};throw new Error(`Unexpected layout import format: ${o}`)}async function Xo(o,e=!0){try{const t=await o.getLayouts();if(t.length>0)try{const s=await o.getLayout(t[0]);return _t(s)}catch(s){re.error("Unable to load layout",t[0],":",s),re.warn("No valid layouts found, falling back to default layout")}}catch(t){re.error("Unable to fetch layout list",t),re.warn("Falling back to default layout")}return e?zo:Jo}function Qo(o){const{filterSets:e,layoutConfig:t,links:s}=o;return{filterSets:e,layoutConfig:t,links:s,version:2}}const le={exportLayout:Qo,getDefaultLayout:Xo,normalizeLayout:_t},w=A.module("AppMainContainer");class J extends m.Component{static handleWindowBeforeUnload(e){e.preventDefault(),e.returnValue=""}static hydrateConsole(e,t){return Be.hydrate({...e,unzip:s=>vt.loadAsync(s).then(a=>Object.values(a.files))},t)}static handleRefresh(){w.info("Refreshing application"),window.location.reload()}constructor(e){super(e),vs(this),this.importElement=X.createRef(),this.state={contextActions:[{action:()=>{this.handleToolSelect(ue.LINKER)},shortcut:Ce.LINKER,isGlobal:!0},{action:()=>{this.sendClearFilter()},shortcut:Ct.TABLE.CLEAR_ALL_FILTERS,isGlobal:!0},{action:()=>{w.debug("Consume unhandled save shortcut")},shortcut:Ce.SAVE,isGlobal:!0}],isAuthFailed:!1,isDisconnected:!1,isPanelsMenuShown:!1,isResetLayoutPromptShown:!1,isSettingsMenuShown:!1,unsavedNotebookCount:0,widgets:[]}}componentDidMount(){this.initWidgets(),this.startListeningForDisconnect(),window.addEventListener("beforeunload",J.handleWindowBeforeUnload)}componentDidUpdate(e){const{dashboardData:t}=this.props;e.dashboardData!==t&&this.handleDataChange(t)}componentWillUnmount(){this.deinitWidgets(),this.stopListeningForDisconnect(),window.removeEventListener("beforeunload",J.handleWindowBeforeUnload)}goldenLayout;importElement;widgetListenerRemover;initWidgets(){const{connection:e}=this.props;if(e.subscribeToFieldUpdates==null){w.warn("subscribeToFieldUpdates not supported, not initializing widgets");return}this.widgetListenerRemover=e.subscribeToFieldUpdates(t=>{w.debug("Got updates",t),this.setState(({widgets:s})=>{const{updated:a,created:r,removed:i}=t,c=[...a,...i],l=s.filter(h=>!c.some(u=>u.name===h.name));return[...a,...r].forEach(h=>{h.name!=null&&h.name!==""&&l.push(h)}),{widgets:l}})})}deinitWidgets(){this.widgetListenerRemover?.()}openNotebookFromURL(){const{match:e}=this.props,{notebookPath:t}=e.params;if(t){const{session:s,sessionConfig:a}=this.props;if(s==null||a==null){w.error("No session available to open notebook URL",t);return}const r={id:`/${t}`,itemName:`/${t}`},i=a.type,c={value:null,language:i};this.emitLayoutEvent(On.SELECT_NOTEBOOK,s,i,c,r,!0)}}sendClearFilter(){this.emitLayoutEvent(oe.CLEAR_ALL_FILTERS)}emitLayoutEvent(e,...t){this.goldenLayout?.eventHub.emit(e,...t)}handleCancelResetLayoutPrompt(){this.setState({isResetLayoutPromptShown:!1})}handleConfirmResetLayoutPrompt(){this.setState({isResetLayoutPromptShown:!1}),this.resetLayout()}handleError(e){K.isCanceled(e)||w.error(e)}handleSettingsMenuHide(){this.setState({isSettingsMenuShown:!1})}handleSettingsMenuShow(){this.setState({isSettingsMenuShown:!0})}handleControlSelect(e,t){switch(w.debug("handleControlSelect",e),e){case G.DROPDOWN_FILTER:this.emitLayoutEvent(oe.OPEN_DROPDOWN,{title:"DropdownFilter",type:e,createNewStack:!0,dragEvent:t});break;case G.INPUT_FILTER:this.emitLayoutEvent(oe.OPEN_INPUT,{title:"InputFilter",type:e,createNewStack:!0,dragEvent:t});break;case G.MARKDOWN:this.emitLayoutEvent(In.OPEN,{title:"Markdown",type:e,dragEvent:t});break;case G.FILTER_SET_MANAGER:this.emitLayoutEvent(oe.OPEN_FILTER_SET_MANAGER,{title:"FilterSets",type:e,dragEvent:t});break;default:throw new Error(`Unrecognized control type ${e}`)}}handleToolSelect(e){w.debug("handleToolSelect",e);const{activeTool:t,setActiveTool:s}=this.props;s(t===e?ue.DEFAULT:e)}handleClearFilter(){this.sendClearFilter()}handleDataChange(e){const{updateWorkspaceData:t}=this.props,{closed:s,filterSets:a,links:r}=e;t({closed:s,filterSets:a,links:r})}handleGoldenLayoutChange(e){this.goldenLayout=e}handleLayoutConfigChange(e){const{updateWorkspaceData:t}=this.props;t({layoutConfig:e})}handleWidgetMenuClick(){this.setState(({isPanelsMenuShown:e})=>({isPanelsMenuShown:!e}))}handleWidgetSelect(e,t){this.setState({isPanelsMenuShown:!1}),w.debug("handleWidgetSelect",e,t),this.openWidget(e,t)}handleWidgetsMenuClose(){this.setState({isPanelsMenuShown:!1})}handleAutoFillClick(){const{widgets:e}=this.state;w.debug("handleAutoFillClick",e);const t=e.sort((s,a)=>s.title!=null&&a.title!=null?s.title.localeCompare(a.title):0);for(let s=0;s<t.length;s+=1)this.openWidget(t[s])}handleExportLayoutClick(){w.info("handleExportLayoutClick"),this.setState({isPanelsMenuShown:!1});try{const{workspace:e}=this.props,{data:t}=e,s=le.exportLayout(t);w.info("handleExportLayoutClick exportedConfig",s);const a=new Blob([JSON.stringify(s)],{type:"application/json"}),r=B.i18n.DateTimeFormat.format("yyyy-MM-dd-HHmmss",new Date),i=document.createElement("a");i.href=URL.createObjectURL(a),i.download=`deephaven-app-layout-${r}.json`,i.click()}catch(e){w.error("Unable to export layout",e)}}handleImportLayoutClick(){w.info("handleImportLayoutClick"),this.setState({isPanelsMenuShown:!1}),this.importElement.current!=null&&(this.importElement.current.value="",this.importElement.current.click())}handleResetLayoutClick(){w.info("handleResetLayoutClick"),this.setState({isPanelsMenuShown:!1,isResetLayoutPromptShown:!0,unsavedNotebookCount:Ln.unsavedNotebookCount()})}handleImportLayoutFiles(e){e.stopPropagation(),e.preventDefault(),e.target.files!=null&&this.importLayoutFile(e.target.files?.[0])}handleDisconnect(){w.info("Disconnected from server"),this.setState({isDisconnected:!0})}handleReconnect(){w.info("Reconnected to server"),this.setState({isDisconnected:!1})}handleReconnectAuthFailed(){w.warn("Reconnect authentication failed"),this.setState({isAuthFailed:!0})}async importLayoutFile(e){try{const{updateDashboardData:t,updateWorkspaceData:s}=this.props,a=await e.text(),r=JSON.parse(a),{filterSets:i,layoutConfig:c,links:l}=le.normalizeLayout(r);s({layoutConfig:c}),t(_,{filterSets:i,links:l})}catch(t){w.error("Unable to import layout",t)}}async resetLayout(){const{layoutStorage:e,session:t}=this.props,{filterSets:s,layoutConfig:a,links:r}=await le.getDefaultLayout(e,t!==void 0),{updateDashboardData:i,updateWorkspaceData:c}=this.props;c({layoutConfig:a}),i(_,{filterSets:s,links:r})}handlePaste(e){if(e.target instanceof HTMLElement&&e.target.closest(".monaco-editor"))return;const{clipboardData:t}=e,s=t.getData("Text"),a=/“|”/g;a.test(s)&&(e.preventDefault(),e.stopPropagation(),document.execCommand("insertText",!1,s.replace(a,'"')))}startListeningForDisconnect(){const{connection:e}=this.props;e.addEventListener(B.IdeConnection.EVENT_DISCONNECT,this.handleDisconnect),e.addEventListener(B.IdeConnection.EVENT_RECONNECT,this.handleReconnect),e.addEventListener(B.CoreClient.EVENT_RECONNECT_AUTH_FAILED,this.handleReconnectAuthFailed)}stopListeningForDisconnect(){const{connection:e}=this.props;e.removeEventListener(B.IdeConnection.EVENT_DISCONNECT,this.handleDisconnect),e.removeEventListener(B.IdeConnection.EVENT_RECONNECT,this.handleReconnect),e.removeEventListener(B.CoreClient.EVENT_RECONNECT_AUTH_FAILED,this.handleReconnectAuthFailed)}hydrateDefault(e,t){const{connection:s}=this.props,{metadata:a}=e;if(a?.type!=null&&(a?.id!=null||a?.name!=null)){const r=a.id!=null?{type:a.type,id:a.id}:{type:a.type,name:a.name,title:a.name};return{fetch:()=>s.getObject(r),...e,localDashboardId:t}}return Be.hydrate(e,t)}openWidget(e,t){const{connection:s}=this.props;this.emitLayoutEvent(Ss.OPEN,{dragEvent:t,fetch:()=>s.getObject(e),widget:e})}getDashboardPlugins=Qt(e=>[...e.entries()].filter(([,s])=>Cs(s)||Ve(s)).map(([s,a])=>{if(Ve(a)){const{DashboardPlugin:i}=a;return n.jsx(i,{},s)}const{component:r}=a;return n.jsx(r,{},s)}));render(){const{activeTool:e,plugins:t,user:s,workspace:a,serverConfigValues:r}=this.props,{data:i}=a,{layoutConfig:c}=i,{permissions:l}=s,{canUsePanels:d}=l,{contextActions:h,isAuthFailed:u,isDisconnected:g,isPanelsMenuShown:y,isResetLayoutPromptShown:v,isSettingsMenuShown:E,unsavedNotebookCount:R,widgets:T}=this.state,j=this.getDashboardPlugins(t);return n.jsxs("div",{className:F("app-main-tabs","w-100","h-100","d-flex","flex-column",e?`active-tool-${e.toLowerCase()}`:""),onPaste:this.handlePaste,tabIndex:-1,children:[n.jsx("nav",{className:"nav-container",children:n.jsxs("div",{className:"app-main-top-nav-menus",children:[n.jsx(wt,{className:"ml-1",style:{maxHeight:"20px"}}),n.jsxs("div",{children:[n.jsxs(S,{kind:"ghost",className:"btn-panels-menu",icon:Qs,onClick:()=>{},children:["Controls",n.jsx(Oe,{handleControlSelect:this.handleControlSelect,handleToolSelect:this.handleToolSelect,onClearFilter:this.handleClearFilter})]}),d&&n.jsxs(S,{kind:"ghost",className:"btn-panels-menu btn-show-panels","data-testid":"app-main-panels-button",onClick:this.handleWidgetMenuClick,icon:en,children:["Panels",n.jsx(ys,{isShown:y,className:"panels-menu-popper",onExited:this.handleWidgetsMenuClose,options:{placement:"bottom"},closeOnBlur:!0,interactive:!0,children:n.jsx(Ho,{widgets:T,onExportLayout:this.handleExportLayoutClick,onImportLayout:this.handleImportLayoutClick,onResetLayout:this.handleResetLayoutClick,onSelect:this.handleWidgetSelect})})]}),n.jsx(S,{kind:"ghost",className:F("btn-settings-menu",{"text-warning":s.operateAs!=null&&s.operateAs!==s.name}),onClick:this.handleSettingsMenuShow,icon:n.jsxs("span",{className:"fa-layers",children:[n.jsx(x,{icon:tn,transform:"grow-3"}),g&&!u&&n.jsxs(n.Fragment,{children:[n.jsx(x,{icon:sn,color:ie.background,transform:"grow-2 right-8 down-8.5 rotate-45"}),n.jsx(x,{icon:Ye,color:ie.danger,transform:"shrink-5 right-6 down-6"})]})]}),tooltip:g&&!u?"Server disconnected":"User Settings"})]})]})}),n.jsxs(un,{emptyDashboard:n.jsx(Zo,{onAutoFillClick:this.handleAutoFillClick}),id:_,layoutConfig:c,onGoldenLayoutChange:this.handleGoldenLayoutChange,onLayoutConfigChange:this.handleLayoutConfigChange,onLayoutInitialized:this.openNotebookFromURL,hydrate:this.hydrateDefault,children:[n.jsx(Pn,{hydrateConsole:J.hydrateConsole,notebooksUrl:new URL("notebooks/",document.baseURI).href}),j]}),n.jsx(St,{in:E,timeout:ie.transitionMidMs,classNames:"slide-left",mountOnEnter:!0,unmountOnExit:!0,children:n.jsx(I,{serverConfigValues:r,onDone:this.handleSettingsMenuHide,user:s})}),n.jsx(Ts,{actions:h}),n.jsx("input",{ref:this.importElement,type:"file",accept:".json",style:{display:"none"},onChange:this.handleImportLayoutFiles}),n.jsx(hn,{isOpen:g&&!u,debounceMs:1e3,children:n.jsx(mn,{icon:Ye,title:n.jsxs(n.Fragment,{children:[n.jsx(nn,{})," Attempting to reconnect..."]}),subtitle:"Please check your network connection."})}),n.jsx(Ge,{confirmButtonText:"Reset",onConfirm:this.handleConfirmResetLayoutPrompt,onCancel:this.handleCancelResetLayoutPrompt,isConfirmDanger:!0,isOpen:v,headerText:R===0?"Reset Layout":"Reset layout and discard unsaved changes",bodyText:R===0?"Do you want to reset your layout? Your existing layout will be lost.":"Do you want to reset your layout? Any unsaved notebooks will be lost."}),n.jsx(Ge,{confirmButtonText:"Refresh",onConfirm:J.handleRefresh,isOpen:u,headerText:"Authentication failed",bodyText:"Credentials are invalid. Please refresh your browser to try and reconnect."})]})}}const ea=o=>({activeTool:En(o),dashboardData:bs(o,_),layoutStorage:Go(o),plugins:Rn(o),connection:Nn(o,_),session:et(o,_)?.session,sessionConfig:et(o,_)?.config,user:jn(o),workspace:It(o),serverConfigValues:Vo(o)}),ta=te(ea,{setActiveTool:Ot,updateDashboardData:gs,updateWorkspaceData:Fn})(Xt(J));function sa(){return n.jsxs("div",{className:"app",children:[n.jsx(ta,{}),n.jsx(ws,{})]})}const na=A.module("LocalWorkspaceStorage");class L{static STORAGE_KEY="deephaven.WorkspaceStorage";static getBooleanServerConfig(e,t){if(e?.get(t)?.toLowerCase()==="true")return!0;if(e?.get(t)?.toLowerCase()==="false")return!1}static makeDefaultWorkspaceSettings(e){const t={defaultDateTimeFormat:W.DEFAULT_DATETIME_FORMAT_STRING,formatter:[],timeZone:W.DEFAULT_TIME_ZONE_ID,showTimeZone:!1,showTSeparator:!0,disableMoveConfirmation:!1,defaultDecimalFormatOptions:{defaultFormatString:k.DEFAULT_FORMAT_STRING},defaultIntegerFormatOptions:{defaultFormatString:P.DEFAULT_FORMAT_STRING},truncateNumbersWithPound:!1,defaultNotebookSettings:{isMinimapEnabled:!1}},s={defaultDateTimeFormat:e?.get("dateTimeFormat"),formatter:[],timeZone:e?.get("timeZone"),showTimeZone:L.getBooleanServerConfig(e,"showTimeZone"),showTSeparator:L.getBooleanServerConfig(e,"showTSeparator"),disableMoveConfirmation:L.getBooleanServerConfig(e,"disableMoveConfirmation"),defaultDecimalFormatOptions:e?.get("decimalFormat")!==void 0?{defaultFormatString:e?.get("decimalFormat")}:void 0,defaultIntegerFormatOptions:e?.get("integerFormat")!==void 0?{defaultFormatString:e?.get("integerFormat")}:void 0,truncateNumbersWithPound:L.getBooleanServerConfig(e,"truncateNumbersWithPound"),defaultNotebookSettings:e?.get("isMinimapEnabled")!==void 0?{isMinimapEnabled:L.getBooleanServerConfig(e,"isMinimapEnabled")}:void 0},a=Object.keys(s);for(let r=0;r<a.length;r+=1){const i=a[r];s[i]!==void 0&&(t[i]=s[i])}return t}static async makeWorkspaceData(e,t){const{filterSets:s,links:a,layoutConfig:r}=await le.getDefaultLayout(e,t?.isConsoleAvailable);return{settings:{},layoutConfig:r,closed:[{}],links:a,filterSets:s}}static async makeDefaultWorkspace(e,t){return{data:await L.makeWorkspaceData(e,t)}}layoutStorage;constructor(e){this.layoutStorage=e}async load(e){try{return JSON.parse(localStorage.getItem(L.STORAGE_KEY)??"")}catch{return na.info("Unable to load workspace data, initializing to default data"),L.makeDefaultWorkspace(this.layoutStorage,e)}}async save(e){return localStorage.setItem(L.STORAGE_KEY,JSON.stringify(e)),e}}class oa{storageService;root;constructor(e,t=""){this.storageService=e,this.root=t}async getLayouts(){return(await this.storageService.listItems(this.root,"*.json")).map(t=>t.basename)}async getLayout(e){const s=await(await this.storageService.loadFile(`${this.root}/${e}`)).text();return JSON.parse(s)}}const ee=A.module("GrpcFileStorageTable");class he{static REFRESH_DEBOUNCE=50;storageService;baseRoot;root;currentSize=0;currentViewport;listeners=[];viewportUpdatePromise;currentViewportData;childTables=new Map;constructor(e,t="",s=t){this.storageService=e,this.baseRoot=t,this.root=s,s===t&&(this.doRefresh=Fe(this.doRefresh.bind(this),he.REFRESH_DEBOUNCE))}removeBaseRoot(e){return H.removeRoot(this.baseRoot,e)}getViewportData(){return this.viewportUpdatePromise||this.refreshInternal(),this.viewportUpdatePromise??Promise.resolve({items:[],offset:0})}getSnapshot(e){throw new Error("Method not implemented.")}get size(){return this.currentSize}setExpanded(e,t){const s=e.split("/");let a=s.shift();if((a===void 0||a==="")&&(a=s.shift()),a===void 0||a==="")throw new Error(`Invalid path: ${e}`);const r=s.join("/");if(t){if(!this.childTables.has(a)){const i=new he(this.storageService,this.baseRoot,`${this.root}/${a}`);this.childTables.set(a,i)}r&&this.childTables.get(a)?.setExpanded(r,t)}else this.childTables.has(a)&&(r?this.childTables.get(a)?.setExpanded(r,t):this.childTables.delete(a));this.currentViewport&&this.refreshInternal()}collapseAll(){this.childTables.clear(),this.currentViewport&&this.refreshInternal()}setSearch(e){throw new Error("Method not implemented.")}setViewport(e){this.currentViewport=e,this.refreshInternal()}setFilters(){throw new Error("Method not implemented.")}setSorts(){throw new Error("Method not implemented.")}setReversed(){throw new Error("Method not implemented.")}close(){this.listeners=[]}onUpdate(e){return this.listeners=[...this.listeners,e],()=>{this.listeners=this.listeners.filter(t=>t!==e)}}doRefresh(e){ee.debug2("doRefresh",this.root),e(this.fetchData())}refresh(){ee.debug2("refresh",this.root),this.viewportUpdatePromise?.cancel();const e=new Promise(s=>{this.doRefresh(s)}),t=K.makeCancelable(e.then(s=>{if(this.viewportUpdatePromise!==t)throw new xs;return this.currentViewportData=s,this.sendUpdate(),s}));t.catch(s=>{K.isCanceled(s)||ee.error("Error updating viewport",s)}),this.viewportUpdatePromise=t}refreshInternal(){try{this.refresh()}catch(e){K.isCanceled(e)||ee.error("Unable to refresh data",e)}}async fetchData(){const{currentViewport:e}=this;if(!e)throw new Error("No viewport set");let s=(await this.storageService.listItems(this.root)).map(a=>({type:a.type,filename:this.removeBaseRoot(a.filename),basename:a.basename,id:this.removeBaseRoot(a.filename),isExpanded:a.type==="directory"?this.childTables.has(a.basename):void 0})).sort((a,r)=>a.type!==r.type?a.type==="directory"?-1:1:a.basename.localeCompare(r.basename));for(let a=0;a<s.length;a+=1){const r=s[a],{basename:i,filename:c}=r;if(c===this.removeBaseRoot(`${this.root}/${i}`)&&r.type==="directory"){const l=this.childTables.get(i);if(l!=null){l.setViewport({top:0,bottom:e.bottom-a});const d=await l.getViewportData();s.splice(a+1,0,...d.items)}}}return this.currentSize=s.length,ee.debug2(this.root,"items",s,e),s=s.slice(e.top,e.bottom),{items:s,offset:e.top}}sendUpdate(){const{listeners:e}=this,t=this.currentViewportData??{items:[],offset:0};for(let s=0;s<e.length;s+=1)e[s](t)}}const aa=A.module("GrpcFileStorage");class Ie{static REFRESH_THROTTLE=150;storageService;tables=[];root;constructor(e,t=""){this.storageService=e,this.root=t}removeRoot(e){return H.removeRoot(this.root,e)}addRoot(e){return H.addRoot(this.root,e)}async createDirectory(e){return await this.storageService.createDirectory(this.addRoot(e)),this.refreshTables(),{type:"directory",id:e,filename:e,basename:H.getBaseName(e)}}async getTable(){const e=new he(this.storageService,this.root);return this.tables.push(e),e}async saveFile(e){const t=dh.storage.FileContents.text(e.content);return await this.storageService.saveFile(this.addRoot(e.filename),t,!0),this.refreshTables(),e}async loadFile(e){const s=await(await this.storageService.loadFile(this.addRoot(e))).text();return{filename:e,basename:H.getBaseName(e),content:s}}async copyFile(e,t){const s=await this.storageService.loadFile(this.addRoot(e));await this.storageService.saveFile(this.addRoot(t),s,!1),this.refreshTables()}async deleteFile(e){await this.storageService.deleteItem(this.addRoot(e)),this.refreshTables()}async moveFile(e,t){await this.storageService.moveItem(this.addRoot(e),this.addRoot(t)),this.refreshTables()}async info(e){const t=await this.storageService.listItems(this.addRoot(H.getPath(e)),H.getBaseName(e));if(t.length===0)throw new kn;if(t.length>1)throw aa.error("More than one matching file found, should never happen.",t),new Error("More than one matching file found");const s=t[0];return{filename:this.removeRoot(s.filename),basename:s.basename,id:this.removeRoot(s.filename),type:s.type}}refreshTables=es(()=>{this.tables.forEach(e=>e.refresh())},Ie.REFRESH_THROTTLE)}const ra=A.module("AppInit");function Le(o){const{workspace:e,setActiveTool:t,setApi:s,setCommandHistoryStorage:a,setDashboardData:r,setFileStorage:i,setLayoutStorage:c,setDashboardConnection:l,setDashboardSessionWrapper:d,setPlugins:h,setUser:u,setWorkspace:g,setWorkspaceStorage:y,setDefaultWorkspaceSettings:v,setServerConfigValues:E}=o,R=yt(),T=pn(),j=Fs(),C=Es(),p=fn(),b=gn(),[se,$t]=m.useState();m.useEffect(function(){h(C)},[C,h]),m.useEffect(function(){async function Wt(){try{const ne=await bn(),me=await vn(R,j,ne),Me=T.getStorageService(),Ue=new oa(Me,"/layouts"),Bt=new Ie(Me,"/notebooks"),_e=new L(Ue),Gt=new fo,$e=await _e.load({isConsoleAvailable:me!==void 0}),{data:pe}=$e,{settings:Vt}=pe,{shortcutOverrides:Ke={}}=Vt,Ht=U.isMacPlatform?Ke.mac??{}:Ke.windows??{};Object.entries(Ht).forEach(([qt,Yt])=>{Ee.get(qt)?.setKeyState(Yt)});const Zt={filterSets:pe.filterSets,links:pe.links};s(R),t(ue.DEFAULT),E(p),a(Gt),r(_,Zt),i(Bt),c(Ue),l(_,j),me!==void 0&&d(_,me),u(b),y(_e),g($e),v(L.makeDefaultWorkspaceSettings(p))}catch(ne){ra.error(ne),$t(ne)}}Wt()},[R,T,j,p,t,s,a,r,i,c,l,d,u,g,v,y,E,b]);const Pe=e==null&&se==null,ke=!Pe&&se==null,Ae=se!=null?`${se}`:null;return n.jsxs(n.Fragment,{children:[ke&&n.jsx(sa,{}),n.jsx(on,{isLoading:Pe&&Ae==null,isLoaded:ke,errorMessage:Ae})]})}Le.propTypes={workspace:f.shape({}),workspaceStorage:f.shape({close:f.func}),setActiveTool:f.func.isRequired,setApi:f.func.isRequired,setCommandHistoryStorage:f.func.isRequired,setDashboardData:f.func.isRequired,setFileStorage:f.func.isRequired,setLayoutStorage:f.func.isRequired,setDashboardConnection:f.func.isRequired,setDashboardSessionWrapper:f.func.isRequired,setPlugins:f.func.isRequired,setUser:f.func.isRequired,setWorkspace:f.func.isRequired,setWorkspaceStorage:f.func.isRequired};Le.defaultProps={workspace:null,workspaceStorage:null};const ia=o=>({workspace:It(o),workspaceStorage:Zn(o)}),ft=te(ia,{setActiveTool:Ot,setApi:An,setCommandHistoryStorage:Mn,setDashboardData:Ds,setFileStorage:Un,setLayoutStorage:go,setDashboardConnection:_n,setDashboardSessionWrapper:$n,setPlugins:Kn,setUser:Wn,setWorkspace:Bn,setDefaultWorkspaceSettings:Gn,setWorkspaceStorage:Vn,setServerConfigValues:Hn})(Le),la=X.lazy(()=>as(()=>import("./StyleGuideRoot-a6410c3f.js"),["./StyleGuideRoot-a6410c3f.js","./vendor-a758141f.js","./helpers-042e6b4d.js","./vendor-fac43f8b.css","./index-777e0869.js","./monaco-1410cbed.js","./monaco-f18fde03.css","./index-eed2d9c0.css","./IrisGrid-03e8a663.js","./usePlugins-051cda02.js","./plotly-0a78b507.js","./usePlugins-a532c861.css","./IrisGrid-e0b16101.css","./FontBootstrap-abaccda2.js","./FontBootstrap-dda4f49b.css","./useUser-f0d8b080.js","./useUser-c5624723.css","./ControlType-7b1ad7ef.js","./ControlType-87c32a85.css","./StyleGuideRoot-a863a6e3.css"],import.meta.url)),ca=new URL(document.baseURI).pathname.replace(/\/$/,"");function da(){return n.jsx(ts,{basename:ca,children:n.jsxs(ss,{children:[n.jsx(fe,{exact:!0,path:"/",component:ft}),n.jsx(fe,{path:"/notebooks/:notebookPath+",component:ft}),n.jsx(fe,{path:"/styleguide",component:la}),n.jsx(ns,{from:"*",to:"/"})]})})}function gt(){return Rs.register(new URL("./download/serviceWorker.js",window.location.href)),Ns.init({getWorker:()=>new rs}),window["__react-beautiful-dnd-disable-dev-warnings"]=!0,n.jsx(os,{store:jt,children:n.jsx(da,{})})}const va=Object.freeze(Object.defineProperty({__proto__:null,AppRoot:gt,default:gt},Symbol.toStringTag,{value:"Module"}));export{va as A,L};
6
- //# sourceMappingURL=AppRoot-8c5918a3.js.map
5
+ Barrage Version: ${i}`,children:"Copy Versions"})]})]})]}),n.jsx("div",{className:"app-settings-footer-item",children:n.jsx(Eo,{})})]}),n.jsx("div",{className:"app-settings-footer-section",children:n.jsx("a",{target:"_blank",rel:"noreferrer noopener",href:"https://deephaven.io",style:{display:"block",width:"61.8%"},children:n.jsx(wt,{})})})]})]})]})}}const mt=10;function z(o){const{forwardedProps:{menuItem:{action:e,title:t,disabled:s},iconElement:a,displayShortcut:r,isMouseSelected:i,isKeyboardSelected:c,closeMenu:l}}=o,d=m.useRef(),h=m.useRef(),u=m.useRef(null),[g,y]=m.useState(!1),v=m.useCallback(T=>{d.current!=null&&h.current!=null&&u.current&&(Math.abs(d.current-T.clientX)>=mt||Math.abs(h.current-T.clientY)>=mt)&&(y(!0),window.removeEventListener("mousemove",v),l(),e(T),u.current=null)},[e,l]);function E(T){d.current=T.clientX,h.current=T.clientY,u.current=T.target,window.addEventListener("mousemove",v)}function R(T){u.current===T.target&&(y(!0),l(),e(),window.removeEventListener("mousemove",v)),u.current=null}return m.useEffect(function(){return function(){return window.removeEventListener("mousemove",v)}},[v]),n.jsxs("button",{type:"button",className:F("btn-context-menu",{disabled:s},{active:i&&!s},{"keyboard-active":c&&!s}),onMouseDown:E,onMouseUp:R,disabled:g,children:[n.jsx("span",{className:F("icon"),children:a}),n.jsx("span",{className:"title",children:t}),n.jsx("span",{className:"shortcut",children:r})]})}function Oe(o){const{handleControlSelect:e,handleToolSelect:t,onClearFilter:s}=o,a=m.useMemo(()=>[{title:"Input Filter",icon:Hs,menuElement:n.jsx(z,{}),action:r=>{e(G.INPUT_FILTER,r)},order:10},{title:"Dropdown Filter",icon:Zs,menuElement:n.jsx(z,{}),action:r=>{e(G.DROPDOWN_FILTER,r)},order:15},{title:"Markdown Widget",icon:qs,menuElement:n.jsx(z,{}),action:r=>{e(G.MARKDOWN,r)},order:20},{title:"Filter Sets",icon:Ys,menuElement:n.jsx(z,{}),action:r=>{e(G.FILTER_SET_MANAGER,r)},order:25},{disabled:!0,menuElement:n.jsx("div",{className:"context-menu-group-header",children:"Tools"}),order:30},{title:"Linker",icon:zs,action:()=>{t(ue.LINKER)},order:40,shortcut:Ce.LINKER},{disabled:!0,menuElement:n.jsx("div",{className:"context-menu-group-header",children:"Actions"}),order:50},{title:"Clear All Filters",icon:Js,action:()=>{s()},order:60,shortcut:Ct.TABLE.CLEAR_ALL_FILTERS}],[e,t,s]);return n.jsx(ms,{popperClassName:"controls-menu-popper",actions:a})}Oe.propTypes={handleControlSelect:f.func,handleToolSelect:f.func,onClearFilter:f.func};Oe.defaultProps={handleControlSelect:()=>{},handleToolSelect:()=>{},onClearFilter:()=>{}};z.propTypes={forwardedProps:f.shape({iconElement:f.node,displayShortcut:f.string,isMouseSelected:f.bool.isRequired,isKeyboardSelected:f.bool.isRequired,closeMenu:f.func.isRequired,menuItem:f.shape({action:f.func,title:f.string,disabled:f.bool}).isRequired})};z.defaultProps={forwardedProps:null};const Wo=xn(Pt,null),Bo={layoutStorage:Wo},Go=o=>o.layoutStorage,Vo=o=>o.serverConfigValues;Object.entries(Bo).map(([o,e])=>ps.register(o,e));const pt=10;function Ho(o){const{onExportLayout:e,onImportLayout:t,onResetLayout:s,onSelect:a,widgets:r=[]}=o,[i,c]=m.useState(!1),[l,d]=m.useState(""),h=m.useRef(null),u=m.useRef(),g=m.useCallback((p,b)=>{p!=null&&a(p,b)},[a]),y=m.useCallback(p=>{d(p.target.value)},[]),v=m.useCallback(p=>{u.current!=null&&(Math.abs(u.current.x-p.clientX)>=pt||Math.abs(u.current.y-p.clientY)>=pt)&&(c(!0),window.removeEventListener("mousemove",v),g(u.current.widget,p),u.current=void 0)},[u,g]),E=m.useCallback((p,b)=>{u.current={x:p.clientX,y:p.clientY,widget:b},window.addEventListener("mousemove",v)},[v]),R=m.useCallback((p,b)=>{window.removeEventListener("mousemove",v),u.current?.widget===b&&(c(!0),g(b)),u.current=void 0},[v,u,g]),T=m.useMemo(()=>r.filter(p=>l?p.name?.toLowerCase().includes(l.toLowerCase()):!0),[l,r]).sort((p,b)=>p.name?.localeCompare(b.name??"")??0),j=m.useMemo(()=>T.map(p=>n.jsx("li",{children:n.jsxs(S,{kind:"ghost","data-testid":`panel-list-item-${p.name??""}-button`,onMouseDown:b=>{E(b,p)},onMouseUp:b=>{R(b,p)},onKeyDown:b=>{(b.key==="Enter"||b.key===" ")&&g(p)},disabled:i,onClick:()=>{},children:[n.jsx(Dn,{type:p.type})," ",p.name??""]})},p.name)),[T,i,E,R,g]),C=m.useMemo(()=>j.length===0?n.jsx("span",{children:"No bound variables found."}):null,[j]);return n.jsxs("div",{className:"widget-list-container d-flex flex-column",children:[n.jsx("div",{className:"widget-list-header",children:n.jsx(fs,{value:l,placeholder:"Find Table, Plot or Widget",onChange:y,ref:h})}),n.jsxs("ul",{className:"widget-list flex-grow-1",children:[C&&n.jsx("li",{className:"widget-list-message",children:C}),!C&&j]}),n.jsx("div",{children:n.jsx("hr",{})}),n.jsxs("div",{className:"widget-list-footer",children:[n.jsxs(S,{kind:"ghost",onClick:e,children:[n.jsxs("div",{className:"fa-md fa-layers",children:[n.jsx(x,{mask:He,icon:Ze,transform:"right-5 down-5"}),n.jsx(x,{icon:Ze,transform:"right-8 down-6"})]}),"Export Layout"]}),n.jsxs(S,{kind:"ghost",onClick:t,children:[n.jsxs("div",{className:"fa-md fa-layers",children:[n.jsx(x,{mask:He,icon:qe,transform:"right-5 down-5"}),n.jsx(x,{icon:qe,transform:"right-8 down-6"})]}),"Import Layout"]}),n.jsx(S,{kind:"ghost",icon:Z,onClick:s,tooltip:"Reset Layout"})]})]})}function Zo({onAutoFillClick:o=()=>{}}){return n.jsxs("div",{className:"empty-dashboard-container",children:[n.jsxs("div",{className:"hint-container",children:[n.jsx(x,{icon:Xs})," ",n.jsx("br",{}),"Use the panel list to add objects from a query."]}),n.jsxs("div",{className:"empty-dashboard",children:[n.jsx("div",{className:"add-panels-hint",children:"Drag Panels Here"}),n.jsx(S,{kind:"tertiary",onClick:o,children:"Auto fill objects"})]})]})}function qo(o){return o.version===2}function Yo(o){return Array.isArray(o)}const re=A.module("UserLayoutUtils"),zo={layoutConfig:[{type:"column",content:[{type:"row",height:40,content:[{type:"stack",content:[{type:"react-component",component:ze.COMPONENT,title:ze.TITLE,isClosable:!1},{type:"react-component",component:Je.COMPONENT,title:Je.TITLE,isClosable:!1}]},{type:"stack",width:25,content:[{type:"react-component",component:Xe.COMPONENT,title:Xe.TITLE,isClosable:!1},{type:"react-component",component:Qe.COMPONENT,title:Qe.TITLE,isClosable:!1}]}]},{type:"row",content:[{type:"stack",title:"Notebooks",content:[]}]}]}],links:[],filterSets:[],version:2},Jo={layoutConfig:[],links:[],filterSets:[],version:2};function _t(o){if(qo(o))return o;if(Yo(o))return{layoutConfig:o,links:[],filterSets:[],version:2};throw new Error(`Unexpected layout import format: ${o}`)}async function Xo(o,e=!0){try{const t=await o.getLayouts();if(t.length>0)try{const s=await o.getLayout(t[0]);return _t(s)}catch(s){re.error("Unable to load layout",t[0],":",s),re.warn("No valid layouts found, falling back to default layout")}}catch(t){re.error("Unable to fetch layout list",t),re.warn("Falling back to default layout")}return e?zo:Jo}function Qo(o){const{filterSets:e,layoutConfig:t,links:s}=o;return{filterSets:e,layoutConfig:t,links:s,version:2}}const le={exportLayout:Qo,getDefaultLayout:Xo,normalizeLayout:_t},w=A.module("AppMainContainer");class J extends m.Component{static handleWindowBeforeUnload(e){e.preventDefault(),e.returnValue=""}static hydrateConsole(e,t){return Be.hydrate({...e,unzip:s=>vt.loadAsync(s).then(a=>Object.values(a.files))},t)}static handleRefresh(){w.info("Refreshing application"),window.location.reload()}constructor(e){super(e),vs(this),this.importElement=X.createRef(),this.state={contextActions:[{action:()=>{this.handleToolSelect(ue.LINKER)},shortcut:Ce.LINKER,isGlobal:!0},{action:()=>{this.sendClearFilter()},shortcut:Ct.TABLE.CLEAR_ALL_FILTERS,isGlobal:!0},{action:()=>{w.debug("Consume unhandled save shortcut")},shortcut:Ce.SAVE,isGlobal:!0}],isAuthFailed:!1,isDisconnected:!1,isPanelsMenuShown:!1,isResetLayoutPromptShown:!1,isSettingsMenuShown:!1,unsavedNotebookCount:0,widgets:[]}}componentDidMount(){this.initWidgets(),this.startListeningForDisconnect(),window.addEventListener("beforeunload",J.handleWindowBeforeUnload)}componentDidUpdate(e){const{dashboardData:t}=this.props;e.dashboardData!==t&&this.handleDataChange(t)}componentWillUnmount(){this.deinitWidgets(),this.stopListeningForDisconnect(),window.removeEventListener("beforeunload",J.handleWindowBeforeUnload)}goldenLayout;importElement;widgetListenerRemover;initWidgets(){const{connection:e}=this.props;if(e.subscribeToFieldUpdates==null){w.warn("subscribeToFieldUpdates not supported, not initializing widgets");return}this.widgetListenerRemover=e.subscribeToFieldUpdates(t=>{w.debug("Got updates",t),this.setState(({widgets:s})=>{const{updated:a,created:r,removed:i}=t,c=[...a,...i],l=s.filter(h=>!c.some(u=>u.name===h.name));return[...a,...r].forEach(h=>{h.name!=null&&h.name!==""&&l.push(h)}),{widgets:l}})})}deinitWidgets(){this.widgetListenerRemover?.()}openNotebookFromURL(){const{match:e}=this.props,{notebookPath:t}=e.params;if(t){const{session:s,sessionConfig:a}=this.props;if(s==null||a==null){w.error("No session available to open notebook URL",t);return}const r={id:`/${t}`,itemName:`/${t}`},i=a.type,c={value:null,language:i};this.emitLayoutEvent(On.SELECT_NOTEBOOK,s,i,c,r,!0)}}sendClearFilter(){this.emitLayoutEvent(oe.CLEAR_ALL_FILTERS)}emitLayoutEvent(e,...t){this.goldenLayout?.eventHub.emit(e,...t)}handleCancelResetLayoutPrompt(){this.setState({isResetLayoutPromptShown:!1})}handleConfirmResetLayoutPrompt(){this.setState({isResetLayoutPromptShown:!1}),this.resetLayout()}handleError(e){K.isCanceled(e)||w.error(e)}handleSettingsMenuHide(){this.setState({isSettingsMenuShown:!1})}handleSettingsMenuShow(){this.setState({isSettingsMenuShown:!0})}handleControlSelect(e,t){switch(w.debug("handleControlSelect",e),e){case G.DROPDOWN_FILTER:this.emitLayoutEvent(oe.OPEN_DROPDOWN,{title:"DropdownFilter",type:e,createNewStack:!0,dragEvent:t});break;case G.INPUT_FILTER:this.emitLayoutEvent(oe.OPEN_INPUT,{title:"InputFilter",type:e,createNewStack:!0,dragEvent:t});break;case G.MARKDOWN:this.emitLayoutEvent(In.OPEN,{title:"Markdown",type:e,dragEvent:t});break;case G.FILTER_SET_MANAGER:this.emitLayoutEvent(oe.OPEN_FILTER_SET_MANAGER,{title:"FilterSets",type:e,dragEvent:t});break;default:throw new Error(`Unrecognized control type ${e}`)}}handleToolSelect(e){w.debug("handleToolSelect",e);const{activeTool:t,setActiveTool:s}=this.props;s(t===e?ue.DEFAULT:e)}handleClearFilter(){this.sendClearFilter()}handleDataChange(e){const{updateWorkspaceData:t}=this.props,{closed:s,filterSets:a,links:r}=e;t({closed:s,filterSets:a,links:r})}handleGoldenLayoutChange(e){this.goldenLayout=e}handleLayoutConfigChange(e){const{updateWorkspaceData:t}=this.props;t({layoutConfig:e})}handleWidgetMenuClick(){this.setState(({isPanelsMenuShown:e})=>({isPanelsMenuShown:!e}))}handleWidgetSelect(e,t){this.setState({isPanelsMenuShown:!1}),w.debug("handleWidgetSelect",e,t),this.openWidget(e,t)}handleWidgetsMenuClose(){this.setState({isPanelsMenuShown:!1})}handleAutoFillClick(){const{widgets:e}=this.state;w.debug("handleAutoFillClick",e);const t=e.sort((s,a)=>s.title!=null&&a.title!=null?s.title.localeCompare(a.title):0);for(let s=0;s<t.length;s+=1)this.openWidget(t[s])}handleExportLayoutClick(){w.info("handleExportLayoutClick"),this.setState({isPanelsMenuShown:!1});try{const{workspace:e}=this.props,{data:t}=e,s=le.exportLayout(t);w.info("handleExportLayoutClick exportedConfig",s);const a=new Blob([JSON.stringify(s)],{type:"application/json"}),r=B.i18n.DateTimeFormat.format("yyyy-MM-dd-HHmmss",new Date),i=document.createElement("a");i.href=URL.createObjectURL(a),i.download=`deephaven-app-layout-${r}.json`,i.click()}catch(e){w.error("Unable to export layout",e)}}handleImportLayoutClick(){w.info("handleImportLayoutClick"),this.setState({isPanelsMenuShown:!1}),this.importElement.current!=null&&(this.importElement.current.value="",this.importElement.current.click())}handleResetLayoutClick(){w.info("handleResetLayoutClick"),this.setState({isPanelsMenuShown:!1,isResetLayoutPromptShown:!0,unsavedNotebookCount:Ln.unsavedNotebookCount()})}handleImportLayoutFiles(e){e.stopPropagation(),e.preventDefault(),e.target.files!=null&&this.importLayoutFile(e.target.files?.[0])}handleDisconnect(){w.info("Disconnected from server"),this.setState({isDisconnected:!0})}handleReconnect(){w.info("Reconnected to server"),this.setState({isDisconnected:!1})}handleReconnectAuthFailed(){w.warn("Reconnect authentication failed"),this.setState({isAuthFailed:!0})}async importLayoutFile(e){try{const{updateDashboardData:t,updateWorkspaceData:s}=this.props,a=await e.text(),r=JSON.parse(a),{filterSets:i,layoutConfig:c,links:l}=le.normalizeLayout(r);s({layoutConfig:c}),t(_,{filterSets:i,links:l})}catch(t){w.error("Unable to import layout",t)}}async resetLayout(){const{layoutStorage:e,session:t}=this.props,{filterSets:s,layoutConfig:a,links:r}=await le.getDefaultLayout(e,t!==void 0),{updateDashboardData:i,updateWorkspaceData:c}=this.props;c({layoutConfig:a}),i(_,{filterSets:s,links:r})}handlePaste(e){if(e.target instanceof HTMLElement&&e.target.closest(".monaco-editor"))return;const{clipboardData:t}=e,s=t.getData("Text"),a=/“|”/g;a.test(s)&&(e.preventDefault(),e.stopPropagation(),document.execCommand("insertText",!1,s.replace(a,'"')))}startListeningForDisconnect(){const{connection:e}=this.props;e.addEventListener(B.IdeConnection.EVENT_DISCONNECT,this.handleDisconnect),e.addEventListener(B.IdeConnection.EVENT_RECONNECT,this.handleReconnect),e.addEventListener(B.CoreClient.EVENT_RECONNECT_AUTH_FAILED,this.handleReconnectAuthFailed)}stopListeningForDisconnect(){const{connection:e}=this.props;e.removeEventListener(B.IdeConnection.EVENT_DISCONNECT,this.handleDisconnect),e.removeEventListener(B.IdeConnection.EVENT_RECONNECT,this.handleReconnect),e.removeEventListener(B.CoreClient.EVENT_RECONNECT_AUTH_FAILED,this.handleReconnectAuthFailed)}hydrateDefault(e,t){const{connection:s}=this.props,{metadata:a}=e;if(a?.type!=null&&(a?.id!=null||a?.name!=null)){const r=a.id!=null?{type:a.type,id:a.id}:{type:a.type,name:a.name,title:a.name};return{fetch:()=>s.getObject(r),...e,localDashboardId:t}}return Be.hydrate(e,t)}openWidget(e,t){const{connection:s}=this.props;this.emitLayoutEvent(Ss.OPEN,{dragEvent:t,fetch:()=>s.getObject(e),widget:e})}getDashboardPlugins=Qt(e=>[...e.entries()].filter(([,s])=>Cs(s)||Ve(s)).map(([s,a])=>{if(Ve(a)){const{DashboardPlugin:i}=a;return n.jsx(i,{},s)}const{component:r}=a;return n.jsx(r,{},s)}));render(){const{activeTool:e,plugins:t,user:s,workspace:a,serverConfigValues:r}=this.props,{data:i}=a,{layoutConfig:c}=i,{permissions:l}=s,{canUsePanels:d}=l,{contextActions:h,isAuthFailed:u,isDisconnected:g,isPanelsMenuShown:y,isResetLayoutPromptShown:v,isSettingsMenuShown:E,unsavedNotebookCount:R,widgets:T}=this.state,j=this.getDashboardPlugins(t);return n.jsxs("div",{className:F("app-main-tabs","w-100","h-100","d-flex","flex-column",e?`active-tool-${e.toLowerCase()}`:""),onPaste:this.handlePaste,tabIndex:-1,children:[n.jsx("nav",{className:"nav-container",children:n.jsxs("div",{className:"app-main-top-nav-menus",children:[n.jsx(wt,{className:"ml-1",style:{maxHeight:"20px"}}),n.jsxs("div",{children:[n.jsxs(S,{kind:"ghost",className:"btn-panels-menu",icon:Qs,onClick:()=>{},children:["Controls",n.jsx(Oe,{handleControlSelect:this.handleControlSelect,handleToolSelect:this.handleToolSelect,onClearFilter:this.handleClearFilter})]}),d&&n.jsxs(S,{kind:"ghost",className:"btn-panels-menu btn-show-panels","data-testid":"app-main-panels-button",onClick:this.handleWidgetMenuClick,icon:en,children:["Panels",n.jsx(ys,{isShown:y,className:"panels-menu-popper",onExited:this.handleWidgetsMenuClose,options:{placement:"bottom"},closeOnBlur:!0,interactive:!0,children:n.jsx(Ho,{widgets:T,onExportLayout:this.handleExportLayoutClick,onImportLayout:this.handleImportLayoutClick,onResetLayout:this.handleResetLayoutClick,onSelect:this.handleWidgetSelect})})]}),n.jsx(S,{kind:"ghost",className:F("btn-settings-menu",{"text-warning":s.operateAs!=null&&s.operateAs!==s.name}),onClick:this.handleSettingsMenuShow,icon:n.jsxs("span",{className:"fa-layers",children:[n.jsx(x,{icon:tn,transform:"grow-3"}),g&&!u&&n.jsxs(n.Fragment,{children:[n.jsx(x,{icon:sn,color:ie.background,transform:"grow-2 right-8 down-8.5 rotate-45"}),n.jsx(x,{icon:Ye,color:ie.danger,transform:"shrink-5 right-6 down-6"})]})]}),tooltip:g&&!u?"Server disconnected":"User Settings"})]})]})}),n.jsxs(un,{emptyDashboard:n.jsx(Zo,{onAutoFillClick:this.handleAutoFillClick}),id:_,layoutConfig:c,onGoldenLayoutChange:this.handleGoldenLayoutChange,onLayoutConfigChange:this.handleLayoutConfigChange,onLayoutInitialized:this.openNotebookFromURL,hydrate:this.hydrateDefault,children:[n.jsx(Pn,{hydrateConsole:J.hydrateConsole,notebooksUrl:new URL("notebooks/",document.baseURI).href}),j]}),n.jsx(St,{in:E,timeout:ie.transitionMidMs,classNames:"slide-left",mountOnEnter:!0,unmountOnExit:!0,children:n.jsx(I,{serverConfigValues:r,onDone:this.handleSettingsMenuHide,user:s})}),n.jsx(Ts,{actions:h}),n.jsx("input",{ref:this.importElement,type:"file",accept:".json",style:{display:"none"},onChange:this.handleImportLayoutFiles}),n.jsx(hn,{isOpen:g&&!u,debounceMs:1e3,children:n.jsx(mn,{icon:Ye,title:n.jsxs(n.Fragment,{children:[n.jsx(nn,{})," Attempting to reconnect..."]}),subtitle:"Please check your network connection."})}),n.jsx(Ge,{confirmButtonText:"Reset",onConfirm:this.handleConfirmResetLayoutPrompt,onCancel:this.handleCancelResetLayoutPrompt,isConfirmDanger:!0,isOpen:v,headerText:R===0?"Reset Layout":"Reset layout and discard unsaved changes",bodyText:R===0?"Do you want to reset your layout? Your existing layout will be lost.":"Do you want to reset your layout? Any unsaved notebooks will be lost."}),n.jsx(Ge,{confirmButtonText:"Refresh",onConfirm:J.handleRefresh,isOpen:u,headerText:"Authentication failed",bodyText:"Credentials are invalid. Please refresh your browser to try and reconnect."})]})}}const ea=o=>({activeTool:En(o),dashboardData:bs(o,_),layoutStorage:Go(o),plugins:Rn(o),connection:Nn(o,_),session:et(o,_)?.session,sessionConfig:et(o,_)?.config,user:jn(o),workspace:It(o),serverConfigValues:Vo(o)}),ta=te(ea,{setActiveTool:Ot,updateDashboardData:gs,updateWorkspaceData:Fn})(Xt(J));function sa(){return n.jsxs("div",{className:"app",children:[n.jsx(ta,{}),n.jsx(ws,{})]})}const na=A.module("LocalWorkspaceStorage");class L{static STORAGE_KEY="deephaven.WorkspaceStorage";static getBooleanServerConfig(e,t){if(e?.get(t)?.toLowerCase()==="true")return!0;if(e?.get(t)?.toLowerCase()==="false")return!1}static makeDefaultWorkspaceSettings(e){const t={defaultDateTimeFormat:W.DEFAULT_DATETIME_FORMAT_STRING,formatter:[],timeZone:W.DEFAULT_TIME_ZONE_ID,showTimeZone:!1,showTSeparator:!0,disableMoveConfirmation:!1,defaultDecimalFormatOptions:{defaultFormatString:k.DEFAULT_FORMAT_STRING},defaultIntegerFormatOptions:{defaultFormatString:P.DEFAULT_FORMAT_STRING},truncateNumbersWithPound:!1,defaultNotebookSettings:{isMinimapEnabled:!1}},s={defaultDateTimeFormat:e?.get("dateTimeFormat"),formatter:[],timeZone:e?.get("timeZone"),showTimeZone:L.getBooleanServerConfig(e,"showTimeZone"),showTSeparator:L.getBooleanServerConfig(e,"showTSeparator"),disableMoveConfirmation:L.getBooleanServerConfig(e,"disableMoveConfirmation"),defaultDecimalFormatOptions:e?.get("decimalFormat")!==void 0?{defaultFormatString:e?.get("decimalFormat")}:void 0,defaultIntegerFormatOptions:e?.get("integerFormat")!==void 0?{defaultFormatString:e?.get("integerFormat")}:void 0,truncateNumbersWithPound:L.getBooleanServerConfig(e,"truncateNumbersWithPound"),defaultNotebookSettings:e?.get("isMinimapEnabled")!==void 0?{isMinimapEnabled:L.getBooleanServerConfig(e,"isMinimapEnabled")}:void 0},a=Object.keys(s);for(let r=0;r<a.length;r+=1){const i=a[r];s[i]!==void 0&&(t[i]=s[i])}return t}static async makeWorkspaceData(e,t){const{filterSets:s,links:a,layoutConfig:r}=await le.getDefaultLayout(e,t?.isConsoleAvailable);return{settings:{},layoutConfig:r,closed:[{}],links:a,filterSets:s}}static async makeDefaultWorkspace(e,t){return{data:await L.makeWorkspaceData(e,t)}}layoutStorage;constructor(e){this.layoutStorage=e}async load(e){try{return JSON.parse(localStorage.getItem(L.STORAGE_KEY)??"")}catch{return na.info("Unable to load workspace data, initializing to default data"),L.makeDefaultWorkspace(this.layoutStorage,e)}}async save(e){return localStorage.setItem(L.STORAGE_KEY,JSON.stringify(e)),e}}class oa{storageService;root;constructor(e,t=""){this.storageService=e,this.root=t}async getLayouts(){return(await this.storageService.listItems(this.root,"*.json")).map(t=>t.basename)}async getLayout(e){const s=await(await this.storageService.loadFile(`${this.root}/${e}`)).text();return JSON.parse(s)}}const ee=A.module("GrpcFileStorageTable");class he{static REFRESH_DEBOUNCE=50;storageService;baseRoot;root;currentSize=0;currentViewport;listeners=[];viewportUpdatePromise;currentViewportData;childTables=new Map;constructor(e,t="",s=t){this.storageService=e,this.baseRoot=t,this.root=s,s===t&&(this.doRefresh=Fe(this.doRefresh.bind(this),he.REFRESH_DEBOUNCE))}removeBaseRoot(e){return H.removeRoot(this.baseRoot,e)}getViewportData(){return this.viewportUpdatePromise||this.refreshInternal(),this.viewportUpdatePromise??Promise.resolve({items:[],offset:0})}getSnapshot(e){throw new Error("Method not implemented.")}get size(){return this.currentSize}setExpanded(e,t){const s=e.split("/");let a=s.shift();if((a===void 0||a==="")&&(a=s.shift()),a===void 0||a==="")throw new Error(`Invalid path: ${e}`);const r=s.join("/");if(t){if(!this.childTables.has(a)){const i=new he(this.storageService,this.baseRoot,`${this.root}/${a}`);this.childTables.set(a,i)}r&&this.childTables.get(a)?.setExpanded(r,t)}else this.childTables.has(a)&&(r?this.childTables.get(a)?.setExpanded(r,t):this.childTables.delete(a));this.currentViewport&&this.refreshInternal()}collapseAll(){this.childTables.clear(),this.currentViewport&&this.refreshInternal()}setSearch(e){throw new Error("Method not implemented.")}setViewport(e){this.currentViewport=e,this.refreshInternal()}setFilters(){throw new Error("Method not implemented.")}setSorts(){throw new Error("Method not implemented.")}setReversed(){throw new Error("Method not implemented.")}close(){this.listeners=[]}onUpdate(e){return this.listeners=[...this.listeners,e],()=>{this.listeners=this.listeners.filter(t=>t!==e)}}doRefresh(e){ee.debug2("doRefresh",this.root),e(this.fetchData())}refresh(){ee.debug2("refresh",this.root),this.viewportUpdatePromise?.cancel();const e=new Promise(s=>{this.doRefresh(s)}),t=K.makeCancelable(e.then(s=>{if(this.viewportUpdatePromise!==t)throw new xs;return this.currentViewportData=s,this.sendUpdate(),s}));t.catch(s=>{K.isCanceled(s)||ee.error("Error updating viewport",s)}),this.viewportUpdatePromise=t}refreshInternal(){try{this.refresh()}catch(e){K.isCanceled(e)||ee.error("Unable to refresh data",e)}}async fetchData(){const{currentViewport:e}=this;if(!e)throw new Error("No viewport set");let s=(await this.storageService.listItems(this.root)).map(a=>({type:a.type,filename:this.removeBaseRoot(a.filename),basename:a.basename,id:this.removeBaseRoot(a.filename),isExpanded:a.type==="directory"?this.childTables.has(a.basename):void 0})).sort((a,r)=>a.type!==r.type?a.type==="directory"?-1:1:a.basename.localeCompare(r.basename));for(let a=0;a<s.length;a+=1){const r=s[a],{basename:i,filename:c}=r;if(c===this.removeBaseRoot(`${this.root}/${i}`)&&r.type==="directory"){const l=this.childTables.get(i);if(l!=null){l.setViewport({top:0,bottom:e.bottom-a});const d=await l.getViewportData();s.splice(a+1,0,...d.items)}}}return this.currentSize=s.length,ee.debug2(this.root,"items",s,e),s=s.slice(e.top,e.bottom),{items:s,offset:e.top}}sendUpdate(){const{listeners:e}=this,t=this.currentViewportData??{items:[],offset:0};for(let s=0;s<e.length;s+=1)e[s](t)}}const aa=A.module("GrpcFileStorage");class Ie{static REFRESH_THROTTLE=150;storageService;tables=[];root;constructor(e,t=""){this.storageService=e,this.root=t}removeRoot(e){return H.removeRoot(this.root,e)}addRoot(e){return H.addRoot(this.root,e)}async createDirectory(e){return await this.storageService.createDirectory(this.addRoot(e)),this.refreshTables(),{type:"directory",id:e,filename:e,basename:H.getBaseName(e)}}async getTable(){const e=new he(this.storageService,this.root);return this.tables.push(e),e}async saveFile(e){const t=dh.storage.FileContents.text(e.content);return await this.storageService.saveFile(this.addRoot(e.filename),t,!0),this.refreshTables(),e}async loadFile(e){const s=await(await this.storageService.loadFile(this.addRoot(e))).text();return{filename:e,basename:H.getBaseName(e),content:s}}async copyFile(e,t){const s=await this.storageService.loadFile(this.addRoot(e));await this.storageService.saveFile(this.addRoot(t),s,!1),this.refreshTables()}async deleteFile(e){await this.storageService.deleteItem(this.addRoot(e)),this.refreshTables()}async moveFile(e,t){await this.storageService.moveItem(this.addRoot(e),this.addRoot(t)),this.refreshTables()}async info(e){const t=await this.storageService.listItems(this.addRoot(H.getPath(e)),H.getBaseName(e));if(t.length===0)throw new kn;if(t.length>1)throw aa.error("More than one matching file found, should never happen.",t),new Error("More than one matching file found");const s=t[0];return{filename:this.removeRoot(s.filename),basename:s.basename,id:this.removeRoot(s.filename),type:s.type}}refreshTables=es(()=>{this.tables.forEach(e=>e.refresh())},Ie.REFRESH_THROTTLE)}const ra=A.module("AppInit");function Le(o){const{workspace:e,setActiveTool:t,setApi:s,setCommandHistoryStorage:a,setDashboardData:r,setFileStorage:i,setLayoutStorage:c,setDashboardConnection:l,setDashboardSessionWrapper:d,setPlugins:h,setUser:u,setWorkspace:g,setWorkspaceStorage:y,setDefaultWorkspaceSettings:v,setServerConfigValues:E}=o,R=yt(),T=pn(),j=Fs(),C=Es(),p=fn(),b=gn(),[se,$t]=m.useState();m.useEffect(function(){h(C)},[C,h]),m.useEffect(function(){async function Wt(){try{const ne=await bn(),me=await vn(R,j,ne),Me=T.getStorageService(),Ue=new oa(Me,"/layouts"),Bt=new Ie(Me,"/notebooks"),_e=new L(Ue),Gt=new fo,$e=await _e.load({isConsoleAvailable:me!==void 0}),{data:pe}=$e,{settings:Vt}=pe,{shortcutOverrides:Ke={}}=Vt,Ht=U.isMacPlatform?Ke.mac??{}:Ke.windows??{};Object.entries(Ht).forEach(([qt,Yt])=>{Ee.get(qt)?.setKeyState(Yt)});const Zt={filterSets:pe.filterSets,links:pe.links};s(R),t(ue.DEFAULT),E(p),a(Gt),r(_,Zt),i(Bt),c(Ue),l(_,j),me!==void 0&&d(_,me),u(b),y(_e),g($e),v(L.makeDefaultWorkspaceSettings(p))}catch(ne){ra.error(ne),$t(ne)}}Wt()},[R,T,j,p,t,s,a,r,i,c,l,d,u,g,v,y,E,b]);const Pe=e==null&&se==null,ke=!Pe&&se==null,Ae=se!=null?`${se}`:null;return n.jsxs(n.Fragment,{children:[ke&&n.jsx(sa,{}),n.jsx(on,{isLoading:Pe&&Ae==null,isLoaded:ke,errorMessage:Ae})]})}Le.propTypes={workspace:f.shape({}),workspaceStorage:f.shape({close:f.func}),setActiveTool:f.func.isRequired,setApi:f.func.isRequired,setCommandHistoryStorage:f.func.isRequired,setDashboardData:f.func.isRequired,setFileStorage:f.func.isRequired,setLayoutStorage:f.func.isRequired,setDashboardConnection:f.func.isRequired,setDashboardSessionWrapper:f.func.isRequired,setPlugins:f.func.isRequired,setUser:f.func.isRequired,setWorkspace:f.func.isRequired,setWorkspaceStorage:f.func.isRequired};Le.defaultProps={workspace:null,workspaceStorage:null};const ia=o=>({workspace:It(o),workspaceStorage:Zn(o)}),ft=te(ia,{setActiveTool:Ot,setApi:An,setCommandHistoryStorage:Mn,setDashboardData:Ds,setFileStorage:Un,setLayoutStorage:go,setDashboardConnection:_n,setDashboardSessionWrapper:$n,setPlugins:Kn,setUser:Wn,setWorkspace:Bn,setDefaultWorkspaceSettings:Gn,setWorkspaceStorage:Vn,setServerConfigValues:Hn})(Le),la=X.lazy(()=>as(()=>import("./StyleGuideRoot-42cc11d1.js"),["./StyleGuideRoot-42cc11d1.js","./vendor-a758141f.js","./helpers-042e6b4d.js","./vendor-fac43f8b.css","./index-c8c58d11.js","./monaco-1410cbed.js","./monaco-f18fde03.css","./index-eed2d9c0.css","./IrisGrid-49222932.js","./usePlugins-660df156.js","./plotly-0a78b507.js","./usePlugins-a532c861.css","./IrisGrid-e0b16101.css","./FontBootstrap-5b595a14.js","./FontBootstrap-91f346e2.css","./useUser-84d4eed4.js","./useUser-c5624723.css","./ControlType-b475cfe6.js","./ControlType-87c32a85.css","./StyleGuideRoot-a863a6e3.css"],import.meta.url)),ca=new URL(document.baseURI).pathname.replace(/\/$/,"");function da(){return n.jsx(ts,{basename:ca,children:n.jsxs(ss,{children:[n.jsx(fe,{exact:!0,path:"/",component:ft}),n.jsx(fe,{path:"/notebooks/:notebookPath+",component:ft}),n.jsx(fe,{path:"/styleguide",component:la}),n.jsx(ns,{from:"*",to:"/"})]})})}function gt(){return Rs.register(new URL("./download/serviceWorker.js",window.location.href)),Ns.init({getWorker:()=>new rs}),window["__react-beautiful-dnd-disable-dev-warnings"]=!0,n.jsx(os,{store:jt,children:n.jsx(da,{})})}const va=Object.freeze(Object.defineProperty({__proto__:null,AppRoot:gt,default:gt},Symbol.toStringTag,{value:"Module"}));export{va as A,L};
6
+ //# sourceMappingURL=AppRoot-bc9433b4.js.map