@trilogy-data/trilogy-studio-components 0.1.19 → 0.1.21

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 (166) hide show
  1. package/dist/{AssetAutoImporter-CUqhhNvb.js → AssetAutoImporter-IfDvXCFE.js} +5 -5
  2. package/dist/{ChatCreatorModal-CixOpWSH.js → ChatCreatorModal-BG6DyTV3.js} +2 -2
  3. package/dist/{CodeBlock-CDWXUAiQ.js → CodeBlock-Br-z9kG9.js} +1 -1
  4. package/dist/{CommunityModels-BKBxewjm.js → CommunityModels-DlK6gSx6.js} +7 -7
  5. package/dist/{ConfirmDialog-tNLC5CUN.js → ConfirmDialog-CYTEamQQ.js} +2 -2
  6. package/dist/{ConnectionView-Dyqm2oeV.js → ConnectionView-B_qlbq8s.js} +7 -7
  7. package/dist/{CreateEditorFromDatasourcePopup-D5mwCk5D.js → CreateEditorFromDatasourcePopup-bSSd8xci.js} +4 -4
  8. package/dist/{Dashboard-Bsoj1oUW.js → Dashboard-BN0T29JU.js} +1384 -1295
  9. package/dist/{DashboardCreatorInline-BLbkDxBF.js → DashboardCreatorInline-CPrHcaZC.js} +3 -3
  10. package/dist/{DashboardImportSelector-YRySr7k3.js → DashboardImportSelector-8mxsOld1.js} +1 -1
  11. package/dist/{DashboardMobile-Ao8NtF1f.js → DashboardMobile-BFcFiWhG.js} +4 -4
  12. package/dist/{DataTable-Bf7xeKSf.js → DataTable-CcALeEBZ.js} +2 -2
  13. package/dist/{DrilldownPane-OZMttRBx.js → DrilldownPane-oN6u9FSj.js} +6110 -6053
  14. package/dist/{Editor-N40lTR0s.js → Editor-BRnH6Fhm.js} +7 -7
  15. package/dist/{EditorCreatorInline-DCFnyl5w.js → EditorCreatorInline-BDWVUdax.js} +2 -2
  16. package/dist/{ErrorMessage-QW4GXCEn.js → ErrorMessage-BcAwiBgc.js} +1 -1
  17. package/dist/{HintComponent-B1B6qtaG.js → HintComponent-BZ7QT0Cf.js} +1 -1
  18. package/dist/{IDE-kbUDZPcL.js → IDE-BYphurDi.js} +10 -10
  19. package/dist/{JobsView-AYNUDnKG.js → JobsView-Bzv-qCJD.js} +4 -4
  20. package/dist/{LLMChat-CZTQUh53.js → LLMChat-DUReWNVL.js} +9 -9
  21. package/dist/{LLMConnectionList-BkvCZP5Q.js → LLMConnectionList-CS8b_fyI.js} +9 -9
  22. package/dist/{LLMView-CaTlmLGb.js → LLMView-D031rgKZ.js} +8 -8
  23. package/dist/{LoadingButton-BdM3Rygq.js → LoadingButton-3lCHccOe.js} +2 -2
  24. package/dist/{LoadingView-DXMQWonY.js → LoadingView-CCvQjQXB.js} +1 -1
  25. package/dist/{MarkdownRenderer-cdaHKql1.js → MarkdownRenderer-ToJ3ndVO.js} +3 -3
  26. package/dist/{MobileIDE-Bi7GNE2X.js → MobileIDE-YK0ZzWHh.js} +17 -17
  27. package/dist/{ModalDialog-D-yprLG4.js → ModalDialog-DUjJI7a8.js} +1 -1
  28. package/dist/{ModelCard-Cd6OxExX.js → ModelCard-DqfChNPX.js} +6 -6
  29. package/dist/{ModelCreator-DeI-n86Z.js → ModelCreator-DM1J950f.js} +4 -4
  30. package/dist/{ModelView-Surdb5KW.js → ModelView--DBf6oe2.js} +6 -6
  31. package/dist/{ResultComponent-CXkTwZFS.js → ResultComponent-DPeHR38g.js} +5 -5
  32. package/dist/{Sidebar-CfOATms_.js → Sidebar-Dq-6dIQq.js} +11 -11
  33. package/dist/{StatusIcon-CahClDuz.js → StatusIcon-BRguDu_P.js} +2 -2
  34. package/dist/{StoreTokenModal-CyPiGrhJ.js → StoreTokenModal-B379wQ3M.js} +2 -2
  35. package/dist/{SymbolsPane-CZaqqs5e.js → SymbolsPane-BrwZzMNn.js} +1 -1
  36. package/dist/Tooltip-Du2RDSUJ.js +104 -0
  37. package/dist/{TrilogyEmbedProvider-scDWYeoJ.js → TrilogyEmbedProvider-SmcmJEz6.js} +1 -1
  38. package/dist/{TutorialPage-IisHiPL6.js → TutorialPage-A-44DRyk.js} +12 -12
  39. package/dist/{UserProfile-CQAUnKyQ.js → UserProfile-DmDQyEIc.js} +4 -4
  40. package/dist/{WelcomePage-Bq-h9f64.js → WelcomePage-CeP5qQXC.js} +2 -2
  41. package/dist/_plugin-vue_export-helper-Ckr1Vx8X.js +368 -0
  42. package/dist/components/LoadingButton.vue.d.ts +6 -5
  43. package/dist/components/LoadingButton.vue.d.ts.map +1 -1
  44. package/dist/components/MarkdownRenderer.vue.d.ts.map +1 -1
  45. package/dist/components/Tooltip.vue.d.ts +6 -5
  46. package/dist/components/Tooltip.vue.d.ts.map +1 -1
  47. package/dist/components/VegaLiteChart.vue.d.ts +6 -5
  48. package/dist/components/VegaLiteChart.vue.d.ts.map +1 -1
  49. package/dist/components/chartHelpers.d.ts.map +1 -1
  50. package/dist/components/connection/ConnectionDatabase.vue.d.ts +6 -5
  51. package/dist/components/connection/ConnectionDatabase.vue.d.ts.map +1 -1
  52. package/dist/components/dashboard/Dashboard.vue.d.ts +3 -1
  53. package/dist/components/dashboard/Dashboard.vue.d.ts.map +1 -1
  54. package/dist/components/dashboard/DashboardChart.vue.d.ts +8 -7
  55. package/dist/components/dashboard/DashboardChart.vue.d.ts.map +1 -1
  56. package/dist/components/dashboard/DashboardFilter.vue.d.ts +1 -1
  57. package/dist/components/dashboard/DashboardGridItem.vue.d.ts.map +1 -1
  58. package/dist/components/dashboard/DashboardHeader.vue.d.ts +10 -0
  59. package/dist/components/dashboard/DashboardHeader.vue.d.ts.map +1 -1
  60. package/dist/components/dashboard/DashboardMarkdown.vue.d.ts +1 -1
  61. package/dist/components/dashboard/DashboardTable.vue.d.ts +1 -1
  62. package/dist/components/dashboard/useDashboard.d.ts.map +1 -1
  63. package/dist/components/editor/Editor.vue.d.ts +12 -10
  64. package/dist/components/editor/Editor.vue.d.ts.map +1 -1
  65. package/dist/components/editor/EditorCreatorInline.vue.d.ts +6 -5
  66. package/dist/components/editor/EditorCreatorInline.vue.d.ts.map +1 -1
  67. package/dist/components/editor/EditorHeader.vue.d.ts +6 -5
  68. package/dist/components/editor/EditorHeader.vue.d.ts.map +1 -1
  69. package/dist/components/editor/ResultComponent.vue.d.ts +48 -40
  70. package/dist/components/editor/ResultComponent.vue.d.ts.map +1 -1
  71. package/dist/components/editor/Results.vue.d.ts +12 -10
  72. package/dist/components/editor/Results.vue.d.ts.map +1 -1
  73. package/dist/components/llm/ArtifactsPane.vue.d.ts +12 -10
  74. package/dist/components/llm/ArtifactsPane.vue.d.ts.map +1 -1
  75. package/dist/components/llm/ChatArtifact.vue.d.ts +6 -5
  76. package/dist/components/llm/ChatArtifact.vue.d.ts.map +1 -1
  77. package/dist/components/llm/LLMChatSplitView.vue.d.ts +12 -10
  78. package/dist/components/llm/LLMChatSplitView.vue.d.ts.map +1 -1
  79. package/dist/components/llm/LLMEditorRefinement.vue.d.ts +12 -10
  80. package/dist/components/llm/LLMEditorRefinement.vue.d.ts.map +1 -1
  81. package/dist/components/model/ModelCard.vue.d.ts +18 -15
  82. package/dist/components/model/ModelCard.vue.d.ts.map +1 -1
  83. package/dist/components/model/ModelCreator.vue.d.ts +12 -10
  84. package/dist/components/model/ModelCreator.vue.d.ts.map +1 -1
  85. package/dist/components/sidebar/ConnectionList.vue.d.ts +18 -15
  86. package/dist/components/sidebar/ConnectionList.vue.d.ts.map +1 -1
  87. package/dist/components/sidebar/ConnectionListItem.vue.d.ts +6 -5
  88. package/dist/components/sidebar/ConnectionListItem.vue.d.ts.map +1 -1
  89. package/dist/components/sidebar/DashboardList.vue.d.ts +14 -12
  90. package/dist/components/sidebar/DashboardList.vue.d.ts.map +1 -1
  91. package/dist/components/sidebar/DashboardListItem.vue.d.ts +7 -6
  92. package/dist/components/sidebar/DashboardListItem.vue.d.ts.map +1 -1
  93. package/dist/components/sidebar/EditorList.vue.d.ts +18 -15
  94. package/dist/components/sidebar/EditorList.vue.d.ts.map +1 -1
  95. package/dist/components/sidebar/EditorListItem.vue.d.ts +6 -5
  96. package/dist/components/sidebar/EditorListItem.vue.d.ts.map +1 -1
  97. package/dist/components/sidebar/LLMConnectionCreator.vue.d.ts +6 -5
  98. package/dist/components/sidebar/LLMConnectionCreator.vue.d.ts.map +1 -1
  99. package/dist/components/sidebar/LLMConnectionList.vue.d.ts +12 -10
  100. package/dist/components/sidebar/LLMConnectionList.vue.d.ts.map +1 -1
  101. package/dist/components/sidebar/LLMConnectionListItem.vue.d.ts +6 -5
  102. package/dist/components/sidebar/LLMConnectionListItem.vue.d.ts.map +1 -1
  103. package/dist/components/sidebar/ModelSidebar.vue.d.ts +24 -20
  104. package/dist/components/sidebar/ModelSidebar.vue.d.ts.map +1 -1
  105. package/dist/components/sidebar/Sidebar.vue.d.ts +92 -77
  106. package/dist/components/sidebar/Sidebar.vue.d.ts.map +1 -1
  107. package/dist/components/tutorial/TutorialPrompt.vue.d.ts +60 -50
  108. package/dist/components/tutorial/TutorialPrompt.vue.d.ts.map +1 -1
  109. package/dist/composables/useCrossFilterEligibility.d.ts.map +1 -1
  110. package/dist/composables/useEmbeddedDashboardGroup.d.ts +5 -9
  111. package/dist/composables/useEmbeddedDashboardGroup.d.ts.map +1 -1
  112. package/dist/composables/useResolvedCrossFilterController.d.ts +1 -1
  113. package/dist/composables/useResolvedCrossFilterController.d.ts.map +1 -1
  114. package/dist/connections/bigquery_oauth.d.ts +1 -0
  115. package/dist/connections/bigquery_oauth.d.ts.map +1 -1
  116. package/dist/connections/duckdb.d.ts.map +1 -1
  117. package/dist/connections/motherduck.d.ts +1 -1
  118. package/dist/connections/motherduck.d.ts.map +1 -1
  119. package/dist/connections/snowflake.d.ts +9 -2
  120. package/dist/connections/snowflake.d.ts.map +1 -1
  121. package/dist/connections.js +2 -2
  122. package/dist/dashboard.js +23 -18
  123. package/dist/dashboards/barChartSpec.d.ts.map +1 -1
  124. package/dist/dashboards/barHChartSpec.d.ts.map +1 -1
  125. package/dist/dashboards/base.d.ts +13 -12
  126. package/dist/dashboards/base.d.ts.map +1 -1
  127. package/dist/dashboards/conditions.d.ts +26 -0
  128. package/dist/dashboards/conditions.d.ts.map +1 -1
  129. package/dist/dashboards/crossFilters.d.ts +28 -8
  130. package/dist/dashboards/crossFilters.d.ts.map +1 -1
  131. package/dist/dashboards/dashboardQueryExecutor.d.ts.map +1 -1
  132. package/dist/dashboards/helpers.d.ts +2 -0
  133. package/dist/dashboards/helpers.d.ts.map +1 -1
  134. package/dist/dashboards/spec.d.ts.map +1 -1
  135. package/dist/{editorStore-BTPcljeQ.js → editorStore-CHHdik0L.js} +1 -1
  136. package/dist/editors/results.d.ts +1 -0
  137. package/dist/editors/results.d.ts.map +1 -1
  138. package/dist/embed.js +2 -2
  139. package/dist/icons/registerMdiIcons.d.ts +2 -1
  140. package/dist/icons/registerMdiIcons.d.ts.map +1 -1
  141. package/dist/monaco.js +1 -1
  142. package/dist/{queryExecutionService-KrjL0UCa.js → queryExecutionService-D1ynkTop.js} +852 -690
  143. package/dist/{remoteProject-CvjztZU1.js → remoteProject-DrsKUWjF.js} +1 -1
  144. package/dist/{snowflake-CY1Gnu3y.js → snowflake-BUHnLz1S.js} +1587 -1539
  145. package/dist/stores/dashboardStore.d.ts +2 -1
  146. package/dist/stores/dashboardStore.d.ts.map +1 -1
  147. package/dist/stores/queryExecutionService.d.ts.map +1 -1
  148. package/dist/stores/resolver.d.ts +2 -0
  149. package/dist/stores/resolver.d.ts.map +1 -1
  150. package/dist/stores.js +2 -2
  151. package/dist/trilogy-studio-components.css +1 -1
  152. package/dist/{useDashboard-CtX3sEag.js → useDashboard-DlVElw8y.js} +1130 -1093
  153. package/dist/{useResizableDialog-BZgmdwim.js → useResizableDialog-B6WRQMxc.js} +1 -1
  154. package/dist/views/ConnectionView.vue.d.ts +6 -5
  155. package/dist/views/ConnectionView.vue.d.ts.map +1 -1
  156. package/dist/views/LLMView.vue.d.ts +36 -30
  157. package/dist/views/LLMView.vue.d.ts.map +1 -1
  158. package/dist/views/ModelView.vue.d.ts +36 -30
  159. package/dist/views/ModelView.vue.d.ts.map +1 -1
  160. package/dist/views/ResponsiveIDE.vue.d.ts.map +1 -1
  161. package/dist/views/TutorialPage.vue.d.ts +196 -162
  162. package/dist/views/TutorialPage.vue.d.ts.map +1 -1
  163. package/dist/views.js +109 -104
  164. package/package.json +1 -1
  165. package/dist/Tooltip-D4kSH91A.js +0 -62
  166. package/dist/_plugin-vue_export-helper-BzkwV_Yn.js +0 -361
