@trilogy-data/trilogy-studio-components 0.1.13 → 0.1.14

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 (294) hide show
  1. package/dist/{ChatCreatorModal-CGYVd4b5.js → ChatCreatorModal-D-CByWEF.js} +12 -12
  2. package/dist/{Dashboard-BzU5l0J1.js → Dashboard-CCWjUVBq.js} +347 -348
  3. package/dist/{DashboardCreatorInline-szUAhl3C.js → DashboardCreatorInline-DRlxDEBN.js} +1 -1
  4. package/dist/{DashboardMobile-cUHQPGAT.js → DashboardMobile-GOPaxc9_.js} +104 -103
  5. package/dist/{LLMConnectionList-egIna8uh.js → LLMConnectionList-ByLjIXLO.js} +1168 -1213
  6. package/dist/{LLMView-BXlHVvci.js → LLMView-B7XLbzBx.js} +53 -51
  7. package/dist/Manager-B2wTf-lw.js +4 -0
  8. package/dist/{ResultComponent-Dqzd51fk.js → ResultComponent-BKuWOt_p.js} +37 -34
  9. package/dist/Sidebar-CMy9ptnW.js +2188 -0
  10. package/dist/TutorialPage-9YzXa97t.js +509 -0
  11. package/dist/{WelcomePage-CKUubkCt.js → WelcomePage-BMcBpSQ7.js} +4 -4
  12. package/dist/components/AssetAutoImporter.vue.d.ts.map +1 -1
  13. package/dist/components/ChartControlPanel.vue.d.ts.map +1 -1
  14. package/dist/components/CodeBlock.vue.d.ts.map +1 -1
  15. package/dist/components/ConfirmDialog.vue.d.ts +25 -0
  16. package/dist/components/ConfirmDialog.vue.d.ts.map +1 -0
  17. package/dist/components/ContextMenu.vue.d.ts +4 -2
  18. package/dist/components/ContextMenu.vue.d.ts.map +1 -1
  19. package/dist/components/DataTable.vue.d.ts +9 -0
  20. package/dist/components/DataTable.vue.d.ts.map +1 -1
  21. package/dist/components/EditableTitle.vue.d.ts.map +1 -1
  22. package/dist/components/HintComponent.vue.d.ts +1 -1
  23. package/dist/components/HintComponent.vue.d.ts.map +1 -1
  24. package/dist/components/LoadingButton.vue.d.ts.map +1 -1
  25. package/dist/components/MarkdownRenderer.vue.d.ts +1 -0
  26. package/dist/components/MarkdownRenderer.vue.d.ts.map +1 -1
  27. package/dist/components/ModalDialog.vue.d.ts +36 -0
  28. package/dist/components/ModalDialog.vue.d.ts.map +1 -0
  29. package/dist/components/PopupModal.vue.d.ts.map +1 -1
  30. package/dist/components/SimpleEditor.vue.d.ts +117 -0
  31. package/dist/components/SimpleEditor.vue.d.ts.map +1 -1
  32. package/dist/components/StatusIcon.vue.d.ts +3 -3
  33. package/dist/components/StatusIcon.vue.d.ts.map +1 -1
  34. package/dist/components/StoreTokenModal.vue.d.ts +18 -0
  35. package/dist/components/StoreTokenModal.vue.d.ts.map +1 -0
  36. package/dist/components/SymbolsPane.vue.d.ts.map +1 -1
  37. package/dist/components/VegaLiteChart.vue.d.ts.map +1 -1
  38. package/dist/components/chartRenderManager.d.ts +2 -0
  39. package/dist/components/chartRenderManager.d.ts.map +1 -1
  40. package/dist/components/community/AddStoreModal.vue.d.ts +46 -1
  41. package/dist/components/community/AddStoreModal.vue.d.ts.map +1 -1
  42. package/dist/components/community/CommunityModelCard.vue.d.ts +3 -3
  43. package/dist/components/community/CommunityModelCard.vue.d.ts.map +1 -1
  44. package/dist/components/community/CommunityModelHeader.vue.d.ts +7 -4
  45. package/dist/components/community/CommunityModelHeader.vue.d.ts.map +1 -1
  46. package/dist/components/community/CommunityModels.vue.d.ts +4 -4
  47. package/dist/components/community/CommunityModels.vue.d.ts.map +1 -1
  48. package/dist/components/community/CommunityRemote.vue.d.ts.map +1 -1
  49. package/dist/components/connection/ConnectionDatabase.vue.d.ts.map +1 -1
  50. package/dist/components/connection/ConnectionSchema.vue.d.ts.map +1 -1
  51. package/dist/components/connection/ConnectionTable.vue.d.ts +9 -0
  52. package/dist/components/connection/ConnectionTable.vue.d.ts.map +1 -1
  53. package/dist/components/dashboard/Dashboard.vue.d.ts +4 -4
  54. package/dist/components/dashboard/Dashboard.vue.d.ts.map +1 -1
  55. package/dist/components/dashboard/DashboardAddItemModal.vue.d.ts +4 -4
  56. package/dist/components/dashboard/DashboardAddItemModal.vue.d.ts.map +1 -1
  57. package/dist/components/dashboard/DashboardCTA.vue.d.ts +4 -4
  58. package/dist/components/dashboard/DashboardCTA.vue.d.ts.map +1 -1
  59. package/dist/components/dashboard/DashboardChart.vue.d.ts +1 -1
  60. package/dist/components/dashboard/DashboardChart.vue.d.ts.map +1 -1
  61. package/dist/components/dashboard/DashboardChartEditor.vue.d.ts +234 -2
  62. package/dist/components/dashboard/DashboardChartEditor.vue.d.ts.map +1 -1
  63. package/dist/components/dashboard/DashboardDataSelector.vue.d.ts.map +1 -1
  64. package/dist/components/dashboard/DashboardEditorDialog.vue.d.ts +42 -0
  65. package/dist/components/dashboard/DashboardEditorDialog.vue.d.ts.map +1 -0
  66. package/dist/components/dashboard/DashboardFilter.vue.d.ts +0 -1
  67. package/dist/components/dashboard/DashboardFilter.vue.d.ts.map +1 -1
  68. package/dist/components/dashboard/DashboardFilterAutocomplete.vue.d.ts.map +1 -1
  69. package/dist/components/dashboard/DashboardGridItem.vue.d.ts +4 -4
  70. package/dist/components/dashboard/DashboardGridItem.vue.d.ts.map +1 -1
  71. package/dist/components/dashboard/DashboardHeader.vue.d.ts.map +1 -1
  72. package/dist/components/dashboard/DashboardHeaderFilterInput.vue.d.ts +1 -0
  73. package/dist/components/dashboard/DashboardHeaderFilterInput.vue.d.ts.map +1 -1
  74. package/dist/components/dashboard/DashboardImportPopup.vue.d.ts +5 -7
  75. package/dist/components/dashboard/DashboardImportPopup.vue.d.ts.map +1 -1
  76. package/dist/components/dashboard/DashboardImportSelector.vue.d.ts +4 -1
  77. package/dist/components/dashboard/DashboardImportSelector.vue.d.ts.map +1 -1
  78. package/dist/components/dashboard/DashboardMarkdown.vue.d.ts +1 -20
  79. package/dist/components/dashboard/DashboardMarkdown.vue.d.ts.map +1 -1
  80. package/dist/components/dashboard/DashboardMarkdownEditor.vue.d.ts +234 -1
  81. package/dist/components/dashboard/DashboardMarkdownEditor.vue.d.ts.map +1 -1
  82. package/dist/components/dashboard/DashboardMobile.vue.d.ts +3 -3
  83. package/dist/components/dashboard/DashboardMobile.vue.d.ts.map +1 -1
  84. package/dist/components/dashboard/DashboardSharePopup.vue.d.ts +5 -7
  85. package/dist/components/dashboard/DashboardSharePopup.vue.d.ts.map +1 -1
  86. package/dist/components/dashboard/DashboardTable.vue.d.ts +9 -1
  87. package/dist/components/dashboard/DashboardTable.vue.d.ts.map +1 -1
  88. package/dist/components/dashboard/useDashboard.d.ts.map +1 -1
  89. package/dist/components/dashboard/useDashboardItemShell.d.ts +28 -0
  90. package/dist/components/dashboard/useDashboardItemShell.d.ts.map +1 -0
  91. package/dist/components/editor/Editor.vue.d.ts +20 -6
  92. package/dist/components/editor/Editor.vue.d.ts.map +1 -1
  93. package/dist/components/editor/EditorCreatorInline.vue.d.ts.map +1 -1
  94. package/dist/components/editor/EditorHeader.vue.d.ts +10 -3
  95. package/dist/components/editor/EditorHeader.vue.d.ts.map +1 -1
  96. package/dist/components/editor/ResultComponent.vue.d.ts +75 -181
  97. package/dist/components/editor/ResultComponent.vue.d.ts.map +1 -1
  98. package/dist/components/editor/Results.vue.d.ts +9 -0
  99. package/dist/components/editor/Results.vue.d.ts.map +1 -1
  100. package/dist/components/editor/editorHelpers.d.ts +1 -1
  101. package/dist/components/editor/editorHelpers.d.ts.map +1 -1
  102. package/dist/components/jobs/JobsAddStoreModal.vue.d.ts +14 -0
  103. package/dist/components/jobs/JobsAddStoreModal.vue.d.ts.map +1 -0
  104. package/dist/components/jobs/JobsView.vue.d.ts +6 -0
  105. package/dist/components/jobs/JobsView.vue.d.ts.map +1 -0
  106. package/dist/components/layout/MobileSidebarLayout.vue.d.ts.map +1 -1
  107. package/dist/components/layout/SidebarLayout.vue.d.ts.map +1 -1
  108. package/dist/components/layout/TabbedBrowser.vue.d.ts +1 -12
  109. package/dist/components/layout/TabbedBrowser.vue.d.ts.map +1 -1
  110. package/dist/components/layout/TabbedLayout.vue.d.ts.map +1 -1
  111. package/dist/components/llm/ArtifactsPane.vue.d.ts +11 -2
  112. package/dist/components/llm/ArtifactsPane.vue.d.ts.map +1 -1
  113. package/dist/components/llm/ChatArtifact.vue.d.ts +10 -0
  114. package/dist/components/llm/ChatArtifact.vue.d.ts.map +1 -1
  115. package/dist/components/llm/ChatCreatorModal.vue.d.ts +1 -9
  116. package/dist/components/llm/ChatCreatorModal.vue.d.ts.map +1 -1
  117. package/dist/components/llm/LLMChat.vue.d.ts +9 -36
  118. package/dist/components/llm/LLMChat.vue.d.ts.map +1 -1
  119. package/dist/components/llm/LLMChatSplitView.vue.d.ts +55 -185
  120. package/dist/components/llm/LLMChatSplitView.vue.d.ts.map +1 -1
  121. package/dist/components/llm/LLMEditorRefinement.vue.d.ts +47 -180
  122. package/dist/components/llm/LLMEditorRefinement.vue.d.ts.map +1 -1
  123. package/dist/components/llm/toolCallDisplay.d.ts +13 -0
  124. package/dist/components/llm/toolCallDisplay.d.ts.map +1 -0
  125. package/dist/components/model/ModelCard.vue.d.ts +22 -5
  126. package/dist/components/model/ModelCard.vue.d.ts.map +1 -1
  127. package/dist/components/model/ModelConcept.vue.d.ts.map +1 -1
  128. package/dist/components/model/ModelCreator.vue.d.ts +3 -0
  129. package/dist/components/model/ModelCreator.vue.d.ts.map +1 -1
  130. package/dist/components/model/ModelSelector.vue.d.ts.map +1 -1
  131. package/dist/components/sidebar/CommunityModelList.vue.d.ts +284 -0
  132. package/dist/components/sidebar/CommunityModelList.vue.d.ts.map +1 -0
  133. package/dist/components/sidebar/CommunityModelListItem.vue.d.ts +7 -7
  134. package/dist/components/sidebar/CommunityModelListItem.vue.d.ts.map +1 -1
  135. package/dist/components/sidebar/ConnectionCreatorInline.vue.d.ts.map +1 -1
  136. package/dist/components/sidebar/ConnectionIcon.vue.d.ts.map +1 -1
  137. package/dist/components/sidebar/ConnectionList.vue.d.ts +21 -71
  138. package/dist/components/sidebar/ConnectionList.vue.d.ts.map +1 -1
  139. package/dist/components/sidebar/ConnectionListItem.vue.d.ts +15 -61
  140. package/dist/components/sidebar/ConnectionListItem.vue.d.ts.map +1 -1
  141. package/dist/components/sidebar/ConnectionRefresh.vue.d.ts.map +1 -1
  142. package/dist/components/sidebar/CreateEditorFromDatasourcePopup.vue.d.ts.map +1 -1
  143. package/dist/components/sidebar/DashboardList.vue.d.ts +33 -75
  144. package/dist/components/sidebar/DashboardList.vue.d.ts.map +1 -1
  145. package/dist/components/sidebar/DashboardListItem.vue.d.ts +13 -59
  146. package/dist/components/sidebar/DashboardListItem.vue.d.ts.map +1 -1
  147. package/dist/components/sidebar/DuckDBImporter.vue.d.ts +1 -0
  148. package/dist/components/sidebar/DuckDBImporter.vue.d.ts.map +1 -1
  149. package/dist/components/sidebar/EditorList.vue.d.ts +190 -67
  150. package/dist/components/sidebar/EditorList.vue.d.ts.map +1 -1
  151. package/dist/components/sidebar/EditorListItem.vue.d.ts +16 -59
  152. package/dist/components/sidebar/EditorListItem.vue.d.ts.map +1 -1
  153. package/dist/components/sidebar/GenericSidebarItem.vue.d.ts.map +1 -1
  154. package/dist/components/sidebar/JobsList.vue.d.ts +12 -0
  155. package/dist/components/sidebar/JobsList.vue.d.ts.map +1 -0
  156. package/dist/components/sidebar/JobsListItem.vue.d.ts +25 -0
  157. package/dist/components/sidebar/JobsListItem.vue.d.ts.map +1 -0
  158. package/dist/components/sidebar/LLMConnectionCreator.vue.d.ts.map +1 -1
  159. package/dist/components/sidebar/LLMConnectionList.vue.d.ts +14 -356
  160. package/dist/components/sidebar/LLMConnectionList.vue.d.ts.map +1 -1
  161. package/dist/components/sidebar/LLMConnectionListItem.vue.d.ts +15 -190
  162. package/dist/components/sidebar/LLMConnectionListItem.vue.d.ts.map +1 -1
  163. package/dist/components/sidebar/ModelSidebar.vue.d.ts +15 -0
  164. package/dist/components/sidebar/ModelSidebar.vue.d.ts.map +1 -1
  165. package/dist/components/sidebar/Sidebar.vue.d.ts +3966 -0
  166. package/dist/components/sidebar/Sidebar.vue.d.ts.map +1 -0
  167. package/dist/components/sidebar/SidebarList.vue.d.ts.map +1 -1
  168. package/dist/components/sidebar/SidebarOverflowMenu.vue.d.ts +19 -0
  169. package/dist/components/sidebar/SidebarOverflowMenu.vue.d.ts.map +1 -0
  170. package/dist/components/sidebar/SidebarTagChip.vue.d.ts +6 -0
  171. package/dist/components/sidebar/SidebarTagChip.vue.d.ts.map +1 -0
  172. package/dist/components/tutorial/TutorialPrompt.vue.d.ts +97 -186
  173. package/dist/components/tutorial/TutorialPrompt.vue.d.ts.map +1 -1
  174. package/dist/components/useConfirmationState.d.ts +10 -0
  175. package/dist/components/useConfirmationState.d.ts.map +1 -0
  176. package/dist/composables/useClickOutside.d.ts +12 -0
  177. package/dist/composables/useClickOutside.d.ts.map +1 -0
  178. package/dist/connections/index.d.ts +1 -0
  179. package/dist/connections/index.d.ts.map +1 -1
  180. package/dist/connections/remoteProject.d.ts +23 -0
  181. package/dist/connections/remoteProject.d.ts.map +1 -0
  182. package/dist/{cssMode-CTNpWCFn.js → cssMode-Cfy3yIk-.js} +1 -1
  183. package/dist/dashboards/base.d.ts +2 -1
  184. package/dist/dashboards/base.d.ts.map +1 -1
  185. package/dist/dashboards/prompts.d.ts +1 -1
  186. package/dist/dashboards/prompts.d.ts.map +1 -1
  187. package/dist/dashboards/spec.d.ts +4 -0
  188. package/dist/dashboards/spec.d.ts.map +1 -1
  189. package/dist/data/index.d.ts +1 -0
  190. package/dist/data/index.d.ts.map +1 -1
  191. package/dist/data/localStorage.d.ts +3 -3
  192. package/dist/data/localStorage.d.ts.map +1 -1
  193. package/dist/data/remoteStoreStorage.d.ts +46 -0
  194. package/dist/data/remoteStoreStorage.d.ts.map +1 -0
  195. package/dist/data/storage.d.ts +6 -6
  196. package/dist/data/storage.d.ts.map +1 -1
  197. package/dist/data/tutorial/reference.d.ts.map +1 -1
  198. package/dist/editors/editor.d.ts +19 -5
  199. package/dist/editors/editor.d.ts.map +1 -1
  200. package/dist/editors/fileTypes.d.ts +12 -0
  201. package/dist/editors/fileTypes.d.ts.map +1 -0
  202. package/dist/editors/helpers.d.ts +2 -0
  203. package/dist/editors/helpers.d.ts.map +1 -1
  204. package/dist/{freemarker2-Cc0GWdmq.js → freemarker2-Dy8u-XQv.js} +1 -1
  205. package/dist/{handlebars-BpAJzwKQ.js → handlebars-BDrD8h_c.js} +1 -1
  206. package/dist/{html-C4cOr6Q2.js → html-CKz7V4Cn.js} +1 -1
  207. package/dist/{htmlMode-4GTCH2de.js → htmlMode-BZE5C9QD.js} +1 -1
  208. package/dist/{javascript-eCxY6C4t.js → javascript-Cav2mApM.js} +1 -1
  209. package/dist/{jsonMode-P2zF1eXm.js → jsonMode-B6434NZu.js} +1 -1
  210. package/dist/{liquid-CHf82yU1.js → liquid-Cq-Omf5B.js} +1 -1
  211. package/dist/llm/chatToolExecutor.d.ts.map +1 -1
  212. package/dist/llm/editorRefinementToolExecutor.d.ts.map +1 -1
  213. package/dist/llm/toolLoopCore.d.ts.map +1 -1
  214. package/dist/{main-B49yDSSL.js → main-C-6acy1R.js} +57734 -55586
  215. package/dist/main.css +1 -1
  216. package/dist/main.js +16 -16
  217. package/dist/main.umd.cjs +580 -559
  218. package/dist/{mdx-DhkaMLCX.js → mdx-DYvw7-lF.js} +1 -1
  219. package/dist/models/helpers.d.ts +16 -4
  220. package/dist/models/helpers.d.ts.map +1 -1
  221. package/dist/models/model.d.ts +1 -0
  222. package/dist/models/model.d.ts.map +1 -1
  223. package/dist/monaco/editorHelpers.d.ts.map +1 -1
  224. package/dist/prism-clike-SH1s-yiH.js +31 -0
  225. package/dist/prism-javascript-CLux6jF8.js +137 -0
  226. package/dist/prism-json-iVb7He6L.js +25 -0
  227. package/dist/prism-markdown-tjNeCMi3.js +300 -0
  228. package/dist/prism-markup-BNGj0Tvm.js +173 -0
  229. package/dist/prism-python-DBk-6kcY.js +71 -0
  230. package/dist/prism-typescript-Crma_dEX.js +55 -0
  231. package/dist/{python-BPlpgFwf.js → python-BTTSwl4o.js} +1 -1
  232. package/dist/{razor-Bw_qWSSk.js → razor-BVBhJqGl.js} +1 -1
  233. package/dist/remotes/genericStoreMetadata.d.ts +8 -0
  234. package/dist/remotes/genericStoreMetadata.d.ts.map +1 -0
  235. package/dist/remotes/jobs.d.ts +38 -0
  236. package/dist/remotes/jobs.d.ts.map +1 -0
  237. package/dist/remotes/jobsService.d.ts +15 -0
  238. package/dist/remotes/jobsService.d.ts.map +1 -0
  239. package/dist/remotes/models.d.ts +2 -1
  240. package/dist/remotes/models.d.ts.map +1 -1
  241. package/dist/remotes/remoteStoreSync.d.ts +7 -0
  242. package/dist/remotes/remoteStoreSync.d.ts.map +1 -0
  243. package/dist/remotes/storeService.d.ts +2 -1
  244. package/dist/remotes/storeService.d.ts.map +1 -1
  245. package/dist/stores/Manager.vue.d.ts +9 -0
  246. package/dist/stores/Manager.vue.d.ts.map +1 -1
  247. package/dist/stores/communityApiStore.d.ts +6 -0
  248. package/dist/stores/communityApiStore.d.ts.map +1 -1
  249. package/dist/stores/editorStore.d.ts +7 -2
  250. package/dist/stores/editorStore.d.ts.map +1 -1
  251. package/dist/stores/index.d.ts +1 -0
  252. package/dist/stores/index.d.ts.map +1 -1
  253. package/dist/stores/jobsApiStore.d.ts +45 -0
  254. package/dist/stores/jobsApiStore.d.ts.map +1 -0
  255. package/dist/stores/modelStore.d.ts.map +1 -1
  256. package/dist/stores/queryExecutionService.d.ts +6 -4
  257. package/dist/stores/queryExecutionService.d.ts.map +1 -1
  258. package/dist/stores/resolver.d.ts +4 -4
  259. package/dist/stores/resolver.d.ts.map +1 -1
  260. package/dist/stores/useScreenNavigation.d.ts +3 -1
  261. package/dist/stores/useScreenNavigation.d.ts.map +1 -1
  262. package/dist/stores/userSettingsStore.d.ts.map +1 -1
  263. package/dist/{tsMode-B4G-3v3r.js → tsMode-z99lZ8eT.js} +1 -1
  264. package/dist/{typescript-CxjsldWX.js → typescript-BXQnMlGm.js} +1 -1
  265. package/dist/useDashboard-3deVRse_.js +3502 -0
  266. package/dist/utility/markdownRenderer.d.ts.map +1 -1
  267. package/dist/utility/prism.d.ts +5 -0
  268. package/dist/utility/prism.d.ts.map +1 -0
  269. package/dist/utils/terminalOutput.d.ts +3 -0
  270. package/dist/utils/terminalOutput.d.ts.map +1 -0
  271. package/dist/views/ConnectionView.vue.d.ts +9 -0
  272. package/dist/views/ConnectionView.vue.d.ts.map +1 -1
  273. package/dist/views/IDE.vue.d.ts +7 -0
  274. package/dist/views/IDE.vue.d.ts.map +1 -0
  275. package/dist/views/LLMView.vue.d.ts +232 -846
  276. package/dist/views/LLMView.vue.d.ts.map +1 -1
  277. package/dist/views/MobileIDE.vue.d.ts +6 -0
  278. package/dist/views/MobileIDE.vue.d.ts.map +1 -0
  279. package/dist/views/ModelView.vue.d.ts +46 -10
  280. package/dist/views/ModelView.vue.d.ts.map +1 -1
  281. package/dist/views/ResponsiveIDE.vue.d.ts.map +1 -1
  282. package/dist/views/TutorialPage.vue.d.ts +465 -907
  283. package/dist/views/TutorialPage.vue.d.ts.map +1 -1
  284. package/dist/{xml-DWqiAUCc.js → xml-Ci-UOFva.js} +1 -1
  285. package/dist/{yaml-BfqSAZW1.js → yaml-XEOisXAU.js} +1 -1
  286. package/package.json +1 -1
  287. package/dist/Manager-CWERTb_Q.js +0 -4
  288. package/dist/Sidebar-DNAHF4lz.js +0 -1862
  289. package/dist/TutorialPage-CqGb6CEf.js +0 -482
  290. package/dist/components/dashboard/DashboardCreatorIcon.vue.d.ts +0 -52
  291. package/dist/components/dashboard/DashboardCreatorIcon.vue.d.ts.map +0 -1
  292. package/dist/components/editor/EditorCreatorIcon.vue.d.ts +0 -61
  293. package/dist/components/editor/EditorCreatorIcon.vue.d.ts.map +0 -1
  294. package/dist/useDashboard-BrcAKpuC.js +0 -3352
