@deephaven/code-studio 0.94.0 → 0.95.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/build/assets/{AppRoot-2QqbS1nC.js → AppRoot-BAdlVp-2.js} +4 -4
  2. package/build/assets/AppRoot-BAdlVp-2.js.map +1 -0
  3. package/build/assets/{Chart-Cm7qWO9E.js → Chart-CAbfBNKX.js} +2 -2
  4. package/build/assets/{Chart-Cm7qWO9E.js.map → Chart-CAbfBNKX.js.map} +1 -1
  5. package/build/assets/{ControlType-CckisQF4.js → ControlType-NUmGfTww.js} +4 -4
  6. package/build/assets/{ControlType-CckisQF4.js.map → ControlType-NUmGfTww.js.map} +1 -1
  7. package/build/assets/{FontBootstrap-CvnhQGa5.js → FontBootstrap-Bl6vq41v.js} +2 -2
  8. package/build/assets/{FontBootstrap-CvnhQGa5.js.map → FontBootstrap-Bl6vq41v.js.map} +1 -1
  9. package/build/assets/{FormatterUtils-BAfeV5hG.js → FormatterUtils-iauIVwuu.js} +2 -2
  10. package/build/assets/{FormatterUtils-BAfeV5hG.js.map → FormatterUtils-iauIVwuu.js.map} +1 -1
  11. package/build/assets/{Grid-PyvX8Ljr.js → Grid-CjnujVEX.js} +2 -2
  12. package/build/assets/{Grid-PyvX8Ljr.js.map → Grid-CjnujVEX.js.map} +1 -1
  13. package/build/assets/{IrisGrid-C7qtaa22.js → IrisGrid-BGnzpzYu.js} +2 -2
  14. package/build/assets/{IrisGrid-C7qtaa22.js.map → IrisGrid-BGnzpzYu.js.map} +1 -1
  15. package/build/assets/{IrisGridModel-CCMYIR29.js → IrisGridModel-CAsjFilJ.js} +3 -3
  16. package/build/assets/{IrisGridModel-CCMYIR29.js.map → IrisGridModel-CAsjFilJ.js.map} +1 -1
  17. package/build/assets/{IrisGridShortcuts-B3PQt1Dg.js → IrisGridShortcuts-BwHkgvtW.js} +2 -2
  18. package/build/assets/{IrisGridShortcuts-B3PQt1Dg.js.map → IrisGridShortcuts-BwHkgvtW.js.map} +1 -1
  19. package/build/assets/{IrisGridThemeProvider-Cf0M-Qvb.js → IrisGridThemeProvider-Atqacw7P.js} +2 -2
  20. package/build/assets/{IrisGridThemeProvider-Cf0M-Qvb.js.map → IrisGridThemeProvider-Atqacw7P.js.map} +1 -1
  21. package/build/assets/{LocalWorkspaceStorage-CFBIVjrj.js → LocalWorkspaceStorage-h3-A9jVy.js} +2 -2
  22. package/build/assets/{LocalWorkspaceStorage-CFBIVjrj.js.map → LocalWorkspaceStorage-h3-A9jVy.js.map} +1 -1
  23. package/build/assets/{MarkdownEditor-fe6mc7KC.js → MarkdownEditor-C8u19ocy.js} +2 -2
  24. package/build/assets/{MarkdownEditor-fe6mc7KC.js.map → MarkdownEditor-C8u19ocy.js.map} +1 -1
  25. package/build/assets/{MarkdownNotebook-2wkzDKT_.js → MarkdownNotebook-CEg2045K.js} +2 -2
  26. package/build/assets/{MarkdownNotebook-2wkzDKT_.js.map → MarkdownNotebook-CEg2045K.js.map} +1 -1
  27. package/build/assets/{MissingPartitionError-Dj2Y-FKf.js → MissingPartitionError-yhygxxeZ.js} +2 -2
  28. package/build/assets/{MissingPartitionError-Dj2Y-FKf.js.map → MissingPartitionError-yhygxxeZ.js.map} +1 -1
  29. package/build/assets/{StyleGuideRoot-DWcUvpZo.js → StyleGuideRoot-C-Kz5fEa.js} +2 -2
  30. package/build/assets/StyleGuideRoot-C-Kz5fEa.js.map +1 -0
  31. package/build/assets/{TokenBoxCellRenderer-DfZgvoE0.js → TokenBoxCellRenderer-DH2eZRQH.js} +2 -2
  32. package/build/assets/{TokenBoxCellRenderer-DfZgvoE0.js.map → TokenBoxCellRenderer-DH2eZRQH.js.map} +1 -1
  33. package/build/assets/{index-B0jej1Vv.js → index-B8xrSWbn.js} +5 -5
  34. package/build/assets/index-B8xrSWbn.js.map +1 -0
  35. package/build/assets/index-Bkz3vMXy.css +1 -0
  36. package/build/assets/{index-A37_P9XP.js → index-By1dHjp4.js} +3 -3
  37. package/build/assets/{index-A37_P9XP.js.map → index-By1dHjp4.js.map} +1 -1
  38. package/build/assets/{index-DVqL-niD.js → index-C159LUCr.js} +2 -2
  39. package/build/assets/{index-DVqL-niD.js.map → index-C159LUCr.js.map} +1 -1
  40. package/build/index.html +2 -2
  41. package/package.json +31 -31
  42. package/build/assets/AppRoot-2QqbS1nC.js.map +0 -1
  43. package/build/assets/StyleGuideRoot-DWcUvpZo.js.map +0 -1
  44. package/build/assets/index-B0jej1Vv.js.map +0 -1
  45. package/build/assets/index-DrdNUMrr.css +0 -1
