@trilogy-data/trilogy-studio-components 0.1.20 → 0.1.22

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 (108) hide show
  1. package/dist/{AssetAutoImporter-9QMzD3ho.js → AssetAutoImporter-D3Y61TQd.js} +5 -5
  2. package/dist/{ChatCreatorModal-CpkL5ah4.js → ChatCreatorModal-BG6DyTV3.js} +2 -2
  3. package/dist/{CodeBlock-CDWXUAiQ.js → CodeBlock-Br-z9kG9.js} +1 -1
  4. package/dist/{CommunityModels-Dk7uEXRw.js → CommunityModels-HRPrOUL7.js} +7 -7
  5. package/dist/{ConfirmDialog-tNLC5CUN.js → ConfirmDialog-CYTEamQQ.js} +2 -2
  6. package/dist/{ConnectionView-DQTOod_j.js → ConnectionView-IEdVwiAs.js} +7 -7
  7. package/dist/{CreateEditorFromDatasourcePopup-D5mwCk5D.js → CreateEditorFromDatasourcePopup-bSSd8xci.js} +4 -4
  8. package/dist/{Dashboard-BcCVnVqI.js → Dashboard-ByRas8Mx.js} +1384 -1295
  9. package/dist/{DashboardCreatorInline-C2ShZBai.js → DashboardCreatorInline-K1khKEvT.js} +3 -3
  10. package/dist/{DashboardImportSelector-YRySr7k3.js → DashboardImportSelector-8mxsOld1.js} +1 -1
  11. package/dist/{DashboardMobile-CKaqqZkb.js → DashboardMobile-CetKFJKJ.js} +4 -4
  12. package/dist/{DataTable-Bf7xeKSf.js → DataTable-CcALeEBZ.js} +2 -2
  13. package/dist/{DrilldownPane-iReKVNZE.js → DrilldownPane-oN6u9FSj.js} +6110 -6053
  14. package/dist/{Editor-DUQhJCtJ.js → Editor-DBE-qYvP.js} +7 -7
  15. package/dist/{EditorCreatorInline-D9h8RNE8.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-nbO1W7BN.js → IDE-Cp1lvfwk.js} +10 -10
  19. package/dist/{JobsView-BRgAiTvy.js → JobsView-BRGWShZ7.js} +4 -4
  20. package/dist/{LLMChat-B5WBKFfx.js → LLMChat-B4SB4M7J.js} +9 -9
  21. package/dist/{LLMConnectionList-JatTlgKd.js → LLMConnectionList-CxT0rMUV.js} +9 -9
  22. package/dist/{LLMView-BTq1yptw.js → LLMView-Cb7M_uE6.js} +8 -8
  23. package/dist/{LoadingButton--jhQCgPi.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-BFZxnpvD.js → MobileIDE-vHy9ebSV.js} +17 -17
  27. package/dist/{ModalDialog-D-yprLG4.js → ModalDialog-DUjJI7a8.js} +1 -1
  28. package/dist/{ModelCard-BdSi4Tb5.js → ModelCard-CWXrviT3.js} +6 -6
  29. package/dist/{ModelCreator-BPfMWQL3.js → ModelCreator-DHM3AiOl.js} +4 -4
  30. package/dist/{ModelView-CsaxXoLJ.js → ModelView-MGkeSYFD.js} +6 -6
  31. package/dist/{ResultComponent-DSRcNmRC.js → ResultComponent-BaRP3sxV.js} +5 -5
  32. package/dist/{Sidebar-BKacsmb3.js → Sidebar-CVbPgM3I.js} +11 -11
  33. package/dist/{StatusIcon-ytnp_iom.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-CDt1VNAs.js → Tooltip-Du2RDSUJ.js} +2 -2
  37. package/dist/{TrilogyEmbedProvider-scDWYeoJ.js → TrilogyEmbedProvider-SmcmJEz6.js} +1 -1
  38. package/dist/{TutorialPage-ZSgVaEzU.js → TutorialPage-3l563qT5.js} +12 -12
  39. package/dist/{UserProfile-BNx75xfc.js → UserProfile-85umd0xp.js} +4 -4
  40. package/dist/{WelcomePage-jGXRVqLL.js → WelcomePage-CeP5qQXC.js} +2 -2
  41. package/dist/_plugin-vue_export-helper-Ckr1Vx8X.js +368 -0
  42. package/dist/components/MarkdownRenderer.vue.d.ts.map +1 -1
  43. package/dist/components/Tooltip.vue.d.ts.map +1 -1
  44. package/dist/components/chartHelpers.d.ts.map +1 -1
  45. package/dist/components/dashboard/Dashboard.vue.d.ts +3 -1
  46. package/dist/components/dashboard/Dashboard.vue.d.ts.map +1 -1
  47. package/dist/components/dashboard/DashboardChart.vue.d.ts +2 -2
  48. package/dist/components/dashboard/DashboardFilter.vue.d.ts +1 -1
  49. package/dist/components/dashboard/DashboardGridItem.vue.d.ts.map +1 -1
  50. package/dist/components/dashboard/DashboardHeader.vue.d.ts +10 -0
  51. package/dist/components/dashboard/DashboardHeader.vue.d.ts.map +1 -1
  52. package/dist/components/dashboard/DashboardMarkdown.vue.d.ts +1 -1
  53. package/dist/components/dashboard/DashboardTable.vue.d.ts +1 -1
  54. package/dist/components/dashboard/useDashboard.d.ts.map +1 -1
  55. package/dist/components/sidebar/DashboardList.vue.d.ts +2 -2
  56. package/dist/components/sidebar/DashboardListItem.vue.d.ts +1 -1
  57. package/dist/components/sidebar/Sidebar.vue.d.ts +2 -2
  58. package/dist/composables/useCrossFilterEligibility.d.ts.map +1 -1
  59. package/dist/composables/useEmbeddedDashboardGroup.d.ts +5 -9
  60. package/dist/composables/useEmbeddedDashboardGroup.d.ts.map +1 -1
  61. package/dist/composables/useResolvedCrossFilterController.d.ts +1 -1
  62. package/dist/composables/useResolvedCrossFilterController.d.ts.map +1 -1
  63. package/dist/connections/bigquery_oauth.d.ts +1 -0
  64. package/dist/connections/bigquery_oauth.d.ts.map +1 -1
  65. package/dist/connections/duckdb.d.ts.map +1 -1
  66. package/dist/connections/motherduck.d.ts +1 -1
  67. package/dist/connections/motherduck.d.ts.map +1 -1
  68. package/dist/connections/snowflake.d.ts +9 -2
  69. package/dist/connections/snowflake.d.ts.map +1 -1
  70. package/dist/connections.js +2 -2
  71. package/dist/dashboard.js +23 -18
  72. package/dist/dashboards/barChartSpec.d.ts.map +1 -1
  73. package/dist/dashboards/barHChartSpec.d.ts.map +1 -1
  74. package/dist/dashboards/base.d.ts +13 -13
  75. package/dist/dashboards/base.d.ts.map +1 -1
  76. package/dist/dashboards/conditions.d.ts +26 -0
  77. package/dist/dashboards/conditions.d.ts.map +1 -1
  78. package/dist/dashboards/crossFilters.d.ts +29 -9
  79. package/dist/dashboards/crossFilters.d.ts.map +1 -1
  80. package/dist/dashboards/dashboardQueryExecutor.d.ts.map +1 -1
  81. package/dist/dashboards/helpers.d.ts +2 -0
  82. package/dist/dashboards/helpers.d.ts.map +1 -1
  83. package/dist/dashboards/spec.d.ts.map +1 -1
  84. package/dist/{editorStore-BTPcljeQ.js → editorStore-CHHdik0L.js} +1 -1
  85. package/dist/editors/results.d.ts +1 -0
  86. package/dist/editors/results.d.ts.map +1 -1
  87. package/dist/embed.js +2 -2
  88. package/dist/icons/registerMdiIcons.d.ts +2 -1
  89. package/dist/icons/registerMdiIcons.d.ts.map +1 -1
  90. package/dist/monaco.js +1 -1
  91. package/dist/{queryExecutionService-BxU16oNE.js → queryExecutionService-Dvn1FJG0.js} +886 -709
  92. package/dist/{remoteProject-CvjztZU1.js → remoteProject-DrsKUWjF.js} +1 -1
  93. package/dist/{snowflake-CY1Gnu3y.js → snowflake-BUHnLz1S.js} +1587 -1539
  94. package/dist/stores/dashboardStore.d.ts +2 -2
  95. package/dist/stores/dashboardStore.d.ts.map +1 -1
  96. package/dist/stores/queryExecutionService.d.ts.map +1 -1
  97. package/dist/stores/resolver.d.ts +3 -1
  98. package/dist/stores/resolver.d.ts.map +1 -1
  99. package/dist/stores.js +2 -2
  100. package/dist/trilogy-studio-components.css +1 -1
  101. package/dist/{useDashboard-Cl_8almf.js → useDashboard-sNPR-7GK.js} +915 -884
  102. package/dist/{useResizableDialog-BZgmdwim.js → useResizableDialog-B6WRQMxc.js} +1 -1
  103. package/dist/views/ResponsiveIDE.vue.d.ts.map +1 -1
  104. package/dist/views/TutorialPage.vue.d.ts +4 -2
  105. package/dist/views/TutorialPage.vue.d.ts.map +1 -1
  106. package/dist/views.js +109 -104
  107. package/package.json +2 -1
  108. 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 Oe, t as ct, M as lt, r as ut, C as Qe, u as ht } from "./toolLoopCore-CK_KVuAS.js";
6
+ import { ref as O, toValue as Ve, computed as dt } from "vue";
7
+ import { K as se, l as ft } from "./constants-BXXolEur.js";
8
+ import { E as De, 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(), pe = /* @__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 hr {
192
+ class Sr {
185
193
  constructor(e, t = 100) {
186
194
  w(this, "settingStore");
187
195
  w(this, "validateCache");
@@ -234,25 +242,26 @@ class hr {
234
242
  throw console.log(s), Error(this.getErrorMessage(s));
235
243
  }
236
244
  }
237
- async validate_query(e, t = null, s = null, o = null, i = null, n = null) {
238
- const a = {
245
+ async validate_query(e, t = null, s = null, o = null, i = null, n = null, a = null) {
246
+ const c = {
239
247
  query: e,
240
248
  sources: t || [],
241
249
  imports: s || [],
242
250
  extra_filters: o || [],
243
251
  extra_content: i || {},
244
- current_filename: n || null
245
- }, c = this.createHash(a), u = this.validateCache.get(c);
246
- if (u)
247
- return u;
248
- const l = await this.fetchWithErrorHandling(this.buildResolverUrl("validate_query"), {
252
+ current_filename: n || null,
253
+ parameters: a || {}
254
+ }, u = this.createHash(c), l = this.validateCache.get(u);
255
+ if (l)
256
+ return l;
257
+ const h = await this.fetchWithErrorHandling(this.buildResolverUrl("validate_query"), {
249
258
  method: "POST",
250
259
  headers: {
251
260
  "Content-Type": "application/json"
252
261
  },
253
- body: JSON.stringify(a)
262
+ body: JSON.stringify(c)
254
263
  });
255
- return this.validateCache.set(c, l), l;
264
+ return this.validateCache.set(u, h), h;
256
265
  }
257
266
  async drilldown_query(e, t, s, o, i, n, a = null, c = null, u = null, l = null, h = null) {
258
267
  console.log("TrilogyResolver.drilldown_query called"), console.log(n);
@@ -343,28 +352,28 @@ class hr {
343
352
  if (u)
344
353
  return u;
345
354
  const l = [], h = [];
346
- if (e.forEach((y, S) => {
347
- const x = [...i || [], ...y.extra_filters || []], $ = {
355
+ if (e.forEach((y, E) => {
356
+ const T = [...i || [], ...y.extra_filters || []], x = {
348
357
  ...n || {},
349
358
  ...y.parameters || {}
350
- }, T = this.createQueryCacheKey(
359
+ }, _ = this.createQueryCacheKey(
351
360
  y.query,
352
361
  t,
353
362
  s,
354
363
  o,
355
- x.length > 0 ? x : null,
356
- Object.keys($).length > 0 ? $ : null,
364
+ T.length > 0 ? T : null,
365
+ Object.keys(x).length > 0 ? x : null,
357
366
  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 });
367
+ ), F = this.queryCache.get(_);
368
+ F ? l.push({
369
+ index: E,
370
+ result: { ...F.data, label: y.label }
371
+ }) : h.push({ index: E, component: y });
363
372
  }), h.length === 0) {
364
- const S = {
365
- data: { queries: l.sort((x, $) => x.index - $.index).map((x) => x.result) }
373
+ const E = {
374
+ data: { queries: l.sort((T, x) => T.index - x.index).map((T) => T.result) }
366
375
  };
367
- return this.batchQueryCache.set(c, S), S;
376
+ return this.batchQueryCache.set(c, E), E;
368
377
  }
369
378
  const d = {
370
379
  queries: h.map((y) => y.component),
@@ -383,26 +392,26 @@ class hr {
383
392
  },
384
393
  body: JSON.stringify(d)
385
394
  }
386
- )).data.queries.forEach((y, S) => {
387
- const x = h[S].index, $ = h[S].component, T = [...i || [], ...$.extra_filters || []], E = {
395
+ )).data.queries.forEach((y, E) => {
396
+ const T = h[E].index, x = h[E].component, _ = [...i || [], ...x.extra_filters || []], F = {
388
397
  ...n || {},
389
- ...$.parameters || {}
390
- }, O = this.createQueryCacheKey(
391
- $.query,
398
+ ...x.parameters || {}
399
+ }, C = this.createQueryCacheKey(
400
+ x.query,
392
401
  t,
393
402
  s,
394
403
  o,
395
- T.length > 0 ? T : null,
396
- Object.keys(E).length > 0 ? E : null,
404
+ _.length > 0 ? _ : null,
405
+ Object.keys(F).length > 0 ? F : null,
397
406
  null
398
407
  );
399
- this.queryCache.set(O, { data: y }), l.push({
400
- index: x,
401
- result: { ...y, label: $.label }
408
+ this.queryCache.set(C, { data: y }), l.push({
409
+ index: T,
410
+ result: { ...y, label: x.label }
402
411
  });
403
412
  });
404
413
  const m = {
405
- data: { queries: l.sort((y, S) => y.index - S.index).map((y) => y.result) }
414
+ data: { queries: l.sort((y, E) => y.index - E.index).map((y) => y.result) }
406
415
  };
407
416
  return this.batchQueryCache.set(c, m), m;
408
417
  }
@@ -419,9 +428,31 @@ class hr {
419
428
  "Content-Type": "application/json"
420
429
  },
421
430
  body: JSON.stringify(s)
422
- }), a = Ve.fromJSON(n.data);
431
+ }), a = st.fromJSON(n.data);
423
432
  return this.modelCache.set(o, a), a;
424
433
  }
434
+ async warmResolver() {
435
+ const e = this.settingStore.settings.trilogyResolver.replace(/\/+$/, "");
436
+ if (!e || je.has(e))
437
+ return;
438
+ const t = pe.get(e);
439
+ if (t)
440
+ return t;
441
+ const s = this.fetchWithErrorHandling(`${e}/generate_query`, {
442
+ method: "POST",
443
+ headers: {
444
+ "Content-Type": "application/json"
445
+ },
446
+ body: JSON.stringify(xt)
447
+ }).then(() => {
448
+ je.add(e);
449
+ }).catch((o) => {
450
+ console.warn("Resolver warm-up request failed:", o);
451
+ }).finally(() => {
452
+ pe.delete(e);
453
+ });
454
+ return pe.set(e, s), s;
455
+ }
425
456
  // Cache management methods
426
457
  clearAllCaches() {
427
458
  this.validateCache.clear(), this.formatCache.clear(), this.queryCache.clear(), this.batchQueryCache.clear(), this.modelCache.clear();
@@ -436,20 +467,67 @@ class hr {
436
467
  };
437
468
  }
438
469
  }
439
- function bt(r) {
470
+ function Tt(r) {
471
+ return r.replace(/[^a-zA-Z0-9_]/g, "_");
472
+ }
473
+ function $t(r) {
474
+ let e = 0;
475
+ for (let t = 0; t < r.length; t++)
476
+ e = Math.imul(31, e) + r.charCodeAt(t) | 0;
477
+ return Math.abs(e).toString(36).slice(0, 5);
478
+ }
479
+ function oe(r) {
480
+ if (r instanceof Date) {
481
+ const e = r.getFullYear(), t = String(r.getMonth() + 1).padStart(2, "0"), s = String(r.getDate()).padStart(2, "0");
482
+ return `${e}-${t}-${s}`;
483
+ }
484
+ return r !== null && typeof r == "object" && typeof r.toISODate == "function" ? r.toISODate() : r;
485
+ }
486
+ function Ie(r, e, t = "") {
487
+ const s = Tt(r) + "_" + $t(r) + t;
488
+ switch (e.op) {
489
+ case "eq": {
490
+ const o = oe(e.value);
491
+ return {
492
+ filterString: `${r} = :${s}`,
493
+ parameters: { [`:${s}`]: o }
494
+ };
495
+ }
496
+ case "range": {
497
+ const o = oe(e.value[0]), i = oe(e.value[1]);
498
+ return {
499
+ filterString: `${r} between :${s}_min and :${s}_max`,
500
+ parameters: {
501
+ [`:${s}_min`]: o,
502
+ [`:${s}_max`]: i
503
+ }
504
+ };
505
+ }
506
+ case "in": {
507
+ const o = {}, i = e.value.map((n, a) => (o[`:${s}_${a}`] = oe(n), `:${s}_${a}`));
508
+ return {
509
+ filterString: `${r} in (${i.join(", ")})`,
510
+ parameters: o
511
+ };
512
+ }
513
+ case "is_null":
514
+ return { filterString: `${r} IS NULL`, parameters: {} };
515
+ }
516
+ }
517
+ function Cr(r) {
440
518
  if (Array.isArray(r)) {
441
519
  const t = {};
442
520
  return r.forEach((o) => {
443
521
  Object.entries(o).forEach(([i, n]) => {
444
522
  t[i] || (t[i] = []), t[i].push(n);
445
523
  });
446
- }), Object.entries(t).map(([o, i]) => i.length > 1 ? `(${i.map((a) => de(o, a)).join(" OR ")})` : de(o, i[0])).join(" AND ");
524
+ }), Object.entries(t).map(([o, i]) => i.length > 1 ? `(${i.map((a) => be(o, a)).join(" OR ")})` : be(o, i[0])).join(" AND ");
447
525
  }
448
526
  return Object.keys(r).length === 0 ? "" : Object.entries(r).map(
449
- ([t, s]) => de(t, s)
527
+ ([t, s]) => be(t, s)
450
528
  ).join(" AND ");
451
529
  }
452
- function _e(r) {
530
+ function Ne(r) {
453
531
  if (r instanceof Date) {
454
532
  const e = r.getFullYear(), t = String(r.getMonth() + 1).padStart(2, "0"), s = String(r.getDate()).padStart(2, "0");
455
533
  return `'${e}-${t}-${s}'::date`;
@@ -457,48 +535,83 @@ function _e(r) {
457
535
  if (r === null)
458
536
  return "NULL";
459
537
  if (typeof r == "string")
460
- return `'${r.replace(/'/g, be)}'`;
538
+ return `'${r.replace(/'/g, De)}'`;
461
539
  if (typeof r == "boolean")
462
540
  return r ? "TRUE" : "FALSE";
463
541
  if (typeof r == "number")
464
542
  return r.toString();
465
543
  }
466
- function de(r, e) {
544
+ function be(r, e) {
467
545
  if (e === null)
468
546
  return `${r} IS NULL`;
469
547
  if (typeof e == "string") {
470
- const t = e.replace(/'/g, be);
548
+ const t = e.replace(/'/g, De);
471
549
  return `${r}='''${t}'''`;
472
550
  } else {
473
551
  if (Array.isArray(e))
474
- return `${r} between ${_e(e[0])} and ${_e(e[e.length - 1])}`;
552
+ return `${r} between ${Ne(e[0])} and ${Ne(e[e.length - 1])}`;
475
553
  if (typeof e == "number" || typeof e == "boolean")
476
554
  return `${r}=${e}`;
477
555
  if (e === void 0)
478
556
  return `${r} IS NULL`;
479
557
  {
480
- const t = JSON.stringify(e).replace(/'/g, be);
558
+ const t = JSON.stringify(e).replace(/'/g, De);
481
559
  return `${r}='${t}'`;
482
560
  }
483
561
  }
484
562
  }
485
- function wt(r = []) {
563
+ function At(r = []) {
486
564
  const e = /* @__PURE__ */ new Set();
487
565
  for (const t of r)
488
566
  t != null && t.label && e.add(t.label);
489
567
  return Array.from(e);
490
568
  }