@@ -1,14 +1,14 @@
1
- var We = Object.defineProperty;
2
- var Ge = (r, e, t) => e in r ? We(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
- var w = (r, e, t) => Ge(r, typeof e != "symbol" ? e + "" : e, t);
4
- import { k as Ve, u as Ye } from "./editorStore-BTPcljeQ.js";
5
- import { a as Xe, c as Ze, b as et, q as De, s as xe, t as tt, M as rt, r as st, C as Te, u as ot } from "./toolLoopCore-CK_KVuAS.js";
6
- import { ref as Q, toValue as Be, computed as nt } from "vue";
7
- import { K as te, l as it } from "./constants-BXXolEur.js";
8
- import { E as be, m as $e, R as J, C as at } from "./snowflake-CY1Gnu3y.js";
9
- import { defineStore as V } from "pinia";
10
- import { c as ct, e as lt, A as Ae, O as Fe, G as Qe, a as Oe, D as ut, g as ht, b as dt, C as ft } from "./chatAgentPrompt-DrX26_jN.js";
11
- const mt = [
1
+ var tt = Object.defineProperty;
2
+ var rt = (r, e, t) => e in r ? tt(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
+ var w = (r, e, t) => rt(r, typeof e != "symbol" ? e + "" : e, t);
4
+ import { k as st, u as ot } from "./editorStore-CHHdik0L.js";
5
+ import { a as nt, c as it, b as at, q as _e, s as Qe, t as ct, M as lt, r as ut, C as Oe, u as ht } from "./toolLoopCore-CK_KVuAS.js";
6
+ import { ref as Q, toValue as Ve, computed as dt } from "vue";
7
+ import { K as se, l as ft } from "./constants-BXXolEur.js";
8
+ import { E as Ee, m as qe, R as B, C as mt } from "./snowflake-BUHnLz1S.js";
9
+ import { defineStore as Y } from "pinia";
10
+ import { c as gt, e as yt, A as ke, O as Me, G as Le, a as Pe, D as pt, g as bt, b as wt, C as vt } from "./chatAgentPrompt-DrX26_jN.js";
11
+ const St = [
12
12
  {
13
13
  id: "welcome",
14
14
  title: "Welcome!",
@@ -36,7 +36,7 @@ const mt = [
36
36
  category: "onboarding",
37
37
  highlightDataTestId: "sidebar-icon-tutorial"
38
38
  }
39
- ], gt = [
39
+ ], Ct = [
40
40
  {
41
41
  id: "editor-intro",
42
42
  title: "Settings",
@@ -79,7 +79,7 @@ const mt = [
79
79
  category: "editor",
80
80
  highlightDataTestId: "editor-generate-button"
81
81
  }
82
- ], yt = [
82
+ ], Et = [
83
83
  {
84
84
  id: "dashboard-intro",
85
85
  title: "Dashboard",
@@ -134,7 +134,7 @@ const mt = [
134
134
  content: "A basic dashboard is just charts and tables, but you can use Markdown blocks and filters to make more rich, interactive experiences. Markdown blocks can have source trilogy queries and have a special syntax for embedding results in line.",
135
135
  category: "dashboard"
136
136
  }
137
- ], pt = [
137
+ ], Dt = [
138
138
  {
139
139
  id: "model-intro",
140
140
  title: "Community Models",
@@ -149,7 +149,15 @@ const mt = [
149
149
  category: "community",
150
150
  highlightDataTestId: "copy-dashboard-share-button"
151
151
  }
152
- ];
152
+ ], je = /* @__PURE__ */ new Set(), ye = /* @__PURE__ */ new Map(), xt = {
153
+ query: "select 1 as resolver_warmup;",
154
+ dialect: "duckdb",
155
+ full_model: { name: "", sources: [] },
156
+ imports: [],
157
+ extra_filters: [],
158
+ parameters: {},
159
+ current_filename: "__resolver_warmup__.preql"
160
+ };
153
161
  class W {
154
162
  constructor(e = 100) {
155
163
  w(this, "capacity");
@@ -181,7 +189,7 @@ class W {
181
189
  return this.cache.size;
182
190
  }
183
191
  }
184
- class ur {
192
+ class Sr {
185
193
  constructor(e, t = 100) {
186
194
  w(this, "settingStore");
187
195
  w(this, "validateCache");
@@ -343,28 +351,28 @@ class ur {
343
351
  if (u)
344
352
  return u;
345
353
  const l = [], h = [];
346
- if (e.forEach((y, S) => {
347
- const x = [...i || [], ...y.extra_filters || []], $ = {
354
+ if (e.forEach((y, E) => {
355
+ const T = [...i || [], ...y.extra_filters || []], x = {
348
356
  ...n || {},
349
357
  ...y.parameters || {}
350
- }, T = this.createQueryCacheKey(
358
+ }, _ = this.createQueryCacheKey(
351
359
  y.query,
352
360
  t,
353
361
  s,
354
362
  o,
355
- x.length > 0 ? x : null,
356
- Object.keys($).length > 0 ? $ : null,
363
+ T.length > 0 ? T : null,
364
+ Object.keys(x).length > 0 ? x : null,
357
365
  null
358
- ), E = this.queryCache.get(T);
359
- E ? l.push({
360
- index: S,
361
- result: { ...E.data, label: y.label }
362
- }) : h.push({ index: S, component: y });
366
+ ), F = this.queryCache.get(_);
367
+ F ? l.push({
368
+ index: E,
369
+ result: { ...F.data, label: y.label }
370
+ }) : h.push({ index: E, component: y });
363
371
  }), h.length === 0) {
364
- const S = {
365
- data: { queries: l.sort((x, $) => x.index - $.index).map((x) => x.result) }
372
+ const E = {
373
+ data: { queries: l.sort((T, x) => T.index - x.index).map((T) => T.result) }
366
374
  };
367
- return this.batchQueryCache.set(c, S), S;
375
+ return this.batchQueryCache.set(c, E), E;
368
376
  }
369
377
  const d = {
370
378
  queries: h.map((y) => y.component),
@@ -383,26 +391,26 @@ class ur {
383
391
  },
384
392
  body: JSON.stringify(d)
385
393
  }
386
- )).data.queries.forEach((y, S) => {
387
- const x = h[S].index, $ = h[S].component, T = [...i || [], ...$.extra_filters || []], E = {
394
+ )).data.queries.forEach((y, E) => {
395
+ const T = h[E].index, x = h[E].component, _ = [...i || [], ...x.extra_filters || []], F = {
388
396
  ...n || {},
389
- ...$.parameters || {}
390
- }, O = this.createQueryCacheKey(
391
- $.query,
397
+ ...x.parameters || {}
398
+ }, C = this.createQueryCacheKey(
399
+ x.query,
392
400
  t,
393
401
  s,
394
402
  o,
395
- T.length > 0 ? T : null,
396
- Object.keys(E).length > 0 ? E : null,
403
+ _.length > 0 ? _ : null,
404
+ Object.keys(F).length > 0 ? F : null,
397
405
  null
398
406
  );
399
- this.queryCache.set(O, { data: y }), l.push({
400
- index: x,
401
- result: { ...y, label: $.label }
407
+ this.queryCache.set(C, { data: y }), l.push({
408
+ index: T,
409
+ result: { ...y, label: x.label }
402
410
  });
403
411
  });
404
412
  const m = {
405
- data: { queries: l.sort((y, S) => y.index - S.index).map((y) => y.result) }
413
+ data: { queries: l.sort((y, E) => y.index - E.index).map((y) => y.result) }
406
414
  };
407
415
  return this.batchQueryCache.set(c, m), m;
408
416
  }
@@ -419,9 +427,31 @@ class ur {
419
427
  "Content-Type": "application/json"
420
428
  },
421
429
  body: JSON.stringify(s)
422
- }), a = Ve.fromJSON(n.data);
430
+ }), a = st.fromJSON(n.data);
423
431
  return this.modelCache.set(o, a), a;
424
432
  }
433
+ async warmResolver() {
434
+ const e = this.settingStore.settings.trilogyResolver.replace(/\/+$/, "");
435
+ if (!e || je.has(e))
436
+ return;
437
+ const t = ye.get(e);
438
+ if (t)
439
+ return t;
440
+ const s = this.fetchWithErrorHandling(`${e}/generate_query`, {
441
+ method: "POST",
442
+ headers: {
443
+ "Content-Type": "application/json"
444
+ },
445
+ body: JSON.stringify(xt)
446
+ }).then(() => {
447
+ je.add(e);
448
+ }).catch((o) => {
449
+ console.warn("Resolver warm-up request failed:", o);
450
+ }).finally(() => {
451
+ ye.delete(e);
452
+ });
453
+ return ye.set(e, s), s;
454
+ }
425
455
  // Cache management methods
426
456
  clearAllCaches() {
427
457
  this.validateCache.clear(), this.formatCache.clear(), this.queryCache.clear(), this.batchQueryCache.clear(), this.modelCache.clear();
@@ -436,20 +466,67 @@ class ur {
436
466
  };
437
467
  }
438
468
  }
439
- function bt(r) {
469
+ function Tt(r) {
470
+ return r.replace(/[^a-zA-Z0-9_]/g, "_");
471
+ }
472
+ function $t(r) {
473
+ let e = 0;
474
+ for (let t = 0; t < r.length; t++)
475
+ e = Math.imul(31, e) + r.charCodeAt(t) | 0;
476
+ return Math.abs(e).toString(36).slice(0, 5);
477
+ }
478
+ function oe(r) {
479
+ if (r instanceof Date) {
480
+ const e = r.getFullYear(), t = String(r.getMonth() + 1).padStart(2, "0"), s = String(r.getDate()).padStart(2, "0");
481
+ return `${e}-${t}-${s}`;
482
+ }
483
+ return r !== null && typeof r == "object" && typeof r.toISODate == "function" ? r.toISODate() : r;
484
+ }
485
+ function Ie(r, e, t = "") {
486
+ const s = Tt(r) + "_" + $t(r) + t;
487
+ switch (e.op) {
488
+ case "eq": {
489
+ const o = oe(e.value);
490
+ return {
491
+ filterString: `${r} = :${s}`,
492
+ parameters: { [`:${s}`]: o }
493
+ };
494
+ }
495
+ case "range": {
496
+ const o = oe(e.value[0]), i = oe(e.value[1]);
497
+ return {
498
+ filterString: `${r} between :${s}_min and :${s}_max`,
499
+ parameters: {
500
+ [`:${s}_min`]: o,
501
+ [`:${s}_max`]: i
502
+ }
503
+ };
504
+ }
505
+ case "in": {
506
+ const o = {}, i = e.value.map((n, a) => (o[`:${s}_${a}`] = oe(n), `:${s}_${a}`));
507
+ return {
508
+ filterString: `${r} in (${i.join(", ")})`,
509
+ parameters: o
510
+ };
511
+ }
512
+ case "is_null":
513
+ return { filterString: `${r} IS NULL`, parameters: {} };
514
+ }
515
+ }
516
+ function Cr(r) {
440
517
  if (Array.isArray(r)) {
441
518
  const t = {};
442
519
  return r.forEach((o) => {
443
520
  Object.entries(o).forEach(([i, n]) => {
444
521
  t[i] || (t[i] = []), t[i].push(n);
445
522
  });
446
- }), Object.entries(t).map(([o, i]) => i.length > 1 ? `(${i.map((a) => de(o, a)).join(" OR ")})` : de(o, i[0])).join(" AND ");
523
+ }), Object.entries(t).map(([o, i]) => i.length > 1 ? `(${i.map((a) => pe(o, a)).join(" OR ")})` : pe(o, i[0])).join(" AND ");
447
524
  }
448
525
  return Object.keys(r).length === 0 ? "" : Object.entries(r).map(
449
- ([t, s]) => de(t, s)
526
+ ([t, s]) => pe(t, s)
450
527
  ).join(" AND ");
451
528
  }
452
- function _e(r) {
529
+ function Ne(r) {
453
530
  if (r instanceof Date) {
454
531
  const e = r.getFullYear(), t = String(r.getMonth() + 1).padStart(2, "0"), s = String(r.getDate()).padStart(2, "0");
455
532
  return `'${e}-${t}-${s}'::date`;
@@ -457,45 +534,83 @@ function _e(r) {
457
534
  if (r === null)
458
535
  return "NULL";
459
536
  if (typeof r == "string")
460
- return `'${r.replace(/'/g, be)}'`;
537
+ return `'${r.replace(/'/g, Ee)}'`;
461
538
  if (typeof r == "boolean")
462
539
  return r ? "TRUE" : "FALSE";
463
540
  if (typeof r == "number")
464
541
  return r.toString();
465
542
  }
466
- function de(r, e) {
543
+ function pe(r, e) {
467
544
  if (e === null)
468
545
  return `${r} IS NULL`;
469
546
  if (typeof e == "string") {
470
- const t = e.replace(/'/g, be);
547
+ const t = e.replace(/'/g, Ee);
471
548
  return `${r}='''${t}'''`;
472
549
  } else {
473
550
  if (Array.isArray(e))
474
- return `${r} between ${_e(e[0])} and ${_e(e[e.length - 1])}`;
551
+ return `${r} between ${Ne(e[0])} and ${Ne(e[e.length - 1])}`;
475
552
  if (typeof e == "number" || typeof e == "boolean")
476
553
  return `${r}=${e}`;
477
554
  if (e === void 0)
478
555
  return `${r} IS NULL`;
479
556
  {
480
- const t = JSON.stringify(e).replace(/'/g, be);
557
+ const t = JSON.stringify(e).replace(/'/g, Ee);
481
558
  return `${r}='${t}'`;
482
559
  }
483
560
  }
484
561
  }
485
- function wt(r = []) {
562
+ function At(r = []) {
486
563
  const e = /* @__PURE__ */ new Set();
487
564
  for (const t of r)
488
565
  t != null && t.label && e.add(t.label);
489
566
  return Array.from(e);
490
567
  }
491
- function B(r) {
568
+ function ue(r) {
492
569
  return { ...r };
493
570
  }
494
- function ae(r, e) {
571
+ function G(r) {
572
+ return { ...r };
573
+ }
574
+ function Ft(r, e) {
575
+ if (r.op !== e.op) return !1;
576
+ switch (r.op) {
577
+ case "is_null":
578
+ return !0;
579
+ case "eq":
580
+ return r.value === e.value;
581
+ case "range": {
582
+ const t = e;
583
+ return r.value[0] === t.value[0] && r.value[1] === t.value[1];
584
+ }
585
+ case "in": {
586
+ const t = e;
587
+ return r.value.length === t.value.length && r.value.every((s, o) => s === t.value[o]);
588
+ }
589
+ }
590
+ }
591
+ function he(r, e) {
495
592
  const t = Object.keys(r).sort(), s = Object.keys(e).sort();
496
- return t.length !== s.length ? !1 : t.every((o, i) => o === s[i] && r[o] === e[o]);
593
+ return t.length !== s.length ? !1 : t.every(
594
+ (o, i) => o === s[i] && Ft(r[o], e[o])
595
+ );
596
+ }
597
+ function _t(r, e) {
598
+ return Array.isArray(r) && Array.isArray(e) ? r.length === e.length && r.every((t, s) => t === e[s]) : r === e;
599
+ }
600
+ function Re(r, e) {
601
+ const t = Object.keys(r).sort(), s = Object.keys(e).sort();
602
+ return t.length !== s.length ? !1 : t.every(
603
+ (o, i) => o === s[i] && _t(r[o], e[o])
604
+ );
605
+ }
606
+ function Qt(r, e, t, s) {
607
+ const o = r.filter((c) => c.source !== e), i = r.filter((c) => c.source === e);
608
+ if (s === "remove") return o;
609
+ if (s === "add") return [...o, { source: e, value: G(t) }];
610
+ const a = i.some((c) => Re(c.value, t)) ? i.filter((c) => !Re(c.value, t)) : [...i, { source: e, value: G(t) }];
611
+ return [...o, ...a];
497
612
  }
498
- function vt(r, e, t) {
613
+ function Ot(r, e, t) {
499
614
  if (e.size === 0)
500
615
  return t && r.startsWith("local.") ? r.replace(/^local\./, "") : r;
501
616
  if (e.has(r))
@@ -507,41 +622,62 @@ function vt(r, e, t) {
507
622
  }
508
623
  return null;
509
624
  }
510
- function St(r, e = [], t = {}) {
625
+ function qt(r, e = [], t = {}) {
511
626
  const s = new Set(e), o = t.normalizeLocalFields ?? !1;
512
627
  return Object.entries(r).reduce((i, [n, a]) => {
513
- if (typeof a != "string")
628
+ if (typeof a != "object" || a === null || !["eq", "range", "in", "is_null"].includes(a.op))
514
629
  return i;
515
- const c = vt(n, s, o);
630
+ const c = Ot(n, s, o);
516
631
  return c && (i[c] = a), i;
517
632
  }, {});
518
633
  }
519
- function Re(r) {
520
- return r.length ? bt(r.map((e) => e.value)) : "";
634
+ function De(r) {
635
+ if (!r.length)
636
+ return { filterStrings: [], parameters: {} };
637
+ const e = {};
638
+ for (const o of r)
639
+ for (const [i, n] of Object.entries(o.value))
640
+ e[i] || (e[i] = []), e[i].push(n);
641
+ const t = [];
642
+ let s = {};
643
+ for (const [o, i] of Object.entries(e))
644
+ if (i.length > 1) {
645
+ const n = [];
646
+ for (let a = 0; a < i.length; a++) {
647
+ const { filterString: c, parameters: u } = Ie(o, i[a], `_or${a}`);
648
+ n.push(c), s = { ...s, ...u };
649
+ }
650
+ t.push(`(${n.join(" OR ")})`);
651
+ } else {
652
+ const { filterString: n, parameters: a } = Ie(o, i[0]);
653
+ t.push(n), s = { ...s, ...a };
654
+ }
655
+ return { filterStrings: t, parameters: s };
521
656
  }
522
- function le(r) {
523
- const e = r.conceptFilters || [], t = (r.filters || []).filter((i) => i.source !== "cross"), s = Re(e);
524
- s && t.push({
657
+ function fe(r) {
658
+ const e = r.conceptFilters || [], t = (r.filters || []).filter((a) => a.source !== "cross"), { filterStrings: s, parameters: o } = De(e), i = s.join(" AND ");
659
+ i && t.push({
525
660
  source: "cross",
526
- value: s
661
+ value: i,
662
+ parameters: Object.keys(o).length ? o : void 0
527
663
  });
528
- const o = JSON.stringify(t) !== JSON.stringify(r.filters || []);
529
- return r.filters = t, o;
664
+ const n = JSON.stringify(t) !== JSON.stringify(r.filters || []);
665
+ return r.filters = t, n;
530
666
  }
531
- function ke(r, e, t, s) {
667
+ function kt(r, e, t, s) {
532
668
  const o = r.filter((c) => c.source !== e), i = r.filter((c) => c.source === e);
533
669
  if (s === "remove")
534
670
  return o;
535
671
  if (s === "add")
536
- return [...o, { source: e, value: B(t) }];
537
- const a = i.some((c) => ae(c.value, t)) ? i.filter((c) => !ae(c.value, t)) : [...i, { source: e, value: B(t) }];
672
+ return [...o, { source: e, value: ue(t) }];
673
+ const a = i.some((c) => he(c.value, t)) ? i.filter((c) => !he(c.value, t)) : [...i, { source: e, value: ue(t) }];
538
674
  return [...o, ...a];
539
675
  }
540
- function Ct(r, e, t, s, o) {
676
+ function Mt(r, e, t, s, o) {
541
677
  const i = [];
542
678
  return Object.entries(r).forEach(([n, a]) => {
543
679
  if (n === e) {
544
- const h = ke(
680
+ const h = Qt(
545
681
  a.chartFilters || [],
546
682
  e,
547
683
  s,
@@ -552,18 +688,18 @@ function Ct(r, e, t, s, o) {
552
688
  }
553
689
  if (!a.allowCrossFilter)
554
690
  return;
555
- const c = ke(
691
+ const c = kt(
556
692
  a.conceptFilters || [],
557
693
  e,
558
694
  t,
559
695
  o
560
696
  ), u = JSON.stringify(c) !== JSON.stringify(a.conceptFilters || []);
561
697
  u && (a.conceptFilters = c);
562
- const l = le(a);
698
+ const l = fe(a);
563
699
  (u || l) && i.push(n);
564
700
  }), i;
565
701
  }
566
- function Et(r, e, t) {
702
+ function Lt(r, e, t) {
567
703
  const s = r[e];
568
704
  if (!s)
569
705
  return !1;
@@ -571,10 +707,10 @@ function Et(r, e, t) {
571
707
  (a) => a.source !== t
572
708
  ), i = JSON.stringify(o) !== JSON.stringify(s.conceptFilters || []);
573
709
  i && (s.conceptFilters = o);
574
- const n = le(s);
710
+ const n = fe(s);
575
711
  return i || n;
576
712
  }
577
- function Dt(r, e) {
713
+ function Pt(r, e) {
578
714
  const t = [];
579
715
  return Object.entries(r).forEach(([s, o]) => {
580
716
  if (s === e) {
@@ -585,11 +721,11 @@ function Dt(r, e) {
585
721
  (c) => c.source !== e
586
722
  ), n = JSON.stringify(i) !== JSON.stringify(o.conceptFilters || []);
587
723
  n && (o.conceptFilters = i);
588
- const a = le(o);
724
+ const a = fe(o);
589
725
  (n || a) && t.push(s);
590
726
  }), t;
591
727
  }
592
- function xt(r) {
728
+ function jt(r) {
593
729
  const e = [];
594
730
  return Object.entries(r).forEach(([t, s]) => {
595
731
  var i, n, a;
@@ -597,18 +733,18 @@ function xt(r) {
597
733
  s.conceptFilters = [], s.chartFilters = [], s.filters = [], o && e.push(t);
598
734
  }), e;
599
735
  }
600
- function Tt(r = {}) {
736
+ function It(r = {}) {
601
737
  const e = /* @__PURE__ */ new Map(), t = () => {
602
- const o = r.validFields ? Be(r.validFields) : [];
738
+ const o = r.validFields ? Ve(r.validFields) : [];
603
739
  return new Set(o);
604
740
  }, s = (o) => {
605
- const i = St(o.filters, t(), {
741
+ const i = qt(o.filters, t(), {
606
742
  normalizeLocalFields: r.normalizeLocalFields ?? !0
607
743
  });
608
744
  return {
609
745
  source: o.source,
610
746
  filters: i,
611
- chart: B(o.chart || i),
747
+ chart: G(o.chart || {}),
612
748
  append: o.append
613
749
  };
614
750
  };
@@ -616,8 +752,8 @@ function Tt(r = {}) {
616
752
  getSelections() {
617
753
  return Array.from(e.values()).flat().map((o) => ({
618
754
  source: o.source,
619
- filters: B(o.filters),
620
- chart: B(o.chart || o.filters),
755
+ filters: ue(o.filters),
756
+ chart: G(o.chart || {}),
621
757
  append: o.append
622
758
  }));
623
759
  },
@@ -634,8 +770,8 @@ function Tt(r = {}) {
634
770
  if (a === "add")
635
771
  return e.set(o.source, [n]), n.filters;
636
772
  const l = c.some(
637
- (h) => ae(h.filters, n.filters)
638
- ) ? c.filter((h) => !ae(h.filters, n.filters)) : [...c, n];
773
+ (h) => he(h.filters, n.filters)
774
+ ) ? c.filter((h) => !he(h.filters, n.filters)) : [...c, n];
639
775
  return l.length === 0 ? e.delete(o.source) : e.set(o.source, l), n.filters;
640
776
  },
641
777
  clearSource(o) {
@@ -651,30 +787,33 @@ function Tt(r = {}) {
651
787
  return Array.from(e.entries()).filter(([i]) => i !== o).flatMap(
652
788
  ([i, n]) => n.map((a) => ({
653
789
  source: i,
654
- value: B(a.filters)
790
+ value: ue(a.filters)
655
791
  }))
656
792
  );
657
793
  },
658
794
  getChartSelectionsFor(o) {
659
- return (e.get(o) || []).map(
660
- (i) => B(i.chart || i.filters)
661
- );
795
+ return (e.get(o) || []).map((i) => G(i.chart || {}));
662
796
  },
663
797
  getFilterExpressionFor(o) {
664
- return Re(this.getSqlFilterInputsFor(o));
798
+ const { filterStrings: i } = De(this.getSqlFilterInputsFor(o));
799
+ return i.join(" AND ");
665
800
  },
666
801
  getSqlFiltersFor(o, i = []) {
667
802
  const n = this.getFilterExpressionFor(o);
668
803
  return n ? [...i, n] : [...i];
804
+ },
805
+ getSqlParametersFor(o) {
806
+ const { parameters: i } = De(this.getSqlFilterInputsFor(o));
807
+ return i;
669
808
  }
670
809
  };
671
810
  }
672
- function hr(r = {}) {
673
- const e = Q(0), t = Tt(Be(r)), s = () => {
811
+ function Er(r = {}) {
812
+ const e = Q(0), t = It(Ve(r)), s = () => {
674
813
  e.value += 1;
675
814
  };
676
815
  return {
677
- version: nt(() => e.value),
816
+ version: dt(() => e.value),
678
817
  applyDimensionClick(o, i) {
679
818
  const n = t.applyDimensionClick(o, i);
680
819
  return s(), n;
@@ -705,17 +844,20 @@ function hr(r = {}) {
705
844
  },
706
845
  getSqlFiltersFor(o, i = []) {
707
846
  return e.value, t.getSqlFiltersFor(o, i);
847
+ },
848
+ getSqlParametersFor(o) {
849
+ return e.value, t.getSqlParametersFor(o);
708
850
  }
709
851
  };
710
852
  }
711
- const M = {
853
+ const L = {
712
854
  CHART: "chart",
713
855
  MARKDOWN: "markdown",
714
856
  TABLE: "table",
715
857
  FILTER: "filter",
716
858
  SECTION_HEADER: "section-header"
717
859
  };
718
- class G {
860
+ class V {
719
861
  constructor({
720
862
  id: e,
721
863
  name: t,
@@ -729,7 +871,7 @@ class G {
729
871
  filter: l = null,
730
872
  imports: h = [],
731
873
  version: d = 1,
732
- state: g = "editing",
874
+ state: f = "editing",
733
875
  description: v = ""
734
876
  }) {
735
877
  w(this, "id");
@@ -748,7 +890,7 @@ class G {
748
890
  w(this, "description", "");
749
891
  w(this, "changed", !1);
750
892
  w(this, "deleted", !1);
751
- this.id = e, this.name = t, this.storage = s, this.connection = o, this.layout = i, this.gridItems = n, this.nextId = a, this.createdAt = c || /* @__PURE__ */ new Date(), this.updatedAt = u || /* @__PURE__ */ new Date(), this.filter = l, this.imports = h, this.version = d, this.state = g, this.description = v, this.changed = !1;
893
+ this.id = e, this.name = t, this.storage = s, this.connection = o, this.layout = i, this.gridItems = n, this.nextId = a, this.createdAt = c || /* @__PURE__ */ new Date(), this.updatedAt = u || /* @__PURE__ */ new Date(), this.filter = l, this.imports = h, this.version = d, this.state = f, this.description = v, this.changed = !1;
752
894
  }
753
895
  delete() {
754
896
  this.deleted = !0, this.changed = !0;
@@ -761,7 +903,7 @@ class G {
761
903
  addItem(e, t = 0, s = 0, o = 4, i = null, n = null, a) {
762
904
  const c = this.nextId.toString();
763
905
  let u = 10;
764
- e === M.MARKDOWN ? u = 3 : e === M.SECTION_HEADER && (u = 1);
906
+ e === L.MARKDOWN ? u = 3 : e === L.SECTION_HEADER && (u = 1);
765
907
  let l = s;
766
908
  l = this.layout.reduce((m, y) => Math.max(m, y.y + y.h), 0), this.layout.push({
767
909
  x: t,
@@ -772,18 +914,18 @@ class G {
772
914
  static: !1
773
915
  });
774
916
  let h = `Note ${c}`;
775
- e === M.CHART ? h = `Chart ${c}` : e === M.TABLE ? h = `Table ${c}` : e === M.SECTION_HEADER && (h = "### Section Header");
776
- let d = a || h, g = `# Markdown Cell
917
+ e === L.CHART ? h = `Chart ${c}` : e === L.TABLE ? h = `Table ${c}` : e === L.SECTION_HEADER && (h = "### Section Header");
918
+ let d = a || h, f = `# Markdown Cell
777
919
  Enter your markdown content here.`;
778
- e === M.CHART ? g = "SELECT unnest([1,2,3,4]) as value, 'example' as dim" : e === M.TABLE ? g = "SELECT [1,2,3,4] as value, 'example' as dim" : e === M.SECTION_HEADER && (g = "");
779
- let v = n || g;
920
+ e === L.CHART ? f = "SELECT unnest([1,2,3,4]) as value, 'example' as dim" : e === L.TABLE ? f = "SELECT [1,2,3,4] as value, 'example' as dim" : e === L.SECTION_HEADER && (f = "");
921
+ let v = n || f;
780
922
  return this.gridItems[c] = {
781
923
  type: e,
782
924
  content: v,
783
925
  name: d,
784
926
  width: 0,
785
927
  height: 0,
786
- allowCrossFilter: e !== M.SECTION_HEADER
928
+ allowCrossFilter: e !== L.SECTION_HEADER
787
929
  }, this.nextId++, this.updatedAt = /* @__PURE__ */ new Date(), this.changed = !0, c;
788
930
  }
789
931
  copyItem(e) {
@@ -884,24 +1026,24 @@ Enter your markdown content here.`;
884
1026
  }
885
1027
  updateItemFilters(e) {
886
1028
  const t = this.gridItems[e];
887
- t && le(t) && (this.updatedAt = /* @__PURE__ */ new Date(), this.changed = !0);
1029
+ t && fe(t) && (this.updatedAt = /* @__PURE__ */ new Date(), this.changed = !0);
888
1030
  }
889
1031
  removeItemCrossFilter(e, t) {
890
- Et(this.gridItems, e, t) && (this.updatedAt = /* @__PURE__ */ new Date(), this.changed = !0);
1032
+ Lt(this.gridItems, e, t) && (this.updatedAt = /* @__PURE__ */ new Date(), this.changed = !0);
891
1033
  }
892
1034
  removeItemCrossFilterSource(e) {
893
1035
  var o, i;
894
- const t = !!((i = (o = this.gridItems[e]) == null ? void 0 : o.chartFilters) != null && i.length), s = Dt(this.gridItems, e);
1036
+ const t = !!((i = (o = this.gridItems[e]) == null ? void 0 : o.chartFilters) != null && i.length), s = Pt(this.gridItems, e);
895
1037
  return (s.length > 0 || t) && (this.updatedAt = /* @__PURE__ */ new Date(), this.changed = !0), s;
896
1038
  }
897
1039
  removeAllFilters() {
898
- const e = xt(this.gridItems);
1040
+ const e = jt(this.gridItems);
899
1041
  for (const t in this.gridItems)
900
1042
  this.gridItems[t].parameters = {};
901
1043
  return e.length > 0 && (this.updatedAt = /* @__PURE__ */ new Date(), this.changed = !0), e;
902
1044
  }
903
1045
  updateItemCrossFilters(e, t, s, o) {
904
- const i = Ct(
1046
+ const i = Mt(
905
1047
  this.gridItems,
906
1048
  e,
907
1049
  t,
@@ -1022,10 +1164,10 @@ Enter your markdown content here.`;
1022
1164
  loadStartTime: null,
1023
1165
  allowCrossFilter: o.allowCrossFilter !== !1,
1024
1166
  // Default to true if not explicitly false
1025
- chartConfig: $e(o.chartConfig),
1026
- drilldownChartConfig: $e(o.drilldownChartConfig)
1167
+ chartConfig: qe(o.chartConfig),
1168
+ drilldownChartConfig: qe(o.drilldownChartConfig)
1027
1169
  };
1028
- return new G({
1170
+ return new V({
1029
1171
  ...e,
1030
1172
  createdAt: new Date(e.createdAt),
1031
1173
  updatedAt: new Date(e.updatedAt),
@@ -1033,7 +1175,7 @@ Enter your markdown content here.`;
1033
1175
  });
1034
1176
  }
1035
1177
  }
1036
- const fe = (r) => {
1178
+ const be = (r) => {
1037
1179
  const t = r.replace(/'''/g, "```").replace(/"""/g, "```").replace(/```(trilogy|sql|json)(\s|\n)/g, "```");
1038
1180
  for (const s of ["```\\s*```", "```"]) {
1039
1181
  const o = t.match(new RegExp(`${s}([\\s\\S]*)${s}`, "s"));
@@ -1041,7 +1183,7 @@ const fe = (r) => {
1041
1183
  return o[o.length - 1];
1042
1184
  }
1043
1185
  return r;
1044
- }, dr = V("llmConnections", {
1186
+ }, Dr = Y("llmConnections", {
1045
1187
  state: () => ({
1046
1188
  connections: {},
1047
1189
  activeConnection: ""
@@ -1069,20 +1211,20 @@ const fe = (r) => {
1069
1211
  throw new Error(`LLM connection with name "${r}" already exists.`);
1070
1212
  let s;
1071
1213
  if (e === "demo")
1072
- s = new ut(r, t.model);
1214
+ s = new pt(r, t.model);
1073
1215
  else if (e === "anthropic")
1074
- s = new Ae(
1216
+ s = new ke(
1075
1217
  r,
1076
1218
  t.apiKey,
1077
1219
  t.model,
1078
1220
  t.saveCredential
1079
1221
  );
1080
1222
  else if (e === "openai")
1081
- s = new Fe(r, t.apiKey, t.model, t.saveCredential);
1223
+ s = new Me(r, t.apiKey, t.model, t.saveCredential);
1082
1224
  else if (e === "google")
1083
- s = new Qe(r, t.apiKey, t.model, t.saveCredential);
1225
+ s = new Le(r, t.apiKey, t.model, t.saveCredential);
1084
1226
  else if (e === "openrouter")
1085
- s = new Oe(
1227
+ s = new Pe(
1086
1228
  r,
1087
1229
  t.apiKey,
1088
1230
  t.model,
@@ -1102,13 +1244,13 @@ const fe = (r) => {
1102
1244
  let t;
1103
1245
  const s = `__temp_${r}_${Date.now()}`;
1104
1246
  if (r === "anthropic")
1105
- t = new Ae(s, e, "", !1);
1247
+ t = new ke(s, e, "", !1);
1106
1248
  else if (r === "openai")
1107
- t = new Fe(s, e, "", !1);
1249
+ t = new Me(s, e, "", !1);
1108
1250
  else if (r === "google")
1109
- t = new Qe(s, e, "", !1);
1251
+ t = new Le(s, e, "", !1);
1110
1252
  else if (r === "openrouter")
1111
- t = new Oe(s, e, "", !1);
1253
+ t = new Pe(s, e, "", !1);
1112
1254
  else
1113
1255
  throw new Error(`LLM provider type "${r}" not found.`);
1114
1256
  return await t.reset(), t.models;
@@ -1132,7 +1274,7 @@ const fe = (r) => {
1132
1274
  role: "assistant",
1133
1275
  content: h.text,
1134
1276
  toolCalls: h.toolCalls
1135
- }), console.log("Initial LLM response:", h.text), l = fe(h.text), e)
1277
+ }), console.log("Initial LLM response:", h.text), l = be(h.text), e)
1136
1278
  for (; c < t && !u; )
1137
1279
  try {
1138
1280
  if (!l || l.trim() == "")
@@ -1145,8 +1287,8 @@ const fe = (r) => {
1145
1287
  console.log(`Max attempts (${t}) reached, returning last response`);
1146
1288
  break;
1147
1289
  }
1148
- let g = d.message, v = `
1149
- You had given a response: """${l}""" that failed validation on this error: ${g}. Generate a new response that solves the original request while fixing the error. Ensure the new answer to validate is still enclosed within triple double quotes with no extra content. Put your reasoning on the fix before the quotes.`;
1290
+ let f = d.message, v = `
1291
+ You had given a response: """${l}""" that failed validation on this error: ${f}. Generate a new response that solves the original request while fixing the error. Ensure the new answer to validate is still enclosed within triple double quotes with no extra content. Put your reasoning on the fix before the quotes.`;
1150
1292
  h = await this.generateCompletion(
1151
1293
  n,
1152
1294
  {
@@ -1160,7 +1302,7 @@ You had given a response: """${l}""" that failed validation on this error: ${g}.
1160
1302
  role: "assistant",
1161
1303
  content: h.text,
1162
1304
  toolCalls: h.toolCalls
1163
- }), l = fe(h.text), console.log(`Attempt ${c}. New extract:`, l);
1305
+ }), l = be(h.text), console.log(`Attempt ${c}. New extract:`, l);
1164
1306
  }
1165
1307
  return console.log("Exiting validation loop with attempts:", c), console.log("Final LLM response:", l), {
1166
1308
  success: u,
@@ -1172,11 +1314,11 @@ You had given a response: """${l}""" that failed validation on this error: ${g}.
1172
1314
  };
1173
1315
  },
1174
1316
  async generateDashboardCompletion(r, e = null, t = [], s = 3) {
1175
- let o = et(r, t);
1317
+ let o = at(r, t);
1176
1318
  return this.generateValidatedCompletion(o, e, s).then((i) => i.content);
1177
1319
  },
1178
1320
  async generateQueryCompletion(r, e, t = null, s = 3, o = null) {
1179
- let i = Ze(r, e);
1321
+ let i = it(r, e);
1180
1322
  return this.generateValidatedCompletion(i, t, s, o);
1181
1323
  },
1182
1324
  async generateSQLQueryCompletion(r) {
@@ -1186,12 +1328,12 @@ You had given a response: """${l}""" that failed validation on this error: ${g}.
1186
1328
  success: !0,
1187
1329
  prompt: r,
1188
1330
  message: e.text,
1189
- content: fe(e.text),
1331
+ content: be(e.text),
1190
1332
  attempts: 1
1191
1333
  }));
1192
1334
  },
1193
1335
  async generateFilterQuery(r, e, t = null, s = 3) {
1194
- let o = Xe(r, e);
1336
+ let o = nt(r, e);
1195
1337
  return this.generateValidatedCompletion(o, t, s).then((i) => i.content);
1196
1338
  },
1197
1339
  /**
@@ -1205,7 +1347,7 @@ You had given a response: """${l}""" that failed validation on this error: ${g}.
1205
1347
  const t = this.connections[r];
1206
1348
  if (!t)
1207
1349
  throw new Error(`LLM connection with name "${r}" not found.`);
1208
- const s = ct(e), o = t.model, i = t.getFastModel();
1350
+ const s = gt(e), o = t.model, i = t.getFastModel();
1209
1351
  try {
1210
1352
  i !== o && (t.model = i);
1211
1353
  const n = await t.generateCompletion(
@@ -1217,7 +1359,7 @@ You had given a response: """${l}""" that failed validation on this error: ${g}.
1217
1359
  },
1218
1360
  null
1219
1361
  );
1220
- return lt(n.text);
1362
+ return yt(n.text);
1221
1363
  } finally {
1222
1364
  i !== o && (t.model = o);
1223
1365
  }
@@ -1242,7 +1384,7 @@ You had given a response: """${l}""" that failed validation on this error: ${g}.
1242
1384
  hasActiveDefaultConnection: (r) => Object.values(r.connections).some((e) => e.isDefault && e.connected)
1243
1385
  }
1244
1386
  });
1245
- class $t {
1387
+ class Nt {
1246
1388
  constructor(e, t, s, o, i, n, a = {}) {
1247
1389
  w(this, "queryQueue", /* @__PURE__ */ new Map());
1248
1390
  w(this, "activeQueries", /* @__PURE__ */ new Set());
@@ -1325,51 +1467,55 @@ class $t {
1325
1467
  * Queue a single query for execution
1326
1468
  */
1327
1469
  runSingle(e) {
1328
- let t = this.getItemData(e, this.dashboardId), s = (this.getItemData(e, this.dashboardId).filters || []).map(
1329
- (c) => c.value
1470
+ let t = this.getItemData(e, this.dashboardId);
1471
+ const s = this.getItemData(e, this.dashboardId).filters || [];
1472
+ let o = s.map((l) => l.value);
1473
+ const i = Object.assign(
1474
+ {},
1475
+ ...s.map((l) => l.parameters || {})
1330
1476
  );
1331
1477
  this.setItemData(e, this.dashboardId, {
1332
1478
  loading: !0,
1333
1479
  error: null
1334
1480
  });
1335
- let o = {
1481
+ let n = {
1336
1482
  dashboardId: this.dashboardId,
1337
1483
  queryInput: {
1338
1484
  text: t.structured_content ? t.structured_content.query : t.content,
1339
- extraFilters: s,
1340
- parameters: t.parameters || {},
1485
+ extraFilters: o,
1486
+ parameters: { ...t.parameters || {}, ...i },
1341
1487
  extraContent: t.rootContent || []
1342
1488
  },
1343
1489
  priority: this.getDefaultPriority(e),
1344
1490
  itemId: e,
1345
- onSuccess: (c) => {
1346
- this.isLatestQueryForItem(a) ? this.setItemData(e, this.dashboardId, {
1347
- results: c.results
1491
+ onSuccess: (l) => {
1492
+ this.isLatestQueryForItem(u) ? this.setItemData(e, this.dashboardId, {
1493
+ results: l.results
1348
1494
  }) : console.log(`Ignoring outdated query result for itemId ${e}`);
1349
1495
  },
1350
- onError: (c) => {
1351
- this.isLatestQueryForItem(a) ? this.setItemData(e, this.dashboardId, { error: c }) : console.log(`Ignoring outdated query error for itemId ${e}`);
1496
+ onError: (l) => {
1497
+ this.isLatestQueryForItem(u) ? this.setItemData(e, this.dashboardId, { error: l }) : console.log(`Ignoring outdated query error for itemId ${e}`);
1352
1498
  },
1353
- onProgress: (c) => {
1499
+ onProgress: (l) => {
1354
1500
  }
1355
1501
  };
1356
- const i = this.generateQueryId(o);
1502
+ const a = this.generateQueryId(n);
1357
1503
  this.cancelPendingQueriesForItem(e);
1358
- const n = this.findDuplicateQuery(o);
1359
- let a;
1360
- if (n)
1361
- console.log(`Deduplicating query for ${o.itemId}`), a = n.id, this.addCallbacksToExistingQuery(n, o);
1504
+ const c = this.findDuplicateQuery(n);
1505
+ let u;
1506
+ if (c)
1507
+ console.log(`Deduplicating query for ${n.itemId}`), u = c.id, this.addCallbacksToExistingQuery(c, n);
1362
1508
  else {
1363
- a = i;
1364
- const c = {
1365
- ...o,
1366
- id: a,
1509
+ u = a;
1510
+ const l = {
1511
+ ...n,
1512
+ id: u,
1367
1513
  timestamp: Date.now(),
1368
1514
  retryCount: 0
1369
1515
  };
1370
- this.queryQueue.set(a, c), this.activeQueries.size < this.maxConcurrentQueries && (console.log(`Executing query immediately for ${o.itemId}`), this.executeQuery(a));
1516
+ this.queryQueue.set(u, l), this.activeQueries.size < this.maxConcurrentQueries && (console.log(`Executing query immediately for ${n.itemId}`), this.executeQuery(u));
1371
1517
  }
1372
- return this.latestQueryByItemId.set(e, a), this.itemIdByQueryId.set(a, e), a;
1518
+ return this.latestQueryByItemId.set(e, u), this.itemIdByQueryId.set(u, e), u;
1373
1519
  }
1374
1520
  /**
1375
1521
  * Queue multiple queries for batch execution with prioritization
@@ -1377,7 +1523,15 @@ class $t {
1377
1523
  runBatch(e) {
1378
1524
  const t = [];
1379
1525
  return this.batchTimeout && clearTimeout(this.batchTimeout), e.forEach((s) => {
1380
- let o = this.getItemData(s, this.dashboardId), i = (o.filters || []).map((h) => h.value);
1526
+ let o = this.getItemData(s, this.dashboardId);
1527
+ const i = o.filters || [];
1528
+ let n = i.map((f) => f.value);
1529
+ const a = Object.assign(
1530
+ {},
1531
+ ...i.map(
1532
+ (f) => f.parameters || {}
1533
+ )
1534
+ );
1381
1535
  if (o.structured_content.query.trim().length === 0) {
1382
1536
  this.setItemData(s, this.dashboardId, {
1383
1537
  error: null,
@@ -1389,44 +1543,44 @@ class $t {
1389
1543
  loading: !0,
1390
1544
  error: null
1391
1545
  });
1392
- let a = {
1546
+ let u = {
1393
1547
  dashboardId: this.dashboardId,
1394
1548
  queryInput: {
1395
1549
  text: o.structured_content ? o.structured_content.query : o.content,
1396
- extraFilters: i,
1397
- parameters: o.parameters || {},
1550
+ extraFilters: n,
1551
+ parameters: { ...o.parameters || {}, ...a },
1398
1552
  extraContent: o.rootContent || []
1399
1553
  },
1400
1554
  priority: this.getDefaultPriority(s),
1401
1555
  itemId: s,
1402
- onSuccess: (h) => {
1403
- this.isLatestQueryForItem(l) ? this.setItemData(s, this.dashboardId, {
1404
- results: h.results
1556
+ onSuccess: (f) => {
1557
+ this.isLatestQueryForItem(d) ? this.setItemData(s, this.dashboardId, {
1558
+ results: f.results
1405
1559
  }) : console.log(`Ignoring outdated batch query result for itemId ${s}`);
1406
1560
  },
1407
- onError: (h) => {
1408
- this.isLatestQueryForItem(l) ? this.setItemData(s, this.dashboardId, { error: h }) : console.log(`Ignoring outdated batch query error for itemId ${s}`);
1561
+ onError: (f) => {
1562
+ this.isLatestQueryForItem(d) ? this.setItemData(s, this.dashboardId, { error: f }) : console.log(`Ignoring outdated batch query error for itemId ${s}`);
1409
1563
  },
1410
- onProgress: (h) => {
1564
+ onProgress: (f) => {
1411
1565
  }
1412
1566
  };
1413
- const c = this.generateQueryId(a);
1567
+ const l = this.generateQueryId(u);
1414
1568
  this.cancelPendingQueriesForItem(s);
1415
- const u = this.findDuplicateQuery(a);
1416
- let l;
1417
- if (u)
1418
- console.log(`Deduplicating batch query for ${a.itemId}`), l = u.id, this.addCallbacksToExistingQuery(u, a);
1569
+ const h = this.findDuplicateQuery(u);
1570
+ let d;
1571
+ if (h)
1572
+ console.log(`Deduplicating batch query for ${u.itemId}`), d = h.id, this.addCallbacksToExistingQuery(h, u);
1419
1573
  else {
1420
- l = c;
1421
- const h = {
1422
- ...a,
1423
- id: l,
1574
+ d = l;
1575
+ const f = {
1576
+ ...u,
1577
+ id: d,
1424
1578
  timestamp: Date.now(),
1425
1579
  retryCount: 0
1426
1580
  };
1427
- this.queryQueue.set(l, h);
1581
+ this.queryQueue.set(d, f);
1428
1582
  }
1429
- this.latestQueryByItemId.set(s, l), this.itemIdByQueryId.set(l, s), t.push(l);
1583
+ this.latestQueryByItemId.set(s, d), this.itemIdByQueryId.set(d, s), t.push(d);
1430
1584
  }), this.batchTimeout = setTimeout(() => {
1431
1585
  this.processBatch();
1432
1586
  }, this.batchDelay), t;
@@ -1513,8 +1667,8 @@ class $t {
1513
1667
  o.map((l) => [
1514
1668
  l.label,
1515
1669
  (h) => {
1516
- var g;
1517
- (g = i.find((v) => v.id === l.label)) == null || g.onSuccess(h);
1670
+ var f;
1671
+ (f = i.find((v) => v.id === l.label)) == null || f.onSuccess(h);
1518
1672
  const d = this.queryWaiters.get(l.label);
1519
1673
  d && (d.resolve(h), this.queryWaiters.delete(l.label)), this.activeQueries.delete(l.label), this.cleanupQueryTracking(l.label);
1520
1674
  }
@@ -1523,7 +1677,7 @@ class $t {
1523
1677
  o.map((l) => [
1524
1678
  l.label,
1525
1679
  (h) => {
1526
- let d = i.find((g) => g.id === l.label);
1680
+ let d = i.find((f) => f.id === l.label);
1527
1681
  d && this.handleQueryError(d, h), this.activeQueries.delete(l.label), this.cleanupQueryTracking(l.label);
1528
1682
  }
1529
1683
  ])
@@ -1611,7 +1765,7 @@ class $t {
1611
1765
  }
1612
1766
  }
1613
1767
  }
1614
- const At = (r) => r.replace(/\s+/g, ""), Ft = V("dashboards", {
1768
+ const Rt = (r) => r.replace(/\s+/g, ""), Jt = Y("dashboards", {
1615
1769
  state: () => ({
1616
1770
  dashboards: {},
1617
1771
  activeDashboardId: "",
@@ -1635,7 +1789,7 @@ const At = (r) => r.replace(/\s+/g, ""), Ft = V("dashboards", {
1635
1789
  throw new Error(`Dashboard with ID "${r}" not found.`);
1636
1790
  if (this.queryExecutors[r])
1637
1791
  return this.queryExecutors[r];
1638
- const t = new $t(
1792
+ const t = new Nt(
1639
1793
  e.queryExecutionService,
1640
1794
  e.connectionName,
1641
1795
  e.dashboardId,
@@ -1679,7 +1833,7 @@ const At = (r) => r.replace(/\s+/g, ""), Ft = V("dashboards", {
1679
1833
  const t = r;
1680
1834
  if (Object.values(this.dashboards).some((o) => o.name === r))
1681
1835
  throw new Error(`A dashboard with name ${r} already exists.`);
1682
- const s = new G({
1836
+ const s = new V({
1683
1837
  id: t,
1684
1838
  name: r,
1685
1839
  connection: e,
@@ -1695,7 +1849,7 @@ const At = (r) => r.replace(/\s+/g, ""), Ft = V("dashboards", {
1695
1849
  let t = `${e.name} (copy)`, s = 1;
1696
1850
  for (; Object.values(this.dashboards).some((i) => i.name === t); )
1697
1851
  t = `${e.name} (copy ${s})`, s++;
1698
- const o = new G({
1852
+ const o = new V({
1699
1853
  id: t,
1700
1854
  name: t,
1701
1855
  connection: e.connection,
@@ -1725,7 +1879,7 @@ const At = (r) => r.replace(/\s+/g, ""), Ft = V("dashboards", {
1725
1879
  // Load dashboards from serialized data
1726
1880
  loadDashboards(r) {
1727
1881
  Object.entries(r).forEach(([e, t]) => {
1728
- this.dashboards[e] = G.fromSerialized(t);
1882
+ this.dashboards[e] = V.fromSerialized(t);
1729
1883
  });
1730
1884
  },
1731
1885
  removeAllFilters(r) {
@@ -1762,7 +1916,7 @@ const At = (r) => r.replace(/\s+/g, ""), Ft = V("dashboards", {
1762
1916
  updateDashboardFilter(r, e) {
1763
1917
  if (this.dashboards[r]) {
1764
1918
  let t = this.dashboards[r].filter;
1765
- return (!e || At(e) === "") && (this.dashboards[r].filter = null, t != null) ? Object.entries(this.dashboards[r].gridItems).map(([s, o]) => s) : (this.dashboards[r].filter = e, t !== e ? Object.entries(this.dashboards[r].gridItems).map(([s, o]) => s) : []);
1919
+ return (!e || Rt(e) === "") && (this.dashboards[r].filter = null, t != null) ? Object.entries(this.dashboards[r].gridItems).map(([s, o]) => s) : (this.dashboards[r].filter = e, t !== e ? Object.entries(this.dashboards[r].gridItems).map(([s, o]) => s) : []);
1766
1920
  } else
1767
1921
  throw new Error(`Dashboard with ID "${r}" not found.`);
1768
1922
  },
@@ -1945,7 +2099,7 @@ const At = (r) => r.replace(/\s+/g, ""), Ft = V("dashboards", {
1945
2099
  const s = this.dashboards[r];
1946
2100
  if (s) {
1947
2101
  for (const i of Object.values(s.gridItems))
1948
- if (i.type === M.CHART || i.type === M.TABLE) {
2102
+ if (i.type === L.CHART || i.type === L.TABLE) {
1949
2103
  const n = typeof i.content == "string" ? i.content : ((o = i.content) == null ? void 0 : o.query) || "";
1950
2104
  await (e == null ? void 0 : e.generateQuery(s.connection, {
1951
2105
  text: n,
@@ -1993,7 +2147,7 @@ const At = (r) => r.replace(/\s+/g, ""), Ft = V("dashboards", {
1993
2147
  );
1994
2148
  if (!s)
1995
2149
  throw new Error(`No completion items found for dashboard ID "${r}".`);
1996
- return ht(s);
2150
+ return bt(s);
1997
2151
  },
1998
2152
  async generatePromptSpec(r, e, t, s) {
1999
2153
  let o = await this.populateAIConcepts(
@@ -2002,13 +2156,13 @@ const At = (r) => r.replace(/\s+/g, ""), Ft = V("dashboards", {
2002
2156
  s
2003
2157
  ), i = await e.generateDashboardCompletion(
2004
2158
  r,
2005
- De,
2159
+ _e,
2006
2160
  o,
2007
2161
  3
2008
2162
  );
2009
2163
  if (!i)
2010
2164
  throw new Error("No response from LLM");
2011
- return De(i);
2165
+ return _e(i);
2012
2166
  },
2013
2167
  async populateFromPromptSpec(r, e, t, s, o) {
2014
2168
  let i = this.dashboards[r];
@@ -2024,15 +2178,15 @@ const At = (r) => r.replace(/\s+/g, ""), Ft = V("dashboards", {
2024
2178
  text: u,
2025
2179
  editorType: "trilogy",
2026
2180
  imports: i.imports,
2027
- extraContent: i.imports.map((g) => {
2181
+ extraContent: i.imports.map((f) => {
2028
2182
  var v, m;
2029
2183
  return {
2030
- alias: g.name,
2031
- contents: ((v = o.editors[g.id]) == null ? void 0 : v.contents) || ((m = o.editors[g.name]) == null ? void 0 : m.contents) || ""
2184
+ alias: f.name,
2185
+ contents: ((v = o.editors[f.id]) == null ? void 0 : v.contents) || ((m = o.editors[f.name]) == null ? void 0 : m.contents) || ""
2032
2186
  };
2033
2187
  })
2034
- }, h = (g) => {
2035
- throw g;
2188
+ }, h = (f) => {
2189
+ throw f;
2036
2190
  };
2037
2191
  return await (await s.executeQuery(
2038
2192
  i.connection,
@@ -2053,8 +2207,8 @@ const At = (r) => r.replace(/\s+/g, ""), Ft = V("dashboards", {
2053
2207
  let c = /* @__PURE__ */ new Map();
2054
2208
  for (const u of e.layout) {
2055
2209
  let l = e.gridItems[u.id], h = l.content, d = l.type.toLowerCase();
2056
- [M.CHART, M.TABLE].includes(d) && (h = `Placeholder, prompt: ${h}`);
2057
- let g = this.addItemToDashboard(
2210
+ [L.CHART, L.TABLE].includes(d) && (h = `Placeholder, prompt: ${h}`);
2211
+ let f = this.addItemToDashboard(
2058
2212
  r,
2059
2213
  "markdown",
2060
2214
  u.x,
@@ -2064,28 +2218,28 @@ const At = (r) => r.replace(/\s+/g, ""), Ft = V("dashboards", {
2064
2218
  h,
2065
2219
  l.name
2066
2220
  );
2067
- c.set(g, { type: d, content: h });
2221
+ c.set(f, { type: d, content: h });
2068
2222
  }
2069
2223
  for (const u of c) {
2070
2224
  let l = u[0], h = u[1], d = h.content;
2071
- [M.CHART, M.TABLE].includes(h.type) && (d = (await t.generateQueryCompletion(h.content, n, a)).content || "No query could be generated"), await this.updateItemContent(r, l, d), await this.updateItemType(r, l, h.type);
2225
+ [L.CHART, L.TABLE].includes(h.type) && (d = (await t.generateQueryCompletion(h.content, n, a)).content || "No query could be generated"), await this.updateItemContent(r, l, d), await this.updateItemType(r, l, h.type);
2072
2226
  }
2073
2227
  }
2074
2228
  }
2075
- }), qe = (r) => new Promise((e) => setTimeout(e, r)), Qt = /* @__PURE__ */ new Set(), Me = /* @__PURE__ */ new Set(), Le = (r) => {
2076
- if (Qt.has(r))
2229
+ }), Je = (r) => new Promise((e) => setTimeout(e, r)), Bt = /* @__PURE__ */ new Set(), Be = /* @__PURE__ */ new Set(), Ke = (r) => {
2230
+ if (Bt.has(r))
2077
2231
  return !0;
2078
2232
  let e = r;
2079
2233
  r.includes("://") || (e = `http://${r}`);
2080
2234
  try {
2081
2235
  const t = new URL(e), s = t.host, o = t.hostname;
2082
- if (Me.has(s) || Me.has(o))
2236
+ if (Be.has(s) || Be.has(o))
2083
2237
  return !0;
2084
2238
  } catch {
2085
2239
  }
2086
2240
  return !1;
2087
- }, ce = async (r, e, t = 5, s = 1e3) => {
2088
- if (Le(r))
2241
+ }, de = async (r, e, t = 5, s = 1e3) => {
2242
+ if (Ke(r))
2089
2243
  throw new Error(
2090
2244
  `Cannot connect to ${r} - blocked by Content Security Policy. This URL is not allowed by the browser's security settings.`
2091
2245
  );
@@ -2098,12 +2252,12 @@ const At = (r) => r.replace(/\s+/g, ""), Ft = V("dashboards", {
2098
2252
  let c = a ? parseInt(a) * 1e3 : i;
2099
2253
  console.log(
2100
2254
  `Rate limited. Retrying after ${c}ms (Attempt ${o + 1}/${t})`
2101
- ), await qe(c), i = i * 2 * (0.8 + Math.random() * 0.4), o++;
2255
+ ), await Je(c), i = i * 2 * (0.8 + Math.random() * 0.4), o++;
2102
2256
  continue;
2103
2257
  }
2104
2258
  return n;
2105
2259
  } catch (n) {
2106
- if (Le(r))
2260
+ if (Ke(r))
2107
2261
  throw new Error(
2108
2262
  `Cannot connect to ${r} - blocked by Content Security Policy. This URL is not allowed by the browser's security settings.`
2109
2263
  );
@@ -2112,9 +2266,9 @@ const At = (r) => r.replace(/\s+/g, ""), Ft = V("dashboards", {
2112
2266
  throw n;
2113
2267
  console.log(
2114
2268
  `Network error, retrying after ${i}ms (Attempt ${o + 1}/${t})`
2115
- ), await qe(i), i = i * 2 * (0.8 + Math.random() * 0.4), o++;
2269
+ ), await Je(i), i = i * 2 * (0.8 + Math.random() * 0.4), o++;
2116
2270
  }
2117
- }, Ot = (r, e, t, s, o) => r.filter((i) => {
2271
+ }, Kt = (r, e, t, s, o) => r.filter((i) => {
2118
2272
  const n = i.name.toLowerCase().includes(e.toLowerCase()), a = !t || i.engine === t;
2119
2273
  let c = !0;
2120
2274
  if (s !== "all") {
@@ -2122,7 +2276,7 @@ const At = (r) => r.replace(/\s+/g, ""), Ft = V("dashboards", {
2122
2276
  c = s === "imported" && u || s === "not-imported" && !u;
2123
2277
  }
2124
2278
  return n && a && c;
2125
- }), fr = (r) => {
2279
+ }), xr = (r) => {
2126
2280
  switch (r) {
2127
2281
  case "bigquery":
2128
2282
  return "new-bigquery-oauth";
@@ -2131,36 +2285,36 @@ const At = (r) => r.replace(/\s+/g, ""), Ft = V("dashboards", {
2131
2285
  default:
2132
2286
  return `new-${r}`;
2133
2287
  }
2134
- }, _t = (r) => {
2288
+ }, Ut = (r) => {
2135
2289
  const e = /* @__PURE__ */ new Set();
2136
2290
  return r.forEach((t) => {
2137
2291
  t.engine && e.add(t.engine);
2138
2292
  }), Array.from(e).sort();
2139
- }, re = {
2293
+ }, ne = {
2140
2294
  type: "github",
2141
2295
  id: "trilogy-data-trilogy-public-models-main",
2142
2296
  name: "Trilogy Public Models",
2143
2297
  owner: "trilogy-data",
2144
2298
  repo: "trilogy-public-models",
2145
2299
  branch: "main"
2146
- }, Ke = (r) => {
2300
+ }, Ye = (r) => {
2147
2301
  if (r)
2148
2302
  return {
2149
2303
  headers: {
2150
2304
  "X-Trilogy-Token": r
2151
2305
  }
2152
2306
  };
2153
- }, kt = async (r) => {
2154
- const e = `${r.baseUrl}/index.json`, t = await ce(e, Ke(r.token));
2307
+ }, zt = async (r) => {
2308
+ const e = `${r.baseUrl}/index.json`, t = await de(e, Ye(r.token));
2155
2309
  if (!t.ok)
2156
2310
  throw new Error(`Failed to fetch store index: ${t.status} ${t.statusText}`);
2157
2311
  return t.json();
2158
- }, qt = async (r) => {
2312
+ }, Ht = async (r) => {
2159
2313
  let e = null, t = [];
2160
2314
  try {
2161
- const o = (await kt(r)).models.map(async (n) => {
2315
+ const o = (await zt(r)).models.map(async (n) => {
2162
2316
  try {
2163
- const a = await ce(n.url, Ke(r.token));
2317
+ const a = await de(n.url, Ye(r.token));
2164
2318
  if (!a.ok)
2165
2319
  return console.warn(`Failed to fetch model ${n.name}: ${a.statusText}`), null;
2166
2320
  const c = await a.json();
@@ -2174,12 +2328,12 @@ const At = (r) => r.replace(/\s+/g, ""), Ft = V("dashboards", {
2174
2328
  s instanceof Error ? e = s.message : e = "Error fetching store data", console.error("Error fetching from generic store:", s);
2175
2329
  }
2176
2330
  return { files: t, error: e };
2177
- }, Mt = async (r) => {
2331
+ }, Wt = async (r) => {
2178
2332
  let e = null, t = [];
2179
2333
  try {
2180
2334
  let s, o;
2181
2335
  r.owner === "trilogy-data" && r.repo === "trilogy-public-models" ? (s = "https://trilogy-data.github.io/trilogy-public-models/studio/index.json", o = "https://trilogy-data.github.io/trilogy-public-models/studio/") : (s = `https://api.github.com/repos/${r.owner}/${r.repo}/contents/studio/index.json?ref=${r.branch}`, o = `https://raw.githubusercontent.com/${r.owner}/${r.repo}/${r.branch}/studio/`);
2182
- const i = await ce(s);
2336
+ const i = await de(s);
2183
2337
  if (i.status !== 200)
2184
2338
  throw new Error(`Error fetching community data: ${await i.text()}`);
2185
2339
  let n;
@@ -2190,7 +2344,7 @@ const At = (r) => r.replace(/\s+/g, ""), Ft = V("dashboards", {
2190
2344
  n = JSON.parse(atob(c.content));
2191
2345
  }
2192
2346
  const a = n.files.filter((c) => c.filename.endsWith(".json")).map(async (c) => {
2193
- const u = `${o}${c.filename}`, l = await ce(u);
2347
+ const u = `${o}${c.filename}`, l = await de(u);
2194
2348
  if (!l.ok)
2195
2349
  throw new Error(`Error fetching file ${c.filename}: ${l.statusText}`);
2196
2350
  const h = await l.json();
@@ -2201,12 +2355,12 @@ const At = (r) => r.replace(/\s+/g, ""), Ft = V("dashboards", {
2201
2355
  s instanceof Error ? e = s.message : e = "Error fetching files", console.error("Error fetching from GitHub store:", s);
2202
2356
  }
2203
2357
  return { files: t, error: e };
2204
- }, Ue = async (r) => r.type === "github" ? Mt(r) : qt(r), Lt = async (r, e) => {
2358
+ }, Xe = async (r) => r.type === "github" ? Wt(r) : Ht(r), Gt = async (r, e) => {
2205
2359
  const t = {}, s = {};
2206
2360
  return await Promise.all(
2207
2361
  r.map(async (o) => {
2208
2362
  try {
2209
- const { files: i, error: n } = await Ue(o);
2363
+ const { files: i, error: n } = await Xe(o);
2210
2364
  t[o.id] = i, n && (s[o.id] = n), e && e(o.id, { files: i, error: n });
2211
2365
  } catch (i) {
2212
2366
  const n = i instanceof Error ? i.message : "Unknown error";
@@ -2214,29 +2368,29 @@ const At = (r) => r.replace(/\s+/g, ""), Ft = V("dashboards", {
2214
2368
  }
2215
2369
  })
2216
2370
  ), { filesByStore: t, errors: s };
2217
- }, we = (r) => r.trim().replace(/[\\/:*?"<>|]+/g, "-").replace(/\s+/g, " "), R = (r) => r.replace(/\/$/, ""), Pe = (r) => R(r).replace(/^https?:\/\//, "").replace(/\//g, "-"), ve = (r) => {
2371
+ }, xe = (r) => r.trim().replace(/[\\/:*?"<>|]+/g, "-").replace(/\s+/g, " "), K = (r) => r.replace(/\/$/, ""), Ue = (r) => K(r).replace(/^https?:\/\//, "").replace(/\//g, "-"), Te = (r) => {
2218
2372
  try {
2219
- const e = new URL(R(r));
2220
- return we(e.hostname + (e.port ? `:${e.port}` : "") || e.host || r);
2373
+ const e = new URL(K(r));
2374
+ return xe(e.hostname + (e.port ? `:${e.port}` : "") || e.host || r);
2221
2375
  } catch {
2222
- return we(R(r));
2376
+ return xe(K(r));
2223
2377
  }
2224
- }, ze = (r) => we(r.name || ve(r.baseUrl)), mr = (r) => ze(r), gr = (r) => ze(r), Ie = "trilogy-community-stores", je = (r) => {
2378
+ }, Ze = (r) => xe(r.name || Te(r.baseUrl)), Tr = (r) => Ze(r), $r = (r) => Ze(r), ze = "trilogy-community-stores", He = (r) => {
2225
2379
  const e = new URLSearchParams(window.location.search), t = e.get("store"), s = e.get("token");
2226
2380
  if (!t || !s)
2227
2381
  return;
2228
- const o = R(t), i = r.find(
2229
- (n) => n.type === "generic" && R(n.baseUrl) === o
2382
+ const o = K(t), i = r.find(
2383
+ (n) => n.type === "generic" && K(n.baseUrl) === o
2230
2384
  );
2231
2385
  i && !i.token && (i.token = s);
2232
- }, ie = V("communityApi", {
2386
+ }, le = Y("communityApi", {
2233
2387
  state: () => ({
2234
2388
  // Initialize with default store
2235
- stores: [re],
2389
+ stores: [ne],
2236
2390
  filesByStore: {},
2237
2391
  errors: {},
2238
2392
  // Initialize default store status as idle
2239
- storeStatus: { [re.id]: "idle" },
2393
+ storeStatus: { [ne.id]: "idle" },
2240
2394
  loading: !1,
2241
2395
  // Modal state
2242
2396
  showAddStoreModal: !1,
@@ -2263,7 +2417,7 @@ const At = (r) => r.replace(/\s+/g, ""), Ft = V("dashboards", {
2263
2417
  const e = [];
2264
2418
  return Object.values(r.filesByStore).forEach((t) => {
2265
2419
  e.push(...t);
2266
- }), _t(e);
2420
+ }), Ut(e);
2267
2421
  },
2268
2422
  // Check if any store has errors
2269
2423
  hasErrors: (r) => Object.keys(r.errors).length > 0,
@@ -2283,7 +2437,7 @@ const At = (r) => r.replace(/\s+/g, ""), Ft = V("dashboards", {
2283
2437
  */
2284
2438
  loadStoresFromStorage() {
2285
2439
  try {
2286
- const r = localStorage.getItem(Ie);
2440
+ const r = localStorage.getItem(ze);
2287
2441
  if (r) {
2288
2442
  const e = JSON.parse(r), t = new Map(this.stores.map((n) => [n.id, n])), s = e.map((n) => {
2289
2443
  const a = t.get(n.id);
@@ -2301,14 +2455,14 @@ const At = (r) => r.replace(/\s+/g, ""), Ft = V("dashboards", {
2301
2455
  ...n,
2302
2456
  ...a
2303
2457
  };
2304
- }), i = [re, ...s].filter(
2458
+ }), i = [ne, ...s].filter(
2305
2459
  (n, a, c) => a === c.findIndex((u) => u.id === n.id)
2306
2460
  );
2307
- je(i), this.stores = i, i.forEach((n) => {
2461
+ He(i), this.stores = i, i.forEach((n) => {
2308
2462
  this.storeStatus[n.id] || (this.storeStatus[n.id] = "idle");
2309
2463
  });
2310
2464
  }
2311
- r || je(this.stores);
2465
+ r || He(this.stores);
2312
2466
  } catch (r) {
2313
2467
  console.error("Error loading stores from localStorage:", r);
2314
2468
  }
@@ -2318,13 +2472,13 @@ const At = (r) => r.replace(/\s+/g, ""), Ft = V("dashboards", {
2318
2472
  */
2319
2473
  saveStoresToStorage() {
2320
2474
  try {
2321
- const r = this.stores.filter((e) => e.id !== re.id).map((e) => {
2475
+ const r = this.stores.filter((e) => e.id !== ne.id).map((e) => {
2322
2476
  if (e.type !== "generic")
2323
2477
  return e;
2324
2478
  const { token: t, ...s } = e;
2325
2479
  return s;
2326
2480
  });
2327
- localStorage.setItem(Ie, JSON.stringify(r));
2481
+ localStorage.setItem(ze, JSON.stringify(r));
2328
2482
  } catch (r) {
2329
2483
  console.error("Error saving stores to localStorage:", r);
2330
2484
  }
@@ -2340,7 +2494,7 @@ const At = (r) => r.replace(/\s+/g, ""), Ft = V("dashboards", {
2340
2494
  console.log(
2341
2495
  `Fetching community model files from ${this.stores.map((e) => e.id).join(", ")}...`
2342
2496
  );
2343
- const r = await Lt(this.stores, (e, t) => {
2497
+ const r = await Gt(this.stores, (e, t) => {
2344
2498
  this.filesByStore[e] = t.files, t.error ? (this.errors[e] = t.error, this.storeStatus[e] = "failed") : this.storeStatus[e] = "connected", console.log(`Store ${e} completed: ${t.error ? "failed" : "success"}`);
2345
2499
  });
2346
2500
  console.log("All stores fetched:", r);
@@ -2361,7 +2515,7 @@ const At = (r) => r.replace(/\s+/g, ""), Ft = V("dashboards", {
2361
2515
  if (e) {
2362
2516
  this.loading = !0, this.storeStatus[r] = "idle";
2363
2517
  try {
2364
- const t = await Ue(e);
2518
+ const t = await Xe(e);
2365
2519
  this.filesByStore[r] = t.files, t.error ? (this.errors[r] = t.error, this.storeStatus[r] = "failed") : (delete this.errors[r], this.storeStatus[r] = "connected");
2366
2520
  } finally {
2367
2521
  this.loading = !1;
@@ -2374,7 +2528,7 @@ const At = (r) => r.replace(/\s+/g, ""), Ft = V("dashboards", {
2374
2528
  filteredFiles(r, e, t, s, o = null) {
2375
2529
  const i = (a) => a in s.models;
2376
2530
  let n = this.allFiles;
2377
- return o && (n = this.filesByStore[o]), n ? Ot(n, r, e, t, i) : [];
2531
+ return o && (n = this.filesByStore[o]), n ? Kt(n, r, e, t, i) : [];
2378
2532
  },
2379
2533
  /**
2380
2534
  * Get files from a specific store
@@ -2395,7 +2549,7 @@ const At = (r) => r.replace(/\s+/g, ""), Ft = V("dashboards", {
2395
2549
  if (r.type === "generic") {
2396
2550
  if (!r.baseUrl)
2397
2551
  throw new Error("Base URL is required for generic stores");
2398
- r.baseUrl = R(r.baseUrl), r.id = r.id || Pe(r.baseUrl), r.name = r.name || ve(r.baseUrl);
2552
+ r.baseUrl = K(r.baseUrl), r.id = r.id || Ue(r.baseUrl), r.name = r.name || Te(r.baseUrl);
2399
2553
  } else if (r.type === "github" && (!r.owner || !r.repo || !r.branch))
2400
2554
  throw new Error("Owner, repo, and branch are required for GitHub stores");
2401
2555
  if (this.stores.some((t) => t.id === r.id))
@@ -2456,10 +2610,10 @@ const At = (r) => r.replace(/\s+/g, ""), Ft = V("dashboards", {
2456
2610
  if (r === "generic") {
2457
2611
  if (!t)
2458
2612
  throw new Error("Please fill in all required fields");
2459
- const n = R(t), c = {
2613
+ const n = K(t), c = {
2460
2614
  type: "generic",
2461
- id: Pe(n),
2462
- name: e || ve(n),
2615
+ id: Ue(n),
2616
+ name: e || Te(n),
2463
2617
  baseUrl: n
2464
2618
  };
2465
2619
  await this.addStore(c);
@@ -2498,20 +2652,20 @@ const At = (r) => r.replace(/\s+/g, ""), Ft = V("dashboards", {
2498
2652
  }
2499
2653
  }
2500
2654
  });
2501
- class Se extends Error {
2655
+ class $e extends Error {
2502
2656
  constructor(t, s) {
2503
2657
  super(t);
2504
2658
  w(this, "status");
2505
2659
  this.name = "JobsServiceError", this.status = s;
2506
2660
  }
2507
2661
  }
2508
- const P = (r, e = {}) => {
2662
+ const I = (r, e = {}) => {
2509
2663
  const t = new Headers(e.headers);
2510
2664
  return r && t.set("X-Trilogy-Token", r), {
2511
2665
  ...e,
2512
2666
  headers: t
2513
2667
  };
2514
- }, Ce = (r) => r.split("/").filter(Boolean).map((e) => encodeURIComponent(e)).join("/"), I = async (r, e) => {
2668
+ }, Ae = (r) => r.split("/").filter(Boolean).map((e) => encodeURIComponent(e)).join("/"), N = async (r, e) => {
2515
2669
  if (r.ok)
2516
2670
  return r;
2517
2671
  let t = "";
@@ -2524,36 +2678,36 @@ const P = (r, e = {}) => {
2524
2678
  } catch {
2525
2679
  t = "";
2526
2680
  }
2527
- throw new Se(t || e, r.status);
2528
- }, Pt = async (r) => {
2681
+ throw new $e(t || e, r.status);
2682
+ }, Vt = async (r) => {
2529
2683
  const e = await fetch(
2530
2684
  `${r.baseUrl}/files`,
2531
- P(r.token, {
2685
+ I(r.token, {
2532
2686
  method: "GET"
2533
2687
  })
2534
2688
  );
2535
- return await I(e, `Failed to fetch files for ${r.name}`), e.json();
2536
- }, yr = async (r, e) => {
2537
- const t = Ce(e), s = await fetch(
2689
+ return await N(e, `Failed to fetch files for ${r.name}`), e.json();
2690
+ }, Ar = async (r, e) => {
2691
+ const t = Ae(e), s = await fetch(
2538
2692
  `${r.baseUrl}/files/${t}`,
2539
- P(r.token, {
2693
+ I(r.token, {
2540
2694
  method: "GET"
2541
2695
  })
2542
2696
  );
2543
2697
  if (s.ok)
2544
2698
  return s.text();
2545
- s.status !== 404 && await I(s, `Failed to fetch ${e}`);
2699
+ s.status !== 404 && await N(s, `Failed to fetch ${e}`);
2546
2700
  const o = await fetch(
2547
2701
  `${r.baseUrl}/${t}`,
2548
- P(r.token, {
2702
+ I(r.token, {
2549
2703
  method: "GET"
2550
2704
  })
2551
2705
  );
2552
- return await I(o, `Failed to fetch ${e}`), o.text();
2553
- }, pr = async (r, e, t) => {
2706
+ return await N(o, `Failed to fetch ${e}`), o.text();
2707
+ }, Fr = async (r, e, t) => {
2554
2708
  const s = await fetch(
2555
2709
  `${r.baseUrl}/files`,
2556
- P(r.token, {
2710
+ I(r.token, {
2557
2711
  method: "POST",
2558
2712
  headers: {
2559
2713
  "Content-Type": "application/json"
@@ -2561,11 +2715,11 @@ const P = (r, e = {}) => {
2561
2715
  body: JSON.stringify({ path: e, content: t })
2562
2716
  })
2563
2717
  );
2564
- await I(s, `Failed to create ${e}`);
2565
- }, br = async (r, e, t) => {
2718
+ await N(s, `Failed to create ${e}`);
2719
+ }, _r = async (r, e, t) => {
2566
2720
  const s = await fetch(
2567
- `${r.baseUrl}/files/${Ce(e)}`,
2568
- P(r.token, {
2721
+ `${r.baseUrl}/files/${Ae(e)}`,
2722
+ I(r.token, {
2569
2723
  method: "PUT",
2570
2724
  headers: {
2571
2725
  "Content-Type": "application/json"
@@ -2573,19 +2727,19 @@ const P = (r, e = {}) => {
2573
2727
  body: JSON.stringify({ content: t })
2574
2728
  })
2575
2729
  );
2576
- await I(s, `Failed to update ${e}`);
2577
- }, wr = async (r, e) => {
2730
+ await N(s, `Failed to update ${e}`);
2731
+ }, Qr = async (r, e) => {
2578
2732
  const t = await fetch(
2579
- `${r.baseUrl}/files/${Ce(e)}`,
2580
- P(r.token, {
2733
+ `${r.baseUrl}/files/${Ae(e)}`,
2734
+ I(r.token, {
2581
2735
  method: "DELETE"
2582
2736
  })
2583
2737
  );
2584
- await I(t, `Failed to delete ${e}`);
2585
- }, It = async (r, e, t) => {
2738
+ await N(t, `Failed to delete ${e}`);
2739
+ }, Yt = async (r, e, t) => {
2586
2740
  const s = await fetch(
2587
2741
  `${r.baseUrl}/${e}`,
2588
- P(r.token, {
2742
+ I(r.token, {
2589
2743
  method: "POST",
2590
2744
  headers: {
2591
2745
  "Content-Type": "application/json"
@@ -2593,31 +2747,31 @@ const P = (r, e = {}) => {
2593
2747
  body: JSON.stringify({ target: t })
2594
2748
  })
2595
2749
  );
2596
- return await I(s, `Failed to ${e} ${t}`), s.json();
2597
- }, jt = async (r, e) => {
2750
+ return await N(s, `Failed to ${e} ${t}`), s.json();
2751
+ }, Xt = async (r, e) => {
2598
2752
  const t = await fetch(
2599
2753
  `${r.baseUrl}/jobs/${e}`,
2600
- P(r.token, {
2754
+ I(r.token, {
2601
2755
  method: "GET"
2602
2756
  })
2603
2757
  );
2604
- return await I(t, `Failed to fetch job ${e}`), t.json();
2605
- }, Nt = async (r, e) => {
2758
+ return await N(t, `Failed to fetch job ${e}`), t.json();
2759
+ }, Zt = async (r, e) => {
2606
2760
  const t = await fetch(
2607
2761
  `${r.baseUrl}/jobs/${e}/cancel`,
2608
- P(r.token, {
2762
+ I(r.token, {
2609
2763
  method: "POST"
2610
2764
  })
2611
2765
  );
2612
- return await I(t, `Failed to cancel job ${e}`), t.json();
2613
- }, U = /* @__PURE__ */ new Map(), Ne = "trilogy-jobs-api-state", Je = (r, e, t) => `${r}::${t}::${e}`, z = (r, e) => `${r}::${e}`, Jt = (r) => {
2766
+ return await N(t, `Failed to cancel job ${e}`), t.json();
2767
+ }, U = /* @__PURE__ */ new Map(), We = "trilogy-jobs-api-state", Ge = (r, e, t) => `${r}::${t}::${e}`, z = (r, e) => `${r}::${e}`, er = (r) => {
2614
2768
  const e = r.pollingState, t = e === "unable-to-fetch" ? "stopped" : r.pollingState ?? "ok";
2615
2769
  return {
2616
2770
  ...r,
2617
2771
  pollingState: t,
2618
2772
  pollingError: t === "stopped" && !r.pollingError && e === "unable-to-fetch" ? "Polling stopped locally." : r.pollingError ?? null
2619
2773
  };
2620
- }, se = (r) => [...r].sort((e, t) => t.submittedAt - e.submittedAt), vr = V("jobsApi", {
2774
+ }, ie = (r) => [...r].sort((e, t) => t.submittedAt - e.submittedAt), Or = Y("jobsApi", {
2621
2775
  state: () => ({
2622
2776
  filesByStore: {},
2623
2777
  jobsByStore: {},
@@ -2630,16 +2784,16 @@ const P = (r, e = {}) => {
2630
2784
  }),
2631
2785
  actions: {
2632
2786
  getGenericStore(r) {
2633
- const t = ie().stores.find((s) => s.id === r);
2787
+ const t = le().stores.find((s) => s.id === r);
2634
2788
  return !t || t.type !== "generic" ? null : t;
2635
2789
  },
2636
2790
  getGenericStores() {
2637
- return ie().stores.filter(
2791
+ return le().stores.filter(
2638
2792
  (e) => e.type === "generic"
2639
2793
  );
2640
2794
  },
2641
2795
  getStoreJobs(r) {
2642
- return se(this.jobsByStore[r] || []);
2796
+ return ie(this.jobsByStore[r] || []);
2643
2797
  },
2644
2798
  getJobsForTarget(r, e) {
2645
2799
  return this.getStoreJobs(r).filter((t) => t.target === e);
@@ -2650,7 +2804,7 @@ const P = (r, e = {}) => {
2650
2804
  ) ? "running" : this.storeStatus[r] || "idle";
2651
2805
  },
2652
2806
  isSubmitting(r, e, t) {
2653
- return !!this.submittingByTarget[Je(r, e, t)];
2807
+ return !!this.submittingByTarget[Ge(r, e, t)];
2654
2808
  },
2655
2809
  isPollingJob(r, e) {
2656
2810
  return !!this.pollingByJob[z(r, e)];
@@ -2668,25 +2822,25 @@ const P = (r, e = {}) => {
2668
2822
  }), delete this.filesByStore[r], delete this.jobsByStore[r], delete this.errors[r], delete this.storeStatus[r], delete this.loadingByStore[r], this.saveJobsToStorage();
2669
2823
  },
2670
2824
  async initialize() {
2671
- ie().loadStoresFromStorage(), this.loadJobsFromStorage(), this.resumePolling(), await this.refreshAllStores();
2825
+ le().loadStoresFromStorage(), this.loadJobsFromStorage(), this.resumePolling(), await this.refreshAllStores();
2672
2826
  },
2673
2827
  saveJobsToStorage() {
2674
2828
  try {
2675
- localStorage.setItem(Ne, JSON.stringify(this.jobsByStore));
2829
+ localStorage.setItem(We, JSON.stringify(this.jobsByStore));
2676
2830
  } catch (r) {
2677
2831
  console.error("Error saving jobs to localStorage:", r);
2678
2832
  }
2679
2833
  },
2680
2834
  loadJobsFromStorage() {
2681
2835
  try {
2682
- const r = localStorage.getItem(Ne);
2836
+ const r = localStorage.getItem(We);
2683
2837
  if (!r)
2684
2838
  return;
2685
2839
  const e = JSON.parse(r);
2686
2840
  this.jobsByStore = Object.fromEntries(
2687
2841
  Object.entries(e).map(([t, s]) => [
2688
2842
  t,
2689
- (s || []).map((o) => Jt(o))
2843
+ (s || []).map((o) => er(o))
2690
2844
  ])
2691
2845
  );
2692
2846
  } catch (r) {
@@ -2725,7 +2879,7 @@ const P = (r, e = {}) => {
2725
2879
  if (e) {
2726
2880
  this.loadingByStore[r] = !0, this.storeStatus[r] = "idle";
2727
2881
  try {
2728
- this.filesByStore[r] = await Pt(e), delete this.errors[r], this.storeStatus[r] = "connected";
2882
+ this.filesByStore[r] = await Vt(e), delete this.errors[r], this.storeStatus[r] = "connected";
2729
2883
  } catch (t) {
2730
2884
  const s = t instanceof Error ? t.message : "Failed to fetch files";
2731
2885
  this.errors[r] = s, this.storeStatus[r] = "failed";
@@ -2737,17 +2891,17 @@ const P = (r, e = {}) => {
2737
2891
  upsertJob(r, e) {
2738
2892
  const t = this.jobsByStore[r] || [], s = t.findIndex((i) => i.job_id === e.job_id);
2739
2893
  if (s === -1) {
2740
- this.jobsByStore[r] = se([e, ...t]), this.saveJobsToStorage();
2894
+ this.jobsByStore[r] = ie([e, ...t]), this.saveJobsToStorage();
2741
2895
  return;
2742
2896
  }
2743
2897
  const o = [...t];
2744
2898
  o[s] = {
2745
2899
  ...o[s],
2746
2900
  ...e
2747
- }, this.jobsByStore[r] = se(o), this.saveJobsToStorage();
2901
+ }, this.jobsByStore[r] = ie(o), this.saveJobsToStorage();
2748
2902
  },
2749
2903
  replaceJobs(r, e) {
2750
- this.jobsByStore[r] = se(e), this.saveJobsToStorage();
2904
+ this.jobsByStore[r] = ie(e), this.saveJobsToStorage();
2751
2905
  },
2752
2906
  removeJob(r, e) {
2753
2907
  this.stopPolling(r, e), delete this.pollingByJob[z(r, e)], delete this.stoppingByJob[z(r, e)], this.jobsByStore[r] = (this.jobsByStore[r] || []).filter(
@@ -2797,10 +2951,10 @@ const P = (r, e = {}) => {
2797
2951
  const s = this.getGenericStore(r);
2798
2952
  if (!s)
2799
2953
  throw new Error("Store not found or does not support jobs");
2800
- const o = Je(r, e, t);
2954
+ const o = Ge(r, e, t);
2801
2955
  this.submittingByTarget[o] = !0;
2802
2956
  try {
2803
- const i = await It(s, t, e), n = this.buildLocalJob(r, e, t, i);
2957
+ const i = await Yt(s, t, e), n = this.buildLocalJob(r, e, t, i);
2804
2958
  return this.upsertJob(r, n), delete this.errors[r], this.storeStatus[r] = "connected", n.status === "running" && this.startPolling(r, n.job_id), n;
2805
2959
  } catch (i) {
2806
2960
  const n = i instanceof Error ? i.message : `Failed to ${t} ${e}`;
@@ -2820,7 +2974,7 @@ const P = (r, e = {}) => {
2820
2974
  return;
2821
2975
  }
2822
2976
  try {
2823
- const i = await jt(s, e), n = this.buildLocalJob(
2977
+ const i = await Xt(s, e), n = this.buildLocalJob(
2824
2978
  r,
2825
2979
  o.target,
2826
2980
  o.operation,
@@ -2830,12 +2984,12 @@ const P = (r, e = {}) => {
2830
2984
  this.upsertJob(r, n), n.status !== "running" && (this.stopPolling(r, e), this.fetchFilesForStore(r));
2831
2985
  } catch (i) {
2832
2986
  const n = i instanceof Error ? i.message : `Failed to poll job ${e}`;
2833
- i instanceof Se && i.status === 401 ? this.pauseJobPolling(
2987
+ i instanceof $e && i.status === 401 ? this.pauseJobPolling(
2834
2988
  r,
2835
2989
  e,
2836
2990
  "auth-paused",
2837
2991
  "Polling paused: authentication required. Update the store token to resume tracking."
2838
- ) : i instanceof Se && i.status === 404 ? this.pauseJobPolling(
2992
+ ) : i instanceof $e && i.status === 404 ? this.pauseJobPolling(
2839
2993
  r,
2840
2994
  e,
2841
2995
  "not-found",
@@ -2856,7 +3010,7 @@ const P = (r, e = {}) => {
2856
3010
  }
2857
3011
  this.stoppingByJob[t] = !0, this.stopPolling(r, e), delete this.pollingByJob[t];
2858
3012
  try {
2859
- const i = await Nt(s, e), n = this.buildLocalJob(
3013
+ const i = await Zt(s, e), n = this.buildLocalJob(
2860
3014
  r,
2861
3015
  o.target,
2862
3016
  o.operation,
@@ -2878,7 +3032,7 @@ const P = (r, e = {}) => {
2878
3032
  }
2879
3033
  }
2880
3034
  });
2881
- class Bt {
3035
+ class tr {
2882
3036
  constructor(e, t, s, o) {
2883
3037
  w(this, "queryExecutionService");
2884
3038
  w(this, "connectionStore");
@@ -2941,7 +3095,7 @@ class Bt {
2941
3095
  }
2942
3096
  }
2943
3097
  async executeTrilogyQuery(e, t, s, o) {
2944
- var g, v;
3098
+ var f, v;
2945
3099
  if (!e || typeof e != "string" || e.trim() === "")
2946
3100
  return {
2947
3101
  success: !1,
@@ -2966,7 +3120,7 @@ class Bt {
2966
3120
  error: `Connection "${t}" is not currently connected. Please ensure the connection is active.`,
2967
3121
  query: e
2968
3122
  };
2969
- const n = ((v = (g = this.chatStore) == null ? void 0 : g.activeChat) == null ? void 0 : v.imports) || [], a = n.map((m) => ({
3123
+ const n = ((v = (f = this.chatStore) == null ? void 0 : f.activeChat) == null ? void 0 : v.imports) || [], a = n.map((m) => ({
2970
3124
  name: m.name,
2971
3125
  alias: m.alias || ""
2972
3126
  }));
@@ -2986,9 +3140,9 @@ class Bt {
2986
3140
  );
2987
3141
  const l = /* @__PURE__ */ new Map();
2988
3142
  u.forEach((m) => l.set(m.alias, m.contents)), c.forEach((m) => l.set(m.alias, m.contents)), n.forEach((m) => {
2989
- var x, $;
2990
- const y = m.alias || m.name, S = (($ = (x = this.editorStore) == null ? void 0 : x.editors[m.id]) == null ? void 0 : $.contents) || "";
2991
- S && l.set(y, S);
3143
+ var T, x;
3144
+ const y = m.alias || m.name, E = ((x = (T = this.editorStore) == null ? void 0 : T.editors[m.id]) == null ? void 0 : x.contents) || "";
3145
+ E && l.set(y, E);
2992
3146
  });
2993
3147
  const h = Array.from(l.entries()).map(
2994
3148
  ([m, y]) => ({
@@ -3031,11 +3185,11 @@ class Bt {
3031
3185
  query: e,
3032
3186
  generatedSql: y.generatedSql
3033
3187
  };
3034
- const S = xe();
3188
+ const E = Qe();
3035
3189
  return {
3036
3190
  success: !0,
3037
3191
  artifact: {
3038
- id: S,
3192
+ id: E,
3039
3193
  type: s,
3040
3194
  data: y.results,
3041
3195
  config: {
@@ -3048,7 +3202,7 @@ class Bt {
3048
3202
  ...o && { chartConfig: o }
3049
3203
  }
3050
3204
  },
3051
- artifactId: S,
3205
+ artifactId: E,
3052
3206
  executionTime: y.executionTime,
3053
3207
  query: e,
3054
3208
  generatedSql: y.generatedSql
@@ -3083,13 +3237,13 @@ class Bt {
3083
3237
  })) : [], n = this.connectionStore.getConnectionSources(t), a = /* @__PURE__ */ new Map();
3084
3238
  n.forEach((d) => a.set(d.alias, d.contents)), i.forEach((d) => a.set(d.alias, d.contents)), s.forEach((d) => {
3085
3239
  var m, y;
3086
- const g = d.alias || d.name, v = ((y = (m = this.editorStore) == null ? void 0 : m.editors[d.id]) == null ? void 0 : y.contents) || "";
3087
- v && a.set(g, v);
3240
+ const f = d.alias || d.name, v = ((y = (m = this.editorStore) == null ? void 0 : m.editors[d.id]) == null ? void 0 : y.contents) || "";
3241
+ v && a.set(f, v);
3088
3242
  });
3089
3243
  const c = Array.from(a.entries()).map(
3090
- ([d, g]) => ({
3244
+ ([d, f]) => ({
3091
3245
  alias: d,
3092
- contents: g
3246
+ contents: f
3093
3247
  })
3094
3248
  ), u = {
3095
3249
  text: e.trim(),
@@ -3184,14 +3338,14 @@ ${i}`,
3184
3338
  try {
3185
3339
  if (!(((o = (s = this.editorStore) == null ? void 0 : s.editors[e.id]) == null ? void 0 : o.contents) || ""))
3186
3340
  return "No fields found in this data source.";
3187
- const a = this.editorStore ? Object.values(this.editorStore.editors).filter((g) => g.connection === t && !g.deleted).map((g) => ({
3188
- alias: g.name,
3189
- contents: g.contents
3341
+ const a = this.editorStore ? Object.values(this.editorStore.editors).filter((f) => f.connection === t && !f.deleted).map((f) => ({
3342
+ alias: f.name,
3343
+ contents: f.contents
3190
3344
  })) : [], c = this.connectionStore.getConnectionSources(t), u = /* @__PURE__ */ new Map();
3191
- c.forEach((g) => u.set(g.alias, g.contents)), a.forEach((g) => u.set(g.alias, g.contents));
3345
+ c.forEach((f) => u.set(f.alias, f.contents)), a.forEach((f) => u.set(f.alias, f.contents));
3192
3346
  const l = Array.from(u.entries()).map(
3193
- ([g, v]) => ({
3194
- alias: g,
3347
+ ([f, v]) => ({
3348
+ alias: f,
3195
3349
  contents: v
3196
3350
  })
3197
3351
  ), h = {
@@ -3205,17 +3359,17 @@ ${i}`,
3205
3359
  !1
3206
3360
  );
3207
3361
  if ((i = d == null ? void 0 : d.data) != null && i.completion_items) {
3208
- const g = d.data.completion_items.filter(
3362
+ const f = d.data.completion_items.filter(
3209
3363
  (m) => m.trilogyType === "concept"
3210
3364
  );
3211
- if (g.length === 0)
3365
+ if (f.length === 0)
3212
3366
  return "No fields found in this data source.";
3213
- const v = g.map((m) => {
3367
+ const v = f.map((m) => {
3214
3368
  let y = `- ${m.label} (${m.datatype || m.type})`;
3215
3369
  return m.description && (y += `: ${m.description}`), m.calculation && (y += ` [calculated: ${m.calculation}]`), y;
3216
3370
  }).join(`
3217
3371
  `);
3218
- return `AVAILABLE FIELDS (${g.length} total):
3372
+ return `AVAILABLE FIELDS (${f.length} total):
3219
3373
  ${v}`;
3220
3374
  }
3221
3375
  return "Unable to fetch field information for this data source.";
@@ -3303,7 +3457,7 @@ Use select_active_import to select a data source.`
3303
3457
  success: !1,
3304
3458
  error: "Markdown content is required and must be a non-empty string"
3305
3459
  };
3306
- const i = xe();
3460
+ const i = Qe();
3307
3461
  let n = null;
3308
3462
  if (s && s.trim()) {
3309
3463
  if (!o) {
@@ -3362,9 +3516,9 @@ Use select_active_import to select a data source.`
3362
3516
  message: "No artifacts in the current chat session."
3363
3517
  };
3364
3518
  const t = e.artifacts.filter((c) => !c.hidden), s = e.artifacts.filter((c) => c.hidden), o = (c, u) => {
3365
- var d, g, v, m;
3519
+ var d, f, v, m;
3366
3520
  const l = [`- ID: ${c.id}, Type: ${c.type}`];
3367
- (d = c.config) != null && d.title && l.push(`Title: "${c.config.title}"`), (g = c.config) != null && g.resultSize && l.push(`${c.config.resultSize} rows`), (v = c.config) != null && v.query && l.push(`Query: "${c.config.query.substring(0, 80)}..."`), c.type === "markdown" && ((m = c.data) != null && m.markdown) && l.push(`Content: "${c.data.markdown.substring(0, 80)}..."`);
3521
+ (d = c.config) != null && d.title && l.push(`Title: "${c.config.title}"`), (f = c.config) != null && f.resultSize && l.push(`${c.config.resultSize} rows`), (v = c.config) != null && v.query && l.push(`Query: "${c.config.query.substring(0, 80)}..."`), c.type === "markdown" && ((m = c.data) != null && m.markdown) && l.push(`Content: "${c.data.markdown.substring(0, 80)}..."`);
3368
3522
  const h = u === e.activeArtifactIndex ? " (currently selected)" : "";
3369
3523
  return l.join(", ") + h;
3370
3524
  }, i = t.length > 0 ? `Visible (${t.length}):
@@ -3402,10 +3556,10 @@ ${i}${n}`
3402
3556
  if (s.config && (o.config = { ...s.config }), s.type === "markdown")
3403
3557
  o.markdown = ((n = s.data) == null ? void 0 : n.markdown) || "", o.query = ((a = s.data) == null ? void 0 : a.query) || "", o.hasQueryResults = !!((c = s.data) != null && c.queryResults);
3404
3558
  else if (s.data) {
3405
- const u = typeof s.data.toJSON == "function" ? s.data.toJSON() : s.data, { head: l, tail: h, totalRows: d, cutCount: g } = tt(u);
3406
- if (g > 0) {
3407
- const v = rt / 2;
3408
- o.data = { ...u, data: l }, o._truncated = `${g} of ${d} rows cut off (showing first ${v} and last ${v}). Use get_artifact_rows to fetch any range.`, o._tail = h;
3559
+ const u = typeof s.data.toJSON == "function" ? s.data.toJSON() : s.data, { head: l, tail: h, totalRows: d, cutCount: f } = ct(u);
3560
+ if (f > 0) {
3561
+ const v = lt / 2;
3562
+ o.data = { ...u, data: l }, o._truncated = `${f} of ${d} rows cut off (showing first ${v} and last ${v}). Use get_artifact_rows to fetch any range.`, o._tail = h;
3409
3563
  } else
3410
3564
  o.data = u;
3411
3565
  }
@@ -3417,7 +3571,7 @@ ${JSON.stringify(o, null, 2)}`
3417
3571
  }
3418
3572
  // Fetch a specific row range from a results or chart artifact
3419
3573
  getArtifactRows(e, t, s) {
3420
- var d, g;
3574
+ var d, f;
3421
3575
  const o = (d = this.chatStore) == null ? void 0 : d.activeChat;
3422
3576
  if (!o)
3423
3577
  return { success: !1, error: "No active chat session." };
@@ -3432,7 +3586,7 @@ ${JSON.stringify(o, null, 2)}`
3432
3586
  success: !1,
3433
3587
  error: `Artifact "${e}" does not contain tabular data (type: ${i.type}). Only results and chart artifacts support row fetching.`
3434
3588
  };
3435
- const n = typeof ((g = i.data) == null ? void 0 : g.toJSON) == "function" ? i.data.toJSON() : i.data, a = n == null ? void 0 : n.data;
3589
+ const n = typeof ((f = i.data) == null ? void 0 : f.toJSON) == "function" ? i.data.toJSON() : i.data, a = n == null ? void 0 : n.data;
3436
3590
  if (!Array.isArray(a))
3437
3591
  return { success: !1, error: `Artifact "${e}" has no row data.` };
3438
3592
  const c = a.length, u = Math.max(0, Math.min(t, c - 1)), l = Math.max(u, Math.min(s, c - 1)), h = a.slice(u, l + 1);
@@ -3510,7 +3664,7 @@ ${JSON.stringify(o, null, 2)}`
3510
3664
  } : { success: !0, message: o.length > 0 ? `Hidden ${i.length} artifact(s). Not found: ${o.join(", ")}. Hidden artifacts remain accessible to you via list_artifacts and can be restored by the user.` : `Hidden ${i.length} artifact(s). They remain accessible via list_artifacts and can be restored by the user.` };
3511
3665
  }
3512
3666
  }
3513
- const Rt = V("chats", {
3667
+ const rr = Y("chats", {
3514
3668
  state: () => ({
3515
3669
  chats: {},
3516
3670
  activeChatId: "",
@@ -3545,7 +3699,7 @@ const Rt = V("chats", {
3545
3699
  },
3546
3700
  actions: {
3547
3701
  newChat(r, e = "", t) {
3548
- const s = new Te({
3702
+ const s = new Oe({
3549
3703
  llmConnectionName: r,
3550
3704
  dataConnectionName: e,
3551
3705
  name: t || `Chat ${(/* @__PURE__ */ new Date()).toLocaleTimeString()}`
@@ -3594,7 +3748,7 @@ const Rt = V("chats", {
3594
3748
  },
3595
3749
  loadChats(r) {
3596
3750
  Object.entries(r).forEach(([e, t]) => {
3597
- this.chats[e] = Te.fromSerialized(t);
3751
+ this.chats[e] = Oe.fromSerialized(t);
3598
3752
  });
3599
3753
  },
3600
3754
  serializeChats() {
@@ -3681,67 +3835,67 @@ const Rt = V("chats", {
3681
3835
  content: e
3682
3836
  });
3683
3837
  try {
3684
- const g = {
3685
- generateCompletion: async (T, E, O) => {
3686
- const j = {
3687
- ...E,
3838
+ const f = {
3839
+ generateCompletion: async (_, F, C) => {
3840
+ const M = {
3841
+ ...F,
3688
3842
  signal: l,
3689
- onRateLimitBackoff: (Y, Ee) => {
3690
- this.setRateLimitBackoff(r, Y, Ee);
3843
+ onRateLimitBackoff: (P, R) => {
3844
+ this.setRateLimitBackoff(r, P, R);
3691
3845
  }
3692
- }, K = await i.generateCompletion(
3693
- T,
3694
- j,
3695
- O
3846
+ }, X = await i.generateCompletion(
3847
+ _,
3848
+ M,
3849
+ C
3696
3850
  );
3697
- return this.clearRateLimitBackoff(r), K;
3851
+ return this.clearRateLimitBackoff(r), X;
3698
3852
  }
3699
3853
  }, v = {
3700
- addMessage: (T) => {
3701
- this.addMessageToChat(r, T);
3854
+ addMessage: (_) => {
3855
+ this.addMessageToChat(r, _);
3702
3856
  },
3703
- addArtifact: (T) => {
3704
- this.addArtifactToChat(r, T), (T.type === "chart" || T.type === "markdown") && this.addMessageToChat(r, {
3857
+ addArtifact: (_) => {
3858
+ this.addArtifactToChat(r, _), (_.type === "chart" || _.type === "markdown") && this.addMessageToChat(r, {
3705
3859
  role: "assistant",
3706
3860
  content: "",
3707
- artifact: T,
3861
+ artifact: _,
3708
3862
  hidden: !1
3709
3863
  });
3710
3864
  },
3711
3865
  getMessages: () => o.messages
3712
- }, m = new Bt(
3866
+ }, m = new tr(
3713
3867
  a,
3714
3868
  n,
3715
3869
  this,
3716
3870
  c
3717
3871
  );
3718
- await st(
3872
+ await ut(
3719
3873
  e,
3720
3874
  u,
3721
- g,
3875
+ f,
3722
3876
  v,
3723
3877
  {
3724
3878
  getToolExecutor: () => m
3725
3879
  },
3726
3880
  {
3727
- setActiveToolName: (T) => this.setActiveToolName(r, T),
3881
+ setActiveToolName: (_) => this.setActiveToolName(r, _),
3728
3882
  checkAborted: () => (l == null ? void 0 : l.aborted) ?? !1
3729
3883
  },
3730
3884
  {
3731
- tools: ft,
3885
+ tools: vt,
3732
3886
  maxIterations: 50,
3733
3887
  noToolCallReminder: "You must call a tool to proceed. If you are finished, call return_to_user with a summary of what was done. Do not respond with text only.",
3734
3888
  buildSystemPrompt: () => this.buildSystemPrompt(r, t),
3735
- onToolResult: async (T, E) => {
3736
- E.triggersSymbolRefresh && s.onSymbolsRefresh && await s.onSymbolsRefresh();
3889
+ onToolResult: async (_, F) => {
3890
+ F.triggersSymbolRefresh && s.onSymbolsRefresh && await s.onSymbolsRefresh();
3737
3891
  }
3738
3892
  }
3739
3893
  );
3740
3894
  return;
3741
- } catch (g) {
3742
- if (g instanceof DOMException && g.name === "AbortError")
3895
+ } catch (f) {
3896
+ if (f instanceof DOMException && f.name === "AbortError")
3743
3897
  return;
3744
- const v = g instanceof Error ? g.message : "An unknown error occurred";
3898
+ const v = f instanceof Error ? f.message : "An unknown error occurred";
3745
3899
  this.addMessageToChat(r, {
3746
3900
  role: "assistant",
3747
3901
  content: `Error: ${v}`
@@ -3761,7 +3915,7 @@ const Rt = V("chats", {
3761
3915
  name: l.name.replace(/\//g, "."),
3762
3916
  alias: ""
3763
3917
  })) : [];
3764
- return dt({
3918
+ return wt({
3765
3919
  dataConnectionName: i,
3766
3920
  availableConnections: n,
3767
3921
  availableConcepts: [],
@@ -3773,48 +3927,48 @@ const Rt = V("chats", {
3773
3927
  }
3774
3928
  }
3775
3929
  });
3776
- function F(r, e = null) {
3930
+ function A(r, e = null) {
3777
3931
  const t = window.location.hash;
3778
3932
  if (!t || !t.startsWith("#"))
3779
3933
  return e;
3780
3934
  const o = new URLSearchParams(t.slice(1)).get(r);
3781
3935
  return o !== null ? o : e;
3782
3936
  }
3783
- function oe(r, e) {
3937
+ function ae(r, e) {
3784
3938
  const t = window.location.hash, s = new URLSearchParams(t.slice(1));
3785
3939
  s.set(r, e), window.location.hash = `#${s.toString()}`;
3786
3940
  }
3787
- function L(r) {
3941
+ function j(r) {
3788
3942
  const e = window.location.hash, t = new URLSearchParams(e.slice(1));
3789
3943
  t.delete(r), window.location.hash = `#${t.toString()}`;
3790
3944
  }
3791
- function Kt(r) {
3945
+ function sr(r) {
3792
3946
  const e = window.location.hash, t = new URLSearchParams(e.slice(1));
3793
3947
  r.forEach((s) => {
3794
3948
  t.delete(s);
3795
3949
  }), window.location.hash = `#${t.toString()}`;
3796
3950
  }
3797
- const Ut = () => {
3798
- const r = Ft(), e = Ye(), t = ot(), s = ie(), o = Rt();
3951
+ const or = () => {
3952
+ const r = Jt(), e = ot(), t = ht(), s = le(), o = rr();
3799
3953
  let i = null;
3800
3954
  const n = {
3801
- activeScreen: Q(F("screen", "")),
3955
+ activeScreen: Q(A("screen", "")),
3802
3956
  activeSidebarScreen: Q(
3803
- F("sidebarScreen", "editors")
3957
+ A("sidebarScreen", "editors")
3804
3958
  ),
3805
- activeEditor: Q(F("editors", "")),
3806
- activeDashboard: Q(F("dashboard", "")),
3807
- activeConnectionKey: Q(F("connections", "")),
3808
- activeModelKey: Q(F("model", "")),
3809
- activeCommunityModelKey: Q(F("community-models", "")),
3810
- activeJobsKey: Q(F("jobs", "")),
3811
- activeLLMConnectionKey: Q(F("llms", "")),
3812
- activeDocumentationKey: Q(F("tutorial", "")),
3959
+ activeEditor: Q(A("editors", "")),
3960
+ activeDashboard: Q(A("dashboard", "")),
3961
+ activeConnectionKey: Q(A("connections", "")),
3962
+ activeModelKey: Q(A("model", "")),
3963
+ activeCommunityModelKey: Q(A("community-models", "")),
3964
+ activeJobsKey: Q(A("jobs", "")),
3965
+ activeLLMConnectionKey: Q(A("llms", "")),
3966
+ activeDocumentationKey: Q(A("tutorial", "")),
3813
3967
  // model import is legacy
3814
- modelImport: Q(F("import", F("model", ""))),
3815
- connectionImport: Q(F("connection", "")),
3968
+ modelImport: Q(A("import", A("model", ""))),
3969
+ connectionImport: Q(A("connection", "")),
3816
3970
  mobileMenuOpen: Q(!1),
3817
- initialSearch: Q(F("initialSearch", "")),
3971
+ initialSearch: Q(A("initialSearch", "")),
3818
3972
  tabs: Q([]),
3819
3973
  activeTab: Q(null),
3820
3974
  showTipModal: Q(!0),
@@ -3831,138 +3985,138 @@ const Ut = () => {
3831
3985
  "profile",
3832
3986
  "settings",
3833
3987
  "connections"
3834
- ]), c = (f, C = !1) => {
3835
- if (n.activeSidebarScreen.value !== f && (n.activeSidebarScreen.value = f, !C)) {
3836
- if (f) {
3837
- oe("sidebarScreen", f);
3988
+ ]), c = (g, S = !1) => {
3989
+ if (n.activeSidebarScreen.value !== g && (n.activeSidebarScreen.value = g, !S)) {
3990
+ if (g) {
3991
+ ae("sidebarScreen", g);
3838
3992
  return;
3839
3993
  }
3840
- L("sidebarScreen");
3994
+ j("sidebarScreen");
3841
3995
  }
3842
- }, u = (f, C = !1) => {
3843
- c(a.has(f) ? f : "", C);
3844
- }, l = (f, C, b) => {
3845
- if (C)
3846
- return C;
3847
- if (f === "dashboard") {
3996
+ }, u = (g, S = !1) => {
3997
+ c(a.has(g) ? g : "", S);
3998
+ }, l = (g, S, b) => {
3999
+ if (S)
4000
+ return S;
4001
+ if (g === "dashboard") {
3848
4002
  let p = r.dashboards[b];
3849
4003
  if (p)
3850
4004
  return p.name || "Untitled Dashboard";
3851
- } else if (f === "editors") {
4005
+ } else if (g === "editors") {
3852
4006
  let p = e.editors[b];
3853
4007
  if (p)
3854
4008
  return p.name || "Untitled Editor";
3855
- } else if (f === "llms") {
3856
- const p = b.split(te), D = p[0], _ = p.length > 1 ? p[1] : null;
3857
- if (_) {
3858
- const A = o.getChatById(_);
3859
- if (A)
3860
- return A.name;
4009
+ } else if (g === "llms") {
4010
+ const p = b.split(se), D = p[0], O = p.length > 1 ? p[1] : null;
4011
+ if (O) {
4012
+ const $ = o.getChatById(O);
4013
+ if ($)
4014
+ return $.name;
3861
4015
  }
3862
4016
  return D || "LLM Chat";
3863
- } else if (f === "community-models") {
3864
- const p = b.split(te), D = p[0], _ = s.stores.find((A) => A.id === D);
3865
- if (_)
3866
- return p.length === 2 ? `${_.name} - ${p[1]}` : p.length === 3 ? p[2] : _.name;
3867
- } else if (f === "jobs") {
3868
- const p = b.split(te), D = p[0], _ = s.stores.find((q) => q.id === D), A = (_ == null ? void 0 : _.name) || D;
4017
+ } else if (g === "community-models") {
4018
+ const p = b.split(se), D = p[0], O = s.stores.find(($) => $.id === D);
4019
+ if (O)
4020
+ return p.length === 2 ? `${O.name} - ${p[1]}` : p.length === 3 ? p[2] : O.name;
4021
+ } else if (g === "jobs") {
4022
+ const p = b.split(se), D = p[0], O = s.stores.find((k) => k.id === D), $ = (O == null ? void 0 : O.name) || D;
3869
4023
  if (p.length === 1)
3870
- return A;
3871
- const k = decodeURIComponent(p[2] || "");
4024
+ return $;
4025
+ const q = decodeURIComponent(p[2] || "");
3872
4026
  if (p[1] === "directory")
3873
- return k === "__root__" ? `${A} - Root` : k;
4027
+ return q === "__root__" ? `${$} - Root` : q;
3874
4028
  if (p[1] === "file") {
3875
- const q = k.split("/");
3876
- return q[q.length - 1] || A;
4029
+ const k = q.split("/");
4030
+ return k[k.length - 1] || $;
3877
4031
  }
3878
4032
  }
3879
- return it(b, null);
3880
- }, h = (f, C, b) => {
3881
- const p = n.tabs.value.find((D) => D.screen === f && D.address === b);
4033
+ return ft(b, null);
4034
+ }, h = (g, S, b) => {
4035
+ const p = n.tabs.value.find((D) => D.screen === g && D.address === b);
3882
4036
  if (p) {
3883
- let D = l(f, C, b);
4037
+ let D = l(g, S, b);
3884
4038
  p.title = D;
3885
4039
  }
3886
- }, d = (f, C, b, p = !1) => {
4040
+ }, d = (g, S, b, p = !1) => {
3887
4041
  const D = n.tabs.value.find(
3888
- (N) => N.screen === f && N.address === b
4042
+ (J) => J.screen === g && J.address === b
3889
4043
  );
3890
4044
  if (D) {
3891
- S(D.id, p);
4045
+ E(D.id, p);
3892
4046
  return;
3893
4047
  }
3894
- let A = n.tabs.value.reduce((N, X) => {
3895
- const Z = parseInt(X.id.replace("tab-", ""));
3896
- return isNaN(Z) ? N : Math.max(N, Z);
4048
+ let $ = n.tabs.value.reduce((J, ee) => {
4049
+ const te = parseInt(ee.id.replace("tab-", ""));
4050
+ return isNaN(te) ? J : Math.max(J, te);
3897
4051
  }, 0);
3898
- p || x(f);
3899
- let k = l(f, C, b);
3900
- const q = {
3901
- id: `tab-${++A}`,
3902
- title: k,
3903
- screen: f,
4052
+ p || T(g);
4053
+ let q = l(g, S, b);
4054
+ const k = {
4055
+ id: `tab-${++$}`,
4056
+ title: q,
4057
+ screen: g,
3904
4058
  address: b
3905
4059
  };
3906
- n.tabs.value.push(q), S(q.id, p);
3907
- }, g = (f, C = null) => {
3908
- if (!f && !C)
4060
+ n.tabs.value.push(k), E(k.id, p);
4061
+ }, f = (g, S = null) => {
4062
+ if (!g && !S)
3909
4063
  return;
3910
- if (!f && C) {
3911
- const p = n.tabs.value.find((D) => D.address === C);
4064
+ if (!g && S) {
4065
+ const p = n.tabs.value.find((D) => D.address === S);
3912
4066
  if (p)
3913
- f = p.id;
4067
+ g = p.id;
3914
4068
  else
3915
4069
  return;
3916
4070
  }
3917
- const b = n.tabs.value.findIndex((p) => p.id === f);
4071
+ const b = n.tabs.value.findIndex((p) => p.id === g);
3918
4072
  if (b !== -1) {
3919
- const p = n.activeTab.value === f;
4073
+ const p = n.activeTab.value === g;
3920
4074
  if (n.tabs.value.splice(b, 1), p)
3921
4075
  if (n.tabs.value.length > 0) {
3922
4076
  const D = b > 0 ? b - 1 : 0;
3923
- S(n.tabs.value[D].id);
4077
+ E(n.tabs.value[D].id);
3924
4078
  } else
3925
4079
  d("welcome", "Welcome", "welcome");
3926
4080
  }
3927
4081
  m();
3928
- }, v = (f) => {
3929
- const C = n.activeTab.value === f;
3930
- n.tabs.value = n.tabs.value.filter((b) => b.id === f), C || (n.tabs.value.length > 0 ? S(n.tabs.value[0].id) : d("welcome", "Welcome", "welcome")), m();
4082
+ }, v = (g) => {
4083
+ const S = n.activeTab.value === g;
4084
+ n.tabs.value = n.tabs.value.filter((b) => b.id === g), S || (n.tabs.value.length > 0 ? E(n.tabs.value[0].id) : d("welcome", "Welcome", "welcome")), m();
3931
4085
  }, m = () => {
3932
- let f = n.tabs.value.map((b) => b.screen), C = [];
3933
- f.includes("editors") || (n.activeEditor.value = "", C.push("editors"), C.push("activeEditorTab")), f.includes("dashboard") || (n.activeDashboard.value = "", C.push("dashboard")), f.includes("connections") || (n.activeConnectionKey.value = "", C.push("connections")), f.includes("models") || (n.activeModelKey.value = "", C.push("model")), f.includes("community-models") || (n.activeCommunityModelKey.value = "", C.push("community-models")), f.includes("jobs") || (n.activeJobsKey.value = "", C.push("jobs")), f.includes("tutorial") || (n.activeDocumentationKey.value = "", C.push("tutorial")), f.includes("llms") || (n.activeLLMConnectionKey.value = "", C.push("llms")), f.includes("settings") || C.push("settings"), f.includes("profile") || C.push("profile"), f.includes("welcome") || C.push("welcome"), Kt(C);
3934
- }, y = (f) => {
3935
- const C = n.tabs.value.findIndex((b) => b.id === f);
3936
- if (C !== -1) {
3937
- const p = n.tabs.value.findIndex((D) => D.id === n.activeTab.value) > C;
3938
- n.tabs.value.splice(C + 1), p && (n.tabs.value.length > 0 ? S(n.tabs.value[n.tabs.value.length - 1].id) : d("welcome", "Welcome", "welcome"));
4086
+ let g = n.tabs.value.map((b) => b.screen), S = [];
4087
+ g.includes("editors") || (n.activeEditor.value = "", S.push("editors"), S.push("activeEditorTab")), g.includes("dashboard") || (n.activeDashboard.value = "", S.push("dashboard")), g.includes("connections") || (n.activeConnectionKey.value = "", S.push("connections")), g.includes("models") || (n.activeModelKey.value = "", S.push("model")), g.includes("community-models") || (n.activeCommunityModelKey.value = "", S.push("community-models")), g.includes("jobs") || (n.activeJobsKey.value = "", S.push("jobs")), g.includes("tutorial") || (n.activeDocumentationKey.value = "", S.push("tutorial")), g.includes("llms") || (n.activeLLMConnectionKey.value = "", S.push("llms")), g.includes("settings") || S.push("settings"), g.includes("profile") || S.push("profile"), g.includes("welcome") || S.push("welcome"), sr(S);
4088
+ }, y = (g) => {
4089
+ const S = n.tabs.value.findIndex((b) => b.id === g);
4090
+ if (S !== -1) {
4091
+ const p = n.tabs.value.findIndex((D) => D.id === n.activeTab.value) > S;
4092
+ n.tabs.value.splice(S + 1), p && (n.tabs.value.length > 0 ? E(n.tabs.value[n.tabs.value.length - 1].id) : d("welcome", "Welcome", "welcome"));
3939
4093
  }
3940
4094
  m();
3941
- }, S = (f, C = !1) => {
3942
- const b = n.tabs.value.find((p) => p.id === f);
4095
+ }, E = (g, S = !1) => {
4096
+ const b = n.tabs.value.find((p) => p.id === g);
3943
4097
  if (b) {
3944
- n.activeTab.value = f, x(b.screen), u(b.screen, C);
3945
- let p = t.getUnreadTips(mt);
4098
+ n.activeTab.value = g, T(b.screen), u(b.screen, S);
4099
+ let p = t.getUnreadTips(St);
3946
4100
  if (b.screen === "editors")
3947
- n.activeEditor.value = b.address, e.activeEditorId = b.address, p = p.concat(t.getUnreadTips(gt));
4101
+ n.activeEditor.value = b.address, e.activeEditorId = b.address, p = p.concat(t.getUnreadTips(Ct));
3948
4102
  else if (b.screen === "dashboard")
3949
- n.activeDashboard.value = b.address, r.activeDashboardId = b.address, n.fullScreen.value ? p = [] : p = p.concat(t.getUnreadTips(yt));
4103
+ n.activeDashboard.value = b.address, r.activeDashboardId = b.address, n.fullScreen.value ? p = [] : p = p.concat(t.getUnreadTips(Et));
3950
4104
  else if (b.screen === "connections")
3951
4105
  n.activeConnectionKey.value = b.address;
3952
4106
  else if (b.screen === "llms") {
3953
4107
  n.activeLLMConnectionKey.value = b.address;
3954
- const D = b.address.split(te);
4108
+ const D = b.address.split(se);
3955
4109
  if (D.length > 1) {
3956
- const _ = D[1];
3957
- o.setActiveChat(_);
4110
+ const O = D[1];
4111
+ o.setActiveChat(O);
3958
4112
  }
3959
- } else b.screen === "tutorial" ? n.activeDocumentationKey.value = b.address : b.screen === "models" ? n.activeModelKey.value = b.address : b.screen === "dashboard-import" || b.screen === "asset-import" ? p = [] : b.screen === "community-models" ? (n.activeCommunityModelKey.value = b.address, p = p.concat(t.getUnreadTips(pt))) : b.screen === "jobs" && (n.activeJobsKey.value = b.address);
3960
- n.mobileMenuOpen.value = !1, n.displayedTips.value = p, n.showTipModal.value = p.length > 0, b.address && !C && oe(b.screen, b.address);
4113
+ } else b.screen === "tutorial" ? n.activeDocumentationKey.value = b.address : b.screen === "models" ? n.activeModelKey.value = b.address : b.screen === "dashboard-import" || b.screen === "asset-import" ? p = [] : b.screen === "community-models" ? (n.activeCommunityModelKey.value = b.address, p = p.concat(t.getUnreadTips(Dt))) : b.screen === "jobs" && (n.activeJobsKey.value = b.address);
4114
+ n.mobileMenuOpen.value = !1, n.displayedTips.value = p, n.showTipModal.value = p.length > 0, b.address && !S && ae(b.screen, b.address);
3961
4115
  }
3962
- }, x = (f) => {
3963
- n.activeScreen.value !== f && (n.activeScreen.value = f, oe("screen", f));
3964
- }, $ = (f) => {
3965
- c(f), f == "settings" ? d("settings", "Settings", "settings") : f == "profile" && d("profile", "Profile", "profile");
4116
+ }, T = (g) => {
4117
+ n.activeScreen.value !== g && (n.activeScreen.value = g, ae("screen", g));
4118
+ }, x = (g) => {
4119
+ c(g), g == "settings" ? d("settings", "Settings", "settings") : g == "profile" && d("profile", "Profile", "profile");
3966
4120
  };
3967
4121
  return {
3968
4122
  get activeScreen() {
@@ -4022,153 +4176,153 @@ const Ut = () => {
4022
4176
  get fullScreen() {
4023
4177
  return n.fullScreen;
4024
4178
  },
4025
- setActiveScreen: x,
4026
- setActiveSidebarScreen: $,
4027
- setActiveEditor: (f) => {
4028
- if (f === null) {
4029
- L("editors"), n.activeEditor.value = "";
4179
+ setActiveScreen: T,
4180
+ setActiveSidebarScreen: x,
4181
+ setActiveEditor: (g) => {
4182
+ if (g === null) {
4183
+ j("editors"), n.activeEditor.value = "";
4030
4184
  return;
4031
4185
  }
4032
- d("editors", null, f);
4186
+ d("editors", null, g);
4033
4187
  },
4034
- setActiveDashboard: (f) => {
4035
- if (f === null) {
4036
- L("dashboard"), n.activeDashboard.value = "";
4188
+ setActiveDashboard: (g) => {
4189
+ if (g === null) {
4190
+ j("dashboard"), n.activeDashboard.value = "";
4037
4191
  return;
4038
4192
  }
4039
- d("dashboard", null, f);
4193
+ d("dashboard", null, g);
4040
4194
  },
4041
- setActiveConnectionKey: (f) => {
4042
- if (f === null) {
4043
- L("connections"), n.activeConnectionKey.value = "";
4195
+ setActiveConnectionKey: (g) => {
4196
+ if (g === null) {
4197
+ j("connections"), n.activeConnectionKey.value = "";
4044
4198
  return;
4045
4199
  }
4046
- d("connections", null, f);
4200
+ d("connections", null, g);
4047
4201
  },
4048
- setActiveDocumentationKey: (f) => {
4049
- if (f === null) {
4050
- L("docs"), n.activeDocumentationKey.value = "";
4202
+ setActiveDocumentationKey: (g) => {
4203
+ if (g === null) {
4204
+ j("docs"), n.activeDocumentationKey.value = "";
4051
4205
  return;
4052
4206
  }
4053
- let C = f.split("+");
4054
- d("tutorial", C[C.length - 1], f);
4207
+ let S = g.split("+");
4208
+ d("tutorial", S[S.length - 1], g);
4055
4209
  },
4056
- setActiveLLMConnectionKey: (f) => {
4057
- if (f === null) {
4058
- L("llms"), n.activeLLMConnectionKey.value = "";
4210
+ setActiveLLMConnectionKey: (g) => {
4211
+ if (g === null) {
4212
+ j("llms"), n.activeLLMConnectionKey.value = "";
4059
4213
  return;
4060
4214
  }
4061
- d("llms", null, f);
4215
+ d("llms", null, g);
4062
4216
  },
4063
- setActiveCommunityModelKey: (f) => {
4064
- if (f === null) {
4065
- L("community-models"), n.activeCommunityModelKey.value = "";
4217
+ setActiveCommunityModelKey: (g) => {
4218
+ if (g === null) {
4219
+ j("community-models"), n.activeCommunityModelKey.value = "";
4066
4220
  return;
4067
4221
  }
4068
- n.activeCommunityModelKey.value = f, d("community-models", null, f);
4222
+ n.activeCommunityModelKey.value = g, d("community-models", null, g);
4069
4223
  },
4070
- setActiveJobsKey: (f) => {
4071
- if (f === null) {
4072
- L("jobs"), n.activeJobsKey.value = "";
4224
+ setActiveJobsKey: (g) => {
4225
+ if (g === null) {
4226
+ j("jobs"), n.activeJobsKey.value = "";
4073
4227
  return;
4074
4228
  }
4075
- n.activeJobsKey.value = f, d("jobs", null, f);
4229
+ n.activeJobsKey.value = g, d("jobs", null, g);
4076
4230
  },
4077
4231
  toggleMobileMenu: () => {
4078
4232
  n.mobileMenuOpen.value = !n.mobileMenuOpen.value;
4079
4233
  },
4080
- setActiveModelKey: (f) => {
4081
- if (f === null) {
4082
- L("model");
4234
+ setActiveModelKey: (g) => {
4235
+ if (g === null) {
4236
+ j("model");
4083
4237
  return;
4084
4238
  }
4085
- oe("model", f), n.activeModelKey.value = f;
4239
+ ae("model", g), n.activeModelKey.value = g;
4086
4240
  },
4087
- setActiveTab: S,
4241
+ setActiveTab: E,
4088
4242
  openTab: d,
4089
4243
  updateTabName: h,
4090
- closeTab: g,
4244
+ closeTab: f,
4091
4245
  closeOtherTabsExcept: v,
4092
4246
  closeTabsToRightOf: y,
4093
4247
  onInitialLoad: () => {
4094
- const f = n.modelImport.value, C = n.connectionImport.value;
4248
+ const g = n.modelImport.value, S = n.connectionImport.value;
4095
4249
  let b = "editors", p = !1;
4096
- if (F("skipTips", "") === "true" && t.updateSetting("skipAllTips", !0), f && C) {
4097
- const k = F("assetType", ""), q = F("assetName", "");
4098
- k && q ? d("asset-import", null, "asset-import") : d("dashboard-import", null, "dashboard-import"), p = !0;
4250
+ if (A("skipTips", "") === "true" && t.updateSetting("skipAllTips", !0), g && S) {
4251
+ const q = A("assetType", ""), k = A("assetName", "");
4252
+ q && k ? d("asset-import", null, "asset-import") : d("dashboard-import", null, "dashboard-import"), p = !0;
4099
4253
  }
4100
- let D = n.activeScreen.value, _ = n.activeSidebarScreen.value;
4101
- const A = [];
4102
- n.activeEditor.value && !p && A.push({
4254
+ let D = n.activeScreen.value, O = n.activeSidebarScreen.value;
4255
+ const $ = [];
4256
+ n.activeEditor.value && !p && $.push({
4103
4257
  screen: "editors",
4104
4258
  title: null,
4105
4259
  key: n.activeEditor.value,
4106
4260
  isActive: D === "editors"
4107
- }), n.activeDashboard.value && !p && A.push({
4261
+ }), n.activeDashboard.value && !p && $.push({
4108
4262
  screen: "dashboard",
4109
4263
  title: null,
4110
4264
  key: n.activeDashboard.value,
4111
4265
  isActive: D === "dashboard"
4112
- }), n.activeConnectionKey.value && !p && A.push({
4266
+ }), n.activeConnectionKey.value && !p && $.push({
4113
4267
  screen: "connections",
4114
4268
  title: null,
4115
4269
  key: n.activeConnectionKey.value,
4116
4270
  isActive: D === "connections"
4117
- }), n.activeModelKey.value && !p && A.push({
4271
+ }), n.activeModelKey.value && !p && $.push({
4118
4272
  screen: "models",
4119
4273
  title: null,
4120
4274
  key: n.activeModelKey.value,
4121
4275
  isActive: D === "models"
4122
- }), n.activeCommunityModelKey.value && !p && A.push({
4276
+ }), n.activeCommunityModelKey.value && !p && $.push({
4123
4277
  screen: "community-models",
4124
4278
  title: null,
4125
4279
  key: n.activeCommunityModelKey.value,
4126
4280
  isActive: D === "community-models"
4127
- }), n.activeJobsKey.value && !p && A.push({
4281
+ }), n.activeJobsKey.value && !p && $.push({
4128
4282
  screen: "jobs",
4129
4283
  title: null,
4130
4284
  key: n.activeJobsKey.value,
4131
4285
  isActive: D === "jobs"
4132
- }), n.activeDocumentationKey.value && !p && A.push({
4286
+ }), n.activeDocumentationKey.value && !p && $.push({
4133
4287
  screen: "tutorial",
4134
4288
  title: null,
4135
4289
  key: n.activeDocumentationKey.value,
4136
4290
  isActive: D === "tutorial"
4137
- }), n.activeLLMConnectionKey.value && !p && A.push({
4291
+ }), n.activeLLMConnectionKey.value && !p && $.push({
4138
4292
  screen: "llms",
4139
4293
  title: null,
4140
4294
  key: n.activeLLMConnectionKey.value,
4141
4295
  isActive: D === "llms"
4142
- }), n.activeSidebarScreen.value === "settings" && A.push({
4296
+ }), n.activeSidebarScreen.value === "settings" && $.push({
4143
4297
  screen: "settings",
4144
4298
  title: "Settings",
4145
4299
  key: "settings",
4146
4300
  isActive: D === "settings"
4147
- }), n.activeSidebarScreen.value === "profile" && A.push({
4301
+ }), n.activeSidebarScreen.value === "profile" && $.push({
4148
4302
  screen: "profile",
4149
4303
  title: "Profile",
4150
4304
  key: "profile",
4151
4305
  isActive: D === "profile"
4152
- }), A.sort((k, q) => k.isActive ? 1 : q.isActive ? -1 : 0), A.forEach((k) => {
4153
- d(k.screen, k.title, k.key, !0);
4154
- }), x(D), !_ && A.length > 0 ? b = A[A.length - 1].screen : _ && (b = _), $(b);
4306
+ }), $.sort((q, k) => q.isActive ? 1 : k.isActive ? -1 : 0), $.forEach((q) => {
4307
+ d(q.screen, q.title, q.key, !0);
4308
+ }), T(D), !O && $.length > 0 ? b = $[$.length - 1].screen : O && (b = O), x(b);
4155
4309
  },
4156
- toggleFullScreen: (f) => {
4157
- n.fullScreen.value = f;
4310
+ toggleFullScreen: (g) => {
4311
+ n.fullScreen.value = g;
4158
4312
  },
4159
4313
  addBackListeners: () => {
4160
4314
  i || (i = window.addEventListener("hashchange", () => {
4161
- const f = F("editors", ""), C = F("dashboard", ""), b = F("connections", ""), p = F("model", ""), D = F("community-models", ""), _ = F("jobs", ""), A = F("docs", ""), k = F("llms", ""), q = F("screen", ""), N = F("sidebarScreen", "");
4162
- let X = !1;
4163
- N !== n.activeSidebarScreen.value && $(N), q !== n.activeScreen.value && (n.activeScreen.value = q, X = !0);
4164
- const Z = [
4315
+ const g = A("editors", ""), S = A("dashboard", ""), b = A("connections", ""), p = A("model", ""), D = A("community-models", ""), O = A("jobs", ""), $ = A("docs", ""), q = A("llms", ""), k = A("screen", ""), J = A("sidebarScreen", "");
4316
+ let ee = !1;
4317
+ J !== n.activeSidebarScreen.value && x(J), k !== n.activeScreen.value && (n.activeScreen.value = k, ee = !0);
4318
+ const te = [
4165
4319
  {
4166
- hash: f,
4320
+ hash: g,
4167
4321
  screen: "editors",
4168
4322
  current: n.activeEditor.value
4169
4323
  },
4170
4324
  {
4171
- hash: C,
4325
+ hash: S,
4172
4326
  screen: "dashboard",
4173
4327
  current: n.activeDashboard.value
4174
4328
  },
@@ -4188,32 +4342,32 @@ const Ut = () => {
4188
4342
  current: n.activeCommunityModelKey.value
4189
4343
  },
4190
4344
  {
4191
- hash: _,
4345
+ hash: O,
4192
4346
  screen: "jobs",
4193
4347
  current: n.activeJobsKey.value
4194
4348
  },
4195
4349
  {
4196
- hash: A,
4350
+ hash: $,
4197
4351
  screen: "tutorial",
4198
4352
  current: n.activeDocumentationKey.value
4199
4353
  },
4200
4354
  {
4201
- hash: k,
4355
+ hash: q,
4202
4356
  screen: "llms",
4203
4357
  current: n.activeLLMConnectionKey.value
4204
4358
  }
4205
4359
  ];
4206
- for (const { hash: H, screen: ue, current: He } of Z)
4207
- if (H && H !== He || ue === q && X) {
4208
- const ee = n.tabs.value.find(
4209
- (he) => he.screen === ue && he.screen === q && he.address === H
4360
+ for (const { hash: H, screen: me, current: et } of te)
4361
+ if (H && H !== et || me === k && ee) {
4362
+ const re = n.tabs.value.find(
4363
+ (ge) => ge.screen === me && ge.screen === k && ge.address === H
4210
4364
  );
4211
- if (ee && ee.id !== n.activeTab.value) {
4212
- S(ee.id, !0);
4365
+ if (re && re.id !== n.activeTab.value) {
4366
+ E(re.id, !0);
4213
4367
  break;
4214
4368
  }
4215
- if (!ee && H) {
4216
- d(ue, null, H);
4369
+ if (!re && H) {
4370
+ d(me, null, H);
4217
4371
  break;
4218
4372
  }
4219
4373
  }
@@ -4224,12 +4378,12 @@ const Ut = () => {
4224
4378
  }
4225
4379
  };
4226
4380
  };
4227
- let me = null;
4228
- function Sr() {
4229
- return me || (me = Ut()), me;
4381
+ let we = null;
4382
+ function qr() {
4383
+ return we || (we = or()), we;
4230
4384
  }
4231
- const ge = 100;
4232
- class zt {
4385
+ const ve = 100;
4386
+ class nr {
4233
4387
  constructor() {
4234
4388
  w(this, "dbName");
4235
4389
  w(this, "storeName");
@@ -4284,7 +4438,7 @@ class zt {
4284
4438
  });
4285
4439
  }
4286
4440
  // Get query history for a specific connection
4287
- async getQueriesForConnection(e, t = ge) {
4441
+ async getQueriesForConnection(e, t = ve) {
4288
4442
  return this.db || await this._initDB(), new Promise((s, o) => {
4289
4443
  if (!this.db) {
4290
4444
  o(new Error("Database not initialized"));
@@ -4325,15 +4479,15 @@ class zt {
4325
4479
  const n = this.db.transaction([this.storeName], "readwrite").objectStore(this.storeName).index("connectionName"), a = n.count(IDBKeyRange.only(e));
4326
4480
  a.onsuccess = () => {
4327
4481
  const c = a.result;
4328
- if (c <= ge) {
4482
+ if (c <= ve) {
4329
4483
  t();
4330
4484
  return;
4331
4485
  }
4332
- const u = c - ge, l = n.openCursor(IDBKeyRange.only(e));
4486
+ const u = c - ve, l = n.openCursor(IDBKeyRange.only(e));
4333
4487
  let h = 0;
4334
4488
  l.onsuccess = (d) => {
4335
- const g = d.target.result;
4336
- g && h < u ? (g.delete(), h++, g.continue()) : t();
4489
+ const f = d.target.result;
4490
+ f && h < u ? (f.delete(), h++, f.continue()) : t();
4337
4491
  }, l.onerror = (d) => {
4338
4492
  console.error("Error trimming history:", d.target.error), s(d.target.error);
4339
4493
  };
@@ -4343,13 +4497,13 @@ class zt {
4343
4497
  });
4344
4498
  }
4345
4499
  }
4346
- let ye = null;
4347
- const pe = () => (ye || (ye = new zt()), ye);
4348
- function ne(r) {
4500
+ let Se = null;
4501
+ const Ce = () => (Se || (Se = new nr()), Se);
4502
+ function ce(r) {
4349
4503
  const e = Q([]), t = Q(!0), s = Q(null), o = async () => {
4350
4504
  t.value = !0;
4351
4505
  try {
4352
- const c = await pe().getQueriesForConnection(r);
4506
+ const c = await Ce().getQueriesForConnection(r);
4353
4507
  e.value = c, s.value = null;
4354
4508
  } catch (c) {
4355
4509
  console.error("Failed to load query history:", c), s.value = "Failed to load query history";
@@ -4358,14 +4512,14 @@ function ne(r) {
4358
4512
  }
4359
4513
  }, i = async (c) => {
4360
4514
  try {
4361
- await pe().addQuery(r, c), await o();
4515
+ await Ce().addQuery(r, c), await o();
4362
4516
  } catch (u) {
4363
4517
  console.error("Failed to record query:", u), s.value = "Failed to record query";
4364
4518
  }
4365
4519
  }, n = async () => {
4366
4520
  t.value = !0;
4367
4521
  try {
4368
- await pe().clearConnectionHistory(r), e.value = [], s.value = null;
4522
+ await Ce().clearConnectionHistory(r), e.value = [], s.value = null;
4369
4523
  } catch (c) {
4370
4524
  console.error("Failed to clear query history:", c), s.value = "Failed to clear query history";
4371
4525
  } finally {
@@ -4373,19 +4527,19 @@ function ne(r) {
4373
4527
  }
4374
4528
  }, a = async (c, u) => {
4375
4529
  const l = performance.now();
4376
- let h = "success", d = null, g = 0, v = 0, m = null;
4530
+ let h = "success", d = null, f = 0, v = 0, m = null;
4377
4531
  try {
4378
- m = await c(u), m && Array.isArray(m) && (g = m.length, g > 0 && typeof m[0] == "object" && (v = Object.keys(m[0]).length));
4532
+ m = await c(u), m && Array.isArray(m) && (f = m.length, f > 0 && typeof m[0] == "object" && (v = Object.keys(m[0]).length));
4379
4533
  } catch (y) {
4380
4534
  throw h = "error", d = y instanceof Error ? y.message : String(y), y;
4381
4535
  } finally {
4382
- const S = performance.now() - l;
4536
+ const E = performance.now() - l;
4383
4537
  await i({
4384
4538
  query: u,
4385
- executionTime: S,
4539
+ executionTime: E,
4386
4540
  status: h,
4387
4541
  errorMessage: d,
4388
- resultSize: g,
4542
+ resultSize: f,
4389
4543
  resultColumns: v
4390
4544
  });
4391
4545
  }
@@ -4401,7 +4555,7 @@ function ne(r) {
4401
4555
  refreshHistory: o
4402
4556
  };
4403
4557
  }
4404
- class Ht {
4558
+ class ir {
4405
4559
  constructor(e) {
4406
4560
  this.connection = e;
4407
4561
  }
@@ -4418,13 +4572,13 @@ class Ht {
4418
4572
  return this.connection.query(e, t ?? null);
4419
4573
  }
4420
4574
  }
4421
- class Wt {
4575
+ class ar {
4422
4576
  constructor(e) {
4423
4577
  this.connectionStore = e;
4424
4578
  }
4425
4579
  getConnection(e) {
4426
4580
  const t = this.connectionStore.connections[e];
4427
- return t ? new Ht(t) : null;
4581
+ return t ? new ir(t) : null;
4428
4582
  }
4429
4583
  async ensureConnected(e) {
4430
4584
  const t = this.connectionStore.connections[e];
@@ -4436,16 +4590,16 @@ class Wt {
4436
4590
  return this.connectionStore.getConnectionSources(e);
4437
4591
  }
4438
4592
  }
4439
- function Gt(r) {
4593
+ function cr(r) {
4440
4594
  return typeof r.getConnection == "function" && typeof r.ensureConnected == "function";
4441
4595
  }
4442
- class Cr {
4596
+ class kr {
4443
4597
  constructor(e, t, s = !0) {
4444
4598
  w(this, "trilogyResolver");
4445
4599
  w(this, "connectionProvider");
4446
4600
  w(this, "storeHistory");
4447
4601
  w(this, "eligibleCrossFilterFieldsCache", /* @__PURE__ */ new Map());
4448
- this.trilogyResolver = e, this.connectionProvider = Gt(t) ? t : new Wt(t), this.storeHistory = s;
4602
+ this.trilogyResolver = e, this.connectionProvider = cr(t) ? t : new ar(t), this.storeHistory = s;
4449
4603
  }
4450
4604
  async executeQueriesBatch(e, t, s, o = [], i, n = {}, a, c, u, l, h = !1, d) {
4451
4605
  if (s === "python")
@@ -4461,7 +4615,7 @@ class Cr {
4461
4615
  executionTime: 0
4462
4616
  })
4463
4617
  };
4464
- const g = (/* @__PURE__ */ new Date()).getTime(), v = new AbortController();
4618
+ const f = (/* @__PURE__ */ new Date()).getTime(), v = new AbortController();
4465
4619
  return {
4466
4620
  cancellation: {
4467
4621
  cancel: () => v.abort(),
@@ -4474,7 +4628,7 @@ class Cr {
4474
4628
  o,
4475
4629
  i || [],
4476
4630
  n,
4477
- g,
4631
+ f,
4478
4632
  v,
4479
4633
  a,
4480
4634
  c,
@@ -4485,33 +4639,34 @@ class Cr {
4485
4639
  )
4486
4640
  };
4487
4641
  }
4488
- async executeQueriesBatchInternal(e, t, s, o = [], i, n = {}, a, c, u, l, h, d, g = !1, v) {
4642
+ async executeQueriesBatchInternal(e, t, s, o = [], i, n = {}, a, c, u, l, h, d, f = !1, v) {
4643
+ var E;
4489
4644
  u && u();
4490
4645
  const m = this.connectionProvider.getConnection(e);
4491
4646
  if (!m)
4492
4647
  return {
4493
4648
  success: !1,
4494
4649
  executionTime: (/* @__PURE__ */ new Date()).getTime() - a,
4495
- results: t.map((S) => ({
4650
+ results: t.map((T) => ({
4496
4651
  success: !1,
4497
4652
  generated_sql: "",
4498
4653
  columns: [],
4499
4654
  error: `Connection ${e} not found.`,
4500
4655
  executionTime: 0,
4501
- results: new J(/* @__PURE__ */ new Map(), []),
4656
+ results: new B(/* @__PURE__ */ new Map(), []),
4502
4657
  resultSize: 0,
4503
4658
  columnCount: 0
4504
4659
  }))
4505
4660
  };
4506
- if (g)
4661
+ if (f)
4507
4662
  return {
4508
4663
  success: !0,
4509
- results: t.map((S) => ({
4664
+ results: t.map((T) => ({
4510
4665
  success: !0,
4511
- generated_sql: S.query,
4666
+ generated_sql: T.query,
4512
4667
  columns: [],
4513
4668
  executionTime: (/* @__PURE__ */ new Date()).getTime() - a,
4514
- results: new J(/* @__PURE__ */ new Map(), []),
4669
+ results: new B(/* @__PURE__ */ new Map(), []),
4515
4670
  resultSize: 0,
4516
4671
  columnCount: 0
4517
4672
  })),
@@ -4539,7 +4694,7 @@ class Cr {
4539
4694
  columns: [],
4540
4695
  error: `Connection ${e} not active, failed to reconnect.`,
4541
4696
  executionTime: (/* @__PURE__ */ new Date()).getTime() - a,
4542
- results: new J(/* @__PURE__ */ new Map(), []),
4697
+ results: new B(/* @__PURE__ */ new Map(), []),
4543
4698
  columnCount: 0,
4544
4699
  resultSize: 0
4545
4700
  }))
@@ -4548,7 +4703,7 @@ class Cr {
4548
4703
  let y = this.connectionProvider.getConnectionSources(e);
4549
4704
  v && (y = y.concat(v));
4550
4705
  try {
4551
- const S = await Promise.race([
4706
+ const T = await Promise.race([
4552
4707
  this.trilogyResolver.resolve_queries_batch(
4553
4708
  t,
4554
4709
  m.queryType,
@@ -4556,90 +4711,94 @@ class Cr {
4556
4711
  o,
4557
4712
  i
4558
4713
  ),
4559
- new Promise((T, E) => {
4714
+ new Promise((F, C) => {
4560
4715
  c.signal.addEventListener(
4561
4716
  "abort",
4562
- () => E(new Error("Query batch cancelled by user"))
4717
+ () => C(new Error("Query batch cancelled by user"))
4563
4718
  );
4564
4719
  })
4565
4720
  ]), x = [];
4566
- if (S && Array.isArray(S.data.queries))
4567
- for (let T = 0; T < S.data.queries.length; T++) {
4568
- const E = S.data.queries[T];
4569
- if (E.generated_sql)
4721
+ if (T && Array.isArray(T.data.queries))
4722
+ for (let F = 0; F < T.data.queries.length; F++) {
4723
+ const C = T.data.queries[F];
4724
+ if (C.generated_sql) {
4725
+ const M = {
4726
+ ...((E = t[F]) == null ? void 0 : E.parameters) || {},
4727
+ ...C.parameters || {}
4728
+ }, X = Object.keys(M).length ? M : null;
4570
4729
  try {
4571
- const O = await Promise.race([
4572
- m.executeSql(E.generated_sql, n),
4573
- new Promise((K, Y) => {
4730
+ const P = await Promise.race([
4731
+ m.executeSql(C.generated_sql, X),
4732
+ new Promise((Z, Fe) => {
4574
4733
  c.signal.addEventListener(
4575
4734
  "abort",
4576
- () => Y(new Error("Query execution cancelled by user"))
4735
+ () => Fe(new Error("Query execution cancelled by user"))
4577
4736
  );
4578
4737
  })
4579
4738
  ]);
4580
- (s === "trilogy" || s === "preql") && this.enrichTrilogyColumns(E.columns || [], O);
4581
- let j = {
4739
+ (s === "trilogy" || s === "preql") && this.enrichTrilogyColumns(C.columns || [], P);
4740
+ let R = {
4582
4741
  success: !0,
4583
- generatedSql: E.generated_sql,
4584
- results: O,
4585
- resultSize: O.data.length,
4586
- columnCount: O.headers.size,
4742
+ generatedSql: C.generated_sql,
4743
+ results: P,
4744
+ resultSize: P.data.length,
4745
+ columnCount: P.headers.size,
4587
4746
  executionTime: (/* @__PURE__ */ new Date()).getTime() - a
4588
4747
  };
4589
- d && E.label && d[E.label] && d[E.label](j), x.push(j), this.storeHistory && ne(e).recordQuery({
4590
- query: t[T].query,
4591
- generatedQuery: E.generated_sql,
4748
+ d && C.label && d[C.label] && d[C.label](R), x.push(R), this.storeHistory && ce(e).recordQuery({
4749
+ query: t[F].query,
4750
+ generatedQuery: C.generated_sql,
4592
4751
  executionTime: (/* @__PURE__ */ new Date()).getTime() - a,
4593
4752
  status: "success",
4594
- resultSize: O.data.length,
4595
- resultColumns: O.headers.size,
4753
+ resultSize: P.data.length,
4754
+ resultColumns: P.headers.size,
4596
4755
  errorMessage: null,
4597
4756
  extraFilters: i
4598
4757
  });
4599
- } catch (O) {
4600
- const j = c.signal.aborted ? "Query execution cancelled by user" : O instanceof Error ? O.message : "Unknown error occurred during execution";
4601
- let K = {
4758
+ } catch (P) {
4759
+ const R = c.signal.aborted ? "Query execution cancelled by user" : P instanceof Error ? P.message : "Unknown error occurred during execution";
4760
+ let Z = {
4602
4761
  success: !1,
4603
- error: j,
4604
- generatedSql: E.generated_sql,
4605
- results: new J(/* @__PURE__ */ new Map(), []),
4762
+ error: R,
4763
+ generatedSql: C.generated_sql,
4764
+ results: new B(/* @__PURE__ */ new Map(), []),
4606
4765
  resultSize: 0,
4607
4766
  columnCount: 0,
4608
4767
  executionTime: (/* @__PURE__ */ new Date()).getTime() - a
4609
4768
  };
4610
- x.push(K), console.error("Error callback for ", E.label, h), console.error("Error details:", O), h && E.label && h[E.label] && h[E.label](K), this.storeHistory && ne(e).recordQuery({
4611
- query: t[T].query,
4612
- generatedQuery: E.generated_sql,
4769
+ x.push(Z), console.error("Error callback for ", C.label, h), console.error("Error details:", P), h && C.label && h[C.label] && h[C.label](Z), this.storeHistory && ce(e).recordQuery({
4770
+ query: t[F].query,
4771
+ generatedQuery: C.generated_sql,
4613
4772
  executionTime: (/* @__PURE__ */ new Date()).getTime() - a,
4614
4773
  status: "error",
4615
4774
  resultSize: 0,
4616
4775
  resultColumns: 0,
4617
- errorMessage: j,
4776
+ errorMessage: R,
4618
4777
  extraFilters: i
4619
4778
  });
4620
4779
  }
4621
- else if (E.error) {
4622
- let O = {
4780
+ } else if (C.error) {
4781
+ let M = {
4623
4782
  success: !1,
4624
- error: E.error,
4783
+ error: C.error,
4625
4784
  generatedSql: "",
4626
4785
  executionTime: (/* @__PURE__ */ new Date()).getTime() - a,
4627
- results: new J(/* @__PURE__ */ new Map(), []),
4786
+ results: new B(/* @__PURE__ */ new Map(), []),
4628
4787
  resultSize: 0,
4629
4788
  columnCount: 0
4630
4789
  };
4631
- h && E.label && h[E.label] && h[E.label](O), x.push(O);
4790
+ h && C.label && h[C.label] && h[C.label](M), x.push(M);
4632
4791
  } else {
4633
- let O = {
4792
+ let M = {
4634
4793
  success: !1,
4635
4794
  error: "No SQL was generated for this query",
4636
4795
  generatedSql: "",
4637
4796
  executionTime: (/* @__PURE__ */ new Date()).getTime() - a,
4638
- results: new J(/* @__PURE__ */ new Map(), []),
4797
+ results: new B(/* @__PURE__ */ new Map(), []),
4639
4798
  resultSize: 0,
4640
4799
  columnCount: 0
4641
4800
  };
4642
- x.push(O), h && E.label && h[E.label] && h[E.label](O);
4801
+ x.push(M), h && C.label && h[C.label] && h[C.label](M);
4643
4802
  }
4644
4803
  }
4645
4804
  return {
@@ -4647,10 +4806,10 @@ class Cr {
4647
4806
  results: x,
4648
4807
  executionTime: (/* @__PURE__ */ new Date()).getTime() - a
4649
4808
  };
4650
- } catch (S) {
4651
- const x = c.signal.aborted ? "Query batch cancelled by user" : S instanceof Error ? S.message : "Unknown error occurred";
4809
+ } catch (T) {
4810
+ const x = c.signal.aborted ? "Query batch cancelled by user" : T instanceof Error ? T.message : "Unknown error occurred";
4652
4811
  return h && Object.values(h).forEach(
4653
- ($) => $({
4812
+ (_) => _({
4654
4813
  message: x,
4655
4814
  error: !0,
4656
4815
  running: !1
@@ -4777,7 +4936,7 @@ class Cr {
4777
4936
  currentFilename: t.currentFilename
4778
4937
  },
4779
4938
  !1
4780
- ), h = wt((l == null ? void 0 : l.data.completion_items) ?? []);
4939
+ ), h = At((l == null ? void 0 : l.data.completion_items) ?? []);
4781
4940
  return this.eligibleCrossFilterFieldsCache.set(c, h), [...h];
4782
4941
  }
4783
4942
  clearEligibleCrossFilterFieldsCache() {
@@ -4820,8 +4979,8 @@ class Cr {
4820
4979
  };
4821
4980
  }
4822
4981
  i && i();
4823
- const g = this.connectionProvider.getConnection(e);
4824
- if (!g)
4982
+ const f = this.connectionProvider.getConnection(e);
4983
+ if (!f)
4825
4984
  return {
4826
4985
  success: !1,
4827
4986
  error: `Connection ${e} not found.`,
@@ -4829,7 +4988,7 @@ class Cr {
4829
4988
  resultSize: 0,
4830
4989
  columnCount: 0
4831
4990
  };
4832
- if (!g.isConnected() && !u)
4991
+ if (!f.isConnected() && !u)
4833
4992
  try {
4834
4993
  n && n({
4835
4994
  message: "Connection is not active... Attempting to automatically reconnect.",
@@ -4855,7 +5014,7 @@ class Cr {
4855
5014
  if (m = await Promise.race([
4856
5015
  this.trilogyResolver.resolve_query(
4857
5016
  t.text,
4858
- g.queryType,
5017
+ f.queryType,
4859
5018
  t.editorType,
4860
5019
  v,
4861
5020
  t.imports,
@@ -4863,53 +5022,56 @@ class Cr {
4863
5022
  t.parameters,
4864
5023
  t.currentFilename || null
4865
5024
  ),
4866
- new Promise(($, T) => {
5025
+ new Promise((F, C) => {
4867
5026
  o.signal.addEventListener(
4868
5027
  "abort",
4869
- () => T(new Error("Query cancelled by user"))
5028
+ () => C(new Error("Query cancelled by user"))
4870
5029
  );
4871
5030
  })
4872
5031
  ]), m && m.data.generated_output) {
4873
- let $ = m.data.columns || [], T = {
5032
+ let F = m.data.columns || [], C = {
4874
5033
  success: !0,
4875
5034
  // hardcode result types for now
4876
5035
  generatedSql: m.data.generated_sql,
4877
- results: new J(
5036
+ results: new B(
4878
5037
  new Map(
4879
- $.map((E) => [
4880
- E.name,
4881
- { name: E.name, type: at.STRING, purpose: E.purpose }
5038
+ F.map((M) => [
5039
+ M.name,
5040
+ { name: M.name, type: mt.STRING, purpose: M.purpose }
4882
5041
  ])
4883
5042
  ),
4884
5043
  m.data.generated_output
4885
5044
  ),
4886
5045
  executionTime: (/* @__PURE__ */ new Date()).getTime() - s,
4887
5046
  resultSize: m.data.generated_output.length,
4888
- columnCount: $.length,
5047
+ columnCount: F.length,
4889
5048
  selectCount: m.data.select_count
4890
5049
  };
4891
- return console.log(T), c && c(T), T;
5050
+ return console.log(C), c && c(C), C;
4892
5051
  } else if (!m || !m.data.generated_sql || u) {
4893
- let $ = {
5052
+ let F = {
4894
5053
  success: !0,
4895
- results: new J(/* @__PURE__ */ new Map(), []),
5054
+ results: new B(/* @__PURE__ */ new Map(), []),
4896
5055
  executionTime: (/* @__PURE__ */ new Date()).getTime() - s,
4897
5056
  resultSize: 0,
4898
5057
  columnCount: 0
4899
5058
  };
4900
- return c && c($), $;
5059
+ return c && c(F), F;
4901
5060
  }
4902
5061
  d = m.data.generated_sql;
4903
- const y = m.data.columns, S = await Promise.race([
4904
- g.executeSql(d, t.parameters),
4905
- new Promise(($, T) => {
5062
+ const y = m.data.columns, E = {
5063
+ ...t.parameters || {},
5064
+ ...m.data.parameters || {}
5065
+ }, T = Object.keys(E).length ? E : null, x = await Promise.race([
5066
+ f.executeSql(d, T),
5067
+ new Promise((F, C) => {
4906
5068
  o.signal.addEventListener(
4907
5069
  "abort",
4908
- () => T(new Error("Query cancelled by user"))
5070
+ () => C(new Error("Query cancelled by user"))
4909
5071
  );
4910
5072
  })
4911
5073
  ]);
4912
- (t.editorType === "trilogy" || t.editorType === "preql") && this.enrichTrilogyColumns(y, S), l = S.data.length, h = S.headers.size, this.storeHistory && ne(e).recordQuery({
5074
+ (t.editorType === "trilogy" || t.editorType === "preql") && this.enrichTrilogyColumns(y, x), l = x.data.length, h = x.headers.size, this.storeHistory && ce(e).recordQuery({
4913
5075
  query: t.text,
4914
5076
  generatedQuery: d,
4915
5077
  executionTime: (/* @__PURE__ */ new Date()).getTime() - s,
@@ -4919,42 +5081,42 @@ class Cr {
4919
5081
  errorMessage: null,
4920
5082
  extraFilters: t.extraFilters
4921
5083
  });
4922
- const x = m == null ? void 0 : m.data.select_count;
5084
+ const _ = m == null ? void 0 : m.data.select_count;
4923
5085
  return c && c({
4924
5086
  success: !0,
4925
5087
  generatedSql: d,
4926
- results: S,
5088
+ results: x,
4927
5089
  executionTime: (/* @__PURE__ */ new Date()).getTime() - s,
4928
5090
  resultSize: l,
4929
5091
  columnCount: h,
4930
- selectCount: x
5092
+ selectCount: _
4931
5093
  }), {
4932
5094
  success: !0,
4933
5095
  generatedSql: d,
4934
- results: S,
5096
+ results: x,
4935
5097
  executionTime: (/* @__PURE__ */ new Date()).getTime() - s,
4936
5098
  resultSize: l,
4937
5099
  columnCount: h,
4938
- selectCount: x
5100
+ selectCount: _
4939
5101
  };
4940
5102
  } catch (y) {
4941
- const S = o.signal.aborted ? "Query cancelled by user" : y instanceof Error ? y.message : "Unknown error occurred";
4942
- return this.storeHistory && ne(e).recordQuery({
5103
+ const E = o.signal.aborted ? "Query cancelled by user" : y instanceof Error ? y.message : "Unknown error occurred";
5104
+ return this.storeHistory && ce(e).recordQuery({
4943
5105
  query: t.text,
4944
5106
  generatedQuery: d,
4945
5107
  executionTime: (/* @__PURE__ */ new Date()).getTime() - s,
4946
5108
  status: "error",
4947
5109
  resultSize: l,
4948
5110
  resultColumns: h,
4949
- errorMessage: S
5111
+ errorMessage: E
4950
5112
  }), a && a({
4951
- message: S,
5113
+ message: E,
4952
5114
  error: !0,
4953
5115
  running: !1,
4954
5116
  generatedSql: d
4955
5117
  }), {
4956
5118
  success: !1,
4957
- error: S,
5119
+ error: E,
4958
5120
  executionTime: (/* @__PURE__ */ new Date()).getTime() - s,
4959
5121
  resultSize: l,
4960
5122
  columnCount: h
@@ -4964,52 +5126,52 @@ class Cr {
4964
5126
  enrichTrilogyColumns(e, t) {
4965
5127
  for (let s = 0; s < e.length; s++) {
4966
5128
  let o = e[s], i = t.headers.get(o.name.replace("local.", "").replaceAll(".", "_"));
4967
- i && (i.traits = o.traits || [], i.address = o.name, i.purpose = o.purpose, t.headers.set(i.name, i));
5129
+ i && (i.traits = o.traits || [], i.address = o.name, i.purpose = o.purpose, i.keys = o.keys || [], t.headers.set(i.name, i));
4968
5130
  }
4969
5131
  }
4970
5132
  }
4971
5133
  export {
4972
- ne as A,
4973
- Ue as B,
4974
- Wt as C,
4975
- $t as D,
4976
- Pt as E,
4977
- mr as F,
4978
- gr as G,
4979
- yr as H,
4980
- ze as I,
4981
- wr as J,
4982
- pr as K,
4983
- br as L,
4984
- ve as M,
4985
- re as N,
4986
- At as O,
4987
- Cr as Q,
4988
- ur as T,
4989
- Ft as a,
4990
- ie as b,
4991
- vr as c,
4992
- Rt as d,
4993
- Sr as e,
4994
- Pe as f,
4995
- F as g,
4996
- M as h,
4997
- hr as i,
4998
- G as j,
4999
- Ct as k,
5000
- Re as l,
5001
- xt as m,
5002
- R as n,
5003
- Tt as o,
5004
- wt as p,
5005
- St as q,
5006
- L as r,
5007
- Et as s,
5008
- Dt as t,
5009
- dr as u,
5010
- le as v,
5011
- bt as w,
5012
- oe as x,
5013
- fr as y,
5014
- fe as z
5134
+ ce as A,
5135
+ Xe as B,
5136
+ ar as C,
5137
+ Nt as D,
5138
+ Vt as E,
5139
+ Tr as F,
5140
+ $r as G,
5141
+ Ar as H,
5142
+ Ze as I,
5143
+ Qr as J,
5144
+ Fr as K,
5145
+ _r as L,
5146
+ Te as M,
5147
+ ne as N,
5148
+ Rt as O,
5149
+ kr as Q,
5150
+ Sr as T,
5151
+ Jt as a,
5152
+ le as b,
5153
+ Or as c,
5154
+ rr as d,
5155
+ qr as e,
5156
+ Ue as f,
5157
+ A as g,
5158
+ L as h,
5159
+ Er as i,
5160
+ V as j,
5161
+ Mt as k,
5162
+ De as l,
5163
+ jt as m,
5164
+ K as n,
5165
+ It as o,
5166
+ At as p,
5167
+ qt as q,
5168
+ j as r,
5169
+ Lt as s,
5170
+ Pt as t,
5171
+ Dr as u,
5172
+ fe as v,
5173
+ Cr as w,
5174
+ ae as x,
5175
+ xr as y,
5176
+ be as z
5015
5177
  };