@@ -1,6 +1,6 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./StyleGuideRoot-DWcUvpZo.js","./vendor-CohWXWuY.js","./helpers-BosuxZz1.js","./vendor-Ck7TznCw.css","./index-A37_P9XP.js","./monaco-CNNCitmD.js","./monaco-BX50Gyx4.css","./index-6ub2NC3N.css","./IrisGridModel-CCMYIR29.js","./ControlType-CckisQF4.js","./ControlType-0B-XeYnS.css","./IrisGridModel-DDgEpNBk.css","./FontBootstrap-CvnhQGa5.js","./TokenBoxCellRenderer-DfZgvoE0.js","./IrisGridShortcuts-B3PQt1Dg.js","./IrisGridShortcuts-B4ulgs9Z.css","./useMergeRef-CdbLELuv.js","./TokenBoxCellRenderer-CnOjKPv1.css","./LocalWorkspaceStorage-CFBIVjrj.js","./LocalWorkspaceStorage-B0s_p084.css","./FontBootstrap-HppzMMw0.css","./Grid-PyvX8Ljr.js","./Grid-DzvebgTk.css","./StyleGuideRoot-Q5SNMm10.css"])))=>i.map(i=>d[i]);
2
- var Ot=Object.defineProperty;var Lt=(a,s,e)=>s in a?Ot(a,s,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[s]=e;var b=(a,s,e)=>Lt(a,typeof s!="symbol"?s+"":s,e);import{X as st,Y as Pt,Z as kt,r as m,J as n,_ as de,a0 as nt,V as X,a1 as ye,M as I,a2 as j,N as F,a3 as at,a4 as At,a5 as Ne,a6 as Mt,a7 as _t,a8 as Ut,a9 as he,aa as Kt,I as $t,ab as Wt,ac as Gt,ad as Bt,ae as Vt,af as me,ag as Ht}from"./vendor-CohWXWuY.js";import{_ as Zt,W as Yt}from"./monaco-CNNCitmD.js";import{O as re,P as Z,T as k,D as qt,I as M,a as _,b as V,u as ot,F as zt,c as R,d as Jt,e as ne,S as ie,B as C,C as H,g as Xt,f as rt,h as it,i as lt,j as ct,k as dt,l as Qt,m as es,n as ts,o as ss,p as ut,q as ns,r as A,s as Ee,t as ht,K as as,v as Le,w as os,x as rs,y as is,z as xe,A as ls,E as cs,G as ds,H as us,J as Y,L as hs,M as $,N as le,Q as ms,R as ps,U as gs,V as mt,W as pt,X as fs,Y as bs,Z as vs,_ as Ss,$ as ys,a0 as xs,a1 as Cs,a2 as Ts,a3 as Pe,a4 as ws,a5 as gt,a6 as Ds,a7 as js,a8 as Ns,a9 as D,aa as Es,ab as ae,ac as Fs,ad as Rs,ae as Is,af as Os,ag as Ls,ah as Ps,ai as ks,aj as As,ak as Ms,al as _s,am as Us,an as Ks,ao as $s,ap as Ws,aq as Gs,ar as Bs,as as Vs,at as Hs,au as Zs,av as Ys,aw as qs,ax as zs,ay as Js}from"./ControlType-CckisQF4.js";import{L as W,v as q,a as Xs,M as Qs,b as en,c as tn,d as sn,l as nn,s as an,e as ce,f as on,g as rn,h as ln,i as cn,j as dn,k as un,m as hn,n as mn,o as pn,p as gn,q as fn,r as bn,t as vn,u as Sn,w as yn,x as xn,y as Cn,z as Tn,A as wn,B as ke,C as Ae,D as Me,E as Dn,F as jn,G as Nn,H as En,I as Fn,J as ft}from"./index-A37_P9XP.js";import{C as Rn,H as In,T as On,P as Ln,B as Pn,m as kn,a as An,L as bt,s as _e,l as Mn,U as pe,N as _n,A as Un,g as Kn,b as $n,u as Wn,c as Gn,d as Bn,e as Vn,f as Hn,h as Zn,G as Yn,i as qn,j as Ue}from"./LocalWorkspaceStorage-CFBIVjrj.js";import{T as ge,I as vt,S as zn,D as Jn}from"./IrisGridShortcuts-B3PQt1Dg.js";import"./helpers-BosuxZz1.js";import"./useMergeRef-CdbLELuv.js";class Ke{static makeSortConfig(s,e){return{column:s,direction:e}}static makeFilterConfig(s){var e=[],t=[];return s.forEach((o,r)=>{e.push(o),r>0&&t.push(re.and)}),{filterItems:e,filterOperators:t}}static combineFilterConfigs(s,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:re.and;return{filterItems:[...s.filterItems,...e.filterItems],filterOperators:[...s.filterOperators,t,...e.filterOperators]}}static makeFilterItem(s,e,t){return{columnName:s,type:e,value:t}}}function Xn(a,s,e){if(a.length>s){var t=a.length-e;return{toKeep:a.slice(t),toPrune:a.slice(0,t)}}return{toKeep:a,toPrune:[]}}function $e(a,s){var e=Object.keys(a);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(a);s&&(t=t.filter(function(o){return Object.getOwnPropertyDescriptor(a,o).enumerable})),e.push.apply(e,t)}return e}function We(a){for(var s=1;s<arguments.length;s++){var e=arguments[s]!=null?arguments[s]:{};s%2?$e(Object(e),!0).forEach(function(t){O(a,t,e[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(e)):$e(Object(e)).forEach(function(t){Object.defineProperty(a,t,Object.getOwnPropertyDescriptor(e,t))})}return a}function Ge(a,s,e,t,o,r,i){try{var l=a[r](i),c=l.value}catch(d){e(d);return}l.done?s(c):Promise.resolve(c).then(t,o)}function U(a){return function(){var s=this,e=arguments;return new Promise(function(t,o){var r=a.apply(s,e);function i(c){Ge(r,t,o,i,l,"next",c)}function l(c){Ge(r,t,o,i,l,"throw",c)}i(void 0)})}}function O(a,s,e){return s=Qn(s),s in a?Object.defineProperty(a,s,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[s]=e,a}function Qn(a){var s=ea(a,"string");return typeof s=="symbol"?s:String(s)}function ea(a,s){if(typeof a!="object"||a===null)return a;var e=a[Symbol.toPrimitive];if(e!==void 0){var t=e.call(a,s||"default");if(typeof t!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(s==="string"?String:Number)(a)}var fe=W.module("PouchStorageTable"),ta="Deephaven.";st.plugin(Pt);function sa(a,s){switch(a){case k.in:case k.contains:return{$regex:new RegExp("".concat(s)).toString()};case k.inIgnoreCase:return{$regex:new RegExp("".concat(s),"i").toString()};case k.eq:return{$eq:s};case k.notEq:return{$ne:s};case k.greaterThan:return{$gt:s};case k.greaterThanOrEqualTo:return{$gte:s};case k.lessThan:return{$lt:s};case k.lessThanOrEqualTo:return{$lte:s};case k.startsWith:return{$regex:new RegExp("^".concat(s,".*")).toString()};default:throw new Error("Unsupported type: ".concat(a))}}function na(a){for(var{filterItems:s,filterOperators:e}=a,t=null,o=0;o<s.length;o+=1){var r=s[o],{columnName:i,type:l,value:c}=r,d={[i]:sa(l,c)};if(o===0)t=d;else if(t!==null&&o-1<e.length){var h=e[o-1];if(h===re.and)t={$and:[t,d]};else if(h===re.or)t={$or:[t,d]};else throw new Error("Unexpected filter operator ".concat(h,", ").concat(d))}}if(t==null)throw new Error("Invalid filter config ".concat(a));return t}function be(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return{$and:[...a.map(s=>na(s)),{name:{$gt:null}},{id:{$gt:null}}]}}function aa(a){var s,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return[{id:e?"desc":"asc"},...(s=a==null?void 0:a.map(t=>({[t.column]:t.direction})))!==null&&s!==void 0?s:[]]}class oa{constructor(s,e){O(this,"db",void 0),O(this,"changes",void 0),O(this,"listeners",[]),O(this,"itemListeners",new Map),O(this,"currentSize",0),O(this,"currentViewport",void 0),O(this,"currentReverse",!1),O(this,"currentFilter",null),O(this,"currentSort",null),O(this,"infoUpdatePromise",void 0),O(this,"viewportUpdatePromise",void 0),O(this,"currentViewportData",void 0),this.db=new st("".concat(ta).concat(s),e),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(s){return this.listeners=[...this.listeners,s],()=>{this.listeners=this.listeners.filter(e=>e!==s)}}onItemUpdate(s,e){return this.itemListeners.has(s)||this.itemListeners.set(s,[]),this.itemListeners.set(s,[...this.itemListeners.get(s),e]),this.refreshItem(s),()=>{this.itemListeners.set(s,this.itemListeners.get(s).filter(t=>t!==e))}}close(){this.listeners=[]}get size(){return this.currentSize}get viewport(){return this.currentViewport}setReversed(s){this.currentReverse=s,this.currentViewportData=void 0,this.refreshData()}setViewport(s){this.currentViewport=s,this.refreshInfo(),this.refreshData()}setSorts(s){this.currentSort=s,this.currentViewportData=void 0,this.refreshData()}setFilters(s){this.currentFilter=s,this.currentViewportData=void 0,this.refreshInfo(),this.refreshData()}get data(){return this.currentViewportData}getViewportData(){var s=this;return U(function*(){var e;return s.viewportUpdatePromise||s.refreshData(),(e=s.viewportUpdatePromise)!==null&&e!==void 0?e:Promise.resolve({items:[],offset:0})})()}put(s){var e=this;return U(function*(){var t=We(We({},s),{},{_id:s.id});return yield e.db.put(t),t})()}sendUpdate(){for(var s,{listeners:e}=this,t=(s=this.currentViewportData)!==null&&s!==void 0?s:{items:[],offset:0},o=0;o<e.length;o+=1)e[o](t)}sendItemUpdate(s){var e=this.itemListeners.get(s.id);if(e!==void 0)for(var t=0;t<e.length;t+=1)e[t](s)}dbUpdate(s){fe.debug("Update received",s),this.refreshInfo(),s.doc!==void 0&&this.sendItemUpdate(s.doc),this.refreshData()}fetchInfo(s){var e=this;return U(function*(){return e.db.find({selector:s,fields:[]})})()}refreshInfo(){var s=this;return U(function*(){try{var e,t;(e=s.infoUpdatePromise)===null||e===void 0||e.cancel(),s.infoUpdatePromise=Z.makeCancelable(s.fetchInfo(be((t=s.currentFilter)!==null&&t!==void 0?t:[])));var o=yield s.infoUpdatePromise;s.currentSize=o.docs.length,s.sendUpdate()}catch(r){if(!Z.isCanceled(r))throw fe.error("Unable to refreshInfo",r),r}})()}fetchViewportData(s,e,t){var o=this;return U(function*(){return o.db.find({selector:e,skip:s.top,limit:s.bottom-s.top+1,sort:t,fields:["id","name"]}).then(r=>({items:r.docs,offset:s.top}))})()}refreshData(){var s=this;return U(function*(){if(s.currentViewport)try{var e,t,o=be((e=s.currentFilter)!==null&&e!==void 0?e:[]),r=aa(s.currentSort,s.currentReverse);(t=s.viewportUpdatePromise)===null||t===void 0||t.cancel(),s.viewportUpdatePromise=Z.makeCancelable(s.fetchViewportData(s.currentViewport,o,r));var i=yield s.viewportUpdatePromise;return s.currentViewportData=i,s.sendUpdate(),i}catch(l){if(!Z.isCanceled(l))throw fe.error("Unable to refreshData",l),l}})()}refreshItem(s){var e=this;return U(function*(){var t=yield e.db.find({selector:{id:s},limit:1}),o=t.docs[0];return o!==void 0&&e.sendItemUpdate(o),o})()}getSnapshot(s){var e=this;return U(function*(){var t=new Map,o=[{id:e.currentReverse?"desc":"asc"}];return yield Promise.all(s.map(function(){var r=U(function*(i){var l,[c,d]=i,h=d-c+1;return e.db.find({selector:be((l=e.currentFilter)!==null&&l!==void 0?l:[]),skip:c,limit:h,sort:o,fields:["id","name"]}).then(u=>{for(var p=0;p<h;p+=1){var N=c+p;t.set(N,u.docs[p])}})});return function(i){return r.apply(this,arguments)}}())),t})()}}function Be(a,s){var e=Object.keys(a);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(a);s&&(t=t.filter(function(o){return Object.getOwnPropertyDescriptor(a,o).enumerable})),e.push.apply(e,t)}return e}function oe(a){for(var s=1;s<arguments.length;s++){var e=arguments[s]!=null?arguments[s]:{};s%2?Be(Object(e),!0).forEach(function(t){St(a,t,e[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(e)):Be(Object(e)).forEach(function(t){Object.defineProperty(a,t,Object.getOwnPropertyDescriptor(e,t))})}return a}function Ve(a,s,e,t,o,r,i){try{var l=a[r](i),c=l.value}catch(d){e(d);return}l.done?s(c):Promise.resolve(c).then(t,o)}function Q(a){return function(){var s=this,e=arguments;return new Promise(function(t,o){var r=a.apply(s,e);function i(c){Ve(r,t,o,i,l,"next",c)}function l(c){Ve(r,t,o,i,l,"throw",c)}i(void 0)})}}function St(a,s,e){return s=ra(s),s in a?Object.defineProperty(a,s,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[s]=e,a}function ra(a){var s=ia(a,"string");return typeof s=="symbol"?s:String(s)}function ia(a,s){if(typeof a!="object"||a===null)return a;var e=a[Symbol.toPrimitive];if(e!==void 0){var t=e.call(a,s||"default");if(typeof t!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(s==="string"?String:Number)(a)}var la=2500,ca=2e3,L=W.module("PouchCommandHistoryTable");class He extends oa{constructor(s,e){var t;super("CommandHistoryStorage.".concat(s),{auto_compaction:!0,revs_limit:1}),St(this,"searchText",void 0),this.cache=e,this.cache.tableRegistry.has(this.cacheKey)||this.cache.tableRegistry.set(this.cacheKey,new Set),L.debug("Adding table to registry",this.cacheKey),(t=this.cache.tableRegistry.get(this.cacheKey))===null||t===void 0||t.add(this)}get cacheKey(){return this.db.name}setSearch(s){L.debug("Setting search filters",s),this.searchText=s.trim().toLowerCase(),this.setFilters(s?[Ke.makeFilterConfig([Ke.makeFilterItem("name",k.contains,s)])]:[])}dbUpdate(s){L.debug("Clearing cache and refreshing data",s),this.cache.response.delete(this.cacheKey),super.dbUpdate(s)}fetchData(s){var e=this;return Q(function*(){return Z.withTimeout(0,Q(function*(){e.cache.response.has(e.cacheKey)?L.debug("Fetching from cache",e.searchText,e.viewport):(L.debug("Fetching from PouchDB",e.searchText,e.viewport),e.cache.response.set(e.cacheKey,e.db.allDocs({include_docs:!0}).then(o=>{var r=o.rows.map(c=>c.doc).filter(c=>{var{name:d}=c;return d});L.debug("Fetched ".concat(r.length," command history items"));var{toKeep:i,toPrune:l}=Xn(r,la,ca);return l.length&&e.pruneItems(l),{docs:i}})));var t=e.cache.response.get(e.cacheKey);return e.searchText==null||e.searchText===""?t:oe(oe({},t),{},{docs:(yield t).docs.filter(o=>{var{name:r}=o;return r.toLowerCase().includes(e.searchText)})})}))})()}fetchInfo(s){var e=this;return Q(function*(){return e.fetchData(s)})()}fetchViewportData(s,e,t){var o=this;return Q(function*(){var r=yield o.fetchData(e);L.debug("Fetching viewport data",s.top,s.bottom+1,t,r);var i=typeof t[0]=="object"&&t[0].id==="desc",l=i?r.docs.slice(0).reverse():r.docs,c=l.slice(s.top,s.bottom+1);return{items:c,offset:s.top}})()}pruneItems(s){var e=this;return Q(function*(){if(e.cache.isPruning.get(e.cacheKey)===!0){L.debug("Pruning already in progress. Skipping.");return}try{L.debug("Pruning ".concat(s.length," command history items"));var t=e.cache.pauseChangeListeners(e.cacheKey);e.cache.isPruning.set(e.cacheKey,!0),yield e.db.bulkDocs(s.map(o=>oe(oe({},o),{},{_deleted:!0}))),e.cache.isPruning.set(e.cacheKey,!1),t(),L.debug("Finished pruning command history items")}catch(o){L.error("An error occurred while pruning db",o)}})()}close(){var s,e,t;L.debug("Closing table",this,(s=this.cache.tableRegistry.get(this.cacheKey))===null||s===void 0?void 0:s.size),(e=this.cache.tableRegistry.get(this.cacheKey))===null||e===void 0||e.delete(this),(t=this.changes)===null||t===void 0||t.cancel(),super.close()}}function ve(a,s,e){return s=da(s),s in a?Object.defineProperty(a,s,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[s]=e,a}function da(a){var s=ua(a,"string");return typeof s=="symbol"?s:String(s)}function ua(a,s){if(typeof a!="object"||a===null)return a;var e=a[Symbol.toPrimitive];if(e!==void 0){var t=e.call(a,s||"default");if(typeof t!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(s==="string"?String:Number)(a)}var Ze=W.module("PouchCommandHistoryCache");class ha{constructor(){ve(this,"isPruning",void 0),ve(this,"response",void 0),ve(this,"tableRegistry",void 0),this.isPruning=new Map,this.response=new Map,this.tableRegistry=new Map}pauseChangeListeners(s){var e,t=[];return(e=this.tableRegistry.get(s))===null||e===void 0||e.forEach(o=>{o.changes&&(Ze.debug("Pausing event listeners on '".concat(s,"' table"),o),o.changes.cancel(),t.push(o))}),()=>{t.forEach(o=>{var r,i;(r=(i=this.tableRegistry.get(s))===null||i===void 0?void 0:i.has(o))!==null&&r!==void 0&&r&&(Ze.debug("Resuming event listeners on '".concat(s,"' table"),o),o.listenForChanges())})}}}function Ye(a,s){var e=Object.keys(a);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(a);s&&(t=t.filter(function(o){return Object.getOwnPropertyDescriptor(a,o).enumerable})),e.push.apply(e,t)}return e}function qe(a){for(var s=1;s<arguments.length;s++){var e=arguments[s]!=null?arguments[s]:{};s%2?Ye(Object(e),!0).forEach(function(t){Ce(a,t,e[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(e)):Ye(Object(e)).forEach(function(t){Object.defineProperty(a,t,Object.getOwnPropertyDescriptor(e,t))})}return a}function ze(a,s,e,t,o,r,i){try{var l=a[r](i),c=l.value}catch(d){e(d);return}l.done?s(c):Promise.resolve(c).then(t,o)}function Se(a){return function(){var s=this,e=arguments;return new Promise(function(t,o){var r=a.apply(s,e);function i(c){ze(r,t,o,i,l,"next",c)}function l(c){ze(r,t,o,i,l,"throw",c)}i(void 0)})}}function Ce(a,s,e){return s=ma(s),s in a?Object.defineProperty(a,s,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[s]=e,a}function ma(a){var s=pa(a,"string");return typeof s=="symbol"?s:String(s)}function pa(a,s){if(typeof a!="object"||a===null)return a;var e=a[Symbol.toPrimitive];if(e!==void 0){var t=e.call(a,s||"default");if(typeof t!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(s==="string"?String:Number)(a)}var Je=W.module("PouchCommandHistoryStorage");class ga{constructor(){Ce(this,"cache",new ha),Ce(this,"updateTableMap",new Map)}getUpdateTable(s){return this.updateTableMap.has(s)||this.updateTableMap.set(s,new He(s,this.cache)),this.updateTableMap.get(s)}getTable(s){var e=this;return Se(function*(){return new He(s,e.cache)})()}addItem(s,e,t,o){var r=this;return Se(function*(){return r.updateItem(s,{id:"".concat(new Date().getTime()),name:t,data:o})})()}updateItem(s,e){var t=this;return Se(function*(){var o=t.getUpdateTable(s),r=yield o.refreshItem(e.id),i=qe(qe({},r??{}),e);return Je.debug("Updating item",i),yield o.put(i),Je.debug("Update saved"),e})()}listenItem(s,e,t){var o=this.getUpdateTable(s);return o.onItemUpdate(e,t)}}const yt="SET_LAYOUT_STORAGE",fa=a=>({type:yt,payload:a});var{dh:xt}=globalThis;const ba=W.module("SettingsUtils");function va(a){return a.formatString!=null}function Ct(a){const s=kt.parse(window.navigator.userAgent),e=`${s.browser.name??""} ${Number(parseFloat(s.browser.version??""))||""}`,t=`${s.os.name??""} ${s.os.version??""}`;return{"Engine Version":a.get("deephaven.version")??"Unknown","Web UI Version":"0.94.0","Java Version":a.get("java.version")??"Unknown","Barrage Version":a.get("barrage.version")??"Unknown","Browser Name":e.trim()||"Unknown","OS Name":t.trim()||"Unknown"}}function Xe(a){return Array.from(a.entries()).filter(s=>s[1].version!==void 0).reduce((s,[e,t])=>({...s,[e]:t.version}),{})}function Te(a){const s=a==null?void 0:a.querySelector("input, select, textarea");s&&s.focus()}function Tt(a,s){return a.defaultFormatString===s.defaultFormatString}function Sa(a,s){return Tt(a,s)}function ya(a,s){return Tt(a,s)}function wt(a){return a!==""&&qt.isValidColumnName(a)}function z(a,s,e){if(!s||e.formatString==null||!va(e))return!1;switch(s){case"datetime":return V.isValid(a,e);case"decimal":return _.isValid(a,e);case"int":return M.isValid(a,e);default:return ba.warn("Trying to validate format of unknown type"),!0}}function xa(a){const{id:s,isNewRule:e,...t}=a;return t}function Ca(a,s){return wt(s.columnName)&&z(a,s.columnType,s.format)}function Dt(a){const{timestamp:s,timeZone:e,showTimeZone:t,showTSeparator:o,isGlobalOptions:r,legacyGlobalFormat:i}=a,l=ot(),c=m.useMemo(()=>new zt(l,[],{timeZone:e,showTimeZone:t,showTSeparator:o}),[l,t,o,e]),d=r?V.getGlobalFormats(t,o):V.getFormats(t,o);return i!=null&&!d.includes(i)&&d.unshift(i),n.jsx(n.Fragment,{children:d.map(h=>{const u=V.makeFormat("",h,V.TYPE_GLOBAL);return n.jsx("option",{value:h,"data-testid":"time-format",children:c.getFormattedString(s,R.dataType.DATETIME,"",u)},h)})})}function Ta(){return n.jsx(n.Fragment,{children:Jt.TIME_ZONES.map(a=>{const{label:s,value:e}=a;return n.jsx("option",{value:e,children:s},e)})})}const G=W.module("FormattingSectionContent"),te=class te extends m.PureComponent{constructor(e){super(e);b(this,"debouncedCommitChanges");b(this,"pendingUpdates");b(this,"containerRef");b(this,"getCachedDateTimeFormatOptions",ye((e,t,o,r=!1,i)=>{const{timestampAtMenuOpen:l}=this.state;return n.jsx(Dt,{timestamp:l,timeZone:e,showTimeZone:t,showTSeparator:o,isGlobalOptions:r,legacyGlobalFormat:i})}));this.debouncedCommitChanges=nt(this.commitChanges.bind(this),te.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),this.handleShowEmptyStringsChange=this.handleShowEmptyStringsChange.bind(this),this.handleShowNullStringsChange=this.handleShowNullStringsChange.bind(this),this.handleShowExtraGroupColumnChange=this.handleShowExtraGroupColumnChange.bind(this);const{defaultDateTimeFormat:t,defaultDecimalFormatOptions:o,defaultIntegerFormatOptions:r,showTimeZone:i,showTSeparator:l,timeZone:c,truncateNumbersWithPound:d,showEmptyStrings:h,showNullStrings:u,showExtraGroupColumn:p}=e;this.containerRef=X.createRef(),this.pendingUpdates=[],this.state={showTimeZone:i,showTSeparator:l,timeZone:c,defaultDateTimeFormat:t,defaultDecimalFormatOptions:o,defaultIntegerFormatOptions:r,truncateNumbersWithPound:d,showEmptyStrings:h,showNullStrings:u,showExtraGroupColumn:p,timestampAtMenuOpen:new Date}}componentDidMount(){Te(this.containerRef.current)}componentWillUnmount(){this.debouncedCommitChanges.flush()}queueUpdate(e){this.pendingUpdates.push(e),this.debouncedCommitChanges()}handleDefaultDateTimeFormatChange(e){G.debug("handleDefaultDateTimeFormatChange",e);const t={defaultDateTimeFormat:e};this.setState(t),this.queueUpdate(t)}handleDefaultDecimalFormatChange(e){G.debug("handleDefaultDecimalFormatChange",e.target.value);const t={defaultDecimalFormatOptions:{defaultFormatString:e.target.value}};this.setState(t),z(dh,R.dataType.DECIMAL,_.makeCustomFormat(e.target.value))&&this.queueUpdate(t)}handleDefaultIntegerFormatChange(e){G.debug("handleDefaultIntegerFormatChange",e.target.value);const t={defaultIntegerFormatOptions:{defaultFormatString:e.target.value}};this.setState(t),z(dh,R.dataType.INT,M.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:o,showTSeparator:r}=e;G.debug("handleResetDateTimeFormat"),this.setState({defaultDateTimeFormat:t,showTimeZone:o,showTSeparator:r}),this.queueUpdate({defaultDateTimeFormat:void 0,showTimeZone:void 0,showTSeparator:void 0})}handleResetTimeZone(){const{defaults:e}=this.props,{timeZone:t}=e;G.debug("handleResetTimeZone"),this.setState({timeZone:t}),this.queueUpdate({timeZone:void 0})}handleResetDecimalFormat(){const{defaults:e}=this.props,{defaultDecimalFormatOptions:t}=e;G.debug("handleResetDecimalFormat"),this.setState({defaultDecimalFormatOptions:t}),this.queueUpdate({defaultDecimalFormatOptions:void 0})}handleResetIntegerFormat(){const{defaults:e}=this.props,{defaultIntegerFormatOptions:t}=e;G.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)}handleShowEmptyStringsChange(){const{showEmptyStrings:e}=this.state,t={showEmptyStrings:!e};this.setState(t),this.queueUpdate(t)}handleShowNullStringsChange(){const{showNullStrings:e}=this.state,t={showNullStrings:!e};this.setState(t),this.queueUpdate(t)}handleShowExtraGroupColumnChange(){const{showExtraGroupColumn:e}=this.state,t={showExtraGroupColumn:!e};this.setState(t),this.queueUpdate(t)}commitChanges(){const{updateSettings:e}=this.props,t=this.pendingUpdates.reduce((o,r)=>({...o,...r}),{});this.pendingUpdates=[],e(t)}render(){const{defaults:e,dh:t}=this.props,{defaultDateTimeFormat:o,defaultDecimalFormatOptions:r,defaultIntegerFormatOptions:i,timeZone:l,showTimeZone:c,showTSeparator:d,truncateNumbersWithPound:h,showEmptyStrings:u,showNullStrings:p,showExtraGroupColumn:N}=this.state,{defaultFormatString:y=_.DEFAULT_FORMAT_STRING}=r??{},{defaultFormatString:f=M.DEFAULT_FORMAT_STRING}=i??{},S=l===e.timeZone,T=d===e.showTSeparator&&c===e.showTimeZone&&o===e.defaultDateTimeFormat,P=Sa(r,e.defaultDecimalFormatOptions),w=ya(i,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(ie,{className:"custom-select",value:l,onChange:this.handleTimeZoneChange,id:"select-reset-timezone",children:n.jsx(Ta,{})})}),n.jsx("div",{className:"col-1 btn-col",children:n.jsx(C,{kind:"ghost",icon:q,onClick:this.handleResetTimeZone,tooltip:"Reset Time Zone",className:I("btn-reset","btn-reset-time-zone",{hidden:S})})})]}),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(ie,{className:"custom-select",value:o,onChange:this.handleDefaultDateTimeFormatChange,id:"select-default-time-format",children:this.getCachedDateTimeFormatOptions(l,c,d,!0,o)})}),n.jsx("div",{className:"col-1 btn-col",children:n.jsx(C,{kind:"ghost",icon:q,onClick:this.handleResetDateTimeFormat,tooltip:"Reset DateTime Options",className:I("btn-reset","btn-reset-date-time",{hidden:T})})})]}),n.jsx("div",{className:"form-row",children:n.jsx("div",{className:"offset-3 col-9",children:n.jsx(H,{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(H,{checked:d??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:I("form-control","flex-grow-1","default-decimal-format-input",{"is-invalid":!z(t,R.dataType.DECIMAL,_.makeCustomFormat(y))}),"data-lpignore":!0,placeholder:_.DEFAULT_FORMAT_STRING,type:"text",id:"default-decimal-format-input",value:y,onChange:this.handleDefaultDecimalFormatChange})}),n.jsx("div",{className:"col-1 btn-col",children:n.jsx(C,{kind:"ghost",icon:q,onClick:this.handleResetDecimalFormat,tooltip:"Reset Decimal Formatting",className:I("btn-reset","btn-reset-decimal",{hidden:P}),"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:I("form-control","flex-grow-1","default-integer-format-input",{"is-invalid":!z(t,R.dataType.INT,M.makeCustomFormat(f))}),"data-lpignore":!0,placeholder:M.DEFAULT_FORMAT_STRING,type:"text",id:"default-integer-format-input",value:f,onChange:this.handleDefaultIntegerFormatChange})}),n.jsx("div",{className:"col-1 btn-col",children:n.jsx(C,{kind:"ghost",icon:q,onClick:this.handleResetIntegerFormat,tooltip:"Reset Integer Formatting",className:I("btn-reset","btn-reset-integer",{hidden:w}),"data-testid":"btn-reset-integer"})})]}),n.jsx("div",{className:"form-row mb-2",children:n.jsx("div",{className:"offset-3 col-9",children:n.jsx(H,{checked:h??null,onChange:this.handleTruncateNumbersWithPoundChange,children:"Show truncated numbers as ###"})})}),n.jsxs("div",{className:"form-row mb-3",children:[n.jsx("label",{className:"col-form-label col-3",htmlFor:"default-integer-format-input",children:"String"}),n.jsxs("div",{className:"col pr-0 pt-2",children:[n.jsxs(H,{checked:u??null,onChange:this.handleShowEmptyStringsChange,children:["Show empty strings as"," ",n.jsx("span",{className:"font-italic text-muted",children:"empty"})]}),n.jsxs(H,{checked:p??null,onChange:this.handleShowNullStringsChange,children:["Show null strings as"," ",n.jsx("span",{className:"font-italic text-muted",children:"null"})]})]})]}),n.jsxs("div",{className:"form-row mb-3",id:"show_extra_group_column_div",children:[n.jsx("label",{className:"col-form-label col-3",htmlFor:"default-show-extra-group-column",children:"Rollup"}),n.jsx("div",{className:"col pr-0 pt-2",id:"default-show-extra-group-column",children:n.jsx(H,{checked:N,onChange:this.handleShowExtraGroupColumnChange,children:'Show extra "group" column'})})]})]})})}};b(te,"defaultProps",{scrollTo:()=>{}}),b(te,"inputDebounceTime",250);let we=te;const wa=a=>({defaultDateTimeFormat:Xt(a),defaultDecimalFormatOptions:rt(a),defaultIntegerFormatOptions:it(a),dh:lt(a),showTimeZone:ct(a),showTSeparator:dt(a),truncateNumbersWithPound:Qt(a),showEmptyStrings:es(a),showNullStrings:ts(a),showExtraGroupColumn:ss(a),timeZone:ut(a),defaults:ns(a)}),Da=de(wa,{updateSettings:ne})(we);function ja(){const[a,s]=m.useState(!1),e=()=>{s(!a)};return n.jsxs(n.Fragment,{children:[n.jsx(C,{kind:"ghost",onClick:e,icon:Xs,children:"Legal Notices"}),n.jsxs(Qs,{isOpen:a,toggle:e,children:[n.jsx(en,{toggle:e,children:"Legal Notice"}),n.jsxs(tn,{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 B(a){const{children:s,isExpanded:e,sectionKey:t,title:o,onToggle:r}=a;return n.jsxs(n.Fragment,{children:[n.jsx("div",{children:n.jsxs(C,{kind:"ghost",className:"btn-collapse-trigger",onClick:()=>r(t),children:[n.jsx("div",{className:"flex-grow-1",children:o}),n.jsx("div",{className:"flex-shrink-0",children:n.jsx(F,{transform:e?"flip-v":"",icon:sn})})]})}),n.jsx(Rn,{in:e,autoFocusOnShow:!0,children:s})]})}B.propTypes={children:j.node,isExpanded:j.bool.isRequired,sectionKey:j.string.isRequired,title:j.node.isRequired,onToggle:j.func};B.defaultProps={children:null,onToggle:()=>{}};function Na({shortcut:a,displayText:s,categoryName:e,onChange:t}){const[o,r]=m.useState(s),[i,l]=m.useState(a.getKeyState()),[c,d]=m.useState(!1),[h,u]=m.useState("");m.useEffect(function(){r(s),l(a.getKeyState())},[s,a]),m.useEffect(function(){r(A.getDisplayText(i)),a.matchesKeyState(i)&&d(!1)},[i,a]),m.useEffect(function(){if(c){if(!A.isValidKeyState(i)){A.isAllowedKey(i.keyValue)?u("Must contain a modifier key"):u("Must contain an allowed action key");return}const g=Ee.getConflictingShortcuts(i).filter(v=>v.id.startsWith(e)&&v!==a).map(v=>v.name);if(g.length){u(`Conflicts with ${g.join(", ")}`);return}u("")}else u("")},[c,i,e,a]);function p(w){if(w.stopPropagation(),w.preventDefault(),a.isEditable&&!w.repeat){const g=A.getKeyStateFromEvent(w),v=A.createKeyState([as.BACKSPACE]);A.doKeyStatesMatch(g,v)?l(A.NULL_KEY_STATE):l(g)}}function N(w){w.stopPropagation(),w.preventDefault(),a.matchesKeyState(i)||d(!0)}function y(){Le.disableAllActions()}function f(){Le.enableAllActions()}function S(){a.setKeyState(i),d(!1),t(a)}function T(){const w=a.getKeyState();l(w),d(!1)}function P(){d(!0),l(a.getDefaultKeyState())}return n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"shortcut-item-container",children:[n.jsxs("label",{className:"shortcut-item-name",children:[a.name,a.tooltip!==void 0&&n.jsx(ht,{children:a.tooltip})]}),n.jsxs("div",{className:"shortcut-item-input-container",children:[n.jsx("input",{className:I("form-control",{"is-invalid":h}),onKeyDown:p,onKeyUp:N,onFocus:y,onBlur:f,disabled:!a.isEditable,value:o,readOnly:!0}),!A.doKeyStatesMatch(i,a.getDefaultKeyState())&&!h&&n.jsx(C,{className:"reset-to-default-button",kind:"ghost",icon:n.jsx(F,{icon:q,transform:{rotate:90,flipX:!0}}),tooltip:"Reset to default",onClick:P})]})]}),c&&n.jsxs("div",{className:I("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:[A.isValidKeyState(i)&&n.jsx(C,{kind:"ghost",onClick:S,children:"Confirm"}),n.jsx(C,{kind:"ghost",onClick:T,children:"Undo"})]})]})]})}function Ea({shortcutOverrides:a={},updateSettings:s}){const e=m.useCallback(i=>{const l=A.isMacPlatform,c={mac:{...a.mac},windows:{...a.windows}},d=l?c.mac:c.windows;i.forEach(h=>{h.isDefault()?delete d[h.id]:d[h.id]=h.getKeyState()}),s({shortcutOverrides:c})},[s,a]);let t=Array.from(Ee.shortcutsByCategory.entries()).map(([i,l])=>({name:i,shortcuts:l}));const o=t.findIndex(i=>i.name.toUpperCase()==="GLOBAL"),r=t.splice(o,1);return t=t.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."}),t.map(i=>n.jsx(Fa,{name:i.name,shortcuts:i.shortcuts,saveShortcutOverrides:e},i.name))]})}function Fa({name:a,shortcuts:s,saveShortcutOverrides:e}){function t(c){return c.split("_").map(d=>`${d[0].toUpperCase()}${d.slice(1).toLowerCase()}`).join(" ")}const[o,r]=m.useState(s);function i(c){const d=o.filter(u=>u!==c&&!u.isNull()&&u.matchesKeyState(c.getKeyState()));d.forEach(u=>u.setToNull());const h=[c,...d];e(h),r(u=>[...u])}const l=m.useMemo(()=>o.map(c=>c.getDisplayText()),[o]);return n.jsxs("div",{className:"mt-3",children:[n.jsx("div",{className:"font-weight-bold",children:t(a)}),o.map((c,d)=>n.jsx(Na,{shortcut:c,displayText:l[d],categoryName:a,onChange:i},c.id))]})}const Ra=a=>({shortcutOverrides:os(a)}),Ia={updateSettings:ne},Oa=de(Ra,Ia)(Ea),La="yyyy-MM-dd-HHmmss",Pa=[["api"],["client"],["dashboardData","default","connection"],["dashboardData","default","sessionWrapper","dh"],["layoutStorage"],["storage"]];function Fe(a){const s=new Map;return function(t,o){const r=[...s.get(this)??[],t];o===Object(o)&&s.set(o,[...r]),r.shift();for(let i=0;i<a.length;i+=1)if(r.length===a[i].length&&r.every((l,c)=>l===a[i][c]))return;return o}}function jt(a,s,e="root",t=new Map([[a,""]])){const o={};return Object.entries(a).forEach(([r,i])=>{try{JSON.stringify(i,Fe(s)),o[r]=i}catch{const c=i;if(typeof i=="bigint")o[r]=i.toString();else if(t.has(c))o[r]=`Circular ref to ${t.get(c)}`;else{const d=`${e}.${r}`;t.set(c,d),o[r]=jt(i,s,d,t)}}}),o}function ka(a){const s=an.getState();return JSON.stringify(jt(s,a),Fe(a),2)}function Aa(a,s){const e={uiVersion:"0.94.0",userAgent:navigator.userAgent,...s};return JSON.stringify(e,Fe(a),2)}async function Ma(a=`${xt.i18n.DateTimeFormat.format(La,new Date)}_support_logs`,s,e=Pa){const t=new at,o=t.folder(a);o.file("console.txt",nn.getFormattedHistory()),o.file("redux.json",ka(e)),o.file("metadata.json",Aa(e,s));const r=await t.generateAsync({type:"blob"}),i=document.createElement("a");i.href=URL.createObjectURL(r),i.download=`${a}.zip`,i.click()}const _a=[{value:R.dataType.DATETIME,label:"DateTime"},{value:R.dataType.DECIMAL,label:"Decimal"},{value:R.dataType.INT,label:"Integer"}];function Ua(){const a=_a.map(s=>n.jsx("option",{value:s.value,children:s.label},`key-columnType-${s.value}`));return n.jsxs(n.Fragment,{children:[n.jsx("option",{disabled:!0,value:"",children:"Select Type"},"key-columnType-placeholder"),a]})}const se=class se extends m.PureComponent{constructor(e){super(e);b(this,"debouncedCommitChanges");b(this,"containerRef");b(this,"addFormatRuleButtonRef");b(this,"lastFormatRuleIndex");b(this,"getCachedColumnTypeOptions",ye(()=>n.jsx(Ua,{})));b(this,"getCachedDateTimeFormatOptions",ye((e,t,o,r=!1,i)=>{const{timestampAtMenuOpen:l}=this.state;return n.jsx(Dt,{timestamp:l,timeZone:e,showTimeZone:t,showTSeparator:o,isGlobalOptions:r,legacyGlobalFormat:i})}));this.debouncedCommitChanges=nt(this.commitChanges.bind(this),se.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:o,showTSeparator:r,timeZone:i}=e,l=t.map((c,d)=>({...c,id:d}));this.containerRef=X.createRef(),this.addFormatRuleButtonRef=X.createRef(),this.lastFormatRuleIndex=l.length,this.state={formatSettings:l,formatRulesChanged:!1,showTimeZone:o,showTSeparator:r,timeZone:i,timestampAtMenuOpen:new Date}}componentDidMount(){Te(this.containerRef.current)}componentWillUnmount(){this.debouncedCommitChanges.flush()}isDuplicateRule(e){const{formatSettings:t}=this.state;return t.some(o=>o.id!==e.id&&o.columnName===e.columnName&&o.columnType===e.columnType)??!1}getAutoIncrementFormatRuleIndex(){const{lastFormatRuleIndex:e}=this;return this.lastFormatRuleIndex+=1,e}handleFormatRuleChange(e,t,o){this.setState(r=>{const{formatSettings:i}=r;ce(i);const l=[...i];let c={};t==="columnType"&&(c={format:this.makeDefaultFormatterItemByType(o)});const d={...l[e],...c,[t]:o};return l[e]=d,{formatSettings:l}},()=>{this.debouncedCommitChanges()})}handleFormatRuleCreate(){this.setState(e=>{const{formatSettings:t}=e,o={columnType:R.dataType.DATETIME,columnName:"",format:{},id:this.getAutoIncrementFormatRuleIndex(),isNewRule:!0};return{formatSettings:[...t,o],formatRulesChanged:!0}})}handleFormatRuleDelete(e){this.setState(t=>{const{formatSettings:o}=t;return{formatSettings:o.filter((i,l)=>l!==e),formatRulesChanged:!0}},()=>{this.debouncedCommitChanges()})}handleFormatRuleEntered(e){this.scrollToFormatBlockBottom(),Te(e)}commitChanges(){const{formatSettings:e}=this.state,{dh:t}=this.props,o=e.filter(l=>Ca(t,l)).map(xa)??[],{updateSettings:r}=this.props;r({formatter:o})}scrollToFormatBlockBottom(){var t,o;const{scrollTo:e}=this.props;e(0,(((t=this.addFormatRuleButtonRef.current)==null?void 0:t.offsetHeight)??0)+(((o=this.addFormatRuleButtonRef.current)==null?void 0:o.offsetTop)??0))}getRuleError(e){const{dh:t}=this.props,o={hasColumnNameError:!1,hasFormatError:!1,message:""},r=[];return e.isNewRule!==void 0&&e.isNewRule||(this.isDuplicateRule(e)&&(o.hasColumnNameError=!0,r.push("Duplicate column name/type combo.")),wt(e.columnName)||(o.hasColumnNameError=!0,r.push("Column names must start with a letter or underscore and contain only alphanumeric characters or underscores.")),e.format.formatString!=null&&e.format.formatString.length===0?(o.hasFormatError=!0,r.push("Empty formatting rule.")):z(t,e.columnType,e.format)||(o.hasFormatError=!0,r.push("Invalid formatting rule.")),o.message=r.join(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./StyleGuideRoot-C-Kz5fEa.js","./vendor-CohWXWuY.js","./helpers-BosuxZz1.js","./vendor-Ck7TznCw.css","./index-By1dHjp4.js","./monaco-CNNCitmD.js","./monaco-BX50Gyx4.css","./index-6ub2NC3N.css","./IrisGridModel-CAsjFilJ.js","./ControlType-NUmGfTww.js","./ControlType-0B-XeYnS.css","./IrisGridModel-DDgEpNBk.css","./FontBootstrap-Bl6vq41v.js","./TokenBoxCellRenderer-DH2eZRQH.js","./IrisGridShortcuts-BwHkgvtW.js","./IrisGridShortcuts-B4ulgs9Z.css","./useMergeRef-CdbLELuv.js","./TokenBoxCellRenderer-CnOjKPv1.css","./LocalWorkspaceStorage-h3-A9jVy.js","./LocalWorkspaceStorage-B0s_p084.css","./FontBootstrap-HppzMMw0.css","./Grid-CjnujVEX.js","./Grid-DzvebgTk.css","./StyleGuideRoot-Q5SNMm10.css"])))=>i.map(i=>d[i]);
2
+ var Ot=Object.defineProperty;var Lt=(a,s,e)=>s in a?Ot(a,s,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[s]=e;var b=(a,s,e)=>Lt(a,typeof s!="symbol"?s+"":s,e);import{X as st,Y as Pt,Z as kt,r as m,J as n,_ as de,a0 as nt,V as X,a1 as ye,M as I,a2 as j,N as F,a3 as at,a4 as At,a5 as Ne,a6 as Mt,a7 as _t,a8 as Ut,a9 as he,aa as Kt,I as $t,ab as Wt,ac as Gt,ad as Bt,ae as Vt,af as me,ag as Ht}from"./vendor-CohWXWuY.js";import{_ as Zt,W as Yt}from"./monaco-CNNCitmD.js";import{O as re,P as Z,T as k,D as qt,I as M,a as _,b as V,u as ot,F as zt,c as R,d as Jt,e as ne,S as ie,B as C,C as H,g as Xt,f as rt,h as it,i as lt,j as ct,k as dt,l as Qt,m as es,n as ts,o as ss,p as ut,q as ns,r as A,s as Ee,t as ht,K as as,v as Le,w as os,x as rs,y as is,z as xe,A as ls,E as cs,G as ds,H as us,J as Y,L as hs,M as $,N as le,Q as ms,R as ps,U as gs,V as mt,W as pt,X as fs,Y as bs,Z as vs,_ as Ss,$ as ys,a0 as xs,a1 as Cs,a2 as Ts,a3 as Pe,a4 as ws,a5 as gt,a6 as Ds,a7 as js,a8 as Ns,a9 as D,aa as Es,ab as ae,ac as Fs,ad as Rs,ae as Is,af as Os,ag as Ls,ah as Ps,ai as ks,aj as As,ak as Ms,al as _s,am as Us,an as Ks,ao as $s,ap as Ws,aq as Gs,ar as Bs,as as Vs,at as Hs,au as Zs,av as Ys,aw as qs,ax as zs,ay as Js}from"./ControlType-NUmGfTww.js";import{L as W,v as q,a as Xs,M as Qs,b as en,c as tn,d as sn,l as nn,s as an,e as ce,f as on,g as rn,h as ln,i as cn,j as dn,k as un,m as hn,n as mn,o as pn,p as gn,q as fn,r as bn,t as vn,u as Sn,w as yn,x as xn,y as Cn,z as Tn,A as wn,B as ke,C as Ae,D as Me,E as Dn,F as jn,G as Nn,H as En,I as Fn,J as ft}from"./index-By1dHjp4.js";import{C as Rn,H as In,T as On,P as Ln,B as Pn,m as kn,a as An,L as bt,s as _e,l as Mn,U as pe,N as _n,A as Un,g as Kn,b as $n,u as Wn,c as Gn,d as Bn,e as Vn,f as Hn,h as Zn,G as Yn,i as qn,j as Ue}from"./LocalWorkspaceStorage-h3-A9jVy.js";import{T as ge,I as vt,S as zn,D as Jn}from"./IrisGridShortcuts-BwHkgvtW.js";import"./helpers-BosuxZz1.js";import"./useMergeRef-CdbLELuv.js";class Ke{static makeSortConfig(s,e){return{column:s,direction:e}}static makeFilterConfig(s){var e=[],t=[];return s.forEach((o,r)=>{e.push(o),r>0&&t.push(re.and)}),{filterItems:e,filterOperators:t}}static combineFilterConfigs(s,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:re.and;return{filterItems:[...s.filterItems,...e.filterItems],filterOperators:[...s.filterOperators,t,...e.filterOperators]}}static makeFilterItem(s,e,t){return{columnName:s,type:e,value:t}}}function Xn(a,s,e){if(a.length>s){var t=a.length-e;return{toKeep:a.slice(t),toPrune:a.slice(0,t)}}return{toKeep:a,toPrune:[]}}function $e(a,s){var e=Object.keys(a);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(a);s&&(t=t.filter(function(o){return Object.getOwnPropertyDescriptor(a,o).enumerable})),e.push.apply(e,t)}return e}function We(a){for(var s=1;s<arguments.length;s++){var e=arguments[s]!=null?arguments[s]:{};s%2?$e(Object(e),!0).forEach(function(t){O(a,t,e[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(e)):$e(Object(e)).forEach(function(t){Object.defineProperty(a,t,Object.getOwnPropertyDescriptor(e,t))})}return a}function Ge(a,s,e,t,o,r,i){try{var l=a[r](i),c=l.value}catch(d){e(d);return}l.done?s(c):Promise.resolve(c).then(t,o)}function U(a){return function(){var s=this,e=arguments;return new Promise(function(t,o){var r=a.apply(s,e);function i(c){Ge(r,t,o,i,l,"next",c)}function l(c){Ge(r,t,o,i,l,"throw",c)}i(void 0)})}}function O(a,s,e){return s=Qn(s),s in a?Object.defineProperty(a,s,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[s]=e,a}function Qn(a){var s=ea(a,"string");return typeof s=="symbol"?s:String(s)}function ea(a,s){if(typeof a!="object"||a===null)return a;var e=a[Symbol.toPrimitive];if(e!==void 0){var t=e.call(a,s||"default");if(typeof t!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(s==="string"?String:Number)(a)}var fe=W.module("PouchStorageTable"),ta="Deephaven.";st.plugin(Pt);function sa(a,s){switch(a){case k.in:case k.contains:return{$regex:new RegExp("".concat(s)).toString()};case k.inIgnoreCase:return{$regex:new RegExp("".concat(s),"i").toString()};case k.eq:return{$eq:s};case k.notEq:return{$ne:s};case k.greaterThan:return{$gt:s};case k.greaterThanOrEqualTo:return{$gte:s};case k.lessThan:return{$lt:s};case k.lessThanOrEqualTo:return{$lte:s};case k.startsWith:return{$regex:new RegExp("^".concat(s,".*")).toString()};default:throw new Error("Unsupported type: ".concat(a))}}function na(a){for(var{filterItems:s,filterOperators:e}=a,t=null,o=0;o<s.length;o+=1){var r=s[o],{columnName:i,type:l,value:c}=r,d={[i]:sa(l,c)};if(o===0)t=d;else if(t!==null&&o-1<e.length){var h=e[o-1];if(h===re.and)t={$and:[t,d]};else if(h===re.or)t={$or:[t,d]};else throw new Error("Unexpected filter operator ".concat(h,", ").concat(d))}}if(t==null)throw new Error("Invalid filter config ".concat(a));return t}function be(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return{$and:[...a.map(s=>na(s)),{name:{$gt:null}},{id:{$gt:null}}]}}function aa(a){var s,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return[{id:e?"desc":"asc"},...(s=a==null?void 0:a.map(t=>({[t.column]:t.direction})))!==null&&s!==void 0?s:[]]}class oa{constructor(s,e){O(this,"db",void 0),O(this,"changes",void 0),O(this,"listeners",[]),O(this,"itemListeners",new Map),O(this,"currentSize",0),O(this,"currentViewport",void 0),O(this,"currentReverse",!1),O(this,"currentFilter",null),O(this,"currentSort",null),O(this,"infoUpdatePromise",void 0),O(this,"viewportUpdatePromise",void 0),O(this,"currentViewportData",void 0),this.db=new st("".concat(ta).concat(s),e),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(s){return this.listeners=[...this.listeners,s],()=>{this.listeners=this.listeners.filter(e=>e!==s)}}onItemUpdate(s,e){return this.itemListeners.has(s)||this.itemListeners.set(s,[]),this.itemListeners.set(s,[...this.itemListeners.get(s),e]),this.refreshItem(s),()=>{this.itemListeners.set(s,this.itemListeners.get(s).filter(t=>t!==e))}}close(){this.listeners=[]}get size(){return this.currentSize}get viewport(){return this.currentViewport}setReversed(s){this.currentReverse=s,this.currentViewportData=void 0,this.refreshData()}setViewport(s){this.currentViewport=s,this.refreshInfo(),this.refreshData()}setSorts(s){this.currentSort=s,this.currentViewportData=void 0,this.refreshData()}setFilters(s){this.currentFilter=s,this.currentViewportData=void 0,this.refreshInfo(),this.refreshData()}get data(){return this.currentViewportData}getViewportData(){var s=this;return U(function*(){var e;return s.viewportUpdatePromise||s.refreshData(),(e=s.viewportUpdatePromise)!==null&&e!==void 0?e:Promise.resolve({items:[],offset:0})})()}put(s){var e=this;return U(function*(){var t=We(We({},s),{},{_id:s.id});return yield e.db.put(t),t})()}sendUpdate(){for(var s,{listeners:e}=this,t=(s=this.currentViewportData)!==null&&s!==void 0?s:{items:[],offset:0},o=0;o<e.length;o+=1)e[o](t)}sendItemUpdate(s){var e=this.itemListeners.get(s.id);if(e!==void 0)for(var t=0;t<e.length;t+=1)e[t](s)}dbUpdate(s){fe.debug("Update received",s),this.refreshInfo(),s.doc!==void 0&&this.sendItemUpdate(s.doc),this.refreshData()}fetchInfo(s){var e=this;return U(function*(){return e.db.find({selector:s,fields:[]})})()}refreshInfo(){var s=this;return U(function*(){try{var e,t;(e=s.infoUpdatePromise)===null||e===void 0||e.cancel(),s.infoUpdatePromise=Z.makeCancelable(s.fetchInfo(be((t=s.currentFilter)!==null&&t!==void 0?t:[])));var o=yield s.infoUpdatePromise;s.currentSize=o.docs.length,s.sendUpdate()}catch(r){if(!Z.isCanceled(r))throw fe.error("Unable to refreshInfo",r),r}})()}fetchViewportData(s,e,t){var o=this;return U(function*(){return o.db.find({selector:e,skip:s.top,limit:s.bottom-s.top+1,sort:t,fields:["id","name"]}).then(r=>({items:r.docs,offset:s.top}))})()}refreshData(){var s=this;return U(function*(){if(s.currentViewport)try{var e,t,o=be((e=s.currentFilter)!==null&&e!==void 0?e:[]),r=aa(s.currentSort,s.currentReverse);(t=s.viewportUpdatePromise)===null||t===void 0||t.cancel(),s.viewportUpdatePromise=Z.makeCancelable(s.fetchViewportData(s.currentViewport,o,r));var i=yield s.viewportUpdatePromise;return s.currentViewportData=i,s.sendUpdate(),i}catch(l){if(!Z.isCanceled(l))throw fe.error("Unable to refreshData",l),l}})()}refreshItem(s){var e=this;return U(function*(){var t=yield e.db.find({selector:{id:s},limit:1}),o=t.docs[0];return o!==void 0&&e.sendItemUpdate(o),o})()}getSnapshot(s){var e=this;return U(function*(){var t=new Map,o=[{id:e.currentReverse?"desc":"asc"}];return yield Promise.all(s.map(function(){var r=U(function*(i){var l,[c,d]=i,h=d-c+1;return e.db.find({selector:be((l=e.currentFilter)!==null&&l!==void 0?l:[]),skip:c,limit:h,sort:o,fields:["id","name"]}).then(u=>{for(var p=0;p<h;p+=1){var N=c+p;t.set(N,u.docs[p])}})});return function(i){return r.apply(this,arguments)}}())),t})()}}function Be(a,s){var e=Object.keys(a);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(a);s&&(t=t.filter(function(o){return Object.getOwnPropertyDescriptor(a,o).enumerable})),e.push.apply(e,t)}return e}function oe(a){for(var s=1;s<arguments.length;s++){var e=arguments[s]!=null?arguments[s]:{};s%2?Be(Object(e),!0).forEach(function(t){St(a,t,e[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(e)):Be(Object(e)).forEach(function(t){Object.defineProperty(a,t,Object.getOwnPropertyDescriptor(e,t))})}return a}function Ve(a,s,e,t,o,r,i){try{var l=a[r](i),c=l.value}catch(d){e(d);return}l.done?s(c):Promise.resolve(c).then(t,o)}function Q(a){return function(){var s=this,e=arguments;return new Promise(function(t,o){var r=a.apply(s,e);function i(c){Ve(r,t,o,i,l,"next",c)}function l(c){Ve(r,t,o,i,l,"throw",c)}i(void 0)})}}function St(a,s,e){return s=ra(s),s in a?Object.defineProperty(a,s,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[s]=e,a}function ra(a){var s=ia(a,"string");return typeof s=="symbol"?s:String(s)}function ia(a,s){if(typeof a!="object"||a===null)return a;var e=a[Symbol.toPrimitive];if(e!==void 0){var t=e.call(a,s||"default");if(typeof t!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(s==="string"?String:Number)(a)}var la=2500,ca=2e3,L=W.module("PouchCommandHistoryTable");class He extends oa{constructor(s,e){var t;super("CommandHistoryStorage.".concat(s),{auto_compaction:!0,revs_limit:1}),St(this,"searchText",void 0),this.cache=e,this.cache.tableRegistry.has(this.cacheKey)||this.cache.tableRegistry.set(this.cacheKey,new Set),L.debug("Adding table to registry",this.cacheKey),(t=this.cache.tableRegistry.get(this.cacheKey))===null||t===void 0||t.add(this)}get cacheKey(){return this.db.name}setSearch(s){L.debug("Setting search filters",s),this.searchText=s.trim().toLowerCase(),this.setFilters(s?[Ke.makeFilterConfig([Ke.makeFilterItem("name",k.contains,s)])]:[])}dbUpdate(s){L.debug("Clearing cache and refreshing data",s),this.cache.response.delete(this.cacheKey),super.dbUpdate(s)}fetchData(s){var e=this;return Q(function*(){return Z.withTimeout(0,Q(function*(){e.cache.response.has(e.cacheKey)?L.debug("Fetching from cache",e.searchText,e.viewport):(L.debug("Fetching from PouchDB",e.searchText,e.viewport),e.cache.response.set(e.cacheKey,e.db.allDocs({include_docs:!0}).then(o=>{var r=o.rows.map(c=>c.doc).filter(c=>{var{name:d}=c;return d});L.debug("Fetched ".concat(r.length," command history items"));var{toKeep:i,toPrune:l}=Xn(r,la,ca);return l.length&&e.pruneItems(l),{docs:i}})));var t=e.cache.response.get(e.cacheKey);return e.searchText==null||e.searchText===""?t:oe(oe({},t),{},{docs:(yield t).docs.filter(o=>{var{name:r}=o;return r.toLowerCase().includes(e.searchText)})})}))})()}fetchInfo(s){var e=this;return Q(function*(){return e.fetchData(s)})()}fetchViewportData(s,e,t){var o=this;return Q(function*(){var r=yield o.fetchData(e);L.debug("Fetching viewport data",s.top,s.bottom+1,t,r);var i=typeof t[0]=="object"&&t[0].id==="desc",l=i?r.docs.slice(0).reverse():r.docs,c=l.slice(s.top,s.bottom+1);return{items:c,offset:s.top}})()}pruneItems(s){var e=this;return Q(function*(){if(e.cache.isPruning.get(e.cacheKey)===!0){L.debug("Pruning already in progress. Skipping.");return}try{L.debug("Pruning ".concat(s.length," command history items"));var t=e.cache.pauseChangeListeners(e.cacheKey);e.cache.isPruning.set(e.cacheKey,!0),yield e.db.bulkDocs(s.map(o=>oe(oe({},o),{},{_deleted:!0}))),e.cache.isPruning.set(e.cacheKey,!1),t(),L.debug("Finished pruning command history items")}catch(o){L.error("An error occurred while pruning db",o)}})()}close(){var s,e,t;L.debug("Closing table",this,(s=this.cache.tableRegistry.get(this.cacheKey))===null||s===void 0?void 0:s.size),(e=this.cache.tableRegistry.get(this.cacheKey))===null||e===void 0||e.delete(this),(t=this.changes)===null||t===void 0||t.cancel(),super.close()}}function ve(a,s,e){return s=da(s),s in a?Object.defineProperty(a,s,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[s]=e,a}function da(a){var s=ua(a,"string");return typeof s=="symbol"?s:String(s)}function ua(a,s){if(typeof a!="object"||a===null)return a;var e=a[Symbol.toPrimitive];if(e!==void 0){var t=e.call(a,s||"default");if(typeof t!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(s==="string"?String:Number)(a)}var Ze=W.module("PouchCommandHistoryCache");class ha{constructor(){ve(this,"isPruning",void 0),ve(this,"response",void 0),ve(this,"tableRegistry",void 0),this.isPruning=new Map,this.response=new Map,this.tableRegistry=new Map}pauseChangeListeners(s){var e,t=[];return(e=this.tableRegistry.get(s))===null||e===void 0||e.forEach(o=>{o.changes&&(Ze.debug("Pausing event listeners on '".concat(s,"' table"),o),o.changes.cancel(),t.push(o))}),()=>{t.forEach(o=>{var r,i;(r=(i=this.tableRegistry.get(s))===null||i===void 0?void 0:i.has(o))!==null&&r!==void 0&&r&&(Ze.debug("Resuming event listeners on '".concat(s,"' table"),o),o.listenForChanges())})}}}function Ye(a,s){var e=Object.keys(a);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(a);s&&(t=t.filter(function(o){return Object.getOwnPropertyDescriptor(a,o).enumerable})),e.push.apply(e,t)}return e}function qe(a){for(var s=1;s<arguments.length;s++){var e=arguments[s]!=null?arguments[s]:{};s%2?Ye(Object(e),!0).forEach(function(t){Ce(a,t,e[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(e)):Ye(Object(e)).forEach(function(t){Object.defineProperty(a,t,Object.getOwnPropertyDescriptor(e,t))})}return a}function ze(a,s,e,t,o,r,i){try{var l=a[r](i),c=l.value}catch(d){e(d);return}l.done?s(c):Promise.resolve(c).then(t,o)}function Se(a){return function(){var s=this,e=arguments;return new Promise(function(t,o){var r=a.apply(s,e);function i(c){ze(r,t,o,i,l,"next",c)}function l(c){ze(r,t,o,i,l,"throw",c)}i(void 0)})}}function Ce(a,s,e){return s=ma(s),s in a?Object.defineProperty(a,s,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[s]=e,a}function ma(a){var s=pa(a,"string");return typeof s=="symbol"?s:String(s)}function pa(a,s){if(typeof a!="object"||a===null)return a;var e=a[Symbol.toPrimitive];if(e!==void 0){var t=e.call(a,s||"default");if(typeof t!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(s==="string"?String:Number)(a)}var Je=W.module("PouchCommandHistoryStorage");class ga{constructor(){Ce(this,"cache",new ha),Ce(this,"updateTableMap",new Map)}getUpdateTable(s){return this.updateTableMap.has(s)||this.updateTableMap.set(s,new He(s,this.cache)),this.updateTableMap.get(s)}getTable(s){var e=this;return Se(function*(){return new He(s,e.cache)})()}addItem(s,e,t,o){var r=this;return Se(function*(){return r.updateItem(s,{id:"".concat(new Date().getTime()),name:t,data:o})})()}updateItem(s,e){var t=this;return Se(function*(){var o=t.getUpdateTable(s),r=yield o.refreshItem(e.id),i=qe(qe({},r??{}),e);return Je.debug("Updating item",i),yield o.put(i),Je.debug("Update saved"),e})()}listenItem(s,e,t){var o=this.getUpdateTable(s);return o.onItemUpdate(e,t)}}const yt="SET_LAYOUT_STORAGE",fa=a=>({type:yt,payload:a});var{dh:xt}=globalThis;const ba=W.module("SettingsUtils");function va(a){return a.formatString!=null}function Ct(a){const s=kt.parse(window.navigator.userAgent),e=`${s.browser.name??""} ${Number(parseFloat(s.browser.version??""))||""}`,t=`${s.os.name??""} ${s.os.version??""}`;return{"Engine Version":a.get("deephaven.version")??"Unknown","Web UI Version":"0.95.0","Java Version":a.get("java.version")??"Unknown","Barrage Version":a.get("barrage.version")??"Unknown","Browser Name":e.trim()||"Unknown","OS Name":t.trim()||"Unknown"}}function Xe(a){return Array.from(a.entries()).filter(s=>s[1].version!==void 0).reduce((s,[e,t])=>({...s,[e]:t.version}),{})}function Te(a){const s=a==null?void 0:a.querySelector("input, select, textarea");s&&s.focus()}function Tt(a,s){return a.defaultFormatString===s.defaultFormatString}function Sa(a,s){return Tt(a,s)}function ya(a,s){return Tt(a,s)}function wt(a){return a!==""&&qt.isValidColumnName(a)}function z(a,s,e){if(!s||e.formatString==null||!va(e))return!1;switch(s){case"datetime":return V.isValid(a,e);case"decimal":return _.isValid(a,e);case"int":return M.isValid(a,e);default:return ba.warn("Trying to validate format of unknown type"),!0}}function xa(a){const{id:s,isNewRule:e,...t}=a;return t}function Ca(a,s){return wt(s.columnName)&&z(a,s.columnType,s.format)}function Dt(a){const{timestamp:s,timeZone:e,showTimeZone:t,showTSeparator:o,isGlobalOptions:r,legacyGlobalFormat:i}=a,l=ot(),c=m.useMemo(()=>new zt(l,[],{timeZone:e,showTimeZone:t,showTSeparator:o}),[l,t,o,e]),d=r?V.getGlobalFormats(t,o):V.getFormats(t,o);return i!=null&&!d.includes(i)&&d.unshift(i),n.jsx(n.Fragment,{children:d.map(h=>{const u=V.makeFormat("",h,V.TYPE_GLOBAL);return n.jsx("option",{value:h,"data-testid":"time-format",children:c.getFormattedString(s,R.dataType.DATETIME,"",u)},h)})})}function Ta(){return n.jsx(n.Fragment,{children:Jt.TIME_ZONES.map(a=>{const{label:s,value:e}=a;return n.jsx("option",{value:e,children:s},e)})})}const G=W.module("FormattingSectionContent"),te=class te extends m.PureComponent{constructor(e){super(e);b(this,"debouncedCommitChanges");b(this,"pendingUpdates");b(this,"containerRef");b(this,"getCachedDateTimeFormatOptions",ye((e,t,o,r=!1,i)=>{const{timestampAtMenuOpen:l}=this.state;return n.jsx(Dt,{timestamp:l,timeZone:e,showTimeZone:t,showTSeparator:o,isGlobalOptions:r,legacyGlobalFormat:i})}));this.debouncedCommitChanges=nt(this.commitChanges.bind(this),te.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),this.handleShowEmptyStringsChange=this.handleShowEmptyStringsChange.bind(this),this.handleShowNullStringsChange=this.handleShowNullStringsChange.bind(this),this.handleShowExtraGroupColumnChange=this.handleShowExtraGroupColumnChange.bind(this);const{defaultDateTimeFormat:t,defaultDecimalFormatOptions:o,defaultIntegerFormatOptions:r,showTimeZone:i,showTSeparator:l,timeZone:c,truncateNumbersWithPound:d,showEmptyStrings:h,showNullStrings:u,showExtraGroupColumn:p}=e;this.containerRef=X.createRef(),this.pendingUpdates=[],this.state={showTimeZone:i,showTSeparator:l,timeZone:c,defaultDateTimeFormat:t,defaultDecimalFormatOptions:o,defaultIntegerFormatOptions:r,truncateNumbersWithPound:d,showEmptyStrings:h,showNullStrings:u,showExtraGroupColumn:p,timestampAtMenuOpen:new Date}}componentDidMount(){Te(this.containerRef.current)}componentWillUnmount(){this.debouncedCommitChanges.flush()}queueUpdate(e){this.pendingUpdates.push(e),this.debouncedCommitChanges()}handleDefaultDateTimeFormatChange(e){G.debug("handleDefaultDateTimeFormatChange",e);const t={defaultDateTimeFormat:e};this.setState(t),this.queueUpdate(t)}handleDefaultDecimalFormatChange(e){G.debug("handleDefaultDecimalFormatChange",e.target.value);const t={defaultDecimalFormatOptions:{defaultFormatString:e.target.value}};this.setState(t),z(dh,R.dataType.DECIMAL,_.makeCustomFormat(e.target.value))&&this.queueUpdate(t)}handleDefaultIntegerFormatChange(e){G.debug("handleDefaultIntegerFormatChange",e.target.value);const t={defaultIntegerFormatOptions:{defaultFormatString:e.target.value}};this.setState(t),z(dh,R.dataType.INT,M.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:o,showTSeparator:r}=e;G.debug("handleResetDateTimeFormat"),this.setState({defaultDateTimeFormat:t,showTimeZone:o,showTSeparator:r}),this.queueUpdate({defaultDateTimeFormat:void 0,showTimeZone:void 0,showTSeparator:void 0})}handleResetTimeZone(){const{defaults:e}=this.props,{timeZone:t}=e;G.debug("handleResetTimeZone"),this.setState({timeZone:t}),this.queueUpdate({timeZone:void 0})}handleResetDecimalFormat(){const{defaults:e}=this.props,{defaultDecimalFormatOptions:t}=e;G.debug("handleResetDecimalFormat"),this.setState({defaultDecimalFormatOptions:t}),this.queueUpdate({defaultDecimalFormatOptions:void 0})}handleResetIntegerFormat(){const{defaults:e}=this.props,{defaultIntegerFormatOptions:t}=e;G.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)}handleShowEmptyStringsChange(){const{showEmptyStrings:e}=this.state,t={showEmptyStrings:!e};this.setState(t),this.queueUpdate(t)}handleShowNullStringsChange(){const{showNullStrings:e}=this.state,t={showNullStrings:!e};this.setState(t),this.queueUpdate(t)}handleShowExtraGroupColumnChange(){const{showExtraGroupColumn:e}=this.state,t={showExtraGroupColumn:!e};this.setState(t),this.queueUpdate(t)}commitChanges(){const{updateSettings:e}=this.props,t=this.pendingUpdates.reduce((o,r)=>({...o,...r}),{});this.pendingUpdates=[],e(t)}render(){const{defaults:e,dh:t}=this.props,{defaultDateTimeFormat:o,defaultDecimalFormatOptions:r,defaultIntegerFormatOptions:i,timeZone:l,showTimeZone:c,showTSeparator:d,truncateNumbersWithPound:h,showEmptyStrings:u,showNullStrings:p,showExtraGroupColumn:N}=this.state,{defaultFormatString:y=_.DEFAULT_FORMAT_STRING}=r??{},{defaultFormatString:f=M.DEFAULT_FORMAT_STRING}=i??{},S=l===e.timeZone,T=d===e.showTSeparator&&c===e.showTimeZone&&o===e.defaultDateTimeFormat,P=Sa(r,e.defaultDecimalFormatOptions),w=ya(i,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(ie,{className:"custom-select",value:l,onChange:this.handleTimeZoneChange,id:"select-reset-timezone",children:n.jsx(Ta,{})})}),n.jsx("div",{className:"col-1 btn-col",children:n.jsx(C,{kind:"ghost",icon:q,onClick:this.handleResetTimeZone,tooltip:"Reset Time Zone",className:I("btn-reset","btn-reset-time-zone",{hidden:S})})})]}),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(ie,{className:"custom-select",value:o,onChange:this.handleDefaultDateTimeFormatChange,id:"select-default-time-format",children:this.getCachedDateTimeFormatOptions(l,c,d,!0,o)})}),n.jsx("div",{className:"col-1 btn-col",children:n.jsx(C,{kind:"ghost",icon:q,onClick:this.handleResetDateTimeFormat,tooltip:"Reset DateTime Options",className:I("btn-reset","btn-reset-date-time",{hidden:T})})})]}),n.jsx("div",{className:"form-row",children:n.jsx("div",{className:"offset-3 col-9",children:n.jsx(H,{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(H,{checked:d??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:I("form-control","flex-grow-1","default-decimal-format-input",{"is-invalid":!z(t,R.dataType.DECIMAL,_.makeCustomFormat(y))}),"data-lpignore":!0,placeholder:_.DEFAULT_FORMAT_STRING,type:"text",id:"default-decimal-format-input",value:y,onChange:this.handleDefaultDecimalFormatChange})}),n.jsx("div",{className:"col-1 btn-col",children:n.jsx(C,{kind:"ghost",icon:q,onClick:this.handleResetDecimalFormat,tooltip:"Reset Decimal Formatting",className:I("btn-reset","btn-reset-decimal",{hidden:P}),"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:I("form-control","flex-grow-1","default-integer-format-input",{"is-invalid":!z(t,R.dataType.INT,M.makeCustomFormat(f))}),"data-lpignore":!0,placeholder:M.DEFAULT_FORMAT_STRING,type:"text",id:"default-integer-format-input",value:f,onChange:this.handleDefaultIntegerFormatChange})}),n.jsx("div",{className:"col-1 btn-col",children:n.jsx(C,{kind:"ghost",icon:q,onClick:this.handleResetIntegerFormat,tooltip:"Reset Integer Formatting",className:I("btn-reset","btn-reset-integer",{hidden:w}),"data-testid":"btn-reset-integer"})})]}),n.jsx("div",{className:"form-row mb-2",children:n.jsx("div",{className:"offset-3 col-9",children:n.jsx(H,{checked:h??null,onChange:this.handleTruncateNumbersWithPoundChange,children:"Show truncated numbers as ###"})})}),n.jsxs("div",{className:"form-row mb-3",children:[n.jsx("label",{className:"col-form-label col-3",htmlFor:"default-integer-format-input",children:"String"}),n.jsxs("div",{className:"col pr-0 pt-2",children:[n.jsxs(H,{checked:u??null,onChange:this.handleShowEmptyStringsChange,children:["Show empty strings as"," ",n.jsx("span",{className:"font-italic text-muted",children:"empty"})]}),n.jsxs(H,{checked:p??null,onChange:this.handleShowNullStringsChange,children:["Show null strings as"," ",n.jsx("span",{className:"font-italic text-muted",children:"null"})]})]})]}),n.jsxs("div",{className:"form-row mb-3",id:"show_extra_group_column_div",children:[n.jsx("label",{className:"col-form-label col-3",htmlFor:"default-show-extra-group-column",children:"Rollup"}),n.jsx("div",{className:"col pr-0 pt-2",id:"default-show-extra-group-column",children:n.jsx(H,{checked:N,onChange:this.handleShowExtraGroupColumnChange,children:'Show extra "group" column'})})]})]})})}};b(te,"defaultProps",{scrollTo:()=>{}}),b(te,"inputDebounceTime",250);let we=te;const wa=a=>({defaultDateTimeFormat:Xt(a),defaultDecimalFormatOptions:rt(a),defaultIntegerFormatOptions:it(a),dh:lt(a),showTimeZone:ct(a),showTSeparator:dt(a),truncateNumbersWithPound:Qt(a),showEmptyStrings:es(a),showNullStrings:ts(a),showExtraGroupColumn:ss(a),timeZone:ut(a),defaults:ns(a)}),Da=de(wa,{updateSettings:ne})(we);function ja(){const[a,s]=m.useState(!1),e=()=>{s(!a)};return n.jsxs(n.Fragment,{children:[n.jsx(C,{kind:"ghost",onClick:e,icon:Xs,children:"Legal Notices"}),n.jsxs(Qs,{isOpen:a,toggle:e,children:[n.jsx(en,{toggle:e,children:"Legal Notice"}),n.jsxs(tn,{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 B(a){const{children:s,isExpanded:e,sectionKey:t,title:o,onToggle:r}=a;return n.jsxs(n.Fragment,{children:[n.jsx("div",{children:n.jsxs(C,{kind:"ghost",className:"btn-collapse-trigger",onClick:()=>r(t),children:[n.jsx("div",{className:"flex-grow-1",children:o}),n.jsx("div",{className:"flex-shrink-0",children:n.jsx(F,{transform:e?"flip-v":"",icon:sn})})]})}),n.jsx(Rn,{in:e,autoFocusOnShow:!0,children:s})]})}B.propTypes={children:j.node,isExpanded:j.bool.isRequired,sectionKey:j.string.isRequired,title:j.node.isRequired,onToggle:j.func};B.defaultProps={children:null,onToggle:()=>{}};function Na({shortcut:a,displayText:s,categoryName:e,onChange:t}){const[o,r]=m.useState(s),[i,l]=m.useState(a.getKeyState()),[c,d]=m.useState(!1),[h,u]=m.useState("");m.useEffect(function(){r(s),l(a.getKeyState())},[s,a]),m.useEffect(function(){r(A.getDisplayText(i)),a.matchesKeyState(i)&&d(!1)},[i,a]),m.useEffect(function(){if(c){if(!A.isValidKeyState(i)){A.isAllowedKey(i.keyValue)?u("Must contain a modifier key"):u("Must contain an allowed action key");return}const g=Ee.getConflictingShortcuts(i).filter(v=>v.id.startsWith(e)&&v!==a).map(v=>v.name);if(g.length){u(`Conflicts with ${g.join(", ")}`);return}u("")}else u("")},[c,i,e,a]);function p(w){if(w.stopPropagation(),w.preventDefault(),a.isEditable&&!w.repeat){const g=A.getKeyStateFromEvent(w),v=A.createKeyState([as.BACKSPACE]);A.doKeyStatesMatch(g,v)?l(A.NULL_KEY_STATE):l(g)}}function N(w){w.stopPropagation(),w.preventDefault(),a.matchesKeyState(i)||d(!0)}function y(){Le.disableAllActions()}function f(){Le.enableAllActions()}function S(){a.setKeyState(i),d(!1),t(a)}function T(){const w=a.getKeyState();l(w),d(!1)}function P(){d(!0),l(a.getDefaultKeyState())}return n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"shortcut-item-container",children:[n.jsxs("label",{className:"shortcut-item-name",children:[a.name,a.tooltip!==void 0&&n.jsx(ht,{children:a.tooltip})]}),n.jsxs("div",{className:"shortcut-item-input-container",children:[n.jsx("input",{className:I("form-control",{"is-invalid":h}),onKeyDown:p,onKeyUp:N,onFocus:y,onBlur:f,disabled:!a.isEditable,value:o,readOnly:!0}),!A.doKeyStatesMatch(i,a.getDefaultKeyState())&&!h&&n.jsx(C,{className:"reset-to-default-button",kind:"ghost",icon:n.jsx(F,{icon:q,transform:{rotate:90,flipX:!0}}),tooltip:"Reset to default",onClick:P})]})]}),c&&n.jsxs("div",{className:I("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:[A.isValidKeyState(i)&&n.jsx(C,{kind:"ghost",onClick:S,children:"Confirm"}),n.jsx(C,{kind:"ghost",onClick:T,children:"Undo"})]})]})]})}function Ea({shortcutOverrides:a={},updateSettings:s}){const e=m.useCallback(i=>{const l=A.isMacPlatform,c={mac:{...a.mac},windows:{...a.windows}},d=l?c.mac:c.windows;i.forEach(h=>{h.isDefault()?delete d[h.id]:d[h.id]=h.getKeyState()}),s({shortcutOverrides:c})},[s,a]);let t=Array.from(Ee.shortcutsByCategory.entries()).map(([i,l])=>({name:i,shortcuts:l}));const o=t.findIndex(i=>i.name.toUpperCase()==="GLOBAL"),r=t.splice(o,1);return t=t.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."}),t.map(i=>n.jsx(Fa,{name:i.name,shortcuts:i.shortcuts,saveShortcutOverrides:e},i.name))]})}function Fa({name:a,shortcuts:s,saveShortcutOverrides:e}){function t(c){return c.split("_").map(d=>`${d[0].toUpperCase()}${d.slice(1).toLowerCase()}`).join(" ")}const[o,r]=m.useState(s);function i(c){const d=o.filter(u=>u!==c&&!u.isNull()&&u.matchesKeyState(c.getKeyState()));d.forEach(u=>u.setToNull());const h=[c,...d];e(h),r(u=>[...u])}const l=m.useMemo(()=>o.map(c=>c.getDisplayText()),[o]);return n.jsxs("div",{className:"mt-3",children:[n.jsx("div",{className:"font-weight-bold",children:t(a)}),o.map((c,d)=>n.jsx(Na,{shortcut:c,displayText:l[d],categoryName:a,onChange:i},c.id))]})}const Ra=a=>({shortcutOverrides:os(a)}),Ia={updateSettings:ne},Oa=de(Ra,Ia)(Ea),La="yyyy-MM-dd-HHmmss",Pa=[["api"],["client"],["dashboardData","default","connection"],["dashboardData","default","sessionWrapper","dh"],["layoutStorage"],["storage"]];function Fe(a){const s=new Map;return function(t,o){const r=[...s.get(this)??[],t];o===Object(o)&&s.set(o,[...r]),r.shift();for(let i=0;i<a.length;i+=1)if(r.length===a[i].length&&r.every((l,c)=>l===a[i][c]))return;return o}}function jt(a,s,e="root",t=new Map([[a,""]])){const o={};return Object.entries(a).forEach(([r,i])=>{try{JSON.stringify(i,Fe(s)),o[r]=i}catch{const c=i;if(typeof i=="bigint")o[r]=i.toString();else if(t.has(c))o[r]=`Circular ref to ${t.get(c)}`;else{const d=`${e}.${r}`;t.set(c,d),o[r]=jt(i,s,d,t)}}}),o}function ka(a){const s=an.getState();return JSON.stringify(jt(s,a),Fe(a),2)}function Aa(a,s){const e={uiVersion:"0.95.0",userAgent:navigator.userAgent,...s};return JSON.stringify(e,Fe(a),2)}async function Ma(a=`${xt.i18n.DateTimeFormat.format(La,new Date)}_support_logs`,s,e=Pa){const t=new at,o=t.folder(a);o.file("console.txt",nn.getFormattedHistory()),o.file("redux.json",ka(e)),o.file("metadata.json",Aa(e,s));const r=await t.generateAsync({type:"blob"}),i=document.createElement("a");i.href=URL.createObjectURL(r),i.download=`${a}.zip`,i.click()}const _a=[{value:R.dataType.DATETIME,label:"DateTime"},{value:R.dataType.DECIMAL,label:"Decimal"},{value:R.dataType.INT,label:"Integer"}];function Ua(){const a=_a.map(s=>n.jsx("option",{value:s.value,children:s.label},`key-columnType-${s.value}`));return n.jsxs(n.Fragment,{children:[n.jsx("option",{disabled:!0,value:"",children:"Select Type"},"key-columnType-placeholder"),a]})}const se=class se extends m.PureComponent{constructor(e){super(e);b(this,"debouncedCommitChanges");b(this,"containerRef");b(this,"addFormatRuleButtonRef");b(this,"lastFormatRuleIndex");b(this,"getCachedColumnTypeOptions",ye(()=>n.jsx(Ua,{})));b(this,"getCachedDateTimeFormatOptions",ye((e,t,o,r=!1,i)=>{const{timestampAtMenuOpen:l}=this.state;return n.jsx(Dt,{timestamp:l,timeZone:e,showTimeZone:t,showTSeparator:o,isGlobalOptions:r,legacyGlobalFormat:i})}));this.debouncedCommitChanges=nt(this.commitChanges.bind(this),se.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:o,showTSeparator:r,timeZone:i}=e,l=t.map((c,d)=>({...c,id:d}));this.containerRef=X.createRef(),this.addFormatRuleButtonRef=X.createRef(),this.lastFormatRuleIndex=l.length,this.state={formatSettings:l,formatRulesChanged:!1,showTimeZone:o,showTSeparator:r,timeZone:i,timestampAtMenuOpen:new Date}}componentDidMount(){Te(this.containerRef.current)}componentWillUnmount(){this.debouncedCommitChanges.flush()}isDuplicateRule(e){const{formatSettings:t}=this.state;return t.some(o=>o.id!==e.id&&o.columnName===e.columnName&&o.columnType===e.columnType)??!1}getAutoIncrementFormatRuleIndex(){const{lastFormatRuleIndex:e}=this;return this.lastFormatRuleIndex+=1,e}handleFormatRuleChange(e,t,o){this.setState(r=>{const{formatSettings:i}=r;ce(i);const l=[...i];let c={};t==="columnType"&&(c={format:this.makeDefaultFormatterItemByType(o)});const d={...l[e],...c,[t]:o};return l[e]=d,{formatSettings:l}},()=>{this.debouncedCommitChanges()})}handleFormatRuleCreate(){this.setState(e=>{const{formatSettings:t}=e,o={columnType:R.dataType.DATETIME,columnName:"",format:{},id:this.getAutoIncrementFormatRuleIndex(),isNewRule:!0};return{formatSettings:[...t,o],formatRulesChanged:!0}})}handleFormatRuleDelete(e){this.setState(t=>{const{formatSettings:o}=t;return{formatSettings:o.filter((i,l)=>l!==e),formatRulesChanged:!0}},()=>{this.debouncedCommitChanges()})}handleFormatRuleEntered(e){this.scrollToFormatBlockBottom(),Te(e)}commitChanges(){const{formatSettings:e}=this.state,{dh:t}=this.props,o=e.filter(l=>Ca(t,l)).map(xa)??[],{updateSettings:r}=this.props;r({formatter:o})}scrollToFormatBlockBottom(){var t,o;const{scrollTo:e}=this.props;e(0,(((t=this.addFormatRuleButtonRef.current)==null?void 0:t.offsetHeight)??0)+(((o=this.addFormatRuleButtonRef.current)==null?void 0:o.offsetTop)??0))}getRuleError(e){const{dh:t}=this.props,o={hasColumnNameError:!1,hasFormatError:!1,message:""},r=[];return e.isNewRule!==void 0&&e.isNewRule||(this.isDuplicateRule(e)&&(o.hasColumnNameError=!0,r.push("Duplicate column name/type combo.")),wt(e.columnName)||(o.hasColumnNameError=!0,r.push("Column names must start with a letter or underscore and contain only alphanumeric characters or underscores.")),e.format.formatString!=null&&e.format.formatString.length===0?(o.hasFormatError=!0,r.push("Empty formatting rule.")):z(t,e.columnType,e.format)||(o.hasFormatError=!0,r.push("Invalid formatting rule.")),o.message=r.join(`
3
3
  `)),o}makeDefaultFormatterItemByType(e){switch(R.getNormalizedType(e)){case R.dataType.INT:{const{defaultIntegerFormatOptions:t}=this.props,{defaultFormatString:o}=t;return M.makeFormat("",o??M.DEFAULT_FORMAT_STRING,M.TYPE_GLOBAL,void 0)}case R.dataType.DECIMAL:{const{defaultDecimalFormatOptions:t}=this.props,{defaultFormatString:o}=t;return _.makeFormat("",o??_.DEFAULT_FORMAT_STRING,_.TYPE_GLOBAL,void 0)}default:return""}}renderFormatRule(e,t){const o=`input-${e}-columnName`,r=`input-${e}-columnType`,i=`input-${e}-format`,l=this.getCachedColumnTypeOptions(),c=p=>this.handleFormatRuleChange(e,"columnName",p.target.value),d=()=>this.handleFormatRuleChange(e,"isNewRule",!1),h=p=>this.handleFormatRuleChange(e,"columnType",p),u=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:o,children:"Column Name"}),n.jsx("input",{id:o,className:I("form-control",{"is-invalid":u.hasColumnNameError}),"data-lpignore":!0,type:"text",value:t.columnName,onChange:c,onBlur:d})]}),n.jsxs("div",{className:"form-group col mb-2",children:[n.jsx(C,{kind:"ghost",className:"btn-delete-format-rule float-right",tabIndex:-1,onClick:()=>this.handleFormatRuleDelete(e),icon:on,tooltip:"Delete","aria-label":"Delete Format Rule"}),n.jsx("label",{htmlFor:r,children:"Column Type"}),n.jsx(ie,{id:r,className:"custom-select",value:t.columnType,onChange:h,children:l})]})]}),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:i,children:"Formatting Rule"}),this.renderFormatRuleInput(e,t.columnType,i,t.format,u.hasFormatError)]})}),n.jsx("div",{className:"form-row",children:n.jsx("div",{className:"form-group col-12 d-flex mb-2",children:u.message&&n.jsx("p",{className:"text-danger",children:u.message})})})]},e)}renderFormatRuleInput(e,t,o,r,i){switch(R.getNormalizedType(t)){case R.dataType.DATETIME:return this.renderDateTimeFormatRuleInput(e,o,r,i);case R.dataType.DECIMAL:return this.renderDecimalFormatRuleInput(e,o,r,i);case R.dataType.INT:return this.renderIntegerFormatRuleInput(e,o,r,i);default:throw new Error(`Unrecognized column type: ${t}`)}}renderDateTimeFormatRuleInput(e,t,o,r){const{showTimeZone:i,showTSeparator:l,timeZone:c}=this.state,d=o.formatString??"";return n.jsxs(ie,{className:I("custom-select",{"is-invalid":r}),value:d,id:t,onChange:h=>{const u=V.makeFormat("",h,V.TYPE_GLOBAL);this.handleFormatRuleChange(e,"format",u)},children:[n.jsx("option",{value:"",disabled:!0,children:"Select format"},"default"),this.getCachedDateTimeFormatOptions(c,i,l)]})}renderIntegerFormatRuleInput(e,t,o,r){const{defaultIntegerFormatOptions:i}=this.props;ce(i);const{defaultFormatString:l}=i,c=o.formatString??"";return n.jsx("input",{className:I("form-control","flex-grow-1",{"is-invalid":r}),"data-lpignore":!0,id:t,placeholder:l??M.DEFAULT_FORMAT_STRING,type:"text",value:c,onChange:d=>{const h=M.makeFormat("",d.target.value,M.TYPE_GLOBAL,void 0);this.handleFormatRuleChange(e,"format",h)}})}renderDecimalFormatRuleInput(e,t,o,r){const{defaultDecimalFormatOptions:i}=this.props,{defaultFormatString:l}=i,c=o.formatString??"";return n.jsx("input",{className:I("form-control","flex-grow-1",{"is-invalid":r}),"data-lpignore":!0,id:t,placeholder:l??_.DEFAULT_FORMAT_STRING,type:"text",value:c,onChange:d=>{const h=_.makeFormat("",d.target.value,_.TYPE_GLOBAL,void 0);this.handleFormatRuleChange(e,"format",h)}})}render(){const{formatRulesChanged:e,formatSettings:t}=this.state,o=t.map((i,l)=>n.jsx(rs,{onEnter:this.handleFormatRuleEntered,children:this.renderFormatRule(l,i)},i.id)),r=n.jsx(C,{kind:"ghost",className:"mb-3",onClick:this.handleFormatRuleCreate,ref:this.addFormatRuleButtonRef,icon:rn,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(At,{appear:e,enter:e,exit:e,children:o}),r]})}};b(se,"defaultProps",{scrollTo:()=>{}}),b(se,"inputDebounceTime",250);let De=se;const Ka=a=>({formatter:is(a),defaultDecimalFormatOptions:rt(a),defaultIntegerFormatOptions:it(a),dh:lt(a),showTimeZone:ct(a),showTSeparator:dt(a),timeZone:ut(a)}),$a=de(Ka,{updateSettings:ne})(De);function Wa(){const a=Ne(),s=xe(ls),e=xe(cs),t=m.useCallback(r=>{a(ne({webgl:r}))},[a]),o=e?n.jsx(ge,{children:"WebGL in most cases has significant performance improvements, particularly when plotting large datasets. However, in some environments (such as remote desktop environments), WebGL may not use hardware acceleration and have degraded performance. If you are experiencing issues with WebGL, you can disable it here."}):n.jsx(ge,{children:"WebGL is disabled by your system administrator. Contact your system administrator to enable."});return n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"app-settings-menu-description",children:"Advanced settings here. Be careful!"}),n.jsxs("div",{className:"form-row mb-3 pl-1",children:[n.jsx(Mt,{isSelected:s,isDisabled:!e,onChange:t,marginEnd:"size-0",children:"Enable WebGL"}),n.jsxs(_t,{variant:"info",marginTop:"size-50",children:[n.jsx(In,{children:"Enable WebGL"}),n.jsx(Ut,{children:n.jsx(ge,{children:o})})]})]})]})}function Ga(){const a=ds(),s=xe(us),e=Ne(),t=m.useCallback(r=>{if(r!=="regular"&&r!=="compact"&&r!=="spacious")throw new Error(`Invalid grid density value: ${r}`);e(ne({gridDensity:r}))},[e]),o=s.gridDensity;return ce(a,"ThemeContext value is null"),n.jsxs(n.Fragment,{children:[n.jsx(On,{}),n.jsxs(Ln,{label:"Default table density",selectedKey:o,onChange:t,children:[n.jsx(he,{children:"Regular"},"regular"),n.jsx(he,{children:"Compact"},"compact"),n.jsx(he,{children:"Spacious"},"spacious")]})]})}const x=class x extends m.Component{constructor(e){super(e);b(this,"menuContentRef");b(this,"broadcastChannel");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(Pn),this.state={expandedSectionKey:x.FORMATTING_SECTION_KEY}}static focusFirstInputInContainer(e){const t=e==null?void 0:e.querySelector("input, select, textarea");t&&t.focus()}componentDidMount(){x.focusFirstInputInContainer(this.menuContentRef.current)}componentWillUnmount(){this.broadcastChannel.close()}isSectionExpanded(e){const{expandedSectionKey:t}=this.state;return t===e}handleLogout(){this.broadcastChannel.postMessage(kn(An))}handleScrollTo(e,t){var o;(o=this.menuContentRef.current)==null||o.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,pluginData:t}=this.props,o=Xe(t);Ma(void 0,{...Object.fromEntries(e),pluginInfo:o})}render(){const e="https://github.com/deephaven/web-client-ui/",t="https://deephaven.io/core/docs/",{serverConfigValues:o,pluginData:r,user:i}=this.props,l=Ct(o),c=Xe(r),d=o.get("deephaven.version"),h=Y.COPY_VERSION_INFO.getDisplayText(),u=(f,S)=>n.jsxs(m.Fragment,{children:[n.jsx("div",{children:f}),n.jsx("div",{children:S})]},f),p=i.displayName??i.name,N=i.image!=null&&i.image!=="",y=p!=="";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:[!N&&n.jsx(F,{icon:ln,transform:"grow-8"}),N&&n.jsx("img",{src:i.image,alt:p})]}),n.jsxs("div",{className:"user-details",children:[y&&n.jsxs("div",{className:"user-name",children:[p,i.operateAs!=null&&i.name!==i.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(F,{icon:cn,className:"mr-1"}),i.operateAs]})]})]}),i.permissions.canLogout&&n.jsx("button",{type:"button",className:"btn btn-link",onClick:this.handleLogout,children:"logout"})]})]}),n.jsx(C,{kind:"ghost",className:"btn-close-settings-menu",onClick:this.handleClose,icon:n.jsx(F,{icon:dn,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(B,{sectionKey:x.FORMATTING_SECTION_KEY,isExpanded:this.isSectionExpanded(x.FORMATTING_SECTION_KEY),title:n.jsxs(n.Fragment,{children:[n.jsx(F,{icon:un,transform:"grow-4",className:"mr-2"}),"Default Format & Time zone"]}),onToggle:this.handleSectionToggle,children:n.jsx(Da,{})}),n.jsx(B,{sectionKey:x.COLUMN_SPECIFIC_SECTION_KEY,isExpanded:this.isSectionExpanded(x.COLUMN_SPECIFIC_SECTION_KEY),title:n.jsxs(n.Fragment,{children:[n.jsx(F,{icon:hn,transform:"grow-4",className:"mr-2"}),"Format by Column Name & Type"]}),onToggle:this.handleSectionToggle,children:n.jsx($a,{scrollTo:this.handleScrollTo})}),n.jsx(B,{sectionKey:x.THEME_SECTION_KEY,isExpanded:this.isSectionExpanded(x.THEME_SECTION_KEY),onToggle:this.handleSectionToggle,title:n.jsxs(n.Fragment,{children:[n.jsx(F,{icon:mn,transform:"grow-4",className:"mr-2"}),"Theme"]}),children:n.jsx(Ga,{})}),n.jsx(B,{sectionKey:x.SHORTCUT_SECTION_KEY,isExpanded:this.isSectionExpanded(x.SHORTCUT_SECTION_KEY),title:n.jsxs(n.Fragment,{children:[n.jsx(F,{icon:pn,transform:"grow-2",className:"mr-2"}),"Keyboard Shortcuts"]}),onToggle:this.handleSectionToggle,children:n.jsx(Oa,{})}),n.jsx(B,{sectionKey:x.ADVANCED_SECTION_KEY,isExpanded:this.isSectionExpanded(x.ADVANCED_SECTION_KEY),title:n.jsxs(n.Fragment,{children:[n.jsx(F,{icon:gn,transform:"grow-4",className:"mr-2"}),"Advanced"]}),onToggle:this.handleSectionToggle,children:n.jsx(Wa,{})}),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:e,className:"custom-link",target:"_blank",rel:"noopener noreferrer",children:e})]}),n.jsx(C,{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:t,className:"custom-link",children:t})]}),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:[d," ",n.jsx(F,{icon:fn}),n.jsxs(ht,{interactive:!0,children:[n.jsx("div",{className:"detailed-server-config",children:Object.entries(l).map(([f,S])=>u(f,S))}),n.jsxs(hs,{kind:"inline",tooltip:"Copy version numbers",copy:Object.entries({...l,...c}).map(([f,S])=>`${f}: ${S}`).join(`
4
4
  `),children:["Copy Versions",n.jsxs("small",{className:"text-muted",children:["(",h,")"]})]})]})]})]}),n.jsxs("div",{className:"app-settings-footer-item",children:[n.jsx("div",{className:"font-weight-bold",children:"Plugins"}),n.jsx("div",{className:"container",children:Array.from(r.entries()).filter(f=>f[1].version!==void 0).map(([f,S])=>n.jsxs("div",{className:"row justify-content-start align-items-center",children:[n.jsx("div",{className:"col pl-0",children:n.jsx("span",{className:"my-0 text-truncate",children:f})}),n.jsx("div",{className:"col-auto",children:n.jsx("span",{children:S==null?void 0:S.version})})]},f))})]}),n.jsx("div",{className:"app-settings-footer-item",children:n.jsx(ja,{})})]}),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(bt,{})})})]})]})]})}};b(x,"defaultProps",{onDone:()=>{}}),b(x,"FORMATTING_SECTION_KEY","SettingsMenu.formatting"),b(x,"COLUMN_SPECIFIC_SECTION_KEY","SettingsMenu.columnFormatting"),b(x,"APPLICATION_SECTION_KEY","ApplicationMenu.settings"),b(x,"SHORTCUT_SECTION_KEY","SettingsMenu.shortcuts"),b(x,"THEME_SECTION_KEY","SettingsMenu.theme"),b(x,"ADVANCED_SECTION_KEY","SettingsMenu.advanced");let je=x;const Qe=10;function J(a){const{forwardedProps:{menuItem:{action:s,title:e,disabled:t},iconElement:o,displayShortcut:r,isMouseSelected:i,isKeyboardSelected:l,closeMenu:c}}=a,d=m.useRef(),h=m.useRef(),u=m.useRef(null),[p,N]=m.useState(!1),y=m.useCallback(T=>{d.current!=null&&h.current!=null&&u.current&&(Math.abs(d.current-T.clientX)>=Qe||Math.abs(h.current-T.clientY)>=Qe)&&(N(!0),window.removeEventListener("mousemove",y),c(),s(T),u.current=null)},[s,c]);function f(T){d.current=T.clientX,h.current=T.clientY,u.current=T.target,window.addEventListener("mousemove",y)}function S(T){u.current===T.target&&(N(!0),c(),s(),window.removeEventListener("mousemove",y)),u.current=null}return m.useEffect(function(){return function(){return window.removeEventListener("mousemove",y)}},[y]),n.jsxs("button",{type:"button",className:I("btn-context-menu",{disabled:t},{active:i&&!t},{"keyboard-active":l&&!t}),onMouseDown:f,onMouseUp:S,disabled:p,children:[n.jsx("span",{className:I("icon"),children:o}),n.jsx("span",{className:"title",children:e}),n.jsx("span",{className:"shortcut",children:r})]})}function Re(a){const{handleControlSelect:s,handleToolSelect:e,onClearFilter:t}=a,o=m.useMemo(()=>[{title:"Input Filter",icon:bn,menuElement:n.jsx(J,{}),action:r=>{s($.INPUT_FILTER,r)},order:10},{title:"Dropdown Filter",icon:vn,menuElement:n.jsx(J,{}),action:r=>{s($.DROPDOWN_FILTER,r)},order:15},{title:"Markdown Widget",icon:Sn,menuElement:n.jsx(J,{}),action:r=>{s($.MARKDOWN,r)},order:20},{title:"Filter Sets",icon:yn,menuElement:n.jsx(J,{}),action:r=>{s($.FILTER_SET_MANAGER,r)},order:25},{disabled:!0,menuElement:n.jsx("div",{className:"context-menu-group-header",children:"Tools"}),order:30},{title:"Linker",icon:xn,action:()=>{e(le.LINKER)},order:40,shortcut:Y.LINKER},{disabled:!0,menuElement:n.jsx("div",{className:"context-menu-group-header",children:"Actions"}),order:50},{title:"Clear All Filters",icon:Cn,action:()=>{t()},order:60,shortcut:vt.TABLE.CLEAR_ALL_FILTERS}],[s,e,t]);return n.jsx(ms,{popperClassName:"controls-menu-popper",actions:o})}Re.propTypes={handleControlSelect:j.func,handleToolSelect:j.func,onClearFilter:j.func};Re.defaultProps={handleControlSelect:()=>{},handleToolSelect:()=>{},onClearFilter:()=>{}};J.propTypes={forwardedProps:j.shape({iconElement:j.node,displayShortcut:j.string,isMouseSelected:j.bool.isRequired,isKeyboardSelected:j.bool.isRequired,closeMenu:j.func.isRequired,menuItem:j.shape({action:j.func,title:j.string,disabled:j.bool}).isRequired})};J.defaultProps={forwardedProps:null};const Ba=Tn(yt,null),Va={layoutStorage:Ba},Ha=a=>a.layoutStorage,Za=a=>a.serverConfigValues;Object.entries(Va).map(([a,s])=>wn.register(a,s));const et=10;function Ya(a){const{onExportLayout:s,onImportLayout:e,onResetLayout:t,onSelect:o,widgets:r=[]}=a,[i,l]=m.useState(!1),[c,d]=m.useState(""),h=m.useRef(null),u=m.useRef(),p=m.useCallback((g,v)=>{g!=null&&o(g,v)},[o]),N=m.useCallback(g=>{d(g.target.value)},[]),y=m.useCallback(g=>{u.current!=null&&(Math.abs(u.current.x-g.clientX)>=et||Math.abs(u.current.y-g.clientY)>=et)&&(l(!0),window.removeEventListener("mousemove",y),p(u.current.widget,g),u.current=void 0)},[u,p]),f=m.useCallback((g,v)=>{u.current={x:g.clientX,y:g.clientY,widget:v},window.addEventListener("mousemove",y)},[y]),S=m.useCallback((g,v)=>{var K;window.removeEventListener("mousemove",y),((K=u.current)==null?void 0:K.widget)===v&&(l(!0),p(v)),u.current=void 0},[y,u,p]),T=m.useMemo(()=>r.filter(g=>{var v;return c?(v=g.name)==null?void 0:v.toLowerCase().includes(c.toLowerCase()):!0}),[c,r]).sort((g,v)=>{var K;return((K=g.name)==null?void 0:K.localeCompare(v.name??""))??0}),P=m.useMemo(()=>T.map(g=>n.jsx("li",{children:n.jsxs(C,{kind:"ghost","data-testid":`panel-list-item-${g.name??""}-button`,onMouseDown:v=>{f(v,g)},onMouseUp:v=>{S(v,g)},onKeyDown:v=>{(v.key==="Enter"||v.key===" ")&&p(g)},disabled:i,onClick:()=>{},children:[n.jsx(ps,{type:g.type})," ",g.name??""]})},g.name)),[T,i,f,S,p]),w=m.useMemo(()=>P.length===0?n.jsx("span",{children:"No bound variables found."}):null,[P]);return n.jsxs("div",{className:"widget-list-container d-flex flex-column",children:[n.jsx("div",{className:"widget-list-header",children:n.jsx(gs,{value:c,placeholder:"Find Table, Plot or Widget",onChange:N,ref:h})}),n.jsxs("ul",{className:"widget-list flex-grow-1",children:[w&&n.jsx("li",{className:"widget-list-message",children:w}),!w&&P]}),n.jsx("div",{children:n.jsx("hr",{})}),n.jsxs("div",{className:"widget-list-footer",children:[n.jsxs(C,{kind:"ghost",onClick:s,children:[n.jsxs("div",{className:"fa-md fa-layers",children:[n.jsx(F,{mask:ke,icon:Ae,transform:"right-5 down-5"}),n.jsx(F,{icon:Ae,transform:"right-8 down-6"})]}),"Export Layout"]}),n.jsxs(C,{kind:"ghost",onClick:e,children:[n.jsxs("div",{className:"fa-md fa-layers",children:[n.jsx(F,{mask:ke,icon:Me,transform:"right-5 down-5"}),n.jsx(F,{icon:Me,transform:"right-8 down-6"})]}),"Import Layout"]}),n.jsx(C,{kind:"ghost",icon:q,onClick:t,tooltip:"Reset Layout"})]})]})}function qa({onAutoFillClick:a=()=>{}}){return n.jsxs("div",{className:"empty-dashboard-container",children:[n.jsxs("div",{className:"hint-container",children:[n.jsx(F,{icon:Dn})," ",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(C,{kind:"tertiary",onClick:a,children:"Auto fill objects"})]})]})}const E=W.module("AppMainContainer");class ee extends m.Component{constructor(e){super(e);b(this,"dashboardLayouts");b(this,"importElement");b(this,"widgetListenerRemover");b(this,"getDashboardPlugins",Wt(e=>Kn(e)));js(this),this.importElement=X.createRef();const{allDashboardData:t}=this.props;this.dashboardLayouts=new Map,this.state={contextActions:[{action:()=>{const{serverConfigValues:o}=this.props,r=Ct(o),i=Object.entries(r).map(([l,c])=>`${l}: ${c}`).join(`
5
- `);Ns(i)},shortcut:Y.COPY_VERSION_INFO,isGlobal:!0},{action:()=>{this.handleToolSelect(le.LINKER)},shortcut:Y.LINKER,isGlobal:!0},{action:()=>{this.sendClearFilter()},shortcut:vt.TABLE.CLEAR_ALL_FILTERS,isGlobal:!0},{action:()=>{this.sendReopenLast()},shortcut:Y.REOPEN_CLOSED_PANEL,isGlobal:!0},{action:()=>{E.debug("Consume unhandled save shortcut")},shortcut:Y.SAVE,isGlobal:!0}],isPanelsMenuShown:!1,isResetLayoutPromptShown:!1,isSettingsMenuShown:!1,unsavedNotebookCount:0,widgets:[],tabs:Object.entries(t).map(([o,r])=>({key:o,title:r.title??"Untitled",isClosable:o!==D,icon:o===D?jn:void 0})),activeTabKey:D,layoutIteration:0}}static handleWindowBeforeUnload(e){e.preventDefault(),e.returnValue=""}static hydrateConsole(e,t){return Ds.hydrate({...e,unzip:o=>at.loadAsync(o).then(r=>Object.values(r.files))},t)}static handleRefresh(){E.info("Refreshing application"),window.location.reload()}componentDidMount(){this.initWidgets(),this.initDashboardData(),window.addEventListener("beforeunload",ee.handleWindowBeforeUnload)}componentDidUpdate(e,t){const{dashboardData:o}=this.props;e.dashboardData!==o&&this.handleDataChange(o)}componentWillUnmount(){this.deinitWidgets(),this.dashboardLayouts.forEach(e=>{_e(e.eventHub,this.handleCreateDashboard)}),window.removeEventListener("beforeunload",ee.handleWindowBeforeUnload)}initWidgets(){const{connection:e}=this.props;if(e!=null){if(e.subscribeToFieldUpdates==null){E.warn("subscribeToFieldUpdates not supported, not initializing widgets");return}this.widgetListenerRemover=e.subscribeToFieldUpdates(t=>{E.debug("Got updates",t),this.setState(({widgets:o})=>{const{updated:r,created:i,removed:l}=t,c=[...r,...l],d=o.filter(u=>!c.some(p=>p.name===u.name));return[...r,...i].forEach(u=>{u.name!=null&&u.name!==""&&d.push(u)}),{widgets:d}})})}}deinitWidgets(){var e;(e=this.widgetListenerRemover)==null||e.call(this)}initDashboardData(){const{setDashboardPluginData:e,updateDashboardData:t,workspace:o}=this.props,{data:r}=o,{filterSets:i,links:l,pluginDataMap:c}=r;if(t(D,{filterSets:i,links:l}),c!=null){const d=Object.keys(c);for(let h=0;h<d.length;h+=1){const u=d[h],p=c[u];E.debug("initDashboardData plugin data",u,p),e(D,u,p)}}}openNotebookFromURL(){const{match:e}=this.props,{notebookPath:t}=e.params;if(t){const{session:o,sessionConfig:r}=this.props;if(o==null||r==null){E.error("No session available to open notebook URL",t);return}const i={id:`/${t}`,itemName:`/${t}`},l=r.type,c={value:null,language:l};this.emitLayoutEvent(Es.SELECT_NOTEBOOK,o,l,c,i,!0)}}sendClearFilter(){this.emitLayoutEvent(ae.CLEAR_ALL_FILTERS)}sendReopenLast(){this.emitLayoutEvent(Fs.REOPEN_LAST)}getActiveEventHub(){const{activeTabKey:e}=this.state,t=this.dashboardLayouts.get(e);return ce(t,"No active layout found"),t.eventHub}emitLayoutEvent(e,...t){this.getActiveEventHub().emit(e,...t)}handleCancelResetLayoutPrompt(){this.setState({isResetLayoutPromptShown:!1})}handleConfirmResetLayoutPrompt(){this.setState({isResetLayoutPromptShown:!1}),this.resetLayout()}handleError(e){Z.isCanceled(e)||E.error(e)}handleSettingsMenuHide(){this.setState({isSettingsMenuShown:!1})}handleSettingsMenuShow(){this.setState({isSettingsMenuShown:!0})}handleControlSelect(e,t){switch(E.debug("handleControlSelect",e),e){case $.DROPDOWN_FILTER:this.emitLayoutEvent(ae.OPEN_DROPDOWN,{title:"DropdownFilter",type:e,createNewStack:!0,dragEvent:t});break;case $.INPUT_FILTER:this.emitLayoutEvent(ae.OPEN_INPUT,{title:"InputFilter",type:e,createNewStack:!0,dragEvent:t});break;case $.MARKDOWN:this.emitLayoutEvent(Rs.OPEN,{title:"Markdown",type:e,dragEvent:t});break;case $.FILTER_SET_MANAGER:this.emitLayoutEvent(ae.OPEN_FILTER_SET_MANAGER,{title:"FilterSets",type:e,dragEvent:t});break;default:throw new Error(`Unrecognized control type ${e}`)}}handleToolSelect(e){E.debug("handleToolSelect",e);const{activeTool:t,setActiveTool:o}=this.props;o(t===e?le.DEFAULT:e)}handleClearFilter(){this.sendClearFilter()}handleDataChange(e){const{updateWorkspaceData:t}=this.props,{closed:o,filterSets:r,links:i,pluginDataMap:l}=e;t({closed:o,filterSets:r,links:i,pluginDataMap:l})}handleGoldenLayoutChange(e){const{activeTabKey:t}=this.state,o=this.dashboardLayouts.get(t);o!==e&&(o!=null&&_e(o.eventHub,this.handleCreateDashboard),this.dashboardLayouts.set(t,e),Mn(e.eventHub,this.handleCreateDashboard))}handleCreateDashboard({pluginId:e,title:t,data:o}){const r=$t(),{setDashboardPluginData:i}=this.props;i(r,e,o),this.setState(({tabs:l})=>({tabs:[...l,{key:r,title:t}],activeTabKey:r}))}handleWidgetMenuClick(){this.setState(({isPanelsMenuShown:e})=>({isPanelsMenuShown:!e}))}handleWidgetSelect(e,t){this.setState({isPanelsMenuShown:!1}),E.debug("handleWidgetSelect",e,t),this.openWidget(e,t)}handleWidgetsMenuClose(){this.setState({isPanelsMenuShown:!1})}handleAutoFillClick(){const{widgets:e}=this.state;E.debug("handleAutoFillClick",e);const t=e.sort((o,r)=>o.title!=null&&r.title!=null?o.title.localeCompare(r.title):0);for(let o=0;o<t.length;o+=1)this.openWidget(t[o])}handleExportLayoutClick(){E.info("handleExportLayoutClick"),this.setState({isPanelsMenuShown:!1});try{const{workspace:e}=this.props,{data:t}=e,o=pe.exportLayout(t);E.info("handleExportLayoutClick exportedConfig",o);const r=new Blob([JSON.stringify(o)],{type:"application/json"}),i=xt.i18n.DateTimeFormat.format("yyyy-MM-dd-HHmmss",new Date),l=document.createElement("a");l.href=URL.createObjectURL(r),l.download=`deephaven-app-layout-${i}.json`,l.click()}catch(e){E.error("Unable to export layout",e)}}handleImportLayoutClick(){E.info("handleImportLayoutClick"),this.setState({isPanelsMenuShown:!1}),this.importElement.current!=null&&(this.importElement.current.value="",this.importElement.current.click())}handleResetLayoutClick(){E.info("handleResetLayoutClick"),this.setState({isPanelsMenuShown:!1,isResetLayoutPromptShown:!0,unsavedNotebookCount:Is.unsavedNotebookCount()})}handleImportLayoutFiles(e){var t;e.stopPropagation(),e.preventDefault(),e.target.files!=null&&this.importLayoutFile((t=e.target.files)==null?void 0:t[0])}async importLayoutFile(e){try{const{updateDashboardData:t,updateWorkspaceData:o}=this.props,r=await e.text(),i=JSON.parse(r),{filterSets:l,layoutConfig:c,links:d,pluginDataMap:h}=pe.normalizeLayout(i);o({layoutConfig:c}),t(D,{filterSets:l,links:d,pluginDataMap:h}),this.setState(({layoutIteration:u})=>({layoutIteration:u+1}))}catch(t){E.error("Unable to import layout",t)}}async resetLayout(){const{layoutStorage:e,session:t}=this.props,{filterSets:o,layoutConfig:r,links:i}=await pe.getDefaultLayout(e,t!==void 0),{updateDashboardData:l,updateWorkspaceData:c}=this.props;c({layoutConfig:r}),l(D,{filterSets:o,links:i})}handlePaste(e){if(e.target instanceof HTMLElement&&e.target.closest(".monaco-editor"))return;const{clipboardData:t}=e,o=t.getData("Text"),r=/“|”/g;r.test(o)&&(e.preventDefault(),e.stopPropagation(),document.execCommand("insertText",!1,o.replace(r,'"')))}openWidget(e,t){const{connection:o}=this.props;Os(this.getActiveEventHub(),{widget:Ls(e),dragEvent:t,fetch:async()=>o==null?void 0:o.getObject(e)})}handleHomeClick(){this.handleTabSelect(D)}handleTabSelect(e){this.setState({activeTabKey:e})}handleTabReorder(e,t){this.setState(({tabs:o})=>{const r=[...o],[i]=r.splice(e,1);return r.splice(t,0,i),{tabs:r}})}handleTabClose(e){this.setState(({tabs:t,activeTabKey:o})=>{const r=t.filter(l=>l.key!==e);let i=o;if(o===e&&r.length>0){const l=t.findIndex(c=>c.key===e);i=l<t.length-1?t[l+1].key:t[l-1].key}return r.length===0&&(i=D),{tabs:r,activeTabKey:i}})}getDashboards(){const{layoutIteration:e,tabs:t}=this.state,{allDashboardData:o,workspace:r}=this.props,{data:i}=r,{layoutConfig:l}=i;return[{id:D,layoutConfig:l,key:`${D}-${e}`},...t.filter(c=>c.key!==D).map(c=>{var d;return{id:c.key,layoutConfig:((d=o[c.key])==null?void 0:d.layoutConfig)??Ps,key:`${c.key}-${e}`}})]}render(){const{activeTool:e,plugins:t,user:o,serverConfigValues:r}=this.props,{permissions:i}=o,{canUsePanels:l}=i,{contextActions:c,isPanelsMenuShown:d,isResetLayoutPromptShown:h,isSettingsMenuShown:u,unsavedNotebookCount:p,widgets:N,tabs:y,activeTabKey:f}=this.state,S=this.getDashboardPlugins(t);return n.jsxs("div",{className:I("app-main-tabs","w-100","h-100","d-flex","flex-column",e?`active-tool-${e.toLowerCase()}`:""),onPaste:this.handlePaste,tabIndex:-1,children:[n.jsxs("div",{className:"app-main-top-nav-menus",children:[n.jsx(bt,{className:"ml-1",style:{maxHeight:"20px"}}),y.length>1&&n.jsx("div",{style:{flexShrink:0,flexGrow:1,display:"flex"},children:n.jsx(_n,{tabs:y,activeKey:f,onSelect:this.handleTabSelect,onReorder:this.handleTabReorder,onClose:this.handleTabClose})}),n.jsxs("div",{className:"app-main-right-menu-buttons",children:[n.jsxs(C,{kind:"ghost",className:"btn-panels-menu",icon:Nn,onClick:()=>{},children:["Controls",n.jsx(Re,{handleControlSelect:this.handleControlSelect,handleToolSelect:this.handleToolSelect,onClearFilter:this.handleClearFilter})]}),l&&n.jsxs(C,{kind:"ghost",className:"btn-panels-menu btn-show-panels","data-testid":"app-main-panels-button",onClick:this.handleWidgetMenuClick,icon:En,children:["Panels",n.jsx(ks,{isShown:d,className:"panels-menu-popper",onExited:this.handleWidgetsMenuClose,options:{placement:"bottom"},closeOnBlur:!0,interactive:!0,children:n.jsx(Ya,{widgets:N,onExportLayout:this.handleExportLayoutClick,onImportLayout:this.handleImportLayoutClick,onResetLayout:this.handleResetLayoutClick,onSelect:this.handleWidgetSelect})})]}),n.jsx(C,{kind:"ghost",className:I("btn-settings-menu",{"text-warning":o.operateAs!=null&&o.operateAs!==o.name}),onClick:this.handleSettingsMenuShow,icon:n.jsx("span",{className:"fa-layers",children:n.jsx(F,{icon:Fn,transform:"grow-3"})}),tooltip:"User Settings"})]})]}),n.jsx(Un,{dashboards:this.getDashboards(),activeDashboard:f,onGoldenLayoutChange:this.handleGoldenLayoutChange,emptyDashboard:f===D?n.jsx(qa,{onAutoFillClick:this.handleAutoFillClick}):n.jsx(ft,{}),plugins:[n.jsx(As,{hydrateConsole:ee.hydrateConsole,notebooksUrl:new URL("notebooks/",document.baseURI).href},"ConsolePlugin"),...S]}),n.jsx(zn,{in:u,mountOnEnter:!0,unmountOnExit:!0,children:n.jsx(je,{serverConfigValues:r,pluginData:t,onDone:this.handleSettingsMenuHide,user:o})}),n.jsx(Ms,{actions:c}),n.jsx("input",{ref:this.importElement,type:"file",accept:".json",style:{display:"none"},onChange:this.handleImportLayoutFiles,"data-testid":"input-import-layout"}),n.jsx(_s,{confirmButtonText:"Reset",onConfirm:this.handleConfirmResetLayoutPrompt,onCancel:this.handleCancelResetLayoutPrompt,isConfirmDanger:!0,isOpen:h,headerText:p===0?"Reset Layout":"Reset layout and discard unsaved changes",bodyText:p===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."})]})}}const za=a=>{var s,e;return{activeTool:Ss(a),allDashboardData:ys(a),dashboardData:xs(a,D),layoutStorage:Ha(a),plugins:Cs(a),connection:Ts(a,D),session:(s=Pe(a,D))==null?void 0:s.session,sessionConfig:(e=Pe(a,D))==null?void 0:e.config,user:ws(a),workspace:gt(a),serverConfigValues:Za(a)}},Ja=de(za,{setActiveTool:mt,setDashboardData:pt,setDashboardPluginData:fs,updateDashboardData:bs,updateWorkspaceData:vs})(Kt(ee));function Xa(){return n.jsxs("div",{className:"app",children:[n.jsx(Ja,{}),n.jsx($n,{})]})}const Qa=W.module("AppInit");function tt(){const a=ot(),s=Wn(),e=Gn(),t=Us(),o=Bn(),r=Vn(),i=Gt(gt),l=Ne(),[c,d]=m.useState();m.useEffect(function(){l(Ks(t))},[t,l]),m.useEffect(function(){async function y(){try{const f=await Hn(),S=await Zn(a,e,f),T=s.getStorageService(),P=new Yn(T,"/layouts"),w=new qn(a,T,"/notebooks"),g=new Ue(P),v=new ga,K=await g.load({isConsoleAvailable:S!==void 0}),{data:ue}=K,{settings:Nt}=ue,{shortcutOverrides:Ie={}}=Nt,Et=A.isMacPlatform?Ie.mac??{}:Ie.windows??{};Object.entries(Et).forEach(([Rt,It])=>{var Oe;(Oe=Ee.get(Rt))==null||Oe.setKeyState(It)});const Ft={title:"Code Studio",filterSets:ue.filterSets,links:ue.links};l($s(a)),l(mt(le.DEFAULT)),l(Ws(o)),l(Gs(v)),l(pt(D,Ft)),l(Bs(w)),l(fa(P)),l(Vs(D,e)),S!==void 0&&l(Hs(D,S)),l(Zs(r)),l(Ys(g)),l(qs(K)),l(zs(Ue.makeDefaultWorkspaceSettings(o)))}catch(f){Qa.error(f),d(f)}}y()},[a,s,e,o,l,r]);const h=i==null&&c==null,u=!h&&c==null,p=c!=null?`${c}`:null;return n.jsxs(n.Fragment,{children:[u&&n.jsx(Xa,{}),n.jsx(ft,{isLoading:h&&p==null,isLoaded:u,errorMessage:p})]})}const eo=X.lazy(()=>Zt(()=>import("./StyleGuideRoot-DWcUvpZo.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23]),import.meta.url)),to=new URL(document.baseURI).pathname.replace(/\/$/,"");function so(){return n.jsx(Bt,{basename:to,children:n.jsxs(Vt,{children:[n.jsx(me,{exact:!0,path:"/",component:tt}),n.jsx(me,{path:"/notebooks/:notebookPath+",component:tt}),n.jsx(me,{path:"/styleguide",component:eo}),n.jsx(Ht,{from:"*",to:"/"})]})})}function po(){return Jn.register(new URL("./download/serviceWorker.js",window.location.href)),Js.init({getWorker:()=>new Yt}),window["__react-beautiful-dnd-disable-dev-warnings"]=!0,n.jsx(so,{})}export{po as AppRoot,po as default};
6
- //# sourceMappingURL=AppRoot-2QqbS1nC.js.map
5
+ `);Ns(i)},shortcut:Y.COPY_VERSION_INFO,isGlobal:!0},{action:()=>{this.handleToolSelect(le.LINKER)},shortcut:Y.LINKER,isGlobal:!0},{action:()=>{this.sendClearFilter()},shortcut:vt.TABLE.CLEAR_ALL_FILTERS,isGlobal:!0},{action:()=>{this.sendReopenLast()},shortcut:Y.REOPEN_CLOSED_PANEL,isGlobal:!0},{action:()=>{E.debug("Consume unhandled save shortcut")},shortcut:Y.SAVE,isGlobal:!0}],isPanelsMenuShown:!1,isResetLayoutPromptShown:!1,isSettingsMenuShown:!1,unsavedNotebookCount:0,widgets:[],tabs:Object.entries(t).map(([o,r])=>({key:o,title:r.title??"Untitled",isClosable:o!==D,icon:o===D?jn:void 0})),activeTabKey:D,layoutIteration:0}}static handleWindowBeforeUnload(e){e.preventDefault(),e.returnValue=""}static hydrateConsole(e,t){return Ds.hydrate({...e,unzip:o=>at.loadAsync(o).then(r=>Object.values(r.files))},t)}static handleRefresh(){E.info("Refreshing application"),window.location.reload()}componentDidMount(){this.initWidgets(),this.initDashboardData(),window.addEventListener("beforeunload",ee.handleWindowBeforeUnload)}componentDidUpdate(e,t){const{dashboardData:o}=this.props;e.dashboardData!==o&&this.handleDataChange(o)}componentWillUnmount(){this.deinitWidgets(),this.dashboardLayouts.forEach(e=>{_e(e.eventHub,this.handleCreateDashboard)}),window.removeEventListener("beforeunload",ee.handleWindowBeforeUnload)}initWidgets(){const{connection:e}=this.props;if(e!=null){if(e.subscribeToFieldUpdates==null){E.warn("subscribeToFieldUpdates not supported, not initializing widgets");return}this.widgetListenerRemover=e.subscribeToFieldUpdates(t=>{E.debug("Got updates",t),this.setState(({widgets:o})=>{const{updated:r,created:i,removed:l}=t,c=[...r,...l],d=o.filter(u=>!c.some(p=>p.name===u.name));return[...r,...i].forEach(u=>{u.name!=null&&u.name!==""&&d.push(u)}),{widgets:d}})})}}deinitWidgets(){var e;(e=this.widgetListenerRemover)==null||e.call(this)}initDashboardData(){const{setDashboardPluginData:e,updateDashboardData:t,workspace:o}=this.props,{data:r}=o,{filterSets:i,links:l,pluginDataMap:c}=r;if(t(D,{filterSets:i,links:l}),c!=null){const d=Object.keys(c);for(let h=0;h<d.length;h+=1){const u=d[h],p=c[u];E.debug("initDashboardData plugin data",u,p),e(D,u,p)}}}openNotebookFromURL(){const{match:e}=this.props,{notebookPath:t}=e.params;if(t){const{session:o,sessionConfig:r}=this.props;if(o==null||r==null){E.error("No session available to open notebook URL",t);return}const i={id:`/${t}`,itemName:`/${t}`},l=r.type,c={value:null,language:l};this.emitLayoutEvent(Es.SELECT_NOTEBOOK,o,l,c,i,!0)}}sendClearFilter(){this.emitLayoutEvent(ae.CLEAR_ALL_FILTERS)}sendReopenLast(){this.emitLayoutEvent(Fs.REOPEN_LAST)}getActiveEventHub(){const{activeTabKey:e}=this.state,t=this.dashboardLayouts.get(e);return ce(t,"No active layout found"),t.eventHub}emitLayoutEvent(e,...t){this.getActiveEventHub().emit(e,...t)}handleCancelResetLayoutPrompt(){this.setState({isResetLayoutPromptShown:!1})}handleConfirmResetLayoutPrompt(){this.setState({isResetLayoutPromptShown:!1}),this.resetLayout()}handleError(e){Z.isCanceled(e)||E.error(e)}handleSettingsMenuHide(){this.setState({isSettingsMenuShown:!1})}handleSettingsMenuShow(){this.setState({isSettingsMenuShown:!0})}handleControlSelect(e,t){switch(E.debug("handleControlSelect",e),e){case $.DROPDOWN_FILTER:this.emitLayoutEvent(ae.OPEN_DROPDOWN,{title:"DropdownFilter",type:e,createNewStack:!0,dragEvent:t});break;case $.INPUT_FILTER:this.emitLayoutEvent(ae.OPEN_INPUT,{title:"InputFilter",type:e,createNewStack:!0,dragEvent:t});break;case $.MARKDOWN:this.emitLayoutEvent(Rs.OPEN,{title:"Markdown",type:e,dragEvent:t});break;case $.FILTER_SET_MANAGER:this.emitLayoutEvent(ae.OPEN_FILTER_SET_MANAGER,{title:"FilterSets",type:e,dragEvent:t});break;default:throw new Error(`Unrecognized control type ${e}`)}}handleToolSelect(e){E.debug("handleToolSelect",e);const{activeTool:t,setActiveTool:o}=this.props;o(t===e?le.DEFAULT:e)}handleClearFilter(){this.sendClearFilter()}handleDataChange(e){const{updateWorkspaceData:t}=this.props,{closed:o,filterSets:r,links:i,pluginDataMap:l}=e;t({closed:o,filterSets:r,links:i,pluginDataMap:l})}handleGoldenLayoutChange(e){const{activeTabKey:t}=this.state,o=this.dashboardLayouts.get(t);o!==e&&(o!=null&&_e(o.eventHub,this.handleCreateDashboard),this.dashboardLayouts.set(t,e),Mn(e.eventHub,this.handleCreateDashboard))}handleCreateDashboard({pluginId:e,title:t,data:o}){const r=$t(),{setDashboardPluginData:i}=this.props;i(r,e,o),this.setState(({tabs:l})=>({tabs:[...l,{key:r,title:t}],activeTabKey:r}))}handleWidgetMenuClick(){this.setState(({isPanelsMenuShown:e})=>({isPanelsMenuShown:!e}))}handleWidgetSelect(e,t){this.setState({isPanelsMenuShown:!1}),E.debug("handleWidgetSelect",e,t),this.openWidget(e,t)}handleWidgetsMenuClose(){this.setState({isPanelsMenuShown:!1})}handleAutoFillClick(){const{widgets:e}=this.state;E.debug("handleAutoFillClick",e);const t=e.sort((o,r)=>o.title!=null&&r.title!=null?o.title.localeCompare(r.title):0);for(let o=0;o<t.length;o+=1)this.openWidget(t[o])}handleExportLayoutClick(){E.info("handleExportLayoutClick"),this.setState({isPanelsMenuShown:!1});try{const{workspace:e}=this.props,{data:t}=e,o=pe.exportLayout(t);E.info("handleExportLayoutClick exportedConfig",o);const r=new Blob([JSON.stringify(o)],{type:"application/json"}),i=xt.i18n.DateTimeFormat.format("yyyy-MM-dd-HHmmss",new Date),l=document.createElement("a");l.href=URL.createObjectURL(r),l.download=`deephaven-app-layout-${i}.json`,l.click()}catch(e){E.error("Unable to export layout",e)}}handleImportLayoutClick(){E.info("handleImportLayoutClick"),this.setState({isPanelsMenuShown:!1}),this.importElement.current!=null&&(this.importElement.current.value="",this.importElement.current.click())}handleResetLayoutClick(){E.info("handleResetLayoutClick"),this.setState({isPanelsMenuShown:!1,isResetLayoutPromptShown:!0,unsavedNotebookCount:Is.unsavedNotebookCount()})}handleImportLayoutFiles(e){var t;e.stopPropagation(),e.preventDefault(),e.target.files!=null&&this.importLayoutFile((t=e.target.files)==null?void 0:t[0])}async importLayoutFile(e){try{const{updateDashboardData:t,updateWorkspaceData:o}=this.props,r=await e.text(),i=JSON.parse(r),{filterSets:l,layoutConfig:c,links:d,pluginDataMap:h}=pe.normalizeLayout(i);o({layoutConfig:c}),t(D,{filterSets:l,links:d,pluginDataMap:h}),this.setState(({layoutIteration:u})=>({layoutIteration:u+1}))}catch(t){E.error("Unable to import layout",t)}}async resetLayout(){const{layoutStorage:e,session:t}=this.props,{filterSets:o,layoutConfig:r,links:i}=await pe.getDefaultLayout(e,t!==void 0),{updateDashboardData:l,updateWorkspaceData:c}=this.props;c({layoutConfig:r}),l(D,{filterSets:o,links:i})}handlePaste(e){if(e.target instanceof HTMLElement&&e.target.closest(".monaco-editor"))return;const{clipboardData:t}=e,o=t.getData("Text"),r=/“|”/g;r.test(o)&&(e.preventDefault(),e.stopPropagation(),document.execCommand("insertText",!1,o.replace(r,'"')))}openWidget(e,t){const{connection:o}=this.props;Os(this.getActiveEventHub(),{widget:Ls(e),dragEvent:t,fetch:async()=>o==null?void 0:o.getObject(e)})}handleHomeClick(){this.handleTabSelect(D)}handleTabSelect(e){this.setState({activeTabKey:e})}handleTabReorder(e,t){this.setState(({tabs:o})=>{const r=[...o],[i]=r.splice(e,1);return r.splice(t,0,i),{tabs:r}})}handleTabClose(e){this.setState(({tabs:t,activeTabKey:o})=>{const r=t.filter(l=>l.key!==e);let i=o;if(o===e&&r.length>0){const l=t.findIndex(c=>c.key===e);i=l<t.length-1?t[l+1].key:t[l-1].key}return r.length===0&&(i=D),{tabs:r,activeTabKey:i}})}getDashboards(){const{layoutIteration:e,tabs:t}=this.state,{allDashboardData:o,workspace:r}=this.props,{data:i}=r,{layoutConfig:l}=i;return[{id:D,layoutConfig:l,key:`${D}-${e}`},...t.filter(c=>c.key!==D).map(c=>{var d;return{id:c.key,layoutConfig:((d=o[c.key])==null?void 0:d.layoutConfig)??Ps,key:`${c.key}-${e}`}})]}render(){const{activeTool:e,plugins:t,user:o,serverConfigValues:r}=this.props,{permissions:i}=o,{canUsePanels:l}=i,{contextActions:c,isPanelsMenuShown:d,isResetLayoutPromptShown:h,isSettingsMenuShown:u,unsavedNotebookCount:p,widgets:N,tabs:y,activeTabKey:f}=this.state,S=this.getDashboardPlugins(t);return n.jsxs("div",{className:I("app-main-tabs","w-100","h-100","d-flex","flex-column",e?`active-tool-${e.toLowerCase()}`:""),onPaste:this.handlePaste,tabIndex:-1,children:[n.jsxs("div",{className:"app-main-top-nav-menus",children:[n.jsx(bt,{className:"ml-1",style:{maxHeight:"20px"}}),y.length>1&&n.jsx("div",{style:{flexShrink:0,flexGrow:1,display:"flex"},children:n.jsx(_n,{tabs:y,activeKey:f,onSelect:this.handleTabSelect,onReorder:this.handleTabReorder,onClose:this.handleTabClose})}),n.jsxs("div",{className:"app-main-right-menu-buttons",children:[n.jsxs(C,{kind:"ghost",className:"btn-panels-menu",icon:Nn,onClick:()=>{},children:["Controls",n.jsx(Re,{handleControlSelect:this.handleControlSelect,handleToolSelect:this.handleToolSelect,onClearFilter:this.handleClearFilter})]}),l&&n.jsxs(C,{kind:"ghost",className:"btn-panels-menu btn-show-panels","data-testid":"app-main-panels-button",onClick:this.handleWidgetMenuClick,icon:En,children:["Panels",n.jsx(ks,{isShown:d,className:"panels-menu-popper",onExited:this.handleWidgetsMenuClose,options:{placement:"bottom"},closeOnBlur:!0,interactive:!0,children:n.jsx(Ya,{widgets:N,onExportLayout:this.handleExportLayoutClick,onImportLayout:this.handleImportLayoutClick,onResetLayout:this.handleResetLayoutClick,onSelect:this.handleWidgetSelect})})]}),n.jsx(C,{kind:"ghost",className:I("btn-settings-menu",{"text-warning":o.operateAs!=null&&o.operateAs!==o.name}),onClick:this.handleSettingsMenuShow,icon:n.jsx("span",{className:"fa-layers",children:n.jsx(F,{icon:Fn,transform:"grow-3"})}),tooltip:"User Settings"})]})]}),n.jsx(Un,{dashboards:this.getDashboards(),activeDashboard:f,onGoldenLayoutChange:this.handleGoldenLayoutChange,emptyDashboard:f===D?n.jsx(qa,{onAutoFillClick:this.handleAutoFillClick}):n.jsx(ft,{}),plugins:[n.jsx(As,{hydrateConsole:ee.hydrateConsole,notebooksUrl:new URL("notebooks/",document.baseURI).href},"ConsolePlugin"),...S]}),n.jsx(zn,{in:u,mountOnEnter:!0,unmountOnExit:!0,children:n.jsx(je,{serverConfigValues:r,pluginData:t,onDone:this.handleSettingsMenuHide,user:o})}),n.jsx(Ms,{actions:c}),n.jsx("input",{ref:this.importElement,type:"file",accept:".json",style:{display:"none"},onChange:this.handleImportLayoutFiles,"data-testid":"input-import-layout"}),n.jsx(_s,{confirmButtonText:"Reset",onConfirm:this.handleConfirmResetLayoutPrompt,onCancel:this.handleCancelResetLayoutPrompt,isConfirmDanger:!0,isOpen:h,headerText:p===0?"Reset Layout":"Reset layout and discard unsaved changes",bodyText:p===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."})]})}}const za=a=>{var s,e;return{activeTool:Ss(a),allDashboardData:ys(a),dashboardData:xs(a,D),layoutStorage:Ha(a),plugins:Cs(a),connection:Ts(a,D),session:(s=Pe(a,D))==null?void 0:s.session,sessionConfig:(e=Pe(a,D))==null?void 0:e.config,user:ws(a),workspace:gt(a),serverConfigValues:Za(a)}},Ja=de(za,{setActiveTool:mt,setDashboardData:pt,setDashboardPluginData:fs,updateDashboardData:bs,updateWorkspaceData:vs})(Kt(ee));function Xa(){return n.jsxs("div",{className:"app",children:[n.jsx(Ja,{}),n.jsx($n,{})]})}const Qa=W.module("AppInit");function tt(){const a=ot(),s=Wn(),e=Gn(),t=Us(),o=Bn(),r=Vn(),i=Gt(gt),l=Ne(),[c,d]=m.useState();m.useEffect(function(){l(Ks(t))},[t,l]),m.useEffect(function(){async function y(){try{const f=await Hn(),S=await Zn(a,e,f),T=s.getStorageService(),P=new Yn(T,"/layouts"),w=new qn(a,T,"/notebooks"),g=new Ue(P),v=new ga,K=await g.load({isConsoleAvailable:S!==void 0}),{data:ue}=K,{settings:Nt}=ue,{shortcutOverrides:Ie={}}=Nt,Et=A.isMacPlatform?Ie.mac??{}:Ie.windows??{};Object.entries(Et).forEach(([Rt,It])=>{var Oe;(Oe=Ee.get(Rt))==null||Oe.setKeyState(It)});const Ft={title:"Code Studio",filterSets:ue.filterSets,links:ue.links};l($s(a)),l(mt(le.DEFAULT)),l(Ws(o)),l(Gs(v)),l(pt(D,Ft)),l(Bs(w)),l(fa(P)),l(Vs(D,e)),S!==void 0&&l(Hs(D,S)),l(Zs(r)),l(Ys(g)),l(qs(K)),l(zs(Ue.makeDefaultWorkspaceSettings(o)))}catch(f){Qa.error(f),d(f)}}y()},[a,s,e,o,l,r]);const h=i==null&&c==null,u=!h&&c==null,p=c!=null?`${c}`:null;return n.jsxs(n.Fragment,{children:[u&&n.jsx(Xa,{}),n.jsx(ft,{isLoading:h&&p==null,isLoaded:u,errorMessage:p})]})}const eo=X.lazy(()=>Zt(()=>import("./StyleGuideRoot-C-Kz5fEa.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23]),import.meta.url)),to=new URL(document.baseURI).pathname.replace(/\/$/,"");function so(){return n.jsx(Bt,{basename:to,children:n.jsxs(Vt,{children:[n.jsx(me,{exact:!0,path:"/",component:tt}),n.jsx(me,{path:"/notebooks/:notebookPath+",component:tt}),n.jsx(me,{path:"/styleguide",component:eo}),n.jsx(Ht,{from:"*",to:"/"})]})})}function po(){return Jn.register(new URL("./download/serviceWorker.js",window.location.href)),Js.init({getWorker:()=>new Yt}),window["__react-beautiful-dnd-disable-dev-warnings"]=!0,n.jsx(so,{})}export{po as AppRoot,po as default};
6
+ //# sourceMappingURL=AppRoot-BAdlVp-2.js.map