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

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 (138) hide show
  1. package/dist/AssetAutoImporter-OHphsfW9.js +403 -0
  2. package/dist/{ChatCreatorModal-CL-jBnc3.js → ChatCreatorModal-CuXha6Dg.js} +3 -3
  3. package/dist/{ChatModelSelect-Do-VRUFc.js → ChatModelSelect-Cz7axWjP.js} +1 -1
  4. package/dist/{CodeBlock-PT4no49I.js → CodeBlock-BBsaC6hX.js} +4 -4
  5. package/dist/{CommunityModels-Cmro0hV3.js → CommunityModels-CIQQhO-y.js} +7 -7
  6. package/dist/{ConnectionErrorPopup-FSs7U-Yl.js → ConnectionErrorPopup-7vpqgF0s.js} +1 -1
  7. package/dist/{ConnectionView-COnTTuA4.js → ConnectionView-7Jj_Ggdi.js} +49 -49
  8. package/dist/{CreateEditorFromDatasourcePopup-snOh1d5h.js → CreateEditorFromDatasourcePopup-CrVHUWFl.js} +4 -4
  9. package/dist/{Dashboard-BH9ZwMVJ.js → Dashboard-DxSi9W6Q.js} +276 -280
  10. package/dist/{DashboardImportSelector-DQSvu9T-.js → DashboardImportSelector-kuDRDYi8.js} +2 -2
  11. package/dist/{DashboardMobile-BUPtdN2V.js → DashboardMobile-CZEgTb0R.js} +39 -39
  12. package/dist/{DrilldownPane-CBs5ZojS.js → DrilldownPane-BheRHJMs.js} +5 -7
  13. package/dist/{Editor-DQsYpkwl.js → Editor-D6tdutTm.js} +105 -103
  14. package/dist/{ErrorMessage-XMn_08gJ.js → ErrorMessage-D5JeF3Iz.js} +4 -4
  15. package/dist/{GlobalChatPanel-DhnOaige.js → GlobalChatPanel-BXZh0sdD.js} +20 -21
  16. package/dist/{IDE-HLa8vybk.js → IDE-T8PmyAQ_.js} +200 -203
  17. package/dist/{JobsView-B97HBoIE.js → JobsView-Ca97MiSd.js} +13 -14
  18. package/dist/{LLMChat-CxJcPLEG.js → LLMChat-Cch33Yd_.js} +3 -3
  19. package/dist/{LLMView-C1MUf0c2.js → LLMView-BDb6wD74.js} +23 -23
  20. package/dist/{LoadingView-s1uznGwG.js → LoadingView-B-xFwd2N.js} +2 -2
  21. package/dist/{MarkdownRenderer-BNDuEyG-.js → MarkdownRenderer-BWvdx0k3.js} +531 -430
  22. package/dist/{MobileIDE-BpqXoaMR.js → MobileIDE-DpdEQEqc.js} +179 -182
  23. package/dist/{ModelCard-BhN25jaV.js → ModelCard-DkAMP4X9.js} +12 -13
  24. package/dist/{ModelView-DUDA_PtZ.js → ModelView-DomyhN8g.js} +7 -7
  25. package/dist/PageLoading-BAvKGo9h.js +5937 -0
  26. package/dist/{ResultComponent-CAn_r3BL.js → ResultComponent-zoOSoRLe.js} +8 -8
  27. package/dist/{Results-BJtlwebY.js → Results-dq-SlJbU.js} +17 -19
  28. package/dist/{StatusIcon-BylPx2EO.js → StatusIcon-AbxNvJ6p.js} +2 -2
  29. package/dist/{StoreTokenModal-zCSYhfrw.js → StoreTokenModal-CM8WXdu1.js} +2 -2
  30. package/dist/{SymbolsPane-KYSwN9Sv.js → SymbolsPane-DfaxeaPS.js} +6 -3
  31. package/dist/{TrilogyEmbedProvider-WA_dlv9e.js → TrilogyEmbedProvider-D3h0gYnX.js} +9 -9
  32. package/dist/{TutorialPage-NRcee6Dx.js → TutorialPage-BtEJG7cT.js} +27 -28
  33. package/dist/{VegaLiteChart-D1slfOUY.js → VegaLiteChart-BVyAab-o.js} +12131 -10947
  34. package/dist/{WelcomePage-D5mU2x1L.js → WelcomePage-BoqzYBLr.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/{dist-CXoL8kXK.js → dist-1z5KURzS.js} +55 -50
  64. package/dist/{dist-DKkuvbPb.js → dist-Bv3D2p5A.js} +20 -18
  65. package/dist/{editor.main-Cl8i7rHY.js → editor.main-BQh6DxDB.js} +33 -33
  66. package/dist/{editorRefinementRuntime-DoP9P5J2.js → editorStore-CAlMJftt.js} +1692 -575
  67. package/dist/embed.js +2 -2
  68. package/dist/{freemarker2-fW5NBILf.js → freemarker2-DQBqlEXc.js} +1 -1
  69. package/dist/{globalChatRuntime-DWZxeS57.js → globalChatRuntime-CyS7vH51.js} +16 -16
  70. package/dist/{handlebars-dG4w8UUY.js → handlebars-tgYxaM70.js} +1 -1
  71. package/dist/{helpers-BLQAgX3C.js → helpers-BbVlA3Pf.js} +34 -35
  72. package/dist/{html-1Dq70BdU.js → html-jJahD3Mi.js} +1 -1
  73. package/dist/{htmlMode--IQmLBeh.js → htmlMode-BA1-8l2e.js} +5 -6
  74. package/dist/{javascript-CTzBM4sF.js → javascript-Cypfo7va.js} +1 -1
  75. package/dist/{jsonMode-DzeJjIEH.js → jsonMode-xJye8PWS.js} +25 -25
  76. package/dist/{liquid-DlHThiki.js → liquid-BGDrv5da.js} +1 -1
  77. package/dist/llm-ClU-2rgk.js +18493 -0
  78. package/dist/llm.js +2 -3
  79. package/dist/{localStorage-D9uyOFEO.js → localStorage-CGQ1iJXt.js} +40 -43
  80. package/dist/{lspLanguageFeatures-Cdfs3EKq.js → lspLanguageFeatures-V3e_p9oN.js} +32 -32
  81. package/dist/{mdx-fn3g4PH5.js → mdx-BUR1aImW.js} +1 -1
  82. package/dist/monaco.js +3 -3
  83. package/dist/{python-CCVj0pFt.js → python-YLkl0pc6.js} +1 -1
  84. package/dist/{razor-Cj3flYnk.js → razor-BP8TRMDY.js} +1 -1
  85. package/dist/{reconcile-Dyf4UZmj.js → reconcile-DXIvGwBk.js} +1 -1
  86. package/dist/{remoteStoreSync-Z-yjlYtI.js → remoteStoreSync-CuQBWpWf.js} +3 -3
  87. package/dist/{rolldown-runtime-Dqa2HsxW.js → rolldown-runtime-B0aSnxlc.js} +2 -2
  88. package/dist/static/test_import.vue.d.ts +4 -0
  89. package/dist/static/test_import.vue.d.ts.map +1 -0
  90. package/dist/stores-LlyiwSbK.js +2604 -0
  91. package/dist/stores.js +4 -7
  92. package/dist/trilogy-studio-components.css +1 -1
  93. package/dist/{tsMode-GI4xMYAl.js → tsMode-BH9HS_sH.js} +64 -66
  94. package/dist/{typescript-CPibXi3J.js → typescript-BM-ynfk9.js} +1 -1
  95. package/dist/{useChatWithTools-B0HZ_DVh.js → useChatWithTools-m3Jn_SV-.js} +11 -11
  96. package/dist/{useDashboard-CdSnPe_6.js → useDashboard-BOAuvVEw.js} +1014 -1022
  97. package/dist/{tabulator_esm-CxLvGDp8.js → useGlobalChatPanel-DuP1q7_f.js} +1729 -711
  98. package/dist/{useResizableDialog-B0ePSts4.js → useResizableDialog-Cs90WJdF.js} +2 -2
  99. package/dist/views/ModelView.vue.d.ts +6 -6
  100. package/dist/views/ModelView.vue.d.ts.map +1 -1
  101. package/dist/views/TutorialPage.vue.d.ts +9 -9
  102. package/dist/views/TutorialPage.vue.d.ts.map +1 -1
  103. package/dist/views.js +192 -194
  104. package/dist/{editor.api2-ClD5pp8H.js → workers-B9Eybl-M.js} +16252 -15926
  105. package/dist/{xml-BNyphceI.js → xml-M5WFPSpA.js} +1 -1
  106. package/dist/{yaml-DE5Vz0PH.js → yaml-CEeFwjz9.js} +1 -1
  107. package/package.json +29 -20
  108. package/dist/AssetAutoImporter-CBzvBaOt.js +0 -405
  109. package/dist/DashboardCreatorInline-CDU7kLy3.js +0 -129
  110. package/dist/DataTable-DoRDynP1.js +0 -365
  111. package/dist/EditorCreatorInline-D6_y1H_h.js +0 -125
  112. package/dist/LoadingButton-OH3frQuO.js +0 -138
  113. package/dist/ModalDialog-D1EOG4rl.js +0 -42
  114. package/dist/ModelCreator-CCdC7EXt.js +0 -253
  115. package/dist/PageLoading-BzniJM0C.js +0 -2669
  116. package/dist/Tooltip-Dihir4zs.js +0 -103
  117. package/dist/_plugin-vue_export-helper-B3ysoDQm.js +0 -8
  118. package/dist/assets/json.worker-CJ5MmO5Q.js +0 -58
  119. package/dist/base-C8IuZWqY.js +0 -164
  120. package/dist/connectionHistoryStorage-DKJHiKJY.js +0 -111
  121. package/dist/connectionHistoryStore-DQeBvStZ.js +0 -61
  122. package/dist/connections-CJSb1TZl.js +0 -229
  123. package/dist/constants-DgFEYN2b.js +0 -7
  124. package/dist/dashboardStore-ppM6nGks.js +0 -641
  125. package/dist/demoSetup-mwa-RDC6.js +0 -2942
  126. package/dist/editorRefinementToolExecutor-CVY3FA7k.js +0 -4624
  127. package/dist/editorStore-BhhmXbi-.js +0 -1019
  128. package/dist/formatting-BbJ5ICgh.js +0 -6
  129. package/dist/llm-BBOVWb-F.js +0 -11967
  130. package/dist/llmStore-DJM2JhzY.js +0 -153
  131. package/dist/monaco.contribution-ikesdolO.js +0 -128
  132. package/dist/stores-BT9hTLny.js +0 -1708
  133. package/dist/trilogy-BroD2Qmp.js +0 -4
  134. package/dist/urlStore-52HG6lsX.js +0 -55
  135. package/dist/useGlobalChatPanel-D_0luajQ.js +0 -85
  136. package/dist/useIsMobile-CNpUQAvk.js +0 -8
  137. package/dist/usePrismHighlight-DVyDiDAL.js +0 -183
  138. package/dist/workers-Br7ThUKL.js +0 -47
@@ -1,2942 +0,0 @@
1
- import { t as e } from "./_plugin-vue_export-helper-B3ysoDQm.js";
2
- import { St as t } from "./editorRefinementToolExecutor-CVY3FA7k.js";
3
- import { i as n, o as r, r as i } from "./stores-BT9hTLny.js";
4
- import { S as a, b as o } from "./editorRefinementRuntime-DoP9P5J2.js";
5
- import "./connections-CJSb1TZl.js";
6
- import { s } from "./remoteWorker-Dkv3TJ0j.js";
7
- import { i as c, n as l, r as u, t as d } from "./helpers-Bhue4TU-.js";
8
- import { N as f, i as p } from "./editorStore-BhhmXbi-.js";
9
- import { a as m, i as h, n as g, o as _, r as v, t as y } from "./llm-BBOVWb-F.js";
10
- import { n as b, t as x } from "./urlStore-52HG6lsX.js";
11
- import { t as S } from "./Tooltip-Dihir4zs.js";
12
- import { t as C } from "./LoadingButton-OH3frQuO.js";
13
- import { t as ee } from "./useIsMobile-CNpUQAvk.js";
14
- import { t as w } from "./helpers-BLQAgX3C.js";
15
- import { n as T, r as E, t as D } from "./remoteStoreSync-Z-yjlYtI.js";
16
- import { t as O } from "./StatusIcon-BylPx2EO.js";
17
- import { t as k } from "./CreateEditorFromDatasourcePopup-snOh1d5h.js";
18
- import { t as A } from "./EditorCreatorInline-D6_y1H_h.js";
19
- import { Fragment as j, Transition as M, computed as N, createBlock as P, createCommentVNode as F, createElementBlock as I, createElementVNode as L, createStaticVNode as te, createTextVNode as R, createVNode as z, defineComponent as B, inject as V, normalizeClass as H, normalizeStyle as ne, onBeforeUnmount as re, onMounted as ie, onUnmounted as ae, openBlock as U, reactive as oe, ref as W, renderList as G, renderSlot as K, resolveComponent as q, shallowRef as se, toDisplayString as J, unref as ce, vModelCheckbox as le, vModelDynamic as ue, vModelSelect as de, vModelText as Y, watch as fe, withCtx as X, withDirectives as Z, withModifiers as Q } from "vue";
20
- //#region components/sidebar/collapseState.ts
21
- var pe = () => !1, me = () => !1;
22
- function he(e = me) {
23
- let t = W({}), n = (n) => {
24
- let r = t.value[n];
25
- return r === void 0 ? !e(n) : r;
26
- };
27
- return {
28
- overrides: t,
29
- isCollapsed: n,
30
- toggle: (e) => {
31
- t.value[e] = !n(e);
32
- },
33
- open: (e) => {
34
- t.value[e] = !1;
35
- }
36
- };
37
- }
38
- //#endregion
39
- //#region components/sidebar/SidebarList.vue?vue&type=script&lang.ts
40
- var ge = B({
41
- name: "SidebarList",
42
- props: { title: {
43
- type: String,
44
- required: !0
45
- } },
46
- setup(e) {
47
- let t = ee();
48
- return {
49
- title: e.title,
50
- isMobile: t
51
- };
52
- }
53
- }), _e = { class: "sidebar-list" }, ve = { class: "sidebar-header-container" }, ye = {
54
- key: 1,
55
- class: "font-sans sidebar-header"
56
- }, be = { class: "action-slot" }, xe = { class: "sidebar-content" };
57
- function Se(e, t, n, r, i, a) {
58
- return U(), I("div", _e, [
59
- L("div", ve, [e.$slots.header ? K(e.$slots, "header", { key: 0 }, void 0, !0) : e.isMobile ? F("", !0) : (U(), I("h3", ye, J(e.title), 1))]),
60
- L("div", be, [K(e.$slots, "actions", {}, void 0, !0)]),
61
- L("div", xe, [K(e.$slots, "default", { isMobile: e.isMobile }, void 0, !0)])
62
- ]);
63
- }
64
- var Ce = /*#__PURE__*/ e(ge, [["render", Se], ["__scopeId", "data-v-9511e8c1"]]), we = {
65
- name: "SidebarItem",
66
- props: {
67
- itemId: {
68
- type: String,
69
- required: !0
70
- },
71
- name: {
72
- type: String,
73
- required: !0
74
- },
75
- indent: {
76
- type: Number,
77
- default: 0
78
- },
79
- isSelected: {
80
- type: Boolean,
81
- default: !1
82
- },
83
- isCollapsible: {
84
- type: Boolean,
85
- default: !1
86
- },
87
- isCollapsed: {
88
- type: Boolean,
89
- default: !1
90
- },
91
- icon: {
92
- type: String,
93
- default: ""
94
- },
95
- extraInfo: {
96
- type: [String, Number],
97
- default: ""
98
- },
99
- itemType: {
100
- type: String,
101
- default: "item"
102
- }
103
- },
104
- emits: ["click", "toggle"],
105
- methods: {
106
- handleClick() {
107
- this.$emit("click", this.itemId);
108
- },
109
- handleToggle() {
110
- this.$emit("toggle", this.itemId);
111
- }
112
- }
113
- }, Te = { class: "sidebar-item" }, Ee = [
114
- "data-testid",
115
- "aria-label",
116
- "disabled",
117
- "tabindex"
118
- ], De = {
119
- key: 0,
120
- class: "mdi mdi-menu-down chevron-icon"
121
- }, Oe = {
122
- key: 1,
123
- class: "mdi mdi-menu-right chevron-icon"
124
- }, ke = ["data-testid"], Ae = { key: 0 };
125
- function je(e, t, n, r, i, a) {
126
- return U(), I("div", Te, [L("div", {
127
- class: H(["sidebar-content", { "sidebar-item-selected": n.isSelected }]),
128
- onClick: t[1] ||= (...e) => a.handleClick && a.handleClick(...e)
129
- }, [
130
- (U(!0), I(j, null, G(Array.from({ length: n.indent }, () => 0), (e, t) => (U(), I("div", {
131
- key: t,
132
- class: "sidebar-padding"
133
- }))), 128)),
134
- n.isCollapsible || n.itemType === "dashboard" ? (U(), I("button", {
135
- key: 0,
136
- onClick: t[0] ||= Q((...e) => a.handleToggle && a.handleToggle(...e), ["stop"]),
137
- class: H(["chevron-button", { "chevron-button-placeholder": !n.isCollapsible }]),
138
- "data-testid": n.isCollapsible ? `expand-${n.itemType}-${n.itemId}` : void 0,
139
- "aria-label": n.isCollapsible ? n.isCollapsed ? "Expand section" : "Collapse section" : void 0,
140
- disabled: !n.isCollapsible,
141
- tabindex: n.isCollapsible ? 0 : -1
142
- }, [n.isCollapsible && !n.isCollapsed ? (U(), I("i", De)) : n.isCollapsible ? (U(), I("i", Oe)) : F("", !0)], 10, Ee)) : F("", !0),
143
- K(e.$slots, "icon", {}, () => [n.icon ? (U(), I("i", {
144
- key: 0,
145
- class: H(`mdi ${n.icon} node-icon`)
146
- }, null, 2)) : F("", !0)], !0),
147
- L("span", {
148
- class: "truncate-text",
149
- "data-testid": `${n.itemType}-${n.itemId}`
150
- }, [K(e.$slots, "name", {}, () => [R(J(n.name), 1)], !0), n.extraInfo ? (U(), I("span", Ae, " (" + J(n.extraInfo) + ")", 1)) : F("", !0)], 8, ke),
151
- K(e.$slots, "extra-content", {}, void 0, !0)
152
- ], 2)]);
153
- }
154
- var Me = /*#__PURE__*/ e(we, [["render", je], ["__scopeId", "data-v-c3f9697d"]]), Ne = /* @__PURE__ */ B({
155
- __name: "ConnectionStatusIcon",
156
- props: { connection: {} },
157
- setup(e) {
158
- let t = e, n = N(() => t.connection.connected ? t.connection.running ? "running" : t.connection.error ? "failed" : "connected" : "disabled"), r = N(() => t.connection.connected ? t.connection.error ? t.connection.error : "Connected" : "Disconnected");
159
- return (t, i) => (U(), P(O, {
160
- message: r.value,
161
- status: n.value,
162
- testName: e.connection.name
163
- }, null, 8, [
164
- "message",
165
- "status",
166
- "testName"
167
- ]));
168
- }
169
- }), Pe = "data:image/webp;base64,UklGRlgDAABXRUJQVlA4TEwDAAAvHUAHELfnKpIkxco+Zl3Pvw9+7wvHhuNItlWlzzd0BSuLjphJgQhc33XUSJIjRfWa56LY44/oiK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 */ B({
170
- __name: "SidebarTagChip",
171
- props: { label: {} },
172
- setup(e) {
173
- return (t, n) => (U(), I("span", Fe, J(e.label), 1));
174
- }
175
- }), [["__scopeId", "data-v-c1ad9b6f"]]), Le = B({
176
- name: "ContextMenu",
177
- props: {
178
- items: {
179
- type: Array,
180
- required: !0
181
- },
182
- position: {
183
- type: Object,
184
- default: () => ({
185
- x: 0,
186
- y: 0
187
- })
188
- },
189
- isVisible: {
190
- type: Boolean,
191
- default: !1
192
- },
193
- id: {
194
- type: String,
195
- default: ""
196
- }
197
- },
198
- emits: ["item-click", "close"],
199
- setup(e, { emit: t }) {
200
- let n = N(() => ({
201
- left: `${e.position.x}px`,
202
- top: `${e.position.y}px`
203
- })), r = (e) => {
204
- e.disabled || e.kind === "separator" || (t("item-click", e), t("close"));
205
- }, i = (n) => {
206
- n = n, e.isVisible && t("close");
207
- };
208
- return ie(() => {
209
- setTimeout(() => {
210
- document.addEventListener("click", i);
211
- }, 300);
212
- }), ae(() => {
213
- document.removeEventListener("click", i);
214
- }), {
215
- positionStyle: n,
216
- handleItemClick: r
217
- };
218
- }
219
- }), Re = ["data-testid"], ze = ["data-testid"], Be = ["data-testid", "onClick"];
220
- function Ve(e, t, n, r, i, a) {
221
- return e.isVisible ? (U(), I("div", {
222
- key: 0,
223
- style: ne(e.positionStyle),
224
- class: "context-menu",
225
- "data-testid": e.id ? `context-menu-${e.id}` : void 0
226
- }, [(U(!0), I(j, null, G(e.items, (t) => (U(), I("div", { key: t.id }, [t.kind === "separator" ? (U(), I("div", {
227
- key: 0,
228
- class: "context-menu-separator",
229
- "data-testid": e.id ? `${e.id}-${t.id}` : `context-menu-item-${t.id}`
230
- }, null, 8, ze)) : (U(), I("div", {
231
- key: 1,
232
- class: H(["context-menu-item", {
233
- danger: t.danger,
234
- disabled: t.disabled
235
- }]),
236
- "data-testid": e.id ? `${e.id}-${t.id}` : `context-menu-item-${t.id}`,
237
- onClick: Q((n) => e.handleItemClick(t), ["stop"])
238
- }, [t.icon ? (U(), I("i", {
239
- key: 0,
240
- class: H(`mdi ${t.icon}`)
241
- }, null, 2)) : F("", !0), L("span", null, J(t.label), 1)], 10, Be))]))), 128))], 12, Re)) : F("", !0);
242
- }
243
- var He = /*#__PURE__*/ e(Le, [["render", Ve], ["__scopeId", "data-v-a366f0a9"]]), Ue = ["title", "data-testid"], We = 8, Ge = 6, Ke = 27, qe = 4, Je = /*#__PURE__*/ e(/* @__PURE__ */ B({
244
- __name: "SidebarOverflowMenu",
245
- props: {
246
- items: {},
247
- tooltip: { default: "Actions" },
248
- menuWidth: { default: 160 },
249
- buttonClass: { default: "" },
250
- testIdBase: {}
251
- },
252
- emits: ["select"],
253
- setup(e, { emit: t }) {
254
- let n = e, r = t, i = W(!1), a = W({
255
- x: 0,
256
- y: 0
257
- }), o = () => n.items.reduce((e, t) => e + (t.kind === "separator" ? qe : Ke), Ge), s = (e) => {
258
- let t = e.currentTarget.getBoundingClientRect(), r = o(), s = Math.max(We, window.innerWidth - n.menuWidth - We), c = Math.max(We, window.innerHeight - r - We);
259
- a.value = {
260
- x: Math.min(s, Math.max(We, t.right - n.menuWidth)),
261
- y: Math.min(c, Math.max(We, t.bottom - 4))
262
- }, i.value = !0;
263
- }, c = (e) => {
264
- r("select", e);
265
- };
266
- return (t, n) => e.items.length > 0 ? (U(), I(j, { key: 0 }, [z(He, {
267
- items: e.items,
268
- position: a.value,
269
- "is-visible": i.value,
270
- id: e.testIdBase,
271
- onItemClick: c,
272
- onClose: n[0] ||= (e) => i.value = !1
273
- }, null, 8, [
274
- "items",
275
- "position",
276
- "is-visible",
277
- "id"
278
- ]), z(S, {
279
- content: e.tooltip,
280
- position: "left"
281
- }, {
282
- default: X(() => [L("button", {
283
- type: "button",
284
- class: H(["sidebar-icon-button sidebar-overflow-button", e.buttonClass]),
285
- onClick: Q(s, ["stop"]),
286
- title: e.tooltip,
287
- "data-testid": e.testIdBase ? `${e.testIdBase}-trigger` : void 0
288
- }, [...n[1] ||= [L("i", { class: "mdi mdi-dots-horizontal" }, null, -1)]], 10, Ue)]),
289
- _: 1
290
- }, 8, ["content"])], 64)) : F("", !0);
291
- }
292
- }), [["__scopeId", "data-v-5dd33db1"]]), Ye = {
293
- name: "EditorListItem",
294
- props: {
295
- item: {
296
- type: Object,
297
- required: !0
298
- },
299
- activeEditor: {
300
- type: String,
301
- default: ""
302
- },
303
- isCollapsed: {
304
- type: Boolean,
305
- default: !1
306
- },
307
- isMobile: {
308
- type: Boolean,
309
- default: !1
310
- }
311
- },
312
- emits: [
313
- "item-click",
314
- "delete-editor",
315
- "toggle",
316
- "refresh-store"
317
- ],
318
- setup(e, { emit: t }) {
319
- let n = V("connectionStore"), r = V("editorStore"), i = V("saveModels"), a = V("saveConnections"), o = V("saveEditors"), s = V("setActiveScreen"), c = V("setActiveEditor");
320
- if (!n || !r || !i || !a || !o || !s || !c) throw Error("Connection store is not provided!");
321
- let l = f();
322
- return {
323
- connectionStore: n,
324
- resolvedConnection: N(() => {
325
- let t = e.item.connectionId || e.item.objectKey;
326
- return t && n.connections[t] || n.connectionByName(e.item.label) || null;
327
- }),
328
- trilogyIcon: Pe,
329
- createDefaultModel: async (e) => {
330
- try {
331
- let t = n.connections[e] || n.connectionByName(e);
332
- if (!t) throw Error(`Connection ${e} not found`);
333
- let r = l.newModelConfig(t.name);
334
- t.setModel(r.name), await i(), await a();
335
- } catch (t) {
336
- console.error(`Error creating model for connection ${e}:`, t);
337
- }
338
- },
339
- createNewEditor: async (t, i, a = "") => {
340
- try {
341
- let l = n.connections[t];
342
- if (!l) throw Error(`Connection ${t} not found`);
343
- let u = `new-editor-${Date.now()}`;
344
- a && (u = `${a}/${u}`);
345
- let d = i === "trilogy" ? "preql" : i === "python" ? "python" : "sql", f = e.item.storage === "remote", p = r.newEditor(u, d, l.name, void 0, f ? {
346
- storage: "remote",
347
- remoteStoreId: e.item.remoteStoreId || l.remoteStoreId || null,
348
- remotePath: u
349
- } : void 0);
350
- await o(), c(p.id), s("editors");
351
- } catch (e) {
352
- console.error("Failed to create new editor:", e);
353
- }
354
- },
355
- contextMenuItems: N(() => {
356
- let t = e.item.type === "connection" && e.item.storage === "remote", n = e.item.type === "folder" && e.item.storage === "remote";
357
- return e.item.type === "editor" ? [{
358
- id: "delete-editor",
359
- label: "Delete editor",
360
- icon: "mdi-trash-can-outline",
361
- danger: !0
362
- }] : e.item.type === "folder" ? [
363
- {
364
- id: "new-sql",
365
- label: "New SQL editor",
366
- icon: "mdi-file-document-plus-outline"
367
- },
368
- ...n ? [{
369
- id: "new-python",
370
- label: "New Python file",
371
- icon: "mdi-language-python"
372
- }] : [],
373
- {
374
- id: "new-trilogy",
375
- label: "New Trilogy editor",
376
- icon: "mdi-file-document-plus-outline"
377
- }
378
- ] : e.item.type === "connection" ? [
379
- ...t ? [{
380
- id: "refresh-store",
381
- label: "Refresh",
382
- icon: "mdi-refresh"
383
- }, {
384
- id: "new-python",
385
- label: "New Python file",
386
- icon: "mdi-language-python"
387
- }] : [],
388
- {
389
- id: "new-sql",
390
- label: "New SQL editor",
391
- icon: "mdi-file-document-plus-outline"
392
- },
393
- {
394
- id: "new-trilogy",
395
- label: "New Trilogy editor",
396
- icon: "mdi-file-document-plus-outline"
397
- }
398
- ] : [];
399
- }),
400
- handleClick: () => {
401
- t("item-click", e.item.type, e.item.objectKey, e.item.key);
402
- },
403
- handleToggle: () => {
404
- t("item-click", e.item.type, e.item.objectKey, e.item.key);
405
- }
406
- };
407
- },
408
- methods: { handleContextMenuItemClick(e) {
409
- switch (e.id) {
410
- case "delete-editor":
411
- this.$emit("delete-editor", this.item.editor);
412
- break;
413
- case "refresh-store": {
414
- let e = this.item.connectionId && this.connectionStore.connections[this.item.connectionId];
415
- e?.remoteStoreId && this.$emit("refresh-store", e.remoteStoreId);
416
- break;
417
- }
418
- case "new-sql":
419
- this.createNewEditor(this.item.type === "connection" ? this.item.connectionId || this.item.objectKey : this.item.connectionId, "sql", this.item.type === "folder" ? this.item.objectKey : "");
420
- break;
421
- case "new-trilogy":
422
- this.createNewEditor(this.item.type === "connection" ? this.item.connectionId || this.item.objectKey : this.item.connectionId, "trilogy", this.item.type === "folder" ? this.item.objectKey : "");
423
- break;
424
- case "new-python":
425
- this.createNewEditor(this.item.type === "connection" ? this.item.connectionId || this.item.objectKey : this.item.connectionId, "python", this.item.type === "folder" ? this.item.objectKey : "");
426
- break;
427
- }
428
- } },
429
- components: {
430
- SidebarItem: Me,
431
- Tooltip: S,
432
- ConnectionStatusIcon: Ne,
433
- SidebarTagChip: Ie,
434
- SidebarOverflowMenu: Je
435
- }
436
- }, Xe = ["data-testid"], Ze = ["src"], Qe = {
437
- key: 0,
438
- class: "text-light"
439
- }, $e = {
440
- key: 0,
441
- class: "connection-model"
442
- }, et = { class: "tag-container" };
443
- function tt(e, t, n, r, i, a) {
444
- let o = q("tooltip"), s = q("sidebar-tag-chip"), c = q("sidebar-overflow-menu"), l = q("connection-status-icon"), u = q("sidebar-item");
445
- return U(), I("div", null, [n.item.type === "creator" ? (U(), I("div", {
446
- key: 0,
447
- "data-testid": `editor-list-id-${n.item.key}`,
448
- class: "creator-item",
449
- onClick: t[0] ||= (t) => e.$emit("item-click", n.item.type, n.item.objectKey, n.item.key)
450
- }, null, 8, Xe)) : (U(), P(u, {
451
- key: 1,
452
- "item-id": n.item.key,
453
- name: n.item.label,
454
- indent: n.item.indent,
455
- "is-selected": n.activeEditor === n.item.objectKey,
456
- "is-collapsible": !["editor", "creator"].includes(n.item.type),
457
- "is-collapsed": n.isCollapsed,
458
- itemType: "editor",
459
- onClick: r.handleClick,
460
- onToggle: r.handleToggle
461
- }, {
462
- icon: X(() => [n.item.type === "editor" ? (U(), I(j, { key: 0 }, [n.item.editor.type === "sql" ? (U(), P(o, {
463
- key: 0,
464
- content: "Raw SQL Editor"
465
- }, {
466
- default: X(() => [...t[2] ||= [L("span", { class: "sql" }, "SQL", -1)]]),
467
- _: 1
468
- })) : n.item.editor.type === "python" ? (U(), P(o, {
469
- key: 1,
470
- content: "Python File",
471
- class: "icon-display"
472
- }, {
473
- default: X(() => [...t[3] ||= [L("i", { class: "mdi mdi-language-python python-icon" }, null, -1)]]),
474
- _: 1
475
- })) : (U(), P(o, {
476
- key: 2,
477
- content: "Trilogy Editor",
478
- class: "icon-display"
479
- }, {
480
- default: X(() => [L("img", {
481
- src: r.trilogyIcon,
482
- class: "trilogy-icon"
483
- }, null, 8, Ze)]),
484
- _: 1
485
- }))], 64)) : F("", !0)]),
486
- name: X(() => [R(J(n.item.label) + " ", 1), n.item.type === "connection" ? (U(), I("span", Qe, [r.resolvedConnection?.model ? (U(), I("span", $e, " (" + J(r.resolvedConnection.model) + ") ", 1)) : (U(), I("span", {
487
- key: 1,
488
- class: "no-model-text",
489
- onClick: t[1] ||= Q((e) => r.createDefaultModel(n.item.connectionId || n.item.objectKey), ["stop"]),
490
- title: "Click to create a default model"
491
- }, " (No Model Set) "))])) : F("", !0)]),
492
- "extra-content": X(() => [n.item.type === "editor" ? (U(), I(j, { key: 0 }, [L("span", et, [(U(!0), I(j, null, G(n.item.editor.tags, (e) => (U(), P(s, {
493
- key: e,
494
- label: e
495
- }, null, 8, ["label"]))), 128))]), z(c, {
496
- items: r.contextMenuItems,
497
- tooltip: "Editor actions",
498
- "test-id-base": `editor-actions-${n.item.key}`,
499
- onSelect: a.handleContextMenuItemClick
500
- }, null, 8, [
501
- "items",
502
- "test-id-base",
503
- "onSelect"
504
- ])], 64)) : n.item.type === "connection" ? (U(), I(j, { key: 1 }, [r.resolvedConnection ? (U(), P(l, {
505
- key: 0,
506
- connection: r.resolvedConnection
507
- }, null, 8, ["connection"])) : F("", !0), z(c, {
508
- items: r.contextMenuItems,
509
- tooltip: "Connection actions",
510
- "test-id-base": `editor-actions-${n.item.key}`,
511
- onSelect: a.handleContextMenuItemClick
512
- }, null, 8, [
513
- "items",
514
- "test-id-base",
515
- "onSelect"
516
- ])], 64)) : n.item.type === "folder" ? (U(), P(c, {
517
- key: 2,
518
- items: r.contextMenuItems,
519
- tooltip: "Folder actions",
520
- "test-id-base": `editor-actions-${n.item.key}`,
521
- onSelect: a.handleContextMenuItemClick
522
- }, null, 8, [
523
- "items",
524
- "test-id-base",
525
- "onSelect"
526
- ])) : F("", !0)]),
527
- _: 1
528
- }, 8, [
529
- "item-id",
530
- "name",
531
- "indent",
532
- "is-selected",
533
- "is-collapsible",
534
- "is-collapsed",
535
- "onClick",
536
- "onToggle"
537
- ]))]);
538
- }
539
- var nt = /*#__PURE__*/ e(Ye, [["render", tt], ["__scopeId", "data-v-9a03eb6c"]]);
540
- //#endregion
541
- //#region components/useConfirmationState.ts
542
- function rt(e) {
543
- let t = W(!1), n = se(null), r = (e) => {
544
- n.value = e, t.value = !0;
545
- }, i = () => {
546
- t.value = !1, n.value = null;
547
- };
548
- return {
549
- isOpen: t,
550
- pendingItem: n,
551
- openConfirmation: r,
552
- closeConfirmation: i,
553
- confirm: async () => {
554
- n.value && await e(n.value), i();
555
- }
556
- };
557
- }
558
- //#endregion
559
- //#region components/sidebar/MobileTreeList.vue?vue&type=script&setup=true&lang.ts
560
- var it = ["data-testid"], at = ["data-testid"], ot = { class: "mobile-tree-count" }, st = {
561
- key: 0,
562
- class: "mobile-tree-branch-meta",
563
- "aria-hidden": "true"
564
- }, ct = { key: 0 }, lt = ["data-testid"], ut = /*#__PURE__*/ e(/* @__PURE__ */ B({
565
- __name: "MobileTreeList",
566
- props: {
567
- items: {},
568
- listId: {},
569
- idField: { default: "id" },
570
- labelField: { default: "name" },
571
- isBranch: {},
572
- isSelectable: {
573
- type: Function,
574
- default: () => !1
575
- },
576
- isDirectBranch: {
577
- type: Function,
578
- default: () => !1
579
- },
580
- isDetailBranch: {
581
- type: Function,
582
- default: () => !1
583
- },
584
- isConfig: {
585
- type: Function,
586
- default: () => !1
587
- },
588
- enabled: {
589
- type: Boolean,
590
- default: !0
591
- },
592
- flat: {
593
- type: Boolean,
594
- default: !1
595
- }
596
- },
597
- emits: [
598
- "expand",
599
- "select",
600
- "viewChange"
601
- ],
602
- setup(e, { expose: t, emit: n }) {
603
- let r = e, a = n, o = i(), s = oe({
604
- mode: "root",
605
- nodeKey: null
606
- }), c = (e) => String(e[r.idField] ?? e.key), l = (e) => String(e[r.labelField] ?? e.label ?? ""), u = (e) => r.isBranch(e), d = (e) => r.isSelectable(e), f = N(() => r.items.find((e) => c(e) === s.nodeKey)), p = N(() => {
607
- if (!f.value) return [];
608
- let e = r.items.findIndex((e) => c(e) === s.nodeKey), t = Number(f.value.indent || 0), n = [];
609
- for (let i = e + 1; i < r.items.length; i++) {
610
- let e = r.items[i], a = Number(e.indent || 0);
611
- if (a <= t) break;
612
- a === t + 1 && n.push(e);
613
- }
614
- return n;
615
- }), m = N(() => p.value.filter((e) => r.isConfig(e))), h = N(() => p.value.filter((e) => !r.isConfig(e))), g = N(() => !r.enabled || r.flat ? r.items : s.mode === "root" ? r.items.filter((e) => Number(e.indent || 0) === 0) : h.value.length ? h.value : p.value), _ = (e) => {
616
- Object.assign(s, e), a("viewChange", s.mode === "root");
617
- }, v = (e) => _(e), y = (e, t = !1) => {
618
- let n = r.items.findIndex((t) => c(t) === c(e));
619
- if (n < 0) return [];
620
- let i = Number(e.indent || 0), a = [];
621
- for (let e = n + 1; e < r.items.length; e++) {
622
- let n = r.items[e], o = Number(n.indent || 0);
623
- if (o <= i) break;
624
- (!t || o === i + 1) && a.push(n);
625
- }
626
- return a;
627
- }, b = (e) => y(e).filter((e) => !r.isBranch(e) && !r.isConfig(e)).length, x = (e) => {
628
- if (!r.isBranch(e)) return a("select", e);
629
- a("expand", e);
630
- let t = { ...s }, n = y(e, !0).some((e) => r.isConfig(e)), i = !r.isDirectBranch(e) && (r.isDetailBranch(e) || n || r.isSelectable(e));
631
- _({
632
- mode: i ? "detail" : "children",
633
- nodeKey: c(e)
634
- }), o.push({
635
- title: l(e),
636
- onBack: () => v(t)
637
- });
638
- }, S = () => {
639
- if (!f.value) return;
640
- let e = { ...s };
641
- _({
642
- mode: "children",
643
- nodeKey: s.nodeKey
644
- }), o.push({
645
- title: `${l(f.value)} children`,
646
- onBack: () => v(e)
647
- });
648
- };
649
- return t({ openItem: x }), (t, n) => (U(), I("div", { class: H(["mobile-tree-list", { "mobile-tree-list-enabled": e.enabled }]) }, [!e.flat && s.mode === "detail" && f.value ? (U(), I(j, { key: 0 }, [
650
- d(f.value) ? F("", !0) : K(t.$slots, "item", {
651
- key: 0,
652
- item: f.value,
653
- detail: !0
654
- }, void 0, !0),
655
- d(f.value) ? (U(), I("button", {
656
- key: 1,
657
- type: "button",
658
- class: "mobile-tree-open",
659
- "data-testid": `mobile-tree-open-${e.listId}`,
660
- onClick: n[0] ||= (e) => a("select", f.value)
661
- }, [...n[1] ||= [L("i", { class: "mdi mdi-open-in-new" }, null, -1), L("span", null, "Open", -1)]], 8, it)) : F("", !0),
662
- (U(!0), I(j, null, G(m.value, (e) => (U(), I("div", {
663
- key: c(e),
664
- class: "mobile-tree-entry"
665
- }, [K(t.$slots, "item", { item: e }, void 0, !0)]))), 128)),
666
- (U(!0), I(j, null, G(d(f.value) ? h.value : [], (e) => (U(), I("div", {
667
- key: c(e),
668
- class: "mobile-tree-entry"
669
- }, [K(t.$slots, "item", { item: e }, void 0, !0)]))), 128)),
670
- h.value.length && !d(f.value) ? (U(), I("button", {
671
- key: 2,
672
- type: "button",
673
- class: "mobile-tree-children",
674
- "data-testid": `mobile-tree-children-${e.listId}`,
675
- onClick: S
676
- }, [
677
- n[2] ||= L("i", { class: "mdi mdi-folder-outline" }, null, -1),
678
- n[3] ||= L("span", null, "Children", -1),
679
- L("span", ot, J(h.value.length), 1),
680
- n[4] ||= L("i", { class: "mdi mdi-chevron-right" }, null, -1)
681
- ], 8, at)) : F("", !0)
682
- ], 64)) : (U(), I(j, { key: 1 }, [(U(!0), I(j, null, G(g.value, (r) => (U(), I("div", {
683
- key: c(r),
684
- class: "mobile-tree-entry"
685
- }, [K(t.$slots, "item", { item: r }, void 0, !0), e.enabled && u(r) ? (U(), I("div", st, [b(r) ? (U(), I("span", ct, "(" + J(b(r)) + ")", 1)) : F("", !0), n[5] ||= L("i", { class: "mdi mdi-chevron-right" }, null, -1)])) : F("", !0)]))), 128)), e.enabled && !e.flat && s.mode !== "root" && !g.value.length ? (U(), I("div", {
686
- key: 0,
687
- class: "mobile-tree-empty",
688
- "data-testid": `mobile-tree-empty-${e.listId}`
689
- }, J(f.value ? "Nothing here." : "This item is no longer available."), 9, lt)) : F("", !0)], 64))], 2));
690
- }
691
- }), [["__scopeId", "data-v-8d1c57f2"]]), dt = {
692
- name: "EditorList",
693
- props: {
694
- activeEditor: String,
695
- testTag: {
696
- type: String,
697
- default: ""
698
- },
699
- mobileSearchQuery: {
700
- type: String,
701
- default: ""
702
- }
703
- },
704
- setup(e) {
705
- let t = p(), n = r(), i = V("editorStore"), s = V("connectionStore"), c = V("modelStore"), l = V("storageSources", []), u = ee();
706
- if (!i || !s || !c) throw Error("Editor store is not provided!");
707
- let d = l.find((e) => e.type === "remote"), f = W(/* @__PURE__ */ new Set([])), m = W(!1), h = W(!1), g = W(null), _ = (e) => {
708
- f.value.has(e) ? f.value.delete(e) : f.value.add(e);
709
- }, v = N(() => {
710
- if (f.value.size === 0) return "All editors";
711
- let e = Object.values(a).filter((e) => !f.value.has(e));
712
- return e.length === 0 ? "No editors" : e.length === 1 ? `${e.map((e) => e.split("_").map((e) => e.charAt(0).toUpperCase() + e.slice(1).toLowerCase()).join(" "))[0]} only` : `${e.length} types`;
713
- }), y = (e) => {
714
- let t = e.target;
715
- g.value && t && !g.value.contains(t) && (h.value = !1);
716
- }, S = b(x.EDITORS) || "", C = (e, t, n) => {
717
- let r = e.split("/"), i = [];
718
- for (let e = 0; e < r.length - 1; e++) {
719
- let a = r.slice(0, e + 1).join("/");
720
- i.push(`f-${t}-${n}-${a}`);
721
- }
722
- return i;
723
- }, w = N(() => {
724
- let t = Object.values(i.editors), n = e.activeEditor || S, r = n ? t.find((e) => e.id === n) : void 0;
725
- if (r) {
726
- let e = r.connectionId || r.connection;
727
- return /* @__PURE__ */ new Set([
728
- `s-${r.storage}`,
729
- `c-${r.storage}-${e}`,
730
- ...C(r.name, r.storage, e)
731
- ]);
732
- }
733
- let a = new Set(t.map((e) => `s-${e.storage}`)), o = new Set(t.map((e) => `c-${e.storage}-${e.connectionId || e.connection}`));
734
- return a.size !== 1 || o.size !== 1 ? /* @__PURE__ */ new Set() : /* @__PURE__ */ new Set([...a, ...o]);
735
- }), { overrides: E, isCollapsed: O, toggle: k, open: A } = he((e) => w.value.has(e)), j = (e) => {
736
- let t = i.getEditorByName(e);
737
- if (!t) return;
738
- let n = t.connectionId || t.connection;
739
- A(`s-${t.storage}`), A(`c-${t.storage}-${n}`), C(t.name, t.storage, n).forEach(A);
740
- };
741
- ie(() => {
742
- document.addEventListener("click", y);
743
- }), re(() => {
744
- document.removeEventListener("click", y);
745
- });
746
- let M = N(() => e.mobileSearchQuery.trim().toLocaleLowerCase()), P = N(() => {
747
- let e = o(Object.values(s.connections), Object.values(i.editors), u.value || M.value ? pe : O, f.value);
748
- return M.value ? e.filter((e) => e.type === "editor" && e.label.toLocaleLowerCase().includes(M.value)) : e;
749
- }), { isOpen: F, openConfirmation: I, closeConfirmation: L, confirm: te } = rt((e) => {
750
- e.delete();
751
- });
752
- return {
753
- isMobile: u,
754
- communityStore: t,
755
- connectionStore: s,
756
- editorStore: i,
757
- EditorTag: a,
758
- toggleTagFilter: _,
759
- contentList: P,
760
- searchQuery: M,
761
- toggleCollapse: k,
762
- collapsed: E,
763
- isCollapsed: O,
764
- revealEditor: j,
765
- hiddenTags: f,
766
- creatorVisible: m,
767
- filterMenuOpen: h,
768
- filterDropdown: g,
769
- filterSummary: v,
770
- showDeleteConfirmationState: F,
771
- showDeleteConfirmation: I,
772
- cancelDelete: L,
773
- confirmDelete: te,
774
- refreshStore: async (e) => {
775
- await n.fetchFilesForStore(e), d && t.stores.find((t) => t.type === "generic" && t.id === e) && (D(e, i, s, c), await T(d, e, i, s, c));
776
- }
777
- };
778
- },
779
- methods: {
780
- formatEditorTag(e) {
781
- return e.split("_").map((e) => e.charAt(0).toUpperCase() + e.slice(1).toLowerCase()).join(" ");
782
- },
783
- saveEditors() {
784
- this.$emit("save-editors");
785
- },
786
- clickAction(e, t, n) {
787
- e === "editor" ? this.$emit("editor-selected", t) : this.toggleCollapse(n);
788
- },
789
- isEditorBranch(e) {
790
- return !["editor", "creator"].includes(e.type);
791
- },
792
- handleTreeItemClick(e) {
793
- this.isMobile ? this.$refs.mobileTree?.openItem(e) : this.clickAction(e.type, e.objectKey, e.key);
794
- },
795
- expandMobileBranch(e) {
796
- this.isCollapsed(e.key) && this.toggleCollapse(e.key);
797
- },
798
- selectMobileItem(e) {
799
- this.clickAction(e.type, e.objectKey, e.key);
800
- }
801
- },
802
- components: {
803
- EditorCreatorInline: A,
804
- SidebarList: Ce,
805
- LoadingButton: C,
806
- EditorListItem: nt,
807
- ConfirmDialog: E,
808
- MobileTreeList: ut
809
- }
810
- }, ft = { class: "editors-header-row" }, pt = {
811
- key: 0,
812
- class: "font-sans sidebar-header"
813
- }, mt = ["data-testid"], ht = {
814
- ref: "filterDropdown",
815
- class: "tag-filter-dropdown"
816
- }, gt = ["aria-expanded"], _t = { class: "tag-filter-button-label" }, vt = {
817
- key: 0,
818
- class: "tag-filter-menu"
819
- }, yt = ["checked", "onChange"];
820
- function bt(e, t, n, r, i, a) {
821
- let o = q("editor-creator-inline"), s = q("editor-list-item"), c = q("mobile-tree-list"), l = q("ConfirmDialog"), u = q("sidebar-list");
822
- return U(), P(u, { title: "Editors" }, {
823
- header: X(() => [L("div", ft, [r.isMobile ? F("", !0) : (U(), I("h3", pt, "Editors")), L("button", {
824
- class: "sidebar-control-button sidebar-header-action sidebar-primary-create",
825
- onClick: t[0] ||= (e) => r.creatorVisible = !r.creatorVisible,
826
- "data-testid": n.testTag ? `editor-creator-add-${n.testTag}` : "editor-creator-add"
827
- }, [t[3] ||= L("i", { class: "mdi mdi-plus" }, null, -1), R(" " + J(r.creatorVisible ? "Close" : "New"), 1)], 8, mt)])]),
828
- actions: X(() => [z(o, {
829
- visible: r.creatorVisible,
830
- onClose: t[1] ||= (e) => r.creatorVisible = !r.creatorVisible,
831
- onEditorSelected: r.revealEditor,
832
- testTag: n.testTag
833
- }, null, 8, [
834
- "visible",
835
- "onEditorSelected",
836
- "testTag"
837
- ]), L("div", ht, [L("button", {
838
- class: "tag-filter-button",
839
- type: "button",
840
- onClick: t[2] ||= (e) => r.filterMenuOpen = !r.filterMenuOpen,
841
- "aria-expanded": r.filterMenuOpen
842
- }, [
843
- t[4] ||= L("span", { class: "tag-filter-button-scope" }, "Scope:", -1),
844
- L("span", _t, J(r.filterSummary), 1),
845
- L("i", { class: H(["mdi mdi-chevron-down tag-filter-chevron", { open: r.filterMenuOpen }]) }, null, 2)
846
- ], 8, gt), r.filterMenuOpen ? (U(), I("div", vt, [(U(!0), I(j, null, G(r.EditorTag, (e) => (U(), I("label", {
847
- key: e,
848
- class: "tag-filter-option"
849
- }, [L("input", {
850
- type: "checkbox",
851
- checked: !r.hiddenTags.has(e),
852
- onChange: (t) => r.toggleTagFilter(e)
853
- }, null, 40, yt), L("span", null, J(a.formatEditorTag(e)) + " Editors", 1)]))), 128))])) : F("", !0)], 512)]),
854
- default: X(() => [z(c, {
855
- "list-id": "editors",
856
- ref: "mobileTree",
857
- items: r.contentList,
858
- "id-field": "key",
859
- "label-field": "label",
860
- enabled: r.isMobile,
861
- flat: !!r.searchQuery,
862
- "is-branch": a.isEditorBranch,
863
- onExpand: a.expandMobileBranch,
864
- onSelect: a.selectMobileItem
865
- }, {
866
- item: X(({ item: e }) => [z(s, {
867
- item: e,
868
- "active-editor": n.activeEditor,
869
- "is-collapsed": r.isCollapsed(e.key),
870
- "is-mobile": r.isMobile,
871
- onItemClick: (t) => a.handleTreeItemClick(e),
872
- onDeleteEditor: r.showDeleteConfirmation,
873
- onRefreshStore: r.refreshStore
874
- }, null, 8, [
875
- "item",
876
- "active-editor",
877
- "is-collapsed",
878
- "is-mobile",
879
- "onItemClick",
880
- "onDeleteEditor",
881
- "onRefreshStore"
882
- ])]),
883
- _: 1
884
- }, 8, [
885
- "items",
886
- "enabled",
887
- "flat",
888
- "is-branch",
889
- "onExpand",
890
- "onSelect"
891
- ]), z(l, {
892
- show: r.showDeleteConfirmationState,
893
- title: "Confirm Deletion",
894
- message: "Are you sure you want to delete this editor? Contents cannot be recovered.",
895
- "confirm-label": "Delete",
896
- "cancel-test-id": "cancel-editor-deletion",
897
- "confirm-test-id": "confirm-editor-deletion",
898
- onClose: r.cancelDelete,
899
- onConfirm: r.confirmDelete
900
- }, null, 8, [
901
- "show",
902
- "onClose",
903
- "onConfirm"
904
- ])]),
905
- _: 1
906
- });
907
- }
908
- var xt = /*#__PURE__*/ e(dt, [["render", bt], ["__scopeId", "data-v-96a07efe"]]), St = B({
909
- name: "ConnectionCreator",
910
- props: {
911
- visible: {
912
- type: Boolean,
913
- required: !0
914
- },
915
- testTag: {
916
- type: String,
917
- required: !1,
918
- default: ""
919
- }
920
- },
921
- methods: { close() {
922
- this.$emit("close");
923
- } },
924
- setup(e, { emit: t }) {
925
- let n = W({
926
- name: "",
927
- type: "duckdb",
928
- options: {
929
- mdToken: "",
930
- account: "",
931
- projectId: "",
932
- username: "",
933
- password: "",
934
- privateKey: "",
935
- saveCredential: !1
936
- }
937
- }), r = V("connectionStore"), i = V("saveConnections"), a = V("saveAll");
938
- if (!r || !i || !a) throw Error("must inject connectionStore to ConnectionCreator");
939
- return {
940
- connectionDetails: n,
941
- connections: r.connections,
942
- createConnection: () => {
943
- n.value.name = "", n.value.type = "duckdb", n.value.options = {
944
- mdToken: "",
945
- account: "",
946
- projectId: "",
947
- username: "",
948
- password: "",
949
- privateKey: "",
950
- saveCredential: !1
951
- };
952
- },
953
- submitConnectionCreation: async () => {
954
- n.value.name && n.value.type && (await r.newConnection(n.value.name, n.value.type, n.value.options), await a(), t("close"));
955
- }
956
- };
957
- }
958
- }), Ct = {
959
- key: 0,
960
- class: "creator-container"
961
- }, wt = { class: "form-row" }, Tt = { class: "form-row" }, Et = {
962
- key: 0,
963
- class: "form-row"
964
- }, Dt = {
965
- key: 1,
966
- class: "form-row"
967
- }, Ot = {
968
- key: 2,
969
- class: "form-row"
970
- }, kt = { class: "form-row" }, At = { class: "form-row" }, jt = { class: "form-row" }, Mt = { class: "button-row" };
971
- function Nt(e, t, n, r, i, a) {
972
- return e.visible ? (U(), I("div", Ct, [L("form", { onSubmit: t[11] ||= Q((...t) => e.submitConnectionCreation && e.submitConnectionCreation(...t), ["prevent"]) }, [
973
- L("div", wt, [t[12] ||= L("label", { for: "connection-name" }, "Name", -1), Z(L("input", {
974
- "data-testid": "connection-creator-name",
975
- type: "text",
976
- "onUpdate:modelValue": t[0] ||= (t) => e.connectionDetails.name = t,
977
- class: "sidebar-control-input",
978
- id: "connection-name",
979
- required: ""
980
- }, null, 512), [[Y, e.connectionDetails.name]])]),
981
- L("div", Tt, [t[14] ||= L("label", { for: "connection-type" }, "Type", -1), Z(L("select", {
982
- "onUpdate:modelValue": t[1] ||= (t) => e.connectionDetails.type = t,
983
- class: "sidebar-control-select",
984
- id: "connection-type",
985
- required: ""
986
- }, [...t[13] ||= [
987
- L("option", { value: "duckdb" }, "DuckDB", -1),
988
- L("option", { value: "sqlite" }, "SQLite", -1),
989
- L("option", { value: "bigquery" }, "Bigquery Oauth", -1),
990
- L("option", { value: "snowflake" }, "Snowflake", -1)
991
- ]], 512), [[de, e.connectionDetails.type]])]),
992
- e.connectionDetails.type === "motherduck" ? (U(), I("div", Et, [
993
- t[15] ||= L("label", { for: "md-token" }, "MotherDuck Token", -1),
994
- Z(L("input", {
995
- type: "password",
996
- "onUpdate:modelValue": t[2] ||= (t) => e.connectionDetails.options.mdToken = t,
997
- class: "sidebar-control-input",
998
- id: "md-token",
999
- placeholder: "MotherDuck Token",
1000
- required: ""
1001
- }, null, 512), [[Y, e.connectionDetails.options.mdToken]]),
1002
- t[16] ||= L("label", { for: "save-credential" }, "Save Credential?", -1),
1003
- Z(L("input", {
1004
- type: "checkbox",
1005
- id: "save-credential",
1006
- "onUpdate:modelValue": t[3] ||= (t) => e.connectionDetails.options.saveCredential = t,
1007
- label: "Save Credential?"
1008
- }, null, 512), [[le, e.connectionDetails.options.saveCredential]])
1009
- ])) : F("", !0),
1010
- e.connectionDetails.type === "bigquery" ? (U(), I("div", Dt, [t[17] ||= L("label", { for: "project-id" }, "BigQuery Project ID", -1), Z(L("input", {
1011
- type: "text",
1012
- "onUpdate:modelValue": t[4] ||= (t) => e.connectionDetails.options.projectId = t,
1013
- class: "sidebar-control-input",
1014
- id: "project-id",
1015
- placeholder: "Billing Project ID",
1016
- required: ""
1017
- }, null, 512), [[Y, e.connectionDetails.options.projectId]])])) : F("", !0),
1018
- e.connectionDetails.type === "sqlserver" ? (U(), I("div", Ot, [
1019
- t[18] ||= L("label", { for: "username" }, "Username", -1),
1020
- Z(L("input", {
1021
- type: "text",
1022
- "onUpdate:modelValue": t[5] ||= (t) => e.connectionDetails.options.username = t,
1023
- class: "sidebar-control-input",
1024
- id: "username",
1025
- required: ""
1026
- }, null, 512), [[Y, e.connectionDetails.options.username]]),
1027
- t[19] ||= L("label", { for: "password" }, "Password", -1),
1028
- Z(L("input", {
1029
- type: "password",
1030
- "onUpdate:modelValue": t[6] ||= (t) => e.connectionDetails.options.password = t,
1031
- class: "sidebar-control-input",
1032
- id: "username",
1033
- required: ""
1034
- }, null, 512), [[Y, e.connectionDetails.options.password]])
1035
- ])) : F("", !0),
1036
- e.connectionDetails.type === "snowflake" ? (U(), I(j, { key: 3 }, [
1037
- L("div", kt, [t[20] ||= L("label", { for: "account" }, "Account", -1), Z(L("input", {
1038
- type: "text",
1039
- "onUpdate:modelValue": t[7] ||= (t) => e.connectionDetails.options.account = t,
1040
- class: "sidebar-control-input",
1041
- id: "account",
1042
- required: ""
1043
- }, null, 512), [[Y, e.connectionDetails.options.account]])]),
1044
- L("div", At, [t[21] ||= L("label", { for: "username" }, "Username", -1), Z(L("input", {
1045
- type: "text",
1046
- "onUpdate:modelValue": t[8] ||= (t) => e.connectionDetails.options.username = t,
1047
- class: "sidebar-control-input",
1048
- id: "username",
1049
- required: ""
1050
- }, null, 512), [[Y, e.connectionDetails.options.username]])]),
1051
- L("div", jt, [t[22] ||= L("label", { for: "privateKey" }, "Private Key", -1), Z(L("input", {
1052
- type: "password",
1053
- "onUpdate:modelValue": t[9] ||= (t) => e.connectionDetails.options.privateKey = t,
1054
- class: "sidebar-control-input",
1055
- id: "privateKey",
1056
- required: ""
1057
- }, null, 512), [[Y, e.connectionDetails.options.privateKey]])])
1058
- ], 64)) : F("", !0),
1059
- L("div", Mt, [t[23] ||= L("button", {
1060
- "data-testid": "connection-creator-submit",
1061
- type: "submit"
1062
- }, "Submit", -1), L("button", {
1063
- type: "button",
1064
- onClick: t[10] ||= (t) => e.close()
1065
- }, "Cancel")])
1066
- ], 32)])) : F("", !0);
1067
- }
1068
- var Pt = /*#__PURE__*/ e(St, [["render", Nt], ["__scopeId", "data-v-9207fd93"]]), Ft = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFgAAABYCAIAAAD+96djAAAAIGNIUk0AAHomAACAhAAA+gAAAIDoAAB1MAAA6mAAADqYAAAXcJy6UTwAAAAGYktHRAD/AP8A/6C9p5MAAAAHdElNRQfnBRMXJzJGoqCLAAANmElEQVR42u2be4xdxX3HPzNzzn3u3r3s2qy9rLFZxS4E7CA1dVDjBnDclAANbXEgaUpbVIFSqa2UqK1UqfmnaVPURmlUqSRqJKIIQwg1hEDlypaJISIBnFiE+IEfGLxmvX7tw/f9OOfM9I8z997dZV93927vUu1Pd6XV3bNzZj5n5vt7zBxxyy23sGIg292B5WIrIKytgLC2AsLaCghrKyCsrYCw5rS7A4syY3+sCfEBB2HM1G/mM6Twv4RACgBtMAYBLAjHsgABSIESINCaIBzSrOMJL3AElYC8j4CEiyPxNcz1v9N3oL3jNwZjcCSVgAtFzufJezgSIaaZJlMoAOfyGPhwDxu7KfpcLKCkvaBZa/+MUJILBfo6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yMDIzLTA1LTE5VDIzOjM5OjQ5KzAwOjAweTItFAAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyMy0wNS0xOVQyMzozOTo0OSswMDowMAhvlagAAAAodEVYdGRhdGU6dGltZXN0YW1wADE5NzAtMDEtMDFUMDA6MDA6MDArMDA6MDCutErVAAAAAElFTkSuQmCC", It = {
1069
- key: 0,
1070
- class: "mdi mdi-duck"
1071
- }, Lt = ["src"], Rt = {
1072
- key: 2,
1073
- class: "mdi mdi-google"
1074
- }, zt = {
1075
- key: 3,
1076
- class: "mdi mdi-google"
1077
- }, Bt = {
1078
- key: 4,
1079
- class: "mdi mdi-database"
1080
- }, Vt = /*#__PURE__*/ e(/* @__PURE__ */ B({
1081
- __name: "ConnectionIcon",
1082
- props: { connectionType: {} },
1083
- setup(e) {
1084
- let t = e, n = N(() => ({
1085
- duckdb: "DuckDB",
1086
- motherduck: "MotherDuck",
1087
- "bigquery-oauth": "BigQuery",
1088
- snowflake: "Snowflake",
1089
- remote: "Remote Project",
1090
- default: "Database Connection"
1091
- })[t.connectionType || "default"] || t.connectionType || "");
1092
- return (t, r) => (U(), P(S, { content: n.value }, {
1093
- default: X(() => [e.connectionType === "duckdb" ? (U(), I("i", It)) : e.connectionType === "motherduck" ? (U(), I("img", {
1094
- key: 1,
1095
- src: ce(Ft),
1096
- class: "motherduck-icon",
1097
- alt: "MotherDuck"
1098
- }, null, 8, Lt)) : e.connectionType === "bigquery-oauth" ? (U(), I("i", Rt)) : e.connectionType === "bigquery" ? (U(), I("i", zt)) : (U(), I("i", Bt))]),
1099
- _: 1
1100
- }, 8, ["content"]));
1101
- }
1102
- }), [["__scopeId", "data-v-d7a85282"]]), Ht = "sidebar-icon-button", Ut = /*#__PURE__*/ e(/* @__PURE__ */ B({
1103
- __name: "ConnectionRefresh",
1104
- props: {
1105
- connection: {},
1106
- type: {},
1107
- isConnected: { type: Boolean }
1108
- },
1109
- emits: ["refresh"],
1110
- setup(e, { emit: t }) {
1111
- let n = e, r = t, i;
1112
- if (i = n.type === "llm" ? V("llmConnectionStore") : V("connectionStore"), !i) throw Error("Connection store is not provided!");
1113
- let a = N(() => n.connection.connected ? "mdi mdi-refresh" : "mdi mdi-power-plug-outline"), o = N(() => n.connection.connected ? `refresh-connection-${n.connection.name}` : `connect-connection-${n.connection.name}`), s = async () => {
1114
- try {
1115
- await i.resetConnection(n.connection.id), r("refresh", n.connection.name);
1116
- } catch (e) {
1117
- throw console.error("Refresh failed:", e), e;
1118
- }
1119
- };
1120
- return (e, t) => (U(), P(C, {
1121
- class: H(["refresh-button", Ht]),
1122
- action: s,
1123
- "data-testid": o.value,
1124
- useDefaultStyle: !1,
1125
- testId: o.value,
1126
- onClick: t[0] ||= Q(() => {}, ["stop"])
1127
- }, {
1128
- default: X(() => [L("i", { class: H([a.value, "refresh-icon"]) }, null, 2)]),
1129
- _: 1
1130
- }, 8, ["data-testid", "testId"]));
1131
- }
1132
- }), [["__scopeId", "data-v-1b2c4327"]]), Wt = B({
1133
- name: "FileUpload",
1134
- props: { connection: {
1135
- type: Object,
1136
- required: !0
1137
- } },
1138
- setup(e) {
1139
- let t = W(!1), n = W(!1), r = W("Processing file..."), i = W(""), a = W(null), o = () => {
1140
- t.value = !0;
1141
- }, s = () => {
1142
- t.value = !1;
1143
- }, c = async (e) => {
1144
- let t = e.target;
1145
- t.files && t.files.length > 0 && await f(t.files[0]);
1146
- }, l = () => {
1147
- a.value?.click();
1148
- }, u = async (e) => {
1149
- if (t.value = !1, e.dataTransfer?.files && e.dataTransfer.files.length > 0) {
1150
- let t = e.dataTransfer.files[0];
1151
- d(t) ? await f(t) : alert("Please drop a CSV, Parquet, or database file");
1152
- }
1153
- }, d = (e) => e.type === "text/csv" || e.name.endsWith(".csv") || e.type === "application/octet-stream" || e.name.endsWith(".parquet") || e.name.endsWith(".db") || e.name.endsWith(".sqlite"), f = async (t) => {
1154
- try {
1155
- n.value = !0, r.value = `Processing ${t.name}...`;
1156
- let o = await e.connection.importFile(t, (e) => {
1157
- r.value = e;
1158
- });
1159
- o.type === "database" ? i.value = `Successfully attached database ${o.name}` : i.value = `Successfully imported ${o.name}`, n.value = !1, setTimeout(() => {
1160
- i.value = "";
1161
- }, 5e3), a.value && (a.value.value = "");
1162
- } catch (e) {
1163
- n.value = !1, console.error(`Error processing ${t.name}:`, e), alert(`Error processing ${t.name}: ${e instanceof Error ? e.message : "Unknown error"}`);
1164
- }
1165
- };
1166
- return {
1167
- isDragging: t,
1168
- isLoading: n,
1169
- loadingMessage: r,
1170
- successMessage: i,
1171
- fileInput: a,
1172
- openFilePicker: l,
1173
- handleDragOver: o,
1174
- handleDragLeave: s,
1175
- handleDrop: u,
1176
- handleFileInput: c
1177
- };
1178
- }
1179
- }), Gt = ["data-testid"], Kt = ["data-testid"], qt = { class: "upload-copy truncate-text" }, Jt = {
1180
- key: 1,
1181
- class: "upload-row"
1182
- }, Yt = ["data-testid"], Xt = { class: "upload-copy truncate-text" };
1183
- function Zt(e, t, n, r, i, a) {
1184
- return U(), I("button", {
1185
- type: "button",
1186
- class: H(["file-upload-container", {
1187
- "drag-active": e.isDragging,
1188
- loading: e.isLoading
1189
- }]),
1190
- "data-testid": `duckdb-importer-${e.connection.name}`,
1191
- onClick: t[1] ||= (...t) => e.openFilePicker && e.openFilePicker(...t),
1192
- onDragover: t[2] ||= Q((...t) => e.handleDragOver && e.handleDragOver(...t), ["prevent"]),
1193
- onDragleave: t[3] ||= Q((...t) => e.handleDragLeave && e.handleDragLeave(...t), ["prevent"]),
1194
- onDrop: t[4] ||= Q((...t) => e.handleDrop && e.handleDrop(...t), ["prevent"])
1195
- }, [L("input", {
1196
- type: "file",
1197
- accept: ".csv,.parquet,.db,.sqlite",
1198
- onChange: t[0] ||= (...t) => e.handleFileInput && e.handleFileInput(...t),
1199
- ref: "fileInput",
1200
- class: "hidden-input"
1201
- }, null, 544), e.successMessage && !e.isLoading ? (U(), I("div", {
1202
- key: 0,
1203
- class: "upload-row upload-success",
1204
- "data-testid": `duckdb-import-success-${e.connection.name}`
1205
- }, [t[5] ||= L("i", { class: "mdi mdi-check-circle-outline upload-icon" }, null, -1), L("span", qt, J(e.successMessage), 1)], 8, Kt)) : e.isLoading ? (U(), I("div", {
1206
- key: 2,
1207
- class: "upload-row loading-container",
1208
- "data-testid": `duckdb-import-loading-${e.connection.name}`
1209
- }, [t[7] ||= L("span", { class: "spinner" }, null, -1), L("span", Xt, J(e.loadingMessage), 1)], 8, Yt)) : (U(), I("div", Jt, [...t[6] ||= [L("i", { class: "mdi mdi-plus upload-icon" }, null, -1), L("span", { class: "upload-copy" }, [L("span", { class: "upload-label" }, "Import data..."), L("span", { class: "upload-subtitle" }, "CSV, Parquet, DB")], -1)]]))], 42, Gt);
1210
- }
1211
- var Qt = /*#__PURE__*/ e(Wt, [["render", Zt], ["__scopeId", "data-v-65f4bd26"]]), $t = { class: "model-anchor" }, en = { class: "model-trigger-text truncate-text" }, tn = "~new-model", nn = 180, $ = 8, rn = {
1212
- name: "ConnectionListItem",
1213
- components: {
1214
- SidebarItem: Me,
1215
- ConnectionIcon: Vt,
1216
- ConnectionStatusIcon: Ne,
1217
- ConnectionRefresh: Ut,
1218
- CreateEditorFromDatasourcePopup: k,
1219
- DuckDBImporter: Qt,
1220
- ModelSelector: /* @__PURE__ */ e(/* @__PURE__ */ B({
1221
- __name: "ModelSelector",
1222
- props: { connection: {} },
1223
- setup(e) {
1224
- let t = e, n = V("modelStore"), r = V("connectionStore"), i = V("saveConnections", () => {}), a = V("saveModels", () => {}), o = W(!1), s = W({
1225
- x: 0,
1226
- y: 0
1227
- }), c = N(() => n ? Object.keys(n.models).filter((e) => !n.models[e].deleted).sort((e, t) => e.localeCompare(t)) : []), l = N(() => {
1228
- let e = c.value.map((e) => ({
1229
- id: e,
1230
- label: e,
1231
- icon: e === t.connection.model ? "mdi-check" : "mdi-cube-outline"
1232
- }));
1233
- return e.length > 0 && e.push({
1234
- id: "model-separator",
1235
- kind: "separator"
1236
- }), e.push({
1237
- id: tn,
1238
- label: "Create New Model",
1239
- icon: "mdi-plus"
1240
- }), e;
1241
- }), u = (e) => {
1242
- if (o.value) {
1243
- o.value = !1;
1244
- return;
1245
- }
1246
- let t = e.currentTarget.getBoundingClientRect(), n = l.value.length * 27 + 6, r = Math.max($, window.innerWidth - nn - $), i = Math.max($, window.innerHeight - n - $);
1247
- s.value = {
1248
- x: Math.min(r, Math.max($, t.left)),
1249
- y: Math.min(i, Math.max($, t.bottom + 4))
1250
- }, o.value = !0;
1251
- }, d = (e) => {
1252
- if (!n || !n.models[e]) return e;
1253
- let t = 2;
1254
- for (; n.models[`${e}-${t}`];) t += 1;
1255
- return `${e}-${t}`;
1256
- }, f = async (e) => {
1257
- if (!r) return;
1258
- let s = e.id, c = !1;
1259
- s === tn && (s = d(t.connection.name), n?.newModelConfig(s), c = !0);
1260
- let l = r.connections[t.connection.id] || r.connectionByName(t.connection.name);
1261
- l && l.setModel(s), o.value = !1, c && await a(), await i();
1262
- };
1263
- return (t, n) => (U(), I("div", $t, [L("button", {
1264
- class: "model-trigger truncate-text",
1265
- type: "button",
1266
- "data-testid": "model-selector-trigger",
1267
- onClick: Q(u, ["stop"])
1268
- }, [L("span", en, J(e.connection.model || "Set model"), 1), n[1] ||= L("i", { class: "mdi mdi-chevron-down model-trigger-icon" }, null, -1)]), z(He, {
1269
- items: l.value,
1270
- position: s.value,
1271
- "is-visible": o.value,
1272
- id: `model-selector-${e.connection.id || e.connection.name}`,
1273
- onItemClick: f,
1274
- onClose: n[0] ||= (e) => o.value = !1
1275
- }, null, 8, [
1276
- "items",
1277
- "position",
1278
- "is-visible",
1279
- "id"
1280
- ])]));
1281
- }
1282
- }), [["__scopeId", "data-v-b85b7f90"]]),
1283
- Tooltip: S,
1284
- SidebarOverflowMenu: Je
1285
- },
1286
- props: {
1287
- item: {
1288
- type: Object,
1289
- required: !0
1290
- },
1291
- isCollapsed: {
1292
- type: Boolean,
1293
- default: !0
1294
- },
1295
- isSelected: {
1296
- type: Boolean,
1297
- default: !1
1298
- },
1299
- testTag: {
1300
- type: String,
1301
- default: ""
1302
- }
1303
- },
1304
- emits: [
1305
- "toggle",
1306
- "click",
1307
- "refresh",
1308
- "updateBigqueryProject",
1309
- "updateBigqueryBrowsingProject",
1310
- "updateMotherDuckToken",
1311
- "updateSnowflakePrivateKey",
1312
- "updateSnowflakeAccount",
1313
- "updateSnowflakeUsername",
1314
- "toggleSaveCredential",
1315
- "toggleDuckdbCompatibleFetch",
1316
- "deleteConnection",
1317
- "toggleMobileMenu"
1318
- ],
1319
- setup(e, { emit: t }) {
1320
- let n = ee(), r = V("editorStore"), i = V("saveEditors"), a = V("setActiveScreen"), o = V("setActiveEditor");
1321
- if (!r || !i || !a || !o) throw Error("Editor store is not provided!");
1322
- let s = N(() => [
1323
- "connection",
1324
- "database",
1325
- "schema"
1326
- ].includes(e.item.type)), c = N(() => [
1327
- "connection",
1328
- "database",
1329
- "schema",
1330
- "table",
1331
- "schema"
1332
- ].includes(e.item.type)), l = () => [
1333
- "refresh-connection",
1334
- "refresh-database",
1335
- "refresh-schema",
1336
- "duckdb-upload",
1337
- "model",
1338
- "bigquery-project",
1339
- "bigquery-browsing-project",
1340
- "motherduck-token",
1341
- "snowflake-private-key",
1342
- "snowflake-account",
1343
- "snowflake-username",
1344
- "toggle-save-credential",
1345
- "duckdb-toggle-compatible-fetch"
1346
- ].includes(e.item.type) ? "" : e.item.name, u = () => {
1347
- c.value && t("click", e.item.id, e.item.connection?.id || e.item.connection?.name || "", e.item.type);
1348
- }, d = () => {
1349
- c.value && t("toggle", e.item.id, e.item.connection?.id || e.item.connection?.name || "", e.item.type);
1350
- }, f = () => {
1351
- t("toggleMobileMenu");
1352
- }, p = async (t) => {
1353
- try {
1354
- let n = `new-editor-${Date.now()}`, s = e.item.connection, c = s.storage === "remote", l = r.newEditor(n, t === "trilogy" ? "preql" : "sql", e.item.connection.name, void 0, c ? {
1355
- storage: "remote",
1356
- remoteStoreId: s.remoteStoreId || null,
1357
- remotePath: n
1358
- } : void 0);
1359
- await i(), o(l.id), a("editors");
1360
- } catch (e) {
1361
- console.error("Failed to create new editor:", e);
1362
- }
1363
- }, m = () => {
1364
- let n = e.item.connection?.id || e.item.connection?.name || "";
1365
- t("refresh", n, n, "connection");
1366
- }, h = () => {
1367
- t("refresh", e.item.id, e.item.connection?.id || e.item.connection?.name || "", "database");
1368
- }, g = () => {
1369
- t("refresh", e.item.id, e.item.connection?.id || e.item.connection?.name || "", "schema");
1370
- }, _ = (e) => {
1371
- t("deleteConnection", e);
1372
- }, v = N(() => {
1373
- if (e.item.type !== "connection") return [];
1374
- let t = [];
1375
- return n.value && t.push({
1376
- id: "query-history",
1377
- label: "Query history",
1378
- icon: "mdi-history"
1379
- }), t.push({
1380
- id: "new-sql",
1381
- label: "New SQL editor",
1382
- icon: "mdi-file-document-plus-outline"
1383
- }, {
1384
- id: "new-trilogy",
1385
- label: "New Trilogy editor",
1386
- icon: "mdi-file-document-plus-outline"
1387
- }, {
1388
- id: "refresh",
1389
- label: "Refresh connection",
1390
- icon: "mdi-refresh"
1391
- }, {
1392
- id: "delete-separator",
1393
- kind: "separator"
1394
- }, {
1395
- id: "delete",
1396
- label: "Delete connection",
1397
- icon: "mdi-trash-can-outline",
1398
- danger: !0
1399
- }), t;
1400
- }), y = (t) => {
1401
- switch (t.id) {
1402
- case "query-history":
1403
- f();
1404
- break;
1405
- case "new-sql":
1406
- p("sql");
1407
- break;
1408
- case "new-trilogy":
1409
- p("trilogy");
1410
- break;
1411
- case "refresh":
1412
- m();
1413
- break;
1414
- case "delete":
1415
- _(e.item.connection);
1416
- break;
1417
- }
1418
- }, b = W(e.item.connection.projectId || ""), x = W(e.item.connection.browsingProjectId || ""), S = W(e.item.connection.mdToken || ""), C = W(e.item.connection.config?.privateKey || ""), w = W(e.item.connection.config?.account || ""), T = W(e.item.connection.config?.username || ""), E = W(!1), D = W(!1), O = W(!1), k = W(!1), A = W(!1), j = (e) => {
1419
- e.value = !0, setTimeout(() => {
1420
- e.value = !1;
1421
- }, 1500);
1422
- }, M = (e, t) => {
1423
- let n;
1424
- return (...r) => {
1425
- clearTimeout(n), n = setTimeout(() => e(...r), t);
1426
- };
1427
- };
1428
- return {
1429
- isMobile: n,
1430
- isExpandable: s,
1431
- getItemName: l,
1432
- handleItemClick: u,
1433
- handleToggle: d,
1434
- toggleMobileMenu: f,
1435
- handleRefreshConnectionClick: m,
1436
- handleRefreshDatabaseClick: h,
1437
- handleRefreshSchemaClick: g,
1438
- deleteConnection: _,
1439
- contextMenuItems: v,
1440
- handleContextMenuItemClick: y,
1441
- bigqueryProject: b,
1442
- bigqueryBrowsingProject: x,
1443
- mdToken: S,
1444
- snowflakePrivateKey: C,
1445
- snowflakeAccount: w,
1446
- snowflakeUsername: T,
1447
- showBillingSuccess: E,
1448
- showBrowsingSuccess: D,
1449
- showPrivateKeySuccess: O,
1450
- showAccountSuccess: k,
1451
- showUsernameSuccess: A,
1452
- debouncedUpdateBigqueryProject: M(() => {
1453
- t("updateBigqueryProject", e.item.connection, b.value), j(E);
1454
- }, 500),
1455
- debouncedUpdateBigqueryBrowsingProject: M(() => {
1456
- t("updateBigqueryBrowsingProject", e.item.connection, x.value), j(D);
1457
- }, 500),
1458
- debouncedUpdateSnowflakePrivateKey: M(() => {
1459
- t("updateSnowflakePrivateKey", e.item.connection, C.value), j(O);
1460
- }, 500),
1461
- debouncedUpdateSnowflakeAccount: M(() => {
1462
- t("updateSnowflakeAccount", e.item.connection, w.value), j(k);
1463
- }, 500),
1464
- debouncedUpdateSnowflakeUsername: M(() => {
1465
- t("updateSnowflakeUsername", e.item.connection, T.value), j(A);
1466
- }, 500),
1467
- updateMotherDuckToken: (e, n) => {
1468
- t("updateMotherDuckToken", e, n);
1469
- },
1470
- toggleSaveCredential: (e) => {
1471
- t("toggleSaveCredential", e);
1472
- },
1473
- toggleCompatibleFetch: (e) => {
1474
- t("toggleDuckdbCompatibleFetch", e);
1475
- }
1476
- };
1477
- }
1478
- }, an = {
1479
- key: 1,
1480
- class: "mdi mdi-database node-icon"
1481
- }, on = {
1482
- key: 2,
1483
- class: "mdi mdi-folder-outline node-icon"
1484
- }, sn = {
1485
- key: 3,
1486
- class: "mdi mdi-table node-icon"
1487
- }, cn = {
1488
- key: 4,
1489
- class: "mdi mdi-alert-circle node-icon"
1490
- }, ln = {
1491
- key: 5,
1492
- class: "mdi mdi-loading mdi-spin node-icon"
1493
- }, un = {
1494
- key: 6,
1495
- class: "mdi mdi-table-column node-icon"
1496
- }, dn = {
1497
- key: 0,
1498
- class: "mdi mdi-check-circle success-icon"
1499
- }, fn = {
1500
- key: 0,
1501
- class: "mdi mdi-check-circle success-icon"
1502
- }, pn = {
1503
- key: 0,
1504
- class: "mdi mdi-check-circle success-icon"
1505
- }, mn = {
1506
- key: 0,
1507
- class: "mdi mdi-check-circle success-icon"
1508
- }, hn = {
1509
- key: 0,
1510
- class: "mdi mdi-check-circle success-icon"
1511
- }, gn = { class: "save-credential-toggle sidebar-toggle-row" }, _n = ["checked"], vn = { class: "save-credential-toggle sidebar-toggle-row" }, yn = ["checked"], bn = { key: 0 }, xn = {
1512
- key: 0,
1513
- class: "connection-actions"
1514
- }, Sn = {
1515
- key: 1,
1516
- class: "connection-actions"
1517
- };
1518
- function Cn(e, t, n, r, i, a) {
1519
- let o = q("connection-icon"), s = q("DuckDBImporter"), c = q("model-selector"), l = q("tooltip"), u = q("CreateEditorFromDatasourcePopup"), d = q("connection-refresh"), f = q("connection-status-icon"), p = q("sidebar-overflow-menu"), m = q("sidebar-item");
1520
- return U(), I("div", null, [z(m, {
1521
- "item-id": n.item.id,
1522
- name: r.getItemName(),
1523
- indent: n.item.indent,
1524
- "is-selected": n.isSelected,
1525
- "is-collapsible": r.isExpandable,
1526
- "is-collapsed": n.isCollapsed,
1527
- itemType: n.testTag ? n.testTag : "connection",
1528
- onClick: r.handleItemClick,
1529
- onToggle: r.handleToggle
1530
- }, {
1531
- icon: X(() => [n.item.type === "connection" ? (U(), P(o, {
1532
- key: 0,
1533
- "connection-type": n.item.connection?.type
1534
- }, null, 8, ["connection-type"])) : n.item.type === "database" ? (U(), I("i", an)) : n.item.type === "schema" ? (U(), I("i", on)) : n.item.type === "table" ? (U(), I("i", sn)) : n.item.type === "error" ? (U(), I("i", cn)) : n.item.type === "loading" ? (U(), I("i", ln)) : n.item.type === "column" ? (U(), I("i", un)) : F("", !0)]),
1535
- name: X(() => [n.item.type === "refresh-connection" ? (U(), I("div", {
1536
- key: 0,
1537
- class: "refresh title-pad-left truncate-text sidebar-sub-item",
1538
- onClick: t[0] ||= (...e) => r.handleRefreshConnectionClick && r.handleRefreshConnectionClick(...e)
1539
- }, J(n.item.name), 1)) : n.item.type === "refresh-database" ? (U(), I("div", {
1540
- key: 1,
1541
- class: "refresh title-pad-left truncate-text sidebar-sub-item",
1542
- onClick: t[1] ||= (...e) => r.handleRefreshDatabaseClick && r.handleRefreshDatabaseClick(...e)
1543
- }, J(n.item.name), 1)) : n.item.type === "refresh-schema" ? (U(), I("div", {
1544
- key: 2,
1545
- class: "refresh title-pad-left truncate-text sidebar-sub-item",
1546
- onClick: t[2] ||= (...e) => r.handleRefreshSchemaClick && r.handleRefreshSchemaClick(...e)
1547
- }, J(n.item.name), 1)) : n.item.type === "duckdb-upload" ? (U(), P(s, {
1548
- key: 3,
1549
- connection: n.item.connection
1550
- }, null, 8, ["connection"])) : n.item.type === "model" ? (U(), I("div", {
1551
- key: 4,
1552
- class: "connection-meta-row",
1553
- onClick: t[3] ||= Q(() => {}, ["stop"])
1554
- }, [t[28] ||= L("span", { class: "meta-label" }, "Model:", -1), z(c, { connection: n.item.connection }, null, 8, ["connection"])])) : n.item.type === "bigquery-project" ? (U(), I("div", {
1555
- key: 5,
1556
- class: "bq-project-container",
1557
- onClick: t[6] ||= Q(() => {}, ["stop"])
1558
- }, [t[29] ||= L("label", { class: "input-label" }, "Billing", -1), L("span", null, [z(M, { name: "fade" }, {
1559
- default: X(() => [r.showBillingSuccess ? (U(), I("i", dn)) : F("", !0)]),
1560
- _: 1
1561
- }), Z(L("input", {
1562
- type: "text",
1563
- "onUpdate:modelValue": t[4] ||= (e) => r.bigqueryProject = e,
1564
- placeholder: "Billing Project",
1565
- class: "bq-project-input sidebar-control-input",
1566
- onInput: t[5] ||= (...e) => r.debouncedUpdateBigqueryProject && r.debouncedUpdateBigqueryProject(...e)
1567
- }, null, 544), [[Y, r.bigqueryProject]])])])) : n.item.type === "bigquery-browsing-project" ? (U(), I("div", {
1568
- key: 6,
1569
- class: "bq-project-container",
1570
- onClick: t[9] ||= Q(() => {}, ["stop"])
1571
- }, [t[30] ||= L("label", { class: "input-label" }, "Browsing", -1), L("span", null, [z(M, { name: "fade" }, {
1572
- default: X(() => [r.showBrowsingSuccess ? (U(), I("i", fn)) : F("", !0)]),
1573
- _: 1
1574
- }), Z(L("input", {
1575
- type: "text",
1576
- "onUpdate:modelValue": t[7] ||= (e) => r.bigqueryBrowsingProject = e,
1577
- placeholder: "Browsing Project",
1578
- class: "bq-project-input sidebar-control-input",
1579
- onInput: t[8] ||= (...e) => r.debouncedUpdateBigqueryBrowsingProject && r.debouncedUpdateBigqueryBrowsingProject(...e)
1580
- }, null, 544), [[Y, r.bigqueryBrowsingProject]])])])) : n.item.type === "motherduck-token" ? (U(), I("div", {
1581
- key: 7,
1582
- class: "md-token-container",
1583
- onClick: t[12] ||= Q(() => {}, ["stop"])
1584
- }, [L("form", { onSubmit: t[11] ||= Q((e) => r.updateMotherDuckToken(n.item.connection, r.mdToken), ["prevent"]) }, [t[31] ||= L("button", {
1585
- type: "submit",
1586
- class: "customize-button sidebar-control-button"
1587
- }, " Update Token ", -1), Z(L("input", {
1588
- type: "password",
1589
- "onUpdate:modelValue": t[10] ||= (e) => r.mdToken = e,
1590
- placeholder: "mdToken",
1591
- class: "connection-customize sidebar-control-input"
1592
- }, null, 512), [[Y, r.mdToken]])], 32)])) : n.item.type === "snowflake-private-key" ? (U(), I("div", {
1593
- key: 8,
1594
- class: "bq-project-container",
1595
- onClick: t[15] ||= Q(() => {}, ["stop"])
1596
- }, [t[32] ||= L("label", { class: "input-label" }, "Private Key", -1), L("span", null, [z(M, { name: "fade" }, {
1597
- default: X(() => [r.showPrivateKeySuccess ? (U(), I("i", pn)) : F("", !0)]),
1598
- _: 1
1599
- }), Z(L("input", {
1600
- type: "password",
1601
- "onUpdate:modelValue": t[13] ||= (e) => r.snowflakePrivateKey = e,
1602
- placeholder: "Private Key",
1603
- class: "bq-project-input sidebar-control-input",
1604
- onInput: t[14] ||= (...e) => r.debouncedUpdateSnowflakePrivateKey && r.debouncedUpdateSnowflakePrivateKey(...e)
1605
- }, null, 544), [[Y, r.snowflakePrivateKey]])])])) : n.item.type === "snowflake-account" ? (U(), I("div", {
1606
- key: 9,
1607
- class: "bq-project-container",
1608
- onClick: t[18] ||= Q(() => {}, ["stop"])
1609
- }, [t[33] ||= L("label", { class: "input-label" }, "Account", -1), L("span", null, [z(M, { name: "fade" }, {
1610
- default: X(() => [r.showAccountSuccess ? (U(), I("i", mn)) : F("", !0)]),
1611
- _: 1
1612
- }), Z(L("input", {
1613
- type: "text",
1614
- "onUpdate:modelValue": t[16] ||= (e) => r.snowflakeAccount = e,
1615
- placeholder: "Account",
1616
- class: "bq-project-input sidebar-control-input",
1617
- onInput: t[17] ||= (...e) => r.debouncedUpdateSnowflakeAccount && r.debouncedUpdateSnowflakeAccount(...e)
1618
- }, null, 544), [[Y, r.snowflakeAccount]])])])) : n.item.type === "snowflake-username" ? (U(), I("div", {
1619
- key: 10,
1620
- class: "bq-project-container",
1621
- onClick: t[21] ||= Q(() => {}, ["stop"])
1622
- }, [t[34] ||= L("label", { class: "input-label" }, "Username", -1), L("span", null, [z(M, { name: "fade" }, {
1623
- default: X(() => [r.showUsernameSuccess ? (U(), I("i", hn)) : F("", !0)]),
1624
- _: 1
1625
- }), Z(L("input", {
1626
- type: "text",
1627
- "onUpdate:modelValue": t[19] ||= (e) => r.snowflakeUsername = e,
1628
- placeholder: "Username",
1629
- class: "bq-project-input sidebar-control-input",
1630
- onInput: t[20] ||= (...e) => r.debouncedUpdateSnowflakeUsername && r.debouncedUpdateSnowflakeUsername(...e)
1631
- }, null, 544), [[Y, r.snowflakeUsername]])])])) : n.item.type === "toggle-save-credential" ? (U(), I("div", {
1632
- key: 11,
1633
- class: "md-token-container",
1634
- onClick: t[23] ||= Q(() => {}, ["stop"])
1635
- }, [L("label", gn, [L("input", {
1636
- type: "checkbox",
1637
- checked: n.item.connection.saveCredential,
1638
- onChange: t[22] ||= (e) => r.toggleSaveCredential(n.item.connection)
1639
- }, null, 40, _n), t[35] ||= L("span", { class: "checkbox-label" }, "Save Credentials", -1)])])) : n.item.type === "duckdb-toggle-compatible-fetch" ? (U(), I("div", {
1640
- key: 12,
1641
- class: "md-token-container",
1642
- onClick: t[25] ||= Q(() => {}, ["stop"])
1643
- }, [z(l, {
1644
- position: "left",
1645
- content: "Check to support fetches from remote sources with unreliable headers, especially when using FireFox"
1646
- }, {
1647
- default: X(() => [L("label", vn, [L("input", {
1648
- type: "checkbox",
1649
- checked: n.item.connection.useCompatibleHttpFetch,
1650
- onChange: t[24] ||= (e) => r.toggleCompatibleFetch(n.item.connection)
1651
- }, null, 40, yn), t[36] ||= L("span", { class: "checkbox-label" }, "Disable Optimized Scans", -1)])]),
1652
- _: 1
1653
- })])) : (U(), I("span", {
1654
- key: 13,
1655
- class: H(["title-pad-left truncate-text", { "error-indicator": n.item.type === "error" }])
1656
- }, [
1657
- R(J(n.item.name) + " ", 1),
1658
- n.item.count !== void 0 && n.item.count > 0 ? (U(), I("span", bn, " (" + J(n.item.count) + ") ", 1)) : F("", !0),
1659
- n.item.type === "database" ? (U(), I("span", {
1660
- key: 1,
1661
- class: "hover-icon",
1662
- onClick: t[26] ||= Q((...e) => r.handleRefreshDatabaseClick && r.handleRefreshDatabaseClick(...e), ["stop"])
1663
- }, [...t[37] ||= [L("i", { class: "mdi mdi-refresh" }, null, -1)]])) : F("", !0),
1664
- n.item.type === "schema" ? (U(), I("span", {
1665
- key: 2,
1666
- class: "hover-icon",
1667
- onClick: t[27] ||= Q((...e) => r.handleRefreshSchemaClick && r.handleRefreshSchemaClick(...e), ["stop"])
1668
- }, [...t[38] ||= [L("i", { class: "mdi mdi-refresh" }, null, -1)]])) : F("", !0)
1669
- ], 2))]),
1670
- "extra-content": X(() => [n.item.type === "table" ? (U(), I("div", xn, [z(u, {
1671
- class: "hover-icon",
1672
- connection: n.item.connection,
1673
- table: n.item.object,
1674
- mode: "icon"
1675
- }, null, 8, ["connection", "table"])])) : n.item.type === "connection" ? (U(), I("div", Sn, [n.item.connection?.connected ? (U(), P(f, {
1676
- key: 1,
1677
- connection: n.item.connection
1678
- }, null, 8, ["connection"])) : (U(), P(d, {
1679
- key: 0,
1680
- connection: n.item.connection,
1681
- onRefresh: r.handleRefreshConnectionClick
1682
- }, null, 8, ["connection", "onRefresh"])), z(p, {
1683
- items: r.contextMenuItems,
1684
- tooltip: "Connection actions",
1685
- "test-id-base": `connection-actions-${n.item.id}`,
1686
- onSelect: r.handleContextMenuItemClick
1687
- }, null, 8, [
1688
- "items",
1689
- "test-id-base",
1690
- "onSelect"
1691
- ])])) : F("", !0)]),
1692
- _: 1
1693
- }, 8, [
1694
- "item-id",
1695
- "name",
1696
- "indent",
1697
- "is-selected",
1698
- "is-collapsible",
1699
- "is-collapsed",
1700
- "itemType",
1701
- "onClick",
1702
- "onToggle"
1703
- ])]);
1704
- }
1705
- //#endregion
1706
- //#region components/sidebar/ConnectionList.vue?vue&type=script&lang.ts
1707
- var wn = {
1708
- name: "ConnectionList",
1709
- props: {
1710
- activeConnectionKey: {
1711
- type: String,
1712
- default: "",
1713
- optional: !0
1714
- },
1715
- testTag: {
1716
- type: String,
1717
- default: ""
1718
- }
1719
- },
1720
- data() {
1721
- return {
1722
- showDeleteConfirmationState: !1,
1723
- connectionToDelete: ""
1724
- };
1725
- },
1726
- setup(e, { emit: t }) {
1727
- let n = V("connectionStore"), r = V("saveConnections"), i = V("saveEditors"), a = V("modelStore"), o = V("editorStore"), s = V("dashboardStore", null), f = V("saveDashboards", null), p = ee();
1728
- if (!n || !r || !i || !a || !o) throw Error("Connection store is not provided!");
1729
- let m = W({}), h = W({}), g = W({}), _ = W(!1), v = W(""), y = W(null), b = () => {
1730
- v.value = "";
1731
- }, x = (e, t) => {
1732
- e.type === "motherduck" && (e.setAttribute("mdToken", t), n.resetConnection(e.id));
1733
- }, S = async (e, t) => {
1734
- e.type === "snowflake" && (e.setPrivateKey(t), await r(), await n.resetConnection(e.id));
1735
- }, C = async (e, t) => {
1736
- e.type === "snowflake" && (e.setAccount(t), await r(), n.resetConnection(e.id));
1737
- }, w = async (e, t) => {
1738
- e.type === "snowflake" && (e.setUsername(t), await r(), n.resetConnection(e.id));
1739
- }, T = async (e, t) => {
1740
- e.type === "bigquery-oauth" && (e.setAttribute("projectId", t), await r(), n.resetConnection(e.id));
1741
- }, E = async (e, t) => {
1742
- e.type === "bigquery-oauth" && (e.setAttribute("browsingProjectId", t), await r(), e.databases = [], await e.getDatabases());
1743
- }, D = (e) => {
1744
- e.saveCredential = !e.saveCredential, n.resetConnection(e.id);
1745
- }, O = async (e) => {
1746
- e?.type !== "duckdb" || typeof e.setUseCompatibleHttpFetch != "function" || (e.setUseCompatibleHttpFetch(!e.useCompatibleHttpFetch), await r(), await n.resetConnection(e.id));
1747
- }, k = () => {
1748
- t("toggle-mobile-menu");
1749
- }, { overrides: A, isCollapsed: j, open: M, toggle: P } = he(), F = async (e, t, r) => {
1750
- try {
1751
- h.value[e] = !0;
1752
- let i = n.connections[t] || n.connectionByName(t);
1753
- if (!i) return;
1754
- if (i.connected || await n.resetConnection(i.id), r === "connection" && (console.log("getting databases"), await i.getDatabases()), r === "database") {
1755
- console.log("getting schemas");
1756
- let t = e.split("+")[1];
1757
- if (await i.refreshDatabase(t), !i.hasSchema) {
1758
- let e = i.databases?.find((e) => e.name === t);
1759
- e && e.schemas.length > 0 && await i.refreshSchema(t, e.schemas[0].name);
1760
- }
1761
- }
1762
- if (r === "schema") {
1763
- let t = e.split("+")[1], n = e.split("+")[2];
1764
- await i.refreshSchema(t, n);
1765
- }
1766
- if (r === "table") {
1767
- let t = e.split("+")[1], n = e.split("+")[2], r = e.split("+")[3], a = i.databases?.find((e) => e.name === t)?.schemas.find((e) => e.name === n)?.tables.find((e) => e.name === r);
1768
- a && (a.columns = await i.getColumns(t, n, r));
1769
- }
1770
- delete g.value[e];
1771
- } catch (t) {
1772
- console.error(t), t instanceof Error ? g.value[e] = t.message : g.value[e] = "An error occurred";
1773
- }
1774
- delete h.value[e];
1775
- }, I = async (e, n, r) => {
1776
- console.log("emitting connection key selected:", e), t("connection-key-selected", e);
1777
- }, L = async (e, t, r) => {
1778
- let i = n.connections[t] || n.connectionByName(t);
1779
- if (i) if (r === "connection" && j(e)) M(e), (i.databases?.length === 0 || i.databases?.length === void 0) && await F(e, t, r);
1780
- else if (r === "database" && j(e)) {
1781
- M(e);
1782
- let n = e.split("+")[1], a = i.databases?.find((e) => e.name === n);
1783
- a && a.schemas?.length === 0 && await F(e, t, r);
1784
- } else if (r === "schema" && j(e)) {
1785
- M(e);
1786
- let n = e.split("+")[1], a = e.split("+")[2], o = i.databases?.find((e) => e.name === n)?.schemas?.find((e) => e.name === a);
1787
- o && o.tables?.length === 0 && await F(e, t, r);
1788
- } else if (r === "table" && j(e)) {
1789
- let n = e.split("+")[1], a = e.split("+")[3], o = e.split("+")[2];
1790
- if (o) {
1791
- let s = await i.databases?.find((e) => e.name === n)?.schemas?.find((e) => e.name === o)?.tables?.find((e) => e.name === a);
1792
- if (s && s.columns.length === 0) {
1793
- await F(e, t, r);
1794
- return;
1795
- }
1796
- }
1797
- } else P(e);
1798
- }, te = N(() => u(Object.values(n.connections), j, h.value, g.value));
1799
- return {
1800
- connectionStore: n,
1801
- editorStore: o,
1802
- dashboardStore: s,
1803
- contentList: te,
1804
- filteredContentList: N(() => c(te.value, v.value)),
1805
- toggleCollapse: L,
1806
- handleItemClick: I,
1807
- toggleMobileMenu: k,
1808
- collapsed: A,
1809
- isCollapsed: j,
1810
- saveConnections: r,
1811
- saveEditors: i,
1812
- saveDashboards: f,
1813
- modelStore: a,
1814
- connectionModelVisible: m,
1815
- updateMotherDuckToken: x,
1816
- updateSnowflakePrivateKey: S,
1817
- updateSnowflakeAccount: C,
1818
- updateSnowflakeUsername: w,
1819
- toggleSaveCredential: D,
1820
- toggleDuckdbCompatibleFetch: O,
1821
- updateBigqueryProject: T,
1822
- updateBigqueryBrowsingProject: E,
1823
- refreshId: F,
1824
- rightSplit: (e) => {
1825
- let t = e.lastIndexOf("+");
1826
- return t === -1 ? e : e.substring(0, t);
1827
- },
1828
- mobileTree: y,
1829
- isConnectionConfig: (e) => l.has(e.type),
1830
- isConnectionBranch: (e) => d.has(e.type),
1831
- expandMobileBranch: async (e) => {
1832
- j(e.id) && await L(e.id, e.connection?.id || e.connection?.name, e.type);
1833
- },
1834
- selectMobileItem: (e) => I(e.id, "", ""),
1835
- handleConnectionTreeClick: (e) => {
1836
- p.value ? y.value?.openItem(e) : I(e.id, "", "");
1837
- },
1838
- creatorVisible: _,
1839
- isMobile: p,
1840
- searchTerm: v,
1841
- clearSearch: b
1842
- };
1843
- },
1844
- components: {
1845
- SidebarList: Ce,
1846
- ConnectionCreatorInline: Pt,
1847
- LoadingButton: C,
1848
- StatusIcon: O,
1849
- Tooltip: S,
1850
- ConnectionListItem: /* @__PURE__ */ e(rn, [["render", Cn], ["__scopeId", "data-v-f67ee2c5"]]),
1851
- MobileTreeList: ut
1852
- },
1853
- methods: {
1854
- resetConnection(e) {
1855
- return this.connectionStore.resetConnection(e.id);
1856
- },
1857
- showDeleteConfirmation(e) {
1858
- this.connectionToDelete = e.id, this.showDeleteConfirmationState = !0;
1859
- },
1860
- cancelDelete() {
1861
- this.showDeleteConfirmationState = !1, this.connectionToDelete = "";
1862
- },
1863
- async confirmDelete() {
1864
- if (this.connectionToDelete) {
1865
- if (!this.connectionStore.connections[this.connectionToDelete]) {
1866
- this.showDeleteConfirmationState = !1, this.connectionToDelete = "";
1867
- return;
1868
- }
1869
- for (let e of Object.values(this.editorStore.editors)) e.connectionId === this.connectionToDelete && e.delete();
1870
- if (this.dashboardStore) for (let e of Object.values(this.dashboardStore.dashboards)) e.connectionId === this.connectionToDelete && e.delete();
1871
- this.connectionStore.deleteConnection(this.connectionToDelete);
1872
- let e = [this.saveConnections(), this.saveEditors()];
1873
- this.saveDashboards && e.push(this.saveDashboards()), await Promise.all(e), this.connectionStore.purgeDeletedConnections(), this.dashboardStore && this.dashboardStore.purgeDeletedDashboards();
1874
- }
1875
- this.showDeleteConfirmationState = !1, this.connectionToDelete = "";
1876
- },
1877
- deleteConnection(e) {
1878
- this.showDeleteConfirmation(e);
1879
- }
1880
- },
1881
- computed: {
1882
- connections() {
1883
- return Object.values(this.connectionStore.connections);
1884
- },
1885
- modelList() {
1886
- return Object.keys(this.modelStore.models);
1887
- }
1888
- }
1889
- }, Tn = { class: "connections-header" }, En = ["data-testid"], Dn = { class: "search-container" }, On = ["data-testid"], kn = ["data-testid"], An = { class: "confirmation-dialog" }, jn = { class: "dialog-actions" };
1890
- function Mn(e, t, n, r, i, a) {
1891
- let o = q("connection-creator-inline"), s = q("connection-list-item"), c = q("mobile-tree-list"), l = q("sidebar-list");
1892
- return U(), P(l, { title: "Connections" }, {
1893
- header: X(() => [L("div", Tn, [t[8] ||= L("h3", { class: "font-sans sidebar-header" }, "Connections", -1), L("button", {
1894
- class: "sidebar-control-button sidebar-header-action sidebar-primary-create connections-new-btn",
1895
- onClick: t[0] ||= (e) => r.creatorVisible = !r.creatorVisible,
1896
- "data-testid": n.testTag ? `connection-creator-add-${n.testTag}` : "connection-creator-add"
1897
- }, [t[7] ||= L("i", { class: "mdi mdi-plus" }, null, -1), R(" " + J(r.creatorVisible ? "Close" : "New"), 1)], 8, En)])]),
1898
- actions: X(() => [z(o, {
1899
- visible: r.creatorVisible,
1900
- onClose: t[1] ||= (e) => r.creatorVisible = !r.creatorVisible
1901
- }, null, 8, ["visible"]), L("div", Dn, [Z(L("input", {
1902
- type: "text",
1903
- "onUpdate:modelValue": t[2] ||= (e) => r.searchTerm = e,
1904
- placeholder: "Search objects...",
1905
- class: "search-input",
1906
- "data-testid": n.testTag ? `connection-search-${n.testTag}` : "connection-search"
1907
- }, null, 8, On), [[Y, r.searchTerm]]), r.searchTerm ? (U(), I("button", {
1908
- key: 0,
1909
- onClick: t[3] ||= (...e) => r.clearSearch && r.clearSearch(...e),
1910
- class: "clear-search-btn sidebar-icon-button",
1911
- "data-testid": n.testTag ? `connection-search-clear-${n.testTag}` : "connection-search-clear"
1912
- }, [...t[9] ||= [L("span", {
1913
- class: "mdi mdi-close",
1914
- "aria-hidden": "true"
1915
- }, null, -1)]], 8, kn)) : F("", !0)])]),
1916
- default: X(() => [z(c, {
1917
- "list-id": "connections",
1918
- ref: "mobileTree",
1919
- items: r.filteredContentList,
1920
- enabled: r.isMobile,
1921
- "is-branch": r.isConnectionBranch,
1922
- "is-config": r.isConnectionConfig,
1923
- "is-detail-branch": (e) => e.type === "connection",
1924
- onExpand: r.expandMobileBranch,
1925
- onSelect: r.selectMobileItem
1926
- }, {
1927
- item: X(({ item: e }) => [(U(), P(s, {
1928
- key: e.id,
1929
- item: e,
1930
- "is-collapsed": r.isCollapsed(e.id),
1931
- isSelected: e.id === n.activeConnectionKey,
1932
- isMobile: r.isMobile,
1933
- testTag: n.testTag,
1934
- onToggle: r.toggleCollapse,
1935
- onClick: (t) => r.handleConnectionTreeClick(e),
1936
- onRefresh: r.refreshId,
1937
- onUpdateMotherduckToken: r.updateMotherDuckToken,
1938
- onUpdateBigqueryProject: r.updateBigqueryProject,
1939
- onUpdateBigqueryBrowsingProject: r.updateBigqueryBrowsingProject,
1940
- onUpdateSnowflakePrivateKey: r.updateSnowflakePrivateKey,
1941
- onUpdateSnowflakeAccount: r.updateSnowflakeAccount,
1942
- onUpdateSnowflakeUsername: r.updateSnowflakeUsername,
1943
- onToggleSaveCredential: r.toggleSaveCredential,
1944
- onToggleDuckdbCompatibleFetch: r.toggleDuckdbCompatibleFetch,
1945
- onToggleMobileMenu: r.toggleMobileMenu,
1946
- onDeleteConnection: a.deleteConnection
1947
- }, null, 8, [
1948
- "item",
1949
- "is-collapsed",
1950
- "isSelected",
1951
- "isMobile",
1952
- "testTag",
1953
- "onToggle",
1954
- "onClick",
1955
- "onRefresh",
1956
- "onUpdateMotherduckToken",
1957
- "onUpdateBigqueryProject",
1958
- "onUpdateBigqueryBrowsingProject",
1959
- "onUpdateSnowflakePrivateKey",
1960
- "onUpdateSnowflakeAccount",
1961
- "onUpdateSnowflakeUsername",
1962
- "onToggleSaveCredential",
1963
- "onToggleDuckdbCompatibleFetch",
1964
- "onToggleMobileMenu",
1965
- "onDeleteConnection"
1966
- ]))]),
1967
- _: 1
1968
- }, 8, [
1969
- "items",
1970
- "enabled",
1971
- "is-branch",
1972
- "is-config",
1973
- "is-detail-branch",
1974
- "onExpand",
1975
- "onSelect"
1976
- ]), i.showDeleteConfirmationState ? (U(), I("div", {
1977
- key: 0,
1978
- class: "confirmation-overlay",
1979
- onClick: t[6] ||= Q((...e) => a.cancelDelete && a.cancelDelete(...e), ["self"])
1980
- }, [L("div", An, [
1981
- t[10] ||= L("h3", null, "Confirm Deletion", -1),
1982
- t[11] ||= L("p", null, " Are you sure you want to delete this connection? All associated editors will be deleted. ", -1),
1983
- L("div", jn, [L("button", {
1984
- class: "cancel-btn",
1985
- onClick: t[4] ||= (...e) => a.cancelDelete && a.cancelDelete(...e)
1986
- }, "Cancel"), L("button", {
1987
- class: "confirm-btn",
1988
- onClick: t[5] ||= (...e) => a.confirmDelete && a.confirmDelete(...e)
1989
- }, "Delete")])
1990
- ])])) : F("", !0)]),
1991
- _: 1
1992
- });
1993
- }
1994
- var Nn = /*#__PURE__*/ e(wn, [["render", Mn], ["__scopeId", "data-v-54ca2dab"]]), Pn = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAQYElEQVR42u1bfZCdVXn/Pc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9pW3wqS5TvXPx+PjvleLVoehUoF0L1NJod9QsCBWETQnxXRL9FYt/IEH5cMlIWTScCbfFM//GhVqM70X9xPBVnPPP/F5hnnf6o/b4ZNL1hWUydy2Xsk3SSTtJJOkkn6Zmm/wMCt80FTC1f9QAAAABJRU5ErkJggg==", Fn = B({
1995
- name: "LLMProviderIcon",
1996
- props: { providerType: {
1997
- type: String,
1998
- required: !0
1999
- } },
2000
- setup() {
2001
- return { deepseekIcon: Pn };
2002
- }
2003
- }), In = { class: "provider-icon-container" }, Ln = {
2004
- key: 0,
2005
- class: "mdi mdi-alpha-c-circle",
2006
- title: "Anthropic"
2007
- }, Rn = {
2008
- key: 1,
2009
- class: "mdi mdi-flash",
2010
- title: "OpenAI"
2011
- }, zn = {
2012
- key: 2,
2013
- class: "mdi mdi-google",
2014
- title: "Google"
2015
- }, Bn = {
2016
- key: 3,
2017
- class: "mdi mdi-robot",
2018
- title: "OpenRouter"
2019
- }, Vn = ["src"], Hn = {
2020
- key: 5,
2021
- class: "mdi mdi-history demo-icon",
2022
- title: "Demo"
2023
- }, Un = {
2024
- key: 6,
2025
- class: "mdi mdi-robot",
2026
- title: "LLM Provider"
2027
- };
2028
- function Wn(e, t, n, r, i, a) {
2029
- return U(), I("div", In, [e.providerType === "anthropic" ? (U(), I("i", Ln)) : e.providerType === "openai" ? (U(), I("i", Rn)) : e.providerType === "google" ? (U(), I("i", zn)) : e.providerType === "openrouter" ? (U(), I("i", Bn)) : e.providerType === "deepseek" ? (U(), I("img", {
2030
- key: 4,
2031
- src: e.deepseekIcon,
2032
- class: "deepseek-icon",
2033
- alt: "DeepSeek",
2034
- title: "DeepSeek"
2035
- }, null, 8, Vn)) : e.providerType === "demo" ? (U(), I("i", Hn)) : (U(), I("i", Un))]);
2036
- }
2037
- //#endregion
2038
- //#region components/sidebar/LLMConnectionListItem.vue?vue&type=script&lang.ts
2039
- var Gn = B({
2040
- name: "LLMConnectionListItem",
2041
- components: {
2042
- SidebarItem: Me,
2043
- LLMProviderIcon: /* @__PURE__ */ e(Fn, [["render", Wn], ["__scopeId", "data-v-bb5e5885"]]),
2044
- ConnectionStatusIcon: Ne,
2045
- Tooltip: S,
2046
- SidebarOverflowMenu: Je
2047
- },
2048
- props: {
2049
- item: {
2050
- type: Object,
2051
- required: !0
2052
- },
2053
- isCollapsed: {
2054
- type: Boolean,
2055
- default: !0
2056
- },
2057
- isSelected: {
2058
- type: Boolean,
2059
- default: !1
2060
- },
2061
- mobileTreeMode: {
2062
- type: Boolean,
2063
- default: !1
2064
- }
2065
- },
2066
- emits: [
2067
- "toggle",
2068
- "setActive",
2069
- "refresh",
2070
- "updateApiKey",
2071
- "updateModel",
2072
- "updateFastModel",
2073
- "updateCompactionThreshold",
2074
- "toggleSaveCredential",
2075
- "deleteConnection",
2076
- "deleteChat",
2077
- "mobileItemClick"
2078
- ],
2079
- setup(e, { emit: n }) {
2080
- let r = W(""), i = W(!1), a = W(""), o = W(""), s = W(""), c = W("idle"), l = null, u = null, d = null;
2081
- ie(() => {
2082
- if (e.item.type === "api-key" && e.item.connection?.getApiKey() && (r.value = e.item.connection.getApiKey()), e.item.type === "model" && e.item.connection?.model && (a.value = e.item.connection.model), e.item.type === "fast-model" && (o.value = e.item.connection?.fastModel || ""), e.item.type === "compaction-threshold") {
2083
- let t = e.item.connection?.compactionThresholdTokens;
2084
- s.value = t == null ? "" : String(t);
2085
- }
2086
- }), fe(() => e.item.connection?.apiKey, (t) => {
2087
- e.item.type === "api-key" && t && (r.value = t);
2088
- }), fe(() => e.item.connection?.model, (t) => {
2089
- e.item.type === "model" && t && (a.value = t);
2090
- }, { immediate: !0 }), fe(() => e.item.connection?.fastModel, (t) => {
2091
- e.item.type === "fast-model" && (o.value = t || "");
2092
- }, { immediate: !0 }), fe(() => e.item.connection?.compactionThresholdTokens, (t) => {
2093
- e.item.type === "compaction-threshold" && (s.value = t == null ? "" : String(t));
2094
- }, { immediate: !0 });
2095
- let f = N(() => {
2096
- let t = [];
2097
- return e.item.type === "connection" && (e.item.connection?.isDefault || t.push({
2098
- id: "set-default",
2099
- label: "Set as default",
2100
- icon: "mdi-star-outline"
2101
- }), t.push({
2102
- id: "refresh",
2103
- label: "Refresh Connection",
2104
- icon: "mdi-refresh"
2105
- }, {
2106
- id: "delete-separator",
2107
- kind: "separator"
2108
- }, {
2109
- id: "delete",
2110
- label: "Delete connection",
2111
- icon: "mdi-trash-can-outline",
2112
- danger: !0
2113
- })), t;
2114
- }), p = (t) => {
2115
- switch (t.id) {
2116
- case "delete":
2117
- E(e.item.id);
2118
- break;
2119
- case "set-default":
2120
- T(e.item.id);
2121
- break;
2122
- case "refresh":
2123
- n("refresh", e.item.id, e.item.connection?.name || "", "connection");
2124
- break;
2125
- }
2126
- }, m = N(() => ["connection", "settings-group"].includes(e.item.type)), _ = () => [
2127
- "api-key",
2128
- "model",
2129
- "fast-model",
2130
- "compaction-threshold",
2131
- "settings-group",
2132
- "toggle-save-credential",
2133
- "refresh-connection"
2134
- ].includes(e.item.type) ? "" : e.item.name, y = () => {
2135
- if (e.mobileTreeMode) {
2136
- n("mobileItemClick", e.item);
2137
- return;
2138
- }
2139
- (m.value || e.item.type === "open-chat" || e.item.type === "open-validation" || e.item.type === "new-chat" || e.item.type === "chat-item") && b(e.item.id);
2140
- }, b = (t) => {
2141
- let r = e.item.type === "chat-item" ? { chatId: e.item.chatId } : void 0;
2142
- n("toggle", t, e.item.connection?.name || "", e.item.type, r);
2143
- }, x = (t) => {
2144
- t.stopPropagation(), n("refresh", e.item.id, e.item.connection?.name || "", "connection");
2145
- }, S = (e) => {
2146
- n("toggleSaveCredential", e);
2147
- }, C = (e) => {
2148
- d &&= (clearTimeout(d), null), c.value = "saving", n("toggleSaveCredential", e), d = setTimeout(() => {
2149
- c.value = "saved", d = setTimeout(() => {
2150
- c.value = "idle", d = null;
2151
- }, 1500);
2152
- }, 400);
2153
- }, ee = (e) => e instanceof v ? "anthropic" : e instanceof h ? "openai" : e instanceof g ? "google" : e.type || "unknown", w = (e) => e && e.connected === !0, T = (t) => {
2154
- n("setActive", t, e.item.connection?.name || "", "connection");
2155
- }, E = (t) => {
2156
- n("deleteConnection", t, e.item.connection?.name || "");
2157
- }, D = (t) => {
2158
- t && n("deleteChat", t, e.item.connection?.name || "");
2159
- }, O = (e, t) => {
2160
- n("updateApiKey", e, t);
2161
- }, k = (e, t) => {
2162
- n("updateModel", e, t);
2163
- }, A = (e, t) => {
2164
- n("updateFastModel", e, t);
2165
- }, j = () => {
2166
- e.item.type !== "api-key" || !e.item.connection || r.value !== (e.item.connection.getApiKey() || "") && (l && clearTimeout(l), l = setTimeout(() => {
2167
- O(e.item.connection, r.value);
2168
- }, 500));
2169
- }, M = () => {
2170
- e.item.type !== "model" || !e.item.connection || !a.value || a.value === e.item.connection.model || k(e.item.connection, a.value);
2171
- }, P = (e, t) => {
2172
- n("updateCompactionThreshold", e, t);
2173
- };
2174
- return {
2175
- apiKeyInput: r,
2176
- selectedModel: a,
2177
- selectedFastModel: o,
2178
- compactionThresholdInput: s,
2179
- defaultCompactionThreshold: t,
2180
- isExpandable: m,
2181
- getItemName: _,
2182
- handleItemClick: y,
2183
- handleRefreshConnectionClick: x,
2184
- getProviderType: ee,
2185
- isConnected: w,
2186
- setAsActive: T,
2187
- updateApiKey: O,
2188
- updateModel: k,
2189
- updateFastModel: A,
2190
- updateCompactionThreshold: P,
2191
- handleApiKeyInput: j,
2192
- handleModelChange: M,
2193
- handleFastModelChange: () => {
2194
- if (e.item.type !== "fast-model" || !e.item.connection) return;
2195
- let t = o.value || null;
2196
- t !== (e.item.connection.fastModel || null) && A(e.item.connection, t);
2197
- },
2198
- handleCompactionThresholdInput: () => {
2199
- if (e.item.type !== "compaction-threshold" || !e.item.connection) return;
2200
- let t = s.value.trim(), n = t === "" ? null : Number(t);
2201
- if (n !== null && !Number.isFinite(n)) return;
2202
- let r = n === null ? null : Math.max(0, Math.floor(n));
2203
- r !== (e.item.connection.compactionThresholdTokens ?? null) && (u && clearTimeout(u), u = setTimeout(() => {
2204
- P(e.item.connection, r);
2205
- }, 500));
2206
- },
2207
- toggleSaveCredential: S,
2208
- handleToggleSaveCredential: C,
2209
- saveCredentialStatus: c,
2210
- deleteConnection: E,
2211
- deleteChat: D,
2212
- contextMenuItems: f,
2213
- handleContextMenuItemClick: p,
2214
- toggleCollapse: b,
2215
- showApiKey: i,
2216
- toggleApiKeyVisibility: () => {
2217
- i.value = !i.value;
2218
- }
2219
- };
2220
- }
2221
- }), Kn = {
2222
- key: 1,
2223
- class: "mdi mdi-tune-vertical node-icon"
2224
- }, qn = {
2225
- key: 2,
2226
- class: "mdi mdi-alert-circle node-icon"
2227
- }, Jn = {
2228
- key: 3,
2229
- class: "mdi mdi-chat-outline node-icon"
2230
- }, Yn = {
2231
- key: 4,
2232
- class: "mdi mdi-test-tube node-icon"
2233
- }, Xn = {
2234
- key: 5,
2235
- class: "mdi mdi-chat-plus-outline node-icon"
2236
- }, Zn = {
2237
- key: 6,
2238
- class: "mdi mdi-chat node-icon"
2239
- }, Qn = {
2240
- key: 7,
2241
- class: "mdi mdi-folder-outline node-icon"
2242
- }, $n = { class: "api-key-input-wrapper" }, er = ["type", "data-testid"], tr = ["data-testid", "title"], nr = ["data-testid"], rr = ["data-testid"], ir = ["value", "data-testid"], ar = ["data-testid"], or = ["data-testid"], sr = ["value", "data-testid"], cr = ["data-testid", "title"], lr = ["placeholder", "data-testid"], ur = { class: "save-credential-toggle sidebar-toggle-row" }, dr = ["checked"], fr = ["data-testid"], pr = ["data-testid"], mr = { key: 0 }, hr = {
2243
- key: 0,
2244
- class: "connection-actions chat-actions"
2245
- }, gr = {
2246
- key: 1,
2247
- class: "connection-actions"
2248
- };
2249
- function _r(e, t, n, r, i, a) {
2250
- let o = q("LLMProviderIcon"), s = q("tooltip"), c = q("connection-status-icon"), l = q("sidebar-overflow-menu"), u = q("sidebar-item");
2251
- return U(), I("div", null, [z(u, {
2252
- "item-id": e.item.id,
2253
- name: e.getItemName(),
2254
- indent: e.item.indent,
2255
- "is-selected": e.isSelected,
2256
- "is-collapsible": e.isExpandable,
2257
- "is-collapsed": e.isCollapsed,
2258
- itemType: "llm-connection",
2259
- onClick: e.handleItemClick,
2260
- onToggle: e.toggleCollapse
2261
- }, {
2262
- icon: X(() => [e.item.type === "connection" ? (U(), P(o, {
2263
- key: 0,
2264
- "provider-type": e.getProviderType(e.item.connection)
2265
- }, null, 8, ["provider-type"])) : e.item.type === "settings-group" ? (U(), I("i", Kn)) : e.item.type === "error" ? (U(), I("i", qn)) : e.item.type === "open-chat" ? (U(), I("i", Jn)) : e.item.type === "open-validation" ? (U(), I("i", Yn)) : e.item.type === "new-chat" ? (U(), I("i", Xn)) : e.item.type === "chat-item" ? (U(), I("i", Zn)) : e.item.type === "chats-header" ? (U(), I("i", Qn)) : F("", !0)]),
2266
- name: X(() => [e.item.type === "refresh-connection" ? (U(), I("div", {
2267
- key: 0,
2268
- class: "refresh title-pad-left truncate-text sidebar-sub-item",
2269
- onClick: t[0] ||= (...t) => e.handleRefreshConnectionClick && e.handleRefreshConnectionClick(...t)
2270
- }, J(e.item.name), 1)) : e.item.type === "api-key" ? (U(), I("div", {
2271
- key: 1,
2272
- class: "api-key-container",
2273
- onClick: t[5] ||= Q(() => {}, ["stop"])
2274
- }, [L("form", { onSubmit: t[4] ||= Q(() => {}, ["prevent"]) }, [L("div", $n, [Z(L("input", {
2275
- type: e.showApiKey ? "text" : "password",
2276
- id: "api-key",
2277
- "onUpdate:modelValue": t[1] ||= (t) => e.apiKeyInput = t,
2278
- onInput: t[2] ||= (...t) => e.handleApiKeyInput && e.handleApiKeyInput(...t),
2279
- placeholder: "API Key",
2280
- class: "connection-customize sidebar-control-input",
2281
- "data-testid": `api-key-input-${e.item.connection.name}`
2282
- }, null, 40, er), [[ue, e.apiKeyInput]]), L("button", {
2283
- type: "button",
2284
- class: "visibility-toggle sidebar-icon-button",
2285
- onClick: t[3] ||= (...t) => e.toggleApiKeyVisibility && e.toggleApiKeyVisibility(...t),
2286
- "data-testid": `toggle-api-key-visibility-${e.item.connection.name}`,
2287
- title: e.showApiKey ? "Hide API Key" : "Show API Key"
2288
- }, [L("i", { class: H(e.showApiKey ? "mdi mdi-eye-off" : "mdi mdi-eye") }, null, 2)], 8, tr)])], 32)])) : e.item.type === "model" ? (U(), I("div", {
2289
- key: 2,
2290
- class: "api-key-container",
2291
- onClick: t[9] ||= Q(() => {}, ["stop"])
2292
- }, [L("form", {
2293
- onSubmit: t[8] ||= Q(() => {}, ["prevent"]),
2294
- "data-testid": `model-update-form-${e.item.connection.name}`
2295
- }, [Z(L("select", {
2296
- "onUpdate:modelValue": t[6] ||= (t) => e.selectedModel = t,
2297
- onChange: t[7] ||= (...t) => e.handleModelChange && e.handleModelChange(...t),
2298
- id: "connection-type",
2299
- required: "",
2300
- class: "connection-customize sidebar-control-select",
2301
- "data-testid": `model-select-${e.item.connection.name}`
2302
- }, [(U(!0), I(j, null, G(e.item.connection.models, (e) => (U(), I("option", {
2303
- value: e,
2304
- key: e,
2305
- "data-testid": `model-option-${e}`
2306
- }, J(e), 9, ir))), 128))], 40, rr), [[de, e.selectedModel]])], 40, nr)])) : e.item.type === "fast-model" ? (U(), I("div", {
2307
- key: 3,
2308
- class: "api-key-container",
2309
- onClick: t[13] ||= Q(() => {}, ["stop"])
2310
- }, [L("form", {
2311
- onSubmit: t[12] ||= Q(() => {}, ["prevent"]),
2312
- "data-testid": `fast-model-update-form-${e.item.connection.name}`
2313
- }, [Z(L("select", {
2314
- "onUpdate:modelValue": t[10] ||= (t) => e.selectedFastModel = t,
2315
- onChange: t[11] ||= (...t) => e.handleFastModelChange && e.handleFastModelChange(...t),
2316
- class: "connection-customize sidebar-control-select",
2317
- "data-testid": `fast-model-select-${e.item.connection.name}`
2318
- }, [t[21] ||= L("option", {
2319
- value: "",
2320
- "data-testid": "fast-model-option-none"
2321
- }, "(Use primary model)", -1), (U(!0), I(j, null, G(e.item.connection.models, (e) => (U(), I("option", {
2322
- value: e,
2323
- key: e,
2324
- "data-testid": `fast-model-option-${e}`
2325
- }, J(e), 9, sr))), 128))], 40, or), [[de, e.selectedFastModel]])], 40, ar)])) : e.item.type === "compaction-threshold" ? (U(), I("div", {
2326
- key: 4,
2327
- class: "api-key-container",
2328
- onClick: t[17] ||= Q(() => {}, ["stop"])
2329
- }, [L("form", {
2330
- onSubmit: t[16] ||= Q(() => {}, ["prevent"]),
2331
- class: "compaction-threshold-row",
2332
- "data-testid": `compaction-threshold-form-${e.item.connection.name}`,
2333
- title: `Summarize and archive older messages once a conversation's input context exceeds this many tokens. Blank uses the default (${e.defaultCompactionThreshold.toLocaleString()}); 0 disables automatic compaction.`
2334
- }, [
2335
- t[22] ||= L("span", { class: "compaction-threshold-label" }, "Compact at", -1),
2336
- Z(L("input", {
2337
- type: "number",
2338
- min: "0",
2339
- step: "10000",
2340
- "onUpdate:modelValue": t[14] ||= (t) => e.compactionThresholdInput = t,
2341
- onInput: t[15] ||= (...t) => e.handleCompactionThresholdInput && e.handleCompactionThresholdInput(...t),
2342
- placeholder: `${e.defaultCompactionThreshold}`,
2343
- class: "connection-customize sidebar-control-input",
2344
- "data-testid": `compaction-threshold-input-${e.item.connection.name}`
2345
- }, null, 40, lr), [[Y, e.compactionThresholdInput]]),
2346
- t[23] ||= L("span", { class: "compaction-threshold-label" }, "tokens", -1)
2347
- ], 40, cr)])) : e.item.type === "toggle-save-credential" ? (U(), I("div", {
2348
- key: 5,
2349
- class: "md-token-container",
2350
- onClick: t[19] ||= Q(() => {}, ["stop"])
2351
- }, [L("label", ur, [
2352
- L("input", {
2353
- type: "checkbox",
2354
- checked: e.item.connection.saveCredential,
2355
- onChange: t[18] ||= (t) => e.handleToggleSaveCredential(e.item.connection)
2356
- }, null, 40, dr),
2357
- t[26] ||= L("span", { class: "checkbox-label" }, "Save credentials", -1),
2358
- e.saveCredentialStatus === "saving" ? (U(), I("span", {
2359
- key: 0,
2360
- class: "save-credential-status saving",
2361
- "data-testid": `save-credential-saving-${e.item.connection.name}`
2362
- }, [...t[24] ||= [L("i", { class: "mdi mdi-loading mdi-spin" }, null, -1), R(" Saving... ", -1)]], 8, fr)) : e.saveCredentialStatus === "saved" ? (U(), I("span", {
2363
- key: 1,
2364
- class: "save-credential-status saved",
2365
- "data-testid": `save-credential-saved-${e.item.connection.name}`
2366
- }, [...t[25] ||= [L("i", { class: "mdi mdi-check-circle" }, null, -1), R(" Saved ", -1)]], 8, pr)) : F("", !0)
2367
- ])])) : (U(), I("span", {
2368
- key: 6,
2369
- class: H(["title-pad-left truncate-text", { "error-indicator": e.item.type === "error" }])
2370
- }, [R(J(e.item.name) + " ", 1), e.item.count !== void 0 && e.item.count > 0 ? (U(), I("span", mr, " (" + J(e.item.count) + ") ", 1)) : F("", !0)], 2))]),
2371
- "extra-content": X(() => [e.item.type === "chat-item" ? (U(), I("div", hr, [z(s, {
2372
- class: "tactile-button",
2373
- content: "Delete Chat",
2374
- position: "left"
2375
- }, {
2376
- default: X(() => [L("span", {
2377
- class: "remove-btn hover-icon sidebar-icon-button danger",
2378
- onClick: t[20] ||= Q((t) => e.deleteChat(e.item.chatId), ["stop"])
2379
- }, [...t[27] ||= [L("i", { class: "mdi mdi-trash-can-outline" }, null, -1)]])]),
2380
- _: 1
2381
- })])) : F("", !0), e.item.type === "connection" ? (U(), I("div", gr, [e.item.connection ? (U(), P(c, {
2382
- key: 0,
2383
- connection: e.item.connection
2384
- }, null, 8, ["connection"])) : F("", !0), z(l, {
2385
- items: e.contextMenuItems,
2386
- tooltip: "Connection actions",
2387
- "test-id-base": `llm-connection-actions-${e.item.id}`,
2388
- onSelect: e.handleContextMenuItemClick
2389
- }, null, 8, [
2390
- "items",
2391
- "test-id-base",
2392
- "onSelect"
2393
- ])])) : F("", !0)]),
2394
- _: 1
2395
- }, 8, [
2396
- "item-id",
2397
- "name",
2398
- "indent",
2399
- "is-selected",
2400
- "is-collapsible",
2401
- "is-collapsed",
2402
- "onClick",
2403
- "onToggle"
2404
- ])]);
2405
- }
2406
- var vr = /*#__PURE__*/ e(Gn, [["render", _r], ["__scopeId", "data-v-1bb5f28a"]]), yr = {
2407
- openai: [
2408
- h.DEFAULT_MODEL,
2409
- "gpt-5.3",
2410
- "gpt-5.2",
2411
- "gpt-5.2-mini"
2412
- ],
2413
- anthropic: [
2414
- "claude-opus-4-6-20260514",
2415
- "claude-opus-4-20250514",
2416
- "claude-sonnet-4-20250514"
2417
- ],
2418
- google: ["models/gemini-2.5-pro", "models/gemini-2.5-flash"],
2419
- openrouter: [
2420
- "anthropic/claude-sonnet-4",
2421
- "openai/gpt-4o",
2422
- "google/gemini-2.5-pro"
2423
- ],
2424
- deepseek: ["deepseek-v4-flash", "deepseek-v4-pro"],
2425
- demo: ["deepseek/deepseek-v3.2"]
2426
- }, br = B({
2427
- name: "LLMConnectionCreator",
2428
- props: {
2429
- visible: {
2430
- type: Boolean,
2431
- required: !0
2432
- },
2433
- testTag: {
2434
- type: String,
2435
- required: !1,
2436
- default: ""
2437
- }
2438
- },
2439
- methods: { close() {
2440
- this.$emit("close");
2441
- } },
2442
- components: { LoadingButton: C },
2443
- setup(e, { emit: t }) {
2444
- let n = W({
2445
- name: "",
2446
- type: "demo",
2447
- options: {
2448
- apiKey: "",
2449
- model: "deepseek/deepseek-v3.2",
2450
- saveCredential: !1
2451
- }
2452
- }), r = V("llmConnectionStore");
2453
- if (!r) throw Error("must inject llmConnectionStore to LLMConnectionCreator");
2454
- let i = r.connections, a = () => {
2455
- n.value.name = "", n.value.type = "demo", n.value.options = {
2456
- apiKey: "",
2457
- model: "",
2458
- saveCredential: !1
2459
- }, o("demo");
2460
- }, o = (e) => {
2461
- switch (e) {
2462
- case "openai":
2463
- n.value.options.model = h.getDefaultModel(yr.openai);
2464
- break;
2465
- case "anthropic":
2466
- n.value.options.model = v.getDefaultModel(yr.anthropic);
2467
- break;
2468
- case "google":
2469
- n.value.options.model = g.getDefaultModel(yr.google);
2470
- break;
2471
- case "demo":
2472
- n.value.options.model = m.getDefaultModel(yr.demo);
2473
- break;
2474
- case "openrouter":
2475
- n.value.options.model = _.getDefaultModel(yr.openrouter);
2476
- break;
2477
- case "deepseek":
2478
- n.value.options.model = y.getDefaultModel(yr.deepseek);
2479
- break;
2480
- default: n.value.options.model = "";
2481
- }
2482
- }, s = async () => {
2483
- await c();
2484
- }, c = async () => {
2485
- if (!n.value.name) throw Error("Connection name is required");
2486
- if (!n.value.type) throw Error("Provider type is required");
2487
- if (!n.value.options.apiKey && n.value.type !== "demo") throw Error("API key is required");
2488
- return await r.newConnection(n.value.name, n.value.type, n.value.options), t("close"), "Connection created successfully";
2489
- };
2490
- return {
2491
- connectionDetails: n,
2492
- connections: i,
2493
- createConnection: a,
2494
- handleSubmitConnection: c,
2495
- submitConnectionCreation: s,
2496
- updateDefaultModel: o
2497
- };
2498
- },
2499
- watch: { "connectionDetails.type": { handler(e) {
2500
- this.updateDefaultModel(e);
2501
- } } }
2502
- }), xr = {
2503
- key: 0,
2504
- class: "creator-container"
2505
- }, Sr = { class: "form-row" }, Cr = { class: "form-row" }, wr = {
2506
- key: 0,
2507
- class: "form-row demo-info"
2508
- }, Tr = { class: "form-row" }, Er = { class: "form-row" }, Dr = { class: "button-row" };
2509
- function Or(e, t, n, r, i, a) {
2510
- let o = q("loading-button");
2511
- return e.visible ? (U(), I("div", xr, [L("form", { onSubmit: t[5] ||= Q((...t) => e.submitConnectionCreation && e.submitConnectionCreation(...t), ["prevent"]) }, [
2512
- L("div", Sr, [t[6] ||= L("label", { for: "llm-connection-name" }, "Name", -1), Z(L("input", {
2513
- type: "text",
2514
- "onUpdate:modelValue": t[0] ||= (t) => e.connectionDetails.name = t,
2515
- class: "sidebar-control-input",
2516
- id: "llm-connection-name",
2517
- required: "",
2518
- "data-testid": "llm-connection-creator-name",
2519
- placeholder: "Connection Name"
2520
- }, null, 512), [[Y, e.connectionDetails.name]])]),
2521
- L("div", Cr, [t[8] ||= L("label", { for: "llm-provider-type" }, "Provider", -1), Z(L("select", {
2522
- "onUpdate:modelValue": t[1] ||= (t) => e.connectionDetails.type = t,
2523
- class: "sidebar-control-select",
2524
- id: "llm-provider-type",
2525
- required: "",
2526
- "data-testid": "llm-connection-creator-type"
2527
- }, [...t[7] ||= [te("<option value=\"demo\" data-testid=\"llm-connection-creator-demo\" data-v-6ed7be04>Demo (Free Trial)</option><option value=\"openai\" data-testid=\"llm-connection-creator-openai\" data-v-6ed7be04>OpenAI</option><option value=\"anthropic\" data-testid=\"llm-connection-creator-anthropic\" data-v-6ed7be04> Anthropic </option><option value=\"google\" data-testid=\"llm-connection-creator-google\" data-v-6ed7be04>Google</option><option value=\"openrouter\" data-testid=\"llm-connection-creator-openrouter\" data-v-6ed7be04> OpenRouter </option><option value=\"deepseek\" data-testid=\"llm-connection-creator-deepseek\" data-v-6ed7be04>DeepSeek</option>", 6)]], 512), [[de, e.connectionDetails.type]])]),
2528
- e.connectionDetails.type === "demo" ? (U(), I("div", wr, [...t[9] ||= [L("span", { class: "demo-label" }, "A limited free API key will be issued automatically.", -1)]])) : F("", !0),
2529
- e.connectionDetails.type === "demo" ? F("", !0) : (U(), I(j, { key: 1 }, [L("div", Tr, [t[10] ||= L("label", { for: "llm-api-key" }, "API Key", -1), Z(L("input", {
2530
- type: "password",
2531
- "onUpdate:modelValue": t[2] ||= (t) => e.connectionDetails.options.apiKey = t,
2532
- class: "sidebar-control-input",
2533
- id: "llm-api-key",
2534
- placeholder: "API Key",
2535
- required: "",
2536
- "data-testid": "llm-connection-creator-api-key"
2537
- }, null, 512), [[Y, e.connectionDetails.options.apiKey]])]), L("div", Er, [t[11] ||= L("label", { for: "save-credential" }, "Save Credential?", -1), Z(L("input", {
2538
- type: "checkbox",
2539
- id: "save-credential",
2540
- "onUpdate:modelValue": t[3] ||= (t) => e.connectionDetails.options.saveCredential = t,
2541
- "data-testid": "llm-connection-creator-save-credential"
2542
- }, null, 512), [[le, e.connectionDetails.options.saveCredential]])])], 64)),
2543
- L("div", Dr, [z(o, {
2544
- "data-testid": "llm-connection-creator-submit",
2545
- action: e.handleSubmitConnection,
2546
- class: "submit-button"
2547
- }, {
2548
- default: X(() => [...t[12] ||= [R(" Submit ", -1)]]),
2549
- _: 1
2550
- }, 8, ["action"]), L("button", {
2551
- type: "button",
2552
- onClick: t[4] ||= (t) => e.close()
2553
- }, "Cancel")])
2554
- ], 32)])) : F("", !0);
2555
- }
2556
- var kr = /*#__PURE__*/ e(br, [["render", Or], ["__scopeId", "data-v-6ed7be04"]]), Ar = [{
2557
- value: "user",
2558
- label: "User Chats"
2559
- }, {
2560
- value: "dashboard",
2561
- label: "Dashboard Chats"
2562
- }], jr = {
2563
- name: "LLMConnectionList",
2564
- props: {
2565
- activeLLMKey: {
2566
- type: String,
2567
- default: "",
2568
- optional: !0
2569
- },
2570
- testTag: {
2571
- type: String,
2572
- default: "",
2573
- optional: !0
2574
- }
2575
- },
2576
- emits: [
2577
- "llm-open-view",
2578
- "create-new-chat",
2579
- "open-chat"
2580
- ],
2581
- setup(e, { emit: t }) {
2582
- let r = V("llmConnectionStore"), i = V("saveLLMConnections"), a = V("chatStore", null);
2583
- if (!r || !i) throw Error("LLM connection store is not provided!");
2584
- let o = n(), s = W({}), c = W({}), l = W(!1), u = W(null), d = ee(), f = b(x.LLMS, "").split("+")[0], { overrides: p, isCollapsed: m, toggle: h } = he((e) => !!f && e === f), g = W(/* @__PURE__ */ new Set(["dashboard", "editor"])), _ = W(!1), v = W(null), y = (e) => {
2585
- g.value.has(e) ? g.value.delete(e) : g.value.add(e), g.value = new Set(g.value);
2586
- }, S = N(() => {
2587
- let e = Ar.filter((e) => !g.value.has(e.value));
2588
- return e.length === Ar.length ? "All chats" : e.length === 0 ? "No chats" : e.length === 1 ? e[0].label : `${e.length} scopes`;
2589
- }), C = (e) => {
2590
- let t = e.target;
2591
- v.value && t && !v.value.contains(t) && (_.value = !1);
2592
- }, w = (e) => `${e}-settings`, T = async (e, t) => {
2593
- t && (await r.connections[e.name].setApiKey(t), r.resetConnectionInBackground(e.name), await i());
2594
- }, E = (e, t) => {
2595
- t && (r.connections[e.name].setModel(t), r.resetConnectionInBackground(e.name), i());
2596
- }, D = (e, t) => {
2597
- r.connections[e.name].setFastModel(t), i();
2598
- }, O = (e, t) => {
2599
- r.connections[e.name].setCompactionThresholdTokens(t), i();
2600
- }, k = async (e, t, n) => {
2601
- if (!r.connections[t]) {
2602
- c.value[e] = "Connection not found";
2603
- return;
2604
- }
2605
- try {
2606
- s.value[e] = !0, n === "connection" && await r.resetConnection(t), delete c.value[e];
2607
- } catch (t) {
2608
- c.value[e] = t instanceof Error ? t.message : "An error occurred";
2609
- }
2610
- delete s.value[e];
2611
- }, A = async (e, n, i, o) => {
2612
- if (i === "new-chat") {
2613
- t("create-new-chat", n);
2614
- return;
2615
- }
2616
- if (i === "chat-item") {
2617
- a && o?.chatId && (a.setActiveChat(o.chatId), r.activeConnection = n), t("llm-open-view", n, "chat", o?.chatId);
2618
- return;
2619
- }
2620
- if (i === "open-chat") {
2621
- t("llm-open-view", n, "chat");
2622
- return;
2623
- }
2624
- if (i === "open-validation") {
2625
- t("llm-open-view", n, "validation");
2626
- return;
2627
- }
2628
- if (i === "connection" && m(e)) {
2629
- let t = r.connections[n];
2630
- if (!t) {
2631
- console.log(`Connection not found ${t}`);
2632
- return;
2633
- }
2634
- (!t.models || t.models.length === 0) && await k(e, n, "models");
2635
- }
2636
- h(e);
2637
- };
2638
- ie(() => {
2639
- document.addEventListener("click", C);
2640
- let e = b(x.LLMS, "").split("+")[1];
2641
- f && r.connections[f] && (r.activeConnection = f, e && a && a.setActiveChat(e));
2642
- }), re(() => {
2643
- document.removeEventListener("click", C);
2644
- });
2645
- let j = /* @__PURE__ */ new Set([
2646
- "loading",
2647
- "error",
2648
- "refresh-connection",
2649
- "api-key",
2650
- "model",
2651
- "fast-model",
2652
- "compaction-threshold",
2653
- "toggle-save-credential",
2654
- "open-chat",
2655
- "open-validation",
2656
- "new-chat"
2657
- ]), M = /* @__PURE__ */ new Set([
2658
- "connection",
2659
- "settings-group",
2660
- "chats-header"
2661
- ]);
2662
- return {
2663
- llmConnectionStore: r,
2664
- chatStore: a,
2665
- contentList: N(() => {
2666
- let e = [];
2667
- return Object.entries(r.connections).sort(([e, t], [n, r]) => {
2668
- let i = t, a = r;
2669
- return i.connected && !a.connected ? -1 : !i.connected && a.connected ? 1 : e.localeCompare(n);
2670
- }).forEach(([t, n]) => {
2671
- let r = n, i = r.availableModels?.length || 0;
2672
- if (r.deleted || (e.push({
2673
- id: t,
2674
- name: t,
2675
- indent: 0,
2676
- count: i,
2677
- type: "connection",
2678
- connection: r
2679
- }), s.value[t] && e.push({
2680
- id: `${t}-loading`,
2681
- name: "Loading...",
2682
- indent: 1,
2683
- count: 0,
2684
- type: "loading",
2685
- connection: r
2686
- }), c.value[t] && e.push({
2687
- id: `${t}-error`,
2688
- name: c.value[t],
2689
- indent: 1,
2690
- count: 0,
2691
- type: "error",
2692
- connection: r
2693
- }), m(t))) return;
2694
- let o = (a ? a.getConnectionChats(t) : []).filter((e) => !g.value.has(e.source));
2695
- e.push({
2696
- id: `${t}-new-chat`,
2697
- name: "New Chat",
2698
- indent: 1,
2699
- count: o.length,
2700
- type: "new-chat",
2701
- connection: r
2702
- }), o.forEach((n) => {
2703
- e.push({
2704
- id: `${t}-chat-${n.id}`,
2705
- name: n.name,
2706
- indent: 2,
2707
- count: n.messages.length,
2708
- type: "chat-item",
2709
- connection: r,
2710
- chat: n,
2711
- chatId: n.id
2712
- });
2713
- }), e.push({
2714
- id: `${t}-open-validation`,
2715
- name: "Validation Tests",
2716
- indent: 1,
2717
- count: 0,
2718
- type: "open-validation",
2719
- connection: r
2720
- }), e.push({
2721
- id: w(t),
2722
- name: "Settings",
2723
- indent: 1,
2724
- count: 0,
2725
- type: "settings-group",
2726
- connection: r
2727
- }), m(w(t)) || (r.type !== "demo" && e.push({
2728
- id: `${t}-api-key`,
2729
- name: "API Key",
2730
- indent: 2,
2731
- count: 0,
2732
- type: "api-key",
2733
- connection: r
2734
- }), e.push({
2735
- id: `${t}-model`,
2736
- name: "Model",
2737
- indent: 2,
2738
- count: 0,
2739
- type: "model",
2740
- connection: r
2741
- }), e.push({
2742
- id: `${t}-fast-model`,
2743
- name: "Fast Model",
2744
- indent: 2,
2745
- count: 0,
2746
- type: "fast-model",
2747
- connection: r
2748
- }), e.push({
2749
- id: `${t}-compaction-threshold`,
2750
- name: "Auto-Compact At",
2751
- indent: 2,
2752
- count: 0,
2753
- type: "compaction-threshold",
2754
- connection: r
2755
- }), r.type !== "demo" && e.push({
2756
- id: `${t}-toggle-save-credential`,
2757
- name: "Toggle Save Credential",
2758
- indent: 2,
2759
- count: 0,
2760
- type: "toggle-save-credential",
2761
- connection: r
2762
- }));
2763
- }), e;
2764
- }),
2765
- toggleCollapse: A,
2766
- collapsed: p,
2767
- isCollapsed: m,
2768
- saveConnections: i,
2769
- updateApiKey: T,
2770
- updateModel: E,
2771
- updateFastModel: D,
2772
- updateCompactionThreshold: O,
2773
- refreshId: k,
2774
- creatorVisible: l,
2775
- isItemSelected: (e) => e.type === "chat-item" && e.chatId && a ? e.chatId === a.activeChatId : e.type === "connection" && e.id === r.activeConnection,
2776
- screenNavigation: o,
2777
- hiddenScopes: g,
2778
- filterMenuOpen: _,
2779
- filterDropdown: v,
2780
- filterSummary: S,
2781
- toggleScopeFilter: y,
2782
- SCOPE_OPTIONS: Ar,
2783
- mobileTree: u,
2784
- isMobile: d,
2785
- isLLMConfig: (e) => j.has(e.type),
2786
- isLLMBranch: (e) => M.has(e.type),
2787
- expandMobileBranch: async (e) => {
2788
- m(e.id) && await A(e.id, e.connection?.name || "", e.type);
2789
- },
2790
- selectMobileItem: (e) => A(e.id, e.connection?.name || "", e.type, e.type === "chat-item" ? { chatId: e.chatId } : void 0),
2791
- handleMobileItemClick: (e) => u.value?.openItem(e)
2792
- };
2793
- },
2794
- components: {
2795
- SidebarList: Ce,
2796
- LLMConnectionListItem: vr,
2797
- LLMConnectionCreator: kr,
2798
- MobileTreeList: ut
2799
- },
2800
- methods: {
2801
- resetConnection(e) {
2802
- return this.llmConnectionStore.resetConnection(e.name);
2803
- },
2804
- setActiveConnection(e) {
2805
- this.llmConnectionStore.activeConnection = e, this.llmConnectionStore.connections[e].isDefault = !0, this.llmConnectionStore.connections[e].changed = !0, Object.keys(this.llmConnectionStore.connections).forEach((t) => {
2806
- t !== e && this.llmConnectionStore.connections[t].isDefault && (this.llmConnectionStore.connections[t].isDefault = !1, this.llmConnectionStore.connections[t].changed = !0);
2807
- }), this.saveConnections();
2808
- },
2809
- deleteConnection(e, t) {
2810
- confirm(`Are you sure you want to delete the connection "${t}"?`) && (this.chatStore && this.chatStore.getConnectionChats(t).forEach((e) => {
2811
- this.screenNavigation.closeTab(null, `${t}+${e.id}`), this.chatStore.removeChat(e.id);
2812
- }), this.screenNavigation.closeTab(null, t), this.llmConnectionStore.connections[t].delete(), this.llmConnectionStore.activeConnection === e && (this.llmConnectionStore.activeConnection = ""));
2813
- },
2814
- deleteChat(e, t) {
2815
- confirm("Are you sure you want to delete this chat?") && this.chatStore && this.chatStore.removeChat(e);
2816
- },
2817
- async toggleSaveCredential(e) {
2818
- e.setSaveCredential(!e.saveCredential), await this.saveConnections();
2819
- }
2820
- },
2821
- computed: { connections() {
2822
- return Object.values(this.llmConnectionStore.connections);
2823
- } }
2824
- }, Mr = { class: "llm-header" }, Nr = ["data-testid"], Pr = {
2825
- ref: "filterDropdown",
2826
- class: "tag-filter-dropdown"
2827
- }, Fr = ["aria-expanded"], Ir = { class: "tag-filter-button-label" }, Lr = {
2828
- key: 0,
2829
- class: "tag-filter-menu"
2830
- }, Rr = ["checked", "onChange"];
2831
- function zr(e, t, n, r, i, a) {
2832
- let o = q("LLMConnectionCreator"), s = q("LLMConnectionListItem"), c = q("mobile-tree-list"), l = q("sidebar-list");
2833
- return U(), P(l, { title: "AI & Agents" }, {
2834
- header: X(() => [L("div", Mr, [t[4] ||= L("h3", { class: "font-sans sidebar-header" }, "AI & Agents", -1), L("button", {
2835
- class: "sidebar-control-button sidebar-header-action sidebar-primary-create llm-new-button",
2836
- onClick: t[0] ||= (e) => r.creatorVisible = !r.creatorVisible,
2837
- "data-testid": n.testTag ? `llm-connection-creator-add-${n.testTag}` : "llm-connection-creator-add"
2838
- }, [t[3] ||= L("i", { class: "mdi mdi-plus" }, null, -1), R(" " + J(r.creatorVisible ? "Close" : "New"), 1)], 8, Nr)])]),
2839
- actions: X(() => [z(o, {
2840
- visible: r.creatorVisible,
2841
- onClose: t[1] ||= (e) => r.creatorVisible = !r.creatorVisible
2842
- }, null, 8, ["visible"]), L("div", Pr, [L("button", {
2843
- class: "tag-filter-button",
2844
- type: "button",
2845
- onClick: t[2] ||= (e) => r.filterMenuOpen = !r.filterMenuOpen,
2846
- "aria-expanded": r.filterMenuOpen
2847
- }, [
2848
- t[5] ||= L("span", { class: "tag-filter-button-scope" }, "Scope:", -1),
2849
- L("span", Ir, J(r.filterSummary), 1),
2850
- L("i", { class: H(["mdi mdi-chevron-down tag-filter-chevron", { open: r.filterMenuOpen }]) }, null, 2)
2851
- ], 8, Fr), r.filterMenuOpen ? (U(), I("div", Lr, [(U(!0), I(j, null, G(r.SCOPE_OPTIONS, (e) => (U(), I("label", {
2852
- key: e.value,
2853
- class: "tag-filter-option"
2854
- }, [L("input", {
2855
- type: "checkbox",
2856
- checked: !r.hiddenScopes.has(e.value),
2857
- onChange: (t) => r.toggleScopeFilter(e.value)
2858
- }, null, 40, Rr), L("span", null, J(e.label), 1)]))), 128))])) : F("", !0)], 512)]),
2859
- default: X(() => [z(c, {
2860
- "list-id": "llms",
2861
- ref: "mobileTree",
2862
- items: r.contentList,
2863
- enabled: r.isMobile,
2864
- "is-branch": r.isLLMBranch,
2865
- "is-config": r.isLLMConfig,
2866
- "is-detail-branch": (e) => ["connection", "settings-group"].includes(e.type),
2867
- onExpand: r.expandMobileBranch,
2868
- onSelect: r.selectMobileItem
2869
- }, {
2870
- item: X(({ item: e }) => [(U(), P(s, {
2871
- key: e.id,
2872
- item: e,
2873
- "mobile-tree-mode": r.isMobile,
2874
- "is-collapsed": r.isCollapsed(e.id),
2875
- isSelected: r.isItemSelected(e),
2876
- onToggle: r.toggleCollapse,
2877
- onRefresh: r.refreshId,
2878
- onUpdateApiKey: r.updateApiKey,
2879
- onUpdateModel: r.updateModel,
2880
- onUpdateFastModel: r.updateFastModel,
2881
- onUpdateCompactionThreshold: r.updateCompactionThreshold,
2882
- onSetActive: a.setActiveConnection,
2883
- onDeleteConnection: a.deleteConnection,
2884
- onDeleteChat: a.deleteChat,
2885
- onToggleSaveCredential: a.toggleSaveCredential,
2886
- onMobileItemClick: r.handleMobileItemClick
2887
- }, null, 8, [
2888
- "item",
2889
- "mobile-tree-mode",
2890
- "is-collapsed",
2891
- "isSelected",
2892
- "onToggle",
2893
- "onRefresh",
2894
- "onUpdateApiKey",
2895
- "onUpdateModel",
2896
- "onUpdateFastModel",
2897
- "onUpdateCompactionThreshold",
2898
- "onSetActive",
2899
- "onDeleteConnection",
2900
- "onDeleteChat",
2901
- "onToggleSaveCredential",
2902
- "onMobileItemClick"
2903
- ]))]),
2904
- _: 1
2905
- }, 8, [
2906
- "items",
2907
- "enabled",
2908
- "is-branch",
2909
- "is-config",
2910
- "is-detail-branch",
2911
- "onExpand",
2912
- "onSelect"
2913
- ])]),
2914
- _: 1
2915
- });
2916
- }
2917
- var Br = /*#__PURE__*/ e(jr, [["render", zr], ["__scopeId", "data-v-41d73d1e"]]), Vr = "demo-model-connection", Hr = "demo-model", Ur = "https://trilogy-data.github.io/trilogy-public-models/studio/demo-model.json", Wr = "tutorial_one_basic";
2918
- function Gr(e) {
2919
- let t = Object.values(e.editors).find((e) => e.name === Wr && e.connection === "demo-model-connection");
2920
- return t ? t.id : null;
2921
- }
2922
- function Kr(e, t, n, r) {
2923
- if (!r) return;
2924
- let i = e.editors[n];
2925
- i && r.validateQuery(t, {
2926
- text: i.contents,
2927
- editorType: i.type,
2928
- imports: [],
2929
- currentFilename: i.name
2930
- }, !1).catch((e) => console.error("Demo query backend warm-up failed:", e));
2931
- }
2932
- async function qr(e, t, n, r, i, a, o, c, l) {
2933
- let u = Gr(e), d = t.connectionByName(Vr);
2934
- if (u && d) return t.connectConnection(d.id).catch((e) => console.error("Demo connection failed to connect:", e)), Kr(e, d.id, u, l), u;
2935
- let f = new s(Vr, Hr);
2936
- t.addConnection(f), n.newModelConfig(Hr, !0), await new w(e, n, r).importModel(Hr, Ur, Vr), await i(Object.values(e.editors)), await a(Object.values(t.connections)), await o(Object.values(n.models)), await c(Object.values(r.dashboards)), t.connectConnection(f.id).catch((e) => console.error("Demo connection failed to connect:", e));
2937
- let p = Gr(e);
2938
- if (!p) throw Error(`Demo import did not produce the "${Wr}" editor`);
2939
- return Kr(e, f.id, p, l), p;
2940
- }
2941
- //#endregion
2942
- export { xt as a, Je as c, Me as d, Ce as f, Vt as i, Ie as l, Br as n, ut as o, he as p, Nn as r, rt as s, qr as t, Pe as u };