@@ -0,0 +1,3502 @@
1
+ import { defineComponent as Y, ref as I, watch as ae, createBlock as G, openBlock as c, withCtx as z, createElementVNode as t, toDisplayString as O, normalizeClass as R, computed as g, createElementBlock as y, createCommentVNode as M, normalizeStyle as De, Fragment as ce, renderList as be, createTextVNode as ne, unref as oe, createVNode as J, withDirectives as se, withKeys as ge, vModelText as ve, onMounted as Ke, onUnmounted as it, inject as _, resolveComponent as Z, Teleport as rt, withModifiers as Oe, resolveDynamicComponent as lt, vModelRadio as at, vShow as st, renderSlot as Ve, onBeforeUnmount as dt, nextTick as Qe } from "vue";
2
+ import { k as We, a as X, a0 as _e, a1 as ut, T as Ee, a2 as Ue, a3 as je, u as Ge, Y as ct, L as mt, a4 as ht, U as Te, a5 as $e, a6 as ft, a7 as vt, M as pt, a8 as yt, a9 as ue, X as w, aa as Ie, ab as le, ac as fe, ad as gt, ae as bt, af as Ct, ag as Be, ah as wt, ai as kt, aj as St, N as Et, ak as Ne } from "./main-C-6acy1R.js";
3
+ const Dt = { class: "share-popup-body" }, It = { class: "json-container" }, Tt = {
4
+ "data-testid": "dashboard-json",
5
+ class: "json-code"
6
+ }, $t = /* @__PURE__ */ Y({
7
+ __name: "DashboardSharePopup",
8
+ props: {
9
+ dashboard: {},
10
+ isOpen: { type: Boolean }
11
+ },
12
+ emits: ["close"],
13
+ setup(e, { emit: o }) {
14
+ const n = e, l = o, r = I(""), i = I(!1), s = (m) => {
15
+ if (!m) return null;
16
+ const a = JSON.parse(JSON.stringify(m));
17
+ if (delete a.id, delete a.connection, delete a.storage, delete a.changed, delete a.deleted, a.layout && Array.isArray(a.layout) && (a.layout = a.layout.map((p) => {
18
+ const k = { ...p };
19
+ return delete k.static, delete k.moved, delete k.state, k;
20
+ })), a.gridItems && typeof a.gridItems == "object")
21
+ for (const [p, k] of Object.entries(a.gridItems)) {
22
+ const b = { ...k };
23
+ delete b.results, delete b.loading, delete b.loadStartTime, delete b.error, b.filters || delete b.filters, b.crossFilters || delete b.crossFilters, b.chartFilters || delete b.chartFilters, b.conceptFilters || delete b.conceptFilters, b.chartConfig && delete b.chartConfig.showDebug, a.gridItems[p] = b;
24
+ }
25
+ return a.imports && Array.isArray(a.imports) && (a.imports = a.imports.map((p) => {
26
+ const k = { ...p };
27
+ return delete k.id, k;
28
+ })), a;
29
+ };
30
+ ae(
31
+ [() => n.dashboard, () => n.isOpen],
32
+ ([m, a]) => {
33
+ if (a && m) {
34
+ const p = s(m);
35
+ r.value = JSON.stringify(p, null, 2), i.value = !1;
36
+ } else a || (r.value = "", i.value = !1);
37
+ },
38
+ { immediate: !0 }
39
+ );
40
+ const f = () => {
41
+ navigator.clipboard.writeText(r.value).then(() => {
42
+ i.value = !0, setTimeout(() => {
43
+ i.value = !1;
44
+ }, 2e3);
45
+ }).catch((m) => {
46
+ console.error("Could not copy text: ", m);
47
+ });
48
+ };
49
+ return (m, a) => (c(), G(We, {
50
+ show: e.isOpen,
51
+ title: "Export Definition",
52
+ "max-width": "860px",
53
+ "test-id": "dashboard-share-popup",
54
+ onClose: a[1] || (a[1] = (p) => l("close"))
55
+ }, {
56
+ footer: z(() => [
57
+ t("button", {
58
+ class: "secondary-button",
59
+ onClick: a[0] || (a[0] = (p) => l("close"))
60
+ }, "Close"),
61
+ t("button", {
62
+ onClick: f,
63
+ class: "dashboard-copy-button",
64
+ "data-testid": "copy-json-button"
65
+ }, [
66
+ t("i", {
67
+ class: R(["mdi", i.value ? "mdi-check-circle-outline" : "mdi-content-copy"]),
68
+ "aria-hidden": "true"
69
+ }, null, 2),
70
+ t("span", null, O(i.value ? "Copied" : "Copy JSON"), 1)
71
+ ])
72
+ ]),
73
+ default: z(() => [
74
+ t("div", Dt, [
75
+ a[3] || (a[3] = t("p", { class: "share-popup-description" }, " Copy a definition of this dashboard; it can be imported by others with the same model defined. Existing runtime/results info is removed automatically. ", -1)),
76
+ t("div", It, [
77
+ a[2] || (a[2] = t("div", { class: "json-toolbar" }, [
78
+ t("span", { class: "json-toolbar-label" }, "dashboard.json")
79
+ ], -1)),
80
+ t("pre", Tt, O(r.value), 1)
81
+ ])
82
+ ])
83
+ ]),
84
+ _: 1
85
+ }, 8, ["show"]));
86
+ }
87
+ }), Lt = /* @__PURE__ */ X($t, [["__scopeId", "data-v-fc505fa3"]]), Mt = ["onClick"], At = { class: "completion-details" }, Rt = { class: "completion-label" }, Ft = { class: "completion-description" }, qt = /* @__PURE__ */ Y({
88
+ __name: "DashboardFilterAutocomplete",
89
+ props: {
90
+ inputValue: {
91
+ type: String,
92
+ required: !0
93
+ },
94
+ completionItems: {
95
+ type: Array,
96
+ required: !0
97
+ },
98
+ inputElement: {
99
+ type: Object,
100
+ default: null
101
+ }
102
+ },
103
+ emits: ["select-completion"],
104
+ setup(e, { emit: o }) {
105
+ const n = e, l = o, r = I(!1), i = I(0), s = I(0), f = I(""), m = I(0), a = I(null), p = g(() => {
106
+ if (!n.inputElement) return {};
107
+ const E = n.inputElement.getBoundingClientRect();
108
+ return {
109
+ top: `${E.bottom + 50}px`,
110
+ left: `${E.left}px`,
111
+ width: `${E.width}px`,
112
+ maxHeight: "200px"
113
+ };
114
+ }), k = () => {
115
+ if (!n.inputElement) return;
116
+ s.value = n.inputElement.selectionStart || 0;
117
+ const E = n.inputValue;
118
+ let A = s.value;
119
+ for (; A > 0 && !/\s/.test(E.charAt(A - 1)); )
120
+ A--;
121
+ let T = s.value;
122
+ for (; T < E.length && !/\s/.test(E.charAt(T)); )
123
+ T++;
124
+ m.value = A, f.value = E.substring(A, T);
125
+ }, b = g(() => {
126
+ if (!f.value.trim()) return [];
127
+ const E = f.value.toLowerCase();
128
+ return n.completionItems.filter((A) => A.label.toLowerCase().includes(E)).sort((A, T) => {
129
+ const Q = A.label.toLowerCase().startsWith(E), K = T.label.toLowerCase().startsWith(E);
130
+ return Q && !K ? -1 : !Q && K ? 1 : A.label.localeCompare(T.label);
131
+ }).slice(0, 10);
132
+ });
133
+ ae(b, (E) => {
134
+ r.value = E.length > 0, i.value = 0;
135
+ });
136
+ const D = (E) => {
137
+ const A = n.inputValue.substring(0, m.value), T = n.inputValue.substring(s.value);
138
+ l("select-completion", {
139
+ text: A + E.label + T,
140
+ cursorPosition: m.value + E.label.length
141
+ }), r.value = !1;
142
+ }, q = (E) => E.trilogySubType ? E.trilogySubType.toLowerCase() : E.type.toLowerCase();
143
+ return ae(
144
+ () => n.inputValue,
145
+ () => {
146
+ k();
147
+ }
148
+ ), _e(
149
+ () => [a.value, n.inputElement],
150
+ () => {
151
+ r.value = !1;
152
+ },
153
+ {
154
+ enabled: () => r.value,
155
+ eventName: "mousedown"
156
+ }
157
+ ), k(), (E, A) => r.value ? (c(), y("div", {
158
+ key: 0,
159
+ ref_key: "dropdown",
160
+ ref: a,
161
+ class: "autocomplete-dropdown",
162
+ style: De(p.value)
163
+ }, [
164
+ (c(!0), y(ce, null, be(b.value, (T, Q) => (c(), y("div", {
165
+ key: Q,
166
+ class: R(["completion-item", { selected: Q === i.value }]),
167
+ onClick: (K) => D(T)
168
+ }, [
169
+ t("div", {
170
+ class: R(["symbol-icon", q(T)])
171
+ }, [
172
+ T.trilogySubType ? (c(), y("i", {
173
+ key: 0,
174
+ class: R(`mdi ${T.trilogySubType === "key" ? "mdi-key-outline" : T.trilogySubType === "property" ? "mdi-tag-outline" : "mdi-cube-outline"}`)
175
+ }, null, 2)) : (c(), y(ce, { key: 1 }, [
176
+ ne(O(T.type === "function" ? "ƒ" : T.type === "variable" ? "V" : T.type === "class" ? "C" : T.type === "interface" ? "I" : T.type === "method" ? "M" : T.type === "property" ? "P" : T.type === "field" ? "F" : T.type === "constant" ? "K" : T.type === "enum" ? "E" : T.type === "keyword" ? "K" : "S"), 1)
177
+ ], 64))
178
+ ], 2),
179
+ t("div", At, [
180
+ t("div", Rt, O(T.label), 1),
181
+ t("div", Ft, O(T.description), 1)
182
+ ])
183
+ ], 10, Mt))), 128))
184
+ ], 4)) : M("", !0);
185
+ }
186
+ }), xt = /* @__PURE__ */ X(qt, [["__scopeId", "data-v-89468628"]]), Ht = { class: "filter-container" }, Ot = { class: "filter-input-wrapper" }, Vt = ["value", "disabled"], Qt = ["value", "placeholder", "disabled"], Bt = {
187
+ key: 0,
188
+ class: "dropdown-error-message",
189
+ "data-testid": "dropdown-error-message"
190
+ }, Nt = { class: "dropdown-actions" }, Pt = ["disabled"], Kt = ["disabled"], Wt = {
191
+ key: 0,
192
+ class: "loader-container"
193
+ }, _t = ["disabled"], Ut = { class: "filter-inline-actions" }, jt = {
194
+ key: 0,
195
+ class: "filter-status error",
196
+ "data-testid": "filter-error-icon"
197
+ }, Gt = ["disabled"], zt = { class: "button-content" }, Jt = ["disabled"], Yt = { class: "button-content" }, Xt = {
198
+ key: 0,
199
+ class: "loader-container"
200
+ }, Zt = ["disabled"], en = { class: "button-content" }, tn = /* @__PURE__ */ Y({
201
+ __name: "DashboardHeaderFilterInput",
202
+ props: {
203
+ filterValue: {
204
+ type: String,
205
+ default: ""
206
+ },
207
+ filterError: String,
208
+ isLoading: Boolean,
209
+ globalCompletion: {
210
+ type: Array,
211
+ default: () => []
212
+ },
213
+ validateFilter: {
214
+ type: Function,
215
+ default: () => !0
216
+ }
217
+ },
218
+ emits: ["filter-change", "filter-apply", "clear-filter"],
219
+ setup(e, { emit: o }) {
220
+ const n = e, l = o, r = ut(), i = I(n.isLoading), s = I(null), f = I(null), m = I(null), a = I(n.filterValue || ""), p = I(!1), k = I(!1), b = g(() => a.value.replace(/\n/g, " ")), D = g(() => a.value.trim().length > 0);
221
+ function q() {
222
+ l("filter-apply", a.value), p.value = !1, Q();
223
+ }
224
+ function E() {
225
+ a.value = "", p.value = !0, l("filter-change", ""), l("filter-apply", ""), l("clear-filter", ""), setTimeout(() => {
226
+ f.value && f.value.focus();
227
+ }, 0);
228
+ }
229
+ function A(C) {
230
+ const v = C.target;
231
+ a.value = v.value, p.value = !0, l("filter-change", a.value);
232
+ }
233
+ function T() {
234
+ k.value = !0, setTimeout(() => {
235
+ if (f.value) {
236
+ f.value.focus();
237
+ const C = a.value.length;
238
+ f.value.setSelectionRange(C, C);
239
+ }
240
+ }, 0);
241
+ }
242
+ function Q() {
243
+ k.value = !1;
244
+ }
245
+ const K = () => {
246
+ i.value = !0;
247
+ const C = n.globalCompletion.map((v) => ({
248
+ name: v.label,
249
+ type: v.datatype,
250
+ description: v.description
251
+ }));
252
+ r.generateFilterQuery(a.value, C, n.validateFilter).then((v) => {
253
+ v && v.length > 0 && (a.value = v.replace(/^\s*where\s+/i, ""), p.value = !0, l("filter-apply", a.value)), i.value = !1;
254
+ }).catch(() => {
255
+ i.value = !1;
256
+ });
257
+ };
258
+ function B(C) {
259
+ C.key === "Enter" && !C.shiftKey && !C.ctrlKey && !C.altKey ? k.value || (C.preventDefault(), q()) : (C.ctrlKey || C.metaKey) && C.shiftKey && C.key === "Enter" ? (C.preventDefault(), K()) : C.key === "Escape" && k.value && (C.preventDefault(), Q());
260
+ }
261
+ function S(C) {
262
+ (C.ctrlKey || C.metaKey) && C.key === "Enter" && !C.shiftKey ? (C.preventDefault(), q()) : (C.ctrlKey || C.metaKey) && C.shiftKey && C.key === "Enter" ? (C.preventDefault(), K()) : C.key === "Escape" && (C.preventDefault(), Q());
263
+ }
264
+ const h = g(() => (n.filterError || "").length > 0 ? "error" : a.value ? "valid" : "neutral");
265
+ function W(C) {
266
+ a.value = C.text, p.value = !0, l("filter-change", a.value);
267
+ const v = k.value ? f.value : s.value;
268
+ v && (v.focus(), v.setSelectionRange(C.cursorPosition, C.cursorPosition));
269
+ }
270
+ return ae(
271
+ () => n.filterValue,
272
+ (C) => {
273
+ C !== a.value && (a.value = C || "", p.value = !1);
274
+ }
275
+ ), ae(
276
+ () => n.isLoading,
277
+ (C) => {
278
+ i.value = C;
279
+ }
280
+ ), _e(
281
+ () => [m.value, s.value],
282
+ () => {
283
+ Q();
284
+ },
285
+ {
286
+ enabled: () => k.value
287
+ }
288
+ ), (C, v) => (c(), y("div", Ht, [
289
+ t("div", Ot, [
290
+ t("input", {
291
+ id: "filter",
292
+ ref_key: "filterInputRef",
293
+ ref: s,
294
+ "data-testid": "filter-input",
295
+ type: "text",
296
+ value: b.value,
297
+ onInput: A,
298
+ onKeydown: B,
299
+ onFocus: T,
300
+ placeholder: "Add a global filter...",
301
+ class: R({ "filter-error": h.value === "error" }),
302
+ disabled: i.value
303
+ }, null, 42, Vt),
304
+ k.value ? (c(), y("div", {
305
+ key: 0,
306
+ ref_key: "filterDropdownRef",
307
+ ref: m,
308
+ class: "filter-dropdown"
309
+ }, [
310
+ t("div", { class: "dropdown-header" }, [
311
+ v[1] || (v[1] = t("span", null, "Global Filters", -1)),
312
+ t("button", {
313
+ onClick: Q,
314
+ class: "close-button",
315
+ title: "Close (Esc)"
316
+ }, [...v[0] || (v[0] = [
317
+ t("i", { class: "mdi mdi-close" }, null, -1)
318
+ ])])
319
+ ]),
320
+ t("textarea", {
321
+ ref_key: "filterTextareaRef",
322
+ ref: f,
323
+ class: R(["filter-textarea", { "filter-error": h.value === "error" }]),
324
+ value: a.value,
325
+ onInput: A,
326
+ onKeydown: S,
327
+ placeholder: oe(r).hasActiveDefaultConnection ? `Use a SQL condition (ex color='blue' or color='red') or text to filter.
328
+ Use Ctrl+Enter to apply, Ctrl+Shift+Enter for text to SQL` : `Use a SQL condition (ex color='blue') to filter.
329
+ Use Ctrl+Enter to apply`,
330
+ disabled: i.value,
331
+ rows: "4"
332
+ }, null, 42, Qt),
333
+ e.filterError ? (c(), y("div", Bt, [
334
+ v[2] || (v[2] = t("i", { class: "mdi mdi-alert-circle-outline" }, null, -1)),
335
+ t("span", null, O(e.filterError), 1)
336
+ ])) : M("", !0),
337
+ t("div", Nt, [
338
+ t("button", {
339
+ onClick: q,
340
+ class: R(["apply-button", { "has-changes": p.value }]),
341
+ disabled: i.value,
342
+ title: "Apply filter (Ctrl+Enter)"
343
+ }, [...v[3] || (v[3] = [
344
+ t("i", { class: "mdi mdi-check" }, null, -1),
345
+ ne(" Apply ", -1)
346
+ ])], 10, Pt),
347
+ oe(r).hasActiveDefaultConnection ? (c(), y("button", {
348
+ key: 0,
349
+ onClick: K,
350
+ class: "llm-button",
351
+ disabled: i.value,
352
+ title: "Text to filter (Ctrl+Shift+Enter)"
353
+ }, [
354
+ t("i", {
355
+ class: R(["mdi mdi-auto-fix", { hidden: i.value }])
356
+ }, null, 2),
357
+ i.value ? (c(), y("div", Wt, [...v[4] || (v[4] = [
358
+ t("div", { class: "loader" }, null, -1)
359
+ ])])) : M("", !0),
360
+ v[5] || (v[5] = ne(" Text to Filter ", -1))
361
+ ], 8, Kt)) : M("", !0),
362
+ t("button", {
363
+ onClick: E,
364
+ class: "clear-button",
365
+ disabled: i.value,
366
+ title: "Clear filter"
367
+ }, [...v[6] || (v[6] = [
368
+ t("i", { class: "mdi mdi-close-circle-outline" }, null, -1),
369
+ ne(" Clear ", -1)
370
+ ])], 8, _t)
371
+ ])
372
+ ], 512)) : M("", !0),
373
+ (k.value ? f.value : s.value) ? (c(), G(xt, {
374
+ key: 1,
375
+ "input-value": a.value,
376
+ "completion-items": e.globalCompletion,
377
+ "input-element": k.value ? f.value : s.value,
378
+ onSelectCompletion: W
379
+ }, null, 8, ["input-value", "completion-items", "input-element"])) : M("", !0),
380
+ t("div", Ut, [
381
+ h.value === "error" ? (c(), y("div", jt, [
382
+ v[8] || (v[8] = t("i", { class: "mdi mdi-alert-circle-outline" }, null, -1)),
383
+ J(Ee, {
384
+ content: e.filterError || "Unknown Error",
385
+ position: "bottom"
386
+ }, {
387
+ default: z(() => [...v[7] || (v[7] = [
388
+ t("span", {
389
+ class: "tooltip-trigger",
390
+ "data-testid": "filter-error-tooltip-trigger"
391
+ }, null, -1)
392
+ ])]),
393
+ _: 1
394
+ }, 8, ["content"])
395
+ ])) : M("", !0),
396
+ t("button", {
397
+ onClick: q,
398
+ class: R(["input-icon-button", { "has-changes": p.value }]),
399
+ "data-testid": "filter-search-button",
400
+ disabled: i.value,
401
+ title: "Apply filter (Enter)"
402
+ }, [
403
+ t("div", zt, [
404
+ v[10] || (v[10] = t("i", { class: "mdi mdi-magnify" }, null, -1)),
405
+ J(Ee, {
406
+ content: p.value ? "Apply changes (Enter)" : "Search (Enter)",
407
+ position: "top"
408
+ }, {
409
+ default: z(() => [...v[9] || (v[9] = [
410
+ t("span", { class: "tooltip-trigger" }, null, -1)
411
+ ])]),
412
+ _: 1
413
+ }, 8, ["content"])
414
+ ])
415
+ ], 10, Gt),
416
+ oe(r).hasActiveDefaultConnection ? (c(), y("button", {
417
+ key: 1,
418
+ onClick: K,
419
+ class: "input-icon-button",
420
+ "data-testid": "filter-llm-button",
421
+ disabled: i.value,
422
+ title: "Transform text to filter if you have a configured LLM connection"
423
+ }, [
424
+ t("div", Yt, [
425
+ t("i", {
426
+ class: R(["mdi mdi-auto-fix", { hidden: i.value }])
427
+ }, null, 2),
428
+ i.value ? (c(), y("div", Xt, [...v[11] || (v[11] = [
429
+ t("div", { class: "loader" }, null, -1)
430
+ ])])) : M("", !0),
431
+ J(Ee, {
432
+ content: i.value ? "Processing..." : "Text to filter (Ctrl+Shift+Enter)",
433
+ position: "top"
434
+ }, {
435
+ default: z(() => [...v[12] || (v[12] = [
436
+ t("span", { class: "tooltip-trigger" }, null, -1)
437
+ ])]),
438
+ _: 1
439
+ }, 8, ["content"])
440
+ ])
441
+ ], 8, Jt)) : M("", !0),
442
+ D.value ? (c(), y("button", {
443
+ key: 2,
444
+ onClick: E,
445
+ class: "input-icon-button clear-icon-button",
446
+ "data-testid": "clear-filters-button",
447
+ disabled: i.value,
448
+ title: "Clear all filters"
449
+ }, [
450
+ t("div", en, [
451
+ v[14] || (v[14] = t("i", { class: "mdi mdi-close" }, null, -1)),
452
+ J(Ee, {
453
+ content: "Clear all filters",
454
+ position: "top"
455
+ }, {
456
+ default: z(() => [...v[13] || (v[13] = [
457
+ t("span", { class: "tooltip-trigger" }, null, -1)
458
+ ])]),
459
+ _: 1
460
+ })
461
+ ])
462
+ ], 8, Zt)) : M("", !0)
463
+ ])
464
+ ])
465
+ ]));
466
+ }
467
+ }), nn = /* @__PURE__ */ X(tn, [["__scopeId", "data-v-ff037c5f"]]), on = {
468
+ class: "dashboard-controls",
469
+ "data-testid": "dashboard-controls"
470
+ }, rn = {
471
+ key: 0,
472
+ class: "editable-text"
473
+ }, ln = { class: "title-text" }, an = {
474
+ key: 0,
475
+ class: "edit-indicator",
476
+ "data-testid": "edit-dashboard-title"
477
+ }, sn = {
478
+ key: 0,
479
+ class: "dashboard-right-controls"
480
+ }, dn = {
481
+ class: "connection-selector",
482
+ "data-testid": "connection-selector-wrapper"
483
+ }, un = { class: "select-wrapper" }, cn = ["value", "title"], mn = ["value"], hn = { class: "grid-actions top-actions" }, fn = { class: "controls-row filter-row" }, vn = { class: "grid-actions filter-actions" }, pn = {
484
+ class: "mode-selector",
485
+ "data-testid": "mode-selector-wrapper"
486
+ }, yn = { class: "select-wrapper" }, gn = ["value", "disabled"], bn = /* @__PURE__ */ Y({
487
+ __name: "DashboardHeader",
488
+ props: {
489
+ dashboard: {
490
+ type: Object,
491
+ required: !0
492
+ },
493
+ editsLocked: Boolean,
494
+ selectedConnection: {
495
+ type: String,
496
+ required: !0
497
+ },
498
+ filterError: String,
499
+ globalCompletion: {
500
+ type: Array,
501
+ default: () => []
502
+ },
503
+ validateFilter: {
504
+ type: Function,
505
+ default: () => !0
506
+ }
507
+ },
508
+ emits: [
509
+ "connection-change",
510
+ "filter-change",
511
+ "import-change",
512
+ "add-item",
513
+ "clear-items",
514
+ "clear-filter",
515
+ "mode-change",
516
+ "refresh",
517
+ "title-update",
518
+ "export-image"
519
+ ],
520
+ setup(e, { emit: o }) {
521
+ const n = e, l = o, r = Ue(), i = je(), s = Ge(), f = I(!1), m = I(!1), a = I(!1), p = I(""), k = I(null);
522
+ function b() {
523
+ m.value = !m.value;
524
+ }
525
+ function D() {
526
+ m.value = !1;
527
+ }
528
+ function q(v) {
529
+ l("filter-change", v);
530
+ }
531
+ async function E() {
532
+ return l("export-image"), await new Promise((v) => setTimeout(v, 5e3)), Promise.resolve();
533
+ }
534
+ function A(v) {
535
+ const $ = v.target;
536
+ l("mode-change", $.value);
537
+ }
538
+ function T() {
539
+ var v;
540
+ n.editsLocked || (a.value = !0, p.value = ((v = n.dashboard) == null ? void 0 : v.name) || "Untitled Dashboard", setTimeout(() => {
541
+ var $;
542
+ ($ = k.value) == null || $.focus();
543
+ }, 0));
544
+ }
545
+ function Q() {
546
+ a.value = !1, l("title-update", p.value);
547
+ }
548
+ function K() {
549
+ var v;
550
+ a.value = !1, p.value = ((v = n.dashboard) == null ? void 0 : v.name) || "Untitled Dashboard";
551
+ }
552
+ const B = g(() => Object.values(i.editors).filter(($) => $.connection === n.selectedConnection).sort(($, ee) => $.name.localeCompare(ee.name)).map(($) => ({
553
+ id: $.id,
554
+ name: $.name.replace(/\//g, "."),
555
+ alias: ""
556
+ }))), S = g(() => {
557
+ var v;
558
+ return ((v = n.dashboard) == null ? void 0 : v.imports) || [];
559
+ });
560
+ function h(v) {
561
+ l("import-change", v);
562
+ }
563
+ function W() {
564
+ l("refresh");
565
+ }
566
+ const C = g(() => {
567
+ var v;
568
+ switch ((v = n.dashboard) == null ? void 0 : v.state) {
569
+ case "editing":
570
+ return "mdi mdi-pencil-outline";
571
+ case "published":
572
+ return "mdi mdi-eye-outline";
573
+ case "fullscreen":
574
+ return "mdi mdi-fullscreen";
575
+ default:
576
+ return "mdi mdi-eye-outline";
577
+ }
578
+ });
579
+ return (v, $) => {
580
+ var ee, te;
581
+ return c(), y("div", on, [
582
+ t("div", {
583
+ class: R(["controls-row title-row", { "view-title-row": e.dashboard.state !== "editing" }])
584
+ }, [
585
+ t("div", {
586
+ class: "dashboard-title",
587
+ onClick: T
588
+ }, [
589
+ a.value ? se((c(), y("input", {
590
+ key: 1,
591
+ ref_key: "titleInput",
592
+ ref: k,
593
+ "data-testid": "dashboard-title-input",
594
+ "onUpdate:modelValue": $[0] || ($[0] = (U) => p.value = U),
595
+ onBlur: Q,
596
+ onKeyup: [
597
+ ge(Q, ["enter"]),
598
+ ge(K, ["esc"])
599
+ ],
600
+ class: "title-input",
601
+ type: "text"
602
+ }, null, 544)), [
603
+ [ve, p.value]
604
+ ]) : (c(), y("span", rn, [
605
+ t("span", ln, O(((ee = e.dashboard) == null ? void 0 : ee.name) || "Untitled Dashboard"), 1),
606
+ e.editsLocked ? M("", !0) : (c(), y("span", an, [...$[6] || ($[6] = [
607
+ t("i", { class: "mdi mdi-pencil-outline" }, null, -1)
608
+ ])]))
609
+ ]))
610
+ ]),
611
+ e.dashboard.state === "editing" ? (c(), y("div", sn, [
612
+ t("div", dn, [
613
+ t("div", un, [
614
+ $[7] || ($[7] = t("i", { class: "mdi mdi-database-outline select-icon" }, null, -1)),
615
+ t("select", {
616
+ id: "connection",
617
+ "data-testid": "connection-selector",
618
+ onChange: $[1] || ($[1] = (U) => v.$emit("connection-change", U)),
619
+ value: e.selectedConnection,
620
+ title: e.selectedConnection
621
+ }, [
622
+ (c(!0), y(ce, null, be(Object.values(oe(r).connections).filter(
623
+ (U) => U.model
624
+ ), (U) => (c(), y("option", {
625
+ key: U.name,
626
+ value: U.name
627
+ }, O(U.name), 9, mn))), 128))
628
+ ], 40, cn)
629
+ ])
630
+ ]),
631
+ J(ct, {
632
+ "available-imports": B.value,
633
+ "active-imports": S.value,
634
+ "onUpdate:imports": h,
635
+ onExplore: $[2] || ($[2] = (U) => oe(s).openTab("editors", null, U.id))
636
+ }, null, 8, ["available-imports", "active-imports"]),
637
+ t("div", hn, [
638
+ t("button", {
639
+ onClick: $[3] || ($[3] = (U) => v.$emit("add-item")),
640
+ class: "btn btn-success",
641
+ "data-testid": "add-item-button",
642
+ title: "Add Item"
643
+ }, [...$[8] || ($[8] = [
644
+ t("i", {
645
+ class: "mdi mdi-plus top-action-icon",
646
+ "aria-hidden": "true"
647
+ }, null, -1),
648
+ t("span", { class: "top-action-label" }, "Add", -1)
649
+ ])]),
650
+ t("button", {
651
+ onClick: $[4] || ($[4] = (U) => v.$emit("clear-items")),
652
+ class: "btn btn-danger",
653
+ "data-testid": "clear-items-button",
654
+ title: "Clear All"
655
+ }, [...$[9] || ($[9] = [
656
+ t("i", {
657
+ class: "mdi mdi-delete-outline top-action-icon",
658
+ "aria-hidden": "true"
659
+ }, null, -1),
660
+ t("span", { class: "top-action-label" }, "Clear", -1)
661
+ ])])
662
+ ])
663
+ ])) : M("", !0)
664
+ ], 2),
665
+ t("div", fn, [
666
+ J(nn, {
667
+ "filter-value": ((te = e.dashboard) == null ? void 0 : te.filter) || "",
668
+ "filter-error": e.filterError,
669
+ "is-loading": f.value,
670
+ "global-completion": e.globalCompletion,
671
+ "validate-filter": e.validateFilter,
672
+ onFilterApply: q,
673
+ onClearFilter: $[5] || ($[5] = (U) => v.$emit("clear-filter", ""))
674
+ }, null, 8, ["filter-value", "filter-error", "is-loading", "global-completion", "validate-filter"]),
675
+ t("div", vn, [
676
+ J(mt, {
677
+ action: E,
678
+ "use-default-style": !1,
679
+ class: "btn btn-secondary filter-action-btn",
680
+ "data-testid": "download-button",
681
+ "test-id": "download-button",
682
+ title: "Download dashboard image",
683
+ "aria-label": "Download dashboard image"
684
+ }, {
685
+ default: z(() => [...$[10] || ($[10] = [
686
+ t("i", {
687
+ class: "mdi mdi-download-outline filter-action-icon",
688
+ "aria-hidden": "true"
689
+ }, null, -1),
690
+ t("span", { class: "filter-action-label" }, "Download", -1)
691
+ ])]),
692
+ _: 1
693
+ }),
694
+ t("button", {
695
+ onClick: b,
696
+ class: "btn btn-secondary filter-action-btn",
697
+ "data-testid": "share-dashboard-button",
698
+ title: "Export dashboard",
699
+ "aria-label": "Export dashboard"
700
+ }, [...$[11] || ($[11] = [
701
+ t("i", {
702
+ class: "mdi mdi-export-variant filter-action-icon",
703
+ "aria-hidden": "true"
704
+ }, null, -1),
705
+ t("span", { class: "filter-action-label" }, "Export", -1)
706
+ ])]),
707
+ t("button", {
708
+ onClick: W,
709
+ class: "btn btn-primary filter-action-btn",
710
+ "data-testid": "refresh-button",
711
+ title: "Refresh dashboard",
712
+ "aria-label": "Refresh dashboard"
713
+ }, [...$[12] || ($[12] = [
714
+ t("i", {
715
+ class: "mdi mdi-refresh filter-action-icon",
716
+ "aria-hidden": "true"
717
+ }, null, -1),
718
+ t("span", { class: "filter-action-label" }, "Refresh", -1)
719
+ ])]),
720
+ t("div", pn, [
721
+ t("div", yn, [
722
+ t("i", {
723
+ class: R(C.value + " select-icon")
724
+ }, null, 2),
725
+ t("select", {
726
+ id: "viewMode",
727
+ "data-testid": "mode-selector",
728
+ onChange: A,
729
+ value: e.dashboard.state,
730
+ disabled: e.editsLocked,
731
+ class: "mode-select"
732
+ }, [...$[13] || ($[13] = [
733
+ t("option", {
734
+ value: "editing",
735
+ "data-testid": "edit-mode-option"
736
+ }, "Edit", -1),
737
+ t("option", {
738
+ value: "published",
739
+ "data-testid": "view-mode-option"
740
+ }, "View", -1),
741
+ t("option", {
742
+ value: "fullscreen",
743
+ "data-testid": "fullscreen-mode-option"
744
+ }, "Fullscreen", -1)
745
+ ])], 40, gn)
746
+ ])
747
+ ])
748
+ ])
749
+ ]),
750
+ J(Lt, {
751
+ dashboard: e.dashboard,
752
+ "is-open": m.value,
753
+ onClose: D
754
+ }, null, 8, ["dashboard", "is-open"])
755
+ ]);
756
+ };
757
+ }
758
+ }), ki = /* @__PURE__ */ X(bn, [["__scopeId", "data-v-4c51e2bc"]]);
759
+ function Le(e) {
760
+ const o = I(null), n = I(!1), l = I(null), r = I(!1), i = I(null), s = I(!1), f = () => {
761
+ i.value && (clearTimeout(i.value), i.value = null);
762
+ }, m = () => {
763
+ if (!o.value) return 0;
764
+ const D = o.value.getBoundingClientRect(), q = window.scrollY || document.documentElement.scrollTop, E = D.top + q, A = Math.floor(E / 200) * 10;
765
+ return Math.min(A, 100);
766
+ };
767
+ Ke(() => {
768
+ setTimeout(() => {
769
+ const D = m();
770
+ if (!e.results.value) {
771
+ n.value = !0;
772
+ return;
773
+ }
774
+ setTimeout(() => {
775
+ n.value = !0;
776
+ }, D);
777
+ }, 0);
778
+ }), it(() => {
779
+ f();
780
+ }), ae(
781
+ e.loading,
782
+ (D) => {
783
+ if (f(), D) {
784
+ i.value = setTimeout(() => {
785
+ r.value = !0, i.value = null;
786
+ }, e.loadingDelayMs ?? 150);
787
+ return;
788
+ }
789
+ r.value = !1;
790
+ },
791
+ { immediate: !0 }
792
+ );
793
+ const a = async () => {
794
+ var A;
795
+ if (!e.query.value) return;
796
+ const D = e.dashboardId(), q = e.itemId(), E = e.getDashboardQueryExecutor(D);
797
+ if (!E)
798
+ throw new Error("Dashboard query executor not found!");
799
+ try {
800
+ (A = e.analyticsStore) == null || A.log(e.analyticsEvent, e.analyticsType, !0), l.value && E.cancelQuery(l.value), l.value = await E.runSingle(q), await E.waitForQuery(l.value);
801
+ } catch (T) {
802
+ console.error("Error setting up query:", T), l.value = null;
803
+ }
804
+ };
805
+ return {
806
+ chartContainer: o,
807
+ ready: n,
808
+ showLoading: r,
809
+ controlsVisible: s,
810
+ executeQuery: a,
811
+ handleLocalRefresh: () => {
812
+ const D = e.onRefresh.value;
813
+ if (D) {
814
+ D(e.itemId());
815
+ return;
816
+ }
817
+ a();
818
+ },
819
+ onChartMouseEnter: () => {
820
+ s.value = !0;
821
+ },
822
+ onChartMouseLeave: () => {
823
+ s.value = !1;
824
+ }
825
+ };
826
+ }
827
+ const Cn = Y({
828
+ name: "DashboardChart",
829
+ components: {
830
+ VegaLiteChart: ft,
831
+ ErrorMessage: $e,
832
+ LoadingView: Te,
833
+ DrilldownPane: ht
834
+ },
835
+ props: {
836
+ dashboardId: {
837
+ type: String,
838
+ required: !0
839
+ },
840
+ itemId: {
841
+ type: String,
842
+ required: !0
843
+ },
844
+ getItemData: {
845
+ type: Function,
846
+ required: !0,
847
+ default: () => ({ type: "CHART", content: "" })
848
+ },
849
+ setItemData: {
850
+ type: Function,
851
+ required: !0,
852
+ default: () => ({ type: "CHART", content: "" })
853
+ },
854
+ editMode: {
855
+ type: Boolean,
856
+ required: !0
857
+ },
858
+ symbols: {
859
+ type: Array,
860
+ required: !0
861
+ },
862
+ getDashboardQueryExecutor: {
863
+ type: Function,
864
+ required: !0
865
+ }
866
+ },
867
+ setup(e, { emit: o }) {
868
+ const n = I(null), l = g(() => e.getItemData(e.itemId, e.dashboardId)), r = g(() => l.value.structured_content.query), i = g(() => l.value.results || null), s = g(() => l.value.name || ""), f = g(() => (l.value.height || 300) - 75), m = g(() => l.value.width || 300), a = g(() => {
869
+ if (l.value.chartConfig)
870
+ return {
871
+ ...l.value.chartConfig,
872
+ showTitle: !1
873
+ };
874
+ }), p = g(() => l.value.loading || !1), k = g(() => l.value.error || null), b = g(() => l.value.loadStartTime || null), D = g(() => (l.value.chartFilters || []).map((j) => j.value)), q = g(() => l.value.hasDrilldown), E = g(() => l.value.onRefresh || null), A = _("connectionStore"), T = _(
875
+ "analyticsStore",
876
+ null
877
+ ), Q = (j) => {
878
+ const N = {
879
+ ...j,
880
+ showTitle: !1
881
+ };
882
+ if (q.value) {
883
+ e.setItemData(e.itemId, e.dashboardId, {
884
+ drilldownChartConfig: N
885
+ });
886
+ return;
887
+ }
888
+ e.setItemData(e.itemId, e.dashboardId, { chartConfig: N });
889
+ };
890
+ if (!A)
891
+ throw new Error("Connection store not found!");
892
+ const {
893
+ chartContainer: K,
894
+ ready: B,
895
+ showLoading: S,
896
+ controlsVisible: h,
897
+ executeQuery: W,
898
+ handleLocalRefresh: C,
899
+ onChartMouseEnter: v,
900
+ onChartMouseLeave: $
901
+ } = Le({
902
+ dashboardId: () => e.dashboardId,
903
+ itemId: () => e.itemId,
904
+ query: r,
905
+ results: i,
906
+ loading: p,
907
+ onRefresh: E,
908
+ getDashboardQueryExecutor: e.getDashboardQueryExecutor,
909
+ analyticsStore: T,
910
+ analyticsEvent: "dashboard-chart-execution",
911
+ analyticsType: "CHART",
912
+ loadingDelayMs: 250
913
+ });
914
+ return {
915
+ chartContainer: K,
916
+ results: i,
917
+ ready: B,
918
+ loading: p,
919
+ showLoading: S,
920
+ error: k,
921
+ query: r,
922
+ chartHeight: f,
923
+ chartWidth: m,
924
+ chartConfig: a,
925
+ chartTitle: s,
926
+ onChartConfigChange: Q,
927
+ onRefresh: E,
928
+ handleLocalRefresh: C,
929
+ chartSelection: D,
930
+ startTime: b,
931
+ handleDimensionClick: (j) => {
932
+ o("dimension-click", {
933
+ source: e.itemId,
934
+ filters: j.filters,
935
+ chart: j.chart,
936
+ append: j.append
937
+ });
938
+ },
939
+ handleBackgroundClick: () => {
940
+ o("background-click");
941
+ },
942
+ activeDrilldown: n,
943
+ activateDrilldown: (j) => {
944
+ let N = j.filters, F = Object.keys(N)[0], P = vt(j.filters);
945
+ F && (n.value = { remove: F, filter: P });
946
+ },
947
+ submitDrilldown: async (j) => {
948
+ let F = await e.getDashboardQueryExecutor(e.dashboardId).createDrilldownQuery(
949
+ r.value,
950
+ j,
951
+ n.value.remove,
952
+ n.value.filter
953
+ );
954
+ e.setItemData(e.itemId, e.dashboardId, {
955
+ drilldown: F,
956
+ drilldownChartConfig: null,
957
+ loading: !0
958
+ }), B.value = !1, S.value = !0, n.value = null, await W().then(() => {
959
+ B.value = !0;
960
+ }).catch((P) => {
961
+ console.error("Error executing drilldown query:", P), B.value = !0;
962
+ }).finally(() => {
963
+ S.value = !1;
964
+ });
965
+ },
966
+ controlsVisible: h,
967
+ onChartMouseEnter: v,
968
+ onChartMouseLeave: $,
969
+ revertDrilldown: async () => {
970
+ e.setItemData(e.itemId, e.dashboardId, {
971
+ drilldown: null,
972
+ drilldownChartConfig: null,
973
+ loading: !0
974
+ }), await W();
975
+ },
976
+ hasDrilldown: q
977
+ };
978
+ }
979
+ }), wn = {
980
+ key: 3,
981
+ class: "loading-overlay"
982
+ };
983
+ function kn(e, o, n, l, r, i) {
984
+ const s = Z("drilldown-pane"), f = Z("ErrorMessage"), m = Z("VegaLiteChart"), a = Z("LoadingView");
985
+ return c(), y("div", {
986
+ ref: "chartContainer",
987
+ class: R(["chart-placeholder no-drag", { "chart-placeholder-edit-mode": e.editMode }]),
988
+ onMouseenter: o[3] || (o[3] = (...p) => e.onChartMouseEnter && e.onChartMouseEnter(...p)),
989
+ onMouseleave: o[4] || (o[4] = (...p) => e.onChartMouseLeave && e.onChartMouseLeave(...p))
990
+ }, [
991
+ e.activeDrilldown ? (c(), G(s, {
992
+ key: 0,
993
+ "drilldown-remove": e.activeDrilldown.remove,
994
+ "drilldown-filter": e.activeDrilldown.filter,
995
+ onClose: o[0] || (o[0] = (p) => e.activeDrilldown = null),
996
+ symbols: e.symbols,
997
+ onSubmit: e.submitDrilldown
998
+ }, null, 8, ["drilldown-remove", "drilldown-filter", "symbols", "onSubmit"])) : e.error && !e.loading ? (c(), G(f, {
999
+ key: 1,
1000
+ class: "chart-placeholder"
1001
+ }, {
1002
+ default: z(() => [
1003
+ ne(O(e.error), 1)
1004
+ ]),
1005
+ _: 1
1006
+ })) : e.results && e.ready && !e.loading ? (c(), G(m, {
1007
+ key: 2,
1008
+ id: `${e.itemId}-${e.dashboardId}`,
1009
+ columns: e.results.headers,
1010
+ data: e.results.data,
1011
+ showControls: e.editMode,
1012
+ initialConfig: e.chartConfig,
1013
+ containerHeight: e.chartHeight,
1014
+ "container-width": e.chartWidth,
1015
+ onChartConfigChange: e.onChartConfigChange,
1016
+ chartSelection: e.chartSelection,
1017
+ chartTitle: e.chartTitle,
1018
+ "drilldown-active": e.hasDrilldown,
1019
+ onDimensionClick: e.handleDimensionClick,
1020
+ onBackgroundClick: e.handleBackgroundClick,
1021
+ onRefreshClick: e.handleLocalRefresh,
1022
+ onDrilldownClick: e.activateDrilldown,
1023
+ onRevertDrilldown: e.revertDrilldown
1024
+ }, null, 8, ["id", "columns", "data", "showControls", "initialConfig", "containerHeight", "container-width", "onChartConfigChange", "chartSelection", "chartTitle", "drilldown-active", "onDimensionClick", "onBackgroundClick", "onRefreshClick", "onDrilldownClick", "onRevertDrilldown"])) : M("", !0),
1025
+ e.loading && e.showLoading ? (c(), y("div", wn, [
1026
+ J(a, {
1027
+ startTime: e.startTime,
1028
+ text: "Loading"
1029
+ }, null, 8, ["startTime"])
1030
+ ])) : M("", !0),
1031
+ !e.editMode || !(e.results && e.ready) ? (c(), y("div", {
1032
+ key: 4,
1033
+ class: R(["controls-toggle", { "controls-visible": e.controlsVisible }])
1034
+ }, [
1035
+ t("button", {
1036
+ onClick: o[1] || (o[1] = (...p) => e.handleLocalRefresh && e.handleLocalRefresh(...p)),
1037
+ class: "control-btn",
1038
+ "data-testid": "refresh-chart-btn",
1039
+ title: "Refresh table"
1040
+ }, [...o[5] || (o[5] = [
1041
+ t("i", { class: "mdi mdi-refresh icon" }, null, -1)
1042
+ ])]),
1043
+ t("button", {
1044
+ onClick: o[2] || (o[2] = (...p) => e.revertDrilldown && e.revertDrilldown(...p)),
1045
+ class: "control-btn",
1046
+ "data-testid": "refresh-chart-btn",
1047
+ title: "Clear Drilldown"
1048
+ }, [...o[6] || (o[6] = [
1049
+ t("i", { class: "mdi mdi-undo icon" }, null, -1)
1050
+ ])])
1051
+ ], 2)) : M("", !0)
1052
+ ], 34);
1053
+ }
1054
+ const Sn = /* @__PURE__ */ X(Cn, [["render", kn], ["__scopeId", "data-v-e4a4798c"]]), En = Y({
1055
+ name: "DynamicMarkdownChart",
1056
+ components: {
1057
+ ErrorMessage: $e,
1058
+ MarkdownRenderer: pt
1059
+ },
1060
+ props: {
1061
+ dashboardId: {
1062
+ type: String,
1063
+ required: !0
1064
+ },
1065
+ itemId: {
1066
+ type: String,
1067
+ required: !0
1068
+ },
1069
+ getItemData: {
1070
+ type: Function,
1071
+ required: !0,
1072
+ default: () => ({ type: "MARKDOWN", content: { markdown: "", query: "" } })
1073
+ },
1074
+ setItemData: {
1075
+ type: Function,
1076
+ required: !0,
1077
+ default: () => ({ type: "MARKDOWN", content: { markdown: "", query: "" } })
1078
+ },
1079
+ editMode: {
1080
+ type: Boolean,
1081
+ required: !0
1082
+ },
1083
+ getDashboardQueryExecutor: {
1084
+ type: Function,
1085
+ required: !0
1086
+ }
1087
+ },
1088
+ setup(e) {
1089
+ const o = g(() => e.getItemData(e.itemId, e.dashboardId)), n = g(() => o.value.structured_content || { markdown: "", query: "" }), l = g(() => n.value.markdown || ""), r = g(() => n.value.query || ""), i = g(() => o.value.results || null), s = g(() => o.value.loading || !1), f = g(() => o.value.error || null), m = g(() => o.value.loadStartTime || null), a = g(() => o.value.onRefresh || null), p = _("connectionStore"), k = _("analyticsStore");
1090
+ if (!p)
1091
+ throw new Error("Connection store not found!");
1092
+ const {
1093
+ chartContainer: b,
1094
+ ready: D,
1095
+ controlsVisible: q,
1096
+ handleLocalRefresh: E,
1097
+ onChartMouseEnter: A,
1098
+ onChartMouseLeave: T
1099
+ } = Le({
1100
+ dashboardId: () => e.dashboardId,
1101
+ itemId: () => e.itemId,
1102
+ query: r,
1103
+ results: i,
1104
+ loading: s,
1105
+ onRefresh: a,
1106
+ getDashboardQueryExecutor: e.getDashboardQueryExecutor,
1107
+ analyticsStore: k,
1108
+ analyticsEvent: "dashboard-markdown-execution",
1109
+ analyticsType: "MARKDOWN"
1110
+ });
1111
+ return {
1112
+ chartContainer: b,
1113
+ results: i,
1114
+ ready: D,
1115
+ loading: s,
1116
+ error: f,
1117
+ query: r,
1118
+ markdown: l,
1119
+ handleLocalRefresh: E,
1120
+ startTime: m,
1121
+ controlsVisible: q,
1122
+ onChartMouseEnter: A,
1123
+ onChartMouseLeave: T
1124
+ };
1125
+ }
1126
+ });
1127
+ function Dn(e, o, n, l, r, i) {
1128
+ const s = Z("ErrorMessage"), f = Z("MarkdownRenderer");
1129
+ return c(), y("div", {
1130
+ ref: "chartContainer",
1131
+ class: R(["chart-placeholder no-drag", { "chart-placeholder-edit-mode": e.editMode }]),
1132
+ onMouseenter: o[1] || (o[1] = (...m) => e.onChartMouseEnter && e.onChartMouseEnter(...m)),
1133
+ onMouseleave: o[2] || (o[2] = (...m) => e.onChartMouseLeave && e.onChartMouseLeave(...m))
1134
+ }, [
1135
+ e.error && !e.loading ? (c(), G(s, {
1136
+ key: 0,
1137
+ class: "chart-placeholder"
1138
+ }, {
1139
+ default: z(() => [
1140
+ ne(O(e.error), 1)
1141
+ ]),
1142
+ _: 1
1143
+ })) : e.ready ? (c(), G(f, {
1144
+ key: 1,
1145
+ markdown: e.markdown,
1146
+ results: e.results,
1147
+ loading: e.loading
1148
+ }, null, 8, ["markdown", "results", "loading"])) : M("", !0),
1149
+ !e.loading && e.editMode ? (c(), y("div", {
1150
+ key: 2,
1151
+ class: R(["controls-toggle", { "controls-visible": e.controlsVisible }])
1152
+ }, [
1153
+ t("button", {
1154
+ onClick: o[0] || (o[0] = (...m) => e.handleLocalRefresh && e.handleLocalRefresh(...m)),
1155
+ class: "control-btn",
1156
+ "data-testid": "refresh-chart-btn",
1157
+ title: "Refresh text"
1158
+ }, [...o[3] || (o[3] = [
1159
+ t("i", { class: "mdi mdi-refresh icon" }, null, -1)
1160
+ ])])
1161
+ ], 2)) : M("", !0)
1162
+ ], 34);
1163
+ }
1164
+ const In = /* @__PURE__ */ X(En, [["render", Dn], ["__scopeId", "data-v-ae377c15"]]), Tn = Y({
1165
+ name: "DashboardTable",
1166
+ components: {
1167
+ DataTable: yt,
1168
+ ErrorMessage: $e,
1169
+ LoadingView: Te
1170
+ },
1171
+ props: {
1172
+ dashboardId: {
1173
+ type: String,
1174
+ required: !0
1175
+ },
1176
+ itemId: {
1177
+ type: String,
1178
+ required: !0
1179
+ },
1180
+ getItemData: {
1181
+ type: Function,
1182
+ required: !0,
1183
+ default: () => ({ type: "CHART", content: "" })
1184
+ },
1185
+ setItemData: {
1186
+ type: Function,
1187
+ required: !0,
1188
+ default: () => ({ type: "CHART", content: "" })
1189
+ },
1190
+ editMode: {
1191
+ type: Boolean,
1192
+ required: !0
1193
+ },
1194
+ getDashboardQueryExecutor: {
1195
+ type: Function,
1196
+ required: !0
1197
+ }
1198
+ },
1199
+ setup(e, { emit: o }) {
1200
+ const n = g(() => e.getItemData(e.itemId, e.dashboardId)), l = g(() => n.value.content), r = g(() => n.value.results || null), i = g(() => n.value.loading || !1), s = g(() => n.value.error || null), f = g(() => n.value.loadStartTime || null), m = g(() => (n.value.height || 300) - 75), a = g(() => (n.value.width || 300) - 100), p = g(() => n.value.onRefresh || null), k = _("connectionStore"), b = _("analyticsStore");
1201
+ if (!k)
1202
+ throw new Error("Connection store not found!");
1203
+ const {
1204
+ chartContainer: D,
1205
+ ready: q,
1206
+ showLoading: E,
1207
+ controlsVisible: A,
1208
+ handleLocalRefresh: T,
1209
+ onChartMouseEnter: Q,
1210
+ onChartMouseLeave: K
1211
+ } = Le({
1212
+ dashboardId: () => e.dashboardId,
1213
+ itemId: () => e.itemId,
1214
+ query: l,
1215
+ results: r,
1216
+ loading: i,
1217
+ onRefresh: p,
1218
+ getDashboardQueryExecutor: e.getDashboardQueryExecutor,
1219
+ analyticsStore: b,
1220
+ analyticsEvent: "dashboard-table-execution",
1221
+ analyticsType: "TABLE"
1222
+ });
1223
+ return {
1224
+ chartContainer: D,
1225
+ results: r,
1226
+ ready: q,
1227
+ loading: i,
1228
+ showLoading: E,
1229
+ error: s,
1230
+ query: l,
1231
+ chartHeight: m,
1232
+ chartWidth: a,
1233
+ onRefresh: p,
1234
+ handleLocalRefresh: T,
1235
+ startTime: f,
1236
+ handleDimensionClick: (h) => {
1237
+ o("dimension-click", {
1238
+ source: e.itemId,
1239
+ filters: h.filters,
1240
+ chart: h.chart,
1241
+ append: h.append
1242
+ });
1243
+ },
1244
+ handleBackgroundClick: () => {
1245
+ o("background-click");
1246
+ },
1247
+ controlsVisible: A,
1248
+ onChartMouseEnter: Q,
1249
+ onChartMouseLeave: K
1250
+ };
1251
+ }
1252
+ }), $n = {
1253
+ key: 2,
1254
+ class: "loading-overlay"
1255
+ };
1256
+ function Ln(e, o, n, l, r, i) {
1257
+ const s = Z("ErrorMessage"), f = Z("data-table"), m = Z("LoadingView");
1258
+ return c(), y("div", {
1259
+ ref: "chartContainer",
1260
+ class: R(["chart-placeholder no-drag", { "chart-placeholder-edit-mode": e.editMode }]),
1261
+ onMouseenter: o[1] || (o[1] = (...a) => e.onChartMouseEnter && e.onChartMouseEnter(...a)),
1262
+ onMouseleave: o[2] || (o[2] = (...a) => e.onChartMouseLeave && e.onChartMouseLeave(...a))
1263
+ }, [
1264
+ e.error && !e.loading ? (c(), G(s, {
1265
+ key: 0,
1266
+ class: "chart-placeholder"
1267
+ }, {
1268
+ default: z(() => [
1269
+ ne(O(e.error), 1)
1270
+ ]),
1271
+ _: 1
1272
+ })) : e.ready && e.results ? (c(), G(f, {
1273
+ key: 1,
1274
+ id: `${e.itemId}-${e.dashboardId}`,
1275
+ headers: e.results.headers,
1276
+ results: e.results.data,
1277
+ containerHeight: e.chartHeight,
1278
+ prettyPrint: !0,
1279
+ fitParent: !0,
1280
+ flushChrome: !0,
1281
+ onCellClick: e.handleDimensionClick,
1282
+ onBackgroundClick: e.handleBackgroundClick
1283
+ }, null, 8, ["id", "headers", "results", "containerHeight", "onCellClick", "onBackgroundClick"])) : M("", !0),
1284
+ e.loading && e.showLoading ? (c(), y("div", $n, [
1285
+ J(m, {
1286
+ startTime: e.startTime,
1287
+ text: "Loading"
1288
+ }, null, 8, ["startTime"])
1289
+ ])) : M("", !0),
1290
+ !e.loading && e.editMode ? (c(), y("div", {
1291
+ key: 3,
1292
+ class: R(["controls-toggle", { "controls-visible": e.controlsVisible }])
1293
+ }, [
1294
+ t("button", {
1295
+ onClick: o[0] || (o[0] = (...a) => e.handleLocalRefresh && e.handleLocalRefresh(...a)),
1296
+ class: "control-btn",
1297
+ "data-testid": "refresh-chart-btn",
1298
+ title: "Refresh table"
1299
+ }, [...o[3] || (o[3] = [
1300
+ t("i", { class: "mdi mdi-refresh icon" }, null, -1)
1301
+ ])])
1302
+ ], 2)) : M("", !0)
1303
+ ], 34);
1304
+ }
1305
+ const Mn = /* @__PURE__ */ X(Tn, [["render", Ln], ["__scopeId", "data-v-aed07269"]]), An = {
1306
+ data() {
1307
+ return {
1308
+ selectedValue: "",
1309
+ selectedLabel: "",
1310
+ searchText: "",
1311
+ showDropdown: !1,
1312
+ inputElement: null
1313
+ };
1314
+ },
1315
+ props: {
1316
+ headers: {
1317
+ type: Map,
1318
+ required: !0
1319
+ },
1320
+ results: {
1321
+ type: Array,
1322
+ required: !0
1323
+ },
1324
+ containerHeight: Number,
1325
+ cellClick: {
1326
+ type: Function,
1327
+ default: () => {
1328
+ }
1329
+ },
1330
+ backgroundClick: {
1331
+ type: Function,
1332
+ default: () => {
1333
+ }
1334
+ },
1335
+ prettyPrint: {
1336
+ type: Boolean,
1337
+ default: !1
1338
+ },
1339
+ fitParent: {
1340
+ type: Boolean,
1341
+ default: !1
1342
+ }
1343
+ },
1344
+ setup() {
1345
+ const e = _("userSettingsStore");
1346
+ if (!e)
1347
+ throw new Error("userSettingsStore not provided");
1348
+ const o = g(() => e.settings.theme);
1349
+ return {
1350
+ settingsStore: e,
1351
+ currentTheme: o
1352
+ };
1353
+ },
1354
+ computed: {
1355
+ headersArray() {
1356
+ return Array.from(this.headers.values());
1357
+ },
1358
+ firstColumn() {
1359
+ return this.headersArray[0] || null;
1360
+ },
1361
+ secondColumn() {
1362
+ return this.headersArray[1] || null;
1363
+ },
1364
+ displayColumn() {
1365
+ return this.firstColumn;
1366
+ },
1367
+ valueColumn() {
1368
+ return this.secondColumn || this.firstColumn;
1369
+ },
1370
+ selectOptions() {
1371
+ if (!this.displayColumn || !this.valueColumn || !this.results || this.results.length === 0)
1372
+ return [];
1373
+ const e = this.displayColumn.name, o = this.valueColumn.name, n = [];
1374
+ return this.results.forEach((l) => {
1375
+ const r = l[e], i = l[o];
1376
+ if (r != null && i !== null && i !== void 0) {
1377
+ const s = this.formatValue(r, this.displayColumn);
1378
+ n.push({
1379
+ label: s,
1380
+ value: i
1381
+ });
1382
+ }
1383
+ }), n;
1384
+ },
1385
+ filteredOptions() {
1386
+ if (!this.searchText)
1387
+ return this.selectOptions;
1388
+ const e = this.searchText.toLowerCase();
1389
+ return this.selectOptions.filter((o) => o.label.toLowerCase().includes(e));
1390
+ },
1391
+ placeholderText() {
1392
+ return this.hasSelection ? this.selectedLabel || "Type to search..." : !this.selectOptions || this.selectOptions.length === 0 ? "No data available" : "All";
1393
+ },
1394
+ hasSelection() {
1395
+ return !!(this.selectedLabel && this.selectedValue);
1396
+ },
1397
+ fieldLabel() {
1398
+ var e;
1399
+ return ((e = this.firstColumn) == null ? void 0 : e.name) || "Field";
1400
+ },
1401
+ dropdownStyle() {
1402
+ if (!this.inputElement)
1403
+ return {};
1404
+ const e = this.inputElement.getBoundingClientRect();
1405
+ return {
1406
+ position: "fixed",
1407
+ top: `${e.bottom}px`,
1408
+ left: `${e.left}px`,
1409
+ width: `${e.width}px`
1410
+ };
1411
+ }
1412
+ },
1413
+ mounted() {
1414
+ this.selectedLabel && !this.searchText && (this.searchText = this.selectedLabel);
1415
+ },
1416
+ watch: {
1417
+ // Watch for external changes to selectedLabel and update searchText accordingly
1418
+ selectedLabel(e) {
1419
+ e && !this.showDropdown && (this.searchText = e);
1420
+ }
1421
+ },
1422
+ methods: {
1423
+ formatValue(e, o) {
1424
+ var n, l;
1425
+ switch (o.type) {
1426
+ case ue.FLOAT:
1427
+ return (n = o.traits) != null && n.includes("usd") ? `$${Number(e).toFixed(o.scale || 2)}` : (l = o.traits) != null && l.includes("percent") ? `${(Number(e) * 100).toFixed(2)}%` : Number(e).toFixed(o.scale || 2);
1428
+ case ue.DATETIME:
1429
+ case ue.TIMESTAMP:
1430
+ case ue.DATE:
1431
+ case ue.TIME:
1432
+ return e instanceof Date ? e.toLocaleString() : String(e);
1433
+ case ue.BOOLEAN:
1434
+ return e ? "✓" : "✗";
1435
+ case ue.ARRAY:
1436
+ case ue.STRUCT:
1437
+ return JSON.stringify(e);
1438
+ default:
1439
+ return String(e);
1440
+ }
1441
+ },
1442
+ highlightMatch(e) {
1443
+ if (!this.searchText)
1444
+ return e;
1445
+ const o = this.searchText.toLowerCase(), l = e.toLowerCase().indexOf(o);
1446
+ if (l === -1)
1447
+ return e;
1448
+ const r = e.slice(0, l), i = e.slice(l, l + this.searchText.length), s = e.slice(l + this.searchText.length);
1449
+ return `${r}<mark>${i}</mark>${s}`;
1450
+ },
1451
+ selectOption(e) {
1452
+ this.selectedValue = e.value, this.selectedLabel = e.label, this.searchText = e.label, this.showDropdown = !1, this.handleSelection();
1453
+ },
1454
+ selectAll() {
1455
+ this.selectedValue = "", this.selectedLabel = "", this.searchText = "", this.showDropdown = !1, this.$emit("background-click"), this.backgroundClick();
1456
+ },
1457
+ onSearchInput() {
1458
+ this.searchText !== this.selectedLabel && this.selectedLabel && (this.selectedValue = "", this.selectedLabel = ""), this.showDropdown = !0, this.updateInputElement();
1459
+ },
1460
+ handleFocus() {
1461
+ this.searchText = "", this.showDropdown = !0, this.updateInputElement();
1462
+ },
1463
+ updateInputElement() {
1464
+ this.inputElement = this.$refs.searchInput;
1465
+ },
1466
+ handleBlur() {
1467
+ setTimeout(() => {
1468
+ this.showDropdown = !1, this.selectedLabel && !this.searchText && (this.searchText = this.selectedLabel);
1469
+ }, 200);
1470
+ },
1471
+ handleSelection() {
1472
+ if (!this.valueColumn || !this.selectedValue)
1473
+ return;
1474
+ const e = this.valueColumn.address || this.valueColumn.name;
1475
+ this.$emit("cell-click", {
1476
+ filters: { [e]: this.selectedValue },
1477
+ append: !1
1478
+ });
1479
+ }
1480
+ }
1481
+ }, Rn = { class: "result-select row pa-0 ba-0" }, Fn = { class: "select-container" }, qn = { class: "search-input-wrapper" }, xn = {
1482
+ key: 0,
1483
+ class: "inline-label"
1484
+ }, Hn = ["placeholder", "disabled"], On = ["onMousedown", "innerHTML"];
1485
+ function Vn(e, o, n, l, r, i) {
1486
+ return c(), y("div", Rn, [
1487
+ t("div", Fn, [
1488
+ t("div", qn, [
1489
+ i.hasSelection ? (c(), y("span", xn, O(i.fieldLabel) + ": ", 1)) : M("", !0),
1490
+ se(t("input", {
1491
+ ref: "searchInput",
1492
+ "onUpdate:modelValue": o[0] || (o[0] = (s) => r.searchText = s),
1493
+ type: "text",
1494
+ class: R(["search-input", { "has-inline-label": i.hasSelection }]),
1495
+ placeholder: i.placeholderText,
1496
+ disabled: !i.selectOptions || i.selectOptions.length === 0,
1497
+ onFocus: o[1] || (o[1] = (...s) => i.handleFocus && i.handleFocus(...s)),
1498
+ onInput: o[2] || (o[2] = (...s) => i.onSearchInput && i.onSearchInput(...s)),
1499
+ onBlur: o[3] || (o[3] = (...s) => i.handleBlur && i.handleBlur(...s))
1500
+ }, null, 42, Hn), [
1501
+ [ve, r.searchText]
1502
+ ]),
1503
+ o[5] || (o[5] = t("span", { class: "search-icon" }, [
1504
+ t("svg", {
1505
+ xmlns: "http://www.w3.org/2000/svg",
1506
+ viewBox: "0 0 24 24",
1507
+ fill: "none",
1508
+ stroke: "currentColor",
1509
+ "stroke-width": "2",
1510
+ "stroke-linecap": "round",
1511
+ "stroke-linejoin": "round"
1512
+ }, [
1513
+ t("circle", {
1514
+ cx: "11",
1515
+ cy: "11",
1516
+ r: "8"
1517
+ }),
1518
+ t("path", { d: "m21 21-4.35-4.35" })
1519
+ ])
1520
+ ], -1))
1521
+ ]),
1522
+ (c(), G(rt, { to: "body" }, [
1523
+ r.showDropdown && i.filteredOptions.length > 0 ? (c(), y("div", {
1524
+ key: 0,
1525
+ class: "dropdown-list",
1526
+ style: De(i.dropdownStyle)
1527
+ }, [
1528
+ t("div", {
1529
+ class: R(["dropdown-item select-all", { selected: !r.selectedValue }]),
1530
+ onMousedown: o[4] || (o[4] = Oe((...s) => i.selectAll && i.selectAll(...s), ["prevent"]))
1531
+ }, " All ", 34),
1532
+ (c(!0), y(ce, null, be(i.filteredOptions, (s, f) => (c(), y("div", {
1533
+ key: f,
1534
+ class: R(["dropdown-item", { selected: r.selectedValue === s.value }]),
1535
+ onMousedown: Oe((m) => i.selectOption(s), ["prevent"]),
1536
+ innerHTML: i.highlightMatch(s.label)
1537
+ }, null, 42, On))), 128))
1538
+ ], 4)) : M("", !0),
1539
+ r.showDropdown && r.searchText && i.filteredOptions.length === 0 ? (c(), y("div", {
1540
+ key: 1,
1541
+ class: "dropdown-list",
1542
+ style: De(i.dropdownStyle)
1543
+ }, [...o[6] || (o[6] = [
1544
+ t("div", { class: "dropdown-item no-results" }, "No matches found", -1)
1545
+ ])], 4)) : M("", !0)
1546
+ ]))
1547
+ ])
1548
+ ]);
1549
+ }
1550
+ const Qn = /* @__PURE__ */ X(An, [["render", Vn], ["__scopeId", "data-v-71523d2a"]]), Bn = Y({
1551
+ name: "DashboardFilter",
1552
+ components: {
1553
+ DashboardDataSelector: Qn,
1554
+ ErrorMessage: $e,
1555
+ LoadingView: Te
1556
+ },
1557
+ props: {
1558
+ dashboardId: {
1559
+ type: String,
1560
+ required: !0
1561
+ },
1562
+ itemId: {
1563
+ type: String,
1564
+ required: !0
1565
+ },
1566
+ getItemData: {
1567
+ type: Function,
1568
+ required: !0,
1569
+ default: () => ({ type: "CHART", content: "" })
1570
+ },
1571
+ setItemData: {
1572
+ type: Function,
1573
+ required: !0,
1574
+ default: () => ({ type: "CHART", content: "" })
1575
+ },
1576
+ editMode: {
1577
+ type: Boolean,
1578
+ required: !0
1579
+ },
1580
+ getDashboardQueryExecutor: {
1581
+ type: Function,
1582
+ required: !0
1583
+ }
1584
+ },
1585
+ setup(e, { emit: o }) {
1586
+ const n = g(() => e.getItemData(e.itemId, e.dashboardId)), l = g(() => n.value.content), r = g(() => n.value.results || null), i = g(() => n.value.loading || !1), s = g(() => n.value.error || null), f = g(() => n.value.loadStartTime || null), m = g(() => (n.value.height || 300) - 75), a = g(() => (n.value.width || 300) - 100), p = g(() => n.value.onRefresh || null), k = _("connectionStore"), b = _("analyticsStore");
1587
+ if (!k)
1588
+ throw new Error("Connection store not found!");
1589
+ const {
1590
+ chartContainer: D,
1591
+ ready: q,
1592
+ showLoading: E,
1593
+ controlsVisible: A,
1594
+ handleLocalRefresh: T,
1595
+ onChartMouseEnter: Q,
1596
+ onChartMouseLeave: K
1597
+ } = Le({
1598
+ dashboardId: () => e.dashboardId,
1599
+ itemId: () => e.itemId,
1600
+ query: l,
1601
+ results: r,
1602
+ loading: i,
1603
+ onRefresh: p,
1604
+ getDashboardQueryExecutor: e.getDashboardQueryExecutor,
1605
+ analyticsStore: b,
1606
+ analyticsEvent: "dashboard-filter-execution",
1607
+ analyticsType: "FILTER"
1608
+ });
1609
+ return {
1610
+ chartContainer: D,
1611
+ results: r,
1612
+ ready: q,
1613
+ loading: i,
1614
+ showLoading: E,
1615
+ error: s,
1616
+ query: l,
1617
+ chartHeight: m,
1618
+ chartWidth: a,
1619
+ onRefresh: p,
1620
+ handleLocalRefresh: T,
1621
+ startTime: f,
1622
+ handleDimensionClick: (h) => {
1623
+ o("dimension-click", {
1624
+ source: e.itemId,
1625
+ filters: h.filters,
1626
+ chart: h.chart,
1627
+ append: h.append
1628
+ });
1629
+ },
1630
+ handleBackgroundClick: () => {
1631
+ o("background-click");
1632
+ },
1633
+ controlsVisible: A,
1634
+ onChartMouseEnter: Q,
1635
+ onChartMouseLeave: K
1636
+ };
1637
+ }
1638
+ }), Nn = {
1639
+ key: 2,
1640
+ class: "loading-overlay"
1641
+ };
1642
+ function Pn(e, o, n, l, r, i) {
1643
+ const s = Z("ErrorMessage"), f = Z("dashboard-data-selector"), m = Z("LoadingView");
1644
+ return c(), y("div", {
1645
+ ref: "chartContainer",
1646
+ class: R(["chart-placeholder no-drag", { "chart-placeholder-edit-mode": e.editMode }]),
1647
+ onMouseenter: o[0] || (o[0] = (...a) => e.onChartMouseEnter && e.onChartMouseEnter(...a)),
1648
+ onMouseleave: o[1] || (o[1] = (...a) => e.onChartMouseLeave && e.onChartMouseLeave(...a))
1649
+ }, [
1650
+ e.error && !e.loading ? (c(), G(s, {
1651
+ key: 0,
1652
+ class: "chart-placeholder"
1653
+ }, {
1654
+ default: z(() => [
1655
+ ne(O(e.error), 1)
1656
+ ]),
1657
+ _: 1
1658
+ })) : e.ready && e.results ? (c(), G(f, {
1659
+ key: 1,
1660
+ id: `${e.itemId}-${e.dashboardId}`,
1661
+ headers: e.results.headers,
1662
+ results: e.results.data,
1663
+ containerHeight: e.chartHeight,
1664
+ prettyPrint: !0,
1665
+ fitParent: !0,
1666
+ onCellClick: e.handleDimensionClick,
1667
+ onBackgroundClick: e.handleBackgroundClick
1668
+ }, null, 8, ["id", "headers", "results", "containerHeight", "onCellClick", "onBackgroundClick"])) : M("", !0),
1669
+ e.loading && e.showLoading ? (c(), y("div", Nn, [
1670
+ J(m, {
1671
+ startTime: e.startTime,
1672
+ text: "Loading"
1673
+ }, null, 8, ["startTime"])
1674
+ ])) : M("", !0)
1675
+ ], 34);
1676
+ }
1677
+ const Kn = /* @__PURE__ */ X(Bn, [["render", Pn], ["__scopeId", "data-v-6108741e"]]), Wn = ["data-testid"], _n = {
1678
+ class: "dev-toolbar",
1679
+ "data-testid": "dashboard-item-header-controls"
1680
+ }, Un = ["data-testid"], jn = ["data-testid"], Gn = ["data-testid", "title"], zn = ["data-testid", "title"], Jn = {
1681
+ key: 0,
1682
+ class: "mdi mdi-filter-remove-outline icon"
1683
+ }, Yn = {
1684
+ key: 1,
1685
+ class: "mdi mdi-filter-outline icon"
1686
+ }, Xn = ["data-testid"], Zn = ["data-testid"], eo = {
1687
+ key: 1,
1688
+ class: "grid-item-header"
1689
+ }, to = { class: "grid-item-header-left" }, no = {
1690
+ key: 0,
1691
+ class: "drag-handle-icon grid-item-drag-handle"
1692
+ }, oo = { class: "item-title-container no-drag" }, io = ["title"], ro = { class: "item-title-text" }, lo = {
1693
+ key: 0,
1694
+ class: "mdi mdi-pencil-outline edit-indicator"
1695
+ }, ao = ["id", "placeholder"], so = { class: "grid-item-header-right" }, uo = {
1696
+ key: 0,
1697
+ class: "header-filters no-drag"
1698
+ }, co = ["title"], mo = { class: "filter-content" }, ho = { class: "filter-source" }, fo = { class: "filter-value" }, vo = ["onClick", "title"], po = ["title"], yo = ["title"], go = { class: "section-header-text" }, bo = ["id", "placeholder"], Co = /* @__PURE__ */ Y({
1699
+ __name: "DashboardGridItem",
1700
+ props: {
1701
+ dashboardId: {},
1702
+ item: {},
1703
+ editMode: { type: Boolean },
1704
+ symbols: {},
1705
+ getItemData: { type: Function },
1706
+ getDashboardQueryExecutor: { type: Function },
1707
+ setItemData: { type: Function }
1708
+ },
1709
+ emits: ["edit-content", "update-dimensions", "dimension-click", "background-click", "remove-filter", "remove-item", "copy-item"],
1710
+ setup(e, { emit: o }) {
1711
+ const n = e, l = o, r = I(!1), i = I(""), s = I(!1);
1712
+ function f(N) {
1713
+ return N.replace(/'''/g, "'").replace("local.", "");
1714
+ }
1715
+ function m(N, F = 1e3) {
1716
+ const P = f(N);
1717
+ return P.length <= F ? P : P.substring(0, F) + "...";
1718
+ }
1719
+ function a() {
1720
+ if (!n.editMode) return;
1721
+ const N = n.getItemData(n.item.i, n.dashboardId);
1722
+ s.value = !1, r.value = !0, i.value = N.name, setTimeout(() => {
1723
+ const F = document.getElementById(`title-input-${n.item.i}`);
1724
+ F && F.focus();
1725
+ }, 0);
1726
+ }
1727
+ function p() {
1728
+ if (r.value) {
1729
+ const N = n.getItemData(n.item.i, n.dashboardId), F = i.value.trim() || N.name;
1730
+ n.setItemData(n.item.i, n.dashboardId, { name: F }), r.value = !1;
1731
+ }
1732
+ }
1733
+ function k() {
1734
+ const F = !n.getItemData(n.item.i, n.dashboardId).allowCrossFilter;
1735
+ n.setItemData(n.item.i, n.dashboardId, {
1736
+ allowCrossFilter: F
1737
+ });
1738
+ }
1739
+ function b() {
1740
+ const N = n.item.h + 1;
1741
+ n.setItemData(n.item.i, n.dashboardId, {
1742
+ dimensions: {
1743
+ width: n.item.w,
1744
+ height: N
1745
+ }
1746
+ });
1747
+ }
1748
+ function D() {
1749
+ const N = Math.max(1, n.item.h - 1);
1750
+ n.setItemData(n.item.i, n.dashboardId, {
1751
+ dimensions: {
1752
+ width: n.item.w,
1753
+ height: N
1754
+ }
1755
+ });
1756
+ }
1757
+ function q() {
1758
+ r.value = !1;
1759
+ }
1760
+ function E() {
1761
+ if (h.value) {
1762
+ a();
1763
+ return;
1764
+ }
1765
+ l("edit-content", n.item);
1766
+ }
1767
+ function A() {
1768
+ confirm(`Are you sure you want to remove "${S.value.name}"?`) && l("remove-item", n.item.i);
1769
+ }
1770
+ function T() {
1771
+ l("copy-item", n.item.i);
1772
+ }
1773
+ function Q(N) {
1774
+ l("dimension-click", N);
1775
+ }
1776
+ function K() {
1777
+ l("background-click", n.item.i);
1778
+ }
1779
+ function B(N) {
1780
+ l("remove-filter", n.item.i, N);
1781
+ }
1782
+ const S = g(() => n.getItemData(n.item.i, n.dashboardId)), h = g(() => S.value.type === w.SECTION_HEADER), W = g(() => {
1783
+ switch (S.value.type) {
1784
+ case w.CHART:
1785
+ return Sn;
1786
+ case w.TABLE:
1787
+ return Mn;
1788
+ case w.FILTER:
1789
+ return Kn;
1790
+ case w.SECTION_HEADER:
1791
+ return null;
1792
+ case w.MARKDOWN:
1793
+ default:
1794
+ return In;
1795
+ }
1796
+ }), C = g(() => {
1797
+ switch (S.value.type) {
1798
+ case w.CHART:
1799
+ return "Chart Name";
1800
+ case w.TABLE:
1801
+ return "Table Name";
1802
+ case w.FILTER:
1803
+ return "Filter Name";
1804
+ case w.SECTION_HEADER:
1805
+ return "Section Header";
1806
+ case w.MARKDOWN:
1807
+ default:
1808
+ return "Note Name";
1809
+ }
1810
+ }), v = g(() => [w.CHART, w.TABLE, w.MARKDOWN].includes(S.value.type)), $ = g(() => S.value.filters ? S.value.filters.length : 0), ee = g(() => (S.value.filters || []).slice(0, 2)), te = g(() => Math.max(0, $.value - ee.value.length));
1811
+ function U(N, F) {
1812
+ var ke;
1813
+ const P = N == null ? void 0 : N.trim();
1814
+ if (!P)
1815
+ return { text: F, level: 3 };
1816
+ const he = P.match(/^(#{1,3})\s*(.+)$/);
1817
+ if (!he)
1818
+ return { text: P, level: 3 };
1819
+ const we = (ke = he[2]) == null ? void 0 : ke.trim();
1820
+ return we ? {
1821
+ text: we,
1822
+ level: he[1].length
1823
+ } : { text: P, level: 3 };
1824
+ }
1825
+ const Ce = g(() => U(S.value.name, C.value)), me = g(() => Ce.value.text), j = g(() => `item-title-level-${Ce.value.level}`);
1826
+ return (N, F) => (c(), y("div", {
1827
+ class: R(["grid-item-content", {
1828
+ "grid-item-chart-style": [oe(w).CHART, oe(w).TABLE, oe(w).FILTER].includes(
1829
+ //@ts-ignore
1830
+ S.value.type
1831
+ ),
1832
+ "grid-item-section-header-style": h.value,
1833
+ "grid-item-edit-style": e.editMode
1834
+ }]),
1835
+ "data-testid": `dashboard-component-${e.item.i}`,
1836
+ onMouseenter: F[2] || (F[2] = () => {
1837
+ s.value = !0;
1838
+ }),
1839
+ onMouseleave: F[3] || (F[3] = () => {
1840
+ s.value = !1;
1841
+ })
1842
+ }, [
1843
+ e.editMode ? (c(), y("div", {
1844
+ key: 0,
1845
+ class: R(["dev-toolbar-shell", { "dev-toolbar-visible": s.value && !r.value }])
1846
+ }, [
1847
+ t("div", _n, [
1848
+ h.value ? M("", !0) : (c(), y("button", {
1849
+ key: 0,
1850
+ onClick: b,
1851
+ class: "control-btn",
1852
+ "data-testid": `increase-height-item-${e.item.i}`,
1853
+ title: "Increase height"
1854
+ }, [...F[4] || (F[4] = [
1855
+ t("i", { class: "mdi mdi-plus icon" }, null, -1)
1856
+ ])], 8, Un)),
1857
+ h.value ? M("", !0) : (c(), y("button", {
1858
+ key: 1,
1859
+ onClick: D,
1860
+ class: "control-btn",
1861
+ "data-testid": `decrease-height-item-${e.item.i}`,
1862
+ title: "Decrease height"
1863
+ }, [...F[5] || (F[5] = [
1864
+ t("i", { class: "mdi mdi-minus icon" }, null, -1)
1865
+ ])], 8, jn)),
1866
+ t("button", {
1867
+ onClick: E,
1868
+ class: "control-btn",
1869
+ "data-testid": `edit-dashboard-item-content-${e.item.i}`,
1870
+ title: h.value ? "Edit title" : "Edit data"
1871
+ }, [
1872
+ t("i", {
1873
+ class: R(
1874
+ h.value ? "mdi mdi-pencil-outline icon" : "mdi mdi-database-edit-outline icon"
1875
+ )
1876
+ }, null, 2)
1877
+ ], 8, Gn),
1878
+ h.value ? M("", !0) : (c(), y("button", {
1879
+ key: 2,
1880
+ onClick: k,
1881
+ class: "control-btn",
1882
+ "data-testid": `toggle-crossfilter-item-content-${e.item.i}`,
1883
+ title: S.value.allowCrossFilter ? "Toggle cross-filtering OFF" : "Toggle cross-filtering ON"
1884
+ }, [
1885
+ S.value.allowCrossFilter ? (c(), y("i", Jn)) : (c(), y("i", Yn))
1886
+ ], 8, zn)),
1887
+ t("button", {
1888
+ onClick: T,
1889
+ class: "control-btn",
1890
+ "data-testid": `copy-dashboard-item-${e.item.i}`,
1891
+ title: "Copy item"
1892
+ }, [...F[6] || (F[6] = [
1893
+ t("i", { class: "mdi mdi-content-copy icon" }, null, -1)
1894
+ ])], 8, Xn),
1895
+ t("button", {
1896
+ onClick: A,
1897
+ class: "control-btn remove-btn",
1898
+ "data-testid": `remove-dashboard-item-${e.item.i}`,
1899
+ title: "Remove item"
1900
+ }, [...F[7] || (F[7] = [
1901
+ t("i", { class: "mdi mdi-delete-outline icon" }, null, -1)
1902
+ ])], 8, Zn)
1903
+ ])
1904
+ ], 2)) : M("", !0),
1905
+ h.value ? M("", !0) : (c(), y("div", eo, [
1906
+ t("div", to, [
1907
+ e.editMode ? (c(), y("div", no, [...F[8] || (F[8] = [
1908
+ t("svg", {
1909
+ xmlns: "http://www.w3.org/2000/svg",
1910
+ width: "16",
1911
+ height: "16",
1912
+ viewBox: "0 0 24 24",
1913
+ fill: "none",
1914
+ stroke: "currentColor",
1915
+ "stroke-width": "2",
1916
+ "stroke-linecap": "round",
1917
+ "stroke-linejoin": "round",
1918
+ class: "drag-handle-svg"
1919
+ }, [
1920
+ t("line", {
1921
+ x1: "3",
1922
+ y1: "12",
1923
+ x2: "21",
1924
+ y2: "12"
1925
+ }),
1926
+ t("line", {
1927
+ x1: "3",
1928
+ y1: "6",
1929
+ x2: "21",
1930
+ y2: "6"
1931
+ }),
1932
+ t("line", {
1933
+ x1: "3",
1934
+ y1: "18",
1935
+ x2: "21",
1936
+ y2: "18"
1937
+ })
1938
+ ], -1)
1939
+ ])])) : M("", !0),
1940
+ t("div", oo, [
1941
+ r.value ? se((c(), y("input", {
1942
+ key: 1,
1943
+ id: `title-input-${e.item.i}`,
1944
+ "onUpdate:modelValue": F[0] || (F[0] = (P) => i.value = P),
1945
+ onBlur: p,
1946
+ onKeyup: [
1947
+ ge(p, ["enter"]),
1948
+ ge(q, ["esc"])
1949
+ ],
1950
+ class: "title-input",
1951
+ type: "text",
1952
+ placeholder: C.value
1953
+ }, null, 40, ao)), [
1954
+ [ve, i.value]
1955
+ ]) : (c(), y("div", {
1956
+ key: 0,
1957
+ class: R(["item-title editable-title", [j.value, { "item-title-static": !e.editMode }]]),
1958
+ title: me.value,
1959
+ onClick: a
1960
+ }, [
1961
+ t("span", ro, O(me.value), 1),
1962
+ e.editMode ? (c(), y("i", lo)) : M("", !0)
1963
+ ], 10, io))
1964
+ ])
1965
+ ]),
1966
+ t("div", so, [
1967
+ v.value && $.value > 0 ? (c(), y("div", uo, [
1968
+ (c(!0), y(ce, null, be(ee.value, (P, he) => (c(), y("div", {
1969
+ key: `${P.source}-${P.value}-${he}`,
1970
+ class: "header-filter-chip",
1971
+ title: f(P.value)
1972
+ }, [
1973
+ t("span", mo, [
1974
+ t("span", ho, O(P.source === "global" ? P.source : "cross") + ": ", 1),
1975
+ t("span", fo, O(m(P.value, 40)), 1)
1976
+ ]),
1977
+ e.editMode && P.source !== "global" ? (c(), y("button", {
1978
+ key: 0,
1979
+ class: "filter-remove-btn",
1980
+ onClick: (we) => B(P.source),
1981
+ title: `Remove ${P.source} filter`
1982
+ }, " x ", 8, vo)) : M("", !0)
1983
+ ], 8, co))), 128)),
1984
+ te.value > 0 ? (c(), y("div", {
1985
+ key: 0,
1986
+ class: "header-filter-chip filter-overflow",
1987
+ title: `${te.value} more filter(s)`
1988
+ }, " +" + O(te.value), 9, po)) : M("", !0)
1989
+ ])) : M("", !0)
1990
+ ])
1991
+ ])),
1992
+ t("div", {
1993
+ class: R(["content-area", { "section-header-content": h.value }])
1994
+ }, [
1995
+ h.value ? (c(), y(ce, { key: 0 }, [
1996
+ r.value ? se((c(), y("input", {
1997
+ key: 1,
1998
+ id: `title-input-${e.item.i}`,
1999
+ "onUpdate:modelValue": F[1] || (F[1] = (P) => i.value = P),
2000
+ onBlur: p,
2001
+ onKeyup: [
2002
+ ge(p, ["enter"]),
2003
+ ge(q, ["esc"])
2004
+ ],
2005
+ class: "title-input section-header-input no-drag",
2006
+ type: "text",
2007
+ placeholder: C.value
2008
+ }, null, 40, bo)), [
2009
+ [ve, i.value]
2010
+ ]) : (c(), y("div", {
2011
+ key: 0,
2012
+ class: R(["section-header-display no-drag", [j.value, { "section-header-editable": e.editMode }]]),
2013
+ title: me.value,
2014
+ onClick: a
2015
+ }, [
2016
+ t("span", go, O(me.value), 1)
2017
+ ], 10, yo))
2018
+ ], 64)) : (c(), G(lt(W.value), {
2019
+ key: 1,
2020
+ dashboardId: n.dashboardId,
2021
+ itemId: e.item.i,
2022
+ setItemData: e.setItemData,
2023
+ getItemData: e.getItemData,
2024
+ getDashboardQueryExecutor: e.getDashboardQueryExecutor,
2025
+ editMode: e.editMode,
2026
+ symbols: n.symbols || [],
2027
+ onDimensionClick: Q,
2028
+ onBackgroundClick: K
2029
+ }, null, 40, ["dashboardId", "itemId", "setItemData", "getItemData", "getDashboardQueryExecutor", "editMode", "symbols"]))
2030
+ ], 2)
2031
+ ], 42, Wn));
2032
+ }
2033
+ }), Si = /* @__PURE__ */ X(Co, [["__scopeId", "data-v-e158f697"]]), wo = { class: "add-item-content" }, ko = {
2034
+ class: "item-type-grid",
2035
+ role: "radiogroup",
2036
+ "aria-label": "Dashboard item type"
2037
+ }, So = ["data-testid"], Eo = ["value", "data-testid"], Do = { class: "item-option-card" }, Io = {
2038
+ class: "item-option-icon",
2039
+ "aria-hidden": "true"
2040
+ }, To = { class: "item-option-text" }, $o = { class: "item-option-label" }, Lo = { class: "item-option-help" }, Mo = /* @__PURE__ */ Y({
2041
+ __name: "DashboardAddItemModal",
2042
+ props: {
2043
+ show: { type: Boolean }
2044
+ },
2045
+ emits: ["add", "close"],
2046
+ setup(e, { emit: o }) {
2047
+ const n = o, l = I(w.CHART), r = [
2048
+ {
2049
+ value: w.CHART,
2050
+ label: "Chart",
2051
+ description: "Visualize trends, comparisons, and distributions.",
2052
+ icon: "mdi-chart-bar",
2053
+ testId: "dashboard-add-item-type-chart"
2054
+ },
2055
+ {
2056
+ value: w.TABLE,
2057
+ label: "Table",
2058
+ description: "Show detailed rows and values in a grid.",
2059
+ icon: "mdi-table-large",
2060
+ testId: "dashboard-add-item-type-table"
2061
+ },
2062
+ {
2063
+ value: w.MARKDOWN,
2064
+ label: "Markdown",
2065
+ description: "Add notes, headings, or narrative context.",
2066
+ icon: "mdi-text-box-outline",
2067
+ testId: "dashboard-add-item-type-markdown"
2068
+ },
2069
+ {
2070
+ value: w.FILTER,
2071
+ label: "Filter",
2072
+ description: "Let viewers narrow the dashboard interactively.",
2073
+ icon: "mdi-filter-variant",
2074
+ testId: "dashboard-add-item-type-filter"
2075
+ },
2076
+ {
2077
+ value: w.SECTION_HEADER,
2078
+ label: "Section Header",
2079
+ description: "Break the dashboard into labeled sections.",
2080
+ icon: "mdi-format-title",
2081
+ testId: "dashboard-add-item-type-section-header"
2082
+ }
2083
+ ];
2084
+ function i() {
2085
+ n("add", l.value);
2086
+ }
2087
+ function s() {
2088
+ n("close");
2089
+ }
2090
+ return (f, m) => (c(), G(We, {
2091
+ show: e.show,
2092
+ title: "Add New Item",
2093
+ "max-width": "680px",
2094
+ "test-id": "dashboard-add-item-modal",
2095
+ onClose: s
2096
+ }, {
2097
+ footer: z(() => [
2098
+ t("button", {
2099
+ class: "cancel-button",
2100
+ onClick: s
2101
+ }, "Cancel"),
2102
+ t("button", {
2103
+ onClick: i,
2104
+ class: "add-button",
2105
+ "data-testid": "dashboard-add-item-confirm"
2106
+ }, " Add Item ")
2107
+ ]),
2108
+ default: z(() => [
2109
+ t("div", wo, [
2110
+ m[1] || (m[1] = t("p", { class: "add-item-description" }, "Choose the kind of block you want to add to the dashboard.", -1)),
2111
+ t("div", ko, [
2112
+ (c(), y(ce, null, be(r, (a) => t("label", {
2113
+ key: a.value,
2114
+ class: R(["item-option", { selected: l.value === a.value }]),
2115
+ "data-testid": `${a.testId}-option`
2116
+ }, [
2117
+ se(t("input", {
2118
+ "onUpdate:modelValue": m[0] || (m[0] = (p) => l.value = p),
2119
+ class: "item-option-input",
2120
+ type: "radio",
2121
+ name: "dashboard-add-item-type",
2122
+ value: a.value,
2123
+ "data-testid": a.testId
2124
+ }, null, 8, Eo), [
2125
+ [at, l.value]
2126
+ ]),
2127
+ t("span", Do, [
2128
+ t("span", Io, [
2129
+ t("i", {
2130
+ class: R(["mdi", a.icon])
2131
+ }, null, 2)
2132
+ ]),
2133
+ t("span", To, [
2134
+ t("span", $o, O(a.label), 1),
2135
+ t("span", Lo, O(a.description), 1)
2136
+ ])
2137
+ ])
2138
+ ], 10, So)), 64))
2139
+ ])
2140
+ ])
2141
+ ]),
2142
+ _: 1
2143
+ }, 8, ["show"]));
2144
+ }
2145
+ }), Ei = /* @__PURE__ */ X(Mo, [["__scopeId", "data-v-ee048740"]]);
2146
+ function Ao(e = "dark") {
2147
+ const o = e === "light";
2148
+ Ie.defineTheme("trilogyStudio", {
2149
+ base: o ? "vs" : "vs-dark",
2150
+ inherit: !0,
2151
+ rules: [
2152
+ { token: "comment", foreground: "#6A9955", fontStyle: "italic" },
2153
+ { token: "keyword", foreground: "#569CD6", fontStyle: "bold" },
2154
+ { token: "definition", foreground: "#E5C07B", fontStyle: "bold" },
2155
+ { token: "type", foreground: "#4EC9B0", fontStyle: "bold" },
2156
+ { token: "string", foreground: "#CE9178" },
2157
+ { token: "number", foreground: "#B5CEA8" },
2158
+ { token: "operator", foreground: "#D4D4D4" },
2159
+ { token: "delimiter", foreground: "#D4D4D4" },
2160
+ { token: "function", foreground: "#C586C0", fontStyle: "bold" },
2161
+ { token: "hidden", foreground: "#D6D6C8", fontStyle: "italic" },
2162
+ { token: "property", foreground: "#BFBFBF" }
2163
+ ],
2164
+ colors: {
2165
+ "editor.background": o ? "#ffffff" : "#111318",
2166
+ "editor.foreground": o ? "#1f2937" : "#e5e7eb",
2167
+ "editorLineNumber.foreground": o ? "#94a3b8" : "#64748b",
2168
+ "editorLineNumber.activeForeground": o ? "#475569" : "#cbd5e1",
2169
+ "editorGutter.background": o ? "#ffffff" : "#111318",
2170
+ editorLineHighlightBackground: o ? "#f6f8fb" : "#181c22",
2171
+ "editor.selectionBackground": o ? "#dbeafe" : "#1d4ed833",
2172
+ "editor.inactiveSelectionBackground": o ? "#e2e8f0" : "#33415555",
2173
+ "editorCursor.foreground": o ? "#334155" : "#ffffff",
2174
+ "editorCursor.background": o ? "#ffffff" : "#111318",
2175
+ "editorIndentGuide.background1": o ? "#e2e8f0" : "#2a2f37",
2176
+ "editorIndentGuide.activeBackground1": o ? "#cbd5e1" : "#475569",
2177
+ "editorWhitespace.foreground": o ? "#cbd5e1" : "#334155",
2178
+ "editorWidget.background": o ? "#ffffff" : "#111318",
2179
+ "editorWidget.border": o ? "#d6dde6" : "#2a2f37"
2180
+ }
2181
+ }), Ie.setTheme("trilogyStudio");
2182
+ }
2183
+ function Ro(e, o = {}) {
2184
+ const l = { ...{
2185
+ automaticLayout: !0,
2186
+ autoClosingBrackets: "always",
2187
+ autoClosingOvertype: "always",
2188
+ autoClosingQuotes: "always",
2189
+ acceptSuggestionOnEnter: "off",
2190
+ tabCompletion: "on",
2191
+ theme: "trilogyStudio"
2192
+ }, ...o };
2193
+ return Ie.create(e, l);
2194
+ }
2195
+ function Pe(e, o = "") {
2196
+ var r;
2197
+ if (!e) return o;
2198
+ const n = e.getSelection();
2199
+ let l = n && !(n.startColumn === n.endColumn && n.startLineNumber === n.endLineNumber) ? ((r = e.getModel()) == null ? void 0 : r.getValueInRange(n)) || "" : e.getValue();
2200
+ return l || (l = o), l;
2201
+ }
2202
+ function Fo(e, o = {}) {
2203
+ const { onValidate: n, onRun: l, onSave: r } = o;
2204
+ if (n && e.addCommand(le.CtrlCmd | le.Shift | fe.KeyV, n), l && e.addCommand(le.CtrlCmd | fe.Enter, l), r && e.addCommand(le.CtrlCmd | fe.KeyS, r), e.addCommand(le.CtrlCmd | fe.KeyZ, () => {
2205
+ e.trigger("ide", "undo", {});
2206
+ }), o.onContentChange) {
2207
+ let i = null;
2208
+ e.onDidChangeModelContent(() => {
2209
+ var s;
2210
+ (s = o.onContentChange) == null || s.call(o, e.getValue()), i && clearTimeout(i), i = setTimeout(() => {
2211
+ var f;
2212
+ e.hasTextFocus() && !((f = e.getSelection()) != null && f.isEmpty()) && e.trigger("completion", "editor.action.triggerSuggest", { auto: !0 });
2213
+ }, 200);
2214
+ });
2215
+ }
2216
+ }
2217
+ let x = null;
2218
+ const qo = Y({
2219
+ name: "EnhancedEditor",
2220
+ components: {
2221
+ SymbolsPane: gt,
2222
+ LoadingView: Te
2223
+ },
2224
+ props: {
2225
+ onSave: {
2226
+ type: null,
2227
+ required: !1,
2228
+ default: null
2229
+ },
2230
+ theme: {
2231
+ type: String,
2232
+ default: ""
2233
+ },
2234
+ initContent: {
2235
+ type: String,
2236
+ required: !1,
2237
+ default: ""
2238
+ },
2239
+ connectionName: {
2240
+ type: String,
2241
+ required: !0
2242
+ },
2243
+ imports: {
2244
+ type: Array,
2245
+ required: !1,
2246
+ default: () => []
2247
+ },
2248
+ rootContent: {
2249
+ type: Array,
2250
+ required: !1,
2251
+ default: () => []
2252
+ }
2253
+ },
2254
+ emits: ["query-started", "format-query"],
2255
+ data() {
2256
+ return {
2257
+ lastOperation: null,
2258
+ editor: new Ct({
2259
+ id: "simple-editor",
2260
+ name: "My Query",
2261
+ type: "trilogy",
2262
+ connection: this.connectionName,
2263
+ storage: "local",
2264
+ contents: this.initContent
2265
+ }),
2266
+ // New properties for collapsible sidebar
2267
+ activePanel: "symbols",
2268
+ isPanelVisible: !1
2269
+ };
2270
+ },
2271
+ setup() {
2272
+ const e = _("queryExecutionService"), o = _("connectionStore"), n = _("isMobile"), l = _("llmConnectionStore"), r = _("analyticsStore"), i = bt();
2273
+ return {
2274
+ queryExecutionService: e,
2275
+ connectionStore: o,
2276
+ isMobile: n,
2277
+ llmConnectionStore: l,
2278
+ analyticsStore: r,
2279
+ userSettingsStore: i
2280
+ };
2281
+ },
2282
+ created() {
2283
+ this.isPanelVisible = !this.isMobile;
2284
+ },
2285
+ mounted() {
2286
+ this.$nextTick(() => {
2287
+ this.createEditor(), this.$watch(
2288
+ () => {
2289
+ var e;
2290
+ return (e = this.userSettingsStore) == null ? void 0 : e.settings.theme;
2291
+ },
2292
+ () => {
2293
+ this.applyEditorTheme();
2294
+ }
2295
+ ), document.addEventListener("keydown", this.handleKeyboardShortcuts), this.validateQuery();
2296
+ });
2297
+ },
2298
+ beforeUnmount() {
2299
+ x && x.dispose(), document.removeEventListener("keydown", this.handleKeyboardShortcuts);
2300
+ },
2301
+ methods: {
2302
+ getResolvedTheme() {
2303
+ var n;
2304
+ const e = this.theme === "light" || this.theme === "dark" ? this.theme : "", o = ((n = this.userSettingsStore) == null ? void 0 : n.settings.theme) || "";
2305
+ return (e || o || "dark") === "light" ? "light" : "dark";
2306
+ },
2307
+ applyEditorTheme() {
2308
+ Ao(this.getResolvedTheme());
2309
+ },
2310
+ // New methods for panel management
2311
+ togglePanel(e) {
2312
+ this.activePanel === e && this.isPanelVisible ? this.isPanelVisible = !1 : (this.activePanel = e, this.isPanelVisible = !0, e === "symbols" && this.$refs.symbolsPane && this.$nextTick(() => {
2313
+ this.focusSymbolSearch();
2314
+ })), x && this.$nextTick(() => {
2315
+ x == null || x.layout();
2316
+ });
2317
+ },
2318
+ closePanel() {
2319
+ this.isPanelVisible = !1, x && this.$nextTick(() => {
2320
+ x == null || x.layout();
2321
+ });
2322
+ },
2323
+ getPanelTitle() {
2324
+ switch (this.activePanel) {
2325
+ case "symbols":
2326
+ return "Symbols";
2327
+ default:
2328
+ return "";
2329
+ }
2330
+ },
2331
+ createEditor() {
2332
+ this.applyEditorTheme(), x = Ro(this.$refs.editorElement, {
2333
+ value: this.editor.contents || "",
2334
+ language: this.editor.type === "sql" ? "sql" : "trilogy"
2335
+ }), Fo(x, {
2336
+ onValidate: () => this.validateQuery(),
2337
+ onRun: () => this.runQuery(),
2338
+ onGenerateLLM: () => this.generateLLMQuery()
2339
+ // Add LLM generation shortcut
2340
+ }), x.addCommand(le.CtrlCmd | fe.Space, () => {
2341
+ this.togglePanel("symbols");
2342
+ }), x.addCommand(le.CtrlCmd | le.Shift | fe.Enter, () => {
2343
+ this.generateLLMQuery();
2344
+ }), this.editor.type !== "sql" && (x.addCommand(le.CtrlCmd | fe.KeyK, () => {
2345
+ this.formatQuery();
2346
+ }), x.addAction({
2347
+ id: "trilogy.simple-editor.format-query",
2348
+ label: "Format Query",
2349
+ contextMenuGroupId: "navigation",
2350
+ contextMenuOrder: 1.5,
2351
+ run: () => {
2352
+ this.formatQuery();
2353
+ }
2354
+ }));
2355
+ },
2356
+ handleKeyboardShortcuts(e) {
2357
+ e.ctrlKey && e.shiftKey && e.key === "O" && (this.togglePanel("symbols"), e.preventDefault()), e.ctrlKey && e.shiftKey && e.key === "Enter" && (this.generateLLMQuery(), e.preventDefault()), e.ctrlKey && e.key === "k" && this.editor.type !== "sql" && (this.formatQuery(), e.preventDefault());
2358
+ },
2359
+ focusSymbolSearch() {
2360
+ const e = this.$refs.symbolsPane;
2361
+ e && "focusSearch" in e && e.focusSearch();
2362
+ },
2363
+ insertSymbol(e) {
2364
+ if (!x) return;
2365
+ const o = x.getPosition();
2366
+ o && e.insertText && (x.executeEdits("", [
2367
+ {
2368
+ range: new wt(
2369
+ o.lineNumber,
2370
+ o.column,
2371
+ o.lineNumber,
2372
+ o.column
2373
+ ),
2374
+ text: e.insertText
2375
+ }
2376
+ ]), x.focus(), this.isMobile && this.closePanel());
2377
+ },
2378
+ async validateQuery(e = !0) {
2379
+ if (!x) return [];
2380
+ const o = this.connectionStore, n = this.queryExecutionService;
2381
+ try {
2382
+ this.editor.setError(null);
2383
+ const l = x.getValue(), r = o.connections[this.editor.connection], i = {
2384
+ text: l,
2385
+ queryType: r ? r.query_type : "trilogy",
2386
+ editorType: this.editor.type,
2387
+ sources: [],
2388
+ imports: this.imports,
2389
+ extraContent: this.rootContent
2390
+ }, s = await n.validateQuery(
2391
+ this.editor.connection,
2392
+ i
2393
+ );
2394
+ if (s && e) {
2395
+ const f = x.getModel();
2396
+ f && Ie.setModelMarkers(f, "owner", s.data.items || []), s.data.completion_items && (this.editor.completionSymbols = s.data.completion_items);
2397
+ }
2398
+ return s ? s.data.imports : [];
2399
+ } catch (l) {
2400
+ return l instanceof Error ? this.editor.setError(l.message || "Validation failed") : this.editor.setError("Validation failed"), [];
2401
+ }
2402
+ },
2403
+ async formatQuery() {
2404
+ var r;
2405
+ const e = x, o = Pe(e, this.editor.contents);
2406
+ if (!o || !e) return;
2407
+ let n = (r = this.connectionStore) == null ? void 0 : r.connections[this.editor.connection], l = this.queryExecutionService;
2408
+ if (l)
2409
+ try {
2410
+ const i = await l.formatQuery(
2411
+ o,
2412
+ n ? n.query_type : "",
2413
+ this.editor.type,
2414
+ this.imports,
2415
+ this.rootContent
2416
+ );
2417
+ i && e.setValue(i);
2418
+ } catch (i) {
2419
+ console.error("Error formatting query:", i);
2420
+ }
2421
+ },
2422
+ async cancelQuery() {
2423
+ this.editor.cancelCallback && await this.editor.cancelCallback(), this.editor.loading = !1;
2424
+ },
2425
+ async runQuery() {
2426
+ var r, i, s;
2427
+ this.$emit("query-started"), this.editor.setError(null);
2428
+ let e = !1;
2429
+ const o = this.connectionStore, n = this.queryExecutionService, l = x;
2430
+ if (!(this.editor.loading || !l))
2431
+ try {
2432
+ this.analyticsStore && this.analyticsStore.log("studio-query-execution", this.editor.type, !0), this.editor.loading = !0, this.lastOperation = null, this.editor.startTime = Date.now();
2433
+ const f = o.connections[this.editor.connection], m = Pe(l, this.editor.contents);
2434
+ if (!m) {
2435
+ this.editor.results = new Be(/* @__PURE__ */ new Map(), []), this.editor.loading = !1;
2436
+ return;
2437
+ }
2438
+ const a = {
2439
+ text: m,
2440
+ queryType: f ? f.query_type : "",
2441
+ editorType: this.editor.type,
2442
+ imports: this.imports,
2443
+ extraContent: this.rootContent
2444
+ }, { resultPromise: p, cancellation: k } = await n.executeQuery(
2445
+ this.editor.connection,
2446
+ a,
2447
+ // Progress callback for connection issues
2448
+ () => {
2449
+ },
2450
+ (D) => {
2451
+ !e && D.error && (this.editor.loading = !1, D.message && this.editor.setError(D.message)), !e && D.running && (this.editor.error = null, this.editor.loading = !0);
2452
+ }
2453
+ );
2454
+ this.editor.cancelCallback = () => {
2455
+ k.isActive() && k.cancel(), this.editor.loading = !1, this.editor.cancelCallback = null;
2456
+ };
2457
+ const b = await p;
2458
+ e = !0, this.lastOperation = {
2459
+ success: b.success,
2460
+ duration: b.executionTime,
2461
+ rows: (r = b.results) != null && r.data ? (s = (i = b.results) == null ? void 0 : i.data) == null ? void 0 : s.length : void 0,
2462
+ type: this.editor.type
2463
+ }, b.success ? (this.editor.executed_contents = m, b.generatedSql && (this.editor.generated_sql = b.generatedSql), b.results && (this.editor.results = b.results, this.editor.duration = b.executionTime)) : b.error && (this.editor.executed_contents = m, this.editor.setError(b.error));
2464
+ } catch (f) {
2465
+ f instanceof Error && this.editor.setError(f.message || "Query execution failed"), this.lastOperation = {
2466
+ success: !1,
2467
+ duration: 0,
2468
+ type: this.editor.type
2469
+ };
2470
+ } finally {
2471
+ this.editor.loading = !1, this.editor.cancelCallback = null, x && x.layout();
2472
+ }
2473
+ },
2474
+ // Add the LLM query generation method
2475
+ async generateLLMQuery() {
2476
+ if (this.editor.loading || !x) return;
2477
+ const e = this.llmConnectionStore, o = this.queryExecutionService, n = this.connectionStore;
2478
+ if (!e) {
2479
+ this.editor.setError("LLM connection store not available");
2480
+ return;
2481
+ }
2482
+ try {
2483
+ this.analyticsStore && this.analyticsStore.log("studio-llm-generation", this.editor.type, !0), this.editor.loading = !0, this.editor.startTime = Date.now(), this.editor.results = new Be(/* @__PURE__ */ new Map(), []), this.editor.setError(null);
2484
+ const l = x.getValue();
2485
+ if (await this.validateQuery(!1), !this.editor.completionSymbols || this.editor.completionSymbols.length === 0)
2486
+ throw new Error("There are no imported concepts for LLM generation");
2487
+ const r = this.editor.completionSymbols.map((f) => ({
2488
+ name: f.label,
2489
+ type: f.datatype,
2490
+ description: f.description,
2491
+ calculation: f.calculation
2492
+ })), i = async (f) => {
2493
+ const m = n.connections[this.editor.connection], a = {
2494
+ text: f,
2495
+ queryType: m ? m.query_type : "",
2496
+ editorType: this.editor.type,
2497
+ imports: this.imports,
2498
+ extraContent: this.rootContent
2499
+ };
2500
+ try {
2501
+ const { resultPromise: p } = await o.executeQuery(
2502
+ this.editor.connection,
2503
+ a,
2504
+ () => {
2505
+ },
2506
+ () => {
2507
+ },
2508
+ (k) => {
2509
+ throw k;
2510
+ },
2511
+ () => !0,
2512
+ !0
2513
+ // Explain mode
2514
+ );
2515
+ return await p, !0;
2516
+ } catch (p) {
2517
+ throw p;
2518
+ }
2519
+ }, s = await e.generateQueryCompletion(l, r, i);
2520
+ if (s)
2521
+ x.setValue(s.content), this.editor.contents = x.getValue(), this.lastOperation = {
2522
+ success: !0,
2523
+ duration: Date.now() - (this.editor.startTime || 0),
2524
+ type: "LLM Generation"
2525
+ };
2526
+ else
2527
+ throw new Error("LLM could not successfully generate query");
2528
+ } catch (l) {
2529
+ if (l instanceof Error)
2530
+ throw this.editor.setError(l.message), l;
2531
+ this.editor.setError("Unknown error occurred during LLM generation"), this.lastOperation = {
2532
+ success: !1,
2533
+ duration: 0,
2534
+ type: "LLM Generation"
2535
+ };
2536
+ } finally {
2537
+ this.editor.loading = !1, x && x.layout();
2538
+ }
2539
+ },
2540
+ getContent() {
2541
+ return x ? x.getValue() : this.editor.contents || "";
2542
+ }
2543
+ }
2544
+ }), xo = { class: "editor-container" }, Ho = { class: "menu-bar" }, Oo = { class: "menu-actions" }, Vo = { class: "editor-content" }, Qo = { class: "sidebar-panel" }, Bo = { class: "be-sidebar-container" }, No = { class: "be-sidebar-icons" }, Po = { class: "result-wrapper" }, Ko = {
2545
+ key: 1,
2546
+ class: "error-message"
2547
+ }, Wo = {
2548
+ key: 2,
2549
+ class: "results-summary",
2550
+ "data-testid": "simple-editor-results"
2551
+ }, _o = { class: "results-details" }, Uo = {
2552
+ key: 0,
2553
+ class: "timing"
2554
+ }, jo = {
2555
+ key: 1,
2556
+ class: "row-count"
2557
+ }, Go = {
2558
+ key: 2,
2559
+ class: "operation-type"
2560
+ };
2561
+ function zo(e, o, n, l, r, i) {
2562
+ const s = Z("SymbolsPane"), f = Z("loading-view");
2563
+ return c(), y("div", xo, [
2564
+ t("div", Ho, [
2565
+ t("div", Oo, [
2566
+ t("button", {
2567
+ class: "action-item",
2568
+ onClick: o[0] || (o[0] = (...m) => e.generateLLMQuery && e.generateLLMQuery(...m)),
2569
+ title: "Generate query using AI",
2570
+ "data-testid": "editor-generate-button"
2571
+ }, " Generate "),
2572
+ e.editor.type !== "sql" ? (c(), y("button", {
2573
+ key: 0,
2574
+ class: "action-item",
2575
+ onClick: o[1] || (o[1] = () => e.validateQuery())
2576
+ }, " Parse ")) : M("", !0),
2577
+ e.editor.type !== "sql" ? (c(), y("button", {
2578
+ key: 1,
2579
+ class: "action-item",
2580
+ onClick: o[2] || (o[2] = (...m) => e.formatQuery && e.formatQuery(...m)),
2581
+ title: "Format query"
2582
+ }, " Format ")) : M("", !0),
2583
+ t("button", {
2584
+ onClick: o[3] || (o[3] = (m) => e.editor.loading ? e.cancelQuery() : e.runQuery()),
2585
+ class: R(["action-item", { "button-cancel": e.editor.loading, "button-run": !e.editor.loading }]),
2586
+ "data-testid": "editor-run-button"
2587
+ }, O(e.editor.loading ? "Cancel" : "Test"), 3)
2588
+ ])
2589
+ ]),
2590
+ t("div", Vo, [
2591
+ t("div", {
2592
+ ref: "editorElement",
2593
+ class: R(["editor-obj", {
2594
+ "monaco-width-with-panel": e.isPanelVisible,
2595
+ "monaco-width-no-panel": !e.isPanelVisible
2596
+ }]),
2597
+ "data-testid": "simple-editor-content"
2598
+ }, null, 2),
2599
+ se(t("div", Qo, [
2600
+ J(s, {
2601
+ symbols: e.editor.completionSymbols || [],
2602
+ onSelectSymbol: e.insertSymbol,
2603
+ ref: "symbolsPane"
2604
+ }, null, 8, ["symbols", "onSelectSymbol"])
2605
+ ], 512), [
2606
+ [st, e.isPanelVisible]
2607
+ ]),
2608
+ t("div", Bo, [
2609
+ t("div", No, [
2610
+ t("button", {
2611
+ class: R(["sidebar-icon-button", { active: e.isPanelVisible }]),
2612
+ onClick: o[4] || (o[4] = (m) => e.togglePanel("symbols")),
2613
+ title: "Symbols"
2614
+ }, [...o[5] || (o[5] = [
2615
+ t("i", { class: "mdi mdi-tag-search-outline" }, null, -1)
2616
+ ])], 2)
2617
+ ])
2618
+ ])
2619
+ ]),
2620
+ t("div", Po, [
2621
+ e.editor.loading ? (c(), G(f, {
2622
+ key: 0,
2623
+ class: "loading-view",
2624
+ text: "Loading...",
2625
+ startTime: e.editor.startTime
2626
+ }, null, 8, ["startTime"])) : e.editor.error ? (c(), y("div", Ko, O(e.editor.error), 1)) : e.lastOperation ? (c(), y("div", Wo, [
2627
+ t("div", {
2628
+ class: R(["status-badge", e.lastOperation.success ? "success" : "error"])
2629
+ }, O(e.lastOperation.success ? "SUCCESS" : "FAILED"), 3),
2630
+ t("div", _o, [
2631
+ e.lastOperation.duration ? (c(), y("div", Uo, O(e.lastOperation.duration) + "ms", 1)) : M("", !0),
2632
+ e.lastOperation.rows !== void 0 ? (c(), y("div", jo, O(e.lastOperation.rows) + " " + O(e.lastOperation.rows === 1 ? "row" : "rows"), 1)) : M("", !0),
2633
+ e.lastOperation.type ? (c(), y("div", Go, O(e.lastOperation.type), 1)) : M("", !0)
2634
+ ])
2635
+ ])) : M("", !0)
2636
+ ])
2637
+ ]);
2638
+ }
2639
+ const ze = /* @__PURE__ */ X(qo, [["render", zo], ["__scopeId", "data-v-b1298af8"]]), Jo = { class: "editor-overlay" }, Yo = { class: "editor-actions" }, Xo = ["data-testid"], Zo = /* @__PURE__ */ Y({
2640
+ __name: "DashboardEditorDialog",
2641
+ props: {
2642
+ initialWidth: {},
2643
+ initialHeight: {},
2644
+ minWidth: { default: 400 },
2645
+ minHeight: { default: 200 },
2646
+ saveLabel: { default: "Save" },
2647
+ saveTestId: { default: "" }
2648
+ },
2649
+ emits: ["save", "cancel"],
2650
+ setup(e, { emit: o }) {
2651
+ const n = e, l = o, { editorElement: r, dialogStyle: i, startResize: s } = kt(() => l("cancel"), {
2652
+ initialWidth: n.initialWidth,
2653
+ initialHeight: n.initialHeight,
2654
+ minWidth: n.minWidth,
2655
+ minHeight: n.minHeight
2656
+ });
2657
+ return (f, m) => (c(), y("div", Jo, [
2658
+ t("div", {
2659
+ ref_key: "editorElement",
2660
+ ref: r,
2661
+ class: "content-editor",
2662
+ style: De(oe(i))
2663
+ }, [
2664
+ Ve(f.$slots, "default", {}, void 0, !0),
2665
+ t("div", Yo, [
2666
+ Ve(f.$slots, "actions", {}, () => [
2667
+ t("button", {
2668
+ class: "save-button",
2669
+ "data-testid": n.saveTestId || void 0,
2670
+ onClick: m[0] || (m[0] = (a) => l("save"))
2671
+ }, O(n.saveLabel), 9, Xo),
2672
+ t("button", {
2673
+ class: "cancel-button",
2674
+ onClick: m[1] || (m[1] = (a) => l("cancel"))
2675
+ }, "Cancel")
2676
+ ], !0)
2677
+ ]),
2678
+ J(St, { onStartResize: oe(s) }, null, 8, ["onStartResize"])
2679
+ ], 4)
2680
+ ]));
2681
+ }
2682
+ }), Je = /* @__PURE__ */ X(Zo, [["__scopeId", "data-v-580721a8"]]), ei = { class: "editor-body" }, ti = /* @__PURE__ */ Y({
2683
+ __name: "DashboardChartEditor",
2684
+ props: {
2685
+ content: {},
2686
+ connectionName: {},
2687
+ imports: {},
2688
+ rootContent: {},
2689
+ initialWidth: {},
2690
+ initialHeight: {}
2691
+ },
2692
+ emits: ["save", "cancel"],
2693
+ setup(e, { emit: o }) {
2694
+ const n = e, l = o, r = I(n.content), i = I(n.imports), s = I(null);
2695
+ function f() {
2696
+ s.value && l("save", s.value.getContent());
2697
+ }
2698
+ function m() {
2699
+ l("cancel");
2700
+ }
2701
+ return (a, p) => (c(), G(Je, {
2702
+ initialWidth: n.initialWidth,
2703
+ initialHeight: n.initialHeight,
2704
+ saveLabel: "Save Query",
2705
+ saveTestId: "save-dashboard-chart",
2706
+ onSave: f,
2707
+ onCancel: m
2708
+ }, {
2709
+ default: z(() => [
2710
+ t("div", ei, [
2711
+ J(ze, {
2712
+ class: "editor-content",
2713
+ initContent: r.value,
2714
+ connectionName: e.connectionName,
2715
+ imports: i.value,
2716
+ rootContent: e.rootContent,
2717
+ ref_key: "editor",
2718
+ ref: s
2719
+ }, null, 8, ["initContent", "connectionName", "imports", "rootContent"])
2720
+ ])
2721
+ ]),
2722
+ _: 1
2723
+ }, 8, ["initialWidth", "initialHeight"]));
2724
+ }
2725
+ }), Di = /* @__PURE__ */ X(ti, [["__scopeId", "data-v-9717eaff"]]), ni = { class: "tab-header" }, oi = { class: "editor-body" }, ii = {
2726
+ key: 0,
2727
+ class: "tab-content"
2728
+ }, ri = {
2729
+ key: 1,
2730
+ class: "tab-content"
2731
+ }, li = /* @__PURE__ */ Y({
2732
+ __name: "DashboardMarkdownEditor",
2733
+ props: {
2734
+ content: {},
2735
+ connectionName: {},
2736
+ imports: {},
2737
+ rootContent: {},
2738
+ initialWidth: {},
2739
+ initialHeight: {}
2740
+ },
2741
+ emits: ["save", "cancel"],
2742
+ setup(e, { emit: o }) {
2743
+ const n = e, l = o, r = g(() => typeof n.content == "string" ? { markdown: n.content, query: "" } : { markdown: n.content.markdown || "", query: n.content.query || "" }), i = I(r.value.markdown), s = I(r.value.query), f = I(n.imports), m = I(null), a = I("markdown");
2744
+ ae(
2745
+ () => n.content,
2746
+ (S) => {
2747
+ const h = typeof S == "string" ? { markdown: S, query: "" } : { markdown: S.markdown || "", query: S.query || "" };
2748
+ i.value = h.markdown, s.value = h.query;
2749
+ }
2750
+ ), ae(a, (S, h) => {
2751
+ h === "query" && m.value && (s.value = m.value.getContent());
2752
+ });
2753
+ function p() {
2754
+ a.value === "query" && m.value && (s.value = m.value.getContent()), l("save", {
2755
+ markdown: i.value,
2756
+ query: s.value
2757
+ });
2758
+ }
2759
+ function k() {
2760
+ l("cancel");
2761
+ }
2762
+ function b(S) {
2763
+ a.value === "query" && m.value && (s.value = m.value.getContent()), a.value = S;
2764
+ }
2765
+ function D(S, h = "") {
2766
+ const W = document.querySelector(".markdown-editor");
2767
+ if (!W) return;
2768
+ const C = W.selectionStart, v = W.selectionEnd, $ = i.value.substring(C, v), ee = i.value.substring(0, C), te = i.value.substring(v);
2769
+ i.value = ee + S + $ + h + te, setTimeout(() => {
2770
+ W.focus(), W.setSelectionRange(C + S.length, C + S.length + $.length);
2771
+ }, 0);
2772
+ }
2773
+ function q() {
2774
+ D("**", "**");
2775
+ }
2776
+ function E() {
2777
+ D("*", "*");
2778
+ }
2779
+ function A() {
2780
+ D("## ");
2781
+ }
2782
+ function T() {
2783
+ D("- ");
2784
+ }
2785
+ function Q() {
2786
+ D("[", "](url)");
2787
+ }
2788
+ function K() {
2789
+ D("{data[0].field_name}");
2790
+ }
2791
+ function B() {
2792
+ D(`{{#each data}}
2793
+ - {{field_name}}
2794
+ {{/each}}`);
2795
+ }
2796
+ return (S, h) => (c(), G(Je, {
2797
+ initialWidth: n.initialWidth,
2798
+ initialHeight: n.initialHeight,
2799
+ saveLabel: "Save Content",
2800
+ saveTestId: "save-dashboard-markdown",
2801
+ onSave: p,
2802
+ onCancel: k
2803
+ }, {
2804
+ default: z(() => [
2805
+ t("div", ni, [
2806
+ t("button", {
2807
+ onClick: h[0] || (h[0] = (W) => b("markdown")),
2808
+ class: R([{ active: a.value === "markdown" }, "tab-button"])
2809
+ }, [...h[3] || (h[3] = [
2810
+ t("i", { class: "mdi mdi-note-text-outline" }, null, -1),
2811
+ t("span", null, "Markdown Template", -1)
2812
+ ])], 2),
2813
+ t("button", {
2814
+ onClick: h[1] || (h[1] = (W) => b("query")),
2815
+ class: R([{ active: a.value === "query" }, "tab-button"])
2816
+ }, [...h[4] || (h[4] = [
2817
+ t("i", { class: "mdi mdi-magnify" }, null, -1),
2818
+ t("span", null, "Data Query", -1)
2819
+ ])], 2)
2820
+ ]),
2821
+ t("div", oi, [
2822
+ a.value === "markdown" ? (c(), y("div", ii, [
2823
+ t("div", { class: "markdown-toolbar" }, [
2824
+ t("button", {
2825
+ onClick: q,
2826
+ title: "Bold"
2827
+ }, [...h[5] || (h[5] = [
2828
+ t("strong", null, "B", -1)
2829
+ ])]),
2830
+ t("button", {
2831
+ onClick: E,
2832
+ title: "Italic"
2833
+ }, [...h[6] || (h[6] = [
2834
+ t("em", null, "I", -1)
2835
+ ])]),
2836
+ t("button", {
2837
+ onClick: A,
2838
+ title: "Heading"
2839
+ }, "H"),
2840
+ t("button", {
2841
+ onClick: T,
2842
+ title: "List"
2843
+ }, [...h[7] || (h[7] = [
2844
+ t("i", { class: "mdi mdi-format-list-bulleted" }, null, -1)
2845
+ ])]),
2846
+ t("button", {
2847
+ onClick: Q,
2848
+ title: "Link"
2849
+ }, [...h[8] || (h[8] = [
2850
+ t("i", { class: "mdi mdi-link-variant" }, null, -1)
2851
+ ])]),
2852
+ h[10] || (h[10] = t("div", { class: "toolbar-separator" }, null, -1)),
2853
+ t("button", {
2854
+ onClick: K,
2855
+ title: "Insert data reference",
2856
+ class: "data-button"
2857
+ }, " {} "),
2858
+ t("button", {
2859
+ onClick: B,
2860
+ title: "Insert loop",
2861
+ class: "data-button"
2862
+ }, [...h[9] || (h[9] = [
2863
+ t("i", { class: "mdi mdi-refresh" }, null, -1)
2864
+ ])])
2865
+ ]),
2866
+ se(t("textarea", {
2867
+ "onUpdate:modelValue": h[2] || (h[2] = (W) => i.value = W),
2868
+ placeholder: `Enter markdown content here...
2869
+
2870
+ Template examples:
2871
+ - {field_name} - First row value
2872
+ - {data[0].field_name} - Specific row
2873
+ - {data.length} - Total rows
2874
+ - {{#each data}} {{field_name}} {{/each}} - Loop all
2875
+ - {{#each data limit=5}} {{field_name}} {{/each}} - Loop first 5`,
2876
+ class: "markdown-editor"
2877
+ }, null, 512), [
2878
+ [ve, i.value]
2879
+ ])
2880
+ ])) : M("", !0),
2881
+ a.value === "query" ? (c(), y("div", ri, [
2882
+ h[11] || (h[11] = t("div", { class: "query-help" }, [
2883
+ t("p", null, " Write a query to fetch data for your markdown template. Leave empty if no data is needed. ")
2884
+ ], -1)),
2885
+ J(ze, {
2886
+ class: "editor-content",
2887
+ initContent: s.value,
2888
+ connectionName: e.connectionName,
2889
+ imports: f.value,
2890
+ rootContent: e.rootContent,
2891
+ ref_key: "editor",
2892
+ ref: m
2893
+ }, null, 8, ["initContent", "connectionName", "imports", "rootContent"])
2894
+ ])) : M("", !0)
2895
+ ])
2896
+ ]),
2897
+ _: 1
2898
+ }, 8, ["initialWidth", "initialHeight"]));
2899
+ }
2900
+ }), Ii = /* @__PURE__ */ X(li, [["__scopeId", "data-v-d2f32030"]]), ai = { class: "dashboard-setup" }, si = { class: "setup-section" }, di = {
2901
+ key: 0,
2902
+ class: "setup-section"
2903
+ }, ui = { class: "action-row" }, ci = ["disabled"], mi = {
2904
+ key: 0,
2905
+ class: "error-message"
2906
+ }, hi = { class: "setup-section" }, fi = { class: "templates-grid" }, vi = ["onClick", "data-testid"], pi = { class: "template-icon" }, yi = { class: "template-info" }, gi = { class: "template-title" }, bi = { class: "template-desc" }, V = 20, Ti = /* @__PURE__ */ Y({
2907
+ __name: "DashboardCTA",
2908
+ props: {
2909
+ dashboardId: {}
2910
+ },
2911
+ emits: ["template-selected", "description-updated"],
2912
+ setup(e, { emit: o }) {
2913
+ const n = _("dashboardStore"), l = _("editorStore"), r = _("llmConnectionStore"), i = _(
2914
+ "queryExecutionService"
2915
+ ), s = _("saveDashboards");
2916
+ if (!n || !r || !i || !s)
2917
+ throw new Error("DashboardStore, LLMConnectionStore, or QueryExecutionService not provided");
2918
+ const f = e, m = g(() => r.activeConnection), a = o, p = I(""), k = I(""), b = I(!1), D = I(""), q = I(null), E = V / 4, A = [
2919
+ {
2920
+ id: "summary",
2921
+ name: "Summary Dashboard",
2922
+ description: "High-level metrics and KPIs with key visualizations",
2923
+ icon: "mdi-view-dashboard",
2924
+ layout: [
2925
+ { i: "title", x: 0, y: 0, w: V, h: 3, type: w.MARKDOWN },
2926
+ { i: "kpi1", x: 0, y: 3, w: V / 4, h: 4, type: w.CHART },
2927
+ { i: "kpi2", x: E, y: 3, w: V / 4, h: 4, type: w.CHART },
2928
+ { i: "kpi3", x: E * 2, y: 3, w: V / 4, h: 4, type: w.CHART },
2929
+ { i: "kpi4", x: E * 3, y: 3, w: V / 4, h: 4, type: w.CHART },
2930
+ { i: "trend", x: 0, y: 7, w: V / 2, h: 8, type: w.CHART },
2931
+ { i: "breakdown", x: V / 2, y: 7, w: V / 2, h: 8, type: w.CHART }
2932
+ ]
2933
+ },
2934
+ {
2935
+ id: "drilldown",
2936
+ name: "Drill-Down Analysis",
2937
+ description: "Hierarchical data exploration with filtering capabilities",
2938
+ icon: "mdi-magnify-expand",
2939
+ layout: [
2940
+ { i: "filters", x: 0, y: 0, w: V, h: 3, type: w.MARKDOWN },
2941
+ { i: "overview", x: 0, y: 3, w: V, h: 5, type: w.CHART },
2942
+ { i: "detail1", x: 0, y: 8, w: V / 2, h: 8, type: w.CHART },
2943
+ { i: "detail2", x: V / 2, y: 10, w: V / 2, h: 8, type: w.CHART },
2944
+ { i: "datatable", x: 0, y: 20, w: V, h: 8, type: w.TABLE }
2945
+ ]
2946
+ },
2947
+ {
2948
+ id: "comparison",
2949
+ name: "Comparison Dashboard",
2950
+ description: "Side-by-side comparisons of metrics across dimensions",
2951
+ icon: "mdi-compare",
2952
+ layout: [
2953
+ { i: "title", x: 0, y: 0, w: V, h: 3, type: w.MARKDOWN },
2954
+ { i: "compare1", x: 0, y: 3, w: V / 2, h: 6, type: w.CHART },
2955
+ { i: "compare2", x: V / 2, y: 3, w: V / 2, h: 6, type: w.CHART },
2956
+ { i: "compare3", x: 0, y: 9, w: V / 2, h: 6, type: w.CHART },
2957
+ { i: "compare4", x: V / 2, y: 9, w: V / 2, h: 6, type: w.CHART },
2958
+ { i: "summary", x: 0, y: 15, w: V, h: 5, type: w.MARKDOWN }
2959
+ ]
2960
+ },
2961
+ {
2962
+ id: "trends",
2963
+ name: "Time Series Analysis",
2964
+ description: "Visualization of trends and patterns over time",
2965
+ icon: "mdi-chart-timeline-variant",
2966
+ layout: [
2967
+ { i: "headline", x: 0, y: 0, w: V, h: 3, type: w.MARKDOWN },
2968
+ { i: "maintrend", x: 0, y: 3, w: V, h: 8, type: w.CHART },
2969
+ { i: "breakdown1", x: 0, y: 11, w: V / 3, h: 6, type: w.CHART },
2970
+ { i: "breakdown2", x: V / 3, y: 11, w: V / 3, h: 6, type: w.CHART },
2971
+ { i: "breakdown3", x: V / 3 * 2, y: 11, w: V / 3, h: 6, type: w.CHART },
2972
+ { i: "forecast", x: 0, y: 17, w: V, h: 6, type: w.CHART }
2973
+ ]
2974
+ }
2975
+ // {
2976
+ // id: 'custom',
2977
+ // name: 'Start from Scratch',
2978
+ // description: 'Build your dashboard completely from scratch',
2979
+ // icon: 'mdi-pencil-outline',
2980
+ // layout: []
2981
+ // }
2982
+ ];
2983
+ function T(B) {
2984
+ q.value = B;
2985
+ const S = A.find((h) => h.id === B);
2986
+ if (S && f.dashboardId) {
2987
+ for (const h of S.layout)
2988
+ n.addItemToDashboard(
2989
+ f.dashboardId,
2990
+ h.type,
2991
+ h.x,
2992
+ h.y,
2993
+ h.w,
2994
+ h.h
2995
+ );
2996
+ a("template-selected", B);
2997
+ }
2998
+ }
2999
+ function Q() {
3000
+ f.dashboardId && p.value && (n.updateDashboardDescription(f.dashboardId, p.value), a("description-updated", p.value));
3001
+ }
3002
+ async function K() {
3003
+ if (!k.value.trim()) {
3004
+ D.value = "Please provide a prompt for the dashboard generation.";
3005
+ return;
3006
+ }
3007
+ try {
3008
+ b.value = !0, D.value = "";
3009
+ const B = await n.generatePromptSpec(
3010
+ k.value,
3011
+ r,
3012
+ i,
3013
+ l
3014
+ );
3015
+ console.log("Prompt spec generated:", B), B ? (await n.populateFromPromptSpec(
3016
+ f.dashboardId,
3017
+ B,
3018
+ r,
3019
+ i,
3020
+ l
3021
+ ), !p.value && B.description && (p.value = B.description, Q()), s()) : D.value = "Failed to generate dashboard specification.";
3022
+ } catch (B) {
3023
+ console.error("Error generating dashboard with LLM:", B), D.value = "An error occurred while generating the dashboard.";
3024
+ } finally {
3025
+ b.value = !1;
3026
+ }
3027
+ }
3028
+ return (B, S) => (c(), y("div", ai, [
3029
+ S[7] || (S[7] = t("div", { class: "setup-header" }, [
3030
+ t("h2", { class: "setup-title" }, "An Empty Dashboard"),
3031
+ t("p", { class: "setup-subtitle" }, " Choose a template or start from scratch by using the 'add item' button to add charts, tables, and more. ")
3032
+ ], -1)),
3033
+ t("div", si, [
3034
+ S[3] || (S[3] = t("h3", { class: "section-title" }, "Description", -1)),
3035
+ se(t("textarea", {
3036
+ "onUpdate:modelValue": S[0] || (S[0] = (h) => p.value = h),
3037
+ placeholder: "What is this dashboard for? Add context to help viewers understand the data...",
3038
+ rows: "3",
3039
+ class: "description-input"
3040
+ }, null, 512), [
3041
+ [ve, p.value]
3042
+ ]),
3043
+ t("button", {
3044
+ onClick: Q,
3045
+ class: "action-button save-button",
3046
+ "data-testid": "dashboard-description-save"
3047
+ }, [...S[2] || (S[2] = [
3048
+ t("i", { class: "mdi mdi-content-save" }, null, -1),
3049
+ ne(" Save ", -1)
3050
+ ])])
3051
+ ]),
3052
+ m.value ? (c(), y("div", di, [
3053
+ S[4] || (S[4] = t("h3", { class: "section-title" }, "AI Copilot", -1)),
3054
+ S[5] || (S[5] = t("p", { class: "section-desc" }, " Let AI help build your dashboard based on your data and description ", -1)),
3055
+ se(t("textarea", {
3056
+ "onUpdate:modelValue": S[1] || (S[1] = (h) => k.value = h),
3057
+ placeholder: "Describe the dashboard you want to create. For example: 'Create a sales performance dashboard with monthly trends, regional breakdown, and top product metrics.'",
3058
+ rows: "4",
3059
+ class: "description-input",
3060
+ "data-testid": "dashboard-prompt-input"
3061
+ }, null, 512), [
3062
+ [ve, k.value]
3063
+ ]),
3064
+ t("div", ui, [
3065
+ t("button", {
3066
+ onClick: K,
3067
+ class: "action-button llm-button",
3068
+ disabled: b.value || !k.value.trim(),
3069
+ "data-testid": "generate-with-llm-button"
3070
+ }, [
3071
+ t("i", {
3072
+ class: R(["mdi", b.value ? "mdi-loading mdi-spin" : "mdi-creation"])
3073
+ }, null, 2),
3074
+ ne(" " + O(b.value ? "Generating..." : "Generate with AI"), 1)
3075
+ ], 8, ci),
3076
+ D.value ? (c(), y("div", mi, O(D.value), 1)) : M("", !0)
3077
+ ])
3078
+ ])) : M("", !0),
3079
+ t("div", hi, [
3080
+ S[6] || (S[6] = t("h3", { class: "section-title" }, "Templates", -1)),
3081
+ t("div", fi, [
3082
+ (c(), y(ce, null, be(A, (h) => t("div", {
3083
+ key: h.id,
3084
+ class: R(["template-card", { selected: q.value === h.id }]),
3085
+ onClick: (W) => T(h.id),
3086
+ "data-testid": `template-card-${h.id}`
3087
+ }, [
3088
+ t("div", pi, [
3089
+ t("i", {
3090
+ class: R(["mdi", h.icon])
3091
+ }, null, 2)
3092
+ ]),
3093
+ t("div", yi, [
3094
+ t("h4", gi, O(h.name), 1),
3095
+ t("p", bi, O(h.description), 1)
3096
+ ])
3097
+ ], 10, vi)), 64))
3098
+ ])
3099
+ ])
3100
+ ]));
3101
+ }
3102
+ });
3103
+ function $i(e, o, n, l) {
3104
+ const r = Et(), i = je();
3105
+ let s = _("queryExecutionService");
3106
+ const f = Ue(), { setActiveDashboard: m } = Ge();
3107
+ if (!s)
3108
+ throw new Error("QueryExecutionService not provided");
3109
+ const a = I(""), p = I(""), k = I(""), b = I(null), D = I(null), q = I(!1), E = I(!1), A = I(!1), T = I([]), Q = g(() => o.maxWidth || "100vw"), K = g(() => e.value ? e.value.layout : []), B = g(() => e.value ? [...e.value.layout].sort((u, L) => (u.y + u.y + u.h) / 2 - (L.y + L.y + L.h) / 2) : []), S = g(() => e.value ? e.value.connection : ""), h = g(() => o.viewMode ? !1 : e.value ? e.value.state === "editing" : !1), W = g(() => e.value ? e.value.imports.map((u) => {
3110
+ var L, d;
3111
+ return {
3112
+ alias: u.name,
3113
+ // legacy handling
3114
+ contents: ((L = i.editors[u.id]) == null ? void 0 : L.contents) || ((d = i.editors[u.name]) == null ? void 0 : d.contents) || ""
3115
+ };
3116
+ }) : []);
3117
+ function C(u) {
3118
+ if (!(u != null && u.id)) return;
3119
+ u.state === "fullscreen" && n.fullScreen(!0), r.setActiveDashboard(u.id), k.value = "", a.value = "", p.value = "", T.value = [], u.filter && (a.value = u.filter, p.value = u.filter);
3120
+ const L = Ae(u.id), d = Object.keys(u.gridItems).filter(
3121
+ (H) => u.gridItems[H].type !== w.SECTION_HEADER && !u.gridItems[H].results
3122
+ );
3123
+ L == null || L.runBatch(d), te();
3124
+ }
3125
+ ae(
3126
+ () => {
3127
+ var u;
3128
+ return (u = e.value) == null ? void 0 : u.id;
3129
+ },
3130
+ (u, L) => {
3131
+ u && u !== L && e.value && C(e.value);
3132
+ }
3133
+ ), Ke(() => {
3134
+ e.value && C(e.value);
3135
+ const u = new ResizeObserver(() => {
3136
+ n.triggerResize();
3137
+ }), L = o.isMobile ? ".mobile-container" : ".grid-container", d = document.querySelector(L);
3138
+ d && u.observe(d);
3139
+ }), dt(() => {
3140
+ b.value !== null && clearTimeout(b.value);
3141
+ });
3142
+ async function v() {
3143
+ var u;
3144
+ if (e.value && e.value.id) {
3145
+ a.value = "", p.value = "", k.value = "";
3146
+ let L = r.removeAllFilters(e.value.id);
3147
+ await ((u = r.getQueryExecutor(e.value.id)) == null ? void 0 : u.runBatch(L));
3148
+ }
3149
+ }
3150
+ async function $(u) {
3151
+ var L;
3152
+ if (!u || Ne(u) === "") {
3153
+ if (k.value = "", e.value && e.value.id) {
3154
+ let d = r.updateDashboardFilter(
3155
+ e.value.id,
3156
+ Ne(u)
3157
+ );
3158
+ await ((L = r.getQueryExecutor(e.value.id)) == null ? void 0 : L.runBatch(d));
3159
+ }
3160
+ return;
3161
+ }
3162
+ e.value && e.value.id && (a.value = u, await (s == null ? void 0 : s.generateQuery(e.value.connection, {
3163
+ text: "select 1 as test;",
3164
+ editorType: "trilogy",
3165
+ extraFilters: [u],
3166
+ imports: e.value.imports,
3167
+ extraContent: W.value
3168
+ }).then(() => {
3169
+ var d;
3170
+ if (k.value = "", e.value && e.value.id) {
3171
+ let H = r.updateDashboardFilter(e.value.id, u);
3172
+ (d = r.getQueryExecutor(e.value.id)) == null || d.runBatch(H);
3173
+ }
3174
+ }).catch((d) => (k.value = d.message, !1))));
3175
+ }
3176
+ const ee = async (u) => {
3177
+ let L = u.replace(/^\s*where\s+/i, "");
3178
+ if (e.value && e.value.id) {
3179
+ let d = await (s == null ? void 0 : s.executeQuery(
3180
+ e.value.connection,
3181
+ {
3182
+ text: "select 1 as test;",
3183
+ editorType: "trilogy",
3184
+ imports: e.value.imports,
3185
+ extraFilters: [L],
3186
+ extraContent: W.value
3187
+ },
3188
+ () => {
3189
+ },
3190
+ () => {
3191
+ },
3192
+ () => {
3193
+ },
3194
+ () => {
3195
+ },
3196
+ !0
3197
+ ));
3198
+ if (!d)
3199
+ throw new Error("No promises returned from query execution service");
3200
+ let H = await d.resultPromise;
3201
+ if (!H.success)
3202
+ throw new Error(
3203
+ `Validation of "select 1 as test ${L}" resulted in ${H.error}`
3204
+ );
3205
+ } else
3206
+ throw new Error("Dashboard not found");
3207
+ };
3208
+ async function te() {
3209
+ if (e.value && e.value.id && s) {
3210
+ let u = await r.populateCompletion(
3211
+ e.value.id,
3212
+ s,
3213
+ i
3214
+ );
3215
+ u && (T.value = u), k.value = "";
3216
+ }
3217
+ }
3218
+ async function U(u) {
3219
+ e.value && e.value.id && (r.updateDashboardImports(e.value.id, u), await te());
3220
+ }
3221
+ const Ce = (u) => {
3222
+ e.value && (r.setState(e.value.id, u), Qe(() => {
3223
+ n.triggerResize();
3224
+ }));
3225
+ }, me = (u) => {
3226
+ e.value && e.value.id && r.updateDashboardLayout(e.value.id, u);
3227
+ };
3228
+ function j() {
3229
+ A.value = !0;
3230
+ }
3231
+ function N(u = w.CHART) {
3232
+ if (!e.value || !e.value.id) return;
3233
+ const L = u === w.SECTION_HEADER ? r.addItemToDashboard(e.value.id, u, 0, 0, 20, 1) : r.addItemToDashboard(e.value.id, u);
3234
+ A.value = !1, Qe(() => {
3235
+ n.dimensionsUpdate(L);
3236
+ });
3237
+ }
3238
+ function F(u) {
3239
+ !e.value || !e.value.id || r.updateDashboardTitle(e.value.id, u);
3240
+ }
3241
+ function P() {
3242
+ !e.value || !e.value.id || r.clearDashboardItems(e.value.id);
3243
+ }
3244
+ function he(u) {
3245
+ !e.value || !e.value.id || r.removeItemFromDashboard(e.value.id, u);
3246
+ }
3247
+ function we(u) {
3248
+ !e.value || !e.value.id || r.copyItemInDashboard(e.value.id, u);
3249
+ }
3250
+ function ke() {
3251
+ A.value = !1;
3252
+ }
3253
+ function Ye(u) {
3254
+ if (D.value = u, !e.value || !e.value.id) return;
3255
+ const d = e.value.gridItems[u.i];
3256
+ d && (d.type === w.CHART ? q.value = !0 : d.type === w.MARKDOWN ? E.value = !0 : d.type === w.TABLE || d.type === w.FILTER ? q.value = !0 : d.type === w.SECTION_HEADER && (D.value = null));
3257
+ }
3258
+ function Xe(u) {
3259
+ if (!e.value || !e.value.id || !D.value) return;
3260
+ const L = D.value.i;
3261
+ Me(L, e.value.id, { content: u }), Re();
3262
+ }
3263
+ function Re() {
3264
+ q.value = !1, E.value = !1, D.value = null;
3265
+ }
3266
+ function Fe(u, L) {
3267
+ if (L && e.value && e.value.id !== L)
3268
+ return {
3269
+ type: w.CHART,
3270
+ content: "",
3271
+ structured_content: { markdown: "", query: "" },
3272
+ name: `Item ${u}`,
3273
+ allowCrossFilter: !0,
3274
+ width: 0,
3275
+ height: 0,
3276
+ imports: [],
3277
+ filters: [],
3278
+ rootContent: [],
3279
+ hasDrilldown: !1
3280
+ };
3281
+ if (!e.value)
3282
+ return {
3283
+ type: w.CHART,
3284
+ content: "",
3285
+ structured_content: { markdown: "", query: "" },
3286
+ name: `Item ${u}`,
3287
+ allowCrossFilter: !0,
3288
+ width: 0,
3289
+ height: 0,
3290
+ imports: [],
3291
+ filters: [],
3292
+ rootContent: [],
3293
+ hasDrilldown: !1
3294
+ };
3295
+ const d = e.value.gridItems[u];
3296
+ if (!d)
3297
+ return {
3298
+ type: w.CHART,
3299
+ content: "",
3300
+ structured_content: { markdown: "", query: "" },
3301
+ name: `Item ${u}`,
3302
+ allowCrossFilter: !0,
3303
+ width: 0,
3304
+ height: 0,
3305
+ imports: e.value.imports,
3306
+ filters: [],
3307
+ rootContent: [],
3308
+ connectionName: e.value.connection || "",
3309
+ hasDrilldown: !1
3310
+ };
3311
+ const H = d.filters || [];
3312
+ let ie = H;
3313
+ e.value.filter && (H.some(
3314
+ (xe) => {
3315
+ var He;
3316
+ return xe.source === "global" && xe.value === ((He = e.value) == null ? void 0 : He.filter);
3317
+ }
3318
+ ) || (ie = [{ value: e.value.filter, source: "global" }, ...H]));
3319
+ function de(re) {
3320
+ return re && typeof re == "object" && typeof re.markdown == "string" && typeof re.query == "string";
3321
+ }
3322
+ let pe = !1, Se = de(d.content) ? d.content : {
3323
+ markdown: d.type === "markdown" ? d.content : "",
3324
+ query: d.type !== "markdown" ? d.content : ""
3325
+ };
3326
+ d.drilldown && (pe = !0, Se = de(d.drilldown) ? d.drilldown : {
3327
+ markdown: d.type === "markdown" ? d.drilldown : "",
3328
+ query: d.type !== "markdown" ? d.drilldown : ""
3329
+ });
3330
+ let ye = d.chartConfig;
3331
+ return pe && (ye = d.drilldownChartConfig || void 0), {
3332
+ type: d.type,
3333
+ // check if it's MarkdownData, and if so, extract markdown
3334
+ //
3335
+ content: de(d.content) ? d.content.markdown : d.content || "",
3336
+ // display the drilldown of set
3337
+ structured_content: Se,
3338
+ name: d.name,
3339
+ allowCrossFilter: d.allowCrossFilter !== !1,
3340
+ // Default to true if not explicitly false
3341
+ width: d.width || 0,
3342
+ height: d.height || 0,
3343
+ chartConfig: ye,
3344
+ filters: ie,
3345
+ chartFilters: d.chartFilters || [],
3346
+ conceptFilters: d.conceptFilters || [],
3347
+ parameters: d.parameters || {},
3348
+ onRefresh: qe,
3349
+ rootContent: W.value,
3350
+ results: d.results || null,
3351
+ connectionName: e.value.connection || "",
3352
+ imports: e.value.imports,
3353
+ error: d.error || "",
3354
+ loading: d.loading || !1,
3355
+ loadStartTime: d.loadStartTime || null,
3356
+ // Include load start time if available
3357
+ hasDrilldown: pe
3358
+ };
3359
+ }
3360
+ function Me(u, L, d) {
3361
+ if (!e.value || !e.value.id) return;
3362
+ if (!L || e.value.id !== L) {
3363
+ console.warn(
3364
+ "Dashboard ID mismatch. Cannot set item data. Given:",
3365
+ L,
3366
+ "Expected:",
3367
+ e.value.id
3368
+ );
3369
+ return;
3370
+ }
3371
+ const H = {};
3372
+ if (d.name && (H.name = d.name), d.chartConfig && (H.chartConfig = d.chartConfig), d.content && (H.content = d.content), d.dimensions && (H.layoutDimensions = {
3373
+ w: d.dimensions.width,
3374
+ h: d.dimensions.height
3375
+ }), d.width && d.height && (H.width = d.width, H.height = d.height), d.loading !== void 0 && (H.loading = d.loading), d.results !== void 0 && (H.results = d.results), d.error !== void 0 && (H.error = d.error), d.drilldown !== void 0 && (H.drilldown = d.drilldown), d.drilldownChartConfig !== void 0 && (H.drilldownChartConfig = d.drilldownChartConfig), d.allowCrossFilter !== void 0 && (H.allowCrossFilter = d.allowCrossFilter), Object.keys(H).length > 0 && r.updateMultipleItemProperties(e.value.id, u, H), d.content) {
3376
+ let ie = Ae(e.value.id);
3377
+ ie == null || ie.runSingle(u);
3378
+ }
3379
+ }
3380
+ function Ae(u) {
3381
+ if (!e.value || !e.value.id)
3382
+ throw new Error("Dashboard not found or not initialized");
3383
+ if (!s) throw new Error("Query execution service not found");
3384
+ if (!f) throw new Error("Connection store not found");
3385
+ let L = r.dashboards[u];
3386
+ const d = r.getOrCreateQueryExecutor(u, {
3387
+ queryExecutionService: s,
3388
+ connectionStore: f,
3389
+ editorStore: i,
3390
+ connectionName: L.connection,
3391
+ dashboardId: u,
3392
+ getDashboardData: (H) => r.dashboards[H],
3393
+ getItemData: Fe,
3394
+ setItemData: Me
3395
+ });
3396
+ return d || console.warn("No query executor found for dashboard:", e.value.id), d;
3397
+ }
3398
+ function Ze(u) {
3399
+ var H;
3400
+ const d = u.target.value;
3401
+ e.value && e.value.id && (r.updateDashboardConnection(e.value.id, d), (H = r.getQueryExecutor(e.value.id)) == null || H.setConnection(d));
3402
+ }
3403
+ function qe(u) {
3404
+ var L, d;
3405
+ if (e.value) {
3406
+ if (u) {
3407
+ (L = r.getQueryExecutor(e.value.id)) == null || L.runSingle(u), n.dimensionsUpdate(u);
3408
+ return;
3409
+ }
3410
+ (d = r.getQueryExecutor(e.value.id)) == null || d.runBatch(Object.keys(e.value.gridItems));
3411
+ }
3412
+ }
3413
+ function et(u) {
3414
+ var ie;
3415
+ if (!e.value || !e.value.id) return;
3416
+ let L = T.value.map((de) => de.label);
3417
+ const d = Object.entries(u.filters).reduce(
3418
+ (de, [pe, Se]) => {
3419
+ let ye = pe, re = null;
3420
+ return ye.startsWith("local.") && (re = ye.replace("local.", "")), (L.includes(ye) || re && L.includes(re)) && (de[pe] = Se), de;
3421
+ },
3422
+ {}
3423
+ );
3424
+ if (!d || Object.keys(d).length === 0) {
3425
+ console.log("No valid filters to apply from cross-filter event, given ", u.filters);
3426
+ return;
3427
+ }
3428
+ let H = r.updateItemCrossFilters(
3429
+ e.value.id,
3430
+ u.source,
3431
+ d,
3432
+ u.chart,
3433
+ u.append ? "append" : "add"
3434
+ );
3435
+ (ie = r.getQueryExecutor(e.value.id)) == null || ie.runBatch(H);
3436
+ }
3437
+ function tt(u, L) {
3438
+ var d;
3439
+ !e.value || !e.value.id || (r.removeItemCrossFilter(e.value.id, u, L), (d = r.getQueryExecutor(e.value.id)) == null || d.runSingle(u));
3440
+ }
3441
+ function nt(u) {
3442
+ var d;
3443
+ if (!e.value || !e.value.id) return;
3444
+ let L = r.removeItemCrossFilterSource(e.value.id, u);
3445
+ (d = r.getQueryExecutor(e.value.id)) == null || d.runBatch(L);
3446
+ }
3447
+ function ot(u) {
3448
+ m(u);
3449
+ }
3450
+ return {
3451
+ // State
3452
+ dashboard: e,
3453
+ layout: K,
3454
+ sortedLayout: B,
3455
+ editMode: h,
3456
+ selectedConnection: S,
3457
+ filter: a,
3458
+ filterError: k,
3459
+ globalCompletion: T,
3460
+ showAddItemModal: A,
3461
+ showQueryEditor: q,
3462
+ showMarkdownEditor: E,
3463
+ editingItem: D,
3464
+ dashboardMaxWidth: Q,
3465
+ rootContent: W,
3466
+ // Methods
3467
+ handleFilterChange: $,
3468
+ handleFilterClear: v,
3469
+ handleImportChange: U,
3470
+ validateFilter: ee,
3471
+ onConnectionChange: Ze,
3472
+ toggleMode: Ce,
3473
+ onLayoutUpdated: me,
3474
+ openAddItemModal: j,
3475
+ addItem: N,
3476
+ clearItems: P,
3477
+ removeItem: he,
3478
+ copyItem: we,
3479
+ closeAddModal: ke,
3480
+ openEditor: Ye,
3481
+ saveContent: Xe,
3482
+ closeEditors: Re,
3483
+ getDashboardQueryExecutor: Ae,
3484
+ getItemData: Fe,
3485
+ setItemData: Me,
3486
+ handleRefresh: qe,
3487
+ setCrossFilter: et,
3488
+ removeFilter: tt,
3489
+ unSelect: nt,
3490
+ dashboardCreated: ot,
3491
+ updateTitle: F
3492
+ };
3493
+ }
3494
+ export {
3495
+ Di as C,
3496
+ ki as D,
3497
+ Ii as M,
3498
+ Ti as _,
3499
+ Si as a,
3500
+ Ei as b,
3501
+ $i as u
3502
+ };