491
- function B(r) {
569
+ function he(r) {
492
570
  return { ...r };
493
571
  }
494
- function vt(r, e) {
572
+ function G(r) {
573
+ return { ...r };
574
+ }
575
+ function Ft(r, e) {
576
+ if (r.op !== e.op) return !1;
577
+ switch (r.op) {
578
+ case "is_null":
579
+ return !0;
580
+ case "eq":
581
+ return r.value === e.value;
582
+ case "range": {
583
+ const t = e;
584
+ return r.value[0] === t.value[0] && r.value[1] === t.value[1];
585
+ }
586
+ case "in": {
587
+ const t = e;
588
+ return r.value.length === t.value.length && r.value.every((s, o) => s === t.value[o]);
589
+ }
590
+ }
591
+ }
592
+ function de(r, e) {
593
+ const t = Object.keys(r).sort(), s = Object.keys(e).sort();
594
+ return t.length !== s.length ? !1 : t.every(
595
+ (o, i) => o === s[i] && Ft(r[o], e[o])
596
+ );
597
+ }
598
+ function _t(r, e) {
495
599
  return Array.isArray(r) && Array.isArray(e) ? r.length === e.length && r.every((t, s) => t === e[s]) : r === e;
496
600
  }
497
- function ae(r, e) {
601
+ function Re(r, e) {
498
602
  const t = Object.keys(r).sort(), s = Object.keys(e).sort();
499
- return t.length !== s.length ? !1 : t.every((o, i) => o === s[i] && vt(r[o], e[o]));
603
+ return t.length !== s.length ? !1 : t.every(
604
+ (o, i) => o === s[i] && _t(r[o], e[o])
605
+ );
606
+ }
607
+ function Ot(r, e, t, s) {
608
+ const o = r.filter((c) => c.source !== e), i = r.filter((c) => c.source === e);
609
+ if (s === "remove") return o;
610
+ if (s === "add") return [...o, { source: e, value: G(t) }];
611
+ const a = i.some((c) => Re(c.value, t)) ? i.filter((c) => !Re(c.value, t)) : [...i, { source: e, value: G(t) }];
612
+ return [...o, ...a];
500
613
  }
501
- function St(r, e, t) {
614
+ function Qt(r, e, t) {
502
615
  if (e.size === 0)
503
616
  return t && r.startsWith("local.") ? r.replace(/^local\./, "") : r;
504
617
  if (e.has(r))
@@ -510,41 +623,62 @@ function St(r, e, t) {
510
623
  }
511
624
  return null;
512
625
  }
513
- function Ct(r, e = [], t = {}) {
626
+ function qt(r, e = [], t = {}) {
514
627
  const s = new Set(e), o = t.normalizeLocalFields ?? !1;
515
628
  return Object.entries(r).reduce((i, [n, a]) => {
516
- if (typeof a != "string" && typeof a != "number" && !(a instanceof Date) && !Array.isArray(a))
629
+ if (typeof a != "object" || a === null || !["eq", "range", "in", "is_null"].includes(a.op))
517
630
  return i;
518
- const c = St(n, s, o);
631
+ const c = Qt(n, s, o);
519
632
  return c && (i[c] = a), i;
520
633
  }, {});
521
634
  }
522
- function Re(r) {
523
- return r.length ? bt(r.map((e) => e.value)) : "";
524
- }
525
635
  function le(r) {
526
- const e = r.conceptFilters || [], t = (r.filters || []).filter((i) => i.source !== "cross"), s = Re(e);
527
- s && t.push({
636
+ if (!r.length)
637
+ return { filterStrings: [], parameters: {} };
638
+ const e = {};
639
+ for (const o of r)
640
+ for (const [i, n] of Object.entries(o.value))
641
+ e[i] || (e[i] = []), e[i].push(n);
642
+ const t = [];
643
+ let s = {};
644
+ for (const [o, i] of Object.entries(e))
645
+ if (i.length > 1) {
646
+ const n = [];
647
+ for (let a = 0; a < i.length; a++) {
648
+ const { filterString: c, parameters: u } = Ie(o, i[a], `_or${a}`);
649
+ n.push(c), s = { ...s, ...u };
650
+ }
651
+ t.push(`(${n.join(" OR ")})`);
652
+ } else {
653
+ const { filterString: n, parameters: a } = Ie(o, i[0]);
654
+ t.push(n), s = { ...s, ...a };
655
+ }
656
+ return { filterStrings: t, parameters: s };
657
+ }
658
+ function me(r) {
659
+ const e = r.conceptFilters || [], t = (r.filters || []).filter((a) => a.source !== "cross"), { filterStrings: s, parameters: o } = le(e), i = s.join(" AND ");
660
+ i && t.push({
528
661
  source: "cross",
529
- value: s
662
+ value: i,
663
+ parameters: Object.keys(o).length ? o : void 0
530
664
  });
531
- const o = JSON.stringify(t) !== JSON.stringify(r.filters || []);
532
- return r.filters = t, o;
665
+ const n = JSON.stringify(t) !== JSON.stringify(r.filters || []);
666
+ return r.filters = t, n;
533
667
  }
534
- function ke(r, e, t, s) {
668
+ function kt(r, e, t, s) {
535
669
  const o = r.filter((c) => c.source !== e), i = r.filter((c) => c.source === e);
536
670
  if (s === "remove")
537
671
  return o;
538
672
  if (s === "add")
539
- return [...o, { source: e, value: B(t) }];
540
- const a = i.some((c) => ae(c.value, t)) ? i.filter((c) => !ae(c.value, t)) : [...i, { source: e, value: B(t) }];
673
+ return [...o, { source: e, value: he(t) }];
674
+ const a = i.some((c) => de(c.value, t)) ? i.filter((c) => !de(c.value, t)) : [...i, { source: e, value: he(t) }];
541
675
  return [...o, ...a];
542
676
  }
543
- function Et(r, e, t, s, o) {
677
+ function Mt(r, e, t, s, o) {
544
678
  const i = [];
545
679
  return Object.entries(r).forEach(([n, a]) => {
546
680
  if (n === e) {
547
- const h = ke(
681
+ const h = Ot(
548
682
  a.chartFilters || [],
549
683
  e,
550
684
  s,
@@ -555,18 +689,18 @@ function Et(r, e, t, s, o) {
555
689
  }
556
690
  if (!a.allowCrossFilter)
557
691
  return;
558
- const c = ke(
692
+ const c = kt(
559
693
  a.conceptFilters || [],
560
694
  e,
561
695
  t,
562
696
  o
563
697
  ), u = JSON.stringify(c) !== JSON.stringify(a.conceptFilters || []);
564
698
  u && (a.conceptFilters = c);
565
- const l = le(a);
699
+ const l = me(a);
566
700
  (u || l) && i.push(n);
567
701
  }), i;
568
702
  }
569
- function Dt(r, e, t) {
703
+ function Lt(r, e, t) {
570
704
  const s = r[e];
571
705
  if (!s)
572
706
  return !1;
@@ -574,10 +708,10 @@ function Dt(r, e, t) {
574
708
  (a) => a.source !== t
575
709
  ), i = JSON.stringify(o) !== JSON.stringify(s.conceptFilters || []);
576
710
  i && (s.conceptFilters = o);
577
- const n = le(s);
711
+ const n = me(s);
578
712
  return i || n;
579
713
  }
580
- function xt(r, e) {
714
+ function Pt(r, e) {
581
715
  const t = [];
582
716
  return Object.entries(r).forEach(([s, o]) => {
583
717
  if (s === e) {
@@ -588,11 +722,11 @@ function xt(r, e) {
588
722
  (c) => c.source !== e
589
723
  ), n = JSON.stringify(i) !== JSON.stringify(o.conceptFilters || []);
590
724
  n && (o.conceptFilters = i);
591
- const a = le(o);
725
+ const a = me(o);
592
726
  (n || a) && t.push(s);
593
727
  }), t;
594
728
  }
595
- function Tt(r) {
729
+ function jt(r) {
596
730
  const e = [];
597
731
  return Object.entries(r).forEach(([t, s]) => {
598
732
  var i, n, a;
@@ -600,18 +734,18 @@ function Tt(r) {
600
734
  s.conceptFilters = [], s.chartFilters = [], s.filters = [], o && e.push(t);
601
735
  }), e;
602
736
  }
603
- function $t(r = {}) {
737
+ function It(r = {}) {
604
738
  const e = /* @__PURE__ */ new Map(), t = () => {
605
- const o = r.validFields ? Be(r.validFields) : [];
739
+ const o = r.validFields ? Ve(r.validFields) : [];
606
740
  return new Set(o);
607
741
  }, s = (o) => {
608
- const i = Ct(o.filters, t(), {
742
+ const i = qt(o.filters, t(), {
609
743
  normalizeLocalFields: r.normalizeLocalFields ?? !0
610
744
  });
611
745
  return {
612
746
  source: o.source,
613
747
  filters: i,
614
- chart: B(o.chart || i),
748
+ chart: G(o.chart || {}),
615
749
  append: o.append
616
750
  };
617
751
  };
@@ -619,8 +753,8 @@ function $t(r = {}) {
619
753
  getSelections() {
620
754
  return Array.from(e.values()).flat().map((o) => ({
621
755
  source: o.source,
622
- filters: B(o.filters),
623
- chart: B(o.chart || o.filters),
756
+ filters: he(o.filters),
757
+ chart: G(o.chart || {}),
624
758
  append: o.append
625
759
  }));
626
760
  },
@@ -637,8 +771,8 @@ function $t(r = {}) {
637
771
  if (a === "add")
638
772
  return e.set(o.source, [n]), n.filters;
639
773
  const l = c.some(
640
- (h) => ae(h.filters, n.filters)
641
- ) ? c.filter((h) => !ae(h.filters, n.filters)) : [...c, n];
774
+ (h) => de(h.filters, n.filters)
775
+ ) ? c.filter((h) => !de(h.filters, n.filters)) : [...c, n];
642
776
  return l.length === 0 ? e.delete(o.source) : e.set(o.source, l), n.filters;
643
777
  },
644
778
  clearSource(o) {
@@ -654,30 +788,46 @@ function $t(r = {}) {
654
788
  return Array.from(e.entries()).filter(([i]) => i !== o).flatMap(
655
789
  ([i, n]) => n.map((a) => ({
656
790
  source: i,
657
- value: B(a.filters)
791
+ value: he(a.filters)
658
792
  }))
659
793
  );
660
794
  },
661
795
  getChartSelectionsFor(o) {
662
- return (e.get(o) || []).map(
663
- (i) => B(i.chart || i.filters)
664
- );
796
+ return (e.get(o) || []).map((i) => G(i.chart || {}));
665
797
  },
666
798
  getFilterExpressionFor(o) {
667
- return Re(this.getSqlFilterInputsFor(o));
799
+ const { filterStrings: i } = le(this.getSqlFilterInputsFor(o));
800
+ return i.join(" AND ");
668
801
  },
669
802
  getSqlFiltersFor(o, i = []) {
670
803
  const n = this.getFilterExpressionFor(o);
671
804
  return n ? [...i, n] : [...i];
805
+ },
806
+ getSqlFilterLikesFor(o, i = []) {
807
+ const n = i.map((l) => ({
808
+ source: "base",
809
+ value: l
810
+ })), { filterStrings: a, parameters: c } = le(
811
+ this.getSqlFilterInputsFor(o)
812
+ ), u = a.join(" AND ");
813
+ return u && n.push({
814
+ source: "cross",
815
+ value: u,
816
+ parameters: Object.keys(c).length ? c : void 0
817
+ }), n;
818
+ },
819
+ getSqlParametersFor(o) {
820
+ const { parameters: i } = le(this.getSqlFilterInputsFor(o));
821
+ return i;
672
822
  }
673
823
  };
674
824
  }
675
- function dr(r = {}) {
676
- const e = Q(0), t = $t(Be(r)), s = () => {
825
+ function Er(r = {}) {
826
+ const e = O(0), t = It(Ve(r)), s = () => {
677
827
  e.value += 1;
678
828
  };
679
829
  return {
680
- version: nt(() => e.value),
830
+ version: dt(() => e.value),
681
831
  applyDimensionClick(o, i) {
682
832
  const n = t.applyDimensionClick(o, i);
683
833
  return s(), n;
@@ -708,17 +858,23 @@ function dr(r = {}) {
708
858
  },
709
859
  getSqlFiltersFor(o, i = []) {
710
860
  return e.value, t.getSqlFiltersFor(o, i);
861
+ },
862
+ getSqlFilterLikesFor(o, i = []) {
863
+ return e.value, t.getSqlFilterLikesFor(o, i);
864
+ },
865
+ getSqlParametersFor(o) {
866
+ return e.value, t.getSqlParametersFor(o);
711
867
  }
712
868
  };
713
869
  }
714
- const M = {
870
+ const L = {
715
871
  CHART: "chart",
716
872
  MARKDOWN: "markdown",
717
873
  TABLE: "table",
718
874
  FILTER: "filter",
719
875
  SECTION_HEADER: "section-header"
720
876
  };
721
- class G {
877
+ class V {
722
878
  constructor({
723
879
  id: e,
724
880
  name: t,
@@ -732,7 +888,7 @@ class G {
732
888
  filter: l = null,
733
889
  imports: h = [],
734
890
  version: d = 1,
735
- state: g = "editing",
891
+ state: f = "editing",
736
892
  description: v = ""
737
893
  }) {
738
894
  w(this, "id");
@@ -751,7 +907,7 @@ class G {
751
907
  w(this, "description", "");
752
908
  w(this, "changed", !1);
753
909
  w(this, "deleted", !1);
754
- 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;
910
+ 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;
755
911
  }
756
912
  delete() {
757
913
  this.deleted = !0, this.changed = !0;
@@ -764,7 +920,7 @@ class G {
764
920
  addItem(e, t = 0, s = 0, o = 4, i = null, n = null, a) {
765
921
  const c = this.nextId.toString();
766
922
  let u = 10;
767
- e === M.MARKDOWN ? u = 3 : e === M.SECTION_HEADER && (u = 1);
923
+ e === L.MARKDOWN ? u = 3 : e === L.SECTION_HEADER && (u = 1);
768
924
  let l = s;
769
925
  l = this.layout.reduce((m, y) => Math.max(m, y.y + y.h), 0), this.layout.push({
770
926
  x: t,
@@ -775,18 +931,18 @@ class G {
775
931
  static: !1
776
932
  });
777
933
  let h = `Note ${c}`;
778
- e === M.CHART ? h = `Chart ${c}` : e === M.TABLE ? h = `Table ${c}` : e === M.SECTION_HEADER && (h = "### Section Header");
779
- let d = a || h, g = `# Markdown Cell
934
+ e === L.CHART ? h = `Chart ${c}` : e === L.TABLE ? h = `Table ${c}` : e === L.SECTION_HEADER && (h = "### Section Header");
935
+ let d = a || h, f = `# Markdown Cell
780
936
  Enter your markdown content here.`;
781
- 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 = "");
782
- let v = n || g;
937
+ 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 = "");
938
+ let v = n || f;
783
939
  return this.gridItems[c] = {
784
940
  type: e,
785
941
  content: v,
786
942
  name: d,
787
943
  width: 0,
788
944
  height: 0,
789
- allowCrossFilter: e !== M.SECTION_HEADER
945
+ allowCrossFilter: e !== L.SECTION_HEADER
790
946
  }, this.nextId++, this.updatedAt = /* @__PURE__ */ new Date(), this.changed = !0, c;
791
947
  }
792
948
  copyItem(e) {
@@ -887,24 +1043,24 @@ Enter your markdown content here.`;
887
1043
  }
888
1044
  updateItemFilters(e) {
889
1045
  const t = this.gridItems[e];
890
- t && le(t) && (this.updatedAt = /* @__PURE__ */ new Date(), this.changed = !0);
1046
+ t && me(t) && (this.updatedAt = /* @__PURE__ */ new Date(), this.changed = !0);
891
1047
  }
892
1048
  removeItemCrossFilter(e, t) {
893
- Dt(this.gridItems, e, t) && (this.updatedAt = /* @__PURE__ */ new Date(), this.changed = !0);
1049
+ Lt(this.gridItems, e, t) && (this.updatedAt = /* @__PURE__ */ new Date(), this.changed = !0);
894
1050
  }
895
1051
  removeItemCrossFilterSource(e) {
896
1052
  var o, i;
897
- const t = !!((i = (o = this.gridItems[e]) == null ? void 0 : o.chartFilters) != null && i.length), s = xt(this.gridItems, e);
1053
+ const t = !!((i = (o = this.gridItems[e]) == null ? void 0 : o.chartFilters) != null && i.length), s = Pt(this.gridItems, e);
898
1054
  return (s.length > 0 || t) && (this.updatedAt = /* @__PURE__ */ new Date(), this.changed = !0), s;
899
1055
  }
900
1056
  removeAllFilters() {
901
- const e = Tt(this.gridItems);
1057
+ const e = jt(this.gridItems);
902
1058
  for (const t in this.gridItems)
903
1059
  this.gridItems[t].parameters = {};
904
1060
  return e.length > 0 && (this.updatedAt = /* @__PURE__ */ new Date(), this.changed = !0), e;
905
1061
  }
906
1062
  updateItemCrossFilters(e, t, s, o) {
907
- const i = Et(
1063
+ const i = Mt(
908
1064
  this.gridItems,
909
1065
  e,
910
1066
  t,
@@ -1025,10 +1181,10 @@ Enter your markdown content here.`;
1025
1181
  loadStartTime: null,
1026
1182
  allowCrossFilter: o.allowCrossFilter !== !1,
1027
1183
  // Default to true if not explicitly false
1028
- chartConfig: $e(o.chartConfig),
1029
- drilldownChartConfig: $e(o.drilldownChartConfig)
1184
+ chartConfig: qe(o.chartConfig),
1185
+ drilldownChartConfig: qe(o.drilldownChartConfig)
1030
1186
  };
1031
- return new G({
1187
+ return new V({
1032
1188
  ...e,
1033
1189
  createdAt: new Date(e.createdAt),
1034
1190
  updatedAt: new Date(e.updatedAt),
@@ -1036,7 +1192,7 @@ Enter your markdown content here.`;
1036
1192
  });
1037
1193
  }
1038
1194
  }
1039
- const fe = (r) => {
1195
+ const we = (r) => {
1040
1196
  const t = r.replace(/'''/g, "```").replace(/"""/g, "```").replace(/```(trilogy|sql|json)(\s|\n)/g, "```");
1041
1197
  for (const s of ["```\\s*```", "```"]) {
1042
1198
  const o = t.match(new RegExp(`${s}([\\s\\S]*)${s}`, "s"));
@@ -1044,7 +1200,7 @@ const fe = (r) => {
1044
1200
  return o[o.length - 1];
1045
1201
  }
1046
1202
  return r;
1047
- }, fr = V("llmConnections", {
1203
+ }, Dr = Y("llmConnections", {
1048
1204
  state: () => ({
1049
1205
  connections: {},
1050
1206
  activeConnection: ""
@@ -1072,20 +1228,20 @@ const fe = (r) => {
1072
1228
  throw new Error(`LLM connection with name "${r}" already exists.`);
1073
1229
  let s;
1074
1230
  if (e === "demo")
1075
- s = new ut(r, t.model);
1231
+ s = new pt(r, t.model);
1076
1232
  else if (e === "anthropic")
1077
- s = new Ae(
1233
+ s = new ke(
1078
1234
  r,
1079
1235
  t.apiKey,
1080
1236
  t.model,
1081
1237
  t.saveCredential
1082
1238
  );
1083
1239
  else if (e === "openai")
1084
- s = new Fe(r, t.apiKey, t.model, t.saveCredential);
1240
+ s = new Me(r, t.apiKey, t.model, t.saveCredential);
1085
1241
  else if (e === "google")
1086
- s = new Qe(r, t.apiKey, t.model, t.saveCredential);
1242
+ s = new Le(r, t.apiKey, t.model, t.saveCredential);
1087
1243
  else if (e === "openrouter")
1088
- s = new Oe(
1244
+ s = new Pe(
1089
1245
  r,
1090
1246
  t.apiKey,
1091
1247
  t.model,
@@ -1105,13 +1261,13 @@ const fe = (r) => {
1105
1261
  let t;
1106
1262
  const s = `__temp_${r}_${Date.now()}`;
1107
1263
  if (r === "anthropic")
1108
- t = new Ae(s, e, "", !1);
1264
+ t = new ke(s, e, "", !1);
1109
1265
  else if (r === "openai")
1110
- t = new Fe(s, e, "", !1);
1266
+ t = new Me(s, e, "", !1);
1111
1267
  else if (r === "google")
1112
- t = new Qe(s, e, "", !1);
1268
+ t = new Le(s, e, "", !1);
1113
1269
  else if (r === "openrouter")
1114
- t = new Oe(s, e, "", !1);
1270
+ t = new Pe(s, e, "", !1);
1115
1271
  else
1116
1272
  throw new Error(`LLM provider type "${r}" not found.`);
1117
1273
  return await t.reset(), t.models;
@@ -1135,7 +1291,7 @@ const fe = (r) => {
1135
1291
  role: "assistant",
1136
1292
  content: h.text,
1137
1293
  toolCalls: h.toolCalls
1138
- }), console.log("Initial LLM response:", h.text), l = fe(h.text), e)
1294
+ }), console.log("Initial LLM response:", h.text), l = we(h.text), e)
1139
1295
  for (; c < t && !u; )
1140
1296
  try {
1141
1297
  if (!l || l.trim() == "")
@@ -1148,8 +1304,8 @@ const fe = (r) => {
1148
1304
  console.log(`Max attempts (${t}) reached, returning last response`);
1149
1305
  break;
1150
1306
  }
1151
- let g = d.message, v = `
1152
- 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.`;
1307
+ let f = d.message, v = `
1308
+ 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.`;
1153
1309
  h = await this.generateCompletion(
1154
1310
  n,
1155
1311
  {
@@ -1163,7 +1319,7 @@ You had given a response: """${l}""" that failed validation on this error: ${g}.
1163
1319
  role: "assistant",
1164
1320
  content: h.text,
1165
1321
  toolCalls: h.toolCalls
1166
- }), l = fe(h.text), console.log(`Attempt ${c}. New extract:`, l);
1322
+ }), l = we(h.text), console.log(`Attempt ${c}. New extract:`, l);
1167
1323
  }
1168
1324
  return console.log("Exiting validation loop with attempts:", c), console.log("Final LLM response:", l), {
1169
1325
  success: u,
@@ -1175,11 +1331,11 @@ You had given a response: """${l}""" that failed validation on this error: ${g}.
1175
1331
  };
1176
1332
  },
1177
1333
  async generateDashboardCompletion(r, e = null, t = [], s = 3) {
1178
- let o = et(r, t);
1334
+ let o = at(r, t);
1179
1335
  return this.generateValidatedCompletion(o, e, s).then((i) => i.content);
1180
1336
  },
1181
1337
  async generateQueryCompletion(r, e, t = null, s = 3, o = null) {
1182
- let i = Ze(r, e);
1338
+ let i = it(r, e);
1183
1339
  return this.generateValidatedCompletion(i, t, s, o);
1184
1340
  },
1185
1341
  async generateSQLQueryCompletion(r) {
@@ -1189,12 +1345,12 @@ You had given a response: """${l}""" that failed validation on this error: ${g}.
1189
1345
  success: !0,
1190
1346
  prompt: r,
1191
1347
  message: e.text,
1192
- content: fe(e.text),
1348
+ content: we(e.text),
1193
1349
  attempts: 1
1194
1350
  }));
1195
1351
  },
1196
1352
  async generateFilterQuery(r, e, t = null, s = 3) {
1197
- let o = Xe(r, e);
1353
+ let o = nt(r, e);
1198
1354
  return this.generateValidatedCompletion(o, t, s).then((i) => i.content);
1199
1355
  },
1200
1356
  /**
@@ -1208,7 +1364,7 @@ You had given a response: """${l}""" that failed validation on this error: ${g}.
1208
1364
  const t = this.connections[r];
1209
1365
  if (!t)
1210
1366
  throw new Error(`LLM connection with name "${r}" not found.`);
1211
- const s = ct(e), o = t.model, i = t.getFastModel();
1367
+ const s = gt(e), o = t.model, i = t.getFastModel();
1212
1368
  try {
1213
1369
  i !== o && (t.model = i);
1214
1370
  const n = await t.generateCompletion(
@@ -1220,7 +1376,7 @@ You had given a response: """${l}""" that failed validation on this error: ${g}.
1220
1376
  },
1221
1377
  null
1222
1378
  );
1223
- return lt(n.text);
1379
+ return yt(n.text);
1224
1380
  } finally {
1225
1381
  i !== o && (t.model = o);
1226
1382
  }
@@ -1245,7 +1401,7 @@ You had given a response: """${l}""" that failed validation on this error: ${g}.
1245
1401
  hasActiveDefaultConnection: (r) => Object.values(r.connections).some((e) => e.isDefault && e.connected)
1246
1402
  }
1247
1403
  });
1248
- class At {
1404
+ class Nt {
1249
1405
  constructor(e, t, s, o, i, n, a = {}) {
1250
1406
  w(this, "queryQueue", /* @__PURE__ */ new Map());
1251
1407
  w(this, "activeQueries", /* @__PURE__ */ new Set());
@@ -1328,51 +1484,55 @@ class At {
1328
1484
  * Queue a single query for execution
1329
1485
  */
1330
1486
  runSingle(e) {
1331
- let t = this.getItemData(e, this.dashboardId), s = (this.getItemData(e, this.dashboardId).filters || []).map(
1332
- (c) => c.value
1487
+ let t = this.getItemData(e, this.dashboardId);
1488
+ const s = this.getItemData(e, this.dashboardId).filters || [];
1489
+ let o = s.map((l) => l.value);
1490
+ const i = Object.assign(
1491
+ {},
1492
+ ...s.map((l) => l.parameters || {})
1333
1493
  );
1334
1494
  this.setItemData(e, this.dashboardId, {
1335
1495
  loading: !0,
1336
1496
  error: null
1337
1497
  });
1338
- let o = {
1498
+ let n = {
1339
1499
  dashboardId: this.dashboardId,
1340
1500
  queryInput: {
1341
1501
  text: t.structured_content ? t.structured_content.query : t.content,
1342
- extraFilters: s,
1343
- parameters: t.parameters || {},
1502
+ extraFilters: o,
1503
+ parameters: { ...t.parameters || {}, ...i },
1344
1504
  extraContent: t.rootContent || []
1345
1505
  },
1346
1506
  priority: this.getDefaultPriority(e),
1347
1507
  itemId: e,
1348
- onSuccess: (c) => {
1349
- this.isLatestQueryForItem(a) ? this.setItemData(e, this.dashboardId, {
1350
- results: c.results
1508
+ onSuccess: (l) => {
1509
+ this.isLatestQueryForItem(u) ? this.setItemData(e, this.dashboardId, {
1510
+ results: l.results
1351
1511
  }) : console.log(`Ignoring outdated query result for itemId ${e}`);
1352
1512
  },
1353
- onError: (c) => {
1354
- this.isLatestQueryForItem(a) ? this.setItemData(e, this.dashboardId, { error: c }) : console.log(`Ignoring outdated query error for itemId ${e}`);
1513
+ onError: (l) => {
1514
+ this.isLatestQueryForItem(u) ? this.setItemData(e, this.dashboardId, { error: l }) : console.log(`Ignoring outdated query error for itemId ${e}`);
1355
1515
  },
1356
- onProgress: (c) => {
1516
+ onProgress: (l) => {
1357
1517
  }
1358
1518
  };
1359
- const i = this.generateQueryId(o);
1519
+ const a = this.generateQueryId(n);
1360
1520
  this.cancelPendingQueriesForItem(e);
1361
- const n = this.findDuplicateQuery(o);
1362
- let a;
1363
- if (n)
1364
- console.log(`Deduplicating query for ${o.itemId}`), a = n.id, this.addCallbacksToExistingQuery(n, o);
1521
+ const c = this.findDuplicateQuery(n);
1522
+ let u;
1523
+ if (c)
1524
+ console.log(`Deduplicating query for ${n.itemId}`), u = c.id, this.addCallbacksToExistingQuery(c, n);
1365
1525
  else {
1366
- a = i;
1367
- const c = {
1368
- ...o,
1369
- id: a,
1526
+ u = a;
1527
+ const l = {
1528
+ ...n,
1529
+ id: u,
1370
1530
  timestamp: Date.now(),
1371
1531
  retryCount: 0
1372
1532
  };
1373
- this.queryQueue.set(a, c), this.activeQueries.size < this.maxConcurrentQueries && (console.log(`Executing query immediately for ${o.itemId}`), this.executeQuery(a));
1533
+ this.queryQueue.set(u, l), this.activeQueries.size < this.maxConcurrentQueries && (console.log(`Executing query immediately for ${n.itemId}`), this.executeQuery(u));
1374
1534
  }
1375
- return this.latestQueryByItemId.set(e, a), this.itemIdByQueryId.set(a, e), a;
1535
+ return this.latestQueryByItemId.set(e, u), this.itemIdByQueryId.set(u, e), u;
1376
1536
  }
1377
1537
  /**
1378
1538
  * Queue multiple queries for batch execution with prioritization
@@ -1380,7 +1540,15 @@ class At {
1380
1540
  runBatch(e) {
1381
1541
  const t = [];
1382
1542
  return this.batchTimeout && clearTimeout(this.batchTimeout), e.forEach((s) => {
1383
- let o = this.getItemData(s, this.dashboardId), i = (o.filters || []).map((h) => h.value);
1543
+ let o = this.getItemData(s, this.dashboardId);
1544
+ const i = o.filters || [];
1545
+ let n = i.map((f) => f.value);
1546
+ const a = Object.assign(
1547
+ {},
1548
+ ...i.map(
1549
+ (f) => f.parameters || {}
1550
+ )
1551
+ );
1384
1552
  if (o.structured_content.query.trim().length === 0) {
1385
1553
  this.setItemData(s, this.dashboardId, {
1386
1554
  error: null,
@@ -1392,44 +1560,44 @@ class At {
1392
1560
  loading: !0,
1393
1561
  error: null
1394
1562
  });
1395
- let a = {
1563
+ let u = {
1396
1564
  dashboardId: this.dashboardId,
1397
1565
  queryInput: {
1398
1566
  text: o.structured_content ? o.structured_content.query : o.content,
1399
- extraFilters: i,
1400
- parameters: o.parameters || {},
1567
+ extraFilters: n,
1568
+ parameters: { ...o.parameters || {}, ...a },
1401
1569
  extraContent: o.rootContent || []
1402
1570
  },
1403
1571
  priority: this.getDefaultPriority(s),
1404
1572
  itemId: s,
1405
- onSuccess: (h) => {
1406
- this.isLatestQueryForItem(l) ? this.setItemData(s, this.dashboardId, {
1407
- results: h.results
1573
+ onSuccess: (f) => {
1574
+ this.isLatestQueryForItem(d) ? this.setItemData(s, this.dashboardId, {
1575
+ results: f.results
1408
1576
  }) : console.log(`Ignoring outdated batch query result for itemId ${s}`);
1409
1577
  },
1410
- onError: (h) => {
1411
- this.isLatestQueryForItem(l) ? this.setItemData(s, this.dashboardId, { error: h }) : console.log(`Ignoring outdated batch query error for itemId ${s}`);
1578
+ onError: (f) => {
1579
+ this.isLatestQueryForItem(d) ? this.setItemData(s, this.dashboardId, { error: f }) : console.log(`Ignoring outdated batch query error for itemId ${s}`);
1412
1580
  },
1413
- onProgress: (h) => {
1581
+ onProgress: (f) => {
1414
1582
  }
1415
1583
  };
1416
- const c = this.generateQueryId(a);
1584
+ const l = this.generateQueryId(u);
1417
1585
  this.cancelPendingQueriesForItem(s);
1418
- const u = this.findDuplicateQuery(a);
1419
- let l;
1420
- if (u)
1421
- console.log(`Deduplicating batch query for ${a.itemId}`), l = u.id, this.addCallbacksToExistingQuery(u, a);
1586
+ const h = this.findDuplicateQuery(u);
1587
+ let d;
1588
+ if (h)
1589
+ console.log(`Deduplicating batch query for ${u.itemId}`), d = h.id, this.addCallbacksToExistingQuery(h, u);
1422
1590
  else {
1423
- l = c;
1424
- const h = {
1425
- ...a,
1426
- id: l,
1591
+ d = l;
1592
+ const f = {
1593
+ ...u,
1594
+ id: d,
1427
1595
  timestamp: Date.now(),
1428
1596
  retryCount: 0
1429
1597
  };
1430
- this.queryQueue.set(l, h);
1598
+ this.queryQueue.set(d, f);
1431
1599
  }
1432
- this.latestQueryByItemId.set(s, l), this.itemIdByQueryId.set(l, s), t.push(l);
1600
+ this.latestQueryByItemId.set(s, d), this.itemIdByQueryId.set(d, s), t.push(d);
1433
1601
  }), this.batchTimeout = setTimeout(() => {
1434
1602
  this.processBatch();
1435
1603
  }, this.batchDelay), t;
@@ -1516,8 +1684,8 @@ class At {
1516
1684
  o.map((l) => [
1517
1685
  l.label,
1518
1686
  (h) => {
1519
- var g;
1520
- (g = i.find((v) => v.id === l.label)) == null || g.onSuccess(h);
1687
+ var f;
1688
+ (f = i.find((v) => v.id === l.label)) == null || f.onSuccess(h);
1521
1689
  const d = this.queryWaiters.get(l.label);
1522
1690
  d && (d.resolve(h), this.queryWaiters.delete(l.label)), this.activeQueries.delete(l.label), this.cleanupQueryTracking(l.label);
1523
1691
  }
@@ -1526,7 +1694,7 @@ class At {
1526
1694
  o.map((l) => [
1527
1695
  l.label,
1528
1696
  (h) => {
1529
- let d = i.find((g) => g.id === l.label);
1697
+ let d = i.find((f) => f.id === l.label);
1530
1698
  d && this.handleQueryError(d, h), this.activeQueries.delete(l.label), this.cleanupQueryTracking(l.label);
1531
1699
  }
1532
1700
  ])
@@ -1614,7 +1782,7 @@ class At {
1614
1782
  }
1615
1783
  }
1616
1784
  }
1617
- const Ft = (r) => r.replace(/\s+/g, ""), Qt = V("dashboards", {
1785
+ const Rt = (r) => r.replace(/\s+/g, ""), Jt = Y("dashboards", {
1618
1786
  state: () => ({
1619
1787
  dashboards: {},
1620
1788
  activeDashboardId: "",
@@ -1638,7 +1806,7 @@ const Ft = (r) => r.replace(/\s+/g, ""), Qt = V("dashboards", {
1638
1806
  throw new Error(`Dashboard with ID "${r}" not found.`);
1639
1807
  if (this.queryExecutors[r])
1640
1808
  return this.queryExecutors[r];
1641
- const t = new At(
1809
+ const t = new Nt(
1642
1810
  e.queryExecutionService,
1643
1811
  e.connectionName,
1644
1812
  e.dashboardId,
@@ -1682,7 +1850,7 @@ const Ft = (r) => r.replace(/\s+/g, ""), Qt = V("dashboards", {
1682
1850
  const t = r;
1683
1851
  if (Object.values(this.dashboards).some((o) => o.name === r))
1684
1852
  throw new Error(`A dashboard with name ${r} already exists.`);
1685
- const s = new G({
1853
+ const s = new V({
1686
1854
  id: t,
1687
1855
  name: r,
1688
1856
  connection: e,
@@ -1698,7 +1866,7 @@ const Ft = (r) => r.replace(/\s+/g, ""), Qt = V("dashboards", {
1698
1866
  let t = `${e.name} (copy)`, s = 1;
1699
1867
  for (; Object.values(this.dashboards).some((i) => i.name === t); )
1700
1868
  t = `${e.name} (copy ${s})`, s++;
1701
- const o = new G({
1869
+ const o = new V({
1702
1870
  id: t,
1703
1871
  name: t,
1704
1872
  connection: e.connection,
@@ -1728,7 +1896,7 @@ const Ft = (r) => r.replace(/\s+/g, ""), Qt = V("dashboards", {
1728
1896
  // Load dashboards from serialized data
1729
1897
  loadDashboards(r) {
1730
1898
  Object.entries(r).forEach(([e, t]) => {
1731
- this.dashboards[e] = G.fromSerialized(t);
1899
+ this.dashboards[e] = V.fromSerialized(t);
1732
1900
  });
1733
1901
  },
1734
1902
  removeAllFilters(r) {
@@ -1765,7 +1933,7 @@ const Ft = (r) => r.replace(/\s+/g, ""), Qt = V("dashboards", {
1765
1933
  updateDashboardFilter(r, e) {
1766
1934
  if (this.dashboards[r]) {
1767
1935
  let t = this.dashboards[r].filter;
1768
- return (!e || Ft(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) : []);
1936
+ 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) : []);
1769
1937
  } else
1770
1938
  throw new Error(`Dashboard with ID "${r}" not found.`);
1771
1939
  },
@@ -1948,7 +2116,7 @@ const Ft = (r) => r.replace(/\s+/g, ""), Qt = V("dashboards", {
1948
2116
  const s = this.dashboards[r];
1949
2117
  if (s) {
1950
2118
  for (const i of Object.values(s.gridItems))
1951
- if (i.type === M.CHART || i.type === M.TABLE) {
2119
+ if (i.type === L.CHART || i.type === L.TABLE) {
1952
2120
  const n = typeof i.content == "string" ? i.content : ((o = i.content) == null ? void 0 : o.query) || "";
1953
2121
  await (e == null ? void 0 : e.generateQuery(s.connection, {
1954
2122
  text: n,
@@ -1996,7 +2164,7 @@ const Ft = (r) => r.replace(/\s+/g, ""), Qt = V("dashboards", {
1996
2164
  );
1997
2165
  if (!s)
1998
2166
  throw new Error(`No completion items found for dashboard ID "${r}".`);
1999
- return ht(s);
2167
+ return bt(s);
2000
2168
  },
2001
2169
  async generatePromptSpec(r, e, t, s) {
2002
2170
  let o = await this.populateAIConcepts(
@@ -2005,13 +2173,13 @@ const Ft = (r) => r.replace(/\s+/g, ""), Qt = V("dashboards", {
2005
2173
  s
2006
2174
  ), i = await e.generateDashboardCompletion(
2007
2175
  r,
2008
- De,
2176
+ _e,
2009
2177
  o,
2010
2178
  3
2011
2179
  );
2012
2180
  if (!i)
2013
2181
  throw new Error("No response from LLM");
2014
- return De(i);
2182
+ return _e(i);
2015
2183
  },
2016
2184
  async populateFromPromptSpec(r, e, t, s, o) {
2017
2185
  let i = this.dashboards[r];
@@ -2027,15 +2195,15 @@ const Ft = (r) => r.replace(/\s+/g, ""), Qt = V("dashboards", {
2027
2195
  text: u,
2028
2196
  editorType: "trilogy",
2029
2197
  imports: i.imports,
2030
- extraContent: i.imports.map((g) => {
2198
+ extraContent: i.imports.map((f) => {
2031
2199
  var v, m;
2032
2200
  return {
2033
- alias: g.name,
2034
- contents: ((v = o.editors[g.id]) == null ? void 0 : v.contents) || ((m = o.editors[g.name]) == null ? void 0 : m.contents) || ""
2201
+ alias: f.name,
2202
+ contents: ((v = o.editors[f.id]) == null ? void 0 : v.contents) || ((m = o.editors[f.name]) == null ? void 0 : m.contents) || ""
2035
2203
  };
2036
2204
  })
2037
- }, h = (g) => {
2038
- throw g;
2205
+ }, h = (f) => {
2206
+ throw f;
2039
2207
  };
2040
2208
  return await (await s.executeQuery(
2041
2209
  i.connection,
@@ -2056,8 +2224,8 @@ const Ft = (r) => r.replace(/\s+/g, ""), Qt = V("dashboards", {
2056
2224
  let c = /* @__PURE__ */ new Map();
2057
2225
  for (const u of e.layout) {
2058
2226
  let l = e.gridItems[u.id], h = l.content, d = l.type.toLowerCase();
2059
- [M.CHART, M.TABLE].includes(d) && (h = `Placeholder, prompt: ${h}`);
2060
- let g = this.addItemToDashboard(
2227
+ [L.CHART, L.TABLE].includes(d) && (h = `Placeholder, prompt: ${h}`);
2228
+ let f = this.addItemToDashboard(
2061
2229
  r,
2062
2230
  "markdown",
2063
2231
  u.x,
@@ -2067,28 +2235,28 @@ const Ft = (r) => r.replace(/\s+/g, ""), Qt = V("dashboards", {
2067
2235
  h,
2068
2236
  l.name
2069
2237
  );
2070
- c.set(g, { type: d, content: h });
2238
+ c.set(f, { type: d, content: h });
2071
2239
  }
2072
2240
  for (const u of c) {
2073
2241
  let l = u[0], h = u[1], d = h.content;
2074
- [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);
2242
+ [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);
2075
2243
  }
2076
2244
  }
2077
2245
  }
2078
- }), qe = (r) => new Promise((e) => setTimeout(e, r)), Ot = /* @__PURE__ */ new Set(), Me = /* @__PURE__ */ new Set(), Le = (r) => {
2079
- if (Ot.has(r))
2246
+ }), Je = (r) => new Promise((e) => setTimeout(e, r)), Bt = /* @__PURE__ */ new Set(), Be = /* @__PURE__ */ new Set(), Ke = (r) => {
2247
+ if (Bt.has(r))
2080
2248
  return !0;
2081
2249
  let e = r;
2082
2250
  r.includes("://") || (e = `http://${r}`);
2083
2251
  try {
2084
2252
  const t = new URL(e), s = t.host, o = t.hostname;
2085
- if (Me.has(s) || Me.has(o))
2253
+ if (Be.has(s) || Be.has(o))
2086
2254
  return !0;
2087
2255
  } catch {
2088
2256
  }
2089
2257
  return !1;
2090
- }, ce = async (r, e, t = 5, s = 1e3) => {
2091
- if (Le(r))
2258
+ }, fe = async (r, e, t = 5, s = 1e3) => {
2259
+ if (Ke(r))
2092
2260
  throw new Error(
2093
2261
  `Cannot connect to ${r} - blocked by Content Security Policy. This URL is not allowed by the browser's security settings.`
2094
2262
  );
@@ -2101,12 +2269,12 @@ const Ft = (r) => r.replace(/\s+/g, ""), Qt = V("dashboards", {
2101
2269
  let c = a ? parseInt(a) * 1e3 : i;
2102
2270
  console.log(
2103
2271
  `Rate limited. Retrying after ${c}ms (Attempt ${o + 1}/${t})`
2104
- ), await qe(c), i = i * 2 * (0.8 + Math.random() * 0.4), o++;
2272
+ ), await Je(c), i = i * 2 * (0.8 + Math.random() * 0.4), o++;
2105
2273
  continue;
2106
2274
  }
2107
2275
  return n;
2108
2276
  } catch (n) {
2109
- if (Le(r))
2277
+ if (Ke(r))
2110
2278
  throw new Error(
2111
2279
  `Cannot connect to ${r} - blocked by Content Security Policy. This URL is not allowed by the browser's security settings.`
2112
2280
  );
@@ -2115,9 +2283,9 @@ const Ft = (r) => r.replace(/\s+/g, ""), Qt = V("dashboards", {
2115
2283
  throw n;
2116
2284
  console.log(
2117
2285
  `Network error, retrying after ${i}ms (Attempt ${o + 1}/${t})`
2118
- ), await qe(i), i = i * 2 * (0.8 + Math.random() * 0.4), o++;
2286
+ ), await Je(i), i = i * 2 * (0.8 + Math.random() * 0.4), o++;
2119
2287
  }
2120
- }, _t = (r, e, t, s, o) => r.filter((i) => {
2288
+ }, Kt = (r, e, t, s, o) => r.filter((i) => {
2121
2289
  const n = i.name.toLowerCase().includes(e.toLowerCase()), a = !t || i.engine === t;
2122
2290
  let c = !0;
2123
2291
  if (s !== "all") {
@@ -2125,7 +2293,7 @@ const Ft = (r) => r.replace(/\s+/g, ""), Qt = V("dashboards", {
2125
2293
  c = s === "imported" && u || s === "not-imported" && !u;
2126
2294
  }
2127
2295
  return n && a && c;
2128
- }), mr = (r) => {
2296
+ }), xr = (r) => {
2129
2297
  switch (r) {
2130
2298
  case "bigquery":
2131
2299
  return "new-bigquery-oauth";
@@ -2134,36 +2302,36 @@ const Ft = (r) => r.replace(/\s+/g, ""), Qt = V("dashboards", {
2134
2302
  default:
2135
2303
  return `new-${r}`;
2136
2304
  }
2137
- }, kt = (r) => {
2305
+ }, Ut = (r) => {
2138
2306
  const e = /* @__PURE__ */ new Set();
2139
2307
  return r.forEach((t) => {
2140
2308
  t.engine && e.add(t.engine);
2141
2309
  }), Array.from(e).sort();
2142
- }, re = {
2310
+ }, ne = {
2143
2311
  type: "github",
2144
2312
  id: "trilogy-data-trilogy-public-models-main",
2145
2313
  name: "Trilogy Public Models",
2146
2314
  owner: "trilogy-data",
2147
2315
  repo: "trilogy-public-models",
2148
2316
  branch: "main"
2149
- }, Ke = (r) => {
2317
+ }, Ye = (r) => {
2150
2318
  if (r)
2151
2319
  return {
2152
2320
  headers: {
2153
2321
  "X-Trilogy-Token": r
2154
2322
  }
2155
2323
  };
2156
- }, qt = async (r) => {
2157
- const e = `${r.baseUrl}/index.json`, t = await ce(e, Ke(r.token));
2324
+ }, zt = async (r) => {
2325
+ const e = `${r.baseUrl}/index.json`, t = await fe(e, Ye(r.token));
2158
2326
  if (!t.ok)
2159
2327
  throw new Error(`Failed to fetch store index: ${t.status} ${t.statusText}`);
2160
2328
  return t.json();
2161
- }, Mt = async (r) => {
2329
+ }, Ht = async (r) => {
2162
2330
  let e = null, t = [];
2163
2331
  try {
2164
- const o = (await qt(r)).models.map(async (n) => {
2332
+ const o = (await zt(r)).models.map(async (n) => {
2165
2333
  try {
2166
- const a = await ce(n.url, Ke(r.token));
2334
+ const a = await fe(n.url, Ye(r.token));
2167
2335
  if (!a.ok)
2168
2336
  return console.warn(`Failed to fetch model ${n.name}: ${a.statusText}`), null;
2169
2337
  const c = await a.json();
@@ -2177,12 +2345,12 @@ const Ft = (r) => r.replace(/\s+/g, ""), Qt = V("dashboards", {
2177
2345
  s instanceof Error ? e = s.message : e = "Error fetching store data", console.error("Error fetching from generic store:", s);
2178
2346
  }
2179
2347
  return { files: t, error: e };
2180
- }, Lt = async (r) => {
2348
+ }, Wt = async (r) => {
2181
2349
  let e = null, t = [];
2182
2350
  try {
2183
2351
  let s, o;
2184
2352
  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/`);
2185
- const i = await ce(s);
2353
+ const i = await fe(s);
2186
2354
  if (i.status !== 200)
2187
2355
  throw new Error(`Error fetching community data: ${await i.text()}`);
2188
2356
  let n;
@@ -2193,7 +2361,7 @@ const Ft = (r) => r.replace(/\s+/g, ""), Qt = V("dashboards", {
2193
2361
  n = JSON.parse(atob(c.content));
2194
2362
  }
2195
2363
  const a = n.files.filter((c) => c.filename.endsWith(".json")).map(async (c) => {
2196
- const u = `${o}${c.filename}`, l = await ce(u);
2364
+ const u = `${o}${c.filename}`, l = await fe(u);
2197
2365
  if (!l.ok)
2198
2366
  throw new Error(`Error fetching file ${c.filename}: ${l.statusText}`);
2199
2367
  const h = await l.json();
@@ -2204,12 +2372,12 @@ const Ft = (r) => r.replace(/\s+/g, ""), Qt = V("dashboards", {
2204
2372
  s instanceof Error ? e = s.message : e = "Error fetching files", console.error("Error fetching from GitHub store:", s);
2205
2373
  }
2206
2374
  return { files: t, error: e };
2207
- }, Ue = async (r) => r.type === "github" ? Lt(r) : Mt(r), Pt = async (r, e) => {
2375
+ }, Xe = async (r) => r.type === "github" ? Wt(r) : Ht(r), Gt = async (r, e) => {
2208
2376
  const t = {}, s = {};
2209
2377
  return await Promise.all(
2210
2378
  r.map(async (o) => {
2211
2379
  try {
2212
- const { files: i, error: n } = await Ue(o);
2380
+ const { files: i, error: n } = await Xe(o);
2213
2381
  t[o.id] = i, n && (s[o.id] = n), e && e(o.id, { files: i, error: n });
2214
2382
  } catch (i) {
2215
2383
  const n = i instanceof Error ? i.message : "Unknown error";
@@ -2217,29 +2385,29 @@ const Ft = (r) => r.replace(/\s+/g, ""), Qt = V("dashboards", {
2217
2385
  }
2218
2386
  })
2219
2387
  ), { filesByStore: t, errors: s };
2220
- }, we = (r) => r.trim().replace(/[\\/:*?"<>|]+/g, "-").replace(/\s+/g, " "), R = (r) => r.replace(/\/$/, ""), Pe = (r) => R(r).replace(/^https?:\/\//, "").replace(/\//g, "-"), ve = (r) => {
2388
+ }, xe = (r) => r.trim().replace(/[\\/:*?"<>|]+/g, "-").replace(/\s+/g, " "), K = (r) => r.replace(/\/$/, ""), Ue = (r) => K(r).replace(/^https?:\/\//, "").replace(/\//g, "-"), Te = (r) => {
2221
2389
  try {
2222
- const e = new URL(R(r));
2223
- return we(e.hostname + (e.port ? `:${e.port}` : "") || e.host || r);
2390
+ const e = new URL(K(r));
2391
+ return xe(e.hostname + (e.port ? `:${e.port}` : "") || e.host || r);
2224
2392
  } catch {
2225
- return we(R(r));
2393
+ return xe(K(r));
2226
2394
  }
2227
- }, ze = (r) => we(r.name || ve(r.baseUrl)), gr = (r) => ze(r), yr = (r) => ze(r), Ie = "trilogy-community-stores", je = (r) => {
2395
+ }, Ze = (r) => xe(r.name || Te(r.baseUrl)), Tr = (r) => Ze(r), $r = (r) => Ze(r), ze = "trilogy-community-stores", He = (r) => {
2228
2396
  const e = new URLSearchParams(window.location.search), t = e.get("store"), s = e.get("token");
2229
2397
  if (!t || !s)
2230
2398
  return;
2231
- const o = R(t), i = r.find(
2232
- (n) => n.type === "generic" && R(n.baseUrl) === o
2399
+ const o = K(t), i = r.find(
2400
+ (n) => n.type === "generic" && K(n.baseUrl) === o
2233
2401
  );
2234
2402
  i && !i.token && (i.token = s);
2235
- }, ie = V("communityApi", {
2403
+ }, ue = Y("communityApi", {
2236
2404
  state: () => ({
2237
2405
  // Initialize with default store
2238
- stores: [re],
2406
+ stores: [ne],
2239
2407
  filesByStore: {},
2240
2408
  errors: {},
2241
2409
  // Initialize default store status as idle
2242
- storeStatus: { [re.id]: "idle" },
2410
+ storeStatus: { [ne.id]: "idle" },
2243
2411
  loading: !1,
2244
2412
  // Modal state
2245
2413
  showAddStoreModal: !1,
@@ -2266,7 +2434,7 @@ const Ft = (r) => r.replace(/\s+/g, ""), Qt = V("dashboards", {
2266
2434
  const e = [];
2267
2435
  return Object.values(r.filesByStore).forEach((t) => {
2268
2436
  e.push(...t);
2269
- }), kt(e);
2437
+ }), Ut(e);
2270
2438
  },
2271
2439
  // Check if any store has errors
2272
2440
  hasErrors: (r) => Object.keys(r.errors).length > 0,
@@ -2286,7 +2454,7 @@ const Ft = (r) => r.replace(/\s+/g, ""), Qt = V("dashboards", {
2286
2454
  */
2287
2455
  loadStoresFromStorage() {
2288
2456
  try {
2289
- const r = localStorage.getItem(Ie);
2457
+ const r = localStorage.getItem(ze);
2290
2458
  if (r) {
2291
2459
  const e = JSON.parse(r), t = new Map(this.stores.map((n) => [n.id, n])), s = e.map((n) => {
2292
2460
  const a = t.get(n.id);
@@ -2304,14 +2472,14 @@ const Ft = (r) => r.replace(/\s+/g, ""), Qt = V("dashboards", {
2304
2472
  ...n,
2305
2473
  ...a
2306
2474
  };
2307
- }), i = [re, ...s].filter(
2475
+ }), i = [ne, ...s].filter(
2308
2476
  (n, a, c) => a === c.findIndex((u) => u.id === n.id)
2309
2477
  );
2310
- je(i), this.stores = i, i.forEach((n) => {
2478
+ He(i), this.stores = i, i.forEach((n) => {
2311
2479
  this.storeStatus[n.id] || (this.storeStatus[n.id] = "idle");
2312
2480
  });
2313
2481
  }
2314
- r || je(this.stores);
2482
+ r || He(this.stores);
2315
2483
  } catch (r) {
2316
2484
  console.error("Error loading stores from localStorage:", r);
2317
2485
  }
@@ -2321,13 +2489,13 @@ const Ft = (r) => r.replace(/\s+/g, ""), Qt = V("dashboards", {
2321
2489
  */
2322
2490
  saveStoresToStorage() {
2323
2491
  try {
2324
- const r = this.stores.filter((e) => e.id !== re.id).map((e) => {
2492
+ const r = this.stores.filter((e) => e.id !== ne.id).map((e) => {
2325
2493
  if (e.type !== "generic")
2326
2494
  return e;
2327
2495
  const { token: t, ...s } = e;
2328
2496
  return s;
2329
2497
  });
2330
- localStorage.setItem(Ie, JSON.stringify(r));
2498
+ localStorage.setItem(ze, JSON.stringify(r));
2331
2499
  } catch (r) {
2332
2500
  console.error("Error saving stores to localStorage:", r);
2333
2501
  }
@@ -2343,7 +2511,7 @@ const Ft = (r) => r.replace(/\s+/g, ""), Qt = V("dashboards", {
2343
2511
  console.log(
2344
2512
  `Fetching community model files from ${this.stores.map((e) => e.id).join(", ")}...`
2345
2513
  );
2346
- const r = await Pt(this.stores, (e, t) => {
2514
+ const r = await Gt(this.stores, (e, t) => {
2347
2515
  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"}`);
2348
2516
  });
2349
2517
  console.log("All stores fetched:", r);
@@ -2364,7 +2532,7 @@ const Ft = (r) => r.replace(/\s+/g, ""), Qt = V("dashboards", {
2364
2532
  if (e) {
2365
2533
  this.loading = !0, this.storeStatus[r] = "idle";
2366
2534
  try {
2367
- const t = await Ue(e);
2535
+ const t = await Xe(e);
2368
2536
  this.filesByStore[r] = t.files, t.error ? (this.errors[r] = t.error, this.storeStatus[r] = "failed") : (delete this.errors[r], this.storeStatus[r] = "connected");
2369
2537
  } finally {
2370
2538
  this.loading = !1;
@@ -2377,7 +2545,7 @@ const Ft = (r) => r.replace(/\s+/g, ""), Qt = V("dashboards", {
2377
2545
  filteredFiles(r, e, t, s, o = null) {
2378
2546
  const i = (a) => a in s.models;
2379
2547
  let n = this.allFiles;
2380
- return o && (n = this.filesByStore[o]), n ? _t(n, r, e, t, i) : [];
2548
+ return o && (n = this.filesByStore[o]), n ? Kt(n, r, e, t, i) : [];
2381
2549
  },
2382
2550
  /**
2383
2551
  * Get files from a specific store
@@ -2398,7 +2566,7 @@ const Ft = (r) => r.replace(/\s+/g, ""), Qt = V("dashboards", {
2398
2566
  if (r.type === "generic") {
2399
2567
  if (!r.baseUrl)
2400
2568
  throw new Error("Base URL is required for generic stores");
2401
- r.baseUrl = R(r.baseUrl), r.id = r.id || Pe(r.baseUrl), r.name = r.name || ve(r.baseUrl);
2569
+ r.baseUrl = K(r.baseUrl), r.id = r.id || Ue(r.baseUrl), r.name = r.name || Te(r.baseUrl);
2402
2570
  } else if (r.type === "github" && (!r.owner || !r.repo || !r.branch))
2403
2571
  throw new Error("Owner, repo, and branch are required for GitHub stores");
2404
2572
  if (this.stores.some((t) => t.id === r.id))
@@ -2459,10 +2627,10 @@ const Ft = (r) => r.replace(/\s+/g, ""), Qt = V("dashboards", {
2459
2627
  if (r === "generic") {
2460
2628
  if (!t)
2461
2629
  throw new Error("Please fill in all required fields");
2462
- const n = R(t), c = {
2630
+ const n = K(t), c = {
2463
2631
  type: "generic",
2464
- id: Pe(n),
2465
- name: e || ve(n),
2632
+ id: Ue(n),
2633
+ name: e || Te(n),
2466
2634
  baseUrl: n
2467
2635
  };
2468
2636
  await this.addStore(c);
@@ -2501,20 +2669,20 @@ const Ft = (r) => r.replace(/\s+/g, ""), Qt = V("dashboards", {
2501
2669
  }
2502
2670
  }
2503
2671
  });
2504
- class Se extends Error {
2672
+ class $e extends Error {
2505
2673
  constructor(t, s) {
2506
2674
  super(t);
2507
2675
  w(this, "status");
2508
2676
  this.name = "JobsServiceError", this.status = s;
2509
2677
  }
2510
2678
  }
2511
- const P = (r, e = {}) => {
2679
+ const I = (r, e = {}) => {
2512
2680
  const t = new Headers(e.headers);
2513
2681
  return r && t.set("X-Trilogy-Token", r), {
2514
2682
  ...e,
2515
2683
  headers: t
2516
2684
  };
2517
- }, Ce = (r) => r.split("/").filter(Boolean).map((e) => encodeURIComponent(e)).join("/"), I = async (r, e) => {
2685
+ }, Ae = (r) => r.split("/").filter(Boolean).map((e) => encodeURIComponent(e)).join("/"), N = async (r, e) => {
2518
2686
  if (r.ok)
2519
2687
  return r;
2520
2688
  let t = "";
@@ -2527,36 +2695,36 @@ const P = (r, e = {}) => {
2527
2695
  } catch {
2528
2696
  t = "";
2529
2697
  }
2530
- throw new Se(t || e, r.status);
2531
- }, It = async (r) => {
2698
+ throw new $e(t || e, r.status);
2699
+ }, Vt = async (r) => {
2532
2700
  const e = await fetch(
2533
2701
  `${r.baseUrl}/files`,
2534
- P(r.token, {
2702
+ I(r.token, {
2535
2703
  method: "GET"
2536
2704
  })
2537
2705
  );
2538
- return await I(e, `Failed to fetch files for ${r.name}`), e.json();
2539
- }, pr = async (r, e) => {
2540
- const t = Ce(e), s = await fetch(
2706
+ return await N(e, `Failed to fetch files for ${r.name}`), e.json();
2707
+ }, Ar = async (r, e) => {
2708
+ const t = Ae(e), s = await fetch(
2541
2709
  `${r.baseUrl}/files/${t}`,
2542
- P(r.token, {
2710
+ I(r.token, {
2543
2711
  method: "GET"
2544
2712
  })
2545
2713
  );
2546
2714
  if (s.ok)
2547
2715
  return s.text();
2548
- s.status !== 404 && await I(s, `Failed to fetch ${e}`);
2716
+ s.status !== 404 && await N(s, `Failed to fetch ${e}`);
2549
2717
  const o = await fetch(
2550
2718
  `${r.baseUrl}/${t}`,
2551
- P(r.token, {
2719
+ I(r.token, {
2552
2720
  method: "GET"
2553
2721
  })
2554
2722
  );
2555
- return await I(o, `Failed to fetch ${e}`), o.text();
2556
- }, br = async (r, e, t) => {
2723
+ return await N(o, `Failed to fetch ${e}`), o.text();
2724
+ }, Fr = async (r, e, t) => {
2557
2725
  const s = await fetch(
2558
2726
  `${r.baseUrl}/files`,
2559
- P(r.token, {
2727
+ I(r.token, {
2560
2728
  method: "POST",
2561
2729
  headers: {
2562
2730
  "Content-Type": "application/json"
@@ -2564,11 +2732,11 @@ const P = (r, e = {}) => {
2564
2732
  body: JSON.stringify({ path: e, content: t })
2565
2733
  })
2566
2734
  );
2567
- await I(s, `Failed to create ${e}`);
2568
- }, wr = async (r, e, t) => {
2735
+ await N(s, `Failed to create ${e}`);
2736
+ }, _r = async (r, e, t) => {
2569
2737
  const s = await fetch(
2570
- `${r.baseUrl}/files/${Ce(e)}`,
2571
- P(r.token, {
2738
+ `${r.baseUrl}/files/${Ae(e)}`,
2739
+ I(r.token, {
2572
2740
  method: "PUT",
2573
2741
  headers: {
2574
2742
  "Content-Type": "application/json"
@@ -2576,19 +2744,19 @@ const P = (r, e = {}) => {
2576
2744
  body: JSON.stringify({ content: t })
2577
2745
  })
2578
2746
  );
2579
- await I(s, `Failed to update ${e}`);
2580
- }, vr = async (r, e) => {
2747
+ await N(s, `Failed to update ${e}`);
2748
+ }, Or = async (r, e) => {
2581
2749
  const t = await fetch(
2582
- `${r.baseUrl}/files/${Ce(e)}`,
2583
- P(r.token, {
2750
+ `${r.baseUrl}/files/${Ae(e)}`,
2751
+ I(r.token, {
2584
2752
  method: "DELETE"
2585
2753
  })
2586
2754
  );
2587
- await I(t, `Failed to delete ${e}`);
2588
- }, jt = async (r, e, t) => {
2755
+ await N(t, `Failed to delete ${e}`);
2756
+ }, Yt = async (r, e, t) => {
2589
2757
  const s = await fetch(
2590
2758
  `${r.baseUrl}/${e}`,
2591
- P(r.token, {
2759
+ I(r.token, {
2592
2760
  method: "POST",
2593
2761
  headers: {
2594
2762
  "Content-Type": "application/json"
@@ -2596,31 +2764,31 @@ const P = (r, e = {}) => {
2596
2764
  body: JSON.stringify({ target: t })
2597
2765
  })
2598
2766
  );
2599
- return await I(s, `Failed to ${e} ${t}`), s.json();
2600
- }, Nt = async (r, e) => {
2767
+ return await N(s, `Failed to ${e} ${t}`), s.json();
2768
+ }, Xt = async (r, e) => {
2601
2769
  const t = await fetch(
2602
2770
  `${r.baseUrl}/jobs/${e}`,
2603
- P(r.token, {
2771
+ I(r.token, {
2604
2772
  method: "GET"
2605
2773
  })
2606
2774
  );
2607
- return await I(t, `Failed to fetch job ${e}`), t.json();
2608
- }, Jt = async (r, e) => {
2775
+ return await N(t, `Failed to fetch job ${e}`), t.json();
2776
+ }, Zt = async (r, e) => {
2609
2777
  const t = await fetch(
2610
2778
  `${r.baseUrl}/jobs/${e}/cancel`,
2611
- P(r.token, {
2779
+ I(r.token, {
2612
2780
  method: "POST"
2613
2781
  })
2614
2782
  );
2615
- return await I(t, `Failed to cancel job ${e}`), t.json();
2616
- }, U = /* @__PURE__ */ new Map(), Ne = "trilogy-jobs-api-state", Je = (r, e, t) => `${r}::${t}::${e}`, z = (r, e) => `${r}::${e}`, Bt = (r) => {
2783
+ return await N(t, `Failed to cancel job ${e}`), t.json();
2784
+ }, U = /* @__PURE__ */ new Map(), We = "trilogy-jobs-api-state", Ge = (r, e, t) => `${r}::${t}::${e}`, z = (r, e) => `${r}::${e}`, er = (r) => {
2617
2785
  const e = r.pollingState, t = e === "unable-to-fetch" ? "stopped" : r.pollingState ?? "ok";
2618
2786
  return {
2619
2787
  ...r,
2620
2788
  pollingState: t,
2621
2789
  pollingError: t === "stopped" && !r.pollingError && e === "unable-to-fetch" ? "Polling stopped locally." : r.pollingError ?? null
2622
2790
  };
2623
- }, se = (r) => [...r].sort((e, t) => t.submittedAt - e.submittedAt), Sr = V("jobsApi", {
2791
+ }, ie = (r) => [...r].sort((e, t) => t.submittedAt - e.submittedAt), Qr = Y("jobsApi", {
2624
2792
  state: () => ({
2625
2793
  filesByStore: {},
2626
2794
  jobsByStore: {},
@@ -2633,16 +2801,16 @@ const P = (r, e = {}) => {
2633
2801
  }),
2634
2802
  actions: {
2635
2803
  getGenericStore(r) {
2636
- const t = ie().stores.find((s) => s.id === r);
2804
+ const t = ue().stores.find((s) => s.id === r);
2637
2805
  return !t || t.type !== "generic" ? null : t;
2638
2806
  },
2639
2807
  getGenericStores() {
2640
- return ie().stores.filter(
2808
+ return ue().stores.filter(
2641
2809
  (e) => e.type === "generic"
2642
2810
  );
2643
2811
  },
2644
2812
  getStoreJobs(r) {
2645
- return se(this.jobsByStore[r] || []);
2813
+ return ie(this.jobsByStore[r] || []);
2646
2814
  },
2647
2815
  getJobsForTarget(r, e) {
2648
2816
  return this.getStoreJobs(r).filter((t) => t.target === e);
@@ -2653,7 +2821,7 @@ const P = (r, e = {}) => {
2653
2821
  ) ? "running" : this.storeStatus[r] || "idle";
2654
2822
  },
2655
2823
  isSubmitting(r, e, t) {
2656
- return !!this.submittingByTarget[Je(r, e, t)];
2824
+ return !!this.submittingByTarget[Ge(r, e, t)];
2657
2825
  },
2658
2826
  isPollingJob(r, e) {
2659
2827
  return !!this.pollingByJob[z(r, e)];
@@ -2671,25 +2839,25 @@ const P = (r, e = {}) => {
2671
2839
  }), delete this.filesByStore[r], delete this.jobsByStore[r], delete this.errors[r], delete this.storeStatus[r], delete this.loadingByStore[r], this.saveJobsToStorage();
2672
2840
  },
2673
2841
  async initialize() {
2674
- ie().loadStoresFromStorage(), this.loadJobsFromStorage(), this.resumePolling(), await this.refreshAllStores();
2842
+ ue().loadStoresFromStorage(), this.loadJobsFromStorage(), this.resumePolling(), await this.refreshAllStores();
2675
2843
  },
2676
2844
  saveJobsToStorage() {
2677
2845
  try {
2678
- localStorage.setItem(Ne, JSON.stringify(this.jobsByStore));
2846
+ localStorage.setItem(We, JSON.stringify(this.jobsByStore));
2679
2847
  } catch (r) {
2680
2848
  console.error("Error saving jobs to localStorage:", r);
2681
2849
  }
2682
2850
  },
2683
2851
  loadJobsFromStorage() {
2684
2852
  try {
2685
- const r = localStorage.getItem(Ne);
2853
+ const r = localStorage.getItem(We);
2686
2854
  if (!r)
2687
2855
  return;
2688
2856
  const e = JSON.parse(r);
2689
2857
  this.jobsByStore = Object.fromEntries(
2690
2858
  Object.entries(e).map(([t, s]) => [
2691
2859
  t,
2692
- (s || []).map((o) => Bt(o))
2860
+ (s || []).map((o) => er(o))
2693
2861
  ])
2694
2862
  );
2695
2863
  } catch (r) {
@@ -2728,7 +2896,7 @@ const P = (r, e = {}) => {
2728
2896
  if (e) {
2729
2897
  this.loadingByStore[r] = !0, this.storeStatus[r] = "idle";
2730
2898
  try {
2731
- this.filesByStore[r] = await It(e), delete this.errors[r], this.storeStatus[r] = "connected";
2899
+ this.filesByStore[r] = await Vt(e), delete this.errors[r], this.storeStatus[r] = "connected";
2732
2900
  } catch (t) {
2733
2901
  const s = t instanceof Error ? t.message : "Failed to fetch files";
2734
2902
  this.errors[r] = s, this.storeStatus[r] = "failed";
@@ -2740,17 +2908,17 @@ const P = (r, e = {}) => {
2740
2908
  upsertJob(r, e) {
2741
2909
  const t = this.jobsByStore[r] || [], s = t.findIndex((i) => i.job_id === e.job_id);
2742
2910
  if (s === -1) {
2743
- this.jobsByStore[r] = se([e, ...t]), this.saveJobsToStorage();
2911
+ this.jobsByStore[r] = ie([e, ...t]), this.saveJobsToStorage();
2744
2912
  return;
2745
2913
  }
2746
2914
  const o = [...t];
2747
2915
  o[s] = {
2748
2916
  ...o[s],
2749
2917
  ...e
2750
- }, this.jobsByStore[r] = se(o), this.saveJobsToStorage();
2918
+ }, this.jobsByStore[r] = ie(o), this.saveJobsToStorage();
2751
2919
  },
2752
2920
  replaceJobs(r, e) {
2753
- this.jobsByStore[r] = se(e), this.saveJobsToStorage();
2921
+ this.jobsByStore[r] = ie(e), this.saveJobsToStorage();
2754
2922
  },
2755
2923
  removeJob(r, e) {
2756
2924
  this.stopPolling(r, e), delete this.pollingByJob[z(r, e)], delete this.stoppingByJob[z(r, e)], this.jobsByStore[r] = (this.jobsByStore[r] || []).filter(
@@ -2800,10 +2968,10 @@ const P = (r, e = {}) => {
2800
2968
  const s = this.getGenericStore(r);
2801
2969
  if (!s)
2802
2970
  throw new Error("Store not found or does not support jobs");
2803
- const o = Je(r, e, t);
2971
+ const o = Ge(r, e, t);
2804
2972
  this.submittingByTarget[o] = !0;
2805
2973
  try {
2806
- const i = await jt(s, t, e), n = this.buildLocalJob(r, e, t, i);
2974
+ const i = await Yt(s, t, e), n = this.buildLocalJob(r, e, t, i);
2807
2975
  return this.upsertJob(r, n), delete this.errors[r], this.storeStatus[r] = "connected", n.status === "running" && this.startPolling(r, n.job_id), n;
2808
2976
  } catch (i) {
2809
2977
  const n = i instanceof Error ? i.message : `Failed to ${t} ${e}`;
@@ -2823,7 +2991,7 @@ const P = (r, e = {}) => {
2823
2991
  return;
2824
2992
  }
2825
2993
  try {
2826
- const i = await Nt(s, e), n = this.buildLocalJob(
2994
+ const i = await Xt(s, e), n = this.buildLocalJob(
2827
2995
  r,
2828
2996
  o.target,
2829
2997
  o.operation,
@@ -2833,12 +3001,12 @@ const P = (r, e = {}) => {
2833
3001
  this.upsertJob(r, n), n.status !== "running" && (this.stopPolling(r, e), this.fetchFilesForStore(r));
2834
3002
  } catch (i) {
2835
3003
  const n = i instanceof Error ? i.message : `Failed to poll job ${e}`;
2836
- i instanceof Se && i.status === 401 ? this.pauseJobPolling(
3004
+ i instanceof $e && i.status === 401 ? this.pauseJobPolling(
2837
3005
  r,
2838
3006
  e,
2839
3007
  "auth-paused",
2840
3008
  "Polling paused: authentication required. Update the store token to resume tracking."
2841
- ) : i instanceof Se && i.status === 404 ? this.pauseJobPolling(
3009
+ ) : i instanceof $e && i.status === 404 ? this.pauseJobPolling(
2842
3010
  r,
2843
3011
  e,
2844
3012
  "not-found",
@@ -2859,7 +3027,7 @@ const P = (r, e = {}) => {
2859
3027
  }
2860
3028
  this.stoppingByJob[t] = !0, this.stopPolling(r, e), delete this.pollingByJob[t];
2861
3029
  try {
2862
- const i = await Jt(s, e), n = this.buildLocalJob(
3030
+ const i = await Zt(s, e), n = this.buildLocalJob(
2863
3031
  r,
2864
3032
  o.target,
2865
3033
  o.operation,
@@ -2881,7 +3049,7 @@ const P = (r, e = {}) => {
2881
3049
  }
2882
3050
  }
2883
3051
  });
2884
- class Rt {
3052
+ class tr {
2885
3053
  constructor(e, t, s, o) {
2886
3054
  w(this, "queryExecutionService");
2887
3055
  w(this, "connectionStore");
@@ -2944,7 +3112,7 @@ class Rt {
2944
3112
  }
2945
3113
  }
2946
3114
  async executeTrilogyQuery(e, t, s, o) {
2947
- var g, v;
3115
+ var f, v;
2948
3116
  if (!e || typeof e != "string" || e.trim() === "")
2949
3117
  return {
2950
3118
  success: !1,
@@ -2969,7 +3137,7 @@ class Rt {
2969
3137
  error: `Connection "${t}" is not currently connected. Please ensure the connection is active.`,
2970
3138
  query: e
2971
3139
  };
2972
- const n = ((v = (g = this.chatStore) == null ? void 0 : g.activeChat) == null ? void 0 : v.imports) || [], a = n.map((m) => ({
3140
+ const n = ((v = (f = this.chatStore) == null ? void 0 : f.activeChat) == null ? void 0 : v.imports) || [], a = n.map((m) => ({
2973
3141
  name: m.name,
2974
3142
  alias: m.alias || ""
2975
3143
  }));
@@ -2989,9 +3157,9 @@ class Rt {
2989
3157
  );
2990
3158
  const l = /* @__PURE__ */ new Map();
2991
3159
  u.forEach((m) => l.set(m.alias, m.contents)), c.forEach((m) => l.set(m.alias, m.contents)), n.forEach((m) => {
2992
- var x, $;
2993
- const y = m.alias || m.name, S = (($ = (x = this.editorStore) == null ? void 0 : x.editors[m.id]) == null ? void 0 : $.contents) || "";
2994
- S && l.set(y, S);
3160
+ var T, x;
3161
+ const y = m.alias || m.name, E = ((x = (T = this.editorStore) == null ? void 0 : T.editors[m.id]) == null ? void 0 : x.contents) || "";
3162
+ E && l.set(y, E);
2995
3163
  });
2996
3164
  const h = Array.from(l.entries()).map(
2997
3165
  ([m, y]) => ({
@@ -3034,11 +3202,11 @@ class Rt {
3034
3202
  query: e,
3035
3203
  generatedSql: y.generatedSql
3036
3204
  };
3037
- const S = xe();
3205
+ const E = Oe();
3038
3206
  return {
3039
3207
  success: !0,
3040
3208
  artifact: {
3041
- id: S,
3209
+ id: E,
3042
3210
  type: s,
3043
3211
  data: y.results,
3044
3212
  config: {
@@ -3051,7 +3219,7 @@ class Rt {
3051
3219
  ...o && { chartConfig: o }
3052
3220
  }
3053
3221
  },
3054
- artifactId: S,
3222
+ artifactId: E,
3055
3223
  executionTime: y.executionTime,
3056
3224
  query: e,
3057
3225
  generatedSql: y.generatedSql
@@ -3086,13 +3254,13 @@ class Rt {
3086
3254
  })) : [], n = this.connectionStore.getConnectionSources(t), a = /* @__PURE__ */ new Map();
3087
3255
  n.forEach((d) => a.set(d.alias, d.contents)), i.forEach((d) => a.set(d.alias, d.contents)), s.forEach((d) => {
3088
3256
  var m, y;
3089
- const g = d.alias || d.name, v = ((y = (m = this.editorStore) == null ? void 0 : m.editors[d.id]) == null ? void 0 : y.contents) || "";
3090
- v && a.set(g, v);
3257
+ const f = d.alias || d.name, v = ((y = (m = this.editorStore) == null ? void 0 : m.editors[d.id]) == null ? void 0 : y.contents) || "";
3258
+ v && a.set(f, v);
3091
3259
  });
3092
3260
  const c = Array.from(a.entries()).map(
3093
- ([d, g]) => ({
3261
+ ([d, f]) => ({
3094
3262
  alias: d,
3095
- contents: g
3263
+ contents: f
3096
3264
  })
3097
3265
  ), u = {
3098
3266
  text: e.trim(),
@@ -3187,14 +3355,14 @@ ${i}`,
3187
3355
  try {
3188
3356
  if (!(((o = (s = this.editorStore) == null ? void 0 : s.editors[e.id]) == null ? void 0 : o.contents) || ""))
3189
3357
  return "No fields found in this data source.";
3190
- const a = this.editorStore ? Object.values(this.editorStore.editors).filter((g) => g.connection === t && !g.deleted).map((g) => ({
3191
- alias: g.name,
3192
- contents: g.contents
3358
+ const a = this.editorStore ? Object.values(this.editorStore.editors).filter((f) => f.connection === t && !f.deleted).map((f) => ({
3359
+ alias: f.name,
3360
+ contents: f.contents
3193
3361
  })) : [], c = this.connectionStore.getConnectionSources(t), u = /* @__PURE__ */ new Map();
3194
- c.forEach((g) => u.set(g.alias, g.contents)), a.forEach((g) => u.set(g.alias, g.contents));
3362
+ c.forEach((f) => u.set(f.alias, f.contents)), a.forEach((f) => u.set(f.alias, f.contents));
3195
3363
  const l = Array.from(u.entries()).map(
3196
- ([g, v]) => ({
3197
- alias: g,
3364
+ ([f, v]) => ({
3365
+ alias: f,
3198
3366
  contents: v
3199
3367
  })
3200
3368
  ), h = {
@@ -3208,17 +3376,17 @@ ${i}`,
3208
3376
  !1
3209
3377
  );
3210
3378
  if ((i = d == null ? void 0 : d.data) != null && i.completion_items) {
3211
- const g = d.data.completion_items.filter(
3379
+ const f = d.data.completion_items.filter(
3212
3380
  (m) => m.trilogyType === "concept"
3213
3381
  );
3214
- if (g.length === 0)
3382
+ if (f.length === 0)
3215
3383
  return "No fields found in this data source.";
3216
- const v = g.map((m) => {
3384
+ const v = f.map((m) => {
3217
3385
  let y = `- ${m.label} (${m.datatype || m.type})`;
3218
3386
  return m.description && (y += `: ${m.description}`), m.calculation && (y += ` [calculated: ${m.calculation}]`), y;
3219
3387
  }).join(`
3220
3388
  `);
3221
- return `AVAILABLE FIELDS (${g.length} total):
3389
+ return `AVAILABLE FIELDS (${f.length} total):
3222
3390
  ${v}`;
3223
3391
  }
3224
3392
  return "Unable to fetch field information for this data source.";
@@ -3306,7 +3474,7 @@ Use select_active_import to select a data source.`
3306
3474
  success: !1,
3307
3475
  error: "Markdown content is required and must be a non-empty string"
3308
3476
  };
3309
- const i = xe();
3477
+ const i = Oe();
3310
3478
  let n = null;
3311
3479
  if (s && s.trim()) {
3312
3480
  if (!o) {
@@ -3365,9 +3533,9 @@ Use select_active_import to select a data source.`
3365
3533
  message: "No artifacts in the current chat session."
3366
3534
  };
3367
3535
  const t = e.artifacts.filter((c) => !c.hidden), s = e.artifacts.filter((c) => c.hidden), o = (c, u) => {
3368
- var d, g, v, m;
3536
+ var d, f, v, m;
3369
3537
  const l = [`- ID: ${c.id}, Type: ${c.type}`];
3370
- (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)}..."`);
3538
+ (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)}..."`);
3371
3539
  const h = u === e.activeArtifactIndex ? " (currently selected)" : "";
3372
3540
  return l.join(", ") + h;
3373
3541
  }, i = t.length > 0 ? `Visible (${t.length}):
@@ -3405,10 +3573,10 @@ ${i}${n}`
3405
3573
  if (s.config && (o.config = { ...s.config }), s.type === "markdown")
3406
3574
  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);
3407
3575
  else if (s.data) {
3408
- const u = typeof s.data.toJSON == "function" ? s.data.toJSON() : s.data, { head: l, tail: h, totalRows: d, cutCount: g } = tt(u);
3409
- if (g > 0) {
3410
- const v = rt / 2;
3411
- 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;
3576
+ const u = typeof s.data.toJSON == "function" ? s.data.toJSON() : s.data, { head: l, tail: h, totalRows: d, cutCount: f } = ct(u);
3577
+ if (f > 0) {
3578
+ const v = lt / 2;
3579
+ 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;
3412
3580
  } else
3413
3581
  o.data = u;
3414
3582
  }
@@ -3420,7 +3588,7 @@ ${JSON.stringify(o, null, 2)}`
3420
3588
  }
3421
3589
  // Fetch a specific row range from a results or chart artifact
3422
3590
  getArtifactRows(e, t, s) {
3423
- var d, g;
3591
+ var d, f;
3424
3592
  const o = (d = this.chatStore) == null ? void 0 : d.activeChat;
3425
3593
  if (!o)
3426
3594
  return { success: !1, error: "No active chat session." };
@@ -3435,7 +3603,7 @@ ${JSON.stringify(o, null, 2)}`
3435
3603
  success: !1,
3436
3604
  error: `Artifact "${e}" does not contain tabular data (type: ${i.type}). Only results and chart artifacts support row fetching.`
3437
3605
  };
3438
- const n = typeof ((g = i.data) == null ? void 0 : g.toJSON) == "function" ? i.data.toJSON() : i.data, a = n == null ? void 0 : n.data;
3606
+ const n = typeof ((f = i.data) == null ? void 0 : f.toJSON) == "function" ? i.data.toJSON() : i.data, a = n == null ? void 0 : n.data;
3439
3607
  if (!Array.isArray(a))
3440
3608
  return { success: !1, error: `Artifact "${e}" has no row data.` };
3441
3609
  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);
@@ -3513,7 +3681,7 @@ ${JSON.stringify(o, null, 2)}`
3513
3681
  } : { 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.` };
3514
3682
  }
3515
3683
  }
3516
- const Kt = V("chats", {
3684
+ const rr = Y("chats", {
3517
3685
  state: () => ({
3518
3686
  chats: {},
3519
3687
  activeChatId: "",
@@ -3548,7 +3716,7 @@ const Kt = V("chats", {
3548
3716
  },
3549
3717
  actions: {
3550
3718
  newChat(r, e = "", t) {
3551
- const s = new Te({
3719
+ const s = new Qe({
3552
3720
  llmConnectionName: r,
3553
3721
  dataConnectionName: e,
3554
3722
  name: t || `Chat ${(/* @__PURE__ */ new Date()).toLocaleTimeString()}`
@@ -3597,7 +3765,7 @@ const Kt = V("chats", {
3597
3765
  },
3598
3766
  loadChats(r) {
3599
3767
  Object.entries(r).forEach(([e, t]) => {
3600
- this.chats[e] = Te.fromSerialized(t);
3768
+ this.chats[e] = Qe.fromSerialized(t);
3601
3769
  });
3602
3770
  },
3603
3771
  serializeChats() {
@@ -3684,67 +3852,67 @@ const Kt = V("chats", {
3684
3852
  content: e
3685
3853
  });
3686
3854
  try {
3687
- const g = {
3688
- generateCompletion: async (T, E, O) => {
3689
- const j = {
3690
- ...E,
3855
+ const f = {
3856
+ generateCompletion: async (_, F, C) => {
3857
+ const M = {
3858
+ ...F,
3691
3859
  signal: l,
3692
- onRateLimitBackoff: (Y, Ee) => {
3693
- this.setRateLimitBackoff(r, Y, Ee);
3860
+ onRateLimitBackoff: (P, R) => {
3861
+ this.setRateLimitBackoff(r, P, R);
3694
3862
  }
3695
- }, K = await i.generateCompletion(
3696
- T,
3697
- j,
3698
- O
3863
+ }, X = await i.generateCompletion(
3864
+ _,
3865
+ M,
3866
+ C
3699
3867
  );
3700
- return this.clearRateLimitBackoff(r), K;
3868
+ return this.clearRateLimitBackoff(r), X;
3701
3869
  }
3702
3870
  }, v = {
3703
- addMessage: (T) => {
3704
- this.addMessageToChat(r, T);
3871
+ addMessage: (_) => {
3872
+ this.addMessageToChat(r, _);
3705
3873
  },
3706
- addArtifact: (T) => {
3707
- this.addArtifactToChat(r, T), (T.type === "chart" || T.type === "markdown") && this.addMessageToChat(r, {
3874
+ addArtifact: (_) => {
3875
+ this.addArtifactToChat(r, _), (_.type === "chart" || _.type === "markdown") && this.addMessageToChat(r, {
3708
3876
  role: "assistant",
3709
3877
  content: "",
3710
- artifact: T,
3878
+ artifact: _,
3711
3879
  hidden: !1
3712
3880
  });
3713
3881
  },
3714
3882
  getMessages: () => o.messages
3715
- }, m = new Rt(
3883
+ }, m = new tr(
3716
3884
  a,
3717
3885
  n,
3718
3886
  this,
3719
3887
  c
3720
3888
  );
3721
- await st(
3889
+ await ut(
3722
3890
  e,
3723
3891
  u,
3724
- g,
3892
+ f,
3725
3893
  v,
3726
3894
  {
3727
3895
  getToolExecutor: () => m
3728
3896
  },
3729
3897
  {
3730
- setActiveToolName: (T) => this.setActiveToolName(r, T),
3898
+ setActiveToolName: (_) => this.setActiveToolName(r, _),
3731
3899
  checkAborted: () => (l == null ? void 0 : l.aborted) ?? !1
3732
3900
  },
3733
3901
  {
3734
- tools: ft,
3902
+ tools: vt,
3735
3903
  maxIterations: 50,
3736
3904
  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.",
3737
3905
  buildSystemPrompt: () => this.buildSystemPrompt(r, t),
3738
- onToolResult: async (T, E) => {
3739
- E.triggersSymbolRefresh && s.onSymbolsRefresh && await s.onSymbolsRefresh();
3906
+ onToolResult: async (_, F) => {
3907
+ F.triggersSymbolRefresh && s.onSymbolsRefresh && await s.onSymbolsRefresh();
3740
3908
  }
3741
3909
  }
3742
3910
  );
3743
3911
  return;
3744
- } catch (g) {
3745
- if (g instanceof DOMException && g.name === "AbortError")
3912
+ } catch (f) {
3913
+ if (f instanceof DOMException && f.name === "AbortError")
3746
3914
  return;
3747
- const v = g instanceof Error ? g.message : "An unknown error occurred";
3915
+ const v = f instanceof Error ? f.message : "An unknown error occurred";
3748
3916
  this.addMessageToChat(r, {
3749
3917
  role: "assistant",
3750
3918
  content: `Error: ${v}`
@@ -3764,7 +3932,7 @@ const Kt = V("chats", {
3764
3932
  name: l.name.replace(/\//g, "."),
3765
3933
  alias: ""
3766
3934
  })) : [];
3767
- return dt({
3935
+ return wt({
3768
3936
  dataConnectionName: i,
3769
3937
  availableConnections: n,
3770
3938
  availableConcepts: [],
@@ -3776,53 +3944,53 @@ const Kt = V("chats", {
3776
3944
  }
3777
3945
  }
3778
3946
  });
3779
- function F(r, e = null) {
3947
+ function A(r, e = null) {
3780
3948
  const t = window.location.hash;
3781
3949
  if (!t || !t.startsWith("#"))
3782
3950
  return e;
3783
3951
  const o = new URLSearchParams(t.slice(1)).get(r);
3784
3952
  return o !== null ? o : e;
3785
3953
  }
3786
- function oe(r, e) {
3954
+ function ae(r, e) {
3787
3955
  const t = window.location.hash, s = new URLSearchParams(t.slice(1));
3788
3956
  s.set(r, e), window.location.hash = `#${s.toString()}`;
3789
3957
  }
3790
- function L(r) {
3958
+ function j(r) {
3791
3959
  const e = window.location.hash, t = new URLSearchParams(e.slice(1));
3792
3960
  t.delete(r), window.location.hash = `#${t.toString()}`;
3793
3961
  }
3794
- function Ut(r) {
3962
+ function sr(r) {
3795
3963
  const e = window.location.hash, t = new URLSearchParams(e.slice(1));
3796
3964
  r.forEach((s) => {
3797
3965
  t.delete(s);
3798
3966
  }), window.location.hash = `#${t.toString()}`;
3799
3967
  }
3800
- const zt = () => {
3801
- const r = Qt(), e = Ye(), t = ot(), s = ie(), o = Kt();
3968
+ const or = () => {
3969
+ const r = Jt(), e = ot(), t = ht(), s = ue(), o = rr();
3802
3970
  let i = null;
3803
3971
  const n = {
3804
- activeScreen: Q(F("screen", "")),
3805
- activeSidebarScreen: Q(
3806
- F("sidebarScreen", "editors")
3972
+ activeScreen: O(A("screen", "")),
3973
+ activeSidebarScreen: O(
3974
+ A("sidebarScreen", "editors")
3807
3975
  ),
3808
- activeEditor: Q(F("editors", "")),
3809
- activeDashboard: Q(F("dashboard", "")),
3810
- activeConnectionKey: Q(F("connections", "")),
3811
- activeModelKey: Q(F("model", "")),
3812
- activeCommunityModelKey: Q(F("community-models", "")),
3813
- activeJobsKey: Q(F("jobs", "")),
3814
- activeLLMConnectionKey: Q(F("llms", "")),
3815
- activeDocumentationKey: Q(F("tutorial", "")),
3976
+ activeEditor: O(A("editors", "")),
3977
+ activeDashboard: O(A("dashboard", "")),
3978
+ activeConnectionKey: O(A("connections", "")),
3979
+ activeModelKey: O(A("model", "")),
3980
+ activeCommunityModelKey: O(A("community-models", "")),
3981
+ activeJobsKey: O(A("jobs", "")),
3982
+ activeLLMConnectionKey: O(A("llms", "")),
3983
+ activeDocumentationKey: O(A("tutorial", "")),
3816
3984
  // model import is legacy
3817
- modelImport: Q(F("import", F("model", ""))),
3818
- connectionImport: Q(F("connection", "")),
3819
- mobileMenuOpen: Q(!1),
3820
- initialSearch: Q(F("initialSearch", "")),
3821
- tabs: Q([]),
3822
- activeTab: Q(null),
3823
- showTipModal: Q(!0),
3824
- displayedTips: Q([]),
3825
- fullScreen: Q(!1)
3985
+ modelImport: O(A("import", A("model", ""))),
3986
+ connectionImport: O(A("connection", "")),
3987
+ mobileMenuOpen: O(!1),
3988
+ initialSearch: O(A("initialSearch", "")),
3989
+ tabs: O([]),
3990
+ activeTab: O(null),
3991
+ showTipModal: O(!0),
3992
+ displayedTips: O([]),
3993
+ fullScreen: O(!1)
3826
3994
  }, a = /* @__PURE__ */ new Set([
3827
3995
  "editors",
3828
3996
  "tutorial",
@@ -3834,138 +4002,138 @@ const zt = () => {
3834
4002
  "profile",
3835
4003
  "settings",
3836
4004
  "connections"
3837
- ]), c = (f, C = !1) => {
3838
- if (n.activeSidebarScreen.value !== f && (n.activeSidebarScreen.value = f, !C)) {
3839
- if (f) {
3840
- oe("sidebarScreen", f);
4005
+ ]), c = (g, S = !1) => {
4006
+ if (n.activeSidebarScreen.value !== g && (n.activeSidebarScreen.value = g, !S)) {
4007
+ if (g) {
4008
+ ae("sidebarScreen", g);
3841
4009
  return;
3842
4010
  }
3843
- L("sidebarScreen");
4011
+ j("sidebarScreen");
3844
4012
  }
3845
- }, u = (f, C = !1) => {
3846
- c(a.has(f) ? f : "", C);
3847
- }, l = (f, C, b) => {
3848
- if (C)
3849
- return C;
3850
- if (f === "dashboard") {
4013
+ }, u = (g, S = !1) => {
4014
+ c(a.has(g) ? g : "", S);
4015
+ }, l = (g, S, b) => {
4016
+ if (S)
4017
+ return S;
4018
+ if (g === "dashboard") {
3851
4019
  let p = r.dashboards[b];
3852
4020
  if (p)
3853
4021
  return p.name || "Untitled Dashboard";
3854
- } else if (f === "editors") {
4022
+ } else if (g === "editors") {
3855
4023
  let p = e.editors[b];
3856
4024
  if (p)
3857
4025
  return p.name || "Untitled Editor";
3858
- } else if (f === "llms") {
3859
- const p = b.split(te), D = p[0], _ = p.length > 1 ? p[1] : null;
3860
- if (_) {
3861
- const A = o.getChatById(_);
3862
- if (A)
3863
- return A.name;
4026
+ } else if (g === "llms") {
4027
+ const p = b.split(se), D = p[0], Q = p.length > 1 ? p[1] : null;
4028
+ if (Q) {
4029
+ const $ = o.getChatById(Q);
4030
+ if ($)
4031
+ return $.name;
3864
4032
  }
3865
4033
  return D || "LLM Chat";
3866
- } else if (f === "community-models") {
3867
- const p = b.split(te), D = p[0], _ = s.stores.find((A) => A.id === D);
3868
- if (_)
3869
- return p.length === 2 ? `${_.name} - ${p[1]}` : p.length === 3 ? p[2] : _.name;
3870
- } else if (f === "jobs") {
3871
- const p = b.split(te), D = p[0], _ = s.stores.find((q) => q.id === D), A = (_ == null ? void 0 : _.name) || D;
4034
+ } else if (g === "community-models") {
4035
+ const p = b.split(se), D = p[0], Q = s.stores.find(($) => $.id === D);
4036
+ if (Q)
4037
+ return p.length === 2 ? `${Q.name} - ${p[1]}` : p.length === 3 ? p[2] : Q.name;
4038
+ } else if (g === "jobs") {
4039
+ const p = b.split(se), D = p[0], Q = s.stores.find((k) => k.id === D), $ = (Q == null ? void 0 : Q.name) || D;
3872
4040
  if (p.length === 1)
3873
- return A;
3874
- const k = decodeURIComponent(p[2] || "");
4041
+ return $;
4042
+ const q = decodeURIComponent(p[2] || "");
3875
4043
  if (p[1] === "directory")
3876
- return k === "__root__" ? `${A} - Root` : k;
4044
+ return q === "__root__" ? `${$} - Root` : q;
3877
4045
  if (p[1] === "file") {
3878
- const q = k.split("/");
3879
- return q[q.length - 1] || A;
4046
+ const k = q.split("/");
4047
+ return k[k.length - 1] || $;
3880
4048
  }
3881
4049
  }
3882
- return it(b, null);
3883
- }, h = (f, C, b) => {
3884
- const p = n.tabs.value.find((D) => D.screen === f && D.address === b);
4050
+ return ft(b, null);
4051
+ }, h = (g, S, b) => {
4052
+ const p = n.tabs.value.find((D) => D.screen === g && D.address === b);
3885
4053
  if (p) {
3886
- let D = l(f, C, b);
4054
+ let D = l(g, S, b);
3887
4055
  p.title = D;
3888
4056
  }
3889
- }, d = (f, C, b, p = !1) => {
4057
+ }, d = (g, S, b, p = !1) => {
3890
4058
  const D = n.tabs.value.find(
3891
- (N) => N.screen === f && N.address === b
4059
+ (J) => J.screen === g && J.address === b
3892
4060
  );
3893
4061
  if (D) {
3894
- S(D.id, p);
4062
+ E(D.id, p);
3895
4063
  return;
3896
4064
  }
3897
- let A = n.tabs.value.reduce((N, X) => {
3898
- const Z = parseInt(X.id.replace("tab-", ""));
3899
- return isNaN(Z) ? N : Math.max(N, Z);
4065
+ let $ = n.tabs.value.reduce((J, ee) => {
4066
+ const te = parseInt(ee.id.replace("tab-", ""));
4067
+ return isNaN(te) ? J : Math.max(J, te);
3900
4068
  }, 0);
3901
- p || x(f);
3902
- let k = l(f, C, b);
3903
- const q = {
3904
- id: `tab-${++A}`,
3905
- title: k,
3906
- screen: f,
4069
+ p || T(g);
4070
+ let q = l(g, S, b);
4071
+ const k = {
4072
+ id: `tab-${++$}`,
4073
+ title: q,
4074
+ screen: g,
3907
4075
  address: b
3908
4076
  };
3909
- n.tabs.value.push(q), S(q.id, p);
3910
- }, g = (f, C = null) => {
3911
- if (!f && !C)
4077
+ n.tabs.value.push(k), E(k.id, p);
4078
+ }, f = (g, S = null) => {
4079
+ if (!g && !S)
3912
4080
  return;
3913
- if (!f && C) {
3914
- const p = n.tabs.value.find((D) => D.address === C);
4081
+ if (!g && S) {
4082
+ const p = n.tabs.value.find((D) => D.address === S);
3915
4083
  if (p)
3916
- f = p.id;
4084
+ g = p.id;
3917
4085
  else
3918
4086
  return;
3919
4087
  }
3920
- const b = n.tabs.value.findIndex((p) => p.id === f);
4088
+ const b = n.tabs.value.findIndex((p) => p.id === g);
3921
4089
  if (b !== -1) {
3922
- const p = n.activeTab.value === f;
4090
+ const p = n.activeTab.value === g;
3923
4091
  if (n.tabs.value.splice(b, 1), p)
3924
4092
  if (n.tabs.value.length > 0) {
3925
4093
  const D = b > 0 ? b - 1 : 0;
3926
- S(n.tabs.value[D].id);
4094
+ E(n.tabs.value[D].id);
3927
4095
  } else
3928
4096
  d("welcome", "Welcome", "welcome");
3929
4097
  }
3930
4098
  m();
3931
- }, v = (f) => {
3932
- const C = n.activeTab.value === f;
3933
- 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();
4099
+ }, v = (g) => {
4100
+ const S = n.activeTab.value === g;
4101
+ 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();
3934
4102
  }, m = () => {
3935
- let f = n.tabs.value.map((b) => b.screen), C = [];
3936
- 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"), Ut(C);
3937
- }, y = (f) => {
3938
- const C = n.tabs.value.findIndex((b) => b.id === f);
3939
- if (C !== -1) {
3940
- const p = n.tabs.value.findIndex((D) => D.id === n.activeTab.value) > C;
3941
- 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"));
4103
+ let g = n.tabs.value.map((b) => b.screen), S = [];
4104
+ 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);
4105
+ }, y = (g) => {
4106
+ const S = n.tabs.value.findIndex((b) => b.id === g);
4107
+ if (S !== -1) {
4108
+ const p = n.tabs.value.findIndex((D) => D.id === n.activeTab.value) > S;
4109
+ 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"));
3942
4110
  }
3943
4111
  m();
3944
- }, S = (f, C = !1) => {
3945
- const b = n.tabs.value.find((p) => p.id === f);
4112
+ }, E = (g, S = !1) => {
4113
+ const b = n.tabs.value.find((p) => p.id === g);
3946
4114
  if (b) {
3947
- n.activeTab.value = f, x(b.screen), u(b.screen, C);
3948
- let p = t.getUnreadTips(mt);
4115
+ n.activeTab.value = g, T(b.screen), u(b.screen, S);
4116
+ let p = t.getUnreadTips(St);
3949
4117
  if (b.screen === "editors")
3950
- n.activeEditor.value = b.address, e.activeEditorId = b.address, p = p.concat(t.getUnreadTips(gt));
4118
+ n.activeEditor.value = b.address, e.activeEditorId = b.address, p = p.concat(t.getUnreadTips(Ct));
3951
4119
  else if (b.screen === "dashboard")
3952
- n.activeDashboard.value = b.address, r.activeDashboardId = b.address, n.fullScreen.value ? p = [] : p = p.concat(t.getUnreadTips(yt));
4120
+ n.activeDashboard.value = b.address, r.activeDashboardId = b.address, n.fullScreen.value ? p = [] : p = p.concat(t.getUnreadTips(Et));
3953
4121
  else if (b.screen === "connections")
3954
4122
  n.activeConnectionKey.value = b.address;
3955
4123
  else if (b.screen === "llms") {
3956
4124
  n.activeLLMConnectionKey.value = b.address;
3957
- const D = b.address.split(te);
4125
+ const D = b.address.split(se);
3958
4126
  if (D.length > 1) {
3959
- const _ = D[1];
3960
- o.setActiveChat(_);
4127
+ const Q = D[1];
4128
+ o.setActiveChat(Q);
3961
4129
  }
3962
- } 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);
3963
- n.mobileMenuOpen.value = !1, n.displayedTips.value = p, n.showTipModal.value = p.length > 0, b.address && !C && oe(b.screen, b.address);
4130
+ } 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);
4131
+ n.mobileMenuOpen.value = !1, n.displayedTips.value = p, n.showTipModal.value = p.length > 0, b.address && !S && ae(b.screen, b.address);
3964
4132
  }
3965
- }, x = (f) => {
3966
- n.activeScreen.value !== f && (n.activeScreen.value = f, oe("screen", f));
3967
- }, $ = (f) => {
3968
- c(f), f == "settings" ? d("settings", "Settings", "settings") : f == "profile" && d("profile", "Profile", "profile");
4133
+ }, T = (g) => {
4134
+ n.activeScreen.value !== g && (n.activeScreen.value = g, ae("screen", g));
4135
+ }, x = (g) => {
4136
+ c(g), g == "settings" ? d("settings", "Settings", "settings") : g == "profile" && d("profile", "Profile", "profile");
3969
4137
  };
3970
4138
  return {
3971
4139
  get activeScreen() {
@@ -4025,153 +4193,153 @@ const zt = () => {
4025
4193
  get fullScreen() {
4026
4194
  return n.fullScreen;
4027
4195
  },
4028
- setActiveScreen: x,
4029
- setActiveSidebarScreen: $,
4030
- setActiveEditor: (f) => {
4031
- if (f === null) {
4032
- L("editors"), n.activeEditor.value = "";
4196
+ setActiveScreen: T,
4197
+ setActiveSidebarScreen: x,
4198
+ setActiveEditor: (g) => {
4199
+ if (g === null) {
4200
+ j("editors"), n.activeEditor.value = "";
4033
4201
  return;
4034
4202
  }
4035
- d("editors", null, f);
4203
+ d("editors", null, g);
4036
4204
  },
4037
- setActiveDashboard: (f) => {
4038
- if (f === null) {
4039
- L("dashboard"), n.activeDashboard.value = "";
4205
+ setActiveDashboard: (g) => {
4206
+ if (g === null) {
4207
+ j("dashboard"), n.activeDashboard.value = "";
4040
4208
  return;
4041
4209
  }
4042
- d("dashboard", null, f);
4210
+ d("dashboard", null, g);
4043
4211
  },
4044
- setActiveConnectionKey: (f) => {
4045
- if (f === null) {
4046
- L("connections"), n.activeConnectionKey.value = "";
4212
+ setActiveConnectionKey: (g) => {
4213
+ if (g === null) {
4214
+ j("connections"), n.activeConnectionKey.value = "";
4047
4215
  return;
4048
4216
  }
4049
- d("connections", null, f);
4217
+ d("connections", null, g);
4050
4218
  },
4051
- setActiveDocumentationKey: (f) => {
4052
- if (f === null) {
4053
- L("docs"), n.activeDocumentationKey.value = "";
4219
+ setActiveDocumentationKey: (g) => {
4220
+ if (g === null) {
4221
+ j("docs"), n.activeDocumentationKey.value = "";
4054
4222
  return;
4055
4223
  }
4056
- let C = f.split("+");
4057
- d("tutorial", C[C.length - 1], f);
4224
+ let S = g.split("+");
4225
+ d("tutorial", S[S.length - 1], g);
4058
4226
  },
4059
- setActiveLLMConnectionKey: (f) => {
4060
- if (f === null) {
4061
- L("llms"), n.activeLLMConnectionKey.value = "";
4227
+ setActiveLLMConnectionKey: (g) => {
4228
+ if (g === null) {
4229
+ j("llms"), n.activeLLMConnectionKey.value = "";
4062
4230
  return;
4063
4231
  }
4064
- d("llms", null, f);
4232
+ d("llms", null, g);
4065
4233
  },
4066
- setActiveCommunityModelKey: (f) => {
4067
- if (f === null) {
4068
- L("community-models"), n.activeCommunityModelKey.value = "";
4234
+ setActiveCommunityModelKey: (g) => {
4235
+ if (g === null) {
4236
+ j("community-models"), n.activeCommunityModelKey.value = "";
4069
4237
  return;
4070
4238
  }
4071
- n.activeCommunityModelKey.value = f, d("community-models", null, f);
4239
+ n.activeCommunityModelKey.value = g, d("community-models", null, g);
4072
4240
  },
4073
- setActiveJobsKey: (f) => {
4074
- if (f === null) {
4075
- L("jobs"), n.activeJobsKey.value = "";
4241
+ setActiveJobsKey: (g) => {
4242
+ if (g === null) {
4243
+ j("jobs"), n.activeJobsKey.value = "";
4076
4244
  return;
4077
4245
  }
4078
- n.activeJobsKey.value = f, d("jobs", null, f);
4246
+ n.activeJobsKey.value = g, d("jobs", null, g);
4079
4247
  },
4080
4248
  toggleMobileMenu: () => {
4081
4249
  n.mobileMenuOpen.value = !n.mobileMenuOpen.value;
4082
4250
  },
4083
- setActiveModelKey: (f) => {
4084
- if (f === null) {
4085
- L("model");
4251
+ setActiveModelKey: (g) => {
4252
+ if (g === null) {
4253
+ j("model");
4086
4254
  return;
4087
4255
  }
4088
- oe("model", f), n.activeModelKey.value = f;
4256
+ ae("model", g), n.activeModelKey.value = g;
4089
4257
  },
4090
- setActiveTab: S,
4258
+ setActiveTab: E,
4091
4259
  openTab: d,
4092
4260
  updateTabName: h,
4093
- closeTab: g,
4261
+ closeTab: f,
4094
4262
  closeOtherTabsExcept: v,
4095
4263
  closeTabsToRightOf: y,
4096
4264
  onInitialLoad: () => {
4097
- const f = n.modelImport.value, C = n.connectionImport.value;
4265
+ const g = n.modelImport.value, S = n.connectionImport.value;
4098
4266
  let b = "editors", p = !1;
4099
- if (F("skipTips", "") === "true" && t.updateSetting("skipAllTips", !0), f && C) {
4100
- const k = F("assetType", ""), q = F("assetName", "");
4101
- k && q ? d("asset-import", null, "asset-import") : d("dashboard-import", null, "dashboard-import"), p = !0;
4267
+ if (A("skipTips", "") === "true" && t.updateSetting("skipAllTips", !0), g && S) {
4268
+ const q = A("assetType", ""), k = A("assetName", "");
4269
+ q && k ? d("asset-import", null, "asset-import") : d("dashboard-import", null, "dashboard-import"), p = !0;
4102
4270
  }
4103
- let D = n.activeScreen.value, _ = n.activeSidebarScreen.value;
4104
- const A = [];
4105
- n.activeEditor.value && !p && A.push({
4271
+ let D = n.activeScreen.value, Q = n.activeSidebarScreen.value;
4272
+ const $ = [];
4273
+ n.activeEditor.value && !p && $.push({
4106
4274
  screen: "editors",
4107
4275
  title: null,
4108
4276
  key: n.activeEditor.value,
4109
4277
  isActive: D === "editors"
4110
- }), n.activeDashboard.value && !p && A.push({
4278
+ }), n.activeDashboard.value && !p && $.push({
4111
4279
  screen: "dashboard",
4112
4280
  title: null,
4113
4281
  key: n.activeDashboard.value,
4114
4282
  isActive: D === "dashboard"
4115
- }), n.activeConnectionKey.value && !p && A.push({
4283
+ }), n.activeConnectionKey.value && !p && $.push({
4116
4284
  screen: "connections",
4117
4285
  title: null,
4118
4286
  key: n.activeConnectionKey.value,
4119
4287
  isActive: D === "connections"
4120
- }), n.activeModelKey.value && !p && A.push({
4288
+ }), n.activeModelKey.value && !p && $.push({
4121
4289
  screen: "models",
4122
4290
  title: null,
4123
4291
  key: n.activeModelKey.value,
4124
4292
  isActive: D === "models"
4125
- }), n.activeCommunityModelKey.value && !p && A.push({
4293
+ }), n.activeCommunityModelKey.value && !p && $.push({
4126
4294
  screen: "community-models",
4127
4295
  title: null,
4128
4296
  key: n.activeCommunityModelKey.value,
4129
4297
  isActive: D === "community-models"
4130
- }), n.activeJobsKey.value && !p && A.push({
4298
+ }), n.activeJobsKey.value && !p && $.push({
4131
4299
  screen: "jobs",
4132
4300
  title: null,
4133
4301
  key: n.activeJobsKey.value,
4134
4302
  isActive: D === "jobs"
4135
- }), n.activeDocumentationKey.value && !p && A.push({
4303
+ }), n.activeDocumentationKey.value && !p && $.push({
4136
4304
  screen: "tutorial",
4137
4305
  title: null,
4138
4306
  key: n.activeDocumentationKey.value,
4139
4307
  isActive: D === "tutorial"
4140
- }), n.activeLLMConnectionKey.value && !p && A.push({
4308
+ }), n.activeLLMConnectionKey.value && !p && $.push({
4141
4309
  screen: "llms",
4142
4310
  title: null,
4143
4311
  key: n.activeLLMConnectionKey.value,
4144
4312
  isActive: D === "llms"
4145
- }), n.activeSidebarScreen.value === "settings" && A.push({
4313
+ }), n.activeSidebarScreen.value === "settings" && $.push({
4146
4314
  screen: "settings",
4147
4315
  title: "Settings",
4148
4316
  key: "settings",
4149
4317
  isActive: D === "settings"
4150
- }), n.activeSidebarScreen.value === "profile" && A.push({
4318
+ }), n.activeSidebarScreen.value === "profile" && $.push({
4151
4319
  screen: "profile",
4152
4320
  title: "Profile",
4153
4321
  key: "profile",
4154
4322
  isActive: D === "profile"
4155
- }), A.sort((k, q) => k.isActive ? 1 : q.isActive ? -1 : 0), A.forEach((k) => {
4156
- d(k.screen, k.title, k.key, !0);
4157
- }), x(D), !_ && A.length > 0 ? b = A[A.length - 1].screen : _ && (b = _), $(b);
4323
+ }), $.sort((q, k) => q.isActive ? 1 : k.isActive ? -1 : 0), $.forEach((q) => {
4324
+ d(q.screen, q.title, q.key, !0);
4325
+ }), T(D), !Q && $.length > 0 ? b = $[$.length - 1].screen : Q && (b = Q), x(b);
4158
4326
  },
4159
- toggleFullScreen: (f) => {
4160
- n.fullScreen.value = f;
4327
+ toggleFullScreen: (g) => {
4328
+ n.fullScreen.value = g;
4161
4329
  },
4162
4330
  addBackListeners: () => {
4163
4331
  i || (i = window.addEventListener("hashchange", () => {
4164
- 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", "");
4165
- let X = !1;
4166
- N !== n.activeSidebarScreen.value && $(N), q !== n.activeScreen.value && (n.activeScreen.value = q, X = !0);
4167
- const Z = [
4332
+ const g = A("editors", ""), S = A("dashboard", ""), b = A("connections", ""), p = A("model", ""), D = A("community-models", ""), Q = A("jobs", ""), $ = A("docs", ""), q = A("llms", ""), k = A("screen", ""), J = A("sidebarScreen", "");
4333
+ let ee = !1;
4334
+ J !== n.activeSidebarScreen.value && x(J), k !== n.activeScreen.value && (n.activeScreen.value = k, ee = !0);
4335
+ const te = [
4168
4336
  {
4169
- hash: f,
4337
+ hash: g,
4170
4338
  screen: "editors",
4171
4339
  current: n.activeEditor.value
4172
4340
  },
4173
4341
  {
4174
- hash: C,
4342
+ hash: S,
4175
4343
  screen: "dashboard",
4176
4344
  current: n.activeDashboard.value
4177
4345
  },
@@ -4191,32 +4359,32 @@ const zt = () => {
4191
4359
  current: n.activeCommunityModelKey.value
4192
4360
  },
4193
4361
  {
4194
- hash: _,
4362
+ hash: Q,
4195
4363
  screen: "jobs",
4196
4364
  current: n.activeJobsKey.value
4197
4365
  },
4198
4366
  {
4199
- hash: A,
4367
+ hash: $,
4200
4368
  screen: "tutorial",
4201
4369
  current: n.activeDocumentationKey.value
4202
4370
  },
4203
4371
  {
4204
- hash: k,
4372
+ hash: q,
4205
4373
  screen: "llms",
4206
4374
  current: n.activeLLMConnectionKey.value
4207
4375
  }
4208
4376
  ];
4209
- for (const { hash: H, screen: ue, current: He } of Z)
4210
- if (H && H !== He || ue === q && X) {
4211
- const ee = n.tabs.value.find(
4212
- (he) => he.screen === ue && he.screen === q && he.address === H
4377
+ for (const { hash: H, screen: ge, current: et } of te)
4378
+ if (H && H !== et || ge === k && ee) {
4379
+ const re = n.tabs.value.find(
4380
+ (ye) => ye.screen === ge && ye.screen === k && ye.address === H
4213
4381
  );
4214
- if (ee && ee.id !== n.activeTab.value) {
4215
- S(ee.id, !0);
4382
+ if (re && re.id !== n.activeTab.value) {
4383
+ E(re.id, !0);
4216
4384
  break;
4217
4385
  }
4218
- if (!ee && H) {
4219
- d(ue, null, H);
4386
+ if (!re && H) {
4387
+ d(ge, null, H);
4220
4388
  break;
4221
4389
  }
4222
4390
  }
@@ -4227,12 +4395,12 @@ const zt = () => {
4227
4395
  }
4228
4396
  };
4229
4397
  };
4230
- let me = null;
4231
- function Cr() {
4232
- return me || (me = zt()), me;
4398
+ let ve = null;
4399
+ function qr() {
4400
+ return ve || (ve = or()), ve;
4233
4401
  }
4234
- const ge = 100;
4235
- class Ht {
4402
+ const Se = 100;
4403
+ class nr {
4236
4404
  constructor() {
4237
4405
  w(this, "dbName");
4238
4406
  w(this, "storeName");
@@ -4287,7 +4455,7 @@ class Ht {
4287
4455
  });
4288
4456
  }
4289
4457
  // Get query history for a specific connection
4290
- async getQueriesForConnection(e, t = ge) {
4458
+ async getQueriesForConnection(e, t = Se) {
4291
4459
  return this.db || await this._initDB(), new Promise((s, o) => {
4292
4460
  if (!this.db) {
4293
4461
  o(new Error("Database not initialized"));
@@ -4328,15 +4496,15 @@ class Ht {
4328
4496
  const n = this.db.transaction([this.storeName], "readwrite").objectStore(this.storeName).index("connectionName"), a = n.count(IDBKeyRange.only(e));
4329
4497
  a.onsuccess = () => {
4330
4498
  const c = a.result;
4331
- if (c <= ge) {
4499
+ if (c <= Se) {
4332
4500
  t();
4333
4501
  return;
4334
4502
  }
4335
- const u = c - ge, l = n.openCursor(IDBKeyRange.only(e));
4503
+ const u = c - Se, l = n.openCursor(IDBKeyRange.only(e));
4336
4504
  let h = 0;
4337
4505
  l.onsuccess = (d) => {
4338
- const g = d.target.result;
4339
- g && h < u ? (g.delete(), h++, g.continue()) : t();
4506
+ const f = d.target.result;
4507
+ f && h < u ? (f.delete(), h++, f.continue()) : t();
4340
4508
  }, l.onerror = (d) => {
4341
4509
  console.error("Error trimming history:", d.target.error), s(d.target.error);
4342
4510
  };
@@ -4346,13 +4514,13 @@ class Ht {
4346
4514
  });
4347
4515
  }
4348
4516
  }
4349
- let ye = null;
4350
- const pe = () => (ye || (ye = new Ht()), ye);
4351
- function ne(r) {
4352
- const e = Q([]), t = Q(!0), s = Q(null), o = async () => {
4517
+ let Ce = null;
4518
+ const Ee = () => (Ce || (Ce = new nr()), Ce);
4519
+ function ce(r) {
4520
+ const e = O([]), t = O(!0), s = O(null), o = async () => {
4353
4521
  t.value = !0;
4354
4522
  try {
4355
- const c = await pe().getQueriesForConnection(r);
4523
+ const c = await Ee().getQueriesForConnection(r);
4356
4524
  e.value = c, s.value = null;
4357
4525
  } catch (c) {
4358
4526
  console.error("Failed to load query history:", c), s.value = "Failed to load query history";
@@ -4361,14 +4529,14 @@ function ne(r) {
4361
4529
  }
4362
4530
  }, i = async (c) => {
4363
4531
  try {
4364
- await pe().addQuery(r, c), await o();
4532
+ await Ee().addQuery(r, c), await o();
4365
4533
  } catch (u) {
4366
4534
  console.error("Failed to record query:", u), s.value = "Failed to record query";
4367
4535
  }
4368
4536
  }, n = async () => {
4369
4537
  t.value = !0;
4370
4538
  try {
4371
- await pe().clearConnectionHistory(r), e.value = [], s.value = null;
4539
+ await Ee().clearConnectionHistory(r), e.value = [], s.value = null;
4372
4540
  } catch (c) {
4373
4541
  console.error("Failed to clear query history:", c), s.value = "Failed to clear query history";
4374
4542
  } finally {
@@ -4376,19 +4544,19 @@ function ne(r) {
4376
4544
  }
4377
4545
  }, a = async (c, u) => {
4378
4546
  const l = performance.now();
4379
- let h = "success", d = null, g = 0, v = 0, m = null;
4547
+ let h = "success", d = null, f = 0, v = 0, m = null;
4380
4548
  try {
4381
- m = await c(u), m && Array.isArray(m) && (g = m.length, g > 0 && typeof m[0] == "object" && (v = Object.keys(m[0]).length));
4549
+ m = await c(u), m && Array.isArray(m) && (f = m.length, f > 0 && typeof m[0] == "object" && (v = Object.keys(m[0]).length));
4382
4550
  } catch (y) {
4383
4551
  throw h = "error", d = y instanceof Error ? y.message : String(y), y;
4384
4552
  } finally {
4385
- const S = performance.now() - l;
4553
+ const E = performance.now() - l;
4386
4554
  await i({
4387
4555
  query: u,
4388
- executionTime: S,
4556
+ executionTime: E,
4389
4557
  status: h,
4390
4558
  errorMessage: d,
4391
- resultSize: g,
4559
+ resultSize: f,
4392
4560
  resultColumns: v
4393
4561
  });
4394
4562
  }
@@ -4404,7 +4572,7 @@ function ne(r) {
4404
4572
  refreshHistory: o
4405
4573
  };
4406
4574
  }
4407
- class Wt {
4575
+ class ir {
4408
4576
  constructor(e) {
4409
4577
  this.connection = e;
4410
4578
  }
@@ -4421,13 +4589,13 @@ class Wt {
4421
4589
  return this.connection.query(e, t ?? null);
4422
4590
  }
4423
4591
  }
4424
- class Gt {
4592
+ class ar {
4425
4593
  constructor(e) {
4426
4594
  this.connectionStore = e;
4427
4595
  }
4428
4596
  getConnection(e) {
4429
4597
  const t = this.connectionStore.connections[e];
4430
- return t ? new Wt(t) : null;
4598
+ return t ? new ir(t) : null;
4431
4599
  }
4432
4600
  async ensureConnected(e) {
4433
4601
  const t = this.connectionStore.connections[e];
@@ -4439,16 +4607,16 @@ class Gt {
4439
4607
  return this.connectionStore.getConnectionSources(e);
4440
4608
  }
4441
4609
  }
4442
- function Vt(r) {
4610
+ function cr(r) {
4443
4611
  return typeof r.getConnection == "function" && typeof r.ensureConnected == "function";
4444
4612
  }
4445
- class Er {
4613
+ class kr {
4446
4614
  constructor(e, t, s = !0) {
4447
4615
  w(this, "trilogyResolver");
4448
4616
  w(this, "connectionProvider");
4449
4617
  w(this, "storeHistory");
4450
4618
  w(this, "eligibleCrossFilterFieldsCache", /* @__PURE__ */ new Map());
4451
- this.trilogyResolver = e, this.connectionProvider = Vt(t) ? t : new Gt(t), this.storeHistory = s;
4619
+ this.trilogyResolver = e, this.connectionProvider = cr(t) ? t : new ar(t), this.storeHistory = s;
4452
4620
  }
4453
4621
  async executeQueriesBatch(e, t, s, o = [], i, n = {}, a, c, u, l, h = !1, d) {
4454
4622
  if (s === "python")
@@ -4464,7 +4632,7 @@ class Er {
4464
4632
  executionTime: 0
4465
4633
  })
4466
4634
  };
4467
- const g = (/* @__PURE__ */ new Date()).getTime(), v = new AbortController();
4635
+ const f = (/* @__PURE__ */ new Date()).getTime(), v = new AbortController();
4468
4636
  return {
4469
4637
  cancellation: {
4470
4638
  cancel: () => v.abort(),
@@ -4477,7 +4645,7 @@ class Er {
4477
4645
  o,
4478
4646
  i || [],
4479
4647
  n,
4480
- g,
4648
+ f,
4481
4649
  v,
4482
4650
  a,
4483
4651
  c,
@@ -4488,33 +4656,34 @@ class Er {
4488
4656
  )
4489
4657
  };
4490
4658
  }
4491
- async executeQueriesBatchInternal(e, t, s, o = [], i, n = {}, a, c, u, l, h, d, g = !1, v) {
4659
+ async executeQueriesBatchInternal(e, t, s, o = [], i, n = {}, a, c, u, l, h, d, f = !1, v) {
4660
+ var E;
4492
4661
  u && u();
4493
4662
  const m = this.connectionProvider.getConnection(e);
4494
4663
  if (!m)
4495
4664
  return {
4496
4665
  success: !1,
4497
4666
  executionTime: (/* @__PURE__ */ new Date()).getTime() - a,
4498
- results: t.map((S) => ({
4667
+ results: t.map((T) => ({
4499
4668
  success: !1,
4500
4669
  generated_sql: "",
4501
4670
  columns: [],
4502
4671
  error: `Connection ${e} not found.`,
4503
4672
  executionTime: 0,
4504
- results: new J(/* @__PURE__ */ new Map(), []),
4673
+ results: new B(/* @__PURE__ */ new Map(), []),
4505
4674
  resultSize: 0,
4506
4675
  columnCount: 0
4507
4676
  }))
4508
4677
  };
4509
- if (g)
4678
+ if (f)
4510
4679
  return {
4511
4680
  success: !0,
4512
- results: t.map((S) => ({
4681
+ results: t.map((T) => ({
4513
4682
  success: !0,
4514
- generated_sql: S.query,
4683
+ generated_sql: T.query,
4515
4684
  columns: [],
4516
4685
  executionTime: (/* @__PURE__ */ new Date()).getTime() - a,
4517
- results: new J(/* @__PURE__ */ new Map(), []),
4686
+ results: new B(/* @__PURE__ */ new Map(), []),
4518
4687
  resultSize: 0,
4519
4688
  columnCount: 0
4520
4689
  })),
@@ -4542,7 +4711,7 @@ class Er {
4542
4711
  columns: [],
4543
4712
  error: `Connection ${e} not active, failed to reconnect.`,
4544
4713
  executionTime: (/* @__PURE__ */ new Date()).getTime() - a,
4545
- results: new J(/* @__PURE__ */ new Map(), []),
4714
+ results: new B(/* @__PURE__ */ new Map(), []),
4546
4715
  columnCount: 0,
4547
4716
  resultSize: 0
4548
4717
  }))
@@ -4551,7 +4720,7 @@ class Er {
4551
4720
  let y = this.connectionProvider.getConnectionSources(e);
4552
4721
  v && (y = y.concat(v));
4553
4722
  try {
4554
- const S = await Promise.race([
4723
+ const T = await Promise.race([
4555
4724
  this.trilogyResolver.resolve_queries_batch(
4556
4725
  t,
4557
4726
  m.queryType,
@@ -4559,90 +4728,94 @@ class Er {
4559
4728
  o,
4560
4729
  i
4561
4730
  ),
4562
- new Promise((T, E) => {
4731
+ new Promise((F, C) => {
4563
4732
  c.signal.addEventListener(
4564
4733
  "abort",
4565
- () => E(new Error("Query batch cancelled by user"))
4734
+ () => C(new Error("Query batch cancelled by user"))
4566
4735
  );
4567
4736
  })
4568
4737
  ]), x = [];
4569
- if (S && Array.isArray(S.data.queries))
4570
- for (let T = 0; T < S.data.queries.length; T++) {
4571
- const E = S.data.queries[T];
4572
- if (E.generated_sql)
4738
+ if (T && Array.isArray(T.data.queries))
4739
+ for (let F = 0; F < T.data.queries.length; F++) {
4740
+ const C = T.data.queries[F];
4741
+ if (C.generated_sql) {
4742
+ const M = {
4743
+ ...((E = t[F]) == null ? void 0 : E.parameters) || {},
4744
+ ...C.parameters || {}
4745
+ }, X = Object.keys(M).length ? M : null;
4573
4746
  try {
4574
- const O = await Promise.race([
4575
- m.executeSql(E.generated_sql, n),
4576
- new Promise((K, Y) => {
4747
+ const P = await Promise.race([
4748
+ m.executeSql(C.generated_sql, X),
4749
+ new Promise((Z, Fe) => {
4577
4750
  c.signal.addEventListener(
4578
4751
  "abort",
4579
- () => Y(new Error("Query execution cancelled by user"))
4752
+ () => Fe(new Error("Query execution cancelled by user"))
4580
4753
  );
4581
4754
  })
4582
4755
  ]);
4583
- (s === "trilogy" || s === "preql") && this.enrichTrilogyColumns(E.columns || [], O);
4584
- let j = {
4756
+ (s === "trilogy" || s === "preql") && this.enrichTrilogyColumns(C.columns || [], P);
4757
+ let R = {
4585
4758
  success: !0,
4586
- generatedSql: E.generated_sql,
4587
- results: O,
4588
- resultSize: O.data.length,
4589
- columnCount: O.headers.size,
4759
+ generatedSql: C.generated_sql,
4760
+ results: P,
4761
+ resultSize: P.data.length,
4762
+ columnCount: P.headers.size,
4590
4763
  executionTime: (/* @__PURE__ */ new Date()).getTime() - a
4591
4764
  };
4592
- d && E.label && d[E.label] && d[E.label](j), x.push(j), this.storeHistory && ne(e).recordQuery({
4593
- query: t[T].query,
4594
- generatedQuery: E.generated_sql,
4765
+ d && C.label && d[C.label] && d[C.label](R), x.push(R), this.storeHistory && ce(e).recordQuery({
4766
+ query: t[F].query,
4767
+ generatedQuery: C.generated_sql,
4595
4768
  executionTime: (/* @__PURE__ */ new Date()).getTime() - a,
4596
4769
  status: "success",
4597
- resultSize: O.data.length,
4598
- resultColumns: O.headers.size,
4770
+ resultSize: P.data.length,
4771
+ resultColumns: P.headers.size,
4599
4772
  errorMessage: null,
4600
4773
  extraFilters: i
4601
4774
  });
4602
- } catch (O) {
4603
- const j = c.signal.aborted ? "Query execution cancelled by user" : O instanceof Error ? O.message : "Unknown error occurred during execution";
4604
- let K = {
4775
+ } catch (P) {
4776
+ const R = c.signal.aborted ? "Query execution cancelled by user" : P instanceof Error ? P.message : "Unknown error occurred during execution";
4777
+ let Z = {
4605
4778
  success: !1,
4606
- error: j,
4607
- generatedSql: E.generated_sql,
4608
- results: new J(/* @__PURE__ */ new Map(), []),
4779
+ error: R,
4780
+ generatedSql: C.generated_sql,
4781
+ results: new B(/* @__PURE__ */ new Map(), []),
4609
4782
  resultSize: 0,
4610
4783
  columnCount: 0,
4611
4784
  executionTime: (/* @__PURE__ */ new Date()).getTime() - a
4612
4785
  };
4613
- 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({
4614
- query: t[T].query,
4615
- generatedQuery: E.generated_sql,
4786
+ 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({
4787
+ query: t[F].query,
4788
+ generatedQuery: C.generated_sql,
4616
4789
  executionTime: (/* @__PURE__ */ new Date()).getTime() - a,
4617
4790
  status: "error",
4618
4791
  resultSize: 0,
4619
4792
  resultColumns: 0,
4620
- errorMessage: j,
4793
+ errorMessage: R,
4621
4794
  extraFilters: i
4622
4795
  });
4623
4796
  }
4624
- else if (E.error) {
4625
- let O = {
4797
+ } else if (C.error) {
4798
+ let M = {
4626
4799
  success: !1,
4627
- error: E.error,
4800
+ error: C.error,
4628
4801
  generatedSql: "",
4629
4802
  executionTime: (/* @__PURE__ */ new Date()).getTime() - a,
4630
- results: new J(/* @__PURE__ */ new Map(), []),
4803
+ results: new B(/* @__PURE__ */ new Map(), []),
4631
4804
  resultSize: 0,
4632
4805
  columnCount: 0
4633
4806
  };
4634
- h && E.label && h[E.label] && h[E.label](O), x.push(O);
4807
+ h && C.label && h[C.label] && h[C.label](M), x.push(M);
4635
4808
  } else {
4636
- let O = {
4809
+ let M = {
4637
4810
  success: !1,
4638
4811
  error: "No SQL was generated for this query",
4639
4812
  generatedSql: "",
4640
4813
  executionTime: (/* @__PURE__ */ new Date()).getTime() - a,
4641
- results: new J(/* @__PURE__ */ new Map(), []),
4814
+ results: new B(/* @__PURE__ */ new Map(), []),
4642
4815
  resultSize: 0,
4643
4816
  columnCount: 0
4644
4817
  };
4645
- x.push(O), h && E.label && h[E.label] && h[E.label](O);
4818
+ x.push(M), h && C.label && h[C.label] && h[C.label](M);
4646
4819
  }
4647
4820
  }
4648
4821
  return {
@@ -4650,10 +4823,10 @@ class Er {
4650
4823
  results: x,
4651
4824
  executionTime: (/* @__PURE__ */ new Date()).getTime() - a
4652
4825
  };
4653
- } catch (S) {
4654
- const x = c.signal.aborted ? "Query batch cancelled by user" : S instanceof Error ? S.message : "Unknown error occurred";
4826
+ } catch (T) {
4827
+ const x = c.signal.aborted ? "Query batch cancelled by user" : T instanceof Error ? T.message : "Unknown error occurred";
4655
4828
  return h && Object.values(h).forEach(
4656
- ($) => $({
4829
+ (_) => _({
4657
4830
  message: x,
4658
4831
  error: !0,
4659
4832
  running: !1
@@ -4752,7 +4925,8 @@ class Er {
4752
4925
  t.imports,
4753
4926
  t.extraFilters,
4754
4927
  null,
4755
- t.currentFilename || null
4928
+ t.currentFilename || null,
4929
+ t.parameters || null
4756
4930
  )) : null;
4757
4931
  }
4758
4932
  async getEligibleCrossFilterFields(e, t = {}) {
@@ -4780,7 +4954,7 @@ class Er {
4780
4954
  currentFilename: t.currentFilename
4781
4955
  },
4782
4956
  !1
4783
- ), h = wt((l == null ? void 0 : l.data.completion_items) ?? []);
4957
+ ), h = At((l == null ? void 0 : l.data.completion_items) ?? []);
4784
4958
  return this.eligibleCrossFilterFieldsCache.set(c, h), [...h];
4785
4959
  }
4786
4960
  clearEligibleCrossFilterFieldsCache() {
@@ -4823,8 +4997,8 @@ class Er {
4823
4997
  };
4824
4998
  }
4825
4999
  i && i();
4826
- const g = this.connectionProvider.getConnection(e);
4827
- if (!g)
5000
+ const f = this.connectionProvider.getConnection(e);
5001
+ if (!f)
4828
5002
  return {
4829
5003
  success: !1,
4830
5004
  error: `Connection ${e} not found.`,
@@ -4832,7 +5006,7 @@ class Er {
4832
5006
  resultSize: 0,
4833
5007
  columnCount: 0
4834
5008
  };
4835
- if (!g.isConnected() && !u)
5009
+ if (!f.isConnected() && !u)
4836
5010
  try {
4837
5011
  n && n({
4838
5012
  message: "Connection is not active... Attempting to automatically reconnect.",
@@ -4858,7 +5032,7 @@ class Er {
4858
5032
  if (m = await Promise.race([
4859
5033
  this.trilogyResolver.resolve_query(
4860
5034
  t.text,
4861
- g.queryType,
5035
+ f.queryType,
4862
5036
  t.editorType,
4863
5037
  v,
4864
5038
  t.imports,
@@ -4866,53 +5040,56 @@ class Er {
4866
5040
  t.parameters,
4867
5041
  t.currentFilename || null
4868
5042
  ),
4869
- new Promise(($, T) => {
5043
+ new Promise((F, C) => {
4870
5044
  o.signal.addEventListener(
4871
5045
  "abort",
4872
- () => T(new Error("Query cancelled by user"))
5046
+ () => C(new Error("Query cancelled by user"))
4873
5047
  );
4874
5048
  })
4875
5049
  ]), m && m.data.generated_output) {
4876
- let $ = m.data.columns || [], T = {
5050
+ let F = m.data.columns || [], C = {
4877
5051
  success: !0,
4878
5052
  // hardcode result types for now
4879
5053
  generatedSql: m.data.generated_sql,
4880
- results: new J(
5054
+ results: new B(
4881
5055
  new Map(
4882
- $.map((E) => [
4883
- E.name,
4884
- { name: E.name, type: at.STRING, purpose: E.purpose }
5056
+ F.map((M) => [
5057
+ M.name,
5058
+ { name: M.name, type: mt.STRING, purpose: M.purpose }
4885
5059
  ])
4886
5060
  ),
4887
5061
  m.data.generated_output
4888
5062
  ),
4889
5063
  executionTime: (/* @__PURE__ */ new Date()).getTime() - s,
4890
5064
  resultSize: m.data.generated_output.length,
4891
- columnCount: $.length,
5065
+ columnCount: F.length,
4892
5066
  selectCount: m.data.select_count
4893
5067
  };
4894
- return console.log(T), c && c(T), T;
5068
+ return console.log(C), c && c(C), C;
4895
5069
  } else if (!m || !m.data.generated_sql || u) {
4896
- let $ = {
5070
+ let F = {
4897
5071
  success: !0,
4898
- results: new J(/* @__PURE__ */ new Map(), []),
5072
+ results: new B(/* @__PURE__ */ new Map(), []),
4899
5073
  executionTime: (/* @__PURE__ */ new Date()).getTime() - s,
4900
5074
  resultSize: 0,
4901
5075
  columnCount: 0
4902
5076
  };
4903
- return c && c($), $;
5077
+ return c && c(F), F;
4904
5078
  }
4905
5079
  d = m.data.generated_sql;
4906
- const y = m.data.columns, S = await Promise.race([
4907
- g.executeSql(d, t.parameters),
4908
- new Promise(($, T) => {
5080
+ const y = m.data.columns, E = {
5081
+ ...t.parameters || {},
5082
+ ...m.data.parameters || {}
5083
+ }, T = Object.keys(E).length ? E : null, x = await Promise.race([
5084
+ f.executeSql(d, T),
5085
+ new Promise((F, C) => {
4909
5086
  o.signal.addEventListener(
4910
5087
  "abort",
4911
- () => T(new Error("Query cancelled by user"))
5088
+ () => C(new Error("Query cancelled by user"))
4912
5089
  );
4913
5090
  })
4914
5091
  ]);
4915
- (t.editorType === "trilogy" || t.editorType === "preql") && this.enrichTrilogyColumns(y, S), l = S.data.length, h = S.headers.size, this.storeHistory && ne(e).recordQuery({
5092
+ (t.editorType === "trilogy" || t.editorType === "preql") && this.enrichTrilogyColumns(y, x), l = x.data.length, h = x.headers.size, this.storeHistory && ce(e).recordQuery({
4916
5093
  query: t.text,
4917
5094
  generatedQuery: d,
4918
5095
  executionTime: (/* @__PURE__ */ new Date()).getTime() - s,
@@ -4922,42 +5099,42 @@ class Er {
4922
5099
  errorMessage: null,
4923
5100
  extraFilters: t.extraFilters
4924
5101
  });
4925
- const x = m == null ? void 0 : m.data.select_count;
5102
+ const _ = m == null ? void 0 : m.data.select_count;
4926
5103
  return c && c({
4927
5104
  success: !0,
4928
5105
  generatedSql: d,
4929
- results: S,
5106
+ results: x,
4930
5107
  executionTime: (/* @__PURE__ */ new Date()).getTime() - s,
4931
5108
  resultSize: l,
4932
5109
  columnCount: h,
4933
- selectCount: x
5110
+ selectCount: _
4934
5111
  }), {
4935
5112
  success: !0,
4936
5113
  generatedSql: d,
4937
- results: S,
5114
+ results: x,
4938
5115
  executionTime: (/* @__PURE__ */ new Date()).getTime() - s,
4939
5116
  resultSize: l,
4940
5117
  columnCount: h,
4941
- selectCount: x
5118
+ selectCount: _
4942
5119
  };
4943
5120
  } catch (y) {
4944
- const S = o.signal.aborted ? "Query cancelled by user" : y instanceof Error ? y.message : "Unknown error occurred";
4945
- return this.storeHistory && ne(e).recordQuery({
5121
+ const E = o.signal.aborted ? "Query cancelled by user" : y instanceof Error ? y.message : "Unknown error occurred";
5122
+ return this.storeHistory && ce(e).recordQuery({
4946
5123
  query: t.text,
4947
5124
  generatedQuery: d,
4948
5125
  executionTime: (/* @__PURE__ */ new Date()).getTime() - s,
4949
5126
  status: "error",
4950
5127
  resultSize: l,
4951
5128
  resultColumns: h,
4952
- errorMessage: S
5129
+ errorMessage: E
4953
5130
  }), a && a({
4954
- message: S,
5131
+ message: E,
4955
5132
  error: !0,
4956
5133
  running: !1,
4957
5134
  generatedSql: d
4958
5135
  }), {
4959
5136
  success: !1,
4960
- error: S,
5137
+ error: E,
4961
5138
  executionTime: (/* @__PURE__ */ new Date()).getTime() - s,
4962
5139
  resultSize: l,
4963
5140
  columnCount: h
@@ -4967,52 +5144,52 @@ class Er {
4967
5144
  enrichTrilogyColumns(e, t) {
4968
5145
  for (let s = 0; s < e.length; s++) {
4969
5146
  let o = e[s], i = t.headers.get(o.name.replace("local.", "").replaceAll(".", "_"));
4970
- i && (i.traits = o.traits || [], i.address = o.name, i.purpose = o.purpose, t.headers.set(i.name, i));
5147
+ i && (i.traits = o.traits || [], i.address = o.name, i.purpose = o.purpose, i.keys = o.keys || [], t.headers.set(i.name, i));
4971
5148
  }
4972
5149
  }
4973
5150
  }
4974
5151
  export {
4975
- ne as A,
4976
- Ue as B,
4977
- Gt as C,
4978
- At as D,
4979
- It as E,
4980
- gr as F,
4981
- yr as G,
4982
- pr as H,
4983
- ze as I,
4984
- vr as J,
4985
- br as K,
4986
- wr as L,
4987
- ve as M,
4988
- re as N,
4989
- Ft as O,
4990
- Er as Q,
4991
- hr as T,
4992
- Qt as a,
4993
- ie as b,
4994
- Sr as c,
4995
- Kt as d,
4996
- Cr as e,
4997
- Pe as f,
4998
- F as g,
4999
- M as h,
5000
- dr as i,
5001
- G as j,
5002
- Et as k,
5003
- Re as l,
5004
- Tt as m,
5005
- R as n,
5006
- $t as o,
5007
- wt as p,
5008
- Ct as q,
5009
- L as r,
5010
- Dt as s,
5011
- xt as t,
5012
- fr as u,
5013
- le as v,
5014
- bt as w,
5015
- oe as x,
5016
- mr as y,
5017
- fe as z
5152
+ ce as A,
5153
+ Xe as B,
5154
+ ar as C,
5155
+ Nt as D,
5156
+ Vt as E,
5157
+ Tr as F,
5158
+ $r as G,
5159
+ Ar as H,
5160
+ Ze as I,
5161
+ Or as J,
5162
+ Fr as K,
5163
+ _r as L,
5164
+ Te as M,
5165
+ ne as N,
5166
+ Rt as O,
5167
+ kr as Q,
5168
+ Sr as T,
5169
+ Jt as a,
5170
+ ue as b,
5171
+ Qr as c,
5172
+ rr as d,
5173
+ qr as e,
5174
+ Ue as f,
5175
+ A as g,
5176
+ L as h,
5177
+ Er as i,
5178
+ V as j,
5179
+ Mt as k,
5180
+ le as l,
5181
+ jt as m,
5182
+ K as n,
5183
+ It as o,
5184
+ At as p,
5185
+ qt as q,
5186
+ j as r,
5187
+ Lt as s,
5188
+ Pt as t,
5189
+ Dr as u,
5190
+ me as v,
5191
+ Cr as w,
5192
+ ae as x,
5193
+ xr as y,
5194
+ we as z
5018
5195
  };