@trilogy-data/trilogy-studio-components 0.1.26 → 0.1.28

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 (145) hide show
  1. package/dist/AssetAutoImporter-C_7Ms9xe.js +403 -0
  2. package/dist/{ChatCreatorModal-CL-jBnc3.js → ChatCreatorModal-Cd40SvdM.js} +3 -3
  3. package/dist/{ChatModelSelect-Do-VRUFc.js → ChatModelSelect-Cz7axWjP.js} +1 -1
  4. package/dist/{CodeBlock-PT4no49I.js → CodeBlock-Dj-GfTbW.js} +4 -4
  5. package/dist/{CommunityModels-Cmro0hV3.js → CommunityModels-lX2RhHCG.js} +7 -7
  6. package/dist/{ConnectionErrorPopup-FSs7U-Yl.js → ConnectionErrorPopup-7vpqgF0s.js} +1 -1
  7. package/dist/{ConnectionView-COnTTuA4.js → ConnectionView-CZ06qjjE.js} +49 -49
  8. package/dist/{CreateEditorFromDatasourcePopup-snOh1d5h.js → CreateEditorFromDatasourcePopup-DwA938kf.js} +4 -4
  9. package/dist/{Dashboard-BH9ZwMVJ.js → Dashboard-CQsIqWZC.js} +276 -280
  10. package/dist/{DashboardImportSelector-DQSvu9T-.js → DashboardImportSelector-CkqH52FX.js} +2 -2
  11. package/dist/{DashboardMobile-BUPtdN2V.js → DashboardMobile-DWFlel5p.js} +39 -39
  12. package/dist/{DrilldownPane-CBs5ZojS.js → DrilldownPane-BheRHJMs.js} +5 -7
  13. package/dist/{Editor-DQsYpkwl.js → Editor-DQ66Vp6v.js} +105 -103
  14. package/dist/{ErrorMessage-XMn_08gJ.js → ErrorMessage-D5JeF3Iz.js} +4 -4
  15. package/dist/{GlobalChatPanel-DhnOaige.js → GlobalChatPanel-B_s3COHE.js} +20 -21
  16. package/dist/{IDE-HLa8vybk.js → IDE-4-Jg6gsM.js} +200 -203
  17. package/dist/{JobsView-B97HBoIE.js → JobsView-B5NWDUgP.js} +13 -14
  18. package/dist/{LLMChat-CxJcPLEG.js → LLMChat-eKgEc-I3.js} +3 -3
  19. package/dist/{LLMView-C1MUf0c2.js → LLMView-CdTwMLVV.js} +23 -23
  20. package/dist/{LoadingView-s1uznGwG.js → LoadingView-Bu3wLJ7J.js} +2 -2
  21. package/dist/{MarkdownRenderer-BNDuEyG-.js → MarkdownRenderer-B6lqdkgc.js} +531 -430
  22. package/dist/{MobileIDE-BpqXoaMR.js → MobileIDE-CZlg20oa.js} +179 -182
  23. package/dist/{ModelCard-BhN25jaV.js → ModelCard-Bs_d7Jis.js} +12 -13
  24. package/dist/{ModelView-DUDA_PtZ.js → ModelView-BP5yyecx.js} +7 -7
  25. package/dist/PageLoading-DKFeqkmK.js +5937 -0
  26. package/dist/{ResultComponent-CAn_r3BL.js → ResultComponent-BaDheojB.js} +8 -8
  27. package/dist/{Results-BJtlwebY.js → Results-CrpHB101.js} +17 -19
  28. package/dist/{StatusIcon-BylPx2EO.js → StatusIcon-Clfyy-Yn.js} +2 -2
  29. package/dist/{StoreTokenModal-zCSYhfrw.js → StoreTokenModal-CO5hXMs3.js} +2 -2
  30. package/dist/{SymbolsPane-KYSwN9Sv.js → SymbolsPane-XFVErDFb.js} +6 -3
  31. package/dist/{TrilogyEmbedProvider-WA_dlv9e.js → TrilogyEmbedProvider-D3h0gYnX.js} +9 -9
  32. package/dist/{TutorialPage-NRcee6Dx.js → TutorialPage-CMcTYDOV.js} +27 -28
  33. package/dist/{VegaLiteChart-D1slfOUY.js → VegaLiteChart-DX_LbF3g.js} +12131 -10947
  34. package/dist/{WelcomePage-D5mU2x1L.js → WelcomePage-B6E35FUa.js} +5 -5
  35. package/dist/{embedTheme-Bub46ILG.js → _plugin-vue_export-helper-f9Rw-Il4.js} +14 -6
  36. package/dist/assets/{css.worker-9aDGcEUy.js → css.worker-niORQtzO.js} +14 -14
  37. package/dist/assets/{html.worker-D2LKDpnG.js → html.worker-CO5LvJpF.js} +17 -17
  38. package/dist/assets/json.worker-BezHzWUV.js +58 -0
  39. package/dist/assets/{ts.worker-Bz0-EaKK.js → ts.worker-CYhxGg0r.js} +107 -107
  40. package/dist/{results-DTgAKr5j.js → base-DuKnVD-A.js} +216 -45
  41. package/dist/components/FeedbackBanner.vue.d.ts +4 -0
  42. package/dist/components/FeedbackBanner.vue.d.ts.map +1 -0
  43. package/dist/components/dashboard/DashboardCreatorIcon.vue.d.ts +54 -0
  44. package/dist/components/dashboard/DashboardCreatorIcon.vue.d.ts.map +1 -0
  45. package/dist/components/dashboard/DashboardProvenance.vue.d.ts +30 -0
  46. package/dist/components/dashboard/DashboardProvenance.vue.d.ts.map +1 -0
  47. package/dist/components/dashboard/ReportLayout.vue.d.ts +19 -0
  48. package/dist/components/dashboard/ReportLayout.vue.d.ts.map +1 -0
  49. package/dist/components/editor/Editor.vue.d.ts +3 -3
  50. package/dist/components/editor/EditorCreatorIcon.vue.d.ts +62 -0
  51. package/dist/components/editor/EditorCreatorIcon.vue.d.ts.map +1 -0
  52. package/dist/components/editor/ValidationComponent.vue.d.ts +50 -0
  53. package/dist/components/editor/ValidationComponent.vue.d.ts.map +1 -0
  54. package/dist/components/model/ModelCard.vue.d.ts +3 -3
  55. package/dist/components/sidebar/LLMConnectionList.vue.d.ts.map +1 -1
  56. package/dist/components/sidebar/Sidebar.vue.d.ts.map +1 -1
  57. package/dist/components/tutorial/TutorialPrompt.vue.d.ts +3 -3
  58. package/dist/components/tutorial/TutorialPrompt.vue.d.ts.map +1 -1
  59. package/dist/{remoteWorker-Dkv3TJ0j.js → connections-CWH3zwH2.js} +4544 -4126
  60. package/dist/connections.js +3 -4
  61. package/dist/{cssMode-D4Rzr1Cu.js → cssMode-zpO2ap2B.js} +5 -6
  62. package/dist/dashboard.js +28 -31
  63. package/dist/dashboards/dashboardQueryExecutor.d.ts +9 -0
  64. package/dist/dashboards/dashboardQueryExecutor.d.ts.map +1 -1
  65. package/dist/{dist-CXoL8kXK.js → dist-1z5KURzS.js} +55 -50
  66. package/dist/{dist-DKkuvbPb.js → dist-Bv3D2p5A.js} +20 -18
  67. package/dist/{editor.main-Cl8i7rHY.js → editor.main-BQh6DxDB.js} +33 -33
  68. package/dist/{editorRefinementRuntime-DoP9P5J2.js → editorStore-CiWH_nGN.js} +1692 -575
  69. package/dist/embed.js +2 -2
  70. package/dist/{freemarker2-fW5NBILf.js → freemarker2-DQBqlEXc.js} +1 -1
  71. package/dist/{globalChatRuntime-DWZxeS57.js → globalChatRuntime-DAERmOdu.js} +16 -16
  72. package/dist/{handlebars-dG4w8UUY.js → handlebars-tgYxaM70.js} +1 -1
  73. package/dist/{helpers-BLQAgX3C.js → helpers-C2pARJoZ.js} +34 -35
  74. package/dist/{html-1Dq70BdU.js → html-jJahD3Mi.js} +1 -1
  75. package/dist/{htmlMode--IQmLBeh.js → htmlMode-BA1-8l2e.js} +5 -6
  76. package/dist/{javascript-CTzBM4sF.js → javascript-Cypfo7va.js} +1 -1
  77. package/dist/{jsonMode-DzeJjIEH.js → jsonMode-xJye8PWS.js} +25 -25
  78. package/dist/{liquid-DlHThiki.js → liquid-BGDrv5da.js} +1 -1
  79. package/dist/llm/data/prompts.d.ts +1 -1
  80. package/dist/llm/data/prompts.d.ts.map +1 -1
  81. package/dist/llm/data/trilogySyntax.generated.d.ts +3 -3
  82. package/dist/llm/data/trilogySyntax.generated.d.ts.map +1 -1
  83. package/dist/llm-Wf4Etiu9.js +18493 -0
  84. package/dist/llm.js +2 -3
  85. package/dist/{localStorage-D9uyOFEO.js → localStorage-C3xms-ab.js} +40 -43
  86. package/dist/{lspLanguageFeatures-Cdfs3EKq.js → lspLanguageFeatures-V3e_p9oN.js} +32 -32
  87. package/dist/{mdx-fn3g4PH5.js → mdx-BUR1aImW.js} +1 -1
  88. package/dist/monaco.js +4 -4
  89. package/dist/{python-CCVj0pFt.js → python-YLkl0pc6.js} +1 -1
  90. package/dist/{razor-Cj3flYnk.js → razor-BP8TRMDY.js} +1 -1
  91. package/dist/{reconcile-Dyf4UZmj.js → reconcile-BH_ReGDR.js} +1 -1
  92. package/dist/{remoteStoreSync-Z-yjlYtI.js → remoteStoreSync-B0K8QScO.js} +3 -3
  93. package/dist/{rolldown-runtime-Dqa2HsxW.js → rolldown-runtime-B0aSnxlc.js} +2 -2
  94. package/dist/static/test_import.vue.d.ts +4 -0
  95. package/dist/static/test_import.vue.d.ts.map +1 -0
  96. package/dist/stores-DTGQZ4_B.js +2612 -0
  97. package/dist/stores.js +4 -7
  98. package/dist/trilogy-studio-components.css +1 -1
  99. package/dist/{tsMode-GI4xMYAl.js → tsMode-BH9HS_sH.js} +64 -66
  100. package/dist/{typescript-CPibXi3J.js → typescript-BM-ynfk9.js} +1 -1
  101. package/dist/{useChatWithTools-B0HZ_DVh.js → useChatWithTools-BSrzJtYI.js} +11 -11
  102. package/dist/{useDashboard-CdSnPe_6.js → useDashboard-CGeIdDuX.js} +1014 -1022
  103. package/dist/{tabulator_esm-CxLvGDp8.js → useGlobalChatPanel-D9kMZLeF.js} +1729 -711
  104. package/dist/{useResizableDialog-B0ePSts4.js → useResizableDialog-Cs90WJdF.js} +2 -2
  105. package/dist/views/ModelView.vue.d.ts +6 -6
  106. package/dist/views/ModelView.vue.d.ts.map +1 -1
  107. package/dist/views/TutorialPage.vue.d.ts +9 -9
  108. package/dist/views/TutorialPage.vue.d.ts.map +1 -1
  109. package/dist/views.js +192 -194
  110. package/dist/{vocabulary-CKLGILtR.js → vocabulary-DQK5jB7m.js} +3 -1
  111. package/dist/{editor.api2-ClD5pp8H.js → workers-B9Eybl-M.js} +16252 -15926
  112. package/dist/{xml-BNyphceI.js → xml-M5WFPSpA.js} +1 -1
  113. package/dist/{yaml-DE5Vz0PH.js → yaml-CEeFwjz9.js} +1 -1
  114. package/package.json +29 -20
  115. package/dist/AssetAutoImporter-CBzvBaOt.js +0 -405
  116. package/dist/DashboardCreatorInline-CDU7kLy3.js +0 -129
  117. package/dist/DataTable-DoRDynP1.js +0 -365
  118. package/dist/EditorCreatorInline-D6_y1H_h.js +0 -125
  119. package/dist/LoadingButton-OH3frQuO.js +0 -138
  120. package/dist/ModalDialog-D1EOG4rl.js +0 -42
  121. package/dist/ModelCreator-CCdC7EXt.js +0 -253
  122. package/dist/PageLoading-BzniJM0C.js +0 -2669
  123. package/dist/Tooltip-Dihir4zs.js +0 -103
  124. package/dist/_plugin-vue_export-helper-B3ysoDQm.js +0 -8
  125. package/dist/assets/json.worker-CJ5MmO5Q.js +0 -58
  126. package/dist/base-C8IuZWqY.js +0 -164
  127. package/dist/connectionHistoryStorage-DKJHiKJY.js +0 -111
  128. package/dist/connectionHistoryStore-DQeBvStZ.js +0 -61
  129. package/dist/connections-CJSb1TZl.js +0 -229
  130. package/dist/constants-DgFEYN2b.js +0 -7
  131. package/dist/dashboardStore-ppM6nGks.js +0 -641
  132. package/dist/demoSetup-mwa-RDC6.js +0 -2942
  133. package/dist/editorRefinementToolExecutor-CVY3FA7k.js +0 -4624
  134. package/dist/editorStore-BhhmXbi-.js +0 -1019
  135. package/dist/formatting-BbJ5ICgh.js +0 -6
  136. package/dist/llm-BBOVWb-F.js +0 -11967
  137. package/dist/llmStore-DJM2JhzY.js +0 -153
  138. package/dist/monaco.contribution-ikesdolO.js +0 -128
  139. package/dist/stores-BT9hTLny.js +0 -1708
  140. package/dist/trilogy-BroD2Qmp.js +0 -4
  141. package/dist/urlStore-52HG6lsX.js +0 -55
  142. package/dist/useGlobalChatPanel-D_0luajQ.js +0 -85
  143. package/dist/useIsMobile-CNpUQAvk.js +0 -8
  144. package/dist/usePrismHighlight-DVyDiDAL.js +0 -183
  145. package/dist/workers-Br7ThUKL.js +0 -47
@@ -1,2669 +0,0 @@
1
- import { t as e } from "./_plugin-vue_export-helper-B3ysoDQm.js";
2
- import { kt as t } from "./editorRefinementToolExecutor-CVY3FA7k.js";
3
- import { i as n, o as r, r as i } from "./stores-BT9hTLny.js";
4
- import { o as a } from "./editorRefinementRuntime-DoP9P5J2.js";
5
- import { a as o, c as s, i as c, o as l, s as u, u as d } from "./editorStore-BhhmXbi-.js";
6
- import "./dashboardStore-ppM6nGks.js";
7
- import { n as f, t as p } from "./urlStore-52HG6lsX.js";
8
- import { t as m } from "./ModalDialog-D1EOG4rl.js";
9
- import { t as h } from "./Tooltip-Dihir4zs.js";
10
- import { t as g } from "./LoadingButton-OH3frQuO.js";
11
- import { t as _ } from "./useIsMobile-CNpUQAvk.js";
12
- import { t as v } from "./trilogy-BroD2Qmp.js";
13
- import { t as y } from "./DashboardCreatorInline-CDU7kLy3.js";
14
- import { t as b } from "./useGlobalChatPanel-D_0luajQ.js";
15
- import { t as x } from "./localStorage-D9uyOFEO.js";
16
- import { n as S, r as C, t as ee } from "./remoteStoreSync-Z-yjlYtI.js";
17
- import { t as w } from "./ModelCreator-CCdC7EXt.js";
18
- import { t as T } from "./StatusIcon-BylPx2EO.js";
19
- import { a as te, c as ne, d as E, f as D, i as re, l as ie, n as ae, o as O, p as k, r as oe, s as se, u as ce } from "./demoSetup-mwa-RDC6.js";
20
- import { Fragment as A, computed as j, createBlock as M, createCommentVNode as N, createElementBlock as P, createElementVNode as F, createStaticVNode as le, createTextVNode as I, createVNode as L, defineComponent as R, inject as z, nextTick as B, normalizeClass as V, normalizeStyle as ue, onMounted as de, openBlock as H, reactive as fe, ref as U, renderList as W, resolveComponent as G, toDisplayString as K, unref as q, vModelCheckbox as pe, vModelSelect as J, vModelText as Y, vShow as X, watch as me, withCtx as Z, withDirectives as Q, withModifiers as $ } from "vue";
21
- import { storeToRefs as he } from "pinia";
22
- //#region components/layout/screenPresentation.ts
23
- var ge = "mdi mdi-file-document-outline", _e = {
24
- editors: "mdi mdi-file-document-edit-outline",
25
- connections: "mdi mdi-database-outline",
26
- llms: "mdi mdi-creation-outline",
27
- dashboard: "mdi mdi-chart-multiple",
28
- "dashboard-import": "mdi mdi-chart-multiple",
29
- "asset-import": "mdi mdi-import",
30
- models: "mdi mdi-set-center",
31
- "community-models": "mdi mdi-library-outline",
32
- jobs: "mdi mdi-playlist-play",
33
- tutorial: "mdi mdi-help",
34
- settings: "mdi mdi-cog-outline",
35
- profile: "mdi mdi-account-outline",
36
- welcome: "mdi mdi-home-outline",
37
- "": ge
38
- }, ve = { llms: "LLMs" };
39
- function ye(e) {
40
- return _e[e] || ge;
41
- }
42
- function be(e) {
43
- return ve[e] ?? e.split("-").map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join(" ");
44
- }
45
- //#endregion
46
- //#region components/sidebar/TutorialSidebar.vue?vue&type=script&lang.ts
47
- var xe = {
48
- name: "DocumentationSidebar",
49
- props: { activeDocumentationKey: {
50
- type: String,
51
- default: "",
52
- optional: !0
53
- } },
54
- setup(e, { emit: t }) {
55
- if (!z("editorStore")) throw Error("Editor store is not provided!");
56
- let n = f(p.TUTORIAL) || "", r = _(), i = U(null), o = `documentation+${n.split("+")[1]}`, { overrides: s, isCollapsed: c, toggle: l } = k((e) => o.startsWith(e));
57
- return {
58
- documentationNodes: j(() => {
59
- let e = [];
60
- return a.forEach((t) => {
61
- let n = `documentation+${t.title}`;
62
- e.push({
63
- id: n,
64
- name: t.title,
65
- indent: 0,
66
- count: t.articles.length,
67
- type: "documentation"
68
- }), c(n) || t.articles.forEach((n) => {
69
- e.push({
70
- id: `article+${t.title}+${n.title}`,
71
- name: n.displayName || n.title,
72
- indent: 1,
73
- count: n.paragraphs.length,
74
- type: "article"
75
- });
76
- });
77
- }), e;
78
- }),
79
- toggleCollapse: l,
80
- collapsed: s,
81
- isCollapsed: c,
82
- isActiveNode: (t) => t === e.activeDocumentationKey,
83
- isMobile: r,
84
- mobileTree: i,
85
- expandMobileBranch: (e) => {
86
- c(e.id) && l(e.id);
87
- },
88
- selectMobileNode: (e) => t("documentation-key-selected", e.id)
89
- };
90
- },
91
- methods: { handleClick(e) {
92
- this.$emit("documentation-key-selected", e);
93
- } },
94
- components: {
95
- SidebarList: D,
96
- SidebarItem: E,
97
- MobileTreeList: O
98
- }
99
- };
100
- //#endregion
101
- //#region components/sidebar/TutorialSidebar.vue
102
- function Se(e, t, n, r, i, a) {
103
- let o = G("sidebar-item"), s = G("mobile-tree-list"), c = G("sidebar-list");
104
- return H(), M(c, { title: "Documentation" }, {
105
- actions: Z(() => [...t[0] ||= []]),
106
- default: Z(() => [L(s, {
107
- "list-id": "tutorial",
108
- ref: "mobileTree",
109
- items: r.documentationNodes,
110
- enabled: r.isMobile,
111
- "is-branch": (e) => e.type === "documentation",
112
- "is-direct-branch": (e) => e.type === "documentation",
113
- onExpand: r.expandMobileBranch,
114
- onSelect: r.selectMobileNode
115
- }, {
116
- item: Z(({ item: e }) => [(H(), M(o, {
117
- key: e.id,
118
- "item-id": e.id,
119
- name: e.name,
120
- indent: e.indent,
121
- "is-selected": r.isActiveNode(e.id),
122
- "is-collapsible": e.type === "documentation",
123
- "is-collapsed": r.isCollapsed(e.id),
124
- icon: e.type === "article" ? "mdi-text-box-outline" : "",
125
- "extra-info": e.type === "documentation" ? e.count : "",
126
- itemType: "documentation",
127
- onClick: (t) => r.isMobile ? r.mobileTree?.openItem(e) : a.handleClick(e.id),
128
- onToggle: r.toggleCollapse
129
- }, null, 8, [
130
- "item-id",
131
- "name",
132
- "indent",
133
- "is-selected",
134
- "is-collapsible",
135
- "is-collapsed",
136
- "icon",
137
- "extra-info",
138
- "onClick",
139
- "onToggle"
140
- ]))]),
141
- _: 1
142
- }, 8, [
143
- "items",
144
- "enabled",
145
- "is-branch",
146
- "is-direct-branch",
147
- "onExpand",
148
- "onSelect"
149
- ])]),
150
- _: 1
151
- });
152
- }
153
- var Ce = /*#__PURE__*/ e(xe, [["render", Se], ["__scopeId", "data-v-07263be1"]]), we = {
154
- name: "ModelList",
155
- props: {
156
- activeModelKey: String,
157
- testTag: {
158
- type: String,
159
- default: ""
160
- },
161
- mobileSearchQuery: {
162
- type: String,
163
- default: ""
164
- }
165
- },
166
- setup(e) {
167
- let t = z("modelStore"), r = z("saveModels"), i = z("editorStore"), a = z("trilogyResolver"), o = n(), s = _(), c = U(null), l = U(!1), u = o.activeModelKey.value || f(p.MODELS) || "", d = u.split("+")[0], m = "", h = "", g = "", v = u.split("+");
168
- if (d === "model" ? m = v[1] : d === "source" ? (m = v[1], h = v[2]) : d === "datasource" ? (m = v[1], h = v[2], g = v[3]) : d === "concept" && (m = v[1], h = v[2], v.length > 5 && (g = v[3])), !t || !r || !i || !a) throw Error("Model store is not provided!");
169
- let { overrides: y, isCollapsed: b, toggle: x } = k((e) => {
170
- let [t, n, r, i] = e.split("+");
171
- return n === m ? t === "model" ? !0 : r === h ? t === "source" || t === "datasource" && i === g : !1 : !1;
172
- }), S = j(() => e.mobileSearchQuery.trim().toLocaleLowerCase()), C = (e) => !S.value && b(e), ee = j(() => {
173
- let e = [];
174
- return Object.values(t.models).sort((e, t) => e.name.localeCompare(t.name)).forEach((t) => {
175
- if (t.deleted) return;
176
- let n = ["model", t.name].join("+");
177
- e.push({
178
- id: n,
179
- name: t.name,
180
- indent: 0,
181
- count: t.sources.length,
182
- type: "model",
183
- concept: null
184
- }), C(n) || t.sources.forEach((n) => {
185
- let r = [
186
- "source",
187
- t.name,
188
- n.alias
189
- ].join("+");
190
- e.push({
191
- id: r,
192
- name: n.alias,
193
- indent: 1,
194
- count: n.concepts.length,
195
- type: "source",
196
- concept: null
197
- }), C(r) || (n.concepts.forEach((r) => {
198
- e.push({
199
- id: [
200
- "concept",
201
- t.name,
202
- n.alias,
203
- r.namespace,
204
- r.name
205
- ].join("+"),
206
- name: r.namespace === "local" ? r.name : r.namespace + "." + r.name,
207
- indent: 2,
208
- count: 0,
209
- type: "concept",
210
- concept: r
211
- });
212
- }), n.datasources.forEach((r) => {
213
- let i = [
214
- "datasource",
215
- t.name,
216
- n.alias,
217
- r.name
218
- ].join("+");
219
- e.push({
220
- id: i,
221
- name: r.name,
222
- indent: 2,
223
- count: r.concepts.length,
224
- type: "datasource",
225
- concept: null
226
- }), C(i) || r.concepts.forEach((i) => {
227
- e.push({
228
- id: [
229
- "concept",
230
- t.name,
231
- n.alias,
232
- r.name,
233
- i.namespace,
234
- i.name
235
- ].join("+"),
236
- name: i.namespace === "local" ? i.name : i.namespace + "." + i.name,
237
- indent: 3,
238
- count: 0,
239
- type: "concept",
240
- concept: i
241
- });
242
- });
243
- }));
244
- });
245
- }), S.value ? e.filter((e) => e.type === "concept" && e.name.toLocaleLowerCase().includes(S.value)) : e;
246
- }), w = (e) => a.resolveModel(e, t.models[e].sources.map((e) => ({
247
- alias: e.alias,
248
- contents: (i.editors[e.editor] || { contents: "" }).contents
249
- }))).then((n) => {
250
- t.setModelConfigParseResults(e, n);
251
- }).catch((n) => {
252
- t.setModelParseError(e, n.message), console.error("Failed to fetch parse results:", n);
253
- }), T = (e) => {
254
- let t = e.lastIndexOf("+"), n = t === -1 ? e : e.substring(t + 1);
255
- o.openTab("models", n, e);
256
- };
257
- return {
258
- creatorVisible: l,
259
- flatList: ee,
260
- collapsed: y,
261
- isCollapsed: b,
262
- saveModels: r,
263
- fetchParseResults: w,
264
- trilogyIcon: ce,
265
- navigationStore: o,
266
- handleClick: T,
267
- handleToggle: x,
268
- modelStore: t,
269
- contextMenuItems: (e) => e.type === "model" ? [
270
- {
271
- id: "refresh-model",
272
- label: "Refresh model",
273
- icon: "mdi-cog-refresh-outline"
274
- },
275
- {
276
- id: "delete-separator",
277
- kind: "separator"
278
- },
279
- {
280
- id: "delete-model",
281
- label: "Delete model",
282
- icon: "mdi-trash-can-outline",
283
- danger: !0
284
- }
285
- ] : [],
286
- handleContextMenuItemClick: (e, n) => {
287
- switch (n.id) {
288
- case "refresh-model":
289
- w(e.name);
290
- break;
291
- case "delete-model":
292
- t.removeModelConfig(e.name);
293
- break;
294
- }
295
- },
296
- isMobile: s,
297
- mobileTree: c,
298
- searchQuery: S,
299
- isModelBranch: (e) => e.type === "model" || ["source", "datasource"].includes(e.type) && e.count > 0,
300
- expandMobileBranch: (e) => {
301
- b(e.id) && x(e.id);
302
- },
303
- selectMobileItem: (e) => T(e.id)
304
- };
305
- },
306
- components: {
307
- SidebarList: D,
308
- SidebarItem: E,
309
- ModelCreator: w,
310
- LoadingButton: g,
311
- Tooltip: h,
312
- SidebarOverflowMenu: ne,
313
- MobileTreeList: O
314
- }
315
- }, Te = { class: "models-header" }, Ee = { class: "models-header-actions" }, De = ["data-testid"], Oe = ["src"], ke = {
316
- key: 2,
317
- class: "mdi mdi-table node-icon"
318
- }, Ae = {
319
- key: 0,
320
- class: "right-container"
321
- };
322
- function je(e, t, n, r, i, a) {
323
- let o = G("loading-button"), s = G("model-creator"), c = G("sidebar-overflow-menu"), l = G("sidebar-item"), u = G("mobile-tree-list"), d = G("sidebar-list");
324
- return H(), M(d, { title: "Models" }, {
325
- header: Z(() => [F("div", Te, [t[4] ||= F("h3", { class: "font-sans sidebar-header" }, "Models", -1), F("div", Ee, [F("button", {
326
- class: "sidebar-control-button sidebar-header-action sidebar-primary-create",
327
- onClick: t[0] ||= (e) => r.creatorVisible = !r.creatorVisible,
328
- "data-testid": n.testTag ? `model-creator-add-${n.testTag}` : "model-creator-add"
329
- }, [t[2] ||= F("i", { class: "mdi mdi-plus" }, null, -1), I(" " + K(r.creatorVisible ? "Close" : "New"), 1)], 8, De), L(o, {
330
- class: "sidebar-control-button sidebar-header-action",
331
- action: r.saveModels,
332
- "key-combination": ["control", "s"],
333
- "use-default-style": !1
334
- }, {
335
- default: Z(() => [...t[3] ||= [I(" Save ", -1)]]),
336
- _: 1
337
- }, 8, ["action"])])])]),
338
- actions: Z(() => [L(s, {
339
- visible: r.creatorVisible,
340
- onClose: t[1] ||= (e) => r.creatorVisible = !r.creatorVisible
341
- }, null, 8, ["visible"])]),
342
- default: Z(() => [L(u, {
343
- "list-id": "models",
344
- ref: "mobileTree",
345
- items: r.flatList,
346
- enabled: r.isMobile,
347
- flat: !!r.searchQuery,
348
- "is-branch": r.isModelBranch,
349
- "is-selectable": r.isModelBranch,
350
- onExpand: r.expandMobileBranch,
351
- onSelect: r.selectMobileItem
352
- }, {
353
- item: Z(({ item: e }) => [L(l, {
354
- "item-id": e.id,
355
- name: e.name,
356
- indent: e.indent,
357
- "is-selected": n.activeModelKey === e.id,
358
- "is-collapsible": ["model"].includes(e.type) || ["source", "datasource"].includes(e.type) && e.count > 0,
359
- "is-collapsed": r.isCollapsed(e.id),
360
- onClick: (t) => r.isMobile ? r.mobileTree?.openItem(e) : r.handleClick(e.id),
361
- onToggle: r.handleToggle
362
- }, {
363
- icon: Z(() => [e.type === "source" ? (H(), P("img", {
364
- key: 0,
365
- src: r.trilogyIcon,
366
- class: "trilogy-icon"
367
- }, null, 8, Oe)) : e.type === "concept" ? (H(), P("span", {
368
- key: 1,
369
- class: V(`purpose-${e.concept.purpose.toLowerCase()}`)
370
- }, K(e.concept.purpose.charAt(0).toUpperCase()), 3)) : e.type === "datasource" ? (H(), P("i", ke)) : N("", !0)]),
371
- "extra-content": Z(() => [e.type === "model" ? (H(), P("span", Ae, [L(c, {
372
- items: r.contextMenuItems(e),
373
- tooltip: "Model actions",
374
- onSelect: (t) => r.handleContextMenuItemClick(e, t)
375
- }, null, 8, ["items", "onSelect"])])) : N("", !0)]),
376
- _: 2
377
- }, 1032, [
378
- "item-id",
379
- "name",
380
- "indent",
381
- "is-selected",
382
- "is-collapsible",
383
- "is-collapsed",
384
- "onClick",
385
- "onToggle"
386
- ])]),
387
- _: 1
388
- }, 8, [
389
- "items",
390
- "enabled",
391
- "flat",
392
- "is-branch",
393
- "is-selectable",
394
- "onExpand",
395
- "onSelect"
396
- ])]),
397
- _: 1
398
- });
399
- }
400
- var Me = /*#__PURE__*/ e(we, [["render", je], ["__scopeId", "data-v-ad82d845"]]), Ne = {
401
- key: 0,
402
- class: "mdi mdi-server-network sidebar-icon"
403
- }, Pe = {
404
- key: 1,
405
- class: "mdi mdi-folder-outline sidebar-icon"
406
- }, Fe = {
407
- key: 2,
408
- class: "mdi mdi-file-outline sidebar-icon"
409
- }, Ie = {
410
- key: 0,
411
- class: "tag-container"
412
- }, Le = /*#__PURE__*/ e(/* @__PURE__ */ R({
413
- __name: "JobsListItem",
414
- props: {
415
- item: {},
416
- activeJobsKey: { default: "" },
417
- isCollapsed: {
418
- type: Boolean,
419
- default: !1
420
- }
421
- },
422
- emits: [
423
- "item-click",
424
- "item-toggle",
425
- "delete-store",
426
- "refresh-store"
427
- ],
428
- setup(e, { emit: t }) {
429
- let n = e, i = t, a = r(), o = () => {
430
- i("item-click", n.item);
431
- }, s = () => {
432
- i("item-toggle", n.item);
433
- }, c = (e) => a.getStoreStatus(e), l = (e) => {
434
- let t = a.errors[e];
435
- if (t) return t;
436
- let n = a.getStoreStatus(e);
437
- if (n === "connected") return "Ready";
438
- if (n === "running") return "Polling active jobs";
439
- };
440
- return (t, n) => (H(), M(E, {
441
- "item-id": e.item.key,
442
- name: e.item.label,
443
- indent: e.item.indent,
444
- "is-selected": e.activeJobsKey === e.item.key,
445
- "is-collapsible": e.item.type === "store" || e.item.type === "directory",
446
- "is-collapsed": e.isCollapsed,
447
- itemType: "jobs",
448
- onClick: o,
449
- onToggle: s
450
- }, {
451
- icon: Z(() => [e.item.type === "store" ? (H(), P("i", Ne)) : e.item.type === "directory" ? (H(), P("i", Pe)) : (H(), P("i", Fe))]),
452
- "extra-content": Z(() => [e.item.type === "store" && e.item.store ? (H(), P("span", Ie, [
453
- L(h, {
454
- content: "Remove Store",
455
- position: "left"
456
- }, {
457
- default: Z(() => [F("span", {
458
- class: "remove-btn hover-icon sidebar-icon-button danger",
459
- onClick: n[0] ||= $((t) => i("delete-store", e.item.store), ["stop"])
460
- }, [...n[2] ||= [F("i", { class: "mdi mdi-trash-can-outline" }, null, -1)]])]),
461
- _: 1
462
- }),
463
- L(h, {
464
- content: "Refresh Store",
465
- position: "left"
466
- }, {
467
- default: Z(() => [F("span", {
468
- class: "hover-icon sidebar-icon-button",
469
- onClick: n[1] ||= $((t) => i("refresh-store", e.item.store.id), ["stop"])
470
- }, [...n[3] ||= [F("i", { class: "mdi mdi-refresh" }, null, -1)]])]),
471
- _: 1
472
- }),
473
- L(T, {
474
- status: c(e.item.store.id),
475
- message: l(e.item.store.id),
476
- "test-name": e.item.store.id
477
- }, null, 8, [
478
- "status",
479
- "message",
480
- "test-name"
481
- ])
482
- ])) : N("", !0)]),
483
- _: 1
484
- }, 8, [
485
- "item-id",
486
- "name",
487
- "indent",
488
- "is-selected",
489
- "is-collapsible",
490
- "is-collapsed"
491
- ]));
492
- }
493
- }), [["__scopeId", "data-v-ace64696"]]), Re = { class: "form-group" }, ze = { class: "form-group" }, Be = { class: "form-group" }, Ve = {
494
- key: 0,
495
- class: "form-error",
496
- "data-testid": "add-jobs-store-error"
497
- }, He = { class: "dialog-actions" }, Ue = ["disabled"], We = /*#__PURE__*/ e(/* @__PURE__ */ R({
498
- __name: "JobsAddStoreModal",
499
- props: {
500
- show: { type: Boolean },
501
- loading: { type: Boolean }
502
- },
503
- emits: ["close", "add"],
504
- setup(e, { emit: t }) {
505
- let n = e, r = t, i = U(""), a = U(""), o = U(""), s = U("");
506
- me(() => n.show, (e) => {
507
- e && (i.value = "", a.value = "", o.value = "", s.value = "");
508
- });
509
- let c = () => {
510
- if (!a.value) {
511
- s.value = "Base URL is required.";
512
- return;
513
- }
514
- r("add", d(a.value, i.value, o.value));
515
- };
516
- return (t, n) => (H(), M(m, {
517
- show: e.show,
518
- title: "Add Jobs Store",
519
- "test-id": "add-jobs-store-modal",
520
- onClose: n[4] ||= (e) => t.$emit("close")
521
- }, {
522
- default: Z(() => [F("form", { onSubmit: $(c, ["prevent"]) }, [
523
- F("div", Re, [n[5] ||= F("label", null, "Store Name", -1), Q(F("input", {
524
- "onUpdate:modelValue": n[0] ||= (e) => i.value = e,
525
- type: "text",
526
- placeholder: "Optional, defaults to the store URL",
527
- "data-testid": "jobs-store-name-input"
528
- }, null, 512), [[Y, i.value]])]),
529
- F("div", ze, [
530
- n[6] ||= F("label", null, "Base URL", -1),
531
- Q(F("input", {
532
- "onUpdate:modelValue": n[1] ||= (e) => a.value = e,
533
- type: "url",
534
- placeholder: "e.g., http://localhost:8100",
535
- "data-testid": "jobs-store-url-input",
536
- required: ""
537
- }, null, 512), [[Y, a.value]]),
538
- n[7] ||= F("small", null, "Must expose `/index.json`, `/files`, `/run`, `/refresh`, and `/jobs/{id}`.", -1)
539
- ]),
540
- F("div", Be, [
541
- n[8] ||= F("label", null, "Token", -1),
542
- Q(F("input", {
543
- "onUpdate:modelValue": n[2] ||= (e) => o.value = e,
544
- type: "text",
545
- placeholder: "Optional X-Trilogy-Token value",
546
- "data-testid": "jobs-store-token-input"
547
- }, null, 512), [[Y, o.value]]),
548
- n[9] ||= F("small", null, "Stored in memory only. You’ll need to re-enter it after a full reload.", -1)
549
- ]),
550
- s.value ? (H(), P("div", Ve, K(s.value), 1)) : N("", !0),
551
- F("div", He, [F("button", {
552
- type: "button",
553
- class: "cancel-btn",
554
- onClick: n[3] ||= (e) => t.$emit("close")
555
- }, "Cancel"), F("button", {
556
- type: "submit",
557
- class: "confirm-btn",
558
- disabled: e.loading
559
- }, K(e.loading ? "Adding..." : "Add Store"), 9, Ue)])
560
- ], 32)]),
561
- _: 1
562
- }, 8, ["show"]));
563
- }
564
- }), [["__scopeId", "data-v-733e3642"]]), Ge = (e, t) => ({
565
- name: e,
566
- path: t,
567
- files: [],
568
- children: {}
569
- }), Ke = (e) => e.slice().sort((e, t) => e.localeCompare(t)), qe = (e, t) => {
570
- if (!t) return e;
571
- let n = t.split("/").filter(Boolean), r = e, i = "";
572
- return n.forEach((e) => {
573
- i = i ? `${i}/${e}` : e, r.children[e] || (r.children[e] = Ge(e, i)), r = r.children[e];
574
- }), r;
575
- }, Je = (e, t) => `${e}+directory+${encodeURIComponent(t)}`, Ye = (e, t) => `${e}+file+${encodeURIComponent(t)}`, Xe = (e, t, n, r, i) => {
576
- Ke(n).forEach((n) => {
577
- let a = r ? `${r}/${n}` : n;
578
- e.push({
579
- type: "file",
580
- label: n,
581
- key: Ye(t, a),
582
- indent: i,
583
- storeId: t,
584
- target: a
585
- });
586
- });
587
- }, Ze = (e, t, n, r, i) => {
588
- Xe(e, t, n.files, n.path, i), Object.values(n.children).sort((e, t) => e.name.localeCompare(t.name)).forEach((n) => {
589
- let a = Je(t, n.path);
590
- e.push({
591
- type: "directory",
592
- label: n.name,
593
- key: a,
594
- indent: i,
595
- storeId: t,
596
- target: n.path
597
- }), r(a) || Ze(e, t, n, r, i + 1);
598
- });
599
- }, Qe = (e, t = [], n = {}) => {
600
- let r = [];
601
- return t.forEach((t) => {
602
- if (r.push({
603
- type: "store",
604
- label: t.name,
605
- key: t.id,
606
- indent: 0,
607
- storeId: t.id,
608
- store: t
609
- }), e(t.id)) return;
610
- let i = Ge("", "");
611
- (n[t.id]?.directories || []).forEach((e) => {
612
- let t = qe(i, e.directory);
613
- t.files = Ke(e.files);
614
- }), Ze(r, t.id, i, e, 1);
615
- }), r;
616
- }, $e = { class: "jobs-header" }, et = {
617
- key: 0,
618
- class: "empty-state"
619
- }, tt = {
620
- key: 1,
621
- class: "error-container"
622
- }, nt = { class: "error-text" }, rt = ["onClick"], it = /*#__PURE__*/ e(/* @__PURE__ */ R({
623
- __name: "JobsList",
624
- props: { activeJobsKey: { default: "" } },
625
- emits: ["jobs-key-selected"],
626
- setup(e, { emit: t }) {
627
- let i = e, a = t, o = c(), s = r(), l = n(), u = z("storageSources", []), d = z("editorStore"), f = z("connectionStore"), p = z("modelStore"), m = U(!1), h = _(), g = U(null), v = j(() => u.find((e) => e.type === "remote")), y = j(() => o.stores.filter((e) => e.type === "generic")), b = j(() => y.value.some((e) => !!s.errors[e.id])), x = j(() => y.value.filter((e) => !!s.errors[e.id])), w = j(() => (i.activeJobsKey || "").split("+")[0] || ""), { isCollapsed: T, toggle: te, open: ne } = k((e) => e.includes("+directory+") ? !0 : w.value ? e === w.value : y.value.length === 1 && e === y.value[0].id), E = j(() => Qe(T, y.value, s.filesByStore)), re = async (e) => {
628
- try {
629
- await o.addStore(e), await s.fetchFilesForStore(e.id), v.value && d && f && p && await S(v.value, e.id, d, f, p), ne(e.id), m.value = !1;
630
- } catch (e) {
631
- console.error("Failed to add jobs store:", e);
632
- }
633
- }, { isOpen: ie, openConfirmation: ae, closeConfirmation: oe, confirm: ce } = se((e) => {
634
- d && f && p && ee(e.id, d, f, p), o.removeStore(e.id), s.clearStoreData(e.id);
635
- }), le = (e) => {
636
- l.openTab("jobs", null, e.key), a("jobs-key-selected", e.key);
637
- }, R = (e) => {
638
- te(e.key);
639
- }, B = (e) => ["store", "directory"].includes(e.type), V = (e) => {
640
- T(e.key) && R(e);
641
- }, ue = (e) => {
642
- h.value ? g.value?.openItem(e) : le(e);
643
- }, fe = async (e) => {
644
- await s.fetchFilesForStore(e);
645
- };
646
- return de(async () => {
647
- o.loadStoresFromStorage(), await s.refreshAllStores();
648
- }), (t, n) => (H(), M(D, { title: "Jobs" }, {
649
- header: Z(() => [F("div", $e, [n[3] ||= F("h3", { class: "font-sans sidebar-header" }, "Jobs", -1), F("button", {
650
- class: "sidebar-control-button sidebar-header-action sidebar-primary-create",
651
- onClick: n[0] ||= (e) => m.value = !0
652
- }, [...n[2] ||= [F("i", { class: "mdi mdi-plus" }, null, -1), I(" New ", -1)]])])]),
653
- default: Z(() => [
654
- y.value.length ? N("", !0) : (H(), P("div", et, " Add a Trilogy local server to browse files and run jobs. ")),
655
- b.value ? (H(), P("div", tt, [(H(!0), P(A, null, W(x.value, (e) => (H(), P("div", {
656
- key: e.id,
657
- class: "error-item"
658
- }, [F("span", nt, K(e.name) + ": " + K(q(s).errors[e.id]), 1), F("button", {
659
- onClick: (t) => q(s).clearStoreError(e.id),
660
- class: "clear-error"
661
- }, "x", 8, rt)]))), 128))])) : N("", !0),
662
- L(O, {
663
- "list-id": "jobs",
664
- ref_key: "mobileTree",
665
- ref: g,
666
- items: E.value,
667
- "id-field": "key",
668
- "label-field": "label",
669
- enabled: q(h),
670
- "is-branch": B,
671
- "is-selectable": B,
672
- onExpand: V,
673
- onSelect: le
674
- }, {
675
- item: Z(({ item: t }) => [(H(), M(Le, {
676
- key: t.key,
677
- item: t,
678
- "is-collapsed": q(T)(t.key),
679
- "active-jobs-key": e.activeJobsKey,
680
- onItemClick: ue,
681
- onItemToggle: R,
682
- onDeleteStore: q(ae),
683
- onRefreshStore: fe
684
- }, null, 8, [
685
- "item",
686
- "is-collapsed",
687
- "active-jobs-key",
688
- "onDeleteStore"
689
- ]))]),
690
- _: 1
691
- }, 8, ["items", "enabled"]),
692
- L(We, {
693
- show: m.value,
694
- onClose: n[1] ||= (e) => m.value = !1,
695
- onAdd: re
696
- }, null, 8, ["show"]),
697
- L(C, {
698
- show: q(ie),
699
- title: "Confirm Store Removal",
700
- message: "Remove this jobs store? Imported models remain untouched.",
701
- "confirm-label": "Remove",
702
- onClose: q(oe),
703
- onConfirm: q(ce)
704
- }, null, 8, [
705
- "show",
706
- "onClose",
707
- "onConfirm"
708
- ])
709
- ]),
710
- _: 1
711
- }));
712
- }
713
- }), [["__scopeId", "data-v-6c9c90f4"]]), at = {
714
- class: "popup-content",
715
- "data-testid": "dashboard-import-popup"
716
- }, ot = { class: "popup-header" }, st = { class: "popup-body" }, ct = { class: "import-mode-selector" }, lt = {
717
- key: 0,
718
- class: "input-group"
719
- }, ut = {
720
- key: 0,
721
- class: "error-message"
722
- }, dt = {
723
- key: 1,
724
- class: "input-group"
725
- }, ft = { class: "url-input-container" }, pt = ["disabled"], mt = {
726
- key: 0,
727
- class: "error-message"
728
- }, ht = {
729
- key: 1,
730
- class: "preview-container"
731
- }, gt = { class: "json-preview" }, _t = { class: "connection-selector" }, vt = { class: "form-row" }, yt = ["value"], bt = {
732
- key: 0,
733
- class: "form-row"
734
- }, xt = {
735
- key: 1,
736
- class: "form-row"
737
- }, St = { class: "form-row" }, Ct = { class: "form-row" }, wt = { class: "form-row" }, Tt = { class: "popup-footer" }, Et = ["disabled"], Dt = /*#__PURE__*/ e(/* @__PURE__ */ R({
738
- __name: "DashboardImportPopup",
739
- props: { isOpen: { type: Boolean } },
740
- emits: ["close"],
741
- setup(e, { emit: n }) {
742
- let r = n, i = z("dashboardStore"), a = z("connectionStore"), o = z("saveDashboards"), s = z("saveAll");
743
- if (!i || !a || !o || !s) throw Error("Required stores not provided");
744
- let c = U(""), l = U(""), u = U(null), d = U(!1), f = U(""), p = U("paste"), m = U(null), h = U({
745
- mdToken: "",
746
- projectId: "",
747
- username: "",
748
- password: "",
749
- account: "",
750
- sshPrivateKey: ""
751
- }), g = U(!0);
752
- function _() {
753
- if (!l.value) {
754
- g.value = !1;
755
- return;
756
- }
757
- if (l.value === "new-motherduck" && !h.value.mdToken) {
758
- g.value = !1;
759
- return;
760
- }
761
- if (l.value === "new-bigquery-oauth" && !h.value.projectId) {
762
- g.value = !1;
763
- return;
764
- }
765
- if (l.value === "new-snowflake" && (!h.value.username || !h.value.account || !h.value.sshPrivateKey)) {
766
- g.value = !1;
767
- return;
768
- }
769
- g.value = !0;
770
- }
771
- let v = async () => {
772
- if (!f.value) {
773
- m.value = "Please enter a URL", setTimeout(() => {
774
- m.value = null;
775
- }, 3e3);
776
- return;
777
- }
778
- d.value = !0, m.value = null;
779
- try {
780
- let e = await fetch(f.value);
781
- if (!e.ok) throw Error(`HTTP error! Status: ${e.status}`);
782
- let t = await e.text();
783
- c.value = t, d.value = !1;
784
- } catch (e) {
785
- console.error("Error fetching dashboard:", e), m.value = `Failed to fetch from URL: ${e instanceof Error ? e.message : "Unknown error"}`, d.value = !1, setTimeout(() => {
786
- m.value = null;
787
- }, 5e3);
788
- }
789
- }, y = async () => {
790
- try {
791
- let e = t.fromSerialized(JSON.parse(c.value));
792
- e.storage = "local";
793
- let n = l.value;
794
- if (n.startsWith("new-")) {
795
- let t = n.replace("new-", "");
796
- n = `dashboard-${e.name || "imported"}-connection`, a.connectionByName(n) || a.newConnection(n, t, {
797
- mdToken: h.value.mdToken,
798
- projectId: h.value.projectId,
799
- username: h.value.username,
800
- password: h.value.password,
801
- account: h.value.account,
802
- privateKey: h.value.sshPrivateKey
803
- });
804
- }
805
- let o = a.connectionByName(n);
806
- e.connection = n, o && (e.connectionId = o.id), e.id = Math.random().toString(36).substring(2, 15), i.addDashboard(e), b.value = !0, c.value = "", f.value = "", h.value = {
807
- mdToken: "",
808
- projectId: "",
809
- username: "",
810
- password: "",
811
- account: "",
812
- sshPrivateKey: ""
813
- }, await s(), setTimeout(() => {
814
- b.value = !1, r("close");
815
- }, 1500);
816
- } catch {
817
- u.value = "Invalid JSON format", setTimeout(() => {
818
- u.value = null;
819
- }, 3e3);
820
- }
821
- }, b = U(!1);
822
- return _(), (t, n) => e.isOpen ? (H(), P("div", {
823
- key: 0,
824
- class: "popup-overlay",
825
- onClick: n[11] ||= $((e) => r("close"), ["self"])
826
- }, [F("div", at, [
827
- F("div", ot, [n[12] ||= F("h3", null, "Import Dashboard", -1), F("button", {
828
- onClick: n[0] ||= (e) => r("close"),
829
- class: "close-button",
830
- "data-testid": "close-popup-button"
831
- }, " ✕ ")]),
832
- F("div", st, [
833
- F("div", ct, [F("button", {
834
- class: V(["mode-button", { active: p.value === "paste" }]),
835
- onClick: n[1] ||= (e) => p.value = "paste",
836
- "data-testid": "paste-mode-button"
837
- }, " Paste JSON ", 2), F("button", {
838
- class: V(["mode-button", { active: p.value === "url" }]),
839
- onClick: n[2] ||= (e) => p.value = "url",
840
- "data-testid": "url-mode-button"
841
- }, " From URL ", 2)]),
842
- p.value === "paste" ? (H(), P("div", lt, [
843
- n[13] ||= F("label", { for: "dashboard-json" }, "Paste Dashboard JSON", -1),
844
- Q(F("textarea", {
845
- id: "dashboard-json",
846
- "onUpdate:modelValue": n[3] ||= (e) => c.value = e,
847
- placeholder: "Paste your dashboard JSON here",
848
- rows: "16",
849
- class: "dashboard-textarea",
850
- "data-testid": "dashboard-json-input"
851
- }, null, 512), [[Y, c.value]]),
852
- u.value ? (H(), P("div", ut, K(u.value), 1)) : N("", !0)
853
- ])) : N("", !0),
854
- p.value === "url" ? (H(), P("div", dt, [
855
- n[15] ||= F("label", { for: "dashboard-url" }, "Dashboard URL", -1),
856
- F("div", ft, [Q(F("input", {
857
- type: "text",
858
- id: "dashboard-url",
859
- "onUpdate:modelValue": n[4] ||= (e) => f.value = e,
860
- placeholder: "https://example.com/dashboard.json",
861
- class: "url-input",
862
- "data-testid": "dashboard-url-input"
863
- }, null, 512), [[Y, f.value]]), F("button", {
864
- onClick: v,
865
- class: "fetch-button",
866
- disabled: d.value,
867
- "data-testid": "fetch-url-button"
868
- }, K(d.value ? "Loading..." : "Fetch"), 9, pt)]),
869
- m.value ? (H(), P("div", mt, K(m.value), 1)) : N("", !0),
870
- c.value && p.value === "url" ? (H(), P("div", ht, [n[14] ||= F("label", null, "Dashboard JSON Preview", -1), F("div", gt, [F("pre", null, K(c.value.length > 500 ? c.value.substring(0, 500) + "..." : c.value), 1)])])) : N("", !0)
871
- ])) : N("", !0)
872
- ]),
873
- F("div", _t, [
874
- F("div", vt, [n[21] ||= F("label", { for: "connection-select" }, "Assign To Connection", -1), Q(F("select", {
875
- id: "connection-select",
876
- "onUpdate:modelValue": n[5] ||= (e) => l.value = e,
877
- class: "connection-dropdown",
878
- "data-testid": "connection-select",
879
- onChange: _
880
- }, [
881
- n[16] ||= F("option", {
882
- value: "",
883
- disabled: ""
884
- }, "-- Select Connection --", -1),
885
- (H(!0), P(A, null, W(q(a).connections, (e) => (H(), P("option", {
886
- key: e.name,
887
- value: e.name
888
- }, K(e.name), 9, yt))), 128)),
889
- n[17] ||= F("option", { value: "new-duckdb" }, "New DuckDB", -1),
890
- n[18] ||= F("option", { value: "new-motherduck" }, "New MotherDuck", -1),
891
- n[19] ||= F("option", { value: "new-bigquery-oauth" }, "New Bigquery Oauth", -1),
892
- n[20] ||= F("option", { value: "new-snowflake" }, "New Snowflake", -1)
893
- ], 544), [[J, l.value]])]),
894
- l.value === "new-motherduck" ? (H(), P("div", bt, [n[22] ||= F("label", { for: "md-token" }, "MotherDuck Token", -1), Q(F("input", {
895
- type: "text",
896
- "onUpdate:modelValue": n[6] ||= (e) => h.value.mdToken = e,
897
- id: "md-token",
898
- placeholder: "MotherDuck Token",
899
- class: "connection-input",
900
- onInput: _
901
- }, null, 544), [[
902
- Y,
903
- h.value.mdToken,
904
- void 0,
905
- { trim: !0 }
906
- ]])])) : N("", !0),
907
- l.value === "new-bigquery-oauth" ? (H(), P("div", xt, [n[23] ||= F("label", { for: "project-id" }, "BigQuery Project ID", -1), Q(F("input", {
908
- type: "text",
909
- "onUpdate:modelValue": n[7] ||= (e) => h.value.projectId = e,
910
- id: "project-id",
911
- placeholder: "Billing Project ID",
912
- class: "connection-input",
913
- onInput: _
914
- }, null, 544), [[
915
- Y,
916
- h.value.projectId,
917
- void 0,
918
- { trim: !0 }
919
- ]])])) : N("", !0),
920
- l.value === "new-snowflake" ? (H(), P(A, { key: 2 }, [
921
- F("div", St, [n[24] ||= F("label", { for: "snowflake-username" }, "Username", -1), Q(F("input", {
922
- type: "text",
923
- "onUpdate:modelValue": n[8] ||= (e) => h.value.username = e,
924
- id: "snowflake-username",
925
- placeholder: "Snowflake Username",
926
- class: "connection-input",
927
- onInput: _
928
- }, null, 544), [[
929
- Y,
930
- h.value.username,
931
- void 0,
932
- { trim: !0 }
933
- ]])]),
934
- F("div", Ct, [n[25] ||= F("label", { for: "snowflake-account" }, "Account", -1), Q(F("input", {
935
- type: "text",
936
- "onUpdate:modelValue": n[9] ||= (e) => h.value.account = e,
937
- id: "snowflake-account",
938
- placeholder: "Snowflake Account",
939
- class: "connection-input",
940
- onInput: _
941
- }, null, 544), [[
942
- Y,
943
- h.value.account,
944
- void 0,
945
- { trim: !0 }
946
- ]])]),
947
- F("div", wt, [n[26] ||= F("label", { for: "snowflake-ssh-private-key" }, "Private Key", -1), Q(F("input", {
948
- type: "text",
949
- "onUpdate:modelValue": n[10] ||= (e) => h.value.sshPrivateKey = e,
950
- id: "snowflake-ssh-private-key",
951
- placeholder: "Private Key",
952
- class: "connection-input",
953
- onInput: _
954
- }, null, 544), [[
955
- Y,
956
- h.value.sshPrivateKey,
957
- void 0,
958
- { trim: !0 }
959
- ]])])
960
- ], 64)) : N("", !0)
961
- ]),
962
- F("div", Tt, [F("button", {
963
- onClick: y,
964
- class: "copy-button",
965
- "data-testid": "import-dashboard-button",
966
- disabled: !c.value || !l.value || d.value || !g.value
967
- }, K(b.value ? "Imported!" : "Import"), 9, Et)])
968
- ])])) : N("", !0);
969
- }
970
- }), [["__scopeId", "data-v-3448e3ad"]]), Ot = {
971
- name: "DashboardListItem",
972
- props: {
973
- item: {
974
- type: Object,
975
- required: !0
976
- },
977
- isActive: {
978
- type: Boolean,
979
- default: !1
980
- },
981
- isCollapsed: {
982
- type: Boolean,
983
- default: !1
984
- }
985
- },
986
- emits: [
987
- "click",
988
- "delete",
989
- "clone",
990
- "toggle"
991
- ],
992
- setup(e) {
993
- let t = z("connectionStore"), n = z("dashboardStore"), r = _();
994
- if (!t || !n) throw Error("Connection/Dashboard stores is not provided!");
995
- let i = j(() => e.item.type === "connection" && (e.item.connectionId && t.connections[e.item.connectionId] || t.connectionByName(e.item.label)) || null);
996
- return {
997
- isMobile: r,
998
- dashboardStore: n,
999
- connectionInfo: i,
1000
- connectionStatus: j(() => {
1001
- let e = i.value;
1002
- return e ? e.running ? "running" : e.connected ? "connected" : "disabled" : "disabled";
1003
- }),
1004
- contextMenuItems: j(() => e.item.type === "connection" ? [{
1005
- id: "new-dashboard",
1006
- label: "New dashboard",
1007
- icon: "mdi-table-plus"
1008
- }] : e.item.type === "investigation" ? [
1009
- {
1010
- id: "promote-investigation",
1011
- label: "Promote to dashboard",
1012
- icon: "mdi-arrow-up-bold"
1013
- },
1014
- {
1015
- id: "clone-dashboard",
1016
- label: "Clone",
1017
- icon: "mdi-content-copy"
1018
- },
1019
- {
1020
- id: "delete-separator",
1021
- kind: "separator"
1022
- },
1023
- {
1024
- id: "delete-dashboard",
1025
- label: "Delete investigation",
1026
- icon: "mdi-trash-can-outline",
1027
- danger: !0
1028
- }
1029
- ] : e.item.type === "dashboard" ? [
1030
- {
1031
- id: "clone-dashboard",
1032
- label: "Clone dashboard",
1033
- icon: "mdi-content-copy"
1034
- },
1035
- {
1036
- id: "delete-separator",
1037
- kind: "separator"
1038
- },
1039
- {
1040
- id: "delete-dashboard",
1041
- label: "Delete dashboard",
1042
- icon: "mdi-trash-can-outline",
1043
- danger: !0
1044
- }
1045
- ] : [])
1046
- };
1047
- },
1048
- methods: {
1049
- handleClick() {
1050
- this.$emit("click", this.item);
1051
- },
1052
- handleToggle() {
1053
- this.$emit("toggle", this.item);
1054
- },
1055
- handleDelete() {
1056
- this.$emit("delete", this.item.dashboard);
1057
- },
1058
- handleClone() {
1059
- this.dashboardStore.cloneDashboard(this.item.id);
1060
- },
1061
- handleContextMenuItemClick(e) {
1062
- switch (e.id) {
1063
- case "new-dashboard": {
1064
- let e = `${this.item.label} Dashboard ${Date.now().toString().slice(-4)}`, t = this.dashboardStore.newDashboard(e, this.item.connectionId || this.item.label);
1065
- this.dashboardStore.setActiveDashboard(t.id);
1066
- break;
1067
- }
1068
- case "clone-dashboard":
1069
- this.handleClone();
1070
- break;
1071
- case "delete-dashboard":
1072
- this.handleDelete();
1073
- break;
1074
- case "promote-investigation":
1075
- this.dashboardStore.promoteDashboard(this.item.id);
1076
- break;
1077
- }
1078
- }
1079
- },
1080
- components: {
1081
- SidebarItem: E,
1082
- Tooltip: h,
1083
- StatusIcon: T,
1084
- SidebarOverflowMenu: ne
1085
- }
1086
- }, kt = {
1087
- key: 0,
1088
- class: "text-light connection-model"
1089
- }, At = { class: "dashboard-actions" }, jt = ["data-testid"];
1090
- function Mt(e, t, n, r, i, a) {
1091
- let o = G("tooltip"), s = G("status-icon"), c = G("sidebar-overflow-menu"), l = G("sidebar-item");
1092
- return n.item.type === "creator" ? (H(), P("div", {
1093
- key: 1,
1094
- "data-testid": `dashboard-list-id-${n.item.key}`,
1095
- class: "creator-item",
1096
- onClick: t[0] ||= (...e) => a.handleClick && a.handleClick(...e)
1097
- }, K(n.item.label), 9, jt)) : (H(), M(l, {
1098
- key: 0,
1099
- "item-id": n.item.key,
1100
- name: n.item.label,
1101
- indent: n.item.indent,
1102
- "is-selected": n.isActive,
1103
- "is-collapsible": ![
1104
- "dashboard",
1105
- "investigation",
1106
- "creator"
1107
- ].includes(n.item.type) || n.item.hasInvestigations,
1108
- "is-collapsed": n.isCollapsed,
1109
- itemType: "dashboard",
1110
- onClick: a.handleClick,
1111
- onToggle: a.handleToggle
1112
- }, {
1113
- icon: Z(() => [n.item.type === "investigation" ? (H(), M(o, {
1114
- key: 0,
1115
- content: "Investigation",
1116
- position: "right"
1117
- }, {
1118
- default: Z(() => [...t[1] ||= [F("i", { class: "mdi mdi-source-branch node-icon investigation-icon" }, null, -1)]]),
1119
- _: 1
1120
- })) : n.item.type === "dashboard" ? (H(), M(o, {
1121
- key: 1,
1122
- content: "Dashboard",
1123
- position: "right"
1124
- }, {
1125
- default: Z(() => [...t[2] ||= [F("i", { class: "mdi mdi-view-dashboard node-icon" }, null, -1)]]),
1126
- _: 1
1127
- })) : N("", !0)]),
1128
- name: Z(() => [I(K(n.item.label) + " ", 1), n.item.type === "connection" ? (H(), P("span", kt, " (" + K(r.connectionInfo?.model ? r.connectionInfo?.model : "No Model Set") + ") ", 1)) : N("", !0)]),
1129
- "extra-content": Z(() => [F("div", At, [n.item.type === "connection" ? (H(), P(A, { key: 0 }, [L(s, { status: r.connectionStatus }, null, 8, ["status"]), L(c, {
1130
- items: r.contextMenuItems,
1131
- tooltip: "Connection actions",
1132
- onSelect: a.handleContextMenuItemClick
1133
- }, null, 8, ["items", "onSelect"])], 64)) : N("", !0), n.item.type === "dashboard" || n.item.type === "investigation" ? (H(), M(c, {
1134
- key: 1,
1135
- items: r.contextMenuItems,
1136
- tooltip: n.item.type === "investigation" ? "Investigation actions" : "Dashboard actions",
1137
- onSelect: a.handleContextMenuItemClick
1138
- }, null, 8, [
1139
- "items",
1140
- "tooltip",
1141
- "onSelect"
1142
- ])) : N("", !0)])]),
1143
- _: 1
1144
- }, 8, [
1145
- "item-id",
1146
- "name",
1147
- "indent",
1148
- "is-selected",
1149
- "is-collapsible",
1150
- "is-collapsed",
1151
- "onClick",
1152
- "onToggle"
1153
- ]));
1154
- }
1155
- var Nt = /*#__PURE__*/ e(Ot, [["render", Mt], ["__scopeId", "data-v-28e46aa7"]]);
1156
- //#endregion
1157
- //#region components/sidebar/DashboardList.vue?vue&type=script&lang.ts
1158
- function Pt(e, t, n) {
1159
- let r = [], i = {}, a = {};
1160
- return e.forEach((e) => {
1161
- if (e.deleted) return;
1162
- if (e.parentDashboardId) {
1163
- a[e.parentDashboardId] || (a[e.parentDashboardId] = []), a[e.parentDashboardId].push(e);
1164
- return;
1165
- }
1166
- let t = e.storage || "local";
1167
- i[t] || (i[t] = []), i[t].push(e);
1168
- }), Object.entries(i).forEach(([e, i]) => {
1169
- let o = `s-${e}`;
1170
- if (r.push({
1171
- type: "storage",
1172
- label: e === "local" ? "Browser Storage" : "Remote Storage",
1173
- key: o,
1174
- id: o,
1175
- indent: 0
1176
- }), !t(o)) {
1177
- let o = {};
1178
- i.forEach((e) => {
1179
- let t = e.connectionId || e.connection || "default";
1180
- o[t] || (o[t] = {
1181
- label: n.connections[t]?.name || e.connection || t,
1182
- dashboards: []
1183
- }), o[t].dashboards.push(e);
1184
- }), Object.entries(o).forEach(([n, i]) => {
1185
- let o = `c-${e}-${n}`;
1186
- r.push({
1187
- type: "connection",
1188
- id: o,
1189
- label: i.label,
1190
- key: o,
1191
- indent: 1,
1192
- connectionId: n
1193
- }), t(o) || i.dashboards.forEach((e) => {
1194
- let n = (a[e.id] || []).length > 0, i = `d-${e.id}`;
1195
- r.push({
1196
- type: "dashboard",
1197
- label: e.name,
1198
- id: e.id,
1199
- key: i,
1200
- indent: 2,
1201
- dashboard: e,
1202
- hasInvestigations: n
1203
- }), n && !t(i) && a[e.id].forEach((e) => {
1204
- r.push({
1205
- type: "investigation",
1206
- label: e.investigationName || e.name,
1207
- id: e.id,
1208
- key: `i-${e.id}`,
1209
- indent: 3,
1210
- dashboard: e
1211
- });
1212
- });
1213
- });
1214
- });
1215
- }
1216
- }), r;
1217
- }
1218
- var Ft = {
1219
- name: "DashboardList",
1220
- props: {
1221
- activeDashboardKey: String,
1222
- testTag: {
1223
- type: String,
1224
- default: ""
1225
- }
1226
- },
1227
- setup(e) {
1228
- let t = z("dashboardStore"), n = z("connectionStore"), r = z("chatStore", null), i = z("saveDashboards");
1229
- if (!t || !n || !i) throw Error("Dashboard or connection store is not provided!");
1230
- let a = U(!1), o = U(!1), s = _(), c = U(null), l = U(!0), u = f(p.DASHBOARD) || "", d = (e) => {
1231
- let t = e.storage || "local", n = e.connectionId || e.connection || "default";
1232
- return [`s-${t}`, `c-${t}-${n}`];
1233
- }, m = j(() => {
1234
- let n = Object.values(t.dashboards).filter((e) => !e.deleted), r = e.activeDashboardKey || u, i = r ? n.find((e) => e.id === r) : void 0;
1235
- if (i) return new Set(d(i));
1236
- let a = new Set(n.map((e) => `s-${e.storage || "local"}`));
1237
- return a.size === 1 ? a : /* @__PURE__ */ new Set();
1238
- }), { overrides: h, isCollapsed: g, toggle: v } = k((e) => e.startsWith("d-") || m.value.has(e)), y = j(() => Pt(Object.values(t.dashboards), g, n)), { isOpen: b, openConfirmation: x, closeConfirmation: S, confirm: C } = se((e) => {
1239
- r && e.chatId && r.chats[e.chatId] && r.removeChat(e.chatId), e.delete();
1240
- });
1241
- return {
1242
- connectionStore: n,
1243
- dashboardStore: t,
1244
- contentList: y,
1245
- toggleCollapse: v,
1246
- collapsed: h,
1247
- isCollapsed: g,
1248
- creatorVisible: a,
1249
- importPopupVisible: o,
1250
- saveDashboards: i,
1251
- showDeleteConfirmationState: b,
1252
- showDeleteConfirmation: x,
1253
- cancelDelete: S,
1254
- confirmDelete: C,
1255
- isMobile: s,
1256
- mobileTree: c,
1257
- mobileTreeAtRoot: l
1258
- };
1259
- },
1260
- methods: {
1261
- dashboardCreated(e) {
1262
- console.log("Dashboard created event received:", e), this.$emit("dashboard-key-selected", e);
1263
- },
1264
- clickAction(e) {
1265
- e.type === "dashboard" || e.type === "investigation" ? this.$emit("dashboard-key-selected", e.id) : this.toggleCollapse(e.key);
1266
- },
1267
- isDashboardBranch(e) {
1268
- return ["storage", "connection"].includes(e.type) || e.type === "dashboard" && e.hasInvestigations;
1269
- },
1270
- expandMobileBranch(e) {
1271
- this.isCollapsed(e.key) && this.toggleCollapse(e.key);
1272
- },
1273
- selectMobileItem(e) {
1274
- this.clickAction(e);
1275
- },
1276
- handleDashboardTreeClick(e) {
1277
- this.isMobile ? this.$refs.mobileTree?.openItem(e) : this.clickAction(e);
1278
- },
1279
- handleDashboardTreeToggle(e) {
1280
- this.isMobile ? this.$refs.mobileTree?.openItem(e) : this.toggleCollapse(e.key);
1281
- }
1282
- },
1283
- components: {
1284
- DashboardCreatorInline: y,
1285
- DashboardImportPopup: Dt,
1286
- DashboardListItem: Nt,
1287
- SidebarList: D,
1288
- LoadingButton: g,
1289
- ConfirmDialog: C,
1290
- MobileTreeList: O
1291
- }
1292
- }, It = { class: "dashboards-header" }, Lt = {
1293
- key: 0,
1294
- class: "font-sans sidebar-header"
1295
- }, Rt = ["data-testid"], zt = {
1296
- key: 0,
1297
- class: "button-container"
1298
- };
1299
- function Bt(e, t, n, r, i, a) {
1300
- let o = G("dashboard-creator-inline"), s = G("dashboard-import-popup"), c = G("dashboard-list-item"), l = G("mobile-tree-list"), u = G("ConfirmDialog"), d = G("sidebar-list");
1301
- return H(), M(d, { title: "Dashboards" }, {
1302
- header: Z(() => [F("div", It, [r.isMobile ? N("", !0) : (H(), P("h3", Lt, "Dashboards")), F("button", {
1303
- class: "sidebar-control-button sidebar-header-action sidebar-primary-create",
1304
- onClick: t[0] ||= (e) => r.creatorVisible = !r.creatorVisible,
1305
- "data-testid": n.testTag ? `dashboard-creator-add-${n.testTag}` : "dashboard-creator-add"
1306
- }, [t[5] ||= F("i", { class: "mdi mdi-plus" }, null, -1), I(" " + K(r.creatorVisible ? "Close" : "New"), 1)], 8, Rt)])]),
1307
- actions: Z(() => [
1308
- !r.isMobile || r.mobileTreeAtRoot ? (H(), P("div", zt, [F("button", {
1309
- class: "sidebar-control-button sidebar-header-action",
1310
- onClick: t[1] ||= (e) => r.importPopupVisible = !0,
1311
- "data-testid": "dashboard-import-button"
1312
- }, " Import ")])) : N("", !0),
1313
- L(o, {
1314
- visible: r.creatorVisible,
1315
- onClose: t[2] ||= (e) => r.creatorVisible = !r.creatorVisible,
1316
- testTag: n.testTag,
1317
- onDashboardCreated: a.dashboardCreated
1318
- }, null, 8, [
1319
- "visible",
1320
- "testTag",
1321
- "onDashboardCreated"
1322
- ]),
1323
- L(s, {
1324
- isOpen: r.importPopupVisible,
1325
- onClose: t[3] ||= (e) => r.importPopupVisible = !1
1326
- }, null, 8, ["isOpen"])
1327
- ]),
1328
- default: Z(() => [L(l, {
1329
- "list-id": "dashboards",
1330
- ref: "mobileTree",
1331
- items: r.contentList,
1332
- "id-field": "key",
1333
- "label-field": "label",
1334
- enabled: r.isMobile,
1335
- "is-branch": a.isDashboardBranch,
1336
- "is-selectable": (e) => e.type === "dashboard",
1337
- onExpand: a.expandMobileBranch,
1338
- onSelect: a.selectMobileItem,
1339
- onViewChange: t[4] ||= (e) => r.mobileTreeAtRoot = e
1340
- }, {
1341
- item: Z(({ item: e }) => [(H(), M(c, {
1342
- key: e.key,
1343
- item: e,
1344
- "is-active": n.activeDashboardKey === e.id,
1345
- "is-collapsed": r.isCollapsed(e.key),
1346
- onClick: (t) => a.handleDashboardTreeClick(e),
1347
- onToggle: (t) => a.handleDashboardTreeToggle(e),
1348
- onDelete: r.showDeleteConfirmation
1349
- }, null, 8, [
1350
- "item",
1351
- "is-active",
1352
- "is-collapsed",
1353
- "onClick",
1354
- "onToggle",
1355
- "onDelete"
1356
- ]))]),
1357
- _: 1
1358
- }, 8, [
1359
- "items",
1360
- "enabled",
1361
- "is-branch",
1362
- "is-selectable",
1363
- "onExpand",
1364
- "onSelect"
1365
- ]), L(u, {
1366
- show: r.showDeleteConfirmationState,
1367
- title: "Confirm Deletion",
1368
- message: "Are you sure you want to delete this dashboard? Contents cannot be recovered.",
1369
- "confirm-label": "Delete",
1370
- "cancel-test-id": "cancel-dashboard-deletion",
1371
- "confirm-test-id": "confirm-dashboard-deletion",
1372
- onClose: r.cancelDelete,
1373
- onConfirm: r.confirmDelete
1374
- }, null, 8, [
1375
- "show",
1376
- "onClose",
1377
- "onConfirm"
1378
- ])]),
1379
- _: 1
1380
- });
1381
- }
1382
- var Vt = /*#__PURE__*/ e(Ft, [["render", Bt], ["__scopeId", "data-v-04081e74"]]), Ht = {
1383
- key: 1,
1384
- class: "right-pad"
1385
- }, Ut = {
1386
- key: 0,
1387
- class: "tag-container"
1388
- }, Wt = {
1389
- key: 1,
1390
- class: "tag-container hover-icon"
1391
- }, Gt = {
1392
- key: 2,
1393
- class: "tag-container"
1394
- }, Kt = ["data-testid"], qt = /*#__PURE__*/ e(/* @__PURE__ */ R({
1395
- __name: "CommunityModelListItem",
1396
- props: {
1397
- item: {},
1398
- activeModel: { default: "" },
1399
- isCollapsed: {
1400
- type: Boolean,
1401
- default: !1
1402
- },
1403
- isMobile: {
1404
- type: Boolean,
1405
- default: !1
1406
- },
1407
- mobileTreeMode: {
1408
- type: Boolean,
1409
- default: !1
1410
- }
1411
- },
1412
- emits: [
1413
- "item-click",
1414
- "model-selected",
1415
- "model-details",
1416
- "item-toggle",
1417
- "delete-store",
1418
- "mobile-item-click"
1419
- ],
1420
- setup(e, { emit: t }) {
1421
- let n = e, r = t, i = c(), a = () => {
1422
- if (n.mobileTreeMode) {
1423
- r("mobile-item-click", n.item);
1424
- return;
1425
- }
1426
- n.item.type === "model" ? r("model-selected", n.item.model, n.item.key, n.item.modelRoot) : r("item-click", n.item.type, n.item.key, n.item.modelRoot);
1427
- }, o = () => {
1428
- ["model"].includes(n.item.type) || r("item-toggle", n.item.type, n.item.key, n.item.modelRoot);
1429
- }, l = () => "", d = (e) => e.id === s.id, f = (e) => i.getStoreStatus(e.id), p = (e) => {
1430
- let t = i.errors[e.id];
1431
- if (t) return `Connection failed: ${t}`;
1432
- if (i.getStoreStatus(e.id) === "connected") return `Connected: ${u(e)}`;
1433
- };
1434
- return (t, n) => (H(), M(E, {
1435
- "item-id": e.item.key,
1436
- name: e.item.label,
1437
- indent: e.item.indent,
1438
- "is-selected": e.activeModel === e.item.key,
1439
- "is-collapsible": !["model"].includes(e.item.type),
1440
- "is-collapsed": e.isCollapsed,
1441
- icon: l(),
1442
- itemType: "community",
1443
- onClick: a,
1444
- onToggle: o
1445
- }, {
1446
- icon: Z(() => [e.item.type === "root" ? (H(), P("i", {
1447
- key: 0,
1448
- class: V(["mdi sidebar-icon", e.item.store?.type === "generic" ? "mdi-server-network" : "mdi-source-repository"])
1449
- }, null, 2)) : e.item.type === "engine" ? (H(), P("span", Ht, [L(re, { "connection-type": e.item.label }, null, 8, ["connection-type"])])) : N("", !0)]),
1450
- "extra-content": Z(() => [e.item.type === "model" ? (H(), P("span", Ut, [(H(!0), P(A, null, W(e.item.model?.tags || [], (e) => (H(), M(ie, {
1451
- key: e,
1452
- label: e
1453
- }, null, 8, ["label"]))), 128))])) : e.item.type === "engine" ? (H(), P("span", Wt)) : e.item.type === "root" ? (H(), P("span", Gt, [e.item.store && !d(e.item.store) ? (H(), M(h, {
1454
- key: 0,
1455
- content: "Remove Store",
1456
- position: "left"
1457
- }, {
1458
- default: Z(() => [F("span", {
1459
- class: "remove-btn hover-icon sidebar-icon-button danger",
1460
- onClick: n[0] ||= $((t) => r("delete-store", e.item.store), ["stop"]),
1461
- "data-testid": `delete-store-${e.item.store.id}`
1462
- }, [...n[1] ||= [F("i", { class: "mdi mdi-trash-can-outline" }, null, -1)]], 8, Kt)]),
1463
- _: 1
1464
- })) : N("", !0), e.item.store ? (H(), M(T, {
1465
- key: 1,
1466
- status: f(e.item.store),
1467
- message: p(e.item.store),
1468
- "test-name": e.item.store.id
1469
- }, null, 8, [
1470
- "status",
1471
- "message",
1472
- "test-name"
1473
- ])) : N("", !0)])) : N("", !0)]),
1474
- _: 1
1475
- }, 8, [
1476
- "item-id",
1477
- "name",
1478
- "indent",
1479
- "is-selected",
1480
- "is-collapsible",
1481
- "is-collapsed",
1482
- "icon"
1483
- ]));
1484
- }
1485
- }), [["__scopeId", "data-v-8680201b"]]), Jt = {
1486
- name: "AddStoreModal",
1487
- components: { ModalDialog: m },
1488
- props: {
1489
- show: {
1490
- type: Boolean,
1491
- required: !0
1492
- },
1493
- loading: {
1494
- type: Boolean,
1495
- default: !1
1496
- }
1497
- },
1498
- emits: ["close", "add"],
1499
- setup(e, { emit: t }) {
1500
- let n = U("generic"), r = U(""), i = U(""), a = U(""), s = U(""), c = U("main"), u = U(null), f = U(!1), p = j(() => {
1501
- let e = typeof window < "u" ? `${window.location.origin}${window.location.pathname}` : "";
1502
- return e ? `trilogy serve . --studio-url ${e}` : "trilogy serve .";
1503
- });
1504
- return me(() => e.show, (e) => {
1505
- e && (n.value = "generic", r.value = "", i.value = "", a.value = "", s.value = "", c.value = "main", u.value = null, f.value = !1);
1506
- }), {
1507
- storeType: n,
1508
- storeName: r,
1509
- baseUrl: i,
1510
- owner: a,
1511
- repo: s,
1512
- branch: c,
1513
- error: u,
1514
- handleSubmit: async () => {
1515
- u.value = null;
1516
- try {
1517
- if (n.value === "generic" || n.value === "static") {
1518
- if (!i.value) {
1519
- u.value = "Please fill in all required fields";
1520
- return;
1521
- }
1522
- t("add", (n.value === "static" ? l : d)(i.value, r.value || void 0));
1523
- } else {
1524
- if (!a.value || !s.value || !c.value) {
1525
- u.value = "Please fill in all required fields";
1526
- return;
1527
- }
1528
- t("add", o(a.value.trim(), s.value.trim(), c.value.trim(), r.value || void 0));
1529
- }
1530
- } catch (e) {
1531
- u.value = e instanceof Error ? e.message : "Failed to add store";
1532
- }
1533
- },
1534
- serveCommand: p,
1535
- copyServeCommand: async () => {
1536
- try {
1537
- await navigator.clipboard.writeText(p.value), f.value = !0, setTimeout(() => {
1538
- f.value = !1;
1539
- }, 2e3);
1540
- } catch (e) {
1541
- console.error("Failed to copy serve command:", e);
1542
- }
1543
- },
1544
- copiedCommand: f
1545
- };
1546
- }
1547
- }, Yt = { class: "form-group" }, Xt = { class: "form-group" }, Zt = { class: "form-group" }, Qt = { class: "form-group" }, $t = { class: "form-group" }, en = {
1548
- class: "cli-tip",
1549
- "data-testid": "add-store-cli-tip"
1550
- }, tn = { class: "cli-tip-command" }, nn = { "data-testid": "add-store-cli-command" }, rn = ["title"], an = { class: "form-group" }, on = { class: "form-group" }, sn = { class: "form-group" }, cn = { class: "form-group" }, ln = {
1551
- key: 3,
1552
- class: "form-error",
1553
- "data-testid": "add-store-error"
1554
- }, un = { class: "dialog-actions" }, dn = ["disabled"];
1555
- function fn(e, t, n, r, i, a) {
1556
- let o = G("ModalDialog");
1557
- return H(), M(o, {
1558
- show: n.show,
1559
- title: "Add Model Store",
1560
- "test-id": "add-store-modal",
1561
- onClose: t[12] ||= (t) => e.$emit("close")
1562
- }, {
1563
- default: Z(() => [F("form", { onSubmit: t[11] ||= $((...e) => r.handleSubmit && r.handleSubmit(...e), ["prevent"]) }, [
1564
- F("div", Yt, [t[14] ||= F("label", null, [I("Store Type: "), F("span", { class: "required" }, "*")], -1), Q(F("select", {
1565
- "onUpdate:modelValue": t[0] ||= (e) => r.storeType = e,
1566
- "data-testid": "store-type-select"
1567
- }, [...t[13] ||= [
1568
- F("option", { value: "generic" }, "Trilogy serve (API)", -1),
1569
- F("option", { value: "static" }, "Static files (URL)", -1),
1570
- F("option", { value: "github" }, "GitHub repository", -1)
1571
- ]], 512), [[J, r.storeType]])]),
1572
- r.storeType === "static" ? (H(), P(A, { key: 0 }, [F("div", Xt, [t[15] ||= F("label", null, "Store Name:", -1), Q(F("input", {
1573
- "onUpdate:modelValue": t[1] ||= (e) => r.storeName = e,
1574
- type: "text",
1575
- placeholder: "Optional, defaults to the store URL",
1576
- "data-testid": "store-name-input"
1577
- }, null, 512), [[Y, r.storeName]])]), F("div", Zt, [
1578
- t[16] ||= F("label", null, [I("Base URL: "), F("span", { class: "required" }, "*")], -1),
1579
- Q(F("input", {
1580
- "onUpdate:modelValue": t[2] ||= (e) => r.baseUrl = e,
1581
- type: "url",
1582
- placeholder: "e.g., https://storage.googleapis.com/my-bucket/models",
1583
- "data-testid": "store-url-input",
1584
- required: ""
1585
- }, null, 512), [[Y, r.baseUrl]]),
1586
- t[17] ||= F("small", null, "Any origin serving index.json plus model files: a GCS or S3 bucket, a CDN, GitHub Pages. Models are browsed and imported as local copies.", -1)
1587
- ])], 64)) : N("", !0),
1588
- r.storeType === "generic" ? (H(), P(A, { key: 1 }, [
1589
- F("div", Qt, [t[18] ||= F("label", null, "Store Name:", -1), Q(F("input", {
1590
- "onUpdate:modelValue": t[3] ||= (e) => r.storeName = e,
1591
- type: "text",
1592
- placeholder: "Optional, defaults to the store URL",
1593
- "data-testid": "store-name-input"
1594
- }, null, 512), [[Y, r.storeName]])]),
1595
- F("div", $t, [
1596
- t[19] ||= F("label", null, [I("Base URL: "), F("span", { class: "required" }, "*")], -1),
1597
- Q(F("input", {
1598
- "onUpdate:modelValue": t[4] ||= (e) => r.baseUrl = e,
1599
- type: "url",
1600
- placeholder: "e.g., http://localhost:8100",
1601
- "data-testid": "store-url-input",
1602
- required: ""
1603
- }, null, 512), [[Y, r.baseUrl]]),
1604
- t[20] ||= F("small", null, "URL should serve an index.json file at /index.json", -1)
1605
- ]),
1606
- F("div", en, [
1607
- t[21] ||= F("div", { class: "cli-tip-title" }, [F("i", { class: "mdi mdi-lightbulb-on" }), I(" Serving a local model? ")], -1),
1608
- t[22] ||= F("p", { class: "cli-tip-body" }, " Run this in your model directory. The Trilogy CLI serves it over HTTP and prints a link that opens the model back in this studio. ", -1),
1609
- F("div", tn, [F("code", nn, K(r.serveCommand), 1), F("button", {
1610
- type: "button",
1611
- class: "cli-tip-copy",
1612
- title: r.copiedCommand ? "Copied" : "Copy command",
1613
- "data-testid": "add-store-cli-copy",
1614
- onClick: t[5] ||= (...e) => r.copyServeCommand && r.copyServeCommand(...e)
1615
- }, [F("i", { class: V(["mdi", r.copiedCommand ? "mdi-check" : "mdi-content-copy"]) }, null, 2)], 8, rn)]),
1616
- t[23] ||= F("small", null, "Then paste the URL it prints above, or just follow the link.", -1)
1617
- ])
1618
- ], 64)) : N("", !0),
1619
- r.storeType === "github" ? (H(), P(A, { key: 2 }, [
1620
- F("div", an, [t[24] ||= F("label", null, "Display Name:", -1), Q(F("input", {
1621
- "onUpdate:modelValue": t[6] ||= (e) => r.storeName = e,
1622
- type: "text",
1623
- placeholder: "Optional, defaults to owner/repo",
1624
- "data-testid": "store-name-input"
1625
- }, null, 512), [[Y, r.storeName]])]),
1626
- F("div", on, [t[25] ||= F("label", null, [I("Repository Owner: "), F("span", { class: "required" }, "*")], -1), Q(F("input", {
1627
- "onUpdate:modelValue": t[7] ||= (e) => r.owner = e,
1628
- type: "text",
1629
- placeholder: "e.g., trilogy-data",
1630
- "data-testid": "github-owner-input",
1631
- required: ""
1632
- }, null, 512), [[Y, r.owner]])]),
1633
- F("div", sn, [t[26] ||= F("label", null, [I("Repository Name: "), F("span", { class: "required" }, "*")], -1), Q(F("input", {
1634
- "onUpdate:modelValue": t[8] ||= (e) => r.repo = e,
1635
- type: "text",
1636
- placeholder: "e.g., trilogy-public-models",
1637
- "data-testid": "github-repo-input",
1638
- required: ""
1639
- }, null, 512), [[Y, r.repo]])]),
1640
- F("div", cn, [
1641
- t[27] ||= F("label", null, [I("Branch: "), F("span", { class: "required" }, "*")], -1),
1642
- Q(F("input", {
1643
- "onUpdate:modelValue": t[9] ||= (e) => r.branch = e,
1644
- type: "text",
1645
- placeholder: "e.g., main",
1646
- "data-testid": "github-branch-input",
1647
- required: ""
1648
- }, null, 512), [[Y, r.branch]]),
1649
- t[28] ||= F("small", null, "Reads the repository's studio/index.json. Public repositories only.", -1)
1650
- ])
1651
- ], 64)) : N("", !0),
1652
- r.error ? (H(), P("div", ln, K(r.error), 1)) : N("", !0),
1653
- F("div", un, [F("button", {
1654
- type: "button",
1655
- class: "cancel-btn",
1656
- "data-testid": "add-store-cancel",
1657
- onClick: t[10] ||= (t) => e.$emit("close")
1658
- }, " Cancel "), F("button", {
1659
- type: "submit",
1660
- class: "confirm-btn",
1661
- "data-testid": "add-store-submit",
1662
- disabled: n.loading
1663
- }, K(n.loading ? "Adding..." : "Add Store"), 9, dn)])
1664
- ], 32)]),
1665
- _: 1
1666
- }, 8, ["show"]);
1667
- }
1668
- var pn = /*#__PURE__*/ e(Jt, [["render", fn], ["__scopeId", "data-v-4dd2e9ea"]]), mn = (e, t = [], n = {}) => {
1669
- let r = [];
1670
- return t.forEach((t) => {
1671
- let i = t.id, a = t.name, o = t.type === "static" ? t.origin : void 0, s = {
1672
- owner: o?.owner ?? "",
1673
- repo: o?.repo ?? "",
1674
- branch: o?.branch ?? "main",
1675
- displayName: a
1676
- };
1677
- if (r.push({
1678
- type: "root",
1679
- label: a,
1680
- key: i,
1681
- indent: 0,
1682
- modelRoot: s,
1683
- store: t
1684
- }), !e(i)) {
1685
- let a = n[i] || [], o = {};
1686
- a.forEach((e) => {
1687
- o[e.engine] || (o[e.engine] = []), o[e.engine].push(e);
1688
- }), Object.keys(o).sort().forEach((n) => {
1689
- let a = `${i}+${n}`;
1690
- r.push({
1691
- type: "engine",
1692
- label: n,
1693
- key: a,
1694
- indent: 1,
1695
- modelRoot: s,
1696
- store: t
1697
- }), e(a) || o[n].forEach((e) => {
1698
- r.push({
1699
- type: "model",
1700
- label: e.name,
1701
- key: `${a}+${e.name}`,
1702
- indent: 2,
1703
- model: e,
1704
- modelRoot: s,
1705
- store: t
1706
- });
1707
- });
1708
- });
1709
- }
1710
- }), r;
1711
- }, hn = R({
1712
- name: "CommunityModelList",
1713
- setup() {
1714
- let e = c(), t = n(), r = z("editorStore"), i = z("connectionStore"), a = z("modelStore"), o = _(), s = U(null), l = t.activeCommunityModelKey.value || "", u = j(() => {
1715
- if (l) {
1716
- let [e, t] = l.split("+");
1717
- return new Set(t ? [e, `${e}+${t}`] : [e]);
1718
- }
1719
- let t = e.stores;
1720
- return t.length === 1 ? /* @__PURE__ */ new Set([t[0].id]) : /* @__PURE__ */ new Set();
1721
- }), { overrides: d, isCollapsed: f, toggle: p, open: m } = k((e) => u.value.has(e)), h = async (t) => {
1722
- try {
1723
- await e.addStore(t), e.closeAddStoreModal();
1724
- } catch (e) {
1725
- console.error("Failed to add store:", e);
1726
- }
1727
- }, { isOpen: g, openConfirmation: v, closeConfirmation: y, confirm: b } = se((t) => {
1728
- t.type === "generic" && r && i && a && ee(t.id, r, i, a), e.removeStore(t.id);
1729
- }), x = (e, n, r) => {
1730
- t.openTab("community-models", e.name, n), console.log("Selected model:", e.name, "from root:", r);
1731
- }, S = (e, n, r) => {
1732
- m(n), t.openTab("community-models", null, n);
1733
- }, C = (e, t, n) => {
1734
- p(t);
1735
- }, w = j(() => mn(f, e.stores, e.filesByStore));
1736
- return de(async () => {
1737
- await e.initialize();
1738
- }), {
1739
- communityStore: e,
1740
- navigationStore: t,
1741
- handleAddStoreSubmit: h,
1742
- showDeleteStoreConfirmation: v,
1743
- cancelDeleteStore: y,
1744
- confirmDeleteStore: b,
1745
- showDeleteConfirmationState: g,
1746
- handleModelSelected: x,
1747
- handleItemClick: S,
1748
- handleItemToggle: C,
1749
- collapsed: d,
1750
- isCollapsed: f,
1751
- displayTree: w,
1752
- isMobile: o,
1753
- mobileTree: s,
1754
- isCommunityBranch: (e) => ["root", "engine"].includes(e.type),
1755
- expandMobileBranch: (e) => {
1756
- f(e.key) && m(e.key);
1757
- },
1758
- selectMobileItem: (e) => {
1759
- e.type === "model" ? x(e.model, e.key, e.modelRoot) : S(e.type, e.key, e.modelRoot);
1760
- },
1761
- handleMobileItemClick: (e) => s.value?.openItem(e)
1762
- };
1763
- },
1764
- components: {
1765
- SidebarList: D,
1766
- CommunityModelListItem: qt,
1767
- AddStoreModal: pn,
1768
- ConfirmDialog: C,
1769
- MobileTreeList: O
1770
- }
1771
- }), gn = { class: "community-header" }, _n = { class: "button-container" }, vn = ["disabled"], yn = {
1772
- key: 0,
1773
- class: "error-container"
1774
- }, bn = { class: "error-text" }, xn = ["onClick"];
1775
- function Sn(e, t, n, r, i, a) {
1776
- let o = G("CommunityModelListItem"), s = G("mobile-tree-list"), c = G("AddStoreModal"), l = G("ConfirmDialog"), u = G("sidebar-list");
1777
- return H(), M(u, { title: "External Models" }, {
1778
- header: Z(() => [F("div", gn, [t[4] ||= F("h3", { class: "font-sans sidebar-header" }, "External Models", -1), F("button", {
1779
- class: "sidebar-control-button sidebar-header-action sidebar-primary-create",
1780
- onClick: t[0] ||= (t) => e.communityStore.openAddStoreModal(),
1781
- "data-testid": "community-store-add"
1782
- }, [...t[3] ||= [F("i", { class: "mdi mdi-plus" }, null, -1), I(" New ", -1)]])])]),
1783
- actions: Z(() => [F("div", _n, [F("button", {
1784
- class: "sidebar-control-button sidebar-header-action",
1785
- onClick: t[1] ||= (t) => e.communityStore.refreshData(),
1786
- disabled: e.communityStore.loading,
1787
- "data-testid": "community-store-refresh"
1788
- }, [t[5] ||= F("i", { class: "mdi mdi-refresh" }, null, -1), I(" " + K(e.communityStore.loading ? "Refreshing" : "Refresh"), 1)], 8, vn)])]),
1789
- default: Z(() => [
1790
- e.communityStore.hasErrors ? (H(), P("div", yn, [(H(!0), P(A, null, W(e.communityStore.errorList, (t) => (H(), P("div", {
1791
- key: t.root,
1792
- class: "error-item"
1793
- }, [F("span", bn, K(t.name) + ": " + K(t.error), 1), F("button", {
1794
- onClick: (n) => e.communityStore.clearStoreError(t.root),
1795
- class: "clear-error"
1796
- }, "×", 8, xn)]))), 128))])) : N("", !0),
1797
- L(s, {
1798
- "list-id": "community",
1799
- ref: "mobileTree",
1800
- items: e.displayTree,
1801
- "id-field": "key",
1802
- "label-field": "label",
1803
- enabled: e.isMobile,
1804
- "is-branch": e.isCommunityBranch,
1805
- "is-selectable": e.isCommunityBranch,
1806
- onExpand: e.expandMobileBranch,
1807
- onSelect: e.selectMobileItem
1808
- }, {
1809
- item: Z(({ item: t }) => [(H(), M(o, {
1810
- key: t.key,
1811
- item: t,
1812
- "mobile-tree-mode": e.isMobile,
1813
- "is-collapsed": e.isCollapsed(t.key),
1814
- "active-model": e.navigationStore.activeCommunityModelKey.value,
1815
- onItemClick: e.handleItemClick,
1816
- onItemToggle: e.handleItemToggle,
1817
- onModelSelected: e.handleModelSelected,
1818
- onDeleteStore: e.showDeleteStoreConfirmation,
1819
- onMobileItemClick: e.handleMobileItemClick
1820
- }, null, 8, [
1821
- "item",
1822
- "mobile-tree-mode",
1823
- "is-collapsed",
1824
- "active-model",
1825
- "onItemClick",
1826
- "onItemToggle",
1827
- "onModelSelected",
1828
- "onDeleteStore",
1829
- "onMobileItemClick"
1830
- ]))]),
1831
- _: 1
1832
- }, 8, [
1833
- "items",
1834
- "enabled",
1835
- "is-branch",
1836
- "is-selectable",
1837
- "onExpand",
1838
- "onSelect"
1839
- ]),
1840
- L(c, {
1841
- show: e.communityStore.showAddStoreModal,
1842
- loading: e.communityStore.addingStore,
1843
- onClose: t[2] ||= (t) => e.communityStore.closeAddStoreModal(),
1844
- onAdd: e.handleAddStoreSubmit
1845
- }, null, 8, [
1846
- "show",
1847
- "loading",
1848
- "onAdd"
1849
- ]),
1850
- L(l, {
1851
- show: e.showDeleteConfirmationState,
1852
- title: "Confirm Store Removal",
1853
- message: "Are you sure you want to remove this store? This will not delete any imported models.",
1854
- "confirm-label": "Remove",
1855
- "cancel-test-id": "cancel-store-deletion",
1856
- "confirm-test-id": "confirm-store-deletion",
1857
- onClose: e.cancelDeleteStore,
1858
- onConfirm: e.confirmDeleteStore
1859
- }, null, 8, [
1860
- "show",
1861
- "onClose",
1862
- "onConfirm"
1863
- ])
1864
- ]),
1865
- _: 1
1866
- });
1867
- }
1868
- var Cn = /*#__PURE__*/ e(hn, [["render", Sn], ["__scopeId", "data-v-46a284c6"]]), wn = {
1869
- editors: () => Promise.all([import("./Editor-DQsYpkwl.js").then((e) => e.n), import("./ResultComponent-CAn_r3BL.js").then((e) => e.n)]),
1870
- connections: () => import("./ConnectionView-COnTTuA4.js").then((e) => e.n),
1871
- llms: () => import("./LLMView-C1MUf0c2.js"),
1872
- dashboard: () => import("./Dashboard-BH9ZwMVJ.js").then((e) => e.n),
1873
- models: () => import("./ModelView-DUDA_PtZ.js").then((e) => e.n),
1874
- "community-models": () => import("./CommunityModels-Cmro0hV3.js").then((e) => e.n),
1875
- jobs: () => import("./JobsView-B97HBoIE.js").then((e) => e.n),
1876
- tutorial: () => import("./TutorialPage-NRcee6Dx.js")
1877
- }, Tn = /* @__PURE__ */ new Set();
1878
- function En(e) {
1879
- if (Tn.has(e)) return;
1880
- let t = wn[e];
1881
- t && (Tn.add(e), t().catch(() => {
1882
- Tn.delete(e);
1883
- }));
1884
- }
1885
- function Dn(e = 3e3) {
1886
- if (typeof window > "u") return;
1887
- let t = () => Object.keys(wn).forEach(En);
1888
- window.setTimeout(() => {
1889
- "requestIdleCallback" in window ? window.requestIdleCallback(() => t(), { timeout: 1e4 }) : t();
1890
- }, e);
1891
- }
1892
- //#endregion
1893
- //#region components/sidebar/Sidebar.vue?vue&type=script&lang.ts
1894
- var On = R({
1895
- name: "Sidebar",
1896
- props: {
1897
- active: {
1898
- type: String,
1899
- default: ""
1900
- },
1901
- activeEditor: {
1902
- type: String,
1903
- default: ""
1904
- },
1905
- activeModelKey: {
1906
- type: String,
1907
- default: ""
1908
- },
1909
- activeDocumentationKey: {
1910
- type: String,
1911
- default: ""
1912
- },
1913
- activeConnectionKey: {
1914
- type: String,
1915
- default: ""
1916
- },
1917
- activeJobsKey: {
1918
- type: String,
1919
- default: ""
1920
- },
1921
- activeLLMKey: {
1922
- type: String,
1923
- default: ""
1924
- },
1925
- activeDashboardKey: {
1926
- type: String,
1927
- default: ""
1928
- },
1929
- containerWidth: {
1930
- type: Number,
1931
- default: 200
1932
- }
1933
- },
1934
- setup() {
1935
- let e = U(!1), t = U(null), n = _(), r = i(), a = b(), o = z("chatStore", null);
1936
- return {
1937
- llmConnectionStore: z("llmConnectionStore", null),
1938
- isSaving: e,
1939
- previousUnSaved: t,
1940
- isMobile: n,
1941
- mobileNavigation: r,
1942
- globalChatPanel: a,
1943
- chatStore: o
1944
- };
1945
- },
1946
- data() {
1947
- let e = [
1948
- {
1949
- name: "dashboard",
1950
- tooltip: "Chart",
1951
- icon: "mdi mdi-chart-multiple",
1952
- screen: "dashboard"
1953
- },
1954
- {
1955
- name: "models",
1956
- tooltip: "Model",
1957
- icon: "mdi mdi-set-center",
1958
- screen: "models",
1959
- searchLabel: "concepts"
1960
- },
1961
- {
1962
- name: "community-models",
1963
- tooltip: "Share & Explore",
1964
- icon: "mdi mdi-library-outline",
1965
- screen: "community-models"
1966
- },
1967
- {
1968
- name: "jobs",
1969
- tooltip: "Jobs",
1970
- icon: "mdi mdi-playlist-play",
1971
- screen: "jobs"
1972
- },
1973
- {
1974
- name: "help",
1975
- tooltip: "Help",
1976
- icon: "mdi mdi-help",
1977
- screen: "tutorial"
1978
- }
1979
- ], t = [
1980
- {
1981
- name: "edit",
1982
- tooltip: "Query",
1983
- icon: "mdi mdi-file-document-edit-outline",
1984
- screen: "editors",
1985
- searchLabel: "queries"
1986
- },
1987
- {
1988
- name: "database",
1989
- tooltip: "Connect",
1990
- icon: "mdi mdi-database-outline",
1991
- screen: "connections"
1992
- },
1993
- {
1994
- name: "llm",
1995
- tooltip: "AI",
1996
- icon: "mdi mdi-creation-outline",
1997
- screen: "llms"
1998
- }
1999
- ], n = z("saveAll"), r = z("unSaved") || 0;
2000
- if (!n) throw Error("saveAll is not provided");
2001
- return {
2002
- trilogyIcon: v,
2003
- sidebarItems: t,
2004
- sidebarFeatureItems: e,
2005
- unSaved: r,
2006
- saveAll: n,
2007
- contentCollapsed: !1,
2008
- mobileDetailScrollPositions: {},
2009
- mobileSearchQueries: {},
2010
- mobileSearchQuery: ""
2011
- };
2012
- },
2013
- components: {
2014
- EditorList: te,
2015
- ConnectionList: oe,
2016
- Tooltip: h,
2017
- TutorialSidebar: Ce,
2018
- ModelSidebar: Me,
2019
- JobsList: it,
2020
- LLMConnectionList: ae,
2021
- DashboardList: Vt,
2022
- CommunityModelList: Cn
2023
- },
2024
- watch: {
2025
- contentCollapsed(e) {
2026
- this.$emit("content-collapsed", e);
2027
- },
2028
- unSaved: {
2029
- handler(e, t) {
2030
- t > 0 && e === 0 && !this.isSaving && this.triggerSaveAnimation(), this.previousUnSaved = e;
2031
- },
2032
- immediate: !0
2033
- },
2034
- mobileSearchQuery(e) {
2035
- this.mobileNavigation.searchActive.value = !!e.trim();
2036
- }
2037
- },
2038
- computed: {
2039
- activeMobileDestination() {
2040
- return [...this.sidebarItems, ...this.sidebarFeatureItems].find((e) => e.screen === this.active);
2041
- },
2042
- mobileNavigationLevel() {
2043
- return this.mobileNavigation.level.value;
2044
- },
2045
- globalChatOpen() {
2046
- return this.globalChatPanel.isOpen.value;
2047
- },
2048
- hasLLMConnections() {
2049
- return !!(this.llmConnectionStore && Object.keys(this.llmConnectionStore.connections || {}).length > 0);
2050
- },
2051
- aiChatRunning() {
2052
- let e = this.chatStore?.chatExecutions;
2053
- return e ? Object.values(e).some((e) => e?.isLoading) : !1;
2054
- }
2055
- },
2056
- methods: {
2057
- preloadScreen: En,
2058
- toggleGlobalChat() {
2059
- this.globalChatPanel.togglePanel();
2060
- },
2061
- triggerSaveAnimation() {
2062
- this.isSaving = !0, setTimeout(() => {
2063
- this.isSaving = !1;
2064
- }, 500);
2065
- },
2066
- async handleSave() {
2067
- this.isSaving = !0, await this.saveAll(), setTimeout(() => {
2068
- this.isSaving = !1;
2069
- }, 500);
2070
- },
2071
- selectItem(e) {
2072
- if (this.isMobile) {
2073
- this.$emit("screen-selected", e);
2074
- return;
2075
- }
2076
- e === this.active ? this.contentCollapsed = !this.contentCollapsed : (this.contentCollapsed = !1, this.$emit("screen-selected", e));
2077
- },
2078
- rememberMobileDetailScroll() {
2079
- if (this.mobileNavigationLevel !== "detail") return;
2080
- let e = this.$refs.mobileDetailMenu;
2081
- e && this.active && (this.mobileDetailScrollPositions[this.active] = e.scrollTop, this.mobileSearchQueries[this.active] = this.mobileSearchQuery);
2082
- },
2083
- selectMobileDestination(e) {
2084
- this.rememberMobileDetailScroll(), this.$emit("screen-selected", e);
2085
- let t = [...this.sidebarItems, ...this.sidebarFeatureItems].find((t) => t.screen === e);
2086
- this.mobileNavigation.enterDestination(t?.tooltip || ""), this.mobileSearchQuery = this.mobileSearchQueries[e] || "", this.$nextTick(() => {
2087
- let t = this.$refs.mobileDetailMenu;
2088
- t && (t.scrollTop = this.mobileDetailScrollPositions[e] || 0);
2089
- });
2090
- },
2091
- toggleCollapse() {
2092
- this.contentCollapsed = !this.contentCollapsed;
2093
- },
2094
- editorSelected(e) {
2095
- this.$emit("editor-selected", e);
2096
- },
2097
- modelKeySelected(e) {
2098
- this.$emit("model-key-selected", e);
2099
- },
2100
- documentationKeySelected(e) {
2101
- this.$emit("documentation-key-selected", e);
2102
- },
2103
- jobsKeySelected(e) {
2104
- this.$emit("jobs-key-selected", e);
2105
- },
2106
- connectionKeySelected(e) {
2107
- this.$emit("connection-key-selected", e);
2108
- },
2109
- dashboardKeySelected(e) {
2110
- this.$emit("dashboard-key-selected", e);
2111
- },
2112
- toggleMobileMenu() {
2113
- this.$emit("toggle-mobile-menu");
2114
- },
2115
- llmKeySelected(e) {
2116
- this.$emit("llm-key-selected", e);
2117
- },
2118
- llmOpenView(e, t, n) {
2119
- this.$emit("llm-open-view", e, t, n);
2120
- },
2121
- createNewChat(e) {
2122
- this.$emit("create-new-chat", e);
2123
- },
2124
- saveEditors() {
2125
- this.$emit("save-editors");
2126
- },
2127
- saveDashboards() {
2128
- this.$emit("save-dashboards");
2129
- },
2130
- openSettings() {
2131
- console.log("Settings clicked");
2132
- },
2133
- openProfile() {
2134
- console.log("Profile clicked");
2135
- },
2136
- getUrl(e) {
2137
- let t = new URLSearchParams(window.location.search);
2138
- return t.set("sidebarScreen", e), `#${t.toString()}`;
2139
- }
2140
- }
2141
- }), kn = {
2142
- key: 0,
2143
- class: "mobile-menu-root",
2144
- "data-testid": "mobile-menu-root"
2145
- }, An = ["aria-label"], jn = ["src"], Mn = { class: "mobile-menu-save-state" }, Nn = {
2146
- class: "mobile-menu-destinations",
2147
- "aria-label": "Main navigation"
2148
- }, Pn = [
2149
- "aria-current",
2150
- "data-testid",
2151
- "onClick",
2152
- "onMouseenter"
2153
- ], Fn = { class: "mobile-menu-bottom" }, In = {
2154
- key: 1,
2155
- class: "sidebar-icons",
2156
- "data-testid": "sidebar-icons"
2157
- }, Ln = { class: "trilogy-icon" }, Rn = { class: "trilogy-icon-wrapper" }, zn = ["src"], Bn = ["title"], Vn = ["title"], Hn = [
2158
- "onClick",
2159
- "onMouseenter",
2160
- "data-testid"
2161
- ], Un = [
2162
- "onClick",
2163
- "href",
2164
- "data-testid"
2165
- ], Wn = [
2166
- "onClick",
2167
- "onMouseenter",
2168
- "data-testid"
2169
- ], Gn = [
2170
- "onClick",
2171
- "href",
2172
- "data-testid"
2173
- ], Kn = { class: "sidebar-bottom-icons" }, qn = {
2174
- key: 0,
2175
- class: "ai-running-dot",
2176
- title: "An AI conversation is running"
2177
- }, Jn = {
2178
- key: 0,
2179
- class: "mobile-subsection-search"
2180
- }, Yn = ["placeholder", "aria-label"];
2181
- function Xn(e, t, n, r, i, a) {
2182
- let o = G("tooltip"), s = G("EditorList"), c = G("ConnectionList"), l = G("LLMConnectionList"), u = G("ModelSidebar"), d = G("JobsList"), f = G("TutorialSidebar"), p = G("DashboardList"), m = G("CommunityModelList");
2183
- return H(), P("div", { class: V(["sidebar-container", { "mobile-navigation": e.isMobile }]) }, [
2184
- e.isMobile && e.mobileNavigationLevel === "root" ? (H(), P("div", kn, [
2185
- F("button", {
2186
- type: "button",
2187
- class: "mobile-menu-brand",
2188
- "aria-label": e.unSaved ? `Save ${e.unSaved} unsaved changes` : "All changes saved",
2189
- onClick: t[0] ||= (...t) => e.handleSave && e.handleSave(...t)
2190
- }, [F("img", {
2191
- class: V(["mobile-menu-logo", { spinning: e.isSaving }]),
2192
- src: e.trilogyIcon,
2193
- alt: "",
2194
- "aria-hidden": "true",
2195
- "data-testid": "trilogy-icon"
2196
- }, null, 10, jn), F("div", null, [t[10] ||= F("div", { class: "mobile-menu-title" }, "Trilogy Studio", -1), F("div", Mn, K(e.unSaved ? `${e.unSaved} unsaved — tap to save` : "All changes saved"), 1)])], 8, An),
2197
- F("nav", Nn, [(H(!0), P(A, null, W([...e.sidebarItems, ...e.sidebarFeatureItems], (n) => (H(), P("button", {
2198
- key: n.screen,
2199
- type: "button",
2200
- class: V(["mobile-menu-destination", { selected: e.active === n.screen }]),
2201
- "aria-current": e.active === n.screen ? "page" : void 0,
2202
- "data-testid": `sidebar-icon-${n.screen}`,
2203
- onClick: (t) => e.selectMobileDestination(n.screen),
2204
- onMouseenter: (t) => e.preloadScreen(n.screen)
2205
- }, [
2206
- F("i", {
2207
- class: V(n.icon),
2208
- "aria-hidden": "true"
2209
- }, null, 2),
2210
- F("span", null, K(n.tooltip), 1),
2211
- t[11] ||= F("i", {
2212
- class: "mdi mdi-chevron-right mobile-menu-chevron",
2213
- "aria-hidden": "true"
2214
- }, null, -1)
2215
- ], 42, Pn))), 128))]),
2216
- F("div", Fn, [F("button", {
2217
- type: "button",
2218
- class: "mobile-menu-destination",
2219
- "data-testid": "sidebar-icon-settings",
2220
- onClick: t[1] ||= (t) => e.selectItem("settings")
2221
- }, [...t[12] ||= [F("i", {
2222
- class: "mdi mdi-cog-outline",
2223
- "aria-hidden": "true"
2224
- }, null, -1), F("span", null, "Settings", -1)]]), F("button", {
2225
- type: "button",
2226
- class: "mobile-menu-destination",
2227
- "data-testid": "sidebar-icon-profile",
2228
- onClick: t[2] ||= (t) => e.selectItem("profile")
2229
- }, [...t[13] ||= [F("i", {
2230
- class: "mdi mdi-account-outline",
2231
- "aria-hidden": "true"
2232
- }, null, -1), F("span", null, "Profile", -1)]])])
2233
- ])) : N("", !0),
2234
- e.isMobile ? N("", !0) : (H(), P("div", In, [
2235
- F("div", Ln, [F("div", Rn, [L(o, { content: e.unSaved ? `Save ${e.unSaved} ${(e.unSaved?.valueOf() || 0) > 1 ? "changes" : "change"}` : "All changes saved!" }, {
2236
- default: Z(() => [F("img", {
2237
- class: V(["trilogy-icon", { spinning: e.isSaving }]),
2238
- onClick: t[3] ||= (...t) => e.handleSave && e.handleSave(...t),
2239
- src: e.trilogyIcon,
2240
- "data-testid": "trilogy-icon"
2241
- }, null, 10, zn)]),
2242
- _: 1
2243
- }, 8, ["content"]), (e.unSaved?.valueOf() || 0) > 0 ? (H(), P("div", {
2244
- key: 0,
2245
- class: "unsaved-badge",
2246
- title: `${e.unSaved} unsaved ${(e.unSaved?.valueOf() || 0) > 1 ? "changes" : "change"}`
2247
- }, K(e.unSaved), 9, Bn)) : N("", !0)])]),
2248
- t[17] ||= F("div", { class: "trilogy-icon-padding" }, null, -1),
2249
- F("div", {
2250
- class: "sidebar-collapse-btn",
2251
- onClick: t[4] ||= (...t) => e.toggleCollapse && e.toggleCollapse(...t),
2252
- title: e.contentCollapsed ? "Expand sidebar" : "Collapse sidebar"
2253
- }, [F("i", { class: V(e.contentCollapsed ? "mdi mdi-chevron-right" : "mdi mdi-chevron-left") }, null, 2)], 8, Vn),
2254
- t[18] ||= F("div", { class: "sidebar-divider" }, null, -1),
2255
- (H(!0), P(A, null, W(e.sidebarItems, (t, n) => (H(), P("div", {
2256
- key: t.name,
2257
- class: V(["sidebar-icon sidebar-icon-margin", { selected: e.active == t.screen }]),
2258
- onClick: (n) => e.selectItem(t.screen),
2259
- onMouseenter: (n) => e.preloadScreen(t.screen),
2260
- "data-testid": `sidebar-icon-${t.screen}`
2261
- }, [L(o, { content: t.tooltip }, {
2262
- default: Z(() => [F("a", {
2263
- onClick: $((n) => e.selectItem(t.screen), ["prevent", "stop"]),
2264
- href: e.getUrl(t.screen),
2265
- target: "_blank",
2266
- "data-testid": `sidebar-link-${t.screen}`
2267
- }, [F("i", { class: V(t.icon) }, null, 2)], 8, Un)]),
2268
- _: 2
2269
- }, 1032, ["content"])], 42, Hn))), 128)),
2270
- t[19] ||= F("div", { class: "sidebar-divider" }, null, -1),
2271
- (H(!0), P(A, null, W(e.sidebarFeatureItems, (t, n) => (H(), P("div", {
2272
- key: t.name,
2273
- class: V(["sidebar-icon sidebar-icon-margin", { selected: e.active == t.screen }]),
2274
- onClick: (n) => e.selectItem(t.screen),
2275
- onMouseenter: (n) => e.preloadScreen(t.screen),
2276
- "data-testid": `sidebar-icon-${t.screen}`
2277
- }, [L(o, { content: t.tooltip }, {
2278
- default: Z(() => [F("a", {
2279
- onClick: $((n) => e.selectItem(t.screen), ["prevent", "stop"]),
2280
- href: e.getUrl(t.screen),
2281
- target: "_blank",
2282
- "data-testid": `sidebar-link-${t.screen}`
2283
- }, [F("i", { class: V(t.icon) }, null, 2)], 8, Gn)]),
2284
- _: 2
2285
- }, 1032, ["content"])], 42, Wn))), 128)),
2286
- F("div", Kn, [
2287
- e.hasLLMConnections ? (H(), P("div", {
2288
- key: 0,
2289
- class: V(["sidebar-icon sidebar-icon-margin ai-panel-icon", { selected: e.globalChatOpen }]),
2290
- onClick: t[5] ||= (...t) => e.toggleGlobalChat && e.toggleGlobalChat(...t),
2291
- "data-testid": "sidebar-icon-ai-panel"
2292
- }, [L(o, { content: "AI Assistant (Ctrl+Shift+.)" }, {
2293
- default: Z(() => [...t[14] ||= [F("i", { class: "mdi mdi-creation" }, null, -1)]]),
2294
- _: 1
2295
- }), e.aiChatRunning ? (H(), P("span", qn)) : N("", !0)], 2)) : N("", !0),
2296
- F("div", {
2297
- class: V(["sidebar-icon sidebar-icon-margin", { selected: e.active == "settings" }]),
2298
- onClick: t[6] ||= (t) => e.selectItem("settings"),
2299
- "data-testid": "sidebar-icon-settings"
2300
- }, [L(o, { content: "Settings" }, {
2301
- default: Z(() => [...t[15] ||= [F("i", { class: "mdi mdi-cog-outline" }, null, -1)]]),
2302
- _: 1
2303
- })], 2),
2304
- F("div", {
2305
- class: V(["sidebar-icon sidebar-icon-margin", { selected: e.active == "profile" }]),
2306
- "data-testid": "sidebar-icon-profile",
2307
- onClick: t[7] ||= (t) => e.selectItem("profile")
2308
- }, [L(o, { content: "Profile" }, {
2309
- default: Z(() => [...t[16] ||= [F("i", { class: "mdi mdi-account-outline" }, null, -1)]]),
2310
- _: 1
2311
- })], 2)
2312
- ])
2313
- ])),
2314
- Q(F("div", {
2315
- ref: "mobileDetailMenu",
2316
- class: V(["sidebar-content", { "sidebar-content-collapsed": e.contentCollapsed && !e.isMobile }]),
2317
- style: ue(e.isMobile || e.contentCollapsed ? {} : { width: e.containerWidth - 40 + "px" })
2318
- }, [
2319
- e.isMobile && e.activeMobileDestination?.searchLabel ? (H(), P("label", Jn, [
2320
- t[21] ||= F("i", {
2321
- class: "mdi mdi-magnify",
2322
- "aria-hidden": "true"
2323
- }, null, -1),
2324
- Q(F("input", {
2325
- "onUpdate:modelValue": t[8] ||= (t) => e.mobileSearchQuery = t,
2326
- type: "search",
2327
- placeholder: `Search ${e.activeMobileDestination.searchLabel}`,
2328
- "aria-label": `Search ${e.activeMobileDestination.searchLabel}`,
2329
- "data-testid": "mobile-sidebar-search"
2330
- }, null, 8, Yn), [[Y, e.mobileSearchQuery]]),
2331
- e.mobileSearchQuery ? (H(), P("button", {
2332
- key: 0,
2333
- type: "button",
2334
- "aria-label": "Clear search",
2335
- onClick: t[9] ||= (t) => e.mobileSearchQuery = ""
2336
- }, [...t[20] ||= [F("i", {
2337
- class: "mdi mdi-close",
2338
- "aria-hidden": "true"
2339
- }, null, -1)]])) : N("", !0)
2340
- ])) : N("", !0),
2341
- Q(L(s, {
2342
- activeEditor: e.activeEditor,
2343
- mobileSearchQuery: e.mobileSearchQuery,
2344
- onEditorSelected: e.editorSelected,
2345
- onSaveEditors: e.saveEditors
2346
- }, null, 8, [
2347
- "activeEditor",
2348
- "mobileSearchQuery",
2349
- "onEditorSelected",
2350
- "onSaveEditors"
2351
- ]), [[X, e.active === "editors"]]),
2352
- Q(L(c, {
2353
- onConnectionKeySelected: e.connectionKeySelected,
2354
- onToggleMobileMenu: e.toggleMobileMenu,
2355
- activeConnectionKey: e.activeConnectionKey
2356
- }, null, 8, [
2357
- "onConnectionKeySelected",
2358
- "onToggleMobileMenu",
2359
- "activeConnectionKey"
2360
- ]), [[X, e.active === "connections"]]),
2361
- Q(L(l, {
2362
- onLlmConnectionKeySelected: e.llmKeySelected,
2363
- onLlmOpenView: e.llmOpenView,
2364
- onCreateNewChat: e.createNewChat,
2365
- activeLLMKey: e.activeLLMKey
2366
- }, null, 8, [
2367
- "onLlmConnectionKeySelected",
2368
- "onLlmOpenView",
2369
- "onCreateNewChat",
2370
- "activeLLMKey"
2371
- ]), [[X, e.active === "llms"]]),
2372
- Q(L(u, {
2373
- onModelKeySelected: e.modelKeySelected,
2374
- activeModelKey: e.activeModelKey,
2375
- mobileSearchQuery: e.mobileSearchQuery
2376
- }, null, 8, [
2377
- "onModelKeySelected",
2378
- "activeModelKey",
2379
- "mobileSearchQuery"
2380
- ]), [[X, e.active === "models"]]),
2381
- Q(L(d, {
2382
- onJobsKeySelected: e.jobsKeySelected,
2383
- activeJobsKey: e.activeJobsKey
2384
- }, null, 8, ["onJobsKeySelected", "activeJobsKey"]), [[X, e.active === "jobs"]]),
2385
- Q(L(f, {
2386
- onDocumentationKeySelected: e.documentationKeySelected,
2387
- activeDocumentationKey: e.activeDocumentationKey
2388
- }, null, 8, ["onDocumentationKeySelected", "activeDocumentationKey"]), [[X, e.active === "tutorial"]]),
2389
- Q(L(p, {
2390
- onDashboardKeySelected: e.dashboardKeySelected,
2391
- onSaveEditors: e.saveDashboards,
2392
- activeDashboardKey: e.activeDashboardKey,
2393
- onToggleMobileMenu: e.toggleMobileMenu
2394
- }, null, 8, [
2395
- "onDashboardKeySelected",
2396
- "onSaveEditors",
2397
- "activeDashboardKey",
2398
- "onToggleMobileMenu"
2399
- ]), [[X, e.active === "dashboard"]]),
2400
- Q(L(m, null, null, 512), [[X, e.active === "community-models"]])
2401
- ], 6), [[X, !e.isMobile || e.mobileNavigationLevel === "detail"]])
2402
- ], 2);
2403
- }
2404
- var Zn = /*#__PURE__*/ e(On, [["render", Xn], ["__scopeId", "data-v-8ea26f23"]]), Qn = R({
2405
- name: "StorageManager",
2406
- setup() {
2407
- let e = (z("storageSources", []) || []).find((e) => e instanceof x), t = U([]), n = U(!1), r = U(30), i = U(""), a = j(() => t.value.reduce((e, t) => e + t.bytes, 0));
2408
- async function o() {
2409
- if (e) {
2410
- n.value = !0;
2411
- try {
2412
- t.value = await e.getStorageUsage();
2413
- } finally {
2414
- n.value = !1;
2415
- }
2416
- }
2417
- }
2418
- async function s(t, r) {
2419
- if (e && confirm(`Delete "${t}" from ${r}? This cannot be undone.`)) {
2420
- n.value = !0;
2421
- try {
2422
- await e.deleteStorageKey(t, r), await o();
2423
- } finally {
2424
- n.value = !1;
2425
- }
2426
- }
2427
- }
2428
- async function c() {
2429
- if (!e) return;
2430
- let t = /* @__PURE__ */ new Date(Date.now() - r.value * 24 * 60 * 60 * 1e3);
2431
- if (confirm(`Delete all chats last updated before ${t.toLocaleDateString()}?`)) {
2432
- n.value = !0;
2433
- try {
2434
- let n = await e.pruneChatsOlderThan(t);
2435
- i.value = n === 0 ? "No chats matched the cutoff." : `Removed ${n} chat${n === 1 ? "" : "s"}.`, await o();
2436
- } finally {
2437
- n.value = !1;
2438
- }
2439
- }
2440
- }
2441
- function l(e) {
2442
- return e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFixed(1)} KB` : `${(e / 1024 / 1024).toFixed(2)} MB`;
2443
- }
2444
- return de(o), {
2445
- rows: t,
2446
- loading: n,
2447
- pruneDays: r,
2448
- pruneMessage: i,
2449
- totalBytes: a,
2450
- refresh: o,
2451
- deleteKey: s,
2452
- pruneChats: c,
2453
- formatBytes: l
2454
- };
2455
- }
2456
- }), $n = { class: "storage-container" }, er = { class: "intro" }, tr = ["disabled"], nr = {
2457
- key: 0,
2458
- class: "empty"
2459
- }, rr = {
2460
- key: 1,
2461
- class: "empty"
2462
- }, ir = {
2463
- key: 2,
2464
- class: "usage-table"
2465
- }, ar = { class: "key" }, or = { class: "numeric" }, sr = ["onClick", "disabled"], cr = { class: "numeric" }, lr = { class: "section" }, ur = { class: "prune-row" }, dr = ["disabled"], fr = {
2466
- key: 0,
2467
- class: "prune-message"
2468
- };
2469
- function pr(e, t, n, r, i, a) {
2470
- return H(), P("div", $n, [
2471
- F("div", er, [t[3] ||= F("p", null, " Large data (chats, editors, dashboards, model config) is stored in IndexedDB. Smaller items (connections, LLM settings, user settings, credentials) stay in localStorage. Clear individual keys or prune old chats below. ", -1), F("button", {
2472
- class: "button",
2473
- onClick: t[0] ||= (...t) => e.refresh && e.refresh(...t),
2474
- disabled: e.loading
2475
- }, "Refresh", 8, tr)]),
2476
- e.loading ? (H(), P("div", nr, "Loading…")) : e.rows.length ? (H(), P("table", ir, [
2477
- t[6] ||= F("thead", null, [F("tr", null, [
2478
- F("th", null, "Key"),
2479
- F("th", null, "Backend"),
2480
- F("th", { class: "numeric" }, "Size"),
2481
- F("th")
2482
- ])], -1),
2483
- F("tbody", null, [(H(!0), P(A, null, W(e.rows, (t) => (H(), P("tr", { key: `${t.backend}:${t.key}` }, [
2484
- F("td", ar, K(t.key), 1),
2485
- F("td", null, [F("span", { class: V(["backend-badge", t.backend]) }, K(t.backend), 3)]),
2486
- F("td", or, K(e.formatBytes(t.bytes)), 1),
2487
- F("td", null, [F("button", {
2488
- class: "button button-small",
2489
- onClick: (n) => e.deleteKey(t.key, t.backend),
2490
- disabled: e.loading
2491
- }, " Delete ", 8, sr)])
2492
- ]))), 128))]),
2493
- F("tfoot", null, [F("tr", null, [
2494
- t[4] ||= F("td", { colspan: "2" }, [F("strong", null, "Total")], -1),
2495
- F("td", cr, [F("strong", null, K(e.formatBytes(e.totalBytes)), 1)]),
2496
- t[5] ||= F("td", null, null, -1)
2497
- ])])
2498
- ])) : (H(), P("div", rr, "Nothing stored.")),
2499
- F("div", lr, [
2500
- t[9] ||= F("h3", null, "Prune old chats", -1),
2501
- t[10] ||= F("p", { class: "muted" }, " Deletes chats whose last activity is older than the selected age. Artifact payloads stored in chats are the most common cause of quota errors. ", -1),
2502
- F("div", ur, [
2503
- t[8] ||= F("label", { for: "prune-days" }, "Delete chats older than", -1),
2504
- Q(F("select", {
2505
- id: "prune-days",
2506
- "onUpdate:modelValue": t[1] ||= (t) => e.pruneDays = t
2507
- }, [...t[7] ||= [
2508
- F("option", { value: 7 }, "7 days", -1),
2509
- F("option", { value: 30 }, "30 days", -1),
2510
- F("option", { value: 90 }, "90 days", -1),
2511
- F("option", { value: 180 }, "180 days", -1),
2512
- F("option", { value: 365 }, "1 year", -1)
2513
- ]], 512), [[
2514
- J,
2515
- e.pruneDays,
2516
- void 0,
2517
- { number: !0 }
2518
- ]]),
2519
- F("button", {
2520
- class: "button",
2521
- onClick: t[2] ||= (...t) => e.pruneChats && e.pruneChats(...t),
2522
- disabled: e.loading
2523
- }, "Prune", 8, dr)
2524
- ]),
2525
- e.pruneMessage ? (H(), P("div", fr, K(e.pruneMessage), 1)) : N("", !0)
2526
- ])
2527
- ]);
2528
- }
2529
- //#endregion
2530
- //#region components/user/UserSettings.vue?vue&type=script&lang.ts
2531
- var mr = R({
2532
- name: "UserSettings",
2533
- components: { StorageManager: /* @__PURE__ */ e(Qn, [["render", pr], ["__scopeId", "data-v-e5d394da"]]) },
2534
- setup() {
2535
- let e = z("userSettingsStore");
2536
- if (!e) throw Error("User Settings Store is required");
2537
- let { settings: t, isLoading: n, hasChanges: r } = he(e), i = U("general");
2538
- return de(() => {
2539
- e.hasLoaded || e.loadSettings();
2540
- }), {
2541
- settings: t,
2542
- isLoading: n,
2543
- hasChanges: r,
2544
- activeTab: i,
2545
- clearDismissedTips: async () => {
2546
- await e.clearDismissedTips();
2547
- },
2548
- saveSettings: async () => {
2549
- await e.saveSettings() && console.log("Settings saved successfully");
2550
- },
2551
- resetToDefaults: () => {
2552
- e.resetToDefaults();
2553
- },
2554
- formatLabel: (e) => e.replace(/([A-Z])/g, " $1").replace(/^./, (e) => e.toUpperCase()),
2555
- toggleTheme: () => {
2556
- B(() => {
2557
- e.toggleTheme();
2558
- });
2559
- },
2560
- onSettingChange: () => {
2561
- e.setHasChanges(!0);
2562
- },
2563
- onThemeChange: () => {
2564
- e.setHasChanges(!0), B(() => {
2565
- e.toggleTheme();
2566
- });
2567
- },
2568
- userSettingsStore: e
2569
- };
2570
- }
2571
- }), hr = { class: "settings-container" }, gr = { class: "tabs" }, _r = { class: "tab-panel" }, vr = ["for"], yr = [
2572
- "id",
2573
- "onUpdate:modelValue",
2574
- "onChange"
2575
- ], br = ["onUpdate:modelValue"], xr = { key: 2 }, Sr = ["disabled"], Cr = [
2576
- "id",
2577
- "onUpdate:modelValue",
2578
- "data-testid"
2579
- ], wr = { class: "actions" }, Tr = ["disabled"], Er = ["disabled"], Dr = { class: "tab-panel" };
2580
- function Or(e, t, n, r, i, a) {
2581
- let o = G("StorageManager");
2582
- return H(), P("div", hr, [
2583
- F("div", gr, [F("button", {
2584
- class: V(["tab-button", { "tab-active": e.activeTab === "general" }]),
2585
- onClick: t[0] ||= (t) => e.activeTab = "general",
2586
- "data-testid": "settings-tab-general"
2587
- }, " General ", 2), F("button", {
2588
- class: V(["tab-button", { "tab-active": e.activeTab === "storage" }]),
2589
- onClick: t[1] ||= (t) => e.activeTab = "storage",
2590
- "data-testid": "settings-tab-storage"
2591
- }, " Storage ", 2)]),
2592
- Q(F("div", _r, [
2593
- t[8] ||= F("h2", null, "Settings", -1),
2594
- (H(!0), P(A, null, W(Object.entries(e.settings), ([n, r]) => (H(), P("div", {
2595
- class: "setting",
2596
- key: n
2597
- }, [F("label", { for: n }, K(e.formatLabel(n)), 9, vr), typeof r == "boolean" ? Q((H(), P("input", {
2598
- key: 0,
2599
- type: "checkbox",
2600
- id: n,
2601
- "onUpdate:modelValue": (t) => e.settings[n] = t,
2602
- onChange: () => e.userSettingsStore.updateSetting(n, e.settings[n])
2603
- }, null, 40, yr)), [[pe, e.settings[n]]]) : n === "theme" ? Q((H(), P("select", {
2604
- key: 1,
2605
- "onUpdate:modelValue": (t) => e.settings[n] = t,
2606
- onChange: t[2] ||= (...t) => e.onThemeChange && e.onThemeChange(...t)
2607
- }, [...t[7] ||= [F("option", { value: "dark" }, "Dark", -1), F("option", { value: "light" }, "Light", -1)]], 40, br)), [[J, e.settings[n]]]) : n === "tipsRead" ? (H(), P("div", xr, [F("button", {
2608
- class: "button",
2609
- onClick: t[3] ||= (...t) => e.clearDismissedTips && e.clearDismissedTips(...t),
2610
- disabled: e.isLoading
2611
- }, " Reshow Dismissed Popups (" + K(e.settings.tipsRead.length) + ") ", 9, Sr)])) : typeof r == "string" ? Q((H(), P("input", {
2612
- key: 3,
2613
- type: "text",
2614
- id: n,
2615
- "onUpdate:modelValue": (t) => e.settings[n] = t,
2616
- "data-testid": `settings-${n}`,
2617
- onInput: t[4] ||= (...t) => e.onSettingChange && e.onSettingChange(...t)
2618
- }, null, 40, Cr)), [[Y, e.settings[n]]]) : N("", !0)]))), 128)),
2619
- F("div", wr, [F("button", {
2620
- class: "button",
2621
- onClick: t[5] ||= (...t) => e.saveSettings && e.saveSettings(...t),
2622
- disabled: e.isLoading || !e.hasChanges
2623
- }, " Save ", 8, Tr), F("button", {
2624
- class: "button",
2625
- onClick: t[6] ||= (...t) => e.resetToDefaults && e.resetToDefaults(...t),
2626
- disabled: e.isLoading
2627
- }, " Reset to Defaults ", 8, Er)])
2628
- ], 512), [[X, e.activeTab === "general"]]),
2629
- Q(F("div", Dr, [L(o)], 512), [[X, e.activeTab === "storage"]])
2630
- ]);
2631
- }
2632
- var kr = /*#__PURE__*/ e(mr, [["render", Or], ["__scopeId", "data-v-e04e640c"]]), Ar = R({
2633
- name: "UserProfile",
2634
- setup() {
2635
- return {
2636
- profile: fe({
2637
- name: "Anonymous",
2638
- email: null,
2639
- organization: null
2640
- }),
2641
- editProfile: () => {
2642
- console.log("Edit profile clicked");
2643
- },
2644
- trilogyIcon: v
2645
- };
2646
- }
2647
- }), jr = { class: "profile-container" }, Mr = { class: "profile-info" }, Nr = ["src"], Pr = { class: "details" }, Fr = { key: 0 }, Ir = { key: 1 };
2648
- function Lr(e, t, n, r, i, a) {
2649
- return H(), P("div", jr, [t[3] ||= F("h2", null, "Profile", -1), F("div", Mr, [F("img", {
2650
- src: e.trilogyIcon,
2651
- alt: "User Avatar",
2652
- class: "avatar"
2653
- }, null, 8, Nr), F("div", Pr, [
2654
- F("p", null, [t[0] ||= F("strong", null, "User Name:", -1), I(" " + K(e.profile.name), 1)]),
2655
- e.profile.email ? (H(), P("p", Fr, [t[1] ||= F("strong", null, "Email:", -1), I(" " + K(e.profile.email), 1)])) : N("", !0),
2656
- e.profile.organization ? (H(), P("p", Ir, [t[2] ||= F("strong", null, "Organization:", -1), I(" " + K(e.profile.organization), 1)])) : N("", !0)
2657
- ])])]);
2658
- }
2659
- var Rr = /*#__PURE__*/ e(Ar, [["render", Lr], ["__scopeId", "data-v-e25754ef"]]), zr = {}, Br = {
2660
- class: "page-loading",
2661
- role: "status",
2662
- "aria-label": "Loading page"
2663
- };
2664
- function Vr(e, t) {
2665
- return H(), P("div", Br, [...t[0] ||= [le("<div class=\"page-loading__bar\" data-v-bd8a428d><span class=\"skeleton skeleton--chip\" data-v-bd8a428d></span><span class=\"skeleton skeleton--title\" data-v-bd8a428d></span><span class=\"skeleton skeleton--chip\" data-v-bd8a428d></span></div><div class=\"page-loading__body\" data-v-bd8a428d><span class=\"skeleton skeleton--line skeleton--w60\" data-v-bd8a428d></span><span class=\"skeleton skeleton--line skeleton--w40\" data-v-bd8a428d></span><span class=\"skeleton skeleton--block\" data-v-bd8a428d></span><div class=\"page-loading__row\" data-v-bd8a428d><span class=\"skeleton skeleton--card\" data-v-bd8a428d></span><span class=\"skeleton skeleton--card\" data-v-bd8a428d></span></div></div>", 2)]]);
2666
- }
2667
- var Hr = /*#__PURE__*/ e(zr, [["render", Vr], ["__scopeId", "data-v-bd8a428d"]]);
2668
- //#endregion
2669
- export { Dn as a, Zn as i, Rr as n, be as o, kr as r, ye as s, Hr as t };