@vertesia/ui 1.0.0-dev.20260227.112605Z → 1.0.0

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 (783) hide show
  1. package/lib/esm/core/components/SelectList.js +3 -1
  2. package/lib/esm/core/components/SelectList.js.map +1 -1
  3. package/lib/esm/core/components/SidePanel.js +2 -2
  4. package/lib/esm/core/components/SidePanel.js.map +1 -1
  5. package/lib/esm/core/components/index.js +0 -5
  6. package/lib/esm/core/components/index.js.map +1 -1
  7. package/lib/esm/core/components/shadcn/breadcrumb.js +11 -7
  8. package/lib/esm/core/components/shadcn/breadcrumb.js.map +1 -1
  9. package/lib/esm/core/components/shadcn/button.js +5 -3
  10. package/lib/esm/core/components/shadcn/button.js.map +1 -1
  11. package/lib/esm/core/components/shadcn/collaspible.js +14 -0
  12. package/lib/esm/core/components/shadcn/collaspible.js.map +1 -0
  13. package/lib/esm/core/components/shadcn/dropdown.js +61 -0
  14. package/lib/esm/core/components/shadcn/dropdown.js.map +1 -0
  15. package/lib/esm/core/components/shadcn/filters/comboBox/DateCombobox.js +3 -1
  16. package/lib/esm/core/components/shadcn/filters/comboBox/DateCombobox.js.map +1 -1
  17. package/lib/esm/core/components/shadcn/filters/comboBox/SelectCombobox.js +3 -1
  18. package/lib/esm/core/components/shadcn/filters/comboBox/SelectCombobox.js.map +1 -1
  19. package/lib/esm/core/components/shadcn/filters/comboBox/StringListCombobox.js +1 -1
  20. package/lib/esm/core/components/shadcn/filters/comboBox/StringListCombobox.js.map +1 -1
  21. package/lib/esm/core/components/shadcn/filters/filter/StringListFilter.js +1 -1
  22. package/lib/esm/core/components/shadcn/filters/filter/StringListFilter.js.map +1 -1
  23. package/lib/esm/core/components/shadcn/filters/filter/dateFilter.js +4 -2
  24. package/lib/esm/core/components/shadcn/filters/filter/dateFilter.js.map +1 -1
  25. package/lib/esm/core/components/shadcn/filters/filterBar.js +7 -4
  26. package/lib/esm/core/components/shadcn/filters/filterBar.js.map +1 -1
  27. package/lib/esm/core/components/shadcn/index.js +4 -0
  28. package/lib/esm/core/components/shadcn/index.js.map +1 -1
  29. package/lib/esm/core/components/shadcn/modal/ConfirmModal.js +4 -2
  30. package/lib/esm/core/components/shadcn/modal/ConfirmModal.js.map +1 -1
  31. package/lib/esm/core/components/shadcn/modal/DeleteModal.js +5 -3
  32. package/lib/esm/core/components/shadcn/modal/DeleteModal.js.map +1 -1
  33. package/lib/esm/core/components/shadcn/popover.js +11 -7
  34. package/lib/esm/core/components/shadcn/popover.js.map +1 -1
  35. package/lib/esm/core/components/shadcn/radioGroup.js +29 -0
  36. package/lib/esm/core/components/shadcn/radioGroup.js.map +1 -0
  37. package/lib/esm/core/components/shadcn/selectBox.js +1 -1
  38. package/lib/esm/core/components/shadcn/switch.js +19 -0
  39. package/lib/esm/core/components/shadcn/switch.js.map +1 -0
  40. package/lib/esm/core/components/shadcn/tabs.js +6 -6
  41. package/lib/esm/core/components/shadcn/tabs.js.map +1 -1
  42. package/lib/esm/core/components/shadcn/theme/ThemeSwitcher.js +8 -6
  43. package/lib/esm/core/components/shadcn/theme/ThemeSwitcher.js.map +1 -1
  44. package/lib/esm/core/components/shadcn/tooltip.js +1 -1
  45. package/lib/esm/core/components/shadcn/tooltip.js.map +1 -1
  46. package/lib/esm/core/components/toast/NotificationPanel.js +3 -3
  47. package/lib/esm/core/components/toast/NotificationPanel.js.map +1 -1
  48. package/lib/esm/env/index.js +11 -1
  49. package/lib/esm/env/index.js.map +1 -1
  50. package/lib/esm/features/agent/PayloadBuilder.js +87 -15
  51. package/lib/esm/features/agent/PayloadBuilder.js.map +1 -1
  52. package/lib/esm/features/agent/chat/AgentRightPanel.js +159 -0
  53. package/lib/esm/features/agent/chat/AgentRightPanel.js.map +1 -0
  54. package/lib/esm/features/agent/chat/ArtifactsTab.js +69 -0
  55. package/lib/esm/features/agent/chat/ArtifactsTab.js.map +1 -0
  56. package/lib/esm/features/agent/chat/AskUserWidget.js +12 -6
  57. package/lib/esm/features/agent/chat/AskUserWidget.js.map +1 -1
  58. package/lib/esm/features/agent/chat/DocumentPanel.js +6 -3
  59. package/lib/esm/features/agent/chat/DocumentPanel.js.map +1 -1
  60. package/lib/esm/features/agent/chat/ImageLightbox.js +3 -1
  61. package/lib/esm/features/agent/chat/ImageLightbox.js.map +1 -1
  62. package/lib/esm/features/agent/chat/ModernAgentConversation.js +243 -106
  63. package/lib/esm/features/agent/chat/ModernAgentConversation.js.map +1 -1
  64. package/lib/esm/features/agent/chat/ModernAgentOutput/AllMessagesMixed.js +122 -52
  65. package/lib/esm/features/agent/chat/ModernAgentOutput/AllMessagesMixed.js.map +1 -1
  66. package/lib/esm/features/agent/chat/ModernAgentOutput/BatchProgressPanel.js +5 -3
  67. package/lib/esm/features/agent/chat/ModernAgentOutput/BatchProgressPanel.js.map +1 -1
  68. package/lib/esm/features/agent/chat/ModernAgentOutput/Header.js +57 -18
  69. package/lib/esm/features/agent/chat/ModernAgentOutput/Header.js.map +1 -1
  70. package/lib/esm/features/agent/chat/ModernAgentOutput/InlineSlidingPlanPanel.js +82 -83
  71. package/lib/esm/features/agent/chat/ModernAgentOutput/InlineSlidingPlanPanel.js.map +1 -1
  72. package/lib/esm/features/agent/chat/ModernAgentOutput/MessageInput.js +16 -14
  73. package/lib/esm/features/agent/chat/ModernAgentOutput/MessageInput.js.map +1 -1
  74. package/lib/esm/features/agent/chat/ModernAgentOutput/MessageItem.js +20 -5
  75. package/lib/esm/features/agent/chat/ModernAgentOutput/MessageItem.js.map +1 -1
  76. package/lib/esm/features/agent/chat/ModernAgentOutput/PlanPanel.js +8 -6
  77. package/lib/esm/features/agent/chat/ModernAgentOutput/PlanPanel.js.map +1 -1
  78. package/lib/esm/features/agent/chat/ModernAgentOutput/SlidingPlanPanel.js +12 -10
  79. package/lib/esm/features/agent/chat/ModernAgentOutput/SlidingPlanPanel.js.map +1 -1
  80. package/lib/esm/features/agent/chat/ModernAgentOutput/StreamingMessage.js +5 -3
  81. package/lib/esm/features/agent/chat/ModernAgentOutput/StreamingMessage.js.map +1 -1
  82. package/lib/esm/features/agent/chat/ModernAgentOutput/ToolCallGroup.js +104 -13
  83. package/lib/esm/features/agent/chat/ModernAgentOutput/ToolCallGroup.js.map +1 -1
  84. package/lib/esm/features/agent/chat/ModernAgentOutput/WorkstreamTabs.js +9 -5
  85. package/lib/esm/features/agent/chat/ModernAgentOutput/WorkstreamTabs.js.map +1 -1
  86. package/lib/esm/features/agent/chat/ModernAgentOutput/utils.js +160 -76
  87. package/lib/esm/features/agent/chat/ModernAgentOutput/utils.js.map +1 -1
  88. package/lib/esm/features/agent/chat/SlidingThinkingIndicator.js +3 -1
  89. package/lib/esm/features/agent/chat/SlidingThinkingIndicator.js.map +1 -1
  90. package/lib/esm/features/agent/chat/VegaLiteChart.js +14 -2
  91. package/lib/esm/features/agent/chat/VegaLiteChart.js.map +1 -1
  92. package/lib/esm/features/agent/chat/hooks/useAgentPlans.js +3 -8
  93. package/lib/esm/features/agent/chat/hooks/useAgentPlans.js.map +1 -1
  94. package/lib/esm/features/agent/chat/hooks/useAgentStream.js +75 -16
  95. package/lib/esm/features/agent/chat/hooks/useAgentStream.js.map +1 -1
  96. package/lib/esm/features/agent/chat/hooks/useArtifacts.js +108 -0
  97. package/lib/esm/features/agent/chat/hooks/useArtifacts.js.map +1 -0
  98. package/lib/esm/features/agent/chat/hooks/useDocumentPanel.js +56 -5
  99. package/lib/esm/features/agent/chat/hooks/useDocumentPanel.js.map +1 -1
  100. package/lib/esm/features/agent/chat/hooks/useFileProcessing.js +12 -10
  101. package/lib/esm/features/agent/chat/hooks/useFileProcessing.js.map +1 -1
  102. package/lib/esm/features/errors/PanelErrorBoundary.js +3 -1
  103. package/lib/esm/features/errors/PanelErrorBoundary.js.map +1 -1
  104. package/lib/esm/features/facets/AgentRunnerFacetsNav.js +45 -33
  105. package/lib/esm/features/facets/AgentRunnerFacetsNav.js.map +1 -1
  106. package/lib/esm/features/facets/RunsFacetsNav.js +1 -1
  107. package/lib/esm/features/facets/RunsFacetsNav.js.map +1 -1
  108. package/lib/esm/features/facets/index.js +1 -1
  109. package/lib/esm/features/facets/index.js.map +1 -1
  110. package/lib/esm/features/layout/GenericPageNavHeader.js +40 -28
  111. package/lib/esm/features/layout/GenericPageNavHeader.js.map +1 -1
  112. package/lib/esm/features/layout/NotFoundView.js +3 -1
  113. package/lib/esm/features/layout/NotFoundView.js.map +1 -1
  114. package/lib/esm/features/magic-pdf/AnnotatedImageSlider.js +9 -5
  115. package/lib/esm/features/magic-pdf/AnnotatedImageSlider.js.map +1 -1
  116. package/lib/esm/features/magic-pdf/DownloadPopover.js +5 -4
  117. package/lib/esm/features/magic-pdf/DownloadPopover.js.map +1 -1
  118. package/lib/esm/features/magic-pdf/MagicPdfView.js +8 -5
  119. package/lib/esm/features/magic-pdf/MagicPdfView.js.map +1 -1
  120. package/lib/esm/features/pdf-viewer/PdfPageSlider.js +9 -5
  121. package/lib/esm/features/pdf-viewer/PdfPageSlider.js.map +1 -1
  122. package/lib/esm/features/pdf-viewer/SimplePdfViewer.js +5 -3
  123. package/lib/esm/features/pdf-viewer/SimplePdfViewer.js.map +1 -1
  124. package/lib/esm/features/permissions/UserPermissionsProvider.js +3 -1
  125. package/lib/esm/features/permissions/UserPermissionsProvider.js.map +1 -1
  126. package/lib/esm/features/store/collections/BrowseCollectionView.js +9 -1
  127. package/lib/esm/features/store/collections/BrowseCollectionView.js.map +1 -1
  128. package/lib/esm/features/store/collections/CollectionsTable.js +14 -7
  129. package/lib/esm/features/store/collections/CollectionsTable.js.map +1 -1
  130. package/lib/esm/features/store/collections/CreateCollection.js +21 -18
  131. package/lib/esm/features/store/collections/CreateCollection.js.map +1 -1
  132. package/lib/esm/features/store/collections/EditCollectionView.js +23 -19
  133. package/lib/esm/features/store/collections/EditCollectionView.js.map +1 -1
  134. package/lib/esm/features/store/collections/SelectCollection.js +25 -10
  135. package/lib/esm/features/store/collections/SelectCollection.js.map +1 -1
  136. package/lib/esm/features/store/collections/SharedPropsEditor.js +5 -3
  137. package/lib/esm/features/store/collections/SharedPropsEditor.js.map +1 -1
  138. package/lib/esm/features/store/collections/SyncMemberHeadsToggle.js +5 -3
  139. package/lib/esm/features/store/collections/SyncMemberHeadsToggle.js.map +1 -1
  140. package/lib/esm/features/store/objects/DocumentPreviewPanel.js +14 -12
  141. package/lib/esm/features/store/objects/DocumentPreviewPanel.js.map +1 -1
  142. package/lib/esm/features/store/objects/DocumentSearchResults.js +15 -5
  143. package/lib/esm/features/store/objects/DocumentSearchResults.js.map +1 -1
  144. package/lib/esm/features/store/objects/DocumentTable.js +10 -7
  145. package/lib/esm/features/store/objects/DocumentTable.js.map +1 -1
  146. package/lib/esm/features/store/objects/ExportPropertiesModal.js +5 -2
  147. package/lib/esm/features/store/objects/ExportPropertiesModal.js.map +1 -1
  148. package/lib/esm/features/store/objects/components/ContentDispositionButton.js +3 -1
  149. package/lib/esm/features/store/objects/components/ContentDispositionButton.js.map +1 -1
  150. package/lib/esm/features/store/objects/components/ContentOverview.js +55 -40
  151. package/lib/esm/features/store/objects/components/ContentOverview.js.map +1 -1
  152. package/lib/esm/features/store/objects/components/DocumentIcon.js +4 -3
  153. package/lib/esm/features/store/objects/components/DocumentIcon.js.map +1 -1
  154. package/lib/esm/features/store/objects/components/PropertiesEditorModal.js +13 -11
  155. package/lib/esm/features/store/objects/components/PropertiesEditorModal.js.map +1 -1
  156. package/lib/esm/features/store/objects/components/SaveVersionConfirmModal.js +15 -18
  157. package/lib/esm/features/store/objects/components/SaveVersionConfirmModal.js.map +1 -1
  158. package/lib/esm/features/store/objects/components/SelectDocument.js +9 -6
  159. package/lib/esm/features/store/objects/components/SelectDocument.js.map +1 -1
  160. package/lib/esm/features/store/objects/components/TextEditorPanel.js +97 -0
  161. package/lib/esm/features/store/objects/components/TextEditorPanel.js.map +1 -0
  162. package/lib/esm/features/store/objects/components/VectorSearchWidget.js +3 -1
  163. package/lib/esm/features/store/objects/components/VectorSearchWidget.js.map +1 -1
  164. package/lib/esm/features/store/objects/components/useContentPanelHooks.js +4 -2
  165. package/lib/esm/features/store/objects/components/useContentPanelHooks.js.map +1 -1
  166. package/lib/esm/features/store/objects/components/useDownloadFile.js +12 -10
  167. package/lib/esm/features/store/objects/components/useDownloadFile.js.map +1 -1
  168. package/lib/esm/features/store/objects/layout/documentLayout.js +10 -6
  169. package/lib/esm/features/store/objects/layout/documentLayout.js.map +1 -1
  170. package/lib/esm/features/store/objects/layout/renderers.js +10 -1
  171. package/lib/esm/features/store/objects/layout/renderers.js.map +1 -1
  172. package/lib/esm/features/store/objects/search/DocumentSearchContext.js +3 -2
  173. package/lib/esm/features/store/objects/search/DocumentSearchContext.js.map +1 -1
  174. package/lib/esm/features/store/objects/search/DocumentSearchProvider.js +3 -0
  175. package/lib/esm/features/store/objects/search/DocumentSearchProvider.js.map +1 -1
  176. package/lib/esm/features/store/objects/selection/ObjectsActionContext.js +22 -109
  177. package/lib/esm/features/store/objects/selection/ObjectsActionContext.js.map +1 -1
  178. package/lib/esm/features/store/objects/selection/ObjectsActionContextClass.js +50 -0
  179. package/lib/esm/features/store/objects/selection/ObjectsActionContextClass.js.map +1 -0
  180. package/lib/esm/features/store/objects/selection/ObjectsActionHooks.js +27 -0
  181. package/lib/esm/features/store/objects/selection/ObjectsActionHooks.js.map +1 -0
  182. package/lib/esm/features/store/objects/selection/SelectionActions.js +10 -6
  183. package/lib/esm/features/store/objects/selection/SelectionActions.js.map +1 -1
  184. package/lib/esm/features/store/objects/selection/actions/AddToCollectionAction.js +17 -12
  185. package/lib/esm/features/store/objects/selection/actions/AddToCollectionAction.js.map +1 -1
  186. package/lib/esm/features/store/objects/selection/actions/ChangeTypeAction.js +9 -5
  187. package/lib/esm/features/store/objects/selection/actions/ChangeTypeAction.js.map +1 -1
  188. package/lib/esm/features/store/objects/selection/actions/ConfirmAction.js +4 -2
  189. package/lib/esm/features/store/objects/selection/actions/ConfirmAction.js.map +1 -1
  190. package/lib/esm/features/store/objects/selection/actions/DeleteObjectsAction.js +24 -23
  191. package/lib/esm/features/store/objects/selection/actions/DeleteObjectsAction.js.map +1 -1
  192. package/lib/esm/features/store/objects/selection/actions/ExportPropertiesAction.js +10 -5
  193. package/lib/esm/features/store/objects/selection/actions/ExportPropertiesAction.js.map +1 -1
  194. package/lib/esm/features/store/objects/selection/actions/RemoveFromCollectionAction.js +13 -9
  195. package/lib/esm/features/store/objects/selection/actions/RemoveFromCollectionAction.js.map +1 -1
  196. package/lib/esm/features/store/objects/selection/actions/StartWorkflowComponent.js +14 -8
  197. package/lib/esm/features/store/objects/selection/actions/StartWorkflowComponent.js.map +1 -1
  198. package/lib/esm/features/store/objects/upload/DocumentUploadModal.js +42 -39
  199. package/lib/esm/features/store/objects/upload/DocumentUploadModal.js.map +1 -1
  200. package/lib/esm/features/store/objects/upload/useSmartFileUploadProcessing.js +4 -2
  201. package/lib/esm/features/store/objects/upload/useSmartFileUploadProcessing.js.map +1 -1
  202. package/lib/esm/features/store/objects/upload/useUploadHandler.js +9 -7
  203. package/lib/esm/features/store/objects/upload/useUploadHandler.js.map +1 -1
  204. package/lib/esm/features/store/types/ContentObjectTypesSearch.js +6 -4
  205. package/lib/esm/features/store/types/ContentObjectTypesSearch.js.map +1 -1
  206. package/lib/esm/features/store/types/ContentObjectTypesTable.js +3 -1
  207. package/lib/esm/features/store/types/ContentObjectTypesTable.js.map +1 -1
  208. package/lib/esm/features/store/types/CreateOrUpdateTypeModal.js +6 -7
  209. package/lib/esm/features/store/types/CreateOrUpdateTypeModal.js.map +1 -1
  210. package/lib/esm/features/store/types/ObjectSchemaEditor.js +9 -7
  211. package/lib/esm/features/store/types/ObjectSchemaEditor.js.map +1 -1
  212. package/lib/esm/features/store/types/SelectContentType.js +9 -7
  213. package/lib/esm/features/store/types/SelectContentType.js.map +1 -1
  214. package/lib/esm/features/store/types/SelectContentTypeModal.js +5 -2
  215. package/lib/esm/features/store/types/SelectContentTypeModal.js.map +1 -1
  216. package/lib/esm/features/store/types/TableLayoutEditor.js +6 -4
  217. package/lib/esm/features/store/types/TableLayoutEditor.js.map +1 -1
  218. package/lib/esm/features/user/UserInfo.js +40 -50
  219. package/lib/esm/features/user/UserInfo.js.map +1 -1
  220. package/lib/esm/i18n/index.js +31 -0
  221. package/lib/esm/i18n/index.js.map +1 -0
  222. package/lib/esm/i18n/instance.js +46 -0
  223. package/lib/esm/i18n/instance.js.map +1 -0
  224. package/lib/esm/i18n/locales/ar.json +694 -0
  225. package/lib/esm/i18n/locales/de.json +662 -0
  226. package/lib/esm/i18n/locales/en.json +663 -0
  227. package/lib/esm/i18n/locales/es.json +668 -0
  228. package/lib/esm/i18n/locales/fr.json +670 -0
  229. package/lib/esm/i18n/locales/it.json +668 -0
  230. package/lib/esm/i18n/locales/ja.json +662 -0
  231. package/lib/esm/i18n/locales/ko.json +662 -0
  232. package/lib/esm/i18n/locales/pt.json +668 -0
  233. package/lib/esm/i18n/locales/ru.json +678 -0
  234. package/lib/esm/i18n/locales/tr.json +662 -0
  235. package/lib/esm/i18n/locales/zh-TW.json +662 -0
  236. package/lib/esm/i18n/locales/zh.json +662 -0
  237. package/lib/esm/layout/FullHeightLayout.js +3 -0
  238. package/lib/esm/layout/FullHeightLayout.js.map +1 -1
  239. package/lib/esm/layout/Navbar.js +3 -1
  240. package/lib/esm/layout/Navbar.js.map +1 -1
  241. package/lib/esm/layout/RegionTag.js +15 -0
  242. package/lib/esm/layout/RegionTag.js.map +1 -0
  243. package/lib/esm/layout/Sidebar.js +2 -2
  244. package/lib/esm/layout/Sidebar.js.map +1 -1
  245. package/lib/esm/layout/index.js +1 -0
  246. package/lib/esm/layout/index.js.map +1 -1
  247. package/lib/esm/router/HistoryNavigator.js +1 -1
  248. package/lib/esm/router/HistoryNavigator.js.map +1 -1
  249. package/lib/esm/router/Nav.js +5 -3
  250. package/lib/esm/router/Nav.js.map +1 -1
  251. package/lib/esm/router/NestedNavigationContext.js +4 -0
  252. package/lib/esm/router/NestedNavigationContext.js.map +1 -1
  253. package/lib/esm/router/NestedRouterProvider.js +3 -1
  254. package/lib/esm/router/NestedRouterProvider.js.map +1 -1
  255. package/lib/esm/router/Router.js +21 -6
  256. package/lib/esm/router/Router.js.map +1 -1
  257. package/lib/esm/session/UserSession.js +31 -0
  258. package/lib/esm/session/UserSession.js.map +1 -1
  259. package/lib/esm/session/UserSessionProvider.js +4 -0
  260. package/lib/esm/session/UserSessionProvider.js.map +1 -1
  261. package/lib/esm/session/auth/composable.js +1 -1
  262. package/lib/esm/session/auth/composable.js.map +1 -1
  263. package/lib/esm/session/auth/firebase.js +1 -1
  264. package/lib/esm/session/auth/firebase.js.map +1 -1
  265. package/lib/esm/session/auth/useCurrentTenant.js +3 -1
  266. package/lib/esm/session/auth/useCurrentTenant.js.map +1 -1
  267. package/lib/esm/shell/SplashScreen.js +3 -7
  268. package/lib/esm/shell/SplashScreen.js.map +1 -1
  269. package/lib/esm/shell/apps/StandaloneApp.js +5 -2
  270. package/lib/esm/shell/apps/StandaloneApp.js.map +1 -1
  271. package/lib/esm/shell/login/EnterpriseSigninButton.js +5 -3
  272. package/lib/esm/shell/login/EnterpriseSigninButton.js.map +1 -1
  273. package/lib/esm/shell/login/GitHubSignInButton.js +3 -7
  274. package/lib/esm/shell/login/GitHubSignInButton.js.map +1 -1
  275. package/lib/esm/shell/login/GoogleSignInButton.js +3 -1
  276. package/lib/esm/shell/login/GoogleSignInButton.js.map +1 -1
  277. package/lib/esm/shell/login/InviteAcceptModal.js +5 -2
  278. package/lib/esm/shell/login/InviteAcceptModal.js.map +1 -1
  279. package/lib/esm/shell/login/MicrosoftSigninButton.js +4 -6
  280. package/lib/esm/shell/login/MicrosoftSigninButton.js.map +1 -1
  281. package/lib/esm/shell/login/SigninScreen.js +6 -2
  282. package/lib/esm/shell/login/SigninScreen.js.map +1 -1
  283. package/lib/esm/shell/login/SignupForm.js +36 -34
  284. package/lib/esm/shell/login/SignupForm.js.map +1 -1
  285. package/lib/esm/shell/login/TerminalLogin.js +29 -22
  286. package/lib/esm/shell/login/TerminalLogin.js.map +1 -1
  287. package/lib/esm/shell/login/UserInfo.js +6 -4
  288. package/lib/esm/shell/login/UserInfo.js.map +1 -1
  289. package/lib/esm/shell/login/UserSessionMenu.js +3 -4
  290. package/lib/esm/shell/login/UserSessionMenu.js.map +1 -1
  291. package/lib/esm/widgets/index.js +0 -1
  292. package/lib/esm/widgets/index.js.map +1 -1
  293. package/lib/esm/widgets/json-view/JSONCode.js +1 -1
  294. package/lib/esm/widgets/json-view/JSONCode.js.map +1 -1
  295. package/lib/esm/widgets/json-view/JSONDisplay.js +6 -2
  296. package/lib/esm/widgets/json-view/JSONDisplay.js.map +1 -1
  297. package/lib/esm/widgets/json-view/JSONSwitcher.js +6 -0
  298. package/lib/esm/widgets/json-view/JSONSwitcher.js.map +1 -0
  299. package/lib/esm/widgets/json-view/JSONView.js +1 -1
  300. package/lib/esm/widgets/json-view/JSONView.js.map +1 -1
  301. package/lib/esm/widgets/json-view/index.js +1 -0
  302. package/lib/esm/widgets/json-view/index.js.map +1 -1
  303. package/lib/esm/widgets/markdown/ArtifactContentRenderer.js +6 -5
  304. package/lib/esm/widgets/markdown/ArtifactContentRenderer.js.map +1 -1
  305. package/lib/esm/widgets/markdown/CodeBlockContext.js +11 -0
  306. package/lib/esm/widgets/markdown/CodeBlockContext.js.map +1 -0
  307. package/lib/esm/widgets/markdown/MarkdownRenderer.js +11 -10
  308. package/lib/esm/widgets/markdown/MarkdownRenderer.js.map +1 -1
  309. package/lib/esm/widgets/markdown/codeBlockHandlers.js +11 -12
  310. package/lib/esm/widgets/markdown/codeBlockHandlers.js.map +1 -1
  311. package/lib/esm/widgets/markdown/index.js +10 -9
  312. package/lib/esm/widgets/markdown/index.js.map +1 -1
  313. package/lib/esm/widgets/markdown/remarkDirectiveHandler.js +0 -1
  314. package/lib/esm/widgets/markdown/remarkDirectiveHandler.js.map +1 -1
  315. package/lib/esm/widgets/schema-editor/ManagedSchema.js +6 -5
  316. package/lib/esm/widgets/schema-editor/ManagedSchema.js.map +1 -1
  317. package/lib/esm/widgets/schema-editor/editor/PropertyEditor.js +7 -3
  318. package/lib/esm/widgets/schema-editor/editor/PropertyEditor.js.map +1 -1
  319. package/lib/esm/widgets/schema-editor/editor/SchemaEditor.js +3 -1
  320. package/lib/esm/widgets/schema-editor/editor/SchemaEditor.js.map +1 -1
  321. package/lib/esm/widgets/upload/DropZone.js +9 -11
  322. package/lib/esm/widgets/upload/DropZone.js.map +1 -1
  323. package/lib/esm/widgets/upload/UploadResultCategory.js +3 -1
  324. package/lib/esm/widgets/upload/UploadResultCategory.js.map +1 -1
  325. package/lib/esm/widgets/upload/UploadSummary.js +3 -1
  326. package/lib/esm/widgets/upload/UploadSummary.js.map +1 -1
  327. package/lib/tsconfig.tsbuildinfo +1 -1
  328. package/lib/types/core/components/SelectList.d.ts.map +1 -1
  329. package/lib/types/core/components/SidePanel.d.ts +4 -2
  330. package/lib/types/core/components/SidePanel.d.ts.map +1 -1
  331. package/lib/types/core/components/index.d.ts +0 -5
  332. package/lib/types/core/components/index.d.ts.map +1 -1
  333. package/lib/types/core/components/shadcn/badge.d.ts +2 -2
  334. package/lib/types/core/components/shadcn/breadcrumb.d.ts +1 -1
  335. package/lib/types/core/components/shadcn/breadcrumb.d.ts.map +1 -1
  336. package/lib/types/core/components/shadcn/button.d.ts.map +1 -1
  337. package/lib/types/core/components/shadcn/collaspible.d.ts +6 -0
  338. package/lib/types/core/components/shadcn/collaspible.d.ts.map +1 -0
  339. package/lib/types/core/components/shadcn/dropdown.d.ts +44 -0
  340. package/lib/types/core/components/shadcn/dropdown.d.ts.map +1 -0
  341. package/lib/types/core/components/shadcn/filters/comboBox/DateCombobox.d.ts.map +1 -1
  342. package/lib/types/core/components/shadcn/filters/comboBox/SelectCombobox.d.ts.map +1 -1
  343. package/lib/types/core/components/shadcn/filters/filter/dateFilter.d.ts.map +1 -1
  344. package/lib/types/core/components/shadcn/filters/filterBar.d.ts.map +1 -1
  345. package/lib/types/core/components/shadcn/index.d.ts +4 -0
  346. package/lib/types/core/components/shadcn/index.d.ts.map +1 -1
  347. package/lib/types/core/components/shadcn/input.d.ts +1 -1
  348. package/lib/types/core/components/shadcn/modal/ConfirmModal.d.ts +2 -1
  349. package/lib/types/core/components/shadcn/modal/ConfirmModal.d.ts.map +1 -1
  350. package/lib/types/core/components/shadcn/modal/DeleteModal.d.ts.map +1 -1
  351. package/lib/types/core/components/shadcn/popover.d.ts +11 -3
  352. package/lib/types/core/components/shadcn/popover.d.ts.map +1 -1
  353. package/lib/types/core/components/shadcn/radioGroup.d.ts +26 -0
  354. package/lib/types/core/components/shadcn/radioGroup.d.ts.map +1 -0
  355. package/lib/types/core/components/shadcn/switch.d.ts +12 -0
  356. package/lib/types/core/components/shadcn/switch.d.ts.map +1 -0
  357. package/lib/types/core/components/shadcn/tabs.d.ts +4 -2
  358. package/lib/types/core/components/shadcn/tabs.d.ts.map +1 -1
  359. package/lib/types/core/components/shadcn/theme/ThemeSwitcher.d.ts +8 -2
  360. package/lib/types/core/components/shadcn/theme/ThemeSwitcher.d.ts.map +1 -1
  361. package/lib/types/core/components/toast/NotificationPanel.d.ts.map +1 -1
  362. package/lib/types/env/index.d.ts +8 -1
  363. package/lib/types/env/index.d.ts.map +1 -1
  364. package/lib/types/features/agent/PayloadBuilder.d.ts +31 -3
  365. package/lib/types/features/agent/PayloadBuilder.d.ts.map +1 -1
  366. package/lib/types/features/agent/chat/AgentRightPanel.d.ts +50 -0
  367. package/lib/types/features/agent/chat/AgentRightPanel.d.ts.map +1 -0
  368. package/lib/types/features/agent/chat/ArtifactsTab.d.ts +9 -0
  369. package/lib/types/features/agent/chat/ArtifactsTab.d.ts.map +1 -0
  370. package/lib/types/features/agent/chat/AskUserWidget.d.ts.map +1 -1
  371. package/lib/types/features/agent/chat/DocumentPanel.d.ts.map +1 -1
  372. package/lib/types/features/agent/chat/ImageLightbox.d.ts.map +1 -1
  373. package/lib/types/features/agent/chat/ModernAgentConversation.d.ts +22 -9
  374. package/lib/types/features/agent/chat/ModernAgentConversation.d.ts.map +1 -1
  375. package/lib/types/features/agent/chat/ModernAgentOutput/AllMessagesMixed.d.ts +3 -1
  376. package/lib/types/features/agent/chat/ModernAgentOutput/AllMessagesMixed.d.ts.map +1 -1
  377. package/lib/types/features/agent/chat/ModernAgentOutput/BatchProgressPanel.d.ts.map +1 -1
  378. package/lib/types/features/agent/chat/ModernAgentOutput/Header.d.ts +12 -3
  379. package/lib/types/features/agent/chat/ModernAgentOutput/Header.d.ts.map +1 -1
  380. package/lib/types/features/agent/chat/ModernAgentOutput/InlineSlidingPlanPanel.d.ts +1 -1
  381. package/lib/types/features/agent/chat/ModernAgentOutput/InlineSlidingPlanPanel.d.ts.map +1 -1
  382. package/lib/types/features/agent/chat/ModernAgentOutput/MessageInput.d.ts.map +1 -1
  383. package/lib/types/features/agent/chat/ModernAgentOutput/MessageItem.d.ts.map +1 -1
  384. package/lib/types/features/agent/chat/ModernAgentOutput/PlanPanel.d.ts.map +1 -1
  385. package/lib/types/features/agent/chat/ModernAgentOutput/SlidingPlanPanel.d.ts.map +1 -1
  386. package/lib/types/features/agent/chat/ModernAgentOutput/StreamingMessage.d.ts +3 -1
  387. package/lib/types/features/agent/chat/ModernAgentOutput/StreamingMessage.d.ts.map +1 -1
  388. package/lib/types/features/agent/chat/ModernAgentOutput/ToolCallGroup.d.ts +5 -1
  389. package/lib/types/features/agent/chat/ModernAgentOutput/ToolCallGroup.d.ts.map +1 -1
  390. package/lib/types/features/agent/chat/ModernAgentOutput/WorkstreamTabs.d.ts.map +1 -1
  391. package/lib/types/features/agent/chat/ModernAgentOutput/utils.d.ts +16 -1
  392. package/lib/types/features/agent/chat/ModernAgentOutput/utils.d.ts.map +1 -1
  393. package/lib/types/features/agent/chat/SlidingThinkingIndicator.d.ts.map +1 -1
  394. package/lib/types/features/agent/chat/VegaLiteChart.d.ts.map +1 -1
  395. package/lib/types/features/agent/chat/hooks/useAgentPlans.d.ts.map +1 -1
  396. package/lib/types/features/agent/chat/hooks/useAgentStream.d.ts +3 -3
  397. package/lib/types/features/agent/chat/hooks/useAgentStream.d.ts.map +1 -1
  398. package/lib/types/features/agent/chat/hooks/useArtifacts.d.ts +18 -0
  399. package/lib/types/features/agent/chat/hooks/useArtifacts.d.ts.map +1 -0
  400. package/lib/types/features/agent/chat/hooks/useDocumentPanel.d.ts.map +1 -1
  401. package/lib/types/features/agent/chat/hooks/useFileProcessing.d.ts +4 -4
  402. package/lib/types/features/agent/chat/hooks/useFileProcessing.d.ts.map +1 -1
  403. package/lib/types/features/agent/chat/types/document.d.ts +2 -0
  404. package/lib/types/features/agent/chat/types/document.d.ts.map +1 -1
  405. package/lib/types/features/errors/PanelErrorBoundary.d.ts.map +1 -1
  406. package/lib/types/features/facets/AgentRunnerFacetsNav.d.ts +2 -1
  407. package/lib/types/features/facets/AgentRunnerFacetsNav.d.ts.map +1 -1
  408. package/lib/types/features/facets/index.d.ts +1 -1
  409. package/lib/types/features/facets/index.d.ts.map +1 -1
  410. package/lib/types/features/layout/GenericPageNavHeader.d.ts +2 -2
  411. package/lib/types/features/layout/GenericPageNavHeader.d.ts.map +1 -1
  412. package/lib/types/features/layout/NotFoundView.d.ts.map +1 -1
  413. package/lib/types/features/magic-pdf/AnnotatedImageSlider.d.ts.map +1 -1
  414. package/lib/types/features/magic-pdf/DownloadPopover.d.ts.map +1 -1
  415. package/lib/types/features/magic-pdf/MagicPdfView.d.ts.map +1 -1
  416. package/lib/types/features/pdf-viewer/PdfPageSlider.d.ts.map +1 -1
  417. package/lib/types/features/pdf-viewer/SimplePdfViewer.d.ts.map +1 -1
  418. package/lib/types/features/permissions/UserPermissionsProvider.d.ts.map +1 -1
  419. package/lib/types/features/store/collections/BrowseCollectionView.d.ts.map +1 -1
  420. package/lib/types/features/store/collections/CollectionsTable.d.ts +4 -0
  421. package/lib/types/features/store/collections/CollectionsTable.d.ts.map +1 -1
  422. package/lib/types/features/store/collections/CreateCollection.d.ts.map +1 -1
  423. package/lib/types/features/store/collections/EditCollectionView.d.ts.map +1 -1
  424. package/lib/types/features/store/collections/SelectCollection.d.ts.map +1 -1
  425. package/lib/types/features/store/collections/SharedPropsEditor.d.ts.map +1 -1
  426. package/lib/types/features/store/collections/SyncMemberHeadsToggle.d.ts.map +1 -1
  427. package/lib/types/features/store/objects/DocumentPreviewPanel.d.ts.map +1 -1
  428. package/lib/types/features/store/objects/DocumentSearchResults.d.ts.map +1 -1
  429. package/lib/types/features/store/objects/DocumentTable.d.ts.map +1 -1
  430. package/lib/types/features/store/objects/ExportPropertiesModal.d.ts.map +1 -1
  431. package/lib/types/features/store/objects/components/ContentDispositionButton.d.ts.map +1 -1
  432. package/lib/types/features/store/objects/components/ContentOverview.d.ts.map +1 -1
  433. package/lib/types/features/store/objects/components/DocumentIcon.d.ts +2 -1
  434. package/lib/types/features/store/objects/components/DocumentIcon.d.ts.map +1 -1
  435. package/lib/types/features/store/objects/components/PropertiesEditorModal.d.ts.map +1 -1
  436. package/lib/types/features/store/objects/components/SaveVersionConfirmModal.d.ts.map +1 -1
  437. package/lib/types/features/store/objects/components/SelectDocument.d.ts +3 -1
  438. package/lib/types/features/store/objects/components/SelectDocument.d.ts.map +1 -1
  439. package/lib/types/features/store/objects/components/TextEditorPanel.d.ts +10 -0
  440. package/lib/types/features/store/objects/components/TextEditorPanel.d.ts.map +1 -0
  441. package/lib/types/features/store/objects/components/VectorSearchWidget.d.ts.map +1 -1
  442. package/lib/types/features/store/objects/components/useContentPanelHooks.d.ts.map +1 -1
  443. package/lib/types/features/store/objects/components/useDownloadFile.d.ts.map +1 -1
  444. package/lib/types/features/store/objects/layout/documentLayout.d.ts +3 -2
  445. package/lib/types/features/store/objects/layout/documentLayout.d.ts.map +1 -1
  446. package/lib/types/features/store/objects/layout/renderers.d.ts.map +1 -1
  447. package/lib/types/features/store/objects/search/DocumentSearchContext.d.ts.map +1 -1
  448. package/lib/types/features/store/objects/search/DocumentSearchProvider.d.ts.map +1 -1
  449. package/lib/types/features/store/objects/selection/ObjectsActionContext.d.ts +3 -20
  450. package/lib/types/features/store/objects/selection/ObjectsActionContext.d.ts.map +1 -1
  451. package/lib/types/features/store/objects/selection/ObjectsActionContextClass.d.ts +16 -0
  452. package/lib/types/features/store/objects/selection/ObjectsActionContextClass.d.ts.map +1 -0
  453. package/lib/types/features/store/objects/selection/ObjectsActionHooks.d.ts +7 -0
  454. package/lib/types/features/store/objects/selection/ObjectsActionHooks.d.ts.map +1 -0
  455. package/lib/types/features/store/objects/selection/ObjectsActionSpec.d.ts +4 -1
  456. package/lib/types/features/store/objects/selection/ObjectsActionSpec.d.ts.map +1 -1
  457. package/lib/types/features/store/objects/selection/SelectionActions.d.ts +6 -1
  458. package/lib/types/features/store/objects/selection/SelectionActions.d.ts.map +1 -1
  459. package/lib/types/features/store/objects/selection/actions/AddToCollectionAction.d.ts.map +1 -1
  460. package/lib/types/features/store/objects/selection/actions/ChangeTypeAction.d.ts.map +1 -1
  461. package/lib/types/features/store/objects/selection/actions/ConfirmAction.d.ts +1 -1
  462. package/lib/types/features/store/objects/selection/actions/ConfirmAction.d.ts.map +1 -1
  463. package/lib/types/features/store/objects/selection/actions/DeleteObjectsAction.d.ts.map +1 -1
  464. package/lib/types/features/store/objects/selection/actions/ExportPropertiesAction.d.ts.map +1 -1
  465. package/lib/types/features/store/objects/selection/actions/RemoveFromCollectionAction.d.ts.map +1 -1
  466. package/lib/types/features/store/objects/selection/actions/StartWorkflowComponent.d.ts.map +1 -1
  467. package/lib/types/features/store/objects/upload/DocumentUploadModal.d.ts.map +1 -1
  468. package/lib/types/features/store/objects/upload/useSmartFileUploadProcessing.d.ts.map +1 -1
  469. package/lib/types/features/store/objects/upload/useUploadHandler.d.ts.map +1 -1
  470. package/lib/types/features/store/types/ContentObjectTypesSearch.d.ts.map +1 -1
  471. package/lib/types/features/store/types/ContentObjectTypesTable.d.ts.map +1 -1
  472. package/lib/types/features/store/types/CreateOrUpdateTypeModal.d.ts +2 -1
  473. package/lib/types/features/store/types/CreateOrUpdateTypeModal.d.ts.map +1 -1
  474. package/lib/types/features/store/types/ObjectSchemaEditor.d.ts.map +1 -1
  475. package/lib/types/features/store/types/SelectContentType.d.ts.map +1 -1
  476. package/lib/types/features/store/types/SelectContentTypeModal.d.ts.map +1 -1
  477. package/lib/types/features/store/types/TableLayoutEditor.d.ts.map +1 -1
  478. package/lib/types/features/user/UserInfo.d.ts +2 -2
  479. package/lib/types/features/user/UserInfo.d.ts.map +1 -1
  480. package/lib/types/i18n/index.d.ts +14 -0
  481. package/lib/types/i18n/index.d.ts.map +1 -0
  482. package/lib/types/i18n/instance.d.ts +5 -0
  483. package/lib/types/i18n/instance.d.ts.map +1 -0
  484. package/lib/types/layout/FullHeightLayout.d.ts +3 -0
  485. package/lib/types/layout/FullHeightLayout.d.ts.map +1 -1
  486. package/lib/types/layout/Navbar.d.ts.map +1 -1
  487. package/lib/types/layout/RegionTag.d.ts +4 -0
  488. package/lib/types/layout/RegionTag.d.ts.map +1 -0
  489. package/lib/types/layout/Sidebar.d.ts +2 -1
  490. package/lib/types/layout/Sidebar.d.ts.map +1 -1
  491. package/lib/types/layout/index.d.ts +1 -0
  492. package/lib/types/layout/index.d.ts.map +1 -1
  493. package/lib/types/router/Nav.d.ts +5 -1
  494. package/lib/types/router/Nav.d.ts.map +1 -1
  495. package/lib/types/router/NestedNavigationContext.d.ts.map +1 -1
  496. package/lib/types/router/NestedRouterProvider.d.ts.map +1 -1
  497. package/lib/types/router/Router.d.ts +2 -0
  498. package/lib/types/router/Router.d.ts.map +1 -1
  499. package/lib/types/session/UserSession.d.ts +1 -0
  500. package/lib/types/session/UserSession.d.ts.map +1 -1
  501. package/lib/types/session/UserSessionProvider.d.ts.map +1 -1
  502. package/lib/types/session/auth/useCurrentTenant.d.ts.map +1 -1
  503. package/lib/types/shell/SplashScreen.d.ts.map +1 -1
  504. package/lib/types/shell/apps/StandaloneApp.d.ts.map +1 -1
  505. package/lib/types/shell/login/EnterpriseSigninButton.d.ts.map +1 -1
  506. package/lib/types/shell/login/GitHubSignInButton.d.ts.map +1 -1
  507. package/lib/types/shell/login/GoogleSignInButton.d.ts.map +1 -1
  508. package/lib/types/shell/login/InviteAcceptModal.d.ts.map +1 -1
  509. package/lib/types/shell/login/MicrosoftSigninButton.d.ts +1 -1
  510. package/lib/types/shell/login/MicrosoftSigninButton.d.ts.map +1 -1
  511. package/lib/types/shell/login/SigninScreen.d.ts.map +1 -1
  512. package/lib/types/shell/login/SignupForm.d.ts.map +1 -1
  513. package/lib/types/shell/login/TerminalLogin.d.ts.map +1 -1
  514. package/lib/types/shell/login/UserInfo.d.ts.map +1 -1
  515. package/lib/types/shell/login/UserSessionMenu.d.ts.map +1 -1
  516. package/lib/types/widgets/index.d.ts +0 -1
  517. package/lib/types/widgets/index.d.ts.map +1 -1
  518. package/lib/types/widgets/json-view/JSONDisplay.d.ts.map +1 -1
  519. package/lib/types/widgets/json-view/JSONSwitcher.d.ts +6 -0
  520. package/lib/types/widgets/json-view/JSONSwitcher.d.ts.map +1 -0
  521. package/lib/types/widgets/json-view/index.d.ts +1 -0
  522. package/lib/types/widgets/json-view/index.d.ts.map +1 -1
  523. package/lib/types/widgets/markdown/ArtifactContentRenderer.d.ts.map +1 -1
  524. package/lib/types/widgets/markdown/CodeBlockContext.d.ts +21 -0
  525. package/lib/types/widgets/markdown/CodeBlockContext.d.ts.map +1 -0
  526. package/lib/types/widgets/markdown/MarkdownRenderer.d.ts.map +1 -1
  527. package/lib/types/widgets/markdown/codeBlockHandlers.d.ts +0 -12
  528. package/lib/types/widgets/markdown/codeBlockHandlers.d.ts.map +1 -1
  529. package/lib/types/widgets/markdown/index.d.ts +10 -9
  530. package/lib/types/widgets/markdown/index.d.ts.map +1 -1
  531. package/lib/types/widgets/schema-editor/ManagedSchema.d.ts +1 -1
  532. package/lib/types/widgets/schema-editor/ManagedSchema.d.ts.map +1 -1
  533. package/lib/types/widgets/schema-editor/editor/PropertyEditor.d.ts.map +1 -1
  534. package/lib/types/widgets/schema-editor/editor/SchemaEditor.d.ts.map +1 -1
  535. package/lib/types/widgets/upload/DropZone.d.ts.map +1 -1
  536. package/lib/types/widgets/upload/UploadResultCategory.d.ts.map +1 -1
  537. package/lib/types/widgets/upload/UploadSummary.d.ts.map +1 -1
  538. package/lib/vertesia-ui-core.js +1 -1
  539. package/lib/vertesia-ui-core.js.map +1 -1
  540. package/lib/vertesia-ui-env.js +1 -1
  541. package/lib/vertesia-ui-env.js.map +1 -1
  542. package/lib/vertesia-ui-features.js +1 -1
  543. package/lib/vertesia-ui-features.js.map +1 -1
  544. package/lib/vertesia-ui-i18n.js +2 -0
  545. package/lib/vertesia-ui-i18n.js.map +1 -0
  546. package/lib/vertesia-ui-layout.js +1 -1
  547. package/lib/vertesia-ui-layout.js.map +1 -1
  548. package/lib/vertesia-ui-router.js +1 -1
  549. package/lib/vertesia-ui-router.js.map +1 -1
  550. package/lib/vertesia-ui-session.js +1 -1
  551. package/lib/vertesia-ui-session.js.map +1 -1
  552. package/lib/vertesia-ui-shell.js +1 -1
  553. package/lib/vertesia-ui-shell.js.map +1 -1
  554. package/lib/vertesia-ui-widgets.js +1 -1
  555. package/lib/vertesia-ui-widgets.js.map +1 -1
  556. package/llms.txt +124 -4
  557. package/package.json +50 -22
  558. package/src/core/components/SelectList.tsx +3 -1
  559. package/src/core/components/SidePanel.tsx +5 -4
  560. package/src/core/components/index.ts +0 -5
  561. package/src/core/components/shadcn/breadcrumb.tsx +16 -9
  562. package/src/core/components/shadcn/button.tsx +5 -3
  563. package/src/core/components/shadcn/collaspible.tsx +33 -0
  564. package/src/core/components/shadcn/dropdown.tsx +309 -0
  565. package/src/core/components/shadcn/filters/comboBox/DateCombobox.tsx +3 -1
  566. package/src/core/components/shadcn/filters/comboBox/SelectCombobox.tsx +3 -1
  567. package/src/core/components/shadcn/filters/comboBox/StringListCombobox.tsx +1 -1
  568. package/src/core/components/shadcn/filters/filter/StringListFilter.tsx +1 -1
  569. package/src/core/components/shadcn/filters/filter/dateFilter.tsx +5 -3
  570. package/src/core/components/shadcn/filters/filterBar.tsx +8 -5
  571. package/src/core/components/shadcn/index.ts +5 -1
  572. package/src/core/components/shadcn/modal/ConfirmModal.tsx +7 -3
  573. package/src/core/components/shadcn/modal/DeleteModal.tsx +5 -3
  574. package/src/core/components/shadcn/popover.tsx +12 -7
  575. package/src/core/components/shadcn/radioGroup.tsx +100 -0
  576. package/src/core/components/shadcn/selectBox.tsx +1 -1
  577. package/src/core/components/shadcn/switch.tsx +60 -0
  578. package/src/core/components/shadcn/tabs.tsx +29 -27
  579. package/src/core/components/shadcn/theme/ThemeSwitcher.tsx +19 -10
  580. package/src/core/components/shadcn/tooltip.tsx +1 -1
  581. package/src/core/components/toast/NotificationPanel.tsx +38 -44
  582. package/src/css/base.css +31 -0
  583. package/src/css/color.css +136 -0
  584. package/src/css/custom-tooltips.css +64 -0
  585. package/src/css/index.css +27 -0
  586. package/src/css/theme.css +86 -0
  587. package/src/css/typography.css +88 -0
  588. package/src/css/utilities.css +72 -0
  589. package/src/env/index.ts +16 -3
  590. package/src/features/agent/PayloadBuilder.tsx +100 -13
  591. package/src/features/agent/chat/AgentRightPanel.tsx +424 -0
  592. package/src/features/agent/chat/ArtifactsTab.tsx +197 -0
  593. package/src/features/agent/chat/AskUserWidget.tsx +14 -8
  594. package/src/features/agent/chat/DocumentPanel.tsx +24 -9
  595. package/src/features/agent/chat/ImageLightbox.tsx +6 -3
  596. package/src/features/agent/chat/ModernAgentConversation.tsx +539 -356
  597. package/src/features/agent/chat/ModernAgentOutput/AllMessagesMixed.tsx +151 -55
  598. package/src/features/agent/chat/ModernAgentOutput/BatchProgressPanel.tsx +6 -4
  599. package/src/features/agent/chat/ModernAgentOutput/Header.tsx +126 -46
  600. package/src/features/agent/chat/ModernAgentOutput/InlineSlidingPlanPanel.tsx +21 -31
  601. package/src/features/agent/chat/ModernAgentOutput/MessageInput.tsx +119 -114
  602. package/src/features/agent/chat/ModernAgentOutput/MessageItem.tsx +26 -9
  603. package/src/features/agent/chat/ModernAgentOutput/PlanPanel.tsx +9 -7
  604. package/src/features/agent/chat/ModernAgentOutput/SlidingPlanPanel.tsx +15 -13
  605. package/src/features/agent/chat/ModernAgentOutput/StreamingMessage.tsx +8 -3
  606. package/src/features/agent/chat/ModernAgentOutput/ToolCallGroup.tsx +149 -49
  607. package/src/features/agent/chat/ModernAgentOutput/WorkstreamTabs.tsx +9 -5
  608. package/src/features/agent/chat/ModernAgentOutput/utils.test.ts +229 -0
  609. package/src/features/agent/chat/ModernAgentOutput/utils.ts +202 -97
  610. package/src/features/agent/chat/SlidingThinkingIndicator.tsx +5 -3
  611. package/src/features/agent/chat/VegaLiteChart.tsx +20 -8
  612. package/src/features/agent/chat/hooks/useAgentPlans.ts +3 -9
  613. package/src/features/agent/chat/hooks/useAgentStream.ts +80 -19
  614. package/src/features/agent/chat/hooks/useArtifacts.ts +151 -0
  615. package/src/features/agent/chat/hooks/useDocumentPanel.ts +65 -5
  616. package/src/features/agent/chat/hooks/useFileProcessing.ts +14 -13
  617. package/src/features/agent/chat/types/document.ts +2 -0
  618. package/src/features/errors/PanelErrorBoundary.tsx +5 -3
  619. package/src/features/facets/AgentRunnerFacetsNav.tsx +54 -35
  620. package/src/features/facets/RunsFacetsNav.tsx +6 -6
  621. package/src/features/facets/index.ts +1 -1
  622. package/src/features/layout/GenericPageNavHeader.tsx +64 -41
  623. package/src/features/layout/NotFoundView.tsx +4 -1
  624. package/src/features/magic-pdf/AnnotatedImageSlider.tsx +12 -8
  625. package/src/features/magic-pdf/DownloadPopover.tsx +11 -10
  626. package/src/features/magic-pdf/MagicPdfView.tsx +10 -7
  627. package/src/features/pdf-viewer/PdfPageSlider.tsx +10 -6
  628. package/src/features/pdf-viewer/SimplePdfViewer.tsx +5 -3
  629. package/src/features/permissions/UserPermissionsProvider.tsx +3 -1
  630. package/src/features/store/collections/BrowseCollectionView.tsx +11 -1
  631. package/src/features/store/collections/CollectionsTable.tsx +20 -12
  632. package/src/features/store/collections/CreateCollection.tsx +45 -40
  633. package/src/features/store/collections/EditCollectionView.tsx +31 -28
  634. package/src/features/store/collections/SelectCollection.tsx +50 -14
  635. package/src/features/store/collections/SharedPropsEditor.tsx +7 -5
  636. package/src/features/store/collections/SyncMemberHeadsToggle.tsx +6 -4
  637. package/src/features/store/objects/DocumentPreviewPanel.tsx +30 -28
  638. package/src/features/store/objects/DocumentSearchResults.tsx +31 -21
  639. package/src/features/store/objects/DocumentTable.tsx +11 -5
  640. package/src/features/store/objects/ExportPropertiesModal.tsx +8 -5
  641. package/src/features/store/objects/components/ContentDispositionButton.tsx +3 -1
  642. package/src/features/store/objects/components/ContentOverview.tsx +96 -50
  643. package/src/features/store/objects/components/DocumentIcon.tsx +11 -3
  644. package/src/features/store/objects/components/PropertiesEditorModal.tsx +14 -12
  645. package/src/features/store/objects/components/SaveVersionConfirmModal.tsx +24 -37
  646. package/src/features/store/objects/components/SelectDocument.tsx +15 -6
  647. package/src/features/store/objects/components/TextEditorPanel.tsx +143 -0
  648. package/src/features/store/objects/components/VectorSearchWidget.tsx +11 -8
  649. package/src/features/store/objects/components/useContentPanelHooks.ts +4 -2
  650. package/src/features/store/objects/components/useDownloadFile.ts +12 -10
  651. package/src/features/store/objects/layout/documentLayout.tsx +16 -6
  652. package/src/features/store/objects/layout/renderers.tsx +27 -1
  653. package/src/features/store/objects/search/DocumentSearchContext.ts +3 -2
  654. package/src/features/store/objects/search/DocumentSearchProvider.tsx +3 -0
  655. package/src/features/store/objects/selection/ObjectsActionContext.tsx +26 -128
  656. package/src/features/store/objects/selection/ObjectsActionContextClass.ts +59 -0
  657. package/src/features/store/objects/selection/ObjectsActionHooks.ts +33 -0
  658. package/src/features/store/objects/selection/ObjectsActionSpec.ts +4 -1
  659. package/src/features/store/objects/selection/SelectionActions.tsx +14 -6
  660. package/src/features/store/objects/selection/actions/AddToCollectionAction.tsx +19 -14
  661. package/src/features/store/objects/selection/actions/ChangeTypeAction.tsx +9 -5
  662. package/src/features/store/objects/selection/actions/ConfirmAction.tsx +4 -3
  663. package/src/features/store/objects/selection/actions/DeleteObjectsAction.tsx +24 -23
  664. package/src/features/store/objects/selection/actions/ExportPropertiesAction.tsx +10 -5
  665. package/src/features/store/objects/selection/actions/RemoveFromCollectionAction.tsx +13 -9
  666. package/src/features/store/objects/selection/actions/StartWorkflowComponent.tsx +14 -8
  667. package/src/features/store/objects/upload/DocumentUploadModal.tsx +56 -55
  668. package/src/features/store/objects/upload/useSmartFileUploadProcessing.ts +4 -2
  669. package/src/features/store/objects/upload/useUploadHandler.ts +9 -7
  670. package/src/features/store/types/ContentObjectTypesSearch.tsx +10 -8
  671. package/src/features/store/types/ContentObjectTypesTable.tsx +6 -4
  672. package/src/features/store/types/CreateOrUpdateTypeModal.tsx +11 -12
  673. package/src/features/store/types/ObjectSchemaEditor.tsx +11 -9
  674. package/src/features/store/types/SelectContentType.tsx +15 -13
  675. package/src/features/store/types/SelectContentTypeModal.tsx +16 -13
  676. package/src/features/store/types/TableLayoutEditor.tsx +16 -12
  677. package/src/features/user/UserInfo.tsx +47 -56
  678. package/src/i18n/index.tsx +45 -0
  679. package/src/i18n/instance.ts +49 -0
  680. package/src/i18n/locales/ar.json +694 -0
  681. package/src/i18n/locales/de.json +662 -0
  682. package/src/i18n/locales/en.json +663 -0
  683. package/src/i18n/locales/es.json +668 -0
  684. package/src/i18n/locales/fr.json +670 -0
  685. package/src/i18n/locales/it.json +668 -0
  686. package/src/i18n/locales/ja.json +662 -0
  687. package/src/i18n/locales/ko.json +662 -0
  688. package/src/i18n/locales/pt.json +668 -0
  689. package/src/i18n/locales/ru.json +678 -0
  690. package/src/i18n/locales/tr.json +662 -0
  691. package/src/i18n/locales/zh-TW.json +662 -0
  692. package/src/i18n/locales/zh.json +662 -0
  693. package/src/layout/FullHeightLayout.tsx +8 -0
  694. package/src/layout/Navbar.tsx +4 -2
  695. package/src/layout/RegionTag.tsx +25 -0
  696. package/src/layout/Sidebar.tsx +4 -3
  697. package/src/layout/index.ts +2 -1
  698. package/src/router/HistoryNavigator.ts +10 -10
  699. package/src/router/Nav.tsx +9 -3
  700. package/src/router/NestedNavigationContext.tsx +4 -0
  701. package/src/router/NestedRouterProvider.tsx +3 -1
  702. package/src/router/Router.tsx +23 -7
  703. package/src/session/UserSession.ts +32 -0
  704. package/src/session/UserSessionProvider.tsx +4 -0
  705. package/src/session/auth/composable.ts +1 -1
  706. package/src/session/auth/firebase.ts +1 -1
  707. package/src/session/auth/useCurrentTenant.ts +3 -1
  708. package/src/shell/SplashScreen.tsx +22 -26
  709. package/src/shell/apps/StandaloneApp.tsx +9 -6
  710. package/src/shell/login/EnterpriseSigninButton.tsx +6 -4
  711. package/src/shell/login/GitHubSignInButton.tsx +3 -7
  712. package/src/shell/login/GoogleSignInButton.tsx +3 -1
  713. package/src/shell/login/InviteAcceptModal.tsx +5 -2
  714. package/src/shell/login/MicrosoftSigninButton.tsx +4 -6
  715. package/src/shell/login/SigninScreen.tsx +18 -13
  716. package/src/shell/login/SignupForm.tsx +46 -46
  717. package/src/shell/login/TerminalLogin.tsx +36 -33
  718. package/src/shell/login/UserInfo.tsx +15 -13
  719. package/src/shell/login/UserSessionMenu.tsx +28 -31
  720. package/src/widgets/index.ts +0 -1
  721. package/src/widgets/json-view/JSONCode.tsx +1 -1
  722. package/src/widgets/json-view/JSONDisplay.tsx +8 -3
  723. package/src/widgets/json-view/JSONSwitcher.tsx +24 -0
  724. package/src/widgets/json-view/JSONView.tsx +1 -1
  725. package/src/widgets/json-view/index.ts +1 -0
  726. package/src/widgets/markdown/ArtifactContentRenderer.tsx +15 -7
  727. package/src/widgets/markdown/CodeBlockContext.tsx +34 -0
  728. package/src/widgets/markdown/MarkdownRenderer.tsx +14 -13
  729. package/src/widgets/markdown/codeBlockHandlers.tsx +17 -36
  730. package/src/widgets/markdown/index.ts +27 -34
  731. package/src/widgets/markdown/remarkDirectiveHandler.ts +1 -1
  732. package/src/widgets/schema-editor/ManagedSchema.ts +6 -5
  733. package/src/widgets/schema-editor/editor/PropertyEditor.tsx +7 -3
  734. package/src/widgets/schema-editor/editor/SchemaEditor.tsx +3 -1
  735. package/src/widgets/upload/DropZone.tsx +10 -13
  736. package/src/widgets/upload/UploadResultCategory.tsx +3 -1
  737. package/src/widgets/upload/UploadSummary.tsx +13 -11
  738. package/tsconfig.dist.json +1 -1
  739. package/lib/esm/core/components/Dropdown.js +0 -16
  740. package/lib/esm/core/components/Dropdown.js.map +0 -1
  741. package/lib/esm/core/components/DropdownList.js +0 -9
  742. package/lib/esm/core/components/DropdownList.js.map +0 -1
  743. package/lib/esm/core/components/RadioGroup.js +0 -34
  744. package/lib/esm/core/components/RadioGroup.js.map +0 -1
  745. package/lib/esm/core/components/SelectStack.js +0 -8
  746. package/lib/esm/core/components/SelectStack.js.map +0 -1
  747. package/lib/esm/core/components/Switch.js +0 -12
  748. package/lib/esm/core/components/Switch.js.map +0 -1
  749. package/lib/esm/widgets/popover/Popover.js +0 -73
  750. package/lib/esm/widgets/popover/Popover.js.map +0 -1
  751. package/lib/esm/widgets/popover/context.js +0 -7
  752. package/lib/esm/widgets/popover/context.js.map +0 -1
  753. package/lib/esm/widgets/popover/index.js +0 -3
  754. package/lib/esm/widgets/popover/index.js.map +0 -1
  755. package/lib/esm/widgets/popover/slots.js +0 -22
  756. package/lib/esm/widgets/popover/slots.js.map +0 -1
  757. package/lib/types/core/components/Dropdown.d.ts +0 -15
  758. package/lib/types/core/components/Dropdown.d.ts.map +0 -1
  759. package/lib/types/core/components/DropdownList.d.ts +0 -13
  760. package/lib/types/core/components/DropdownList.d.ts.map +0 -1
  761. package/lib/types/core/components/RadioGroup.d.ts +0 -26
  762. package/lib/types/core/components/RadioGroup.d.ts.map +0 -1
  763. package/lib/types/core/components/SelectStack.d.ts +0 -13
  764. package/lib/types/core/components/SelectStack.d.ts.map +0 -1
  765. package/lib/types/core/components/Switch.d.ts +0 -11
  766. package/lib/types/core/components/Switch.d.ts.map +0 -1
  767. package/lib/types/widgets/popover/Popover.d.ts +0 -38
  768. package/lib/types/widgets/popover/Popover.d.ts.map +0 -1
  769. package/lib/types/widgets/popover/context.d.ts +0 -8
  770. package/lib/types/widgets/popover/context.d.ts.map +0 -1
  771. package/lib/types/widgets/popover/index.d.ts +0 -3
  772. package/lib/types/widgets/popover/index.d.ts.map +0 -1
  773. package/lib/types/widgets/popover/slots.d.ts +0 -5
  774. package/lib/types/widgets/popover/slots.d.ts.map +0 -1
  775. package/src/core/components/Dropdown.tsx +0 -63
  776. package/src/core/components/DropdownList.tsx +0 -72
  777. package/src/core/components/RadioGroup.tsx +0 -100
  778. package/src/core/components/SelectStack.tsx +0 -63
  779. package/src/core/components/Switch.tsx +0 -30
  780. package/src/widgets/popover/Popover.tsx +0 -171
  781. package/src/widgets/popover/context.ts +0 -15
  782. package/src/widgets/popover/index.ts +0 -2
  783. package/src/widgets/popover/slots.ts +0 -24
@@ -1 +1 @@
1
- {"version":3,"file":"vertesia-ui-widgets.js","sources":["esm/widgets/monacoEditor/MonacoEditor.js","esm/widgets/form/FormContext.js","esm/widgets/form/inputs.js","esm/widgets/form/Form.js","esm/widgets/form/schema.js","esm/widgets/form/ManagedObject.js","esm/widgets/form/fields.js","esm/widgets/json-view/JSONCode.js","esm/widgets/json-view/JSONView.js","esm/widgets/json-view/JSONDisplay.js","esm/widgets/markdown/CodeBlockRendering.js","esm/features/agent/chat/useArtifactUrlCache.js","esm/widgets/markdown/useResolvedUrl.js","esm/widgets/markdown/CodeBlockPlaceholder.js","esm/widgets/markdown/MarkdownLink.js","esm/widgets/markdown/MarkdownImage.js","esm/widgets/markdown/MarkdownFigure.js","esm/widgets/markdown/remarkDirectiveHandler.js","esm/widgets/markdown/normalizeCustomSchemeLinks.js","esm/widgets/markdown/normalizeDirectives.js","esm/core/components/libs/utils.js","esm/features/agent/chat/VegaLiteChart.js","esm/widgets/markdown/MermaidDiagram.js","esm/features/agent/chat/AskUserWidget.js","esm/widgets/markdown/useArtifactContent.js","esm/widgets/markdown/ArtifactContentRenderer.js","esm/widgets/markdown/codeBlockHandlers.js","esm/widgets/markdown/MarkdownRenderer.js","esm/widgets/popover/context.js","esm/widgets/popover/slots.js","esm/widgets/popover/Popover.js","esm/widgets/Progress.js","esm/widgets/properties/PropertiesView.js","esm/widgets/schema-editor/type-signature.js","esm/widgets/schema-editor/json-schema4-utils.js","esm/widgets/schema-editor/ManagedSchema.js","esm/widgets/schema-editor/editor/EditableSchemaProperty.js","esm/widgets/schema-editor/editor/PropertyEditor.js","esm/widgets/schema-editor/editor/PropertyViewer.js","esm/widgets/schema-editor/editor/SchemaContext.js","esm/widgets/schema-editor/editor/Editable.js","esm/widgets/schema-editor/editor/SchemaEditor.js","esm/widgets/SvgIcon.js","esm/widgets/upload/DropZone.js","esm/widgets/upload/UploadResultCategory.js","esm/widgets/upload/UploadSummary.js","esm/widgets/xml-viewer/constants/index.js","esm/widgets/xml-viewer/context/xml-viewer-context.js","esm/widgets/xml-viewer/hooks/useXMLViewer.js","esm/widgets/xml-viewer/components/CDataTag/index.js","esm/widgets/xml-viewer/components/CollapseIcon/index.js","esm/widgets/xml-viewer/hooks/useCollapsible.js","esm/widgets/xml-viewer/components/CommentTag/index.js","esm/widgets/xml-viewer/components/Attributes/index.js","esm/widgets/xml-viewer/components/DeclarationTag/index.js","esm/widgets/xml-viewer/helpers/index.js","esm/widgets/xml-viewer/components/Tag/index.js","esm/widgets/xml-viewer/components/TextElement/index.js","esm/widgets/xml-viewer/components/Elements/index.js","esm/widgets/xml-viewer/components/InvalidXml/index.js","esm/widgets/xml-viewer/components/XMLViewer.js"],"sourcesContent":["import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { Editor } from '@monaco-editor/react';\nimport { useTheme } from '@vertesia/ui/core';\nimport debounce from 'debounce';\nimport clsx from 'clsx';\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nexport class VEditorApi {\n VgetValue;\n VsetValue;\n constructor(VgetValue, VsetValue) {\n this.VgetValue = VgetValue;\n this.VsetValue = VsetValue;\n }\n getValue() {\n return this.VgetValue();\n }\n setValue(value) {\n this.VsetValue(value || '');\n }\n}\nexport function MonacoEditor({ onChange, value, className, editorRef, language = 'javascript', debounceTimeout = 0, options = {}, beforeMount, onMount, defaultValue, }) {\n const [editorValue, setEditorValue] = useState(value || defaultValue || '');\n const editorInstanceRef = useRef(null);\n const { theme } = useTheme();\n const getValueRef = useRef(() => editorValue);\n const setValueRef = useRef((newValue) => {\n setEditorValue(newValue);\n if (editorInstanceRef.current) {\n editorInstanceRef.current.setValue(newValue);\n }\n });\n useEffect(() => {\n getValueRef.current = () => editorValue;\n }, [editorValue]);\n useEffect(() => {\n if (editorRef) {\n editorRef.current = new VEditorApi(() => getValueRef.current(), (value) => setValueRef.current(value));\n }\n return () => {\n if (editorRef) {\n editorRef.current = undefined;\n }\n };\n }, [editorRef]);\n const debouncedOnChange = useMemo(() => {\n if (!onChange)\n return undefined;\n if (debounceTimeout > 0) {\n return debounce((update) => onChange(update), debounceTimeout);\n }\n else {\n return onChange;\n }\n }, [onChange, debounceTimeout]);\n const handleEditorChange = useCallback((newValue) => {\n const actualValue = newValue || '';\n setEditorValue(actualValue);\n if (debouncedOnChange) {\n const update = {\n docChanged: true,\n state: {\n doc: {\n toString: () => actualValue,\n length: actualValue.length\n }\n }\n };\n // Using type assertion through unknown to avoid complex type mocking\n debouncedOnChange(update);\n }\n }, [debouncedOnChange]);\n const handleEditorDidMount = useCallback((editor, monacoInstance) => {\n editorInstanceRef.current = editor;\n // Update the setValue ref to use the actual editor instance\n setValueRef.current = (newValue) => {\n setEditorValue(newValue);\n editor.setValue(newValue);\n };\n // Set up custom theme for better error line highlighting\n monacoInstance.editor.defineTheme('errorLineTheme', {\n base: theme === 'dark' ? 'vs-dark' : 'vs',\n inherit: true,\n rules: [],\n colors: {\n 'editorError.background': '#ffebee',\n 'editorError.border': '#f44336',\n },\n });\n monacoInstance.editor.setTheme('errorLineTheme');\n // Call custom onMount if provided\n onMount?.(editor, monacoInstance);\n }, [onMount, theme]);\n // Update editor value when prop changes from outside\n useEffect(() => {\n const effectiveValue = value || defaultValue || '';\n if (effectiveValue !== editorValue) {\n setEditorValue(effectiveValue);\n if (editorInstanceRef.current) {\n editorInstanceRef.current.setValue(effectiveValue);\n }\n }\n }, [value]); // Only depend on value prop, not editorValue\n const defaultOptions = {\n fontSize: 14,\n fontFamily: 'monospace',\n minimap: { enabled: false },\n scrollBeyondLastLine: false,\n wordWrap: 'on',\n lineNumbers: 'on',\n folding: false,\n lineDecorationsWidth: 10,\n lineNumbersMinChars: 3,\n automaticLayout: true,\n formatOnPaste: true,\n formatOnType: true,\n tabSize: 2,\n insertSpaces: true,\n glyphMargin: true, // Enable better error reporting\n renderValidationDecorations: 'on', // Show error squiggles\n renderLineHighlight: 'line', // Highlight entire line for errors\n hover: {\n enabled: true,\n delay: 100\n }, // Enable hover for error messages\n quickSuggestions: {\n other: true,\n comments: true,\n strings: true\n }, // Show problems panel information\n ...options\n };\n return (_jsx(\"div\", { className: clsx(className, 'w-full h-full!'), children: _jsx(Editor, { className: \"h-full w-full\", height: \"100%\", theme: theme === 'dark' ? 'vs-dark' : 'light', language: language, value: editorValue, onChange: handleEditorChange, onMount: handleEditorDidMount, beforeMount: beforeMount, options: defaultOptions, defaultValue: defaultValue || '' }) }));\n}\n//# sourceMappingURL=MonacoEditor.js.map","import { createContext, useContext } from \"react\";\nconst FieldSetContext = createContext(undefined);\nconst FieldSetContextProvider = FieldSetContext.Provider;\nexport function useFieldSet() {\n const ctx = useContext(FieldSetContext);\n if (!ctx) {\n throw new Error('useFieldSet must be used within a Form or FieldSet element');\n }\n return ctx;\n}\nexport class FormContext {\n object;\n components;\n disabled;\n constructor(object, components = {}, disabled = false) {\n this.object = object;\n this.components = components;\n this.disabled = disabled;\n }\n}\nconst _FormContext = createContext(undefined);\nexport function useForm() {\n const ctx = useContext(_FormContext);\n if (!ctx) {\n throw new Error('useForm must be used within a Form element');\n }\n return ctx;\n}\nconst FormContextProvider = _FormContext.Provider;\nexport { FieldSetContextProvider, FormContextProvider };\n//# sourceMappingURL=FormContext.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport clsx from \"clsx\";\nimport React, { useState } from \"react\";\nimport { Styles } from \"@vertesia/ui/core\";\nconst Input = React.forwardRef(({ object, type = 'text', onChange, ...props }, ref) => {\n const [actualValue, setValue] = useState(object.value != null ? String(object.value) : '');\n const [booleanValue, setBooleanValue] = useState(object.schema.isBoolean && object.value === true);\n if (props.className) {\n props.className = clsx(Styles.INPUT, props.className);\n }\n else {\n props.className = Styles.INPUT;\n }\n const _onChange = (ev) => {\n if (props.disabled)\n return;\n setValue(ev.target.value);\n if (object.schema.isBoolean) {\n object.value = ev.target.checked;\n setBooleanValue(object.value);\n }\n else {\n object.value = ev.target.value;\n }\n onChange && onChange(ev);\n };\n if (type === 'textarea') {\n return (_jsx(\"textarea\", { ref: ref, ...props, value: actualValue, onChange: _onChange }));\n }\n else if (type === 'checkbox') {\n return (_jsx(\"input\", { ref: ref, ...props, type: \"checkbox\", checked: booleanValue, onChange: _onChange, className: \"form-check-input\" }));\n }\n else {\n return (_jsx(\"input\", { ref: ref, ...props, type: type, value: actualValue, onChange: _onChange }));\n }\n});\nexport { Input };\n//# sourceMappingURL=inputs.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { Button, FormItem } from \"@vertesia/ui/core\";\nimport clsx from \"clsx\";\nimport { Plus, Trash2 } from \"lucide-react\";\nimport { useState } from \"react\";\nimport { FormContext, FormContextProvider, useForm } from \"./FormContext.js\";\nimport { Input } from \"./inputs.js\";\nexport function Form({ object, components, onSubmit, children, onChange, disabled }) {\n const _onSubmit = (evt) => {\n evt.stopPropagation();\n evt.preventDefault();\n onSubmit && onSubmit(object.value);\n };\n object.observer = onChange;\n return (_jsx(FormContextProvider, { value: new FormContext(object, components || {}, disabled ?? false), children: _jsx(\"form\", { className: \"w-full\", onSubmit: _onSubmit, children: children }) }));\n}\nfunction GeneratedFormFields() {\n const ctx = useForm();\n return (_jsx(\"div\", { className: 'flex flex-col gap-4 w-full', children: ctx.object.properties.map(renderProperty) }));\n}\nexport function GeneratedForm({ children, ...props }) {\n return (_jsxs(Form, { ...props, children: [_jsx(GeneratedFormFields, {}), children] }));\n}\nfunction renderProperty(prop) {\n if (prop.isList) {\n return _jsx(ListField, { object: prop }, prop.name);\n }\n else if (prop.isObject) {\n return _jsx(CompositeField, { object: prop }, prop.name);\n }\n else {\n return _jsx(ScalarField, { object: prop }, prop.name);\n }\n}\nfunction renderItemProperty(prop, editor) {\n if (prop.isList) {\n return _jsx(ListField, { object: prop });\n }\n else if (prop.isObject) {\n return _jsx(CompositeField, { object: prop });\n }\n else {\n return _jsx(ScalarField, { object: prop, editor: editor });\n }\n}\nexport function ScalarField({ object, editor, inline = false }) {\n if (!editor) {\n editor = object.schema.editor;\n }\n const { components, disabled } = useForm();\n const Component = (editor && components[editor]) || Input;\n const inputType = object.getInputType();\n if (inputType === 'checkbox') {\n inline = true;\n }\n const handleOnChange = (event) => {\n if (disabled)\n return;\n if (object.schema.isBoolean) {\n object.value = event.target.checked;\n }\n else if (object.schema.isNumber) {\n object.value = parseFloat(event.target.value);\n }\n else {\n object.value = event.target.value;\n }\n };\n if (object.isListItem) {\n // List items don't need the FormItem wrapper (no label, description, etc.)\n return _jsx(Component, { object: object, type: inputType, onChange: handleOnChange, disabled: disabled });\n }\n return (_jsx(FormItem, { label: object.title, required: object.schema.isRequired, description: object.schema.description, className: clsx('flex', inline ? 'flex-row items-center' : 'flex-col'), children: _jsx(Component, { object: object, type: inputType, onChange: handleOnChange, disabled: disabled }) }));\n}\nfunction CompositeField({ object }) {\n return (_jsxs(\"div\", { className: \"flex flex-col gap-4 my-4 py-2 pl-4 border-l-4 border-l-solid border-l-slate-100 dark:border-l-slate-600\", children: [!object.isListItem && _jsx(\"div\", { className: 'text-gray-900 dark:text-gray-200 font-semibold', children: object.title }), object.properties.map(renderProperty)] }));\n}\nfunction ListField({ object }) {\n const [value, setValue] = useState(object.value || []);\n const { disabled } = useForm();\n const addItem = () => {\n if (disabled)\n return;\n object.add();\n setValue([...object.value]);\n };\n const deleteItem = (index) => {\n if (disabled)\n return;\n object.remove(index);\n setValue([...object.value]);\n };\n return (_jsxs(\"div\", { className: \"flex flex-col gap-4 my-4 py-2 pl-4 border-l-4 border-l-solid border-l-slate-100 darK:border-l-slate-600\", children: [!object.isListItem && _jsx(\"div\", { className: 'text-gray-900 dark:text-gray-200 font-semibold', children: object.title }), object.items.map((item, index) => {\n return _jsx(ListItem, { object: item, list: object, onDelete: () => deleteItem(index), disabled: disabled }, `${index}-${value[index] ?? ''}`);\n }), _jsx(\"div\", { children: _jsxs(Button, { variant: 'secondary', onClick: addItem, disabled: disabled, children: [_jsx(Plus, { className: \"size-6\" }), \" Add\"] }) })] }));\n}\nfunction ListItem({ list, object, onDelete, disabled }) {\n return (_jsxs(\"div\", { className: 'flex gap-2 w-full', children: [_jsx(\"div\", { className: \"flex-1\", children: renderItemProperty(object, list.schema.arraySchema.editor) }), _jsx(Button, { variant: 'secondary', onClick: onDelete, disabled: disabled, children: _jsx(Trash2, { className: 'size-4' }) })] }));\n}\n//# sourceMappingURL=Form.js.map","import Ajv from \"ajv\";\nimport addFormats from \"ajv-formats\";\nfunction createSchemaFromType(type) {\n if (type === 'object') {\n return { type: 'object', properties: {} };\n }\n else if (type === 'array') {\n return { type: 'array', items: {} };\n }\n else {\n return { type };\n }\n}\nexport class Schema {\n schema;\n properties = {};\n _validator;\n constructor(schema) {\n this.schema = schema || { type: 'object', properties: {} };\n this.load();\n }\n get validator() {\n if (!this._validator) {\n const ajv = new Ajv({ allErrors: true, strict: false });\n addFormats(ajv);\n this._validator = ajv.compile(this.schema);\n }\n return this._validator;\n }\n load() {\n if (this.schema.properties) {\n const properties = this.schema.properties;\n Object.keys(properties).forEach(name => {\n this.loadProperty(name, properties[name]);\n });\n }\n }\n hasProperties() {\n return Object.keys(this.properties).length > 0;\n }\n get title() {\n return this.schema.title || this.schema.name;\n }\n get description() {\n return this.schema.description;\n }\n loadProperty(name, propertySchema) {\n let property;\n if (propertySchema.type === 'array') {\n property = new ArrayPropertySchema(this, name, propertySchema);\n }\n else {\n property = new PropertySchema(this, name, propertySchema);\n }\n this.properties[name] = property;\n return property;\n }\n get type() {\n return this.schema.type;\n }\n validate(value) {\n if (!this.validator(value)) {\n return this.validator.errors || [];\n }\n else {\n return null;\n }\n }\n addProperty(name, typeOrSchema, isRequired = false) {\n if (this.schema.type !== 'object') {\n this.schema.type = 'object';\n }\n if (!this.schema.properties) {\n this.schema.properties = {};\n }\n const propertySchema = typeof typeOrSchema === 'string' ? createSchemaFromType(typeOrSchema) : typeOrSchema;\n const property = this.loadProperty(name, propertySchema);\n this.schema.properties[property.name] = property.schema;\n if (isRequired) {\n property.isRequired = true;\n }\n return property;\n }\n removeProperty(name) {\n if (this.schema.properties) {\n delete this.schema.properties[name];\n if (Array.isArray(this.schema.required)) {\n this.schema.required = this.schema.required.filter(x => x !== name);\n }\n }\n delete this.properties[name];\n }\n getProperty(name) {\n return this.properties[name];\n }\n get editor() {\n return this.schema.editor;\n }\n}\nexport class PropertySchema extends Schema {\n parent;\n name;\n constructor(parent, name, schema) {\n super(schema);\n this.parent = parent;\n this.name = name;\n if (schema.type === 'array') {\n throw new Error(\"Array property must be instantiated using ArrayPropertySchema\");\n }\n if (schema.type === 'object' && !schema.properties) {\n schema.properties = {};\n }\n }\n get isMulti() {\n return false;\n }\n get isReadOnly() {\n return !!this.schema.readOnly;\n }\n set isReadOnly(value) {\n this.schema.readOnly = value;\n }\n get defaultValue() {\n return this.schema.default;\n }\n set defaultValue(value) {\n this.schema.default = value;\n }\n get enum() {\n return this.schema.enum;\n }\n set enum(values) {\n this.schema.enum = values;\n }\n get isRequired() {\n const required = this.parent.schema.required;\n return required ? required.includes(this.name) : false;\n }\n set isRequired(value) {\n let required = Array.isArray(this.parent.schema.required) ? this.parent.schema.required : [];\n if (value) {\n required = required.concat(this.name);\n }\n else {\n required = required.filter(x => x !== this.name);\n }\n this.parent.schema.required = required;\n }\n get type() {\n return this.schema.type;\n }\n set type(value) {\n if (this.schema.type !== value) {\n this.schema.type = value;\n if (value !== 'object') { // remove sub properties\n this.properties = {};\n this.schema.properties = undefined;\n }\n }\n }\n remove() {\n this.parent.removeProperty(this.name);\n }\n get isBoolean() {\n return this.type === 'boolean';\n }\n get isString() {\n return this.type === 'string';\n }\n get isNumber() {\n return this.type === 'number' || this.type === 'integer';\n }\n get isObject() {\n return this.type === 'object';\n }\n}\nfunction getArrayElementType(schema) {\n if (schema.type !== 'array') {\n throw new Error('Expecting an array schema');\n }\n if (!schema.items) {\n schema.items = {};\n }\n else if (Array.isArray(schema.items)) {\n throw new Error('Tuple arrays are not supported');\n }\n return schema.items;\n}\nexport class ArrayPropertySchema extends PropertySchema {\n arraySchema;\n constructor(parent, name, schema) {\n super(parent, name, getArrayElementType(schema));\n this.arraySchema = schema;\n }\n get isMulti() {\n return true;\n }\n}\n//# sourceMappingURL=schema.js.map","import { Schema } from \"./schema.js\";\nexport function computeTitleFromName(name) {\n name = name.replace(/_/g, ' ').replace(/([a-z0-9])&([A-Z])/g, \"$1 $2\");\n return name[0].toUpperCase() + name.slice(1);\n}\nfunction getInputType(_name, schema) {\n if (schema.editor) {\n return schema.editor;\n }\n // Check format as fallback (e.g., \"document\", \"media\", \"date\", etc.)\n if (schema.schema.format) {\n return schema.schema.format;\n }\n switch (schema.type) {\n case 'number':\n case 'integer':\n return 'number';\n case 'boolean':\n return 'checkbox';\n case 'string':\n return \"text\";\n default:\n return 'text';\n }\n}\nexport class Node {\n parent;\n schema;\n name;\n // change observer\n observer; // return false to stop bubbling\n constructor(parent, schema, name) {\n this.parent = parent;\n this.schema = schema;\n this.name = name;\n }\n get isRoot() {\n return !this.parent;\n }\n get root() {\n return this.parent ? this.parent.root : this;\n }\n get path() {\n return this.parent ? this.parent.path.concat(this.name) : [];\n }\n get isScalar() {\n return false;\n }\n get isListItem() {\n return false;\n }\n get isObject() {\n return false;\n }\n get isList() {\n return false;\n }\n get title() {\n return this.schema.title || computeTitleFromName(this.name);\n }\n onChange(node) {\n if (this.observer) {\n if (this.observer(this) === false) {\n return;\n }\n ;\n }\n this.parent && this.parent.onChange(node);\n }\n}\nexport class ManagedObjectBase extends Node {\n constructor(parent, schema, name) {\n super(parent, schema, name);\n }\n get isObject() {\n return true;\n }\n getProperty(name) {\n const schema = this.schema.properties[name];\n if (schema.isMulti) {\n return new ManagedListProperty(this, schema, this.getOrInitArrayProperty(name));\n }\n else if (schema.isObject) {\n return new ManagedObjectProperty(this, schema, schema.name, this.getOrInitObjectProperty(name));\n }\n else {\n return new ManagedProperty(this, schema);\n }\n }\n getOrInitObjectProperty(name) {\n let value = this.value[name];\n if (!value) {\n this.value[name] = value = {};\n }\n return value;\n }\n getOrInitArrayProperty(name) {\n let value = this.value[name];\n if (!value) {\n this.value[name] = value = [];\n }\n return value;\n }\n setPropertyValue(name, value) {\n if (this.value[name] !== value) {\n this.value[name] = value;\n return true;\n }\n return false;\n }\n getPropertyValue(name) {\n return this.value[name];\n }\n get properties() {\n const out = [];\n for (const schema of Object.values(this.schema.properties)) {\n if (schema.isMulti) {\n out.push(new ManagedListProperty(this, schema, this.getOrInitArrayProperty(schema.name)));\n }\n else if (schema.isObject) {\n out.push(new ManagedObjectProperty(this, schema, schema.name, this.getOrInitObjectProperty(schema.name)));\n }\n else {\n out.push(new ManagedProperty(this, schema));\n }\n }\n return out;\n }\n [Symbol.iterator]() {\n return this.properties[Symbol.iterator]();\n }\n}\nexport class ManagedObject extends ManagedObjectBase {\n value;\n constructor(schema, value = {}) {\n super(null, schema instanceof Schema ? schema : new Schema(schema), '#root');\n this.value = value;\n }\n}\nexport class ManagedObjectProperty extends ManagedObjectBase {\n value;\n constructor(parent, schema, name, value) {\n super(parent, schema, name);\n this.value = value;\n }\n}\nexport class ManagedProperty extends Node {\n constructor(parent, schema) {\n super(parent, schema, schema.name);\n if (parent.value[this.name] === undefined && schema.defaultValue !== undefined) {\n parent.value[this.name] = schema.defaultValue;\n }\n }\n get isScalar() {\n return true;\n }\n set value(value) {\n const changed = this.parent.setPropertyValue(this.name, value);\n if (changed) {\n this.onChange(this);\n }\n }\n get value() {\n return this.parent.getPropertyValue(this.name);\n }\n getInputType() {\n return getInputType(this.name, this.schema);\n }\n}\nexport class ManagedListProperty extends Node {\n value;\n items = [];\n constructor(parent, schema, value) {\n super(parent, schema, schema.name);\n this.value = value;\n for (const _v of this.value) {\n this.add();\n }\n }\n get isList() {\n return true;\n }\n newItem(index) {\n if (this.schema.isObject) {\n return new ManageObjectEntry(this, index);\n }\n else {\n return new ManagedScalarEntry(this, index);\n }\n }\n add() {\n const item = this.newItem(this.items.length);\n this.items.push(item);\n return item;\n }\n //TODO change is fired even if the removed item is transient\n // how to mark an item as transient (an added item not yet set by the user)\n remove(index) {\n const value = this.value;\n if (index >= 0 && index < this.items.length) {\n this.items.splice(index, 1);\n // update indexes\n for (let i = 0, l = this.items.length; i < l; i++) {\n const item = this.items[i];\n item.index = i;\n item.name = String(i);\n }\n }\n if (Array.isArray(value) && index >= 0 && index < value.length) {\n value.splice(index, 1);\n // TODO trigger onChange only if this item isn't transient\n this.onChange(this);\n }\n }\n [Symbol.iterator]() {\n return this.items[Symbol.iterator]();\n }\n item(index) {\n if (index < 0 || index >= this.value.length) {\n return undefined;\n }\n const item = this.value[index];\n if (this.schema.isObject) {\n return new ManagedObjectProperty(this, this.schema, String(index), item);\n }\n else {\n return new ManagedScalarEntry(this, index);\n }\n }\n /**\n * remove undefined items from the end of the list if any\n */\n trim() {\n while (this.items[this.items.length - 1] === undefined) {\n this.items.pop();\n }\n }\n}\nexport class ManageObjectEntry extends ManagedObjectBase {\n index;\n key;\n constructor(parent, index) {\n super(parent, parent.schema, String(index));\n this.index = index;\n if (parent.value[index] === undefined) {\n parent.value[index] = {};\n }\n this.key = this.name + '@' + Date.now();\n }\n get isListItem() {\n return true;\n }\n set value(value) {\n this.parent.value[this.index] = value;\n }\n get value() {\n return this.parent.value[this.index];\n }\n}\nexport class ManagedScalarEntry extends Node {\n index;\n key;\n constructor(parent, index) {\n super(parent, parent.schema, String(index));\n this.index = index;\n if (parent.value[index] === undefined && parent.schema.defaultValue !== undefined) {\n parent.value[index] = parent.schema.defaultValue;\n }\n this.key = this.name + '@' + Date.now();\n }\n get isScalar() {\n return true;\n }\n get isListItem() {\n return true;\n }\n set value(value) {\n this.parent.value[this.index] = value;\n }\n get value() {\n return this.parent.value[this.index];\n }\n getInputType() {\n return getInputType(this.name, this.schema);\n }\n}\n//# sourceMappingURL=ManagedObject.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { FormItem } from \"@vertesia/ui/core\";\nexport function FormLabel({ label, required, children }) {\n return (_jsx(FormItem, { label: label, required: required, children: children }));\n}\nexport function FormHelper({ children }) {\n return (_jsx(\"p\", { className: \"mt-2 text-sm text-gray-500\", children: children }));\n}\nexport function FormError({ children }) {\n return (_jsx(\"p\", { className: \"mt-2 text-sm text-red-600\", children: children }));\n}\n//# sourceMappingURL=fields.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { useTheme } from '@vertesia/ui/core';\nimport { MonacoEditor } from '../monacoEditor/MonacoEditor';\nimport { useMemo } from 'react';\nexport function JSONCode({ data, className }) {\n const { theme } = useTheme();\n // Convert data to formatted JSON string\n const jsonString = useMemo(() => {\n try {\n return JSON.stringify(data, null, 2);\n }\n catch (error) {\n console.error('Failed to stringify JSON:', error);\n return '{}';\n }\n }, [data]);\n return (_jsx(\"div\", { className: `h-full ${className || ''}`, children: _jsx(MonacoEditor, { value: jsonString, language: \"json\", theme: theme === 'dark' ? 'vs-dark' : 'vs', options: {\n readOnly: true,\n domReadOnly: true,\n } }) }));\n}\n//# sourceMappingURL=JSONCode.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { DotBadge } from \"@vertesia/ui/core\";\nimport clsx from \"clsx\";\nimport { computeTitleFromName } from \"../form/ManagedObject.js\";\nexport function JSONView({ value }) {\n return _jsx(\"div\", { className: \"flex flex-col gap-4\", children: Object.entries(value).map(([key, value]) => _jsx(PropertyElement, { name: key, value: value }, key)) });\n}\nfunction PropertyTitle({ name }) {\n return (_jsx(\"div\", { className: 'text-md font-semibold', children: computeTitleFromName(name) }));\n}\nfunction BlockElement({ children, className }) {\n return (_jsx(\"div\", { className: clsx('flex flex-col gap-4 py-2 pl-4 border-l-4 border-l-solid border-l-slate-100 dark:border-l-slate-600', className), children: children }));\n}\nfunction PropertyElement({ name, value }) {\n const info = getValueInfo(value);\n switch (info.type) {\n case ValueType.Inline:\n return (_jsxs(\"div\", { className: 'w-full flex gap-2', children: [_jsx(PropertyTitle, { name: name + ':' }), _jsx(\"p\", { children: info.value })] }));\n case ValueType.Paragraph:\n return (_jsxs(\"div\", { children: [_jsx(PropertyTitle, { name: name }), _jsx(\"p\", { children: info.value })] }));\n case ValueType.Prose:\n return (_jsxs(\"div\", { className: \"prose dark:prose-invert\", children: [_jsx(PropertyTitle, { name: name }), _jsx(\"div\", { className: 'vprose dark:prose-invert', children: info.value })] }));\n case ValueType.Array:\n return (_jsx(ArrayProperty, { name: name, value: value }));\n case ValueType.Object:\n return (_jsxs(\"div\", { children: [_jsx(PropertyTitle, { name: name }), _jsx(BlockElement, { className: 'mt-2', children: Object.entries(value).map(([key, value]) => _jsx(PropertyElement, { name: key, value: value }, key)) })] }));\n }\n}\nfunction ArrayProperty({ name, value }) {\n const inlineLength = value.join(' ').length;\n const itemMediumLength = inlineLength / value.length;\n const isInline = (typeof value[0] === 'string') && (inlineLength < 80 || inlineLength < 400 && itemMediumLength < 32);\n const useBullet = value.length > 9;\n return isInline ? (_jsxs(\"div\", { className: 'flex gap-2 flex-wrap', children: [name && _jsx(PropertyTitle, { name: name + ':' }), value.map((item, index) => _jsx(DotBadge, { children: String(item) }, index))] })) : (_jsxs(\"div\", { children: [name && _jsx(PropertyTitle, { name: name }), _jsx(\"div\", { className: 'flex flex-col gap-2', children: value.map((value, index) => _jsx(ItemProperty, { index: index, value: value, useBullet: useBullet }, index)) })] }));\n}\nfunction ItemProperty({ index, value, useBullet }) {\n const bullet = useBullet ? _jsx(\"span\", { className: 'text-xl', children: \"\\u2022\" }) : _jsxs(\"span\", { children: [index + 1, \".\"] });\n const info = getValueInfo(value);\n let content;\n switch (info.type) {\n case ValueType.Object:\n content = _jsx(BlockElement, { children: Object.entries(value).map(([key, value]) => _jsx(PropertyElement, { name: key, value: value }, key)) });\n break;\n case ValueType.Array:\n content = _jsx(ArrayProperty, { value: value });\n break;\n case ValueType.Prose:\n content = _jsx(\"div\", { className: \"prose dark:prose-invert\", children: info.value });\n break;\n default:\n content = _jsx(\"div\", { children: info.value });\n break;\n }\n return (_jsxs(\"div\", { className: 'flex gap-4 hover:bg-slate-50 dark:hover:bg-slate-800 py-2 pr-2 pl-4', children: [_jsx(\"div\", { className: 'font-semibold text-gray-600 dark:text-gray-400', children: bullet }), _jsx(\"div\", { children: content })] }));\n}\nvar ValueType;\n(function (ValueType) {\n ValueType[ValueType[\"Inline\"] = 0] = \"Inline\";\n ValueType[ValueType[\"Paragraph\"] = 1] = \"Paragraph\";\n ValueType[ValueType[\"Prose\"] = 2] = \"Prose\";\n ValueType[ValueType[\"Array\"] = 3] = \"Array\";\n ValueType[ValueType[\"Object\"] = 4] = \"Object\";\n})(ValueType || (ValueType = {}));\nfunction getValueInfo(value) {\n if (value == null) {\n return {\n value: '-',\n type: ValueType.Inline\n };\n }\n if (Array.isArray(value)) {\n return {\n value,\n type: ValueType.Array\n };\n }\n const type = typeof value;\n if (type === 'string') {\n const len = value.length;\n let type;\n if (len < 80) {\n type = ValueType.Inline;\n }\n else if (len > 400) {\n type = ValueType.Prose;\n }\n else {\n type = ValueType.Paragraph;\n value = value.replace(/(?:\\n\\n)+/g, '\\n\\n');\n }\n return { type, value };\n }\n else if (type === 'number' || type === 'boolean') {\n return {\n value: String(value),\n type: ValueType.Inline\n };\n }\n else {\n return {\n value,\n type: ValueType.Object\n };\n }\n}\n//# sourceMappingURL=JSONView.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { JSONCode } from './JSONCode.js';\nimport { JSONView } from './JSONView.js';\nexport function JSONDisplay({ value, viewCode = false }) {\n if (!value) {\n return (_jsx(\"pre\", { className: \"whitespace-pre-wrap\", children: \"No Data to display\" }));\n }\n return (_jsx(\"div\", { className: 'relative w-full h-full', children: viewCode ? _jsx(JSONCode, { data: value }) : _jsx(JSONView, { value: value }) }));\n}\n//# sourceMappingURL=JSONDisplay.js.map","import { jsx as _jsx, Fragment as _Fragment } from \"react/jsx-runtime\";\nimport { createContext, useContext, useMemo } from \"react\";\nexport class CodeBlockRendererRegistry {\n components = {};\n registerComponent(language, component) {\n this.components[language] = component;\n }\n getComponent(language) {\n return this.components[language];\n }\n}\nconst Context = createContext(null);\n/**\n * the compoennts must be memoized to avoid rerendering the provider unnecessarily\n * @param param0\n * @returns\n */\nexport function CodeBlockRendererProvider({ components, children }) {\n const registry = useMemo(() => {\n const registry = new CodeBlockRendererRegistry();\n for (const [language, component] of Object.entries(components)) {\n registry.registerComponent(language, component);\n }\n return registry;\n }, [components]);\n return (_jsx(_Fragment, { children: _jsx(Context.Provider, { value: registry, children: children }) }));\n}\nexport function useCodeBlockRendererRegistry() {\n return useContext(Context);\n}\nexport function useCodeBlockComponent(language) {\n const registry = useContext(Context);\n if (registry) {\n return registry.getComponent(language);\n }\n return undefined;\n}\n//# sourceMappingURL=CodeBlockRendering.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport React, { createContext, useContext, useCallback, useRef } from \"react\";\nconst ArtifactUrlCacheContext = createContext(null);\n/**\n * Provider component that maintains a cache of resolved artifact URLs.\n * This prevents re-fetching the same artifact URL multiple times during re-renders.\n */\nexport function ArtifactUrlCacheProvider({ children }) {\n const cacheRef = useRef(new Map());\n const pendingRef = useRef(new Map());\n const getUrl = useCallback((key) => {\n return cacheRef.current.get(key);\n }, []);\n const setUrl = useCallback((key, url) => {\n cacheRef.current.set(key, url);\n }, []);\n const getOrFetch = useCallback(async (key, fetcher) => {\n // Return cached URL if available\n const cached = cacheRef.current.get(key);\n if (cached) {\n return cached;\n }\n // Return pending promise if a fetch is already in progress\n const pending = pendingRef.current.get(key);\n if (pending) {\n return pending;\n }\n // Start new fetch and cache the promise\n const promise = fetcher().then((url) => {\n cacheRef.current.set(key, url);\n pendingRef.current.delete(key);\n return url;\n }).catch((err) => {\n pendingRef.current.delete(key);\n throw err;\n });\n pendingRef.current.set(key, promise);\n return promise;\n }, []);\n const value = React.useMemo(() => ({ getUrl, setUrl, getOrFetch }), [getUrl, setUrl, getOrFetch]);\n return (_jsx(ArtifactUrlCacheContext.Provider, { value: value, children: children }));\n}\n/**\n * Hook to access the artifact URL cache.\n * Returns null if used outside of ArtifactUrlCacheProvider.\n */\nexport function useArtifactUrlCache() {\n return useContext(ArtifactUrlCacheContext);\n}\n/**\n * Generate a cache key for an artifact URL.\n */\nexport function getArtifactCacheKey(runId, path, disposition = \"inline\") {\n return `artifact:${runId}:${path}:${disposition}`;\n}\n/**\n * Generate a cache key for a file URL.\n */\nexport function getFileCacheKey(path) {\n return `file:${path}`;\n}\n//# sourceMappingURL=useArtifactUrlCache.js.map","import { useState, useEffect, useCallback, useRef } from 'react';\nimport { useUserSession } from '@vertesia/ui/session';\nimport { useArtifactUrlCache, getArtifactCacheKey, getFileCacheKey, } from '../../features/agent/chat/useArtifactUrlCache';\n/**\n * Parses a URL and returns its scheme and path\n */\nexport function parseUrlScheme(rawUrl) {\n if (rawUrl.startsWith('artifact:')) {\n return { scheme: 'artifact', path: rawUrl.slice(9).trim() };\n }\n if (rawUrl.startsWith('image:')) {\n return { scheme: 'image', path: rawUrl.slice(6).trim() };\n }\n if (rawUrl.startsWith('store:')) {\n return { scheme: 'store', path: rawUrl.slice(6).trim() };\n }\n if (rawUrl.startsWith('document://')) {\n return { scheme: 'document', path: rawUrl.slice(11).trim() };\n }\n if (rawUrl.startsWith('collection:')) {\n return { scheme: 'collection', path: rawUrl.slice(11).trim() };\n }\n return { scheme: 'standard', path: rawUrl };\n}\n/**\n * Maps internal URL schemes to application routes\n */\nexport function mapSchemeToRoute(scheme, path) {\n switch (scheme) {\n case 'store':\n return path ? `/store/objects/${path}` : null;\n case 'document':\n return path ? `/store/objects/${path}` : null;\n case 'collection':\n return path ? `/store/collections/${path}` : null;\n default:\n return null;\n }\n}\n/**\n * Hook to resolve custom URL schemes (artifact:, image:, etc.) to actual URLs.\n * Handles caching, loading states, and error handling.\n */\nexport function useResolvedUrl({ rawUrl, artifactRunId, disposition = 'inline', }) {\n const { client } = useUserSession();\n const urlCache = useArtifactUrlCache();\n // Use refs to avoid triggering effect/callback re-runs when these stable values are accessed\n const clientRef = useRef(client);\n clientRef.current = client;\n const urlCacheRef = useRef(urlCache);\n urlCacheRef.current = urlCache;\n const { scheme, path } = parseUrlScheme(rawUrl);\n // For schemes that map to routes, resolve immediately\n const mappedRoute = mapSchemeToRoute(scheme, path);\n const [state, setState] = useState(() => {\n // If it's a mapped route, use that immediately\n if (mappedRoute) {\n return { url: mappedRoute, isLoading: false, error: undefined };\n }\n // If it's a standard URL, use as-is\n if (scheme === 'standard') {\n return { url: rawUrl, isLoading: false, error: undefined };\n }\n // For artifact/image schemes, check cache first\n if (urlCache && (scheme === 'artifact' || scheme === 'image')) {\n let cacheKey;\n if (scheme === 'artifact' && artifactRunId && !path.startsWith('agents/')) {\n cacheKey = getArtifactCacheKey(artifactRunId, path, disposition);\n }\n else {\n cacheKey = getFileCacheKey(path);\n }\n const cached = urlCache.getUrl(cacheKey);\n if (cached) {\n return { url: cached, isLoading: false, error: undefined };\n }\n }\n // Need to fetch\n return { url: undefined, isLoading: true, error: undefined };\n });\n const [retryCount, setRetryCount] = useState(0);\n const fetchUrl = useCallback(async () => {\n // Skip if already resolved or standard URL\n if (mappedRoute || scheme === 'standard') {\n return;\n }\n // Only artifact and image schemes need async resolution\n if (scheme !== 'artifact' && scheme !== 'image') {\n setState({ url: undefined, isLoading: false, error: `Unknown scheme: ${scheme}` });\n return;\n }\n setState(prev => ({ ...prev, isLoading: true, error: undefined }));\n const currentClient = clientRef.current;\n const currentUrlCache = urlCacheRef.current;\n try {\n let url;\n if (scheme === 'artifact') {\n if (artifactRunId && !path.startsWith('agents/')) {\n const cacheKey = getArtifactCacheKey(artifactRunId, path, disposition);\n if (currentUrlCache) {\n url = await currentUrlCache.getOrFetch(cacheKey, async () => {\n const result = await currentClient.files.getArtifactDownloadUrl(artifactRunId, path, disposition);\n return result.url;\n });\n }\n else {\n const result = await currentClient.files.getArtifactDownloadUrl(artifactRunId, path, disposition);\n url = result.url;\n }\n }\n else {\n const cacheKey = getFileCacheKey(path);\n if (currentUrlCache) {\n url = await currentUrlCache.getOrFetch(cacheKey, async () => {\n const result = await currentClient.files.getDownloadUrl(path);\n return result.url;\n });\n }\n else {\n const result = await currentClient.files.getDownloadUrl(path);\n url = result.url;\n }\n }\n }\n else {\n // image: scheme\n const cacheKey = getFileCacheKey(path);\n if (currentUrlCache) {\n url = await currentUrlCache.getOrFetch(cacheKey, async () => {\n const result = await currentClient.files.getDownloadUrl(path);\n return result.url;\n });\n }\n else {\n const result = await currentClient.files.getDownloadUrl(path);\n url = result.url;\n }\n }\n setState({ url, isLoading: false, error: undefined });\n }\n catch (err) {\n const errorMessage = err instanceof Error ? err.message : 'Failed to resolve URL';\n console.error('Failed to resolve URL:', path, err);\n setState({ url: undefined, isLoading: false, error: errorMessage });\n }\n }, [scheme, path, artifactRunId, disposition, mappedRoute]);\n useEffect(() => {\n // Skip if already resolved\n if (state.url && !state.error) {\n return;\n }\n let cancelled = false;\n const doFetch = async () => {\n await fetchUrl();\n };\n if (!cancelled) {\n doFetch();\n }\n return () => {\n cancelled = true;\n };\n }, [fetchUrl, retryCount, state.url, state.error]);\n const retry = useCallback(() => {\n setState({ url: undefined, isLoading: true, error: undefined });\n setRetryCount(c => c + 1);\n }, []);\n return {\n url: state.url,\n isLoading: state.isLoading,\n error: state.error,\n scheme,\n retry,\n };\n}\n//# sourceMappingURL=useResolvedUrl.js.map","import { jsxs as _jsxs, jsx as _jsx } from \"react/jsx-runtime\";\nimport React from 'react';\nimport { BarChart3, GitBranch, MessageSquare, Code, Image, Link, Download, Table, FileText } from 'lucide-react';\nconst TYPE_CONFIG = {\n chart: { icon: BarChart3, label: 'chart', defaultHeight: 200 },\n mermaid: { icon: GitBranch, label: 'diagram', defaultHeight: 150 },\n proposal: { icon: MessageSquare, label: 'options', defaultHeight: 100 },\n code: { icon: Code, label: 'code', defaultHeight: 80 },\n image: { icon: Image, label: 'image', defaultHeight: 150 },\n link: { icon: Link, label: 'link', defaultHeight: 24 },\n expand: { icon: Download, label: 'content', defaultHeight: 100 },\n table: { icon: Table, label: 'table', defaultHeight: 150 },\n markdown: { icon: FileText, label: 'content', defaultHeight: 100 },\n 'fusion-fragment': { icon: Code, label: 'fragment', defaultHeight: 150 },\n};\n/**\n * Placeholder component shown while code blocks are loading.\n * Provides visual feedback and error states with retry capability.\n */\nexport function CodeBlockPlaceholder({ type, error, onRetry, message, height, }) {\n const config = TYPE_CONFIG[type];\n const displayHeight = height ?? config.defaultHeight;\n const isInline = type === 'link';\n if (error) {\n return (_jsxs(\"div\", { className: `flex items-center gap-2 rounded border border-destructive/30 bg-destructive/5 text-destructive ${isInline ? 'inline-flex px-2 py-1 text-sm' : 'p-4'}`, style: !isInline ? { minHeight: displayHeight } : undefined, children: [_jsxs(\"span\", { className: \"text-destructive\", children: [\"Failed to load \", config.label] }), onRetry && (_jsx(\"button\", { onClick: onRetry, className: \"ml-2 rounded bg-destructive/10 px-2 py-1 text-xs hover:bg-destructive/20 transition-colors\", children: \"Retry\" }))] }));\n }\n const IconComponent = config.icon;\n if (isInline) {\n return (_jsxs(\"span\", { className: \"inline-flex items-center gap-1 text-muted animate-pulse\", children: [_jsx(IconComponent, { className: \"h-3 w-3\" }), _jsx(\"span\", { children: message || `Loading ${config.label}...` })] }));\n }\n return (_jsxs(\"div\", { className: \"flex flex-col items-center justify-center gap-3 rounded border border-border bg-muted/30 animate-pulse\", style: { minHeight: displayHeight }, children: [_jsx(IconComponent, { className: \"h-8 w-8 text-muted\" }), _jsx(\"span\", { className: \"text-sm text-muted\", children: message || `Loading ${config.label}...` }), _jsx(\"div\", { className: \"flex gap-1\", children: [...Array(3)].map((_, i) => (_jsx(\"div\", { className: \"h-2 w-2 rounded-full bg-muted animate-bounce\", style: { animationDelay: `${i * 150}ms` } }, i))) })] }));\n}\nexport class CodeBlockErrorBoundary extends React.Component {\n constructor(props) {\n super(props);\n this.state = { hasError: false };\n }\n static getDerivedStateFromError(error) {\n return { hasError: true, error };\n }\n componentDidCatch(error, errorInfo) {\n console.error(`CodeBlock rendering error (${this.props.type}):`, error, errorInfo);\n this.props.onError?.(error);\n }\n handleRetry = () => {\n this.setState({ hasError: false, error: undefined });\n };\n render() {\n if (this.state.hasError) {\n const { type, fallbackCode } = this.props;\n return (_jsxs(\"div\", { className: \"space-y-2\", children: [_jsx(CodeBlockPlaceholder, { type: type, error: this.state.error?.message || 'Rendering failed', onRetry: this.handleRetry }), fallbackCode && (_jsxs(\"details\", { className: \"text-sm\", children: [_jsx(\"summary\", { className: \"cursor-pointer text-muted hover:text-foreground\", children: \"Show raw content\" }), _jsx(\"pre\", { className: \"mt-2 overflow-x-auto rounded bg-muted/50 p-2 text-xs\", children: _jsx(\"code\", { children: fallbackCode }) })] }))] }));\n }\n return this.props.children;\n }\n}\n//# sourceMappingURL=CodeBlockPlaceholder.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { useResolvedUrl, parseUrlScheme, mapSchemeToRoute } from './useResolvedUrl';\nimport { CodeBlockPlaceholder } from './CodeBlockPlaceholder';\n/**\n * Markdown link component with support for custom URL schemes.\n * Handles artifact:, image:, store:, document://, and collection: URLs.\n */\nexport function MarkdownLink({ node, href, children, className, artifactRunId, ExistingLink, ...rest }) {\n const rawHref = href || '';\n const { scheme, path } = parseUrlScheme(rawHref);\n // For schemes that map directly to routes (store:, document://, collection:)\n const mappedRoute = mapSchemeToRoute(scheme, path);\n if (mappedRoute) {\n if (typeof ExistingLink === 'function') {\n return (_jsx(ExistingLink, { node: node, href: mappedRoute, ...rest, children: children }));\n }\n return (_jsx(\"a\", { href: mappedRoute, ...rest, className: className, target: \"_blank\", rel: \"noopener noreferrer\", children: children }));\n }\n // For standard URLs, delegate to existing component or render directly\n if (scheme === 'standard') {\n if (typeof ExistingLink === 'function') {\n return (_jsx(ExistingLink, { node: node, href: href, ...rest, children: children }));\n }\n return (_jsx(\"a\", { href: href, ...rest, className: className, target: \"_blank\", rel: \"noopener noreferrer\", children: children }));\n }\n // For artifact: and image: URLs, use the resolver\n return (_jsx(ResolvedLink, { rawHref: rawHref, artifactRunId: artifactRunId, className: className, rest: rest, children: children }));\n}\n/**\n * Internal component for links that need async URL resolution\n */\nfunction ResolvedLink({ rawHref, artifactRunId, className, children, rest, }) {\n const { url, isLoading, error, retry } = useResolvedUrl({\n rawUrl: rawHref,\n artifactRunId,\n disposition: 'attachment',\n });\n if (isLoading) {\n return (_jsx(\"span\", { className: \"inline-flex items-center gap-1 text-muted\", children: _jsx(CodeBlockPlaceholder, { type: \"link\" }) }));\n }\n if (error) {\n return (_jsx(\"span\", { className: \"inline-flex items-center gap-1\", children: _jsx(CodeBlockPlaceholder, { type: \"link\", error: error, onRetry: retry }) }));\n }\n return (_jsx(\"a\", { href: url || '#', ...rest, className: className, target: \"_blank\", rel: \"noopener noreferrer\", children: children }));\n}\n//# sourceMappingURL=MarkdownLink.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { useResolvedUrl, parseUrlScheme } from './useResolvedUrl';\nimport { CodeBlockPlaceholder } from './CodeBlockPlaceholder';\n/**\n * Markdown image component with support for custom URL schemes.\n * Handles artifact: and image: URLs with loading states and error handling.\n */\nexport function MarkdownImage({ node, src, alt, className, artifactRunId, ExistingImg, ...rest }) {\n const rawSrc = src || '';\n const { scheme } = parseUrlScheme(rawSrc);\n // For standard URLs, delegate to existing component or render directly\n if (scheme === 'standard') {\n if (typeof ExistingImg === 'function') {\n return _jsx(ExistingImg, { node: node, src: src, alt: alt, ...rest });\n }\n return _jsx(\"img\", { src: src, alt: alt, className: className, ...rest });\n }\n // For artifact: and image: URLs, use the resolver\n return (_jsx(ResolvedImage, { rawSrc: rawSrc, alt: alt, artifactRunId: artifactRunId, className: className, rest: rest }));\n}\n/**\n * Internal component for images that need async URL resolution\n */\nfunction ResolvedImage({ rawSrc, alt, artifactRunId, className, rest, }) {\n const { url, isLoading, error, retry } = useResolvedUrl({\n rawUrl: rawSrc,\n artifactRunId,\n disposition: 'inline',\n });\n if (isLoading) {\n return _jsx(CodeBlockPlaceholder, { type: \"image\", message: alt ? `Loading ${alt}...` : undefined });\n }\n if (error) {\n return (_jsx(CodeBlockPlaceholder, { type: \"image\", error: error, onRetry: retry }));\n }\n if (!url) {\n return null;\n }\n return _jsx(\"img\", { src: url, alt: alt, className: className, ...rest });\n}\n//# sourceMappingURL=MarkdownImage.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { useResolvedUrl, parseUrlScheme } from './useResolvedUrl';\nimport { CodeBlockPlaceholder } from './CodeBlockPlaceholder';\n/**\n * Markdown figure component for images with captions.\n * Wraps the image in a <figure> element with a <figcaption>.\n *\n * Usage in markdown: ![alt text](image-url \"Caption text\")\n */\nexport function MarkdownFigure({ src, alt, caption, className, artifactRunId, }) {\n const rawSrc = src || '';\n const { scheme } = parseUrlScheme(rawSrc);\n // For standard URLs, render directly\n if (scheme === 'standard') {\n return (_jsxs(\"figure\", { className: \"my-4\", children: [_jsx(\"img\", { src: src, alt: alt, className: className }), _jsx(\"figcaption\", { className: \"mt-2 text-sm text-muted text-center italic\", children: caption })] }));\n }\n // For artifact: and image: URLs, use the resolver\n return (_jsx(ResolvedFigure, { rawSrc: rawSrc, alt: alt, caption: caption, artifactRunId: artifactRunId, className: className }));\n}\n/**\n * Internal component for figures that need async URL resolution\n */\nfunction ResolvedFigure({ rawSrc, alt, caption, artifactRunId, className, }) {\n const { url, isLoading, error, retry } = useResolvedUrl({\n rawUrl: rawSrc,\n artifactRunId,\n disposition: 'inline',\n });\n if (isLoading) {\n return _jsx(CodeBlockPlaceholder, { type: \"image\", message: alt ? `Loading ${alt}...` : undefined });\n }\n if (error) {\n return (_jsx(CodeBlockPlaceholder, { type: \"image\", error: error, onRetry: retry }));\n }\n if (!url) {\n return null;\n }\n return (_jsxs(\"figure\", { className: \"my-4\", children: [_jsx(\"img\", { src: url, alt: alt, className: className }), _jsx(\"figcaption\", { className: \"mt-2 text-sm text-muted text-center italic\", children: caption })] }));\n}\n//# sourceMappingURL=MarkdownFigure.js.map","/**\n * Custom remark plugin that transforms remark-directive nodes into\n * HTML elements for columns layout and callout containers.\n *\n * Supported directives:\n * :::columns → <div class=\"md-columns\">\n * :::column{width=50%}→ <div class=\"md-column\" style=\"width:50%\">\n * :::note / :::warning / :::tip / :::caution / :::important → callout <div>s\n * :::name → <div class=\"md-name\"> (generic fallback)\n */\nimport { visit } from 'unist-util-visit';\n// Callout types mapped to CSS modifier classes (semantic design system)\nconst CALLOUT_TYPES = {\n note: 'md-callout-info',\n tip: 'md-callout-info',\n warning: 'md-callout-attention',\n important: 'md-callout-attention',\n caution: 'md-callout-destructive',\n};\nconst CALLOUT_LABELS = {\n note: 'Note',\n tip: 'Tip',\n warning: 'Warning',\n important: 'Important',\n caution: 'Caution',\n};\nexport function remarkDirectiveHandler() {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return (tree) => {\n visit(tree, (node) => {\n if (node.type !== 'containerDirective' &&\n node.type !== 'leafDirective' &&\n node.type !== 'textDirective') {\n return;\n }\n const d = node;\n const data = d.data || (d.data = {});\n const attrs = d.attributes || {};\n const name = d.name;\n // ::pagebreak / :::pagebreak → visual page break indicator\n if (name === 'pagebreak') {\n data.hName = 'hr';\n data.hProperties = { className: 'md-pagebreak' };\n return;\n }\n // :::columns → flex container\n if (name === 'columns') {\n data.hName = 'div';\n data.hProperties = { className: 'md-columns' };\n return;\n }\n // :::column{width=50%} → flex child with optional width\n if (name === 'column') {\n data.hName = 'div';\n const props = { className: 'md-column' };\n if (attrs.width) {\n props.style = `flex-basis:${attrs.width};flex-grow:0;flex-shrink:0`;\n }\n data.hProperties = props;\n return;\n }\n // Callout types\n if (name in CALLOUT_TYPES) {\n data.hName = 'div';\n data.hProperties = {\n className: `md-callout ${CALLOUT_TYPES[name]}`,\n 'data-callout-type': name,\n };\n // Prepend a title paragraph\n const label = CALLOUT_LABELS[name];\n if (label && d.children) {\n const titleNode = {\n type: 'paragraph',\n data: {\n hName: 'p',\n hProperties: { className: 'md-callout-title' },\n },\n children: [{ type: 'text', value: label }],\n };\n d.children.unshift(titleNode);\n }\n return;\n }\n // Generic fallback: :::name → <div class=\"md-name\">\n data.hName = 'div';\n data.hProperties = {\n className: `md-${name}`,\n ...Object.fromEntries(Object.entries(attrs).filter(([k]) => k !== 'class')),\n };\n if (attrs.class) {\n data.hProperties.className += ` ${attrs.class}`;\n }\n });\n };\n}\n//# sourceMappingURL=remarkDirectiveHandler.js.map","const CUSTOM_SCHEME_PREFIXES = [\n 'artifact:',\n 'image:',\n 'store:',\n 'document://',\n 'collection:',\n];\nconst CUSTOM_LINK_REGEX = /(!?\\[[^\\]\\n]*\\]\\()((?:artifact:|image:|store:|document:\\/\\/|collection:)[^)]+)(\\))/g;\nconst INLINE_CODE_REGEX = /`[^`\\n]*`/g;\nconst FENCED_CODE_BLOCK_REGEX = /(^|\\n)(`{3,}|~{3,})[^\\n]*\\n[\\s\\S]*?\\n\\2(?=\\n|$)/g;\nconst LINK_TITLE_SUFFIX_REGEX = /\\s+(\"(?:[^\"\\\\]|\\\\.)*\"|'(?:[^'\\\\]|\\\\.)*'|\\([^)]*\\))\\s*$/;\nfunction hasCustomScheme(destination) {\n return CUSTOM_SCHEME_PREFIXES.some(prefix => destination.startsWith(prefix));\n}\nfunction wrapCustomDestination(destinationWithOptionalTitle) {\n const trimmed = destinationWithOptionalTitle.trim();\n // Preserve already angle-bracketed custom destinations.\n if (trimmed.startsWith('<')) {\n const closeIdx = trimmed.indexOf('>');\n if (closeIdx > 0) {\n const bracketedDestination = trimmed.slice(1, closeIdx).trim();\n if (hasCustomScheme(bracketedDestination)) {\n return destinationWithOptionalTitle;\n }\n }\n }\n const titleMatch = trimmed.match(LINK_TITLE_SUFFIX_REGEX);\n const titleStart = titleMatch?.index ?? -1;\n const destination = (titleStart >= 0 ? trimmed.slice(0, titleStart) : trimmed).trim();\n const title = titleStart >= 0 ? trimmed.slice(titleStart) : '';\n if (!hasCustomScheme(destination)) {\n return destinationWithOptionalTitle;\n }\n return `<${destination}>${title}`;\n}\nfunction normalizeCustomLinksInText(text) {\n return text.replace(CUSTOM_LINK_REGEX, (_fullMatch, open, destination, close) => {\n return `${open}${wrapCustomDestination(destination)}${close}`;\n });\n}\nfunction normalizeOutsideInlineCode(text) {\n let result = '';\n let lastIndex = 0;\n let match;\n INLINE_CODE_REGEX.lastIndex = 0;\n while ((match = INLINE_CODE_REGEX.exec(text)) !== null) {\n result += normalizeCustomLinksInText(text.slice(lastIndex, match.index));\n result += match[0];\n lastIndex = match.index + match[0].length;\n }\n result += normalizeCustomLinksInText(text.slice(lastIndex));\n return result;\n}\n/**\n * Normalizes inline markdown links/images with custom URL schemes so they parse\n * correctly even when paths contain spaces (e.g. artifact:out/INVOICE 2025-001.pdf).\n *\n * CommonMark requires destinations with spaces to be wrapped in <...>.\n * We apply this only outside fenced/inline code spans.\n */\nexport function normalizeCustomSchemeLinks(markdown) {\n if (!markdown || !CUSTOM_SCHEME_PREFIXES.some(prefix => markdown.includes(prefix))) {\n return markdown;\n }\n let result = '';\n let lastIndex = 0;\n let match;\n FENCED_CODE_BLOCK_REGEX.lastIndex = 0;\n while ((match = FENCED_CODE_BLOCK_REGEX.exec(markdown)) !== null) {\n result += normalizeOutsideInlineCode(markdown.slice(lastIndex, match.index));\n result += match[0];\n lastIndex = match.index + match[0].length;\n }\n result += normalizeOutsideInlineCode(markdown.slice(lastIndex));\n return result;\n}\n//# sourceMappingURL=normalizeCustomSchemeLinks.js.map","/**\n * Normalize Pandoc-style single-line fenced divs into remark-directive syntax.\n *\n * Pandoc allows single-line containers:\n * ::: pagebreak :::\n * ::: tip Some content here. :::\n *\n * remark-directive requires multi-line containers:\n * :::pagebreak\n * :::\n *\n * :::tip\n * Some content here.\n * :::\n *\n * This preprocessor converts the single-line form into multi-line so that\n * remark-directive can parse them correctly.\n */\n/**\n * Regex matching a single-line fenced div:\n * ::: name optional-content :::\n *\n * Groups:\n * [1] leading indent\n * [2] directive name (word chars only)\n * [3] optional inline content (may be empty)\n *\n * Only matches when both opening and closing ::: are on the SAME line,\n * so it won't interfere with properly formatted multi-line containers.\n */\nconst SINGLE_LINE_DIRECTIVE = /^([ \\t]*):::\\s*(\\w+)\\s*(.*?)\\s*:::[ \\t]*$/gm;\nexport function normalizeDirectives(markdown) {\n if (!markdown || !markdown.includes(':::')) {\n return markdown;\n }\n return markdown.replace(SINGLE_LINE_DIRECTIVE, (_match, indent, name, content) => {\n if (content) {\n // Has content → multi-line container directive\n return `${indent}:::${name}\\n${indent}${content}\\n${indent}:::`;\n }\n // No content → leaf directive (::name)\n return `${indent}::${name}`;\n });\n}\n//# sourceMappingURL=normalizeDirectives.js.map","import { clsx } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\nexport function cn(...inputs) {\n return twMerge(clsx(inputs));\n}\n//# sourceMappingURL=utils.js.map","import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from \"react/jsx-runtime\";\nimport * as DialogPrimitive from '@radix-ui/react-dialog';\nimport { Check, Copy, Download, Loader2, Maximize2, Minimize2, X } from 'lucide-react';\nimport Papa from 'papaparse';\nimport { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { VegaEmbed } from 'react-vega';\nimport { cn } from '../../../core/components/libs/utils';\nimport { useUserSession } from '@vertesia/ui/session';\nimport { getArtifactCacheKey, getFileCacheKey, useArtifactUrlCache } from './useArtifactUrlCache';\n// Constants\nconst DEFAULT_CHART_HEIGHT = 280;\nconst DEFAULT_DASHBOARD_HEIGHT = 500;\n// Error display component\nfunction VegaErrorDisplay({ error, chartTitle }) {\n return (_jsx(\"div\", { className: \"flex items-center justify-center h-full bg-red-50 dark:bg-red-950 rounded-md p-4\", children: _jsxs(\"div\", { className: \"text-center\", children: [_jsxs(\"p\", { className: \"text-sm font-medium text-red-600 dark:text-red-400\", children: [\"Cannot render \", chartTitle || 'Vega-Lite', \" chart\"] }), _jsx(\"p\", { className: \"text-xs text-red-500 dark:text-red-500 mt-1 max-w-xs truncate\", children: error })] }) }));\n}\n// Fullscreen dialog component with smooth animations\nfunction FullscreenDialog({ isOpen, onClose, title, description, children, }) {\n return (_jsx(DialogPrimitive.Root, { open: isOpen, onOpenChange: (open) => !open && onClose(), children: _jsxs(DialogPrimitive.Portal, { children: [_jsx(DialogPrimitive.Overlay, { className: \"fixed inset-0 z-50 bg-black/80 backdrop-blur-sm transition-all duration-300 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0\" }), _jsxs(DialogPrimitive.Content, { className: \"fixed inset-2 sm:inset-4 z-50 flex flex-col bg-white dark:bg-gray-900 rounded-xl shadow-2xl transition-all duration-300 ease-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-98 data-[state=open]:zoom-in-98 data-[state=closed]:slide-out-to-bottom-2 data-[state=open]:slide-in-from-bottom-2\", onEscapeKeyDown: onClose, children: [_jsx(DialogPrimitive.Close, { asChild: true, children: _jsx(\"button\", { onClick: onClose, className: \"absolute top-3 right-3 z-10 p-2 rounded-lg bg-white/80 dark:bg-gray-800/80 backdrop-blur-sm hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors duration-150 shadow-sm\", \"aria-label\": \"Close fullscreen\", children: _jsx(X, { className: \"w-5 h-5 text-gray-600 dark:text-gray-300\" }) }) }), _jsx(\"div\", { className: \"flex-1 overflow-auto p-4 sm:p-6 animate-in fade-in-0 duration-500 delay-150\", children: children }), _jsx(\"div\", { className: \"flex items-center justify-between px-4 sm:px-6 py-3 border-t border-gray-200 dark:border-gray-800 bg-gray-50/50 dark:bg-gray-800/50 rounded-b-xl\", children: _jsxs(\"div\", { className: \"flex flex-col\", children: [_jsx(DialogPrimitive.Title, { className: \"text-base font-semibold text-gray-900 dark:text-gray-100\", children: title || 'Dashboard' }), description && (_jsx(DialogPrimitive.Description, { className: \"text-sm text-gray-500 dark:text-gray-400 mt-0.5\", children: description }))] }) })] })] }) }));\n}\n// Calculate height based on spec complexity\nfunction calculateAutoHeight(spec, mode) {\n if (mode === 'chart') {\n return DEFAULT_CHART_HEIGHT;\n }\n // For dashboard mode, try to calculate based on spec structure\n let rowCount = 1;\n if (spec.vconcat) {\n rowCount = Array.isArray(spec.vconcat) ? spec.vconcat.length : 1;\n }\n else if (spec.concat) {\n const columns = spec.columns || 2;\n const items = Array.isArray(spec.concat) ? spec.concat.length : 1;\n rowCount = Math.ceil(items / columns);\n }\n else if (spec.facet) {\n // Faceted charts - estimate based on data\n rowCount = 2; // Default estimate\n }\n // Base height per row + padding\n return Math.max(DEFAULT_DASHBOARD_HEIGHT, rowCount * 280 + 40);\n}\n// Modern color palette - vibrant but professional\nconst CHART_COLORS = {\n // Primary palette - vibrant gradients\n categorical: [\n '#6366f1', // indigo\n '#8b5cf6', // violet\n '#ec4899', // pink\n '#f43f5e', // rose\n '#f97316', // orange\n '#eab308', // yellow\n '#22c55e', // green\n '#14b8a6', // teal\n '#06b6d4', // cyan\n '#3b82f6', // blue\n ],\n // Sequential schemes\n blues: ['#dbeafe', '#93c5fd', '#3b82f6', '#1d4ed8', '#1e3a8a'],\n purples: ['#f3e8ff', '#c4b5fd', '#8b5cf6', '#6d28d9', '#4c1d95'],\n greens: ['#dcfce7', '#86efac', '#22c55e', '#15803d', '#14532d'],\n // Diverging\n diverging: ['#ef4444', '#fca5a5', '#fef3c7', '#86efac', '#22c55e'],\n};\n/**\n * Preprocess a Vega-Lite spec to fix duplicate signal names that occur\n * when params with selections are used in vconcat/hconcat layouts.\n *\n * The issue: Vega-Lite creates internal signals like `paramName_tuple` for\n * point selections. When a param is defined at the root level of a vconcat/hconcat\n * spec, Vega-Lite's compiler creates duplicate signals when propagating the\n * selection to sub-views.\n *\n * Solution: Move selection params from the root level to the first sub-view\n * (where selections typically originate). Cross-view references are preserved\n * so that clicking in one view filters other views.\n */\nfunction fixVegaLiteSelectionParams(spec) {\n // Deep clone the spec to avoid mutations\n const result = JSON.parse(JSON.stringify(spec));\n // Check if this is a concatenated spec with root-level selection params\n const concatKeys = ['vconcat', 'hconcat', 'concat'];\n const hasConcatViews = concatKeys.some(key => Array.isArray(result[key]));\n if (!hasConcatViews) {\n // Not a concatenated spec, no special handling needed\n return result;\n }\n // Check for selection params at the root level\n const rootSelectionParams = [];\n if (Array.isArray(result.params)) {\n for (const param of result.params) {\n if (param && typeof param === 'object' && param.name && param.select) {\n rootSelectionParams.push({ name: param.name, param });\n }\n }\n }\n if (rootSelectionParams.length === 0) {\n // No selection params at root level, no special handling needed\n return result;\n }\n // Strategy: Move the selection param to the first sub-view that has an\n // encoding field matching the selection. Keep cross-view references intact\n // so filtering works across views.\n for (const { name: paramName, param } of rootSelectionParams) {\n const selectFields = param.select?.fields || [];\n const hasLegendBinding = param.select?.bind === 'legend';\n // Find the concat array\n let concatArray = null;\n for (const key of concatKeys) {\n if (Array.isArray(result[key])) {\n concatArray = result[key];\n break;\n }\n }\n if (!concatArray || concatArray.length === 0)\n continue;\n // Find the first view that has the selection field in its encoding\n // This is typically where users click to make selections\n let targetViewIndex = 0;\n for (let i = 0; i < concatArray.length; i++) {\n const view = concatArray[i];\n if (viewHasField(view, selectFields) || (hasLegendBinding && viewHasColorEncoding(view, selectFields))) {\n targetViewIndex = i;\n break;\n }\n }\n // Move the param to the target view\n const targetView = concatArray[targetViewIndex];\n if (!targetView.params) {\n targetView.params = [];\n }\n targetView.params.push(param);\n // Remove the param from root level\n result.params = result.params.filter((p) => p.name !== paramName);\n // Cross-view references are kept intact - Vega-Lite handles signal\n // propagation from the view where the selection is defined to other views\n }\n // Clean up empty params array at root\n if (Array.isArray(result.params) && result.params.length === 0) {\n delete result.params;\n }\n return result;\n}\n/**\n * Apply parameter values to a Vega-Lite spec.\n * Updates the 'value' field of named params, allowing models to set\n * initial values for interactive controls (sliders, dropdowns, etc.).\n * @exported for testing\n */\nexport function applyParameterValues(spec, parameterValues) {\n if (!parameterValues || Object.keys(parameterValues).length === 0) {\n return spec;\n }\n const result = JSON.parse(JSON.stringify(spec));\n // Helper to update params in a view\n const updateParams = (params) => {\n for (const param of params) {\n if (param && typeof param === 'object' && param.name && param.name in parameterValues) {\n param.value = parameterValues[param.name];\n }\n }\n };\n // Update root-level params\n if (Array.isArray(result.params)) {\n updateParams(result.params);\n }\n // Update params in nested views (vconcat, hconcat, concat)\n const updateNestedViews = (views) => {\n if (!Array.isArray(views))\n return;\n for (const view of views) {\n if (view && Array.isArray(view.params)) {\n updateParams(view.params);\n }\n // Recursively handle nested concatenations\n if (view.vconcat)\n updateNestedViews(view.vconcat);\n if (view.hconcat)\n updateNestedViews(view.hconcat);\n if (view.concat)\n updateNestedViews(view.concat);\n // Handle layers\n if (Array.isArray(view.layer)) {\n for (const layer of view.layer) {\n if (layer && Array.isArray(layer.params)) {\n updateParams(layer.params);\n }\n }\n }\n }\n };\n if (result.vconcat)\n updateNestedViews(result.vconcat);\n if (result.hconcat)\n updateNestedViews(result.hconcat);\n if (result.concat)\n updateNestedViews(result.concat);\n if (Array.isArray(result.layer)) {\n for (const layer of result.layer) {\n if (layer && Array.isArray(layer.params)) {\n updateParams(layer.params);\n }\n }\n }\n return result;\n}\n/**\n * Check if a view has encoding using any of the specified fields.\n */\nfunction viewHasField(view, fields) {\n if (!view || !view.encoding)\n return false;\n for (const field of fields) {\n for (const channel of Object.values(view.encoding)) {\n if (channel && typeof channel === 'object' && channel.field === field) {\n return true;\n }\n }\n }\n // Also check nested layers\n if (Array.isArray(view.layer)) {\n for (const layer of view.layer) {\n if (viewHasField(layer, fields))\n return true;\n }\n }\n return false;\n}\n/**\n * Check if a view has color encoding using any of the specified fields.\n */\nfunction viewHasColorEncoding(view, fields) {\n if (!view)\n return false;\n const checkEncoding = (encoding) => {\n if (!encoding)\n return false;\n const colorField = encoding.color?.field;\n return colorField && fields.includes(colorField);\n };\n if (checkEncoding(view.encoding))\n return true;\n // Check nested layers\n if (Array.isArray(view.layer)) {\n for (const layer of view.layer) {\n if (checkEncoding(layer.encoding))\n return true;\n }\n }\n return false;\n}\n/**\n * Walk the Vega-Lite spec and find all artifact: URL references in data.url fields.\n * Returns an array of references with their paths in the spec tree.\n */\nfunction findArtifactReferences(spec, currentPath = []) {\n const references = [];\n if (!spec || typeof spec !== 'object') {\n return references;\n }\n // Check if this object has a data.url that's an artifact reference\n if (spec.data && typeof spec.data === 'object') {\n const url = spec.data.url;\n if (typeof url === 'string' && url.startsWith('artifact:')) {\n references.push({\n path: [...currentPath, 'data'],\n artifactPath: url.replace(/^artifact:/, '').trim(),\n });\n }\n }\n // Recursively check nested objects (layer, vconcat, hconcat, concat, spec, etc.)\n const nestedKeys = ['layer', 'vconcat', 'hconcat', 'concat', 'spec', 'repeat', 'facet'];\n for (const key of nestedKeys) {\n if (key in spec) {\n const value = spec[key];\n if (Array.isArray(value)) {\n value.forEach((item, index) => {\n references.push(...findArtifactReferences(item, [...currentPath, key, String(index)]));\n });\n }\n else if (typeof value === 'object' && value !== null) {\n references.push(...findArtifactReferences(value, [...currentPath, key]));\n }\n }\n }\n return references;\n}\n/**\n * Deep clone and update the spec by replacing artifact URLs with resolved data values.\n */\nfunction replaceArtifactData(spec, resolvedData) {\n const result = JSON.parse(JSON.stringify(spec));\n for (const [pathKey, data] of resolvedData) {\n const path = pathKey.split('.');\n let current = result;\n // Navigate to the parent of the data object\n for (let i = 0; i < path.length - 1; i++) {\n if (current[path[i]] === undefined) {\n break;\n }\n current = current[path[i]];\n }\n // Replace data.url with data.values\n const lastKey = path[path.length - 1];\n if (current[lastKey] && typeof current[lastKey] === 'object') {\n delete current[lastKey].url;\n current[lastKey].values = data;\n }\n }\n return result;\n}\n// Get dark mode config for Vega with enhanced styling\nfunction getDarkModeConfig(isDark) {\n const baseConfig = {\n background: 'transparent',\n view: { stroke: 'transparent' },\n // Modern color range\n range: {\n category: CHART_COLORS.categorical,\n diverging: CHART_COLORS.diverging,\n heatmap: CHART_COLORS.purples,\n ramp: CHART_COLORS.blues,\n },\n // Enable tooltips by default for all mark types with enhanced styling\n mark: { tooltip: true },\n bar: {\n tooltip: true,\n cornerRadiusTopLeft: 4,\n cornerRadiusTopRight: 4,\n },\n line: {\n tooltip: true,\n strokeWidth: 2.5,\n strokeCap: 'round',\n },\n point: {\n tooltip: true,\n size: 60,\n filled: true,\n },\n area: {\n tooltip: true,\n fillOpacity: 0.7,\n line: true,\n },\n rect: {\n tooltip: true,\n cornerRadius: 2,\n },\n arc: {\n tooltip: true,\n cornerRadius: 4,\n },\n circle: {\n tooltip: true,\n size: 80,\n },\n };\n if (isDark) {\n return {\n ...baseConfig,\n axis: {\n labelColor: '#a1a1aa',\n titleColor: '#e4e4e7',\n gridColor: '#3f3f46',\n domainColor: '#52525b',\n tickColor: '#52525b',\n labelFont: 'Inter, system-ui, sans-serif',\n titleFont: 'Inter, system-ui, sans-serif',\n labelFontSize: 11,\n titleFontSize: 12,\n titleFontWeight: 500,\n },\n legend: {\n labelColor: '#a1a1aa',\n titleColor: '#e4e4e7',\n labelFont: 'Inter, system-ui, sans-serif',\n titleFont: 'Inter, system-ui, sans-serif',\n labelFontSize: 11,\n titleFontSize: 12,\n symbolSize: 100,\n },\n title: {\n color: '#fafafa',\n font: 'Inter, system-ui, sans-serif',\n fontSize: 14,\n fontWeight: 600,\n },\n };\n }\n return {\n ...baseConfig,\n axis: {\n labelColor: '#71717a',\n titleColor: '#3f3f46',\n gridColor: '#e4e4e7',\n domainColor: '#d4d4d8',\n tickColor: '#d4d4d8',\n labelFont: 'Inter, system-ui, sans-serif',\n titleFont: 'Inter, system-ui, sans-serif',\n labelFontSize: 11,\n titleFontSize: 12,\n titleFontWeight: 500,\n },\n legend: {\n labelColor: '#71717a',\n titleColor: '#3f3f46',\n labelFont: 'Inter, system-ui, sans-serif',\n titleFont: 'Inter, system-ui, sans-serif',\n labelFontSize: 11,\n titleFontSize: 12,\n symbolSize: 100,\n },\n title: {\n color: '#18181b',\n font: 'Inter, system-ui, sans-serif',\n fontSize: 14,\n fontWeight: 600,\n },\n };\n}\nexport const VegaLiteChart = memo(function VegaLiteChart({ spec, artifactRunId }) {\n const { title, description, spec: vegaSpec, options } = spec;\n const [isExporting, setIsExporting] = useState(false);\n const [isCopied, setIsCopied] = useState(false);\n const [error, setError] = useState(null);\n const [isFullscreen, setIsFullscreen] = useState(false);\n const viewRef = useRef(null);\n const fullscreenViewRef = useRef(null);\n const containerRef = useRef(null);\n // Artifact resolution state\n const { client } = useUserSession();\n const urlCache = useArtifactUrlCache();\n // Use refs to avoid triggering effect re-runs when these stable values are accessed\n const clientRef = useRef(client);\n clientRef.current = client;\n const urlCacheRef = useRef(urlCache);\n urlCacheRef.current = urlCache;\n const [resolvedSpec, setResolvedSpec] = useState(null);\n const [isLoadingArtifacts, setIsLoadingArtifacts] = useState(false);\n const [artifactError, setArtifactError] = useState(null);\n // Determine mode and settings\n const mode = options?.mode || 'chart';\n const isDashboard = mode === 'dashboard';\n const showFullscreenButton = options?.enableFullscreen ?? isDashboard;\n // Calculate height\n const baseHeight = options?.height || calculateAutoHeight(vegaSpec, mode);\n // Resolve artifact URLs in the spec\n useEffect(() => {\n const references = findArtifactReferences(vegaSpec);\n // If no artifact references, use original spec\n if (references.length === 0) {\n setResolvedSpec(vegaSpec);\n setIsLoadingArtifacts(false);\n setArtifactError(null);\n return;\n }\n let cancelled = false;\n setIsLoadingArtifacts(true);\n setArtifactError(null);\n const resolveArtifacts = async () => {\n const resolvedData = new Map();\n const currentClient = clientRef.current;\n const currentUrlCache = urlCacheRef.current;\n for (const ref of references) {\n try {\n const pathKey = ref.path.join('.');\n let url;\n // Determine if this is a shorthand path or full path\n if (artifactRunId && !ref.artifactPath.startsWith('agents/')) {\n // Shorthand path - use artifact API\n const cacheKey = getArtifactCacheKey(artifactRunId, ref.artifactPath, 'inline');\n if (currentUrlCache) {\n url = await currentUrlCache.getOrFetch(cacheKey, async () => {\n const result = await currentClient.files.getArtifactDownloadUrl(artifactRunId, ref.artifactPath, 'inline');\n return result.url;\n });\n }\n else {\n const result = await currentClient.files.getArtifactDownloadUrl(artifactRunId, ref.artifactPath, 'inline');\n url = result.url;\n }\n }\n else {\n // Full path - use files API\n const cacheKey = getFileCacheKey(ref.artifactPath);\n if (currentUrlCache) {\n url = await currentUrlCache.getOrFetch(cacheKey, async () => {\n const result = await currentClient.files.getDownloadUrl(ref.artifactPath);\n return result.url;\n });\n }\n else {\n const result = await currentClient.files.getDownloadUrl(ref.artifactPath);\n url = result.url;\n }\n }\n // Fetch the data from the resolved URL\n const response = await fetch(url);\n if (!response.ok) {\n throw new Error(`Failed to fetch artifact data: ${response.statusText}`);\n }\n // Detect CSV files by artifact path extension\n const isCsv = ref.artifactPath.toLowerCase().endsWith('.csv');\n let data;\n if (isCsv) {\n // Parse CSV to JSON array\n const csvText = await response.text();\n const parseResult = Papa.parse(csvText, {\n header: true,\n skipEmptyLines: true,\n dynamicTyping: true, // Auto-convert numbers and booleans\n });\n data = parseResult.data;\n }\n else {\n // Parse as JSON\n const jsonData = await response.json();\n data = Array.isArray(jsonData) ? jsonData : [jsonData];\n }\n resolvedData.set(pathKey, data);\n }\n catch (err) {\n console.error(`Failed to resolve artifact: ${ref.artifactPath}`, err);\n if (!cancelled) {\n setArtifactError(`Failed to load data from artifact: ${ref.artifactPath}`);\n }\n return;\n }\n }\n if (!cancelled) {\n const newSpec = replaceArtifactData(vegaSpec, resolvedData);\n setResolvedSpec(newSpec);\n setIsLoadingArtifacts(false);\n }\n };\n resolveArtifacts();\n return () => {\n cancelled = true;\n };\n }, [vegaSpec, artifactRunId]);\n // Detect dark mode\n const [isDarkMode, setIsDarkMode] = useState(false);\n const isDarkModeRef = useRef(false);\n useEffect(() => {\n const checkDarkMode = () => {\n const newDarkMode = document.documentElement.classList.contains('dark');\n // Only update state if dark mode actually changed\n if (newDarkMode !== isDarkModeRef.current) {\n isDarkModeRef.current = newDarkMode;\n setIsDarkMode(newDarkMode);\n }\n };\n checkDarkMode();\n const observer = new MutationObserver(checkDarkMode);\n observer.observe(document.documentElement, { attributes: true, attributeFilter: ['class'] });\n return () => observer.disconnect();\n }, []);\n // Track container width for responsive sizing\n const [containerWidth, setContainerWidth] = useState(0);\n const containerWidthRef = useRef(0);\n useEffect(() => {\n if (!containerRef.current)\n return;\n let resizeTimeout;\n const resizeObserver = new ResizeObserver((entries) => {\n // Debounce resize callbacks to ~100ms to avoid excessive state updates\n clearTimeout(resizeTimeout);\n resizeTimeout = setTimeout(() => {\n const width = entries[0]?.contentRect.width;\n if (width && width !== containerWidthRef.current) {\n containerWidthRef.current = width;\n setContainerWidth(width);\n }\n }, 100);\n });\n resizeObserver.observe(containerRef.current);\n // Initial width\n const initialWidth = containerRef.current.clientWidth;\n containerWidthRef.current = initialWidth;\n setContainerWidth(initialWidth);\n return () => {\n clearTimeout(resizeTimeout);\n resizeObserver.disconnect();\n };\n }, []);\n // Check if there are artifact references that need resolution\n const hasArtifactReferences = useMemo(() => {\n return findArtifactReferences(vegaSpec).length > 0;\n }, [vegaSpec]);\n // Memoize the processed spec to fix Vega-Lite selection param issues\n // This handles the duplicate signal problem in concatenated views\n const processedSpec = useMemo(() => {\n // If there are artifact references, we must wait for resolvedSpec\n // Don't fall back to vegaSpec which contains artifact: URLs\n if (hasArtifactReferences && !resolvedSpec) {\n return null;\n }\n let specToUse = resolvedSpec || vegaSpec;\n if (!specToUse)\n return null;\n // Apply parameter values if provided (allows model to set initial slider/dropdown values)\n if (options?.parameterValues) {\n specToUse = applyParameterValues(specToUse, options.parameterValues);\n }\n return fixVegaLiteSelectionParams(specToUse);\n }, [resolvedSpec, vegaSpec, hasArtifactReferences, options?.parameterValues]);\n // Scale widths in concatenated views to fit container\n const scaleSpecWidths = useCallback((spec, availableWidth) => {\n if (!spec || typeof spec !== 'object')\n return spec;\n // Handle hconcat - distribute width among children\n if (spec.hconcat && Array.isArray(spec.hconcat)) {\n const childCount = spec.hconcat.length;\n const spacing = spec.spacing ?? 10;\n const totalSpacing = spacing * (childCount - 1);\n const widthPerChild = Math.floor((availableWidth - totalSpacing) / childCount);\n return {\n ...spec,\n hconcat: spec.hconcat.map((child) => scaleSpecWidths(child, widthPerChild)),\n };\n }\n // Handle vconcat - each child gets full width\n if (spec.vconcat && Array.isArray(spec.vconcat)) {\n return {\n ...spec,\n vconcat: spec.vconcat.map((child) => scaleSpecWidths(child, availableWidth)),\n };\n }\n // Handle generic concat with columns\n if (spec.concat && Array.isArray(spec.concat)) {\n const columns = spec.columns ?? spec.concat.length;\n const spacing = spec.spacing ?? 10;\n const totalSpacing = spacing * (columns - 1);\n const widthPerChild = Math.floor((availableWidth - totalSpacing) / columns);\n return {\n ...spec,\n concat: spec.concat.map((child) => scaleSpecWidths(child, widthPerChild)),\n };\n }\n // For leaf views, set width if it's \"container\" or larger than available\n const currentWidth = spec.width;\n if (currentWidth === 'container' || (typeof currentWidth === 'number' && currentWidth > availableWidth)) {\n return { ...spec, width: availableWidth };\n }\n return spec;\n }, []);\n // Build the full Vega-Lite spec with defaults\n const buildFullSpec = useCallback((height, forFullscreen = false) => {\n if (!processedSpec)\n return null;\n const config = getDarkModeConfig(isDarkMode);\n // Use measured container width, window width for fullscreen (capped), or fallback\n const calculatedWidth = forFullscreen\n ? (typeof window !== 'undefined' ? Math.min(window.innerWidth - 80, 1400) : 1200)\n : (containerWidth > 0 ? containerWidth - 24 : 500);\n // Check if this is a concatenated view - autosize 'fit' only works for single/layered views\n const isConcatenatedView = 'vconcat' in processedSpec || 'hconcat' in processedSpec || 'concat' in processedSpec;\n // For concatenated views, use 'pad' which works correctly; for single views use 'fit'\n const autosize = isConcatenatedView\n ? { type: 'pad', contains: 'padding' }\n : { type: 'fit', contains: 'padding' };\n // Scale widths for concatenated views to fit container\n let scaledSpec = processedSpec;\n if (isConcatenatedView && calculatedWidth) {\n scaledSpec = scaleSpecWidths(processedSpec, calculatedWidth);\n }\n // Replace \"container\" width with our measured width - \"container\" relies on CSS which may not be ready\n const specWidth = scaledSpec.width;\n const width = isConcatenatedView ? undefined : (specWidth === 'container' ? calculatedWidth : (specWidth ?? calculatedWidth));\n // Destructure to remove width from spec so we can control it (only for non-concat views)\n const { width: _specWidth, ...specWithoutWidth } = scaledSpec;\n return {\n $schema: 'https://vega.github.io/schema/vega-lite/v6.json',\n ...(!isConcatenatedView && width ? { width } : {}),\n height: forFullscreen ? undefined : height,\n autosize,\n ...(isConcatenatedView ? scaledSpec : specWithoutWidth),\n // Override title if provided at top level\n ...(title && !processedSpec.title ? { title } : {}),\n // Apply theme config\n config: {\n ...config,\n ...processedSpec.config,\n },\n };\n }, [processedSpec, title, isDarkMode, containerWidth, scaleSpecWidths]);\n const handleCopy = useCallback(async () => {\n const view = isFullscreen ? fullscreenViewRef.current : viewRef.current;\n if (!view || isCopied)\n return;\n try {\n const canvas = await view.toCanvas(2);\n canvas.toBlob(async (blob) => {\n if (blob) {\n await navigator.clipboard.write([\n new ClipboardItem({ 'image/png': blob })\n ]);\n setIsCopied(true);\n setTimeout(() => setIsCopied(false), 2000);\n }\n }, 'image/png');\n }\n catch (err) {\n console.error('Failed to copy chart:', err);\n }\n }, [isCopied, isFullscreen]);\n const handleExport = useCallback(async () => {\n const view = isFullscreen ? fullscreenViewRef.current : viewRef.current;\n if (!view || isExporting)\n return;\n setIsExporting(true);\n try {\n const url = await view.toImageURL('png', 2);\n const link = document.createElement('a');\n link.download = `${title || 'chart'}.png`;\n link.href = url;\n link.click();\n }\n catch (err) {\n console.error('Failed to export chart:', err);\n }\n finally {\n setIsExporting(false);\n }\n }, [title, isExporting, isFullscreen]);\n const handleNewView = useCallback((view) => {\n viewRef.current = view;\n setError(null);\n }, []);\n const handleFullscreenNewView = useCallback((view) => {\n fullscreenViewRef.current = view;\n }, []);\n const handleError = useCallback((err) => {\n console.error('Vega-Lite rendering error:', err);\n setError(err instanceof Error ? err.message : 'Unknown error');\n }, []);\n const toggleFullscreen = useCallback(() => {\n setIsFullscreen(prev => !prev);\n }, []);\n // Clear error when spec changes\n useEffect(() => {\n setError(null);\n }, [vegaSpec]);\n // Toolbar component (reused in both views)\n const Toolbar = ({ className }) => (_jsxs(\"div\", { className: cn(\"flex items-center gap-2\", className), children: [_jsxs(\"button\", { onClick: handleCopy, disabled: isCopied, className: \"text-xs px-2 py-1 rounded border border-gray-300 dark:border-gray-700 bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 cursor-pointer transition-colors disabled:opacity-50 flex items-center gap-1\", title: \"Copy to clipboard\", children: [isCopied ? _jsx(Check, { className: \"w-3 h-3\" }) : _jsx(Copy, { className: \"w-3 h-3\" }), isCopied ? 'Copied' : 'Copy'] }), _jsxs(\"button\", { onClick: handleExport, disabled: isExporting, className: \"text-xs px-2 py-1 rounded border border-gray-300 dark:border-gray-700 bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 cursor-pointer transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-1\", title: \"Export as PNG\", children: [_jsx(Download, { className: \"w-3 h-3\" }), isExporting ? 'Exporting...' : 'Export'] }), showFullscreenButton && (_jsxs(\"button\", { onClick: toggleFullscreen, className: \"text-xs px-2 py-1 rounded border border-gray-300 dark:border-gray-700 bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 cursor-pointer transition-colors flex items-center gap-1\", title: isFullscreen ? \"Exit fullscreen\" : \"Fullscreen\", children: [isFullscreen ? _jsx(Minimize2, { className: \"w-3 h-3\" }) : _jsx(Maximize2, { className: \"w-3 h-3\" }), isFullscreen ? 'Exit' : 'Fullscreen'] }))] }));\n // Show loading state when resolving artifacts\n // Also show loading if we have artifact refs but haven't resolved them yet\n // (covers the gap before the effect runs)\n if (isLoadingArtifacts || (hasArtifactReferences && !resolvedSpec)) {\n return (_jsx(\"div\", { className: \"bg-white dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-800 shadow-sm\", children: _jsxs(\"div\", { className: \"flex flex-col gap-2 p-3\", children: [_jsx(\"div\", { className: \"flex items-center justify-between\", children: _jsx(\"span\", { className: \"font-medium text-sm text-gray-900 dark:text-gray-100\", children: title || 'Chart' }) }), _jsx(\"div\", { className: \"flex items-center justify-center bg-gray-50 dark:bg-gray-800 rounded\", style: { width: '100%', height: baseHeight }, children: _jsxs(\"div\", { className: \"flex items-center gap-2 text-gray-500 dark:text-gray-400\", children: [_jsx(Loader2, { className: \"w-5 h-5 animate-spin\" }), _jsx(\"span\", { className: \"text-sm\", children: \"Loading data from artifacts...\" })] }) })] }) }));\n }\n // Show artifact error state\n if (artifactError) {\n return (_jsx(\"div\", { className: \"bg-white dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-800 shadow-sm\", children: _jsxs(\"div\", { className: \"flex flex-col gap-2 p-3\", children: [_jsx(\"div\", { className: \"flex items-center justify-between\", children: _jsx(\"span\", { className: \"font-medium text-sm text-gray-900 dark:text-gray-100\", children: title || 'Chart' }) }), _jsx(\"div\", { style: { width: '100%', height: baseHeight }, children: _jsx(VegaErrorDisplay, { error: artifactError, chartTitle: title }) })] }) }));\n }\n if (error) {\n return (_jsx(\"div\", { className: \"bg-white dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-800 shadow-sm\", children: _jsxs(\"div\", { className: \"flex flex-col gap-2 p-3\", children: [_jsx(\"div\", { className: \"flex items-center justify-between\", children: _jsx(\"span\", { className: \"font-medium text-sm text-gray-900 dark:text-gray-100\", children: title || 'Chart' }) }), _jsx(\"div\", { style: { width: '100%', height: baseHeight }, children: _jsx(VegaErrorDisplay, { error: error, chartTitle: title }) })] }) }));\n }\n // Build spec for rendering\n const chartSpec = buildFullSpec(baseHeight);\n const fullscreenSpec = buildFullSpec(0, true);\n // Handle case when spec isn't ready yet\n if (!chartSpec) {\n return null;\n }\n // Debug: Log renders to track unnecessary re-renders (enable with localStorage)\n if (typeof window !== 'undefined' && localStorage.getItem('DEBUG_VEGA_RENDERS')) {\n console.log('VegaLite rendering with spec:', {\n title,\n hasData: !!chartSpec.data?.values,\n dataLength: chartSpec.data?.values?.length,\n });\n }\n return (_jsxs(_Fragment, { children: [_jsx(\"div\", { className: cn(\"bg-white dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-800 shadow-sm\", isDashboard && \"border-2\"), children: _jsxs(\"div\", { className: \"flex flex-col gap-2 p-3\", children: [_jsxs(\"div\", { className: \"flex items-center justify-between\", children: [_jsxs(\"div\", { className: \"flex items-center gap-2\", children: [_jsx(\"span\", { className: \"font-medium text-sm text-gray-900 dark:text-gray-100\", children: title || (isDashboard ? 'Dashboard' : 'Chart') }), isDashboard && (_jsx(\"span\", { className: \"text-xs px-2 py-0.5 rounded-full bg-indigo-100 dark:bg-indigo-900 text-indigo-700 dark:text-indigo-300\", children: \"Interactive\" }))] }), _jsx(Toolbar, {})] }), description && (_jsx(\"span\", { className: \"text-xs text-gray-500 dark:text-gray-400\", children: description })), _jsx(\"div\", { ref: containerRef, className: \"bg-white dark:bg-gray-900 rounded overflow-hidden\", style: { width: '100%', height: baseHeight, minWidth: 0 }, children: _jsx(VegaEmbed, { spec: chartSpec, onEmbed: (result) => handleNewView(result.view), onError: handleError, options: { renderer: options?.renderer || 'canvas', actions: false } }) })] }) }), _jsxs(FullscreenDialog, { isOpen: isFullscreen, onClose: () => setIsFullscreen(false), title: title || (isDashboard ? 'Dashboard' : 'Chart'), description: description, children: [_jsx(\"div\", { className: \"w-full h-full min-h-[calc(100vh-200px)]\", children: fullscreenSpec && (_jsx(VegaEmbed, { spec: fullscreenSpec, onEmbed: (result) => handleFullscreenNewView(result.view), onError: handleError, options: { renderer: options?.renderer || 'canvas', actions: false } })) }), _jsx(\"div\", { className: \"absolute bottom-6 right-6\", children: _jsx(Toolbar, { className: \"bg-white dark:bg-gray-800 rounded-lg shadow-lg p-2 border border-gray-200 dark:border-gray-700\" }) })] })] }));\n}, (prevProps, nextProps) => {\n // Deep compare the spec to prevent re-renders when data hasn't changed\n return JSON.stringify(prevProps.spec) === JSON.stringify(nextProps.spec) &&\n prevProps.artifactRunId === nextProps.artifactRunId;\n});\n//# sourceMappingURL=VegaLiteChart.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { useEffect, useRef, useState, useId } from 'react';\nimport mermaid from 'mermaid';\nconst MERMAID_FONT_FAMILY = 'Inter, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif';\n/**\n * Browser-side Mermaid normalization:\n * - Convert escaped newlines in quoted labels (`\\n`, `\\\\n`) to HTML line breaks.\n * Mermaid web rendering handles `<br/>` labels more reliably than escaped `\\n`.\n */\nfunction normalizeMermaidCodeForBrowser(code) {\n const trimmed = code.trim();\n let normalized = '';\n let inDoubleQuote = false;\n let inSingleQuote = false;\n for (let i = 0; i < trimmed.length; i++) {\n const char = trimmed[i];\n const prev = i > 0 ? trimmed[i - 1] : '';\n if (char === '\"' && !inSingleQuote && prev !== '\\\\') {\n inDoubleQuote = !inDoubleQuote;\n normalized += char;\n continue;\n }\n if (char === \"'\" && !inDoubleQuote && prev !== '\\\\') {\n inSingleQuote = !inSingleQuote;\n normalized += char;\n continue;\n }\n if ((inDoubleQuote || inSingleQuote) && char === '\\\\') {\n let j = i;\n while (trimmed[j] === '\\\\') {\n j++;\n }\n if (trimmed[j] === 'n') {\n normalized += '<br/>';\n i = j;\n continue;\n }\n }\n normalized += char;\n }\n return normalized;\n}\n/**\n * Force Mermaid SVG output to scale with container width.\n * This keeps text and shapes proportional when the container shrinks/expands.\n */\nfunction makeSvgResponsive(svg) {\n return svg.replace(/<svg([^>]*)>/i, (_full, attrs) => {\n let nextAttrs = attrs\n .replace(/\\swidth=\"[^\"]*\"/i, '')\n .replace(/\\sheight=\"[^\"]*\"/i, '');\n if (/style=\"/i.test(nextAttrs)) {\n nextAttrs = nextAttrs.replace(/style=\"([^\"]*)\"/i, (_styleFull, styleValue) => `style=\"${styleValue};width:100%;height:auto;display:block;max-width:100%;\"`);\n }\n else {\n nextAttrs += ' style=\"width:100%;height:auto;display:block;max-width:100%;\"';\n }\n if (!/preserveAspectRatio=/i.test(nextAttrs)) {\n nextAttrs += ' preserveAspectRatio=\"xMidYMid meet\"';\n }\n return `<svg${nextAttrs}>`;\n });\n}\n// Initialize mermaid with a browser-focused config close to Mermaid Playground defaults.\nmermaid.initialize({\n startOnLoad: false,\n theme: 'default',\n securityLevel: 'loose',\n fontFamily: MERMAID_FONT_FAMILY,\n suppressErrorRendering: true,\n flowchart: {\n htmlLabels: true,\n useMaxWidth: true,\n nodeSpacing: 40,\n rankSpacing: 50,\n padding: 12,\n },\n sequence: {\n useMaxWidth: true,\n },\n themeVariables: {\n fontFamily: MERMAID_FONT_FAMILY,\n },\n});\n/**\n * MermaidDiagram - Renders mermaid diagram code as SVG\n *\n * Supports all mermaid diagram types including:\n * - flowchart/graph\n * - sequence\n * - class\n * - state\n * - er (entity relationship)\n * - gantt\n * - pie\n * - mindmap\n * - timeline\n * - and more\n */\nexport function MermaidDiagram({ code, className }) {\n const containerRef = useRef(null);\n const [svg, setSvg] = useState(null);\n const [error, setError] = useState(null);\n const uniqueId = useId().replace(/:/g, '_');\n useEffect(() => {\n let cancelled = false;\n const renderDiagram = async () => {\n if (!code.trim()) {\n setSvg(null);\n setError(null);\n return;\n }\n try {\n // Reset error state\n setError(null);\n // Generate unique ID for this render\n const id = `mermaid-${uniqueId}-${Date.now()}`;\n const normalizedCode = normalizeMermaidCodeForBrowser(code);\n // Render the diagram\n const { svg: renderedSvg } = await mermaid.render(id, normalizedCode);\n const responsiveSvg = makeSvgResponsive(renderedSvg);\n if (!cancelled) {\n setSvg(responsiveSvg);\n }\n }\n catch (err) {\n if (!cancelled) {\n const message = err instanceof Error ? err.message : 'Failed to render mermaid diagram';\n setError(message);\n setSvg(null);\n }\n }\n };\n renderDiagram();\n return () => {\n cancelled = true;\n };\n }, [code, uniqueId]);\n // Silently ignore mermaid syntax errors - just render nothing\n if (error) {\n return null;\n }\n if (!svg) {\n return (_jsx(\"div\", { className: `my-4 p-4 bg-gray-50 dark:bg-gray-800 rounded-lg animate-pulse ${className || ''}`, children: _jsx(\"div\", { className: \"h-32 bg-gray-200 dark:bg-gray-700 rounded\" }) }));\n }\n return (_jsx(\"div\", { ref: containerRef, className: `my-4 w-full overflow-x-auto [&_svg]:mx-auto [&_svg]:w-full [&_svg]:h-auto [&_svg]:max-w-full ${className || ''}`, dangerouslySetInnerHTML: { __html: svg } }));\n}\n//# sourceMappingURL=MermaidDiagram.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport React from \"react\";\nimport { Button } from \"@vertesia/ui/core\";\nimport { MarkdownRenderer } from \"@vertesia/ui/widgets\";\nimport { MessageSquare, CheckCircle, XCircle, AlertCircle, HelpCircle, Send } from \"lucide-react\";\nconst VARIANT_STYLES = {\n default: {\n border: \"border-l-attention\",\n bg: \"bg-amber-50 dark:bg-amber-900/20\",\n icon: \"text-attention\",\n },\n warning: {\n border: \"border-l-destructive\",\n bg: \"bg-red-50 dark:bg-red-900/20\",\n icon: \"text-destructive\",\n },\n info: {\n border: \"border-l-info\",\n bg: \"bg-blue-50 dark:bg-blue-900/20\",\n icon: \"text-info\",\n },\n success: {\n border: \"border-l-success\",\n bg: \"bg-green-50 dark:bg-green-900/20\",\n icon: \"text-success\",\n },\n};\nconst VARIANT_ICONS = {\n default: HelpCircle,\n warning: AlertCircle,\n info: MessageSquare,\n success: CheckCircle,\n};\n/**\n * AskUserWidget - A styled component for displaying agent prompts/questions to users\n *\n * Use this when the agent needs user input, confirmation, or selection from options.\n * Supports both option selection and free-form text input.\n */\nexport function AskUserWidget({ question, description, options, onSelect, onMultiSelect, onSubmit, allowFreeResponse = false, multiSelect = false, placeholder = \"Type your response...\", isLoading = false, icon, variant = \"default\", hideIcon = false, hideBorder = false, \n// Styling props\nclassName, cardClassName, headerClassName, iconClassName, questionClassName, descriptionClassName, optionsClassName, buttonClassName, inputContainerClassName, inputClassName, submitButtonClassName, }) {\n const [inputValue, setInputValue] = React.useState(\"\");\n const [selectedOptions, setSelectedOptions] = React.useState(new Set());\n const inputRef = React.useRef(null);\n const styles = VARIANT_STYLES[variant];\n const DefaultIcon = VARIANT_ICONS[variant];\n const toggleOption = (optionId) => {\n setSelectedOptions((prev) => {\n const next = new Set(prev);\n if (next.has(optionId)) {\n next.delete(optionId);\n }\n else {\n next.add(optionId);\n }\n return next;\n });\n };\n const handleMultiSubmit = () => {\n if (selectedOptions.size > 0 && onMultiSelect) {\n onMultiSelect(Array.from(selectedOptions));\n setSelectedOptions(new Set());\n }\n };\n const handleSubmit = () => {\n if (inputValue.trim() && onSubmit) {\n onSubmit(inputValue.trim());\n setInputValue(\"\");\n }\n };\n const handleKeyDown = (e) => {\n if (e.key === \"Enter\" && !e.shiftKey) {\n e.preventDefault();\n handleSubmit();\n }\n };\n const borderClass = hideBorder ? \"\" : `border-l-4 ${styles.border}`;\n return (_jsx(\"div\", { className: `my-4 font-sans ${className || \"\"}`, children: _jsxs(\"div\", { className: `${borderClass} ${styles.bg} rounded-r-lg shadow-sm ${cardClassName || \"\"}`, children: [_jsx(\"div\", { className: `px-4 py-3 ${headerClassName || \"\"}`, children: _jsxs(\"div\", { className: \"flex items-start gap-3\", children: [!hideIcon && (_jsx(\"div\", { className: `flex-shrink-0 mt-0.5 ${styles.icon} ${iconClassName || \"\"}`, children: icon || _jsx(DefaultIcon, { className: \"size-5\" }) })), _jsxs(\"div\", { className: \"flex-1 min-w-0\", children: [_jsx(\"div\", { className: `prose prose-sm dark:prose-invert max-w-none text-gray-900 dark:text-gray-100 ${questionClassName || \"\"}`, children: _jsx(MarkdownRenderer, { children: question }) }), description && (_jsx(\"p\", { className: `mt-1 text-sm text-gray-600 dark:text-gray-400 ${descriptionClassName || \"\"}`, children: description }))] })] }) }), options && options.length > 0 && (_jsx(\"div\", { className: `px-4 pb-3 pt-1 ${optionsClassName || \"\"}`, children: multiSelect ? (\n /* Multi-select mode with checkboxes */\n _jsxs(\"div\", { className: \"space-y-2\", children: [options.map((option) => (_jsxs(\"label\", { className: `flex items-start gap-3 px-4 py-3 rounded-lg cursor-pointer transition-colors\n ${selectedOptions.has(option.id)\n ? \"bg-blue-50 dark:bg-blue-900/30 border border-blue-300 dark:border-blue-700\"\n : \"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-700\"}\n ${isLoading ? \"opacity-50 cursor-not-allowed\" : \"\"}`, children: [_jsx(\"input\", { type: \"checkbox\", checked: selectedOptions.has(option.id), onChange: () => toggleOption(option.id), disabled: isLoading, className: \"mt-0.5 w-4 h-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700\" }), _jsxs(\"div\", { className: \"flex-1 overflow-hidden\", children: [_jsxs(\"div\", { className: \"flex items-center gap-2 text-sm font-medium text-gray-900 dark:text-gray-100 break-words\", children: [option.icon, _jsx(\"span\", { className: \"break-words\", children: option.label })] }), option.description && (_jsx(\"div\", { className: \"mt-1 text-sm text-gray-500 dark:text-gray-400 break-words whitespace-pre-wrap\", children: option.description }))] })] }, option.id))), _jsx(\"div\", { className: \"pt-2\", children: _jsxs(Button, { size: \"sm\", onClick: handleMultiSubmit, disabled: isLoading || selectedOptions.size === 0, className: \"flex items-center gap-2\", children: [_jsx(Send, { className: \"size-4\" }), \"Submit Selection\", selectedOptions.size > 0 ? ` (${selectedOptions.size})` : \"\"] }) })] })) : (\n /* Single-select mode - always use full-width card layout for clarity */\n _jsx(\"div\", { className: \"flex flex-col gap-2 w-full\", children: options.map((option) => (_jsx(\"button\", { onClick: () => onSelect?.(option.id), disabled: isLoading, className: `w-full text-left px-4 py-3 rounded-lg border border-gray-200 dark:border-gray-700\n bg-white dark:bg-gray-800\n hover:bg-gray-50 dark:hover:bg-gray-700 hover:border-gray-300 dark:hover:border-gray-600\n focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-1\n transition-colors\n ${isLoading ? \"opacity-50 cursor-not-allowed\" : \"cursor-pointer\"}\n ${buttonClassName || \"\"}`, children: _jsxs(\"div\", { className: \"flex items-start gap-3\", children: [option.icon && (_jsx(\"span\", { className: \"flex-shrink-0 mt-0.5 text-gray-500 dark:text-gray-400\", children: option.icon })), _jsxs(\"div\", { className: \"flex-1 overflow-hidden\", children: [_jsx(\"div\", { className: \"font-medium text-sm text-gray-900 dark:text-gray-100 break-words\", children: option.label }), option.description && (_jsx(\"div\", { className: \"mt-1 text-sm text-gray-500 dark:text-gray-400 break-words whitespace-pre-wrap\", children: option.description }))] })] }) }, option.id))) })) })), allowFreeResponse && (_jsx(\"div\", { className: `px-4 pb-3 pt-1 ${inputContainerClassName || \"\"}`, children: _jsxs(\"div\", { className: \"flex gap-2\", children: [_jsx(\"input\", { ref: inputRef, type: \"text\", value: inputValue, onChange: (e) => setInputValue(e.target.value), onKeyDown: handleKeyDown, placeholder: placeholder, disabled: isLoading, className: `flex-1 px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-800 focus:ring-2 focus:ring-blue-500 focus:border-transparent ${inputClassName || \"\"}` }), _jsx(Button, { size: \"sm\", onClick: handleSubmit, disabled: isLoading || !inputValue.trim(), className: submitButtonClassName, children: isLoading ? \"...\" : \"Send\" })] }) }))] }) }));\n}\nexport function ConfirmationWidget({ question, description, onConfirm, onCancel, confirmLabel = \"Yes\", cancelLabel = \"No\", isLoading = false, variant = \"default\", className, }) {\n return (_jsx(AskUserWidget, { question: question, description: description, variant: variant, isLoading: isLoading, className: className, options: [\n {\n id: \"confirm\",\n label: confirmLabel,\n icon: _jsx(CheckCircle, { className: \"size-4\" }),\n },\n {\n id: \"cancel\",\n label: cancelLabel,\n icon: _jsx(XCircle, { className: \"size-4\" }),\n },\n ], onSelect: (id) => {\n if (id === \"confirm\")\n onConfirm();\n else\n onCancel();\n } }));\n}\n//# sourceMappingURL=AskUserWidget.js.map","/**\n * useArtifactContent - Hook to fetch artifact content from GCS\n *\n * Used by expand:* code blocks to fetch and render artifact content inline.\n */\nimport { useState, useEffect, useCallback, useRef } from 'react';\nimport { useUserSession } from '@vertesia/ui/session';\nimport { useArtifactUrlCache, getArtifactCacheKey, } from '../../features/agent/chat/useArtifactUrlCache';\n/**\n * Detect content type from path extension\n */\nfunction detectContentType(path) {\n const ext = path.split('.').pop()?.toLowerCase();\n switch (ext) {\n case 'json':\n return 'json';\n case 'md':\n case 'txt':\n case 'csv':\n case 'yaml':\n case 'yml':\n return 'text';\n case 'png':\n case 'jpg':\n case 'jpeg':\n case 'gif':\n case 'webp':\n case 'pdf':\n return 'binary';\n default:\n return 'text';\n }\n}\n/**\n * Hook to fetch artifact content from GCS.\n * Handles caching, loading states, and error handling.\n *\n * @example\n * ```tsx\n * const { data, isLoading, error } = useArtifactContent({\n * runId: artifactRunId,\n * path: 'direct/chart_123.json'\n * });\n * ```\n */\nexport function useArtifactContent({ runId, path, parseJson = true, }) {\n const { client } = useUserSession();\n const urlCache = useArtifactUrlCache();\n // Use refs to avoid triggering effect re-runs\n const clientRef = useRef(client);\n clientRef.current = client;\n const urlCacheRef = useRef(urlCache);\n urlCacheRef.current = urlCache;\n const [state, setState] = useState({\n data: undefined,\n rawContent: undefined,\n isLoading: true,\n error: undefined,\n contentType: undefined,\n });\n const [retryCount, setRetryCount] = useState(0);\n const fetchContent = useCallback(async () => {\n if (!runId) {\n setState({\n data: undefined,\n rawContent: undefined,\n isLoading: false,\n error: 'No run ID provided',\n contentType: undefined,\n });\n return;\n }\n if (!path) {\n setState({\n data: undefined,\n rawContent: undefined,\n isLoading: false,\n error: 'No artifact path provided',\n contentType: undefined,\n });\n return;\n }\n setState(prev => ({ ...prev, isLoading: true, error: undefined }));\n const currentClient = clientRef.current;\n const currentUrlCache = urlCacheRef.current;\n const contentType = detectContentType(path);\n try {\n // Get signed URL for the artifact\n const cacheKey = getArtifactCacheKey(runId, path, 'inline');\n let signedUrl;\n if (currentUrlCache) {\n signedUrl = await currentUrlCache.getOrFetch(cacheKey, async () => {\n const result = await currentClient.files.getArtifactDownloadUrl(runId, path, 'inline');\n return result.url;\n });\n }\n else {\n const result = await currentClient.files.getArtifactDownloadUrl(runId, path, 'inline');\n signedUrl = result.url;\n }\n // Fetch the actual content\n const response = await fetch(signedUrl);\n if (!response.ok) {\n throw new Error(`Failed to fetch artifact: ${response.status} ${response.statusText}`);\n }\n // For binary content, return the URL instead\n if (contentType === 'binary') {\n setState({\n data: signedUrl,\n rawContent: undefined,\n isLoading: false,\n error: undefined,\n contentType,\n });\n return;\n }\n const rawContent = await response.text();\n // Parse JSON if requested and content is JSON\n let data;\n if (parseJson && contentType === 'json') {\n try {\n data = JSON.parse(rawContent);\n }\n catch {\n // If JSON parse fails, treat as text\n data = rawContent;\n }\n }\n else {\n data = rawContent;\n }\n setState({\n data,\n rawContent,\n isLoading: false,\n error: undefined,\n contentType,\n });\n }\n catch (err) {\n const errorMessage = err instanceof Error ? err.message : 'Failed to fetch artifact';\n console.error('Failed to fetch artifact content:', path, err);\n setState({\n data: undefined,\n rawContent: undefined,\n isLoading: false,\n error: errorMessage,\n contentType,\n });\n }\n }, [runId, path, parseJson]);\n useEffect(() => {\n fetchContent();\n }, [fetchContent, retryCount]);\n const retry = useCallback(() => {\n setState({\n data: undefined,\n rawContent: undefined,\n isLoading: true,\n error: undefined,\n contentType: undefined,\n });\n setRetryCount(c => c + 1);\n }, []);\n return {\n data: state.data,\n rawContent: state.rawContent,\n isLoading: state.isLoading,\n error: state.error,\n contentType: state.contentType,\n retry,\n };\n}\n//# sourceMappingURL=useArtifactContent.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\n/**\n * ArtifactContentRenderer - Renders artifact content by type\n *\n * Supports rendering charts, tables, markdown, fusion fragments, and more.\n */\nimport { useMemo } from 'react';\nimport DOMPurify from 'dompurify';\nimport { CodeBlockPlaceholder, CodeBlockErrorBoundary } from './CodeBlockPlaceholder';\nimport { VegaLiteChart } from '../../features/agent/chat/VegaLiteChart';\nimport { FusionFragmentHandler, FusionFragmentProvider } from '@vertesia/fusion-ux';\nimport { MarkdownRenderer } from './MarkdownRenderer';\n/**\n * Auto-detect render type from content and path\n */\nfunction autoDetectRenderType(content, path, contentType) {\n const ext = path.split('.').pop()?.toLowerCase();\n // SVG files → mockup renderer (inline SVG from text content)\n if (ext === 'svg') {\n return 'mockup';\n }\n // Image extensions (binary → rendered via URL)\n if (['png', 'jpg', 'jpeg', 'gif', 'webp'].includes(ext || '')) {\n return 'image';\n }\n // Markdown\n if (ext === 'md') {\n return 'markdown';\n }\n // CSV as table\n if (ext === 'csv') {\n return 'table';\n }\n // JSON content - try to detect chart or table\n if (contentType === 'json' && typeof content === 'object' && content !== null) {\n const obj = content;\n // Check for Vega-Lite schema\n if (typeof obj.$schema === 'string' && obj.$schema.includes('vega')) {\n return 'vega-lite';\n }\n // Check for wrapped Vega-Lite\n if (obj.library === 'vega-lite' && 'spec' in obj) {\n return 'vega-lite';\n }\n // Check for fusion fragment template with data\n if ('template' in obj && 'data' in obj) {\n return 'fusion-fragment';\n }\n // Check for table data (array of objects)\n if (Array.isArray(content) && content.length > 0 && typeof content[0] === 'object') {\n return 'table';\n }\n }\n // Default to code\n return 'code';\n}\nfunction toVegaLiteSpec(content) {\n if (typeof content !== 'object' || content === null) {\n return null;\n }\n const obj = content;\n if (obj.library === 'vega-lite' && 'spec' in obj && typeof obj.spec === 'object' && obj.spec !== null) {\n return obj;\n }\n if (typeof obj.$schema === 'string' && obj.$schema.includes('vega')) {\n return { library: 'vega-lite', spec: obj };\n }\n return null;\n}\n/**\n * Table renderer for array data or CSV\n */\nfunction TableRenderer({ content }) {\n const { headers, rows } = useMemo(() => {\n if (!Array.isArray(content) || content.length === 0) {\n return { headers: [], rows: [] };\n }\n // Extract headers from first object\n const first = content[0];\n if (typeof first !== 'object' || first === null) {\n return { headers: [], rows: [] };\n }\n const headers = Object.keys(first);\n const rows = content.map(row => headers.map(h => {\n const val = row[h];\n if (val === null || val === undefined)\n return '';\n if (typeof val === 'object')\n return JSON.stringify(val);\n return String(val);\n }));\n return { headers, rows };\n }, [content]);\n if (headers.length === 0) {\n return (_jsx(CodeBlockPlaceholder, { type: \"table\", error: \"No table data found\" }));\n }\n return (_jsxs(\"div\", { className: \"overflow-x-auto\", children: [_jsxs(\"table\", { className: \"min-w-full text-sm border-collapse\", children: [_jsx(\"thead\", { children: _jsx(\"tr\", { className: \"border-b\", children: headers.map((h, i) => (_jsx(\"th\", { className: \"px-3 py-2 text-left font-medium text-muted\", children: h }, i))) }) }), _jsx(\"tbody\", { children: rows.slice(0, 100).map((row, i) => (_jsx(\"tr\", { className: \"border-b border-muted/20\", children: row.map((cell, j) => (_jsx(\"td\", { className: \"px-3 py-2\", children: cell }, j))) }, i))) })] }), rows.length > 100 && (_jsxs(\"div\", { className: \"text-sm text-muted py-2\", children: [\"Showing 100 of \", rows.length, \" rows\"] }))] }));\n}\n/**\n * Code block renderer for raw content\n */\nfunction CodeRenderer({ content, path }) {\n const ext = path.split('.').pop()?.toLowerCase() || '';\n const code = typeof content === 'string' ? content : JSON.stringify(content, null, 2);\n return (_jsx(\"pre\", { className: \"overflow-x-auto p-3 bg-muted/10 rounded text-sm\", children: _jsx(\"code\", { className: `language-${ext}`, children: code }) }));\n}\n/**\n * Sanitize SVG markup using DOMPurify.\n * Allows only safe SVG elements; strips scripts, event handlers, and foreignObject.\n */\nexport function sanitizeSvg(svg) {\n return DOMPurify.sanitize(svg, {\n USE_PROFILES: { svg: true, svgFilters: true },\n ADD_TAGS: ['use'],\n FORBID_TAGS: ['foreignObject'],\n });\n}\n/**\n * Make SVG responsive — remove fixed dimensions, ensure viewBox.\n */\nexport function makeSvgResponsive(svg) {\n return svg.replace(/<svg([^>]*)>/i, (_full, attrs) => {\n let a = attrs;\n if (!/viewBox/i.test(a)) {\n const w = /\\swidth\\s*=\\s*[\"']?(\\d+(?:\\.\\d+)?)/i.exec(a);\n const h = /\\sheight\\s*=\\s*[\"']?(\\d+(?:\\.\\d+)?)/i.exec(a);\n if (w && h)\n a += ` viewBox=\"0 0 ${w[1]} ${h[1]}\"`;\n }\n a = a\n .replace(/\\swidth\\s*=\\s*(?:\"[^\"]*\"|'[^']*'|[^\\s>]+)/i, '')\n .replace(/\\sheight\\s*=\\s*(?:\"[^\"]*\"|'[^']*'|[^\\s>]+)/i, '');\n if (/style=\"/i.test(a)) {\n a = a.replace(/style=\"([^\"]*)\"/i, (_, v) => `style=\"${v};width:100%;height:auto;display:block;max-width:100%;\"`);\n }\n else {\n a += ' style=\"width:100%;height:auto;display:block;max-width:100%;\"';\n }\n if (!/preserveAspectRatio=/i.test(a)) {\n a += ' preserveAspectRatio=\"xMidYMid meet\"';\n }\n return `<svg${a}>`;\n });\n}\n/**\n * Mockup renderer — renders raw SVG content inline after sanitization.\n */\nfunction MockupRenderer({ content }) {\n const processedSvg = useMemo(() => {\n const raw = typeof content === 'string' ? content.trim() : '';\n if (!raw)\n return null;\n return makeSvgResponsive(sanitizeSvg(raw));\n }, [content]);\n if (!processedSvg) {\n return _jsx(CodeBlockPlaceholder, { type: \"expand\", error: \"Empty mockup\" });\n }\n return (_jsx(\"div\", { style: { margin: '16px 0', width: '100%', overflowX: 'auto' }, dangerouslySetInnerHTML: { __html: processedSvg } }));\n}\n/**\n * Image renderer\n */\nfunction ImageRenderer({ content, path }) {\n const url = typeof content === 'string' ? content : '';\n const alt = path.split('/').pop() || 'Artifact image';\n return (_jsx(\"img\", { src: url, alt: alt, className: \"max-w-full h-auto rounded\", loading: \"lazy\" }));\n}\n/**\n * ArtifactContentRenderer - Main component\n *\n * Renders artifact content based on explicit type or auto-detection.\n */\nexport function ArtifactContentRenderer({ content, renderType, path, runId, contentType, }) {\n // Determine actual render type\n const actualType = useMemo(() => {\n if (renderType !== 'auto') {\n return renderType;\n }\n return autoDetectRenderType(content, path, contentType);\n }, [content, path, contentType, renderType]);\n // Render based on type\n switch (actualType) {\n case 'chart': {\n const spec = toVegaLiteSpec(content);\n if (!spec) {\n return (_jsx(CodeBlockPlaceholder, { type: \"chart\", error: \"Only Vega-Lite charts are supported. Recharts rendering has been retired.\" }));\n }\n return (_jsx(CodeBlockErrorBoundary, { type: \"chart\", fallbackCode: JSON.stringify(content, null, 2), children: _jsx(VegaLiteChart, { spec: spec, artifactRunId: runId }) }));\n }\n case 'vega-lite': {\n const spec = toVegaLiteSpec(content);\n if (!spec) {\n return (_jsx(CodeBlockPlaceholder, { type: \"chart\", error: \"Invalid Vega-Lite specification\" }));\n }\n return (_jsx(CodeBlockErrorBoundary, { type: \"chart\", fallbackCode: JSON.stringify(content, null, 2), children: _jsx(VegaLiteChart, { spec: spec, artifactRunId: runId }) }));\n }\n case 'fusion-fragment': {\n // For fusion fragments, content should have { template, data }\n // Wrap with FusionFragmentProvider to inject VegaLiteChart for embedded charts\n const fragmentContent = content;\n console.log('[ArtifactContentRenderer] fusion-fragment:', {\n hasTemplate: !!fragmentContent.template,\n hasData: !!fragmentContent.data,\n runId,\n hasVegaLiteChart: !!VegaLiteChart,\n });\n if (fragmentContent.template && fragmentContent.data) {\n return (_jsx(CodeBlockErrorBoundary, { type: \"fusion-fragment\", fallbackCode: JSON.stringify(content, null, 2), children: _jsx(FusionFragmentProvider, { data: fragmentContent.data, ChartComponent: VegaLiteChart, artifactRunId: runId, children: _jsx(FusionFragmentHandler, { code: JSON.stringify(fragmentContent.template), data: fragmentContent.data }) }) }));\n }\n // If no data wrapper, treat as template-only (needs context from parent provider)\n return (_jsx(CodeBlockErrorBoundary, { type: \"fusion-fragment\", fallbackCode: JSON.stringify(content, null, 2), children: _jsx(FusionFragmentHandler, { code: JSON.stringify(content) }) }));\n }\n case 'table':\n return (_jsx(CodeBlockErrorBoundary, { type: \"table\", fallbackCode: JSON.stringify(content, null, 2), children: _jsx(TableRenderer, { content: content }) }));\n case 'markdown': {\n const markdownContent = typeof content === 'string' ? content : String(content);\n return (_jsx(CodeBlockErrorBoundary, { type: \"markdown\", fallbackCode: markdownContent, children: _jsx(MarkdownRenderer, { artifactRunId: runId, children: markdownContent }) }));\n }\n case 'mockup':\n return (_jsx(CodeBlockErrorBoundary, { type: \"expand\", fallbackCode: typeof content === 'string' ? content : path, children: _jsx(MockupRenderer, { content: content }) }));\n case 'image':\n return (_jsx(CodeBlockErrorBoundary, { type: \"image\", fallbackCode: path, children: _jsx(ImageRenderer, { content: content, path: path }) }));\n case 'code':\n default:\n return _jsx(CodeRenderer, { content: content, path: path });\n }\n}\n//# sourceMappingURL=ArtifactContentRenderer.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport React, { useMemo } from 'react';\nimport { CodeBlockPlaceholder, CodeBlockErrorBoundary } from './CodeBlockPlaceholder';\nimport { VegaLiteChart } from '../../features/agent/chat/VegaLiteChart';\nimport { MermaidDiagram } from './MermaidDiagram';\nimport { AskUserWidget } from '../../features/agent/chat/AskUserWidget';\nimport { useArtifactContent } from './useArtifactContent';\nimport { ArtifactContentRenderer, sanitizeSvg, makeSvgResponsive } from './ArtifactContentRenderer';\nconst CodeBlockContext = React.createContext({});\nexport function CodeBlockHandlerProvider({ children, artifactRunId, onProposalSelect, onProposalSubmit, }) {\n const value = useMemo(() => ({ artifactRunId, onProposalSelect, onProposalSubmit }), [artifactRunId, onProposalSelect, onProposalSubmit]);\n return _jsx(CodeBlockContext.Provider, { value: value, children: children });\n}\nexport function useCodeBlockContext() {\n return React.useContext(CodeBlockContext);\n}\n/**\n * Check if JSON parsing failed due to incomplete content (streaming)\n * vs actually invalid JSON structure\n */\nfunction isIncompleteJson(code) {\n const trimmed = code.trim();\n // Empty or very short content is likely incomplete\n if (trimmed.length < 2)\n return true;\n // Must start with { for a valid JSON object\n if (!trimmed.startsWith('{'))\n return false;\n // Try to parse - if it succeeds, it's not incomplete\n try {\n JSON.parse(trimmed);\n return false; // Valid JSON\n }\n catch (e) {\n const message = e instanceof Error ? e.message : '';\n // Common indicators of incomplete JSON during streaming\n const incompleteIndicators = [\n 'unexpected end',\n 'unterminated string',\n 'expected',\n 'unexpected token',\n ];\n const lowerMessage = message.toLowerCase();\n if (incompleteIndicators.some(ind => lowerMessage.includes(ind))) {\n // Additional check: count brackets to see if they're unbalanced\n let braceCount = 0;\n let bracketCount = 0;\n let inString = false;\n let escaped = false;\n for (const char of trimmed) {\n if (escaped) {\n escaped = false;\n continue;\n }\n if (char === '\\\\') {\n escaped = true;\n continue;\n }\n if (char === '\"') {\n inString = !inString;\n continue;\n }\n if (!inString) {\n if (char === '{')\n braceCount++;\n else if (char === '}')\n braceCount--;\n else if (char === '[')\n bracketCount++;\n else if (char === ']')\n bracketCount--;\n }\n }\n // If brackets are unbalanced or we're in an unclosed string, it's incomplete\n return braceCount > 0 || bracketCount > 0 || inString;\n }\n // For other parse errors, consider it invalid rather than incomplete\n return false;\n }\n}\n/**\n * Parses chart JSON from code block content.\n * Handles cases where extra content is appended after the JSON.\n */\nfunction parseChartJson(code) {\n try {\n let raw = code.trim();\n const jsonStart = raw.indexOf('{');\n const jsonEnd = raw.lastIndexOf('}');\n if (jsonStart !== -1 && jsonEnd > jsonStart) {\n raw = raw.slice(jsonStart, jsonEnd + 1);\n }\n return JSON.parse(raw);\n }\n catch {\n return null;\n }\n}\n/**\n * Detects the chart library from a parsed spec\n */\nfunction detectChartLibrary(spec) {\n // Detect Vega-Lite by $schema containing \"vega\"\n const hasVegaSchema = typeof spec.$schema === 'string' && spec.$schema.includes('vega');\n const isExplicitVegaLite = spec.library === 'vega-lite' && 'spec' in spec;\n if (hasVegaSchema || isExplicitVegaLite) {\n return 'vega-lite';\n }\n return null;\n}\n/**\n * Vega-Lite code block handler\n * Always renders with VegaLiteChart directly - no routing through AgentChart\n */\nexport function VegaLiteCodeBlockHandler({ code }) {\n const { artifactRunId } = useCodeBlockContext();\n // Check if JSON is incomplete (streaming in progress)\n const incomplete = useMemo(() => isIncompleteJson(code), [code]);\n const chartSpec = useMemo(() => {\n if (incomplete)\n return null;\n const spec = parseChartJson(code);\n if (!spec)\n return null;\n // Wrap as VegaLiteChartSpec format\n return { library: 'vega-lite', spec };\n }, [code, incomplete]);\n // Show loading placeholder for incomplete JSON (streaming)\n if (incomplete) {\n return (_jsx(CodeBlockPlaceholder, { type: \"chart\", message: \"Loading chart...\" }));\n }\n if (!chartSpec) {\n return (_jsx(CodeBlockPlaceholder, { type: \"chart\", error: \"Invalid Vega-Lite specification\" }));\n }\n // Render VegaLiteChart directly - bypass AgentChart routing\n return (_jsx(CodeBlockErrorBoundary, { type: \"chart\", fallbackCode: code, children: _jsx(VegaLiteChart, { spec: chartSpec, artifactRunId: artifactRunId }) }));\n}\n/**\n * Chart code block handler\n * `chart` now accepts Vega-Lite specifications only.\n */\nexport function ChartCodeBlockHandler({ code }) {\n const { artifactRunId } = useCodeBlockContext();\n // Check if JSON is incomplete (streaming in progress)\n const incomplete = useMemo(() => isIncompleteJson(code), [code]);\n const chartSpec = useMemo(() => {\n if (incomplete)\n return null;\n const spec = parseChartJson(code);\n if (!spec)\n return null;\n const library = detectChartLibrary(spec);\n if (!library)\n return null;\n // If already wrapped, use as-is.\n if (spec.library === 'vega-lite' && 'spec' in spec && typeof spec.spec === 'object') {\n return spec;\n }\n // Native Vega-Lite spec - wrap it.\n return { library: 'vega-lite', spec };\n }, [code, incomplete]);\n // Show loading placeholder for incomplete JSON (streaming)\n if (incomplete) {\n return (_jsx(CodeBlockPlaceholder, { type: \"chart\", message: \"Loading chart...\" }));\n }\n if (!chartSpec) {\n return (_jsx(CodeBlockPlaceholder, { type: \"chart\", error: \"Invalid Vega-Lite chart specification\" }));\n }\n return (_jsx(CodeBlockErrorBoundary, { type: \"chart\", fallbackCode: code, children: _jsx(VegaLiteChart, { spec: chartSpec, artifactRunId: artifactRunId }) }));\n}\n/**\n * Mermaid diagram code block handler\n */\nexport function MermaidCodeBlockHandler({ code }) {\n const trimmedCode = code.trim();\n if (!trimmedCode) {\n return (_jsx(CodeBlockPlaceholder, { type: \"mermaid\", error: \"Empty diagram\" }));\n }\n return (_jsx(CodeBlockErrorBoundary, { type: \"mermaid\", fallbackCode: code, children: _jsx(MermaidDiagram, { code: trimmedCode }) }));\n}\n/**\n * Proposal/AskUser code block handler\n */\nexport function ProposalCodeBlockHandler({ code }) {\n const { onProposalSelect, onProposalSubmit } = useCodeBlockContext();\n // Check if JSON is incomplete (streaming in progress)\n const incomplete = useMemo(() => isIncompleteJson(code), [code]);\n const widgetProps = useMemo(() => {\n if (incomplete)\n return null;\n try {\n const raw = code.trim();\n const spec = JSON.parse(raw);\n if (!spec.options || (!spec.question && !spec.title)) {\n return null;\n }\n const props = {\n question: spec.question || spec.title || '',\n description: spec.description,\n options: Array.isArray(spec.options)\n ? spec.options.map((opt) => ({\n id: opt.id || opt.value || '',\n label: opt.label || '',\n description: opt.description,\n }))\n : undefined,\n allowFreeResponse: spec.allowFreeResponse ?? spec.multiple,\n variant: spec.variant,\n onSelect: onProposalSelect,\n onSubmit: onProposalSubmit,\n };\n if (!props.question || !props.options?.length) {\n return null;\n }\n return props;\n }\n catch {\n return null;\n }\n }, [code, onProposalSelect, onProposalSubmit, incomplete]);\n // Show loading placeholder for incomplete JSON (streaming)\n if (incomplete) {\n return (_jsx(CodeBlockPlaceholder, { type: \"proposal\", message: \"Loading options...\" }));\n }\n if (!widgetProps) {\n return (_jsx(CodeBlockPlaceholder, { type: \"proposal\", error: \"Invalid proposal specification\" }));\n }\n return (_jsx(CodeBlockErrorBoundary, { type: \"proposal\", fallbackCode: code, children: _jsx(AskUserWidget, { ...widgetProps }) }));\n}\n/**\n * Mockup code block handler — renders inline SVG after sanitization.\n */\nexport function MockupCodeBlockHandler({ code }) {\n const processedSvg = useMemo(() => {\n const trimmed = code.trim();\n if (!trimmed)\n return null;\n return makeSvgResponsive(sanitizeSvg(trimmed));\n }, [code]);\n if (!processedSvg) {\n return (_jsx(CodeBlockPlaceholder, { type: \"code\", error: \"Empty mockup\" }));\n }\n return (_jsx(CodeBlockErrorBoundary, { type: \"code\", fallbackCode: code, children: _jsx(\"div\", { style: { margin: '16px 0', width: '100%', overflowX: 'auto' }, dangerouslySetInnerHTML: { __html: processedSvg } }) }));\n}\n/**\n * Expand code block handler - fetches artifact and renders content inline.\n *\n * Usage: ```expand:chart, ```expand:table, ```expand:markdown, ```expand:fusion-fragment, etc.\n * The type after colon specifies the renderer.\n *\n * @example\n * ```expand:chart\n * direct/chart_abc123.json\n * ```\n */\nexport function ExpandCodeBlockHandler({ code, language }) {\n const { artifactRunId } = useCodeBlockContext();\n const artifactPath = code.trim();\n // Extract render type from language (e.g., \"expand:chart\" → \"chart\")\n const renderType = useMemo(() => {\n if (!language?.includes(':')) {\n return 'auto';\n }\n const type = language.split(':')[1];\n // Validate known types\n const validTypes = [\n 'chart', 'vega-lite', 'table', 'markdown',\n 'fusion-fragment', 'mockup', 'code', 'image', 'auto'\n ];\n return validTypes.includes(type) ? type : 'auto';\n }, [language]);\n // Fetch artifact content from GCS\n const { data, isLoading, error, contentType } = useArtifactContent({\n runId: artifactRunId,\n path: artifactPath,\n });\n if (!artifactRunId) {\n return (_jsx(CodeBlockPlaceholder, { type: \"expand\", error: \"No artifact run ID available\" }));\n }\n if (isLoading) {\n return (_jsx(CodeBlockPlaceholder, { type: \"expand\", message: `Loading ${artifactPath}...` }));\n }\n if (error) {\n return (_jsx(CodeBlockPlaceholder, { type: \"expand\", error: `Failed to load artifact: ${error}` }));\n }\n if (data === undefined) {\n return (_jsx(CodeBlockPlaceholder, { type: \"expand\", error: \"No content found in artifact\" }));\n }\n // Render with explicit type\n return (_jsx(ArtifactContentRenderer, { content: data, renderType: renderType, path: artifactPath, runId: artifactRunId, contentType: contentType }));\n}\n/**\n * Check if a language string is an expand:* pattern\n */\nexport function isExpandLanguage(language) {\n return language?.startsWith('expand') ?? false;\n}\n/**\n * Creates the default code block handlers map.\n *\n * These handlers are used as fallbacks when no custom handler is registered\n * via CodeBlockRendererRegistry for a given language. The priority order in\n * MarkdownRenderer is:\n *\n * 1. User-registered handlers (via CodeBlockRendererRegistry)\n * 2. Default handlers (from this function)\n * 3. Existing code component (if passed via components prop)\n * 4. Default <code> element rendering\n *\n * This allows users to override default behavior for specific languages\n * while still getting built-in support for charts, diagrams, and proposals.\n */\nexport function createDefaultCodeBlockHandlers() {\n return {\n // Chart handler for generic chart code blocks (Vega-Lite only)\n chart: ChartCodeBlockHandler,\n // Vega-Lite handlers - always treat as Vega-Lite\n 'vega-lite': VegaLiteCodeBlockHandler,\n 'vegalite': VegaLiteCodeBlockHandler,\n // Mermaid handler\n mermaid: MermaidCodeBlockHandler,\n // Mockup handler (inline SVG)\n mockup: MockupCodeBlockHandler,\n svg: MockupCodeBlockHandler,\n // Proposal handlers\n proposal: ProposalCodeBlockHandler,\n askuser: ProposalCodeBlockHandler,\n };\n}\n//# sourceMappingURL=codeBlockHandlers.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { useCodeBlockRendererRegistry } from './CodeBlockRendering';\nimport React from 'react';\nimport Markdown, { defaultUrlTransform } from 'react-markdown';\nimport remarkGfm from 'remark-gfm';\nimport remarkMath from 'remark-math';\nimport remarkDirective from 'remark-directive';\nimport remarkAlert from 'remark-github-blockquote-alert';\nimport { remarkDefinitionList, defListHastHandlers } from 'remark-definition-list';\nimport remarkSupersub from 'remark-supersub';\nimport rehypeKatex from 'rehype-katex';\nimport { SKIP, visit } from 'unist-util-visit';\nimport { MarkdownLink } from './MarkdownLink';\nimport { MarkdownImage } from './MarkdownImage';\nimport { MarkdownFigure } from './MarkdownFigure';\nimport { remarkDirectiveHandler } from './remarkDirectiveHandler';\nimport { normalizeCustomSchemeLinks } from './normalizeCustomSchemeLinks';\nimport { normalizeDirectives } from './normalizeDirectives';\nimport { CodeBlockHandlerProvider, createDefaultCodeBlockHandlers, isExpandLanguage, ExpandCodeBlockHandler, } from './codeBlockHandlers';\n// Custom URL schemes that we handle in our components\nconst ALLOWED_CUSTOM_SCHEMES = [\n 'artifact:',\n 'image:',\n 'store:',\n 'document:',\n 'document://',\n 'collection:',\n];\n/**\n * Custom URL transform that allows our custom schemes while using\n * the default transform for standard URLs (which sanitizes unsafe schemes).\n */\nfunction customUrlTransform(url) {\n if (ALLOWED_CUSTOM_SCHEMES.some(scheme => url.startsWith(scheme))) {\n return url;\n }\n return defaultUrlTransform(url);\n}\n/**\n * Remark plugin to remove HTML comments from markdown\n */\nfunction remarkRemoveComments() {\n return (tree) => {\n visit(tree, 'html', (node, index, parent) => {\n if (node.value && /<!--[\\s\\S]*?-->/.test(node.value)) {\n if (parent && typeof index === 'number' && parent.children) {\n parent.children.splice(index, 1);\n return [SKIP, index];\n }\n }\n });\n };\n}\n// Create default handlers once, outside component\nconst defaultCodeBlockHandlers = createDefaultCodeBlockHandlers();\nexport function MarkdownRenderer({ children, components, remarkPlugins = [], removeComments = true, artifactRunId, className, codeClassName, inlineCodeClassName, linkClassName, imageClassName, onProposalSelect, onProposalSubmit, }) {\n const codeBlockRegistry = useCodeBlockRendererRegistry();\n const normalizedMarkdown = React.useMemo(() => normalizeDirectives(normalizeCustomSchemeLinks(children)), [children]);\n // Remark plugins (markdown parsing)\n // Order matters: GFM first, then directive (must precede handler),\n // then definition-list/supersub, then math, then user plugins.\n const remarkPluginsArray = React.useMemo(() => {\n const result = [\n remarkGfm,\n remarkDirective,\n remarkDirectiveHandler,\n remarkAlert,\n remarkDefinitionList,\n remarkSupersub,\n remarkMath,\n ...remarkPlugins,\n ];\n if (removeComments) {\n result.push(remarkRemoveComments);\n }\n return result;\n }, [remarkPlugins, removeComments]);\n // Rehype plugins (HTML processing, including KaTeX for math)\n const rehypePluginsArray = React.useMemo(() => [rehypeKatex], []);\n // Remark-rehype bridge options (custom AST handlers for definition lists)\n const remarkRehypeOptions = React.useMemo(() => ({\n handlers: {\n ...defListHastHandlers,\n },\n }), []);\n const componentsWithOverrides = React.useMemo(() => {\n const baseComponents = components || {};\n const ExistingCode = baseComponents.code;\n const ExistingLink = baseComponents.a;\n const ExistingImg = baseComponents.img;\n const CodeComponent = ({ node, className: codeClassName_, children: codeChildren, ...props }) => {\n const match = /language-([\\w-]+)/.exec(codeClassName_ || '');\n const isInline = !match;\n const language = match ? match[1] : '';\n // Check registry for custom renderer (includes default handlers)\n if (!isInline && language) {\n // First check user-provided registry\n if (codeBlockRegistry) {\n const CustomComponent = codeBlockRegistry.getComponent(language);\n if (CustomComponent) {\n const code = String(codeChildren || '').trim();\n return _jsx(CustomComponent, { code: code, language: language });\n }\n }\n // Check for expand:* pattern (e.g., expand:chart, expand:table)\n if (isExpandLanguage(language)) {\n const code = String(codeChildren || '').trim();\n return _jsx(ExpandCodeBlockHandler, { code: code, language: language });\n }\n // Then check default handlers (chart, vega-lite, mermaid, proposal, askuser)\n const DefaultHandler = defaultCodeBlockHandlers[language];\n if (DefaultHandler) {\n const code = String(codeChildren || '').trim();\n return _jsx(DefaultHandler, { code: code, language: language });\n }\n }\n // Delegate to existing code component if provided\n if (typeof ExistingCode === 'function') {\n return (_jsx(ExistingCode, { node: node, className: codeClassName_, ...props, children: codeChildren }));\n }\n // Default code rendering\n const baseInlineClass = 'px-1.5 py-0.5 rounded';\n const baseCodeClass = '';\n return (_jsx(\"code\", { ...props, className: isInline\n ? `${baseInlineClass} ${inlineCodeClassName || ''}`\n : `${baseCodeClass} ${codeClassName || ''}`, children: codeChildren }));\n };\n const LinkComponent = (props) => {\n const { node, href, children: linkChildren, ...rest } = props;\n return (_jsx(MarkdownLink, { node: node, href: href, className: linkClassName, artifactRunId: artifactRunId, ExistingLink: ExistingLink, ...rest, children: linkChildren }));\n };\n const ImageComponent = (props) => {\n const { node, src, alt, title, ...rest } = props;\n // If image has a title, render as figure with caption\n if (title) {\n return (_jsx(MarkdownFigure, { src: src, alt: alt, caption: title, className: imageClassName, artifactRunId: artifactRunId }));\n }\n return (_jsx(MarkdownImage, { node: node, src: src, alt: alt, className: imageClassName, artifactRunId: artifactRunId, ExistingImg: ExistingImg, ...rest }));\n };\n return {\n ...baseComponents,\n code: CodeComponent,\n a: LinkComponent,\n img: ImageComponent,\n };\n }, [\n components,\n artifactRunId,\n codeBlockRegistry,\n codeClassName,\n inlineCodeClassName,\n linkClassName,\n imageClassName,\n ]);\n const markdownContent = (_jsx(CodeBlockHandlerProvider, { artifactRunId: artifactRunId, onProposalSelect: onProposalSelect, onProposalSubmit: onProposalSubmit, children: _jsx(Markdown, { remarkPlugins: remarkPluginsArray, rehypePlugins: rehypePluginsArray, remarkRehypeOptions: remarkRehypeOptions, components: componentsWithOverrides, urlTransform: customUrlTransform, children: normalizedMarkdown }) }));\n if (className) {\n return _jsx(\"div\", { className: `md-content ${className}`, children: markdownContent });\n }\n return _jsx(\"div\", { className: \"md-content\", children: markdownContent });\n}\n//# sourceMappingURL=MarkdownRenderer.js.map","import { createContext, useContext } from \"react\";\nconst PopoverContext = createContext(undefined);\nexport function usePopoverContext() {\n return useContext(PopoverContext);\n}\nexport { PopoverContext };\n//# sourceMappingURL=context.js.map","import { Children, isValidElement } from \"react\";\nconst __SLOT_NAME = Symbol('__SLOT_NAME');\nexport function processOneSlot(child, out, slots) {\n let slotName;\n if (isValidElement(child) && (slotName = child.type[__SLOT_NAME])) {\n slots[slotName] = child;\n }\n else {\n out.push(child);\n }\n}\nexport function processSlots(children, slots) {\n const out = [];\n Children.forEach(children, child => {\n processOneSlot(child, out, slots);\n });\n return out.length > 1 ? out : out[0];\n}\nexport function defineSlot(name, component) {\n component[__SLOT_NAME] = name;\n}\n//# sourceMappingURL=slots.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { flip, offset, shift } from \"@floating-ui/dom\";\nimport { FloatingFocusManager, FloatingPortal, autoUpdate, safePolygon, useClick, useDismiss, useFloating, useHover, useInteractions, useTransitionStyles } from \"@floating-ui/react\";\nimport clsx from \"clsx\";\nimport { useState } from \"react\";\nimport { PopoverContext } from \"./context\";\nimport { defineSlot, processSlots } from \"./slots\";\nfunction computeElementProps(value) {\n if (!value)\n return { enabled: false };\n return (typeof value === 'boolean' ? { enabled: value } : value);\n}\nfunction getHoverProps(props) {\n return props?.hover === true ? {\n enabled: true,\n handleClose: safePolygon({ blockPointerEvents: true }),\n restMs: 0,\n } : props?.hover;\n}\nfunction getClickProps(props) {\n return props && !props.hover && !props.click ? {\n enabled: true,\n } : props?.click;\n}\n/**\n * The component is instantiated when all interactions are known\n * @param param0\n * @returns\n */\nexport function Popover(props) {\n const slots = {};\n processSlots(props.children, slots);\n if (!slots.content) {\n throw new Error('Popover must provide a content slot');\n }\n const triggerProps = slots.trigger?.props;\n const contentProps = slots.content.props;\n // wait for the trigger to be defined\n return _jsx(ResolvedPopover, { ...props, trigger: triggerProps, content: contentProps });\n}\nfunction ResolvedPopover({ middleware, offset: defaultOffset, trigger, dismiss = true, content, placement, strategy, zIndex = 40 }) {\n const [isOpen, setIsOpen] = useState(false);\n const floating = useFloating({\n open: isOpen,\n placement,\n strategy,\n onOpenChange: setIsOpen,\n middleware: middleware || [offset(defaultOffset || 4), shift(), flip()],\n whileElementsMounted: autoUpdate // stick to the anchor when resizing / scrolling\n });\n const { floatingStyles, refs: { setReference, setFloating }, context, } = floating;\n const dismissInteraction = useDismiss(context, computeElementProps(dismiss));\n const clickInteraction = useClick(context, computeElementProps(getClickProps(trigger)));\n const hoverInteraction = useHover(context, computeElementProps(getHoverProps(trigger)));\n const { getReferenceProps, getFloatingProps, } = useInteractions([dismissInteraction, clickInteraction, hoverInteraction]);\n const { isMounted, styles: transitionStyles } = useTransitionStyles(context, content.transition);\n return (_jsxs(PopoverContext.Provider, { value: {\n ...floating,\n close: () => setIsOpen(false)\n }, children: [trigger &&\n _jsx(\"div\", { className: clsx(trigger.className, \"inline-block\"), ref: setReference, ...getReferenceProps(), children: trigger.children }), _jsx(FloatingPortal, { children: isMounted && (_jsx(\"div\", { ref: setFloating, style: { ...floatingStyles, zIndex: zIndex }, ...getFloatingProps(), children: _jsx(FloatingFocusManager, { context: context, children: _jsx(\"div\", { className: clsx(content.className, \"bg-popover rounded-md text-popover-foreground max-w-md\"), style: transitionStyles, children: content.children }) }) })) })] }));\n}\nfunction PopoverTrigger(_props) {\n return null;\n}\ndefineSlot('trigger', PopoverTrigger);\nfunction PopoverContent(_props) {\n return null;\n}\ndefineSlot('content', PopoverContent);\nPopover.Trigger = PopoverTrigger;\nPopover.Content = PopoverContent;\n//# sourceMappingURL=Popover.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nexport function Progress({ percent }) {\n return (_jsx(\"div\", { className: \"w-full bg-gray-200 rounded-full h-2.5 dark:bg-gray-700\", children: _jsx(\"div\", { className: \"bg-blue-600 h-2.5 rounded-full\", style: { width: `${percent}%` } }) }));\n}\n//# sourceMappingURL=Progress.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { Table, VTooltip } from \"@vertesia/ui/core\";\nimport { Info } from \"lucide-react\";\nexport function PropertiesView({ className, properties }) {\n return (_jsx(Table, { className: className, children: _jsx(\"tbody\", { children: properties.map((property) => (_jsxs(\"tr\", { children: [_jsxs(\"td\", { className: 'w-1/3 font-semibold gap-2', children: [_jsx(\"span\", { children: property.name }), property.description &&\n _jsx(VTooltip, { description: property.description, placement: \"top\", children: _jsx(Info, { className: \"size-3 ml-2 text-muted-foreground\" }) })] }), _jsx(\"td\", { className: 'w-2/3', children: property.value ?? 'undefined' })] }, property.name))) }) }));\n}\n//# sourceMappingURL=PropertiesView.js.map","export var TypeNames;\n(function (TypeNames) {\n TypeNames[\"string\"] = \"string\";\n TypeNames[\"number\"] = \"number\";\n TypeNames[\"integer\"] = \"integer\";\n TypeNames[\"boolean\"] = \"boolean\";\n TypeNames[\"object\"] = \"object\";\n TypeNames[\"any\"] = \"any\";\n TypeNames[\"text\"] = \"text\";\n TypeNames[\"media\"] = \"media\";\n TypeNames[\"document\"] = \"document\";\n})(TypeNames || (TypeNames = {}));\nexport function parseTypeSignature(text) {\n text = text.trim();\n let isArray = false, isNullable = false;\n if (text.endsWith('?')) {\n isNullable = true;\n text = text.substring(0, text.length - 1).trim();\n }\n if (text.endsWith('[]')) {\n isArray = true;\n text = text.substring(0, text.length - 2).trim();\n }\n const name = TypeNames[text];\n if (!name) {\n throw new Error(`Unknown type \"${text}\"`);\n }\n return { name, isArray, isNullable, isObject: name === TypeNames.object };\n}\n//# sourceMappingURL=type-signature.js.map","export function setPropertyName(schema, name, newName) {\n if (schema.properties) {\n const properties = schema.properties;\n const newProperties = {};\n for (const key of Object.keys(properties)) {\n const value = properties[key];\n if (key === name) {\n newProperties[newName] = value;\n }\n else {\n newProperties[key] = value;\n }\n }\n schema.properties = newProperties;\n }\n if (schema.required) {\n schema.required = schema.required.map(x => x === name ? newName : x);\n }\n}\nexport function setRequireProperty(schema, name, isRequired) {\n if (Array.isArray(schema.required)) {\n const index = schema.required.indexOf(name);\n if (isRequired) {\n if (index < 0) {\n schema.required.push(name);\n }\n }\n else {\n if (index > -1) {\n schema.required.splice(index, 1);\n }\n }\n }\n else if (isRequired) {\n schema.required = [name];\n }\n}\nexport function setPropertyType(schema, type) {\n const isAny = type.name === \"any\";\n let typeObj = isAny ?\n undefined\n : (type.isNullable ?\n [type.name, \"null\"]\n : type.name);\n if (type.isArray) {\n schema.type = \"array\";\n schema.properties = undefined;\n if (!schema.items || Array.isArray(schema.items)) {\n schema.items = {\n type: typeObj,\n properties: type.isObject ? {} : undefined\n };\n }\n else {\n const items = schema.items;\n items.type = typeObj;\n if (type.isObject && !items.properties) {\n items.properties = {};\n }\n }\n }\n else {\n schema.type = typeObj;\n schema.items = undefined;\n if (type.isObject) {\n if (!schema.properties) {\n schema.properties = {};\n }\n }\n else {\n schema.properties = undefined;\n }\n }\n}\nexport function removeProperty(schema, name) {\n if (schema.properties) {\n delete schema.properties[name];\n if (Array.isArray(schema.required)) {\n schema.required = schema.required.filter(x => x !== name);\n }\n }\n}\n/**\n * Create a new property in the schema\n * @param schema\n * @param name\n * @param type\n * @param isRequired\n */\nexport function addProperty(schema, name, type, isRequired = false) {\n if (schema.type !== \"object\") {\n throw new Error(\"Cannot add property to a non-object schema\");\n }\n if (!schema.properties) {\n schema.properties = {};\n }\n const newSchema = {};\n setPropertyType(newSchema, type);\n schema.properties[name] = newSchema;\n if (isRequired) {\n if (Array.isArray(schema.required)) {\n addRequired(schema.required, name);\n }\n else {\n schema.required = [name];\n }\n }\n return newSchema;\n}\nexport function getTypeSignature(schema) {\n let isNullable = false, isArray = false;\n let typeName;\n const type = schema.type;\n if (Array.isArray(type)) {\n for (const t of type) {\n if (t === \"null\") {\n isNullable = true;\n }\n else if (!typeName) {\n typeName = t;\n }\n }\n }\n else {\n typeName = type;\n }\n if (!typeName) {\n typeName = \"any\";\n }\n if (typeName === 'array') {\n isArray = true;\n typeName = getItemTypeName(schema.items);\n }\n let displayTypeName = typeName;\n switch (schema.editor) {\n case 'textarea': {\n displayTypeName = 'text';\n break;\n }\n case 'media': {\n displayTypeName = 'media';\n break;\n }\n case 'document': {\n displayTypeName = 'document';\n break;\n }\n }\n return {\n isNullable,\n isArray,\n isObject: typeName === \"object\",\n name: displayTypeName\n };\n}\n// TODO we don't support array of arrays\n// for array of multiple type we get the first type\nfunction getItemTypeName(schema) {\n if (!schema) {\n return \"any\";\n }\n let name;\n if (Array.isArray(schema)) {\n name = getFirstNotNullType(schema[0].type);\n }\n else {\n name = getFirstNotNullType(schema.type);\n }\n if (name === \"array\" || name === \"null\") {\n name = \"any\";\n }\n return name;\n}\nfunction getFirstNotNullType(type) {\n if (!type) {\n return \"any\";\n }\n if (Array.isArray(type)) {\n return type.find(x => x !== \"null\") || \"any\";\n }\n return type;\n}\nfunction addRequired(required, name) {\n if (!required.includes(name)) {\n required.push(name);\n }\n}\n//# sourceMappingURL=json-schema4-utils.js.map","import { TypeNames, parseTypeSignature } from \"./type-signature.js\";\nimport { addProperty, getTypeSignature, removeProperty, setPropertyName, setPropertyType, setRequireProperty } from \"./json-schema4-utils.js\";\nlet new_prop_name_cnt = 0;\nexport class ManagedSchema {\n // the schema source contains information about where the schema was loaded\n // the uri serves to retrieve the schema and for now only store:ID URIs are supported\n source;\n onChange = () => { };\n schema;\n root;\n constructor(schema, title) {\n if (!schema) {\n this.schema = {\n title: title,\n type: \"object\",\n properties: {},\n };\n }\n else if (typeof schema === 'string') {\n this.schema = JSON.parse(schema);\n }\n else {\n this.schema = schema;\n }\n if (!this.schema.properties) {\n this.schema.properties = {};\n }\n this.root = new SchemaNode(\"\", this.schema, this);\n this.root.loadChildren();\n }\n get isEmpty() {\n return !this.root.children || this.root.children.length === 0;\n }\n get children() {\n return this.root.children;\n }\n reload() {\n this.root = new SchemaNode(\"\", this.schema, this);\n this.root.loadChildren();\n this.onChange?.(this);\n return this;\n }\n withSource(name, uri) {\n this.source = {\n uri,\n name\n };\n return this;\n }\n withChangeListener(cb) {\n this.onChange = cb;\n return this;\n }\n replaceSchema(schema) {\n if (!schema) {\n this.schema = {\n title: this.schema.title,\n type: \"object\",\n properties: {},\n };\n }\n else {\n this.schema = schema;\n }\n this.reload();\n }\n clone() {\n const clone = new ManagedSchema(this.schema);\n clone.source = this.source;\n if (this.onChange) {\n clone.withChangeListener(this.onChange);\n }\n return clone;\n }\n}\nexport class SchemaNode {\n schema;\n loader;\n parent;\n name;\n isRequired = false;\n type;\n children;\n constructor(name, schema, loader, parent) {\n this.schema = schema;\n this.loader = loader;\n this.parent = parent;\n this.name = name;\n this.type = getTypeSignature(schema);\n if (this.parent) {\n let required = this.parent._getPropertiesSchema().required;\n this.isRequired = required && Array.isArray(required) ? required.includes(name) : false;\n }\n }\n get title() {\n return this.schema.title;\n }\n set title(value) {\n this.schema.title = value;\n }\n get description() {\n return this.schema.description;\n }\n set description(value) {\n this.schema.description = value;\n }\n get isParent() {\n return this.type.isObject;\n }\n // the isNew is a hack to preserve the open state in UI after a node is created and the tree reloaded\n get isNew() {\n return !!this.schema.isNew;\n }\n set isNew(value) {\n if (value) {\n this.schema.isNew = true;\n }\n else {\n delete this.schema.isNew;\n }\n }\n resetIsNew() {\n const isNew = this.isNew;\n this.isNew = false;\n return isNew;\n }\n // end hack\n getNameSignature() {\n return `${this.name}${this.isRequired ? '' : '?'}`;\n }\n getTypeSignature() {\n return `${this.type.name}${this.type.isArray ? '[]' : ''}${this.type.isNullable ? '?' : ''}`;\n }\n getSignature() {\n return `${this.getNameSignature()}: ${this.getTypeSignature()}`;\n }\n reloadTree() {\n this.loader.reload();\n }\n loadChildren() {\n this.children = [];\n if (this.schema.items && this.schema.items.properties) {\n this._loadChildren(this.schema.items.properties);\n }\n else if (this.schema.properties) {\n this._loadChildren(this.schema.properties);\n }\n }\n _loadChildren(properties) {\n for (const name of Object.keys(properties)) {\n const childSchema = properties[name];\n const child = new SchemaNode(name, childSchema, this.loader, this);\n this.children.push(child);\n if (child.isParent) {\n child.loadChildren();\n }\n }\n }\n _getPropertiesSchema() {\n if (this.type.isArray && this.type.isObject) {\n return this.schema.items;\n }\n else {\n return this.schema;\n }\n }\n findAvailableChildName(prefix) {\n const properties = this._getPropertiesSchema().properties || {};\n let name;\n do {\n name = prefix + (++new_prop_name_cnt);\n } while (properties[name]);\n return name;\n }\n /**\n * Add a new child node\n */\n addChild(name, type, isRequired = false) {\n if (!this.type.isObject) {\n throw new Error(\"Cannot add child to a non object node\");\n }\n if (!this.children) {\n this.children = [];\n }\n let schema = this._getPropertiesSchema();\n const childSchema = addProperty(schema, name, type, isRequired);\n const child = new SchemaNode(name, childSchema, this.loader, this);\n this.children.push(child);\n return child;\n }\n /**\n * Remove this node\n */\n remove() {\n if (this.parent && this.parent.type.isObject) {\n const schema = this.parent._getPropertiesSchema();\n removeProperty(schema, this.name);\n if (this.parent.children) {\n this.parent.children = this.parent.children.filter(c => c.name !== this.name);\n }\n return true;\n }\n return false;\n }\n update(data) {\n let updated = false;\n if (data.name != null && this.name !== data.name) {\n if (this.parent) {\n setPropertyName(this.parent._getPropertiesSchema(), this.name, data.name);\n }\n this.name = data.name;\n updated = true;\n }\n if (data.isRequired != null && this.isRequired !== data.isRequired) {\n if (this.parent) {\n setRequireProperty(this.parent._getPropertiesSchema(), this.name, data.isRequired);\n }\n this.isRequired = data.isRequired;\n updated = true;\n }\n let actualType = data.type?.name;\n if (actualType === \"any\") {\n actualType = undefined;\n }\n const typeChanged = actualType !== this.schema.type;\n if (data.type) {\n setPropertyType(this.schema, data.type);\n this.type = data.type;\n if (this.type.isObject) {\n if (!this.children) {\n this.children = [];\n }\n }\n else {\n this.children = undefined;\n }\n updated = true;\n }\n // update editor field\n if (this.schema.editor && data.editor === null) {\n // explicitly set to null => delete current editor\n this.schema.editor = undefined;\n updated = true;\n }\n else if (data.editor) { // a new editor is set\n this.schema.editor = data.editor;\n updated = true;\n }\n else if (typeChanged) {\n // preserve editor only if the type didn't change\n this.schema.editor = undefined;\n updated = true;\n }\n if (data.description !== this.description) {\n this.description = data.description;\n updated = true;\n }\n return updated;\n }\n getUpdateFromNameAndTypeSignature(nameSig, typeSig) {\n let name = nameSig.trim();\n let isRequired = true;\n if (name.endsWith('?')) {\n name = name.substring(0, name.length - 1).trim();\n isRequired = false;\n }\n const type = parseTypeSignature(typeSig);\n let editor;\n if (type.name === 'text') {\n type.name = TypeNames.string;\n editor = 'textarea';\n }\n else if (type.name === 'media') {\n type.name = TypeNames.any;\n editor = 'media';\n }\n else if (type.name === 'document') {\n type.name = TypeNames.any;\n editor = 'document';\n }\n else {\n editor = null; // remove custom editor\n }\n return { name, type, isRequired, editor };\n }\n updateFromNameAndTypeSignature(nameSig, typeSig) {\n return this.update(this.getUpdateFromNameAndTypeSignature(nameSig, typeSig));\n }\n updateFromSignature(text) {\n text = text.trim();\n const index = text.indexOf(':');\n if (index < 0) {\n throw new Error(\"Expecting a name and a type separated by a colon\");\n }\n const nameSig = text.substring(0, index);\n const typeSig = text.substring(index + 1);\n return this.updateFromNameAndTypeSignature(nameSig, typeSig);\n }\n}\n//# sourceMappingURL=ManagedSchema.js.map","export function getEditableSchemaProperty(schema) {\n return {\n name: schema.getNameSignature(),\n type: schema.getTypeSignature(),\n description: schema.description\n };\n}\n//# sourceMappingURL=EditableSchemaProperty.js.map","import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from \"react/jsx-runtime\";\nimport { useEffect, useRef, useState } from 'react';\nimport { AlignLeft } from 'lucide-react';\nimport { Button, Modal, ModalBody, ModalFooter, ModalTitle, Styles, SelectBox } from '@vertesia/ui/core';\nimport { TypeNames } from '../type-signature.js';\nfunction makeTypeOptions() {\n const types = Object.values(TypeNames);\n const options = [...types];\n for (const type of types) {\n options.push(type + '[]');\n }\n types.sort();\n return options;\n}\nconst TYPE_OPTIONS = makeTypeOptions();\nexport function PropertyEditor({ value, onChange, onCancel, onSave }) {\n const [isModalOpen, setModalOpen] = useState(false);\n if (!value)\n return null;\n const onNameChange = (text) => {\n onChange({ ...value, name: text });\n };\n const onTypeChange = (text) => {\n onChange({ ...value, type: text });\n };\n const onDescriptionChange = (text) => {\n if (text !== undefined && typeof text === 'string') {\n onChange({ ...value, description: text }, true);\n }\n setModalOpen(false);\n };\n return (_jsxs(\"div\", { className: \"flex items-center\", children: [_jsx(\"div\", { className: \"flex-1\", children: _jsx(PropertyNameEditor, { value: value.name, onChange: onNameChange, onCancel: onCancel, onSave: onSave }) }), _jsx(\"div\", { className: \"px-1 font-semibold\", children: \":\" }), _jsx(\"div\", { className: \"flex-1\", children: _jsx(PropertyTypeEditor, { value: value.type, onChange: onTypeChange, onCancel: onCancel, onSave: onSave }) }), _jsxs(\"div\", { children: [_jsx(Button, { variant: \"ghost\", size: \"xs\", onClick: () => setModalOpen(true), title: \"Edit description\", children: _jsx(AlignLeft, { className: \"size-4\" }) }), _jsx(EditDescriptionModal, { value: value.description, isOpen: isModalOpen, onClose: onDescriptionChange })] })] }));\n}\nexport function PropertyNameEditor({ value, onChange, onCancel, onSave }) {\n const ref = useRef(null);\n useEffect(() => {\n ref.current?.focus();\n }, []);\n const onKeyUp = (e) => {\n switch (e.key) {\n case \"Enter\":\n onSave?.();\n break;\n case \"Escape\":\n onCancel?.();\n break;\n }\n };\n const _onChange = (e) => {\n onChange(e.target.value);\n };\n return (_jsx(\"input\", { onKeyUp: onKeyUp, ref: ref, value: value, onChange: _onChange, className: Styles.INPUT_UNSTYLED, style: { fontSize: \"inherit\", width: \"\", display: \"inline\" } }));\n}\nfunction PropertyTypeEditor({ value, onChange, onCancel, onSave }) {\n const onBlur = () => {\n onSave?.();\n };\n const onKeyDown = (e, isOpen) => {\n if (!isOpen) {\n if (e.key === 'Enter') {\n onSave?.();\n }\n else if (e.key === 'Escape') {\n onCancel?.();\n }\n }\n };\n return (_jsx(SelectBox, { className: Styles.INPUT_UNSTYLED, options: TYPE_OPTIONS, value: value || '', onBlur: onBlur, onChange: onChange, onKeyDown: onKeyDown, popupClass: \"schema-type-suggest-popup z-90\" }));\n}\nfunction EditDescriptionModal({ value, isOpen, onClose }) {\n return (_jsxs(Modal, { isOpen: isOpen, onClose: onClose, children: [_jsx(ModalTitle, { children: \"Edit description\" }), _jsx(EditDescriptionModalForm, { value: value, onSave: onClose })] }));\n}\nfunction EditDescriptionModalForm({ value, onSave }) {\n const ref = useRef(null);\n const [currentValue, setCurrentValue] = useState(value || '');\n useEffect(() => {\n ref.current && ref.current.focus();\n }, [ref.current]);\n return (_jsxs(_Fragment, { children: [_jsx(ModalBody, { className: \"h-max\", children: _jsx(\"textarea\", { ref: ref, className: \"dark:bg-gray-800 w-full h-full dark:text-white\", value: currentValue, onChange: (e) => setCurrentValue(e.target.value) }) }), _jsx(ModalFooter, { children: _jsx(Button, { onClick: () => onSave(currentValue), children: \"Save Changes\" }) })] }));\n}\n//# sourceMappingURL=PropertyEditor.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nexport function PropertyViewer({ value }) {\n if (!value)\n return null;\n return (_jsxs(\"div\", { className: 'w-full flex items-baseline', children: [_jsx(\"div\", { children: value.name || '' }), _jsx(\"div\", { className: 'ml-2 text-sm text-muted', children: value.type || '' })] }));\n}\n//# sourceMappingURL=PropertyViewer.js.map","import { useState } from \"react\";\nimport { ManagedSchema } from \"../ManagedSchema.js\";\nexport function useSchema(jsonSchema) {\n const [schema, setSchema] = useState(new ManagedSchema(jsonSchema || { type: \"object\", properties: {} }).withChangeListener((schema) => {\n setSchema(schema.clone());\n }));\n return schema;\n}\n//# sourceMappingURL=SchemaContext.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport clsx from 'clsx';\nimport { useEffect, useRef, useState } from 'react';\nimport { SquarePen, Trash2 } from 'lucide-react';\nimport { Button, Styles, useClickOutside, useFlag } from '@vertesia/ui/core';\nconst VIEW_BOX = \"block text-sm sm:leading-6 rounded-md border-0 py-1.5 px-4\";\nconst VIEW_BOX_HOVER = `${VIEW_BOX} hover:shadow-xs hover:ring-1 hover:ring-inset hover:ring-ring`;\nconst EDIT_BOX = `${VIEW_BOX} shadow-xs ring-1 ring-inset ring-ring`;\nexport function Editable({ value, onChange, onDelete, outlineOnHover = false, editOnClick = true, placeholder, viewer, editor, skipClickOutside, isEditing = false, readonly = false, onValidate, }) {\n const { on, off, isOn } = useFlag(isEditing);\n const [validationError, setValidationError] = useState();\n const _onChange = (value) => {\n if (onValidate) {\n const err = onValidate(value);\n if (err) {\n setValidationError(err);\n return; // don't save\n }\n else {\n setValidationError(undefined);\n }\n }\n if (onChange(value)) {\n off();\n }\n };\n const _skipClickOutside = (e) => {\n if (skipClickOutside) {\n return skipClickOutside(e);\n }\n return false;\n };\n return (_jsxs(\"div\", { className: \"\", children: [isOn && !readonly ?\n _jsx(DataEdit, { value: value, onSave: _onChange, onCancel: off, editor: editor, skipClickOutside: _skipClickOutside })\n : _jsx(DataView, { value: value, onEdit: on, viewer: viewer, placeholder: placeholder, outlineOnHover: outlineOnHover, editOnClick: editOnClick, onDelete: onDelete, readonly: readonly }), validationError &&\n _jsx(\"div\", { className: \"text-red-500 text-sm\", children: validationError })] }));\n}\nfunction DataView({ viewer: Viewer, value, onEdit, editOnClick, outlineOnHover, placeholder, onDelete, readonly }) {\n const onClick = () => {\n editOnClick && onEdit();\n };\n const onKeyUp = (e) => {\n if (e.key === \"Enter\") {\n onEdit();\n }\n };\n const btnStyle = 'invisible group-hover:visible';\n return (_jsxs(\"div\", { tabIndex: 0, onKeyUp: onKeyUp, onClick: onClick, className: clsx(\"flex justify-start items-center group\", outlineOnHover ? VIEW_BOX_HOVER : VIEW_BOX, { 'cursor-pointer': editOnClick }), children: [_jsx(Viewer, { value: value, placeholder: placeholder }), _jsxs(\"div\", { className: 'ml-auto flex space-x-2', children: [!readonly && onDelete &&\n _jsx(Button, { variant: \"ghost\", size: \"sm\", className: btnStyle, onClick: onDelete, children: _jsx(Trash2, { className: \"size-4\" }) }), !readonly ?\n _jsx(Button, { variant: \"ghost\", size: \"sm\", className: btnStyle, onClick: onEdit, children: _jsx(SquarePen, { className: \"size-4\" }) })\n : null] })] }));\n}\nfunction DataEdit({ editor: Editor, value, onSave, onCancel, skipClickOutside }) {\n const [actualValue, setActualValue] = useState(value);\n const latestValue = useRef(value);\n const [debounceTimer, setDebounceTimer] = useState(null);\n const handleSave = () => {\n onSave(latestValue.current);\n };\n const ref = useClickOutside(handleSave, skipClickOutside);\n const _onChange = (value, autoSave = false) => {\n setActualValue(value);\n latestValue.current = value;\n if (autoSave) {\n if (debounceTimer) {\n clearTimeout(debounceTimer);\n }\n setDebounceTimer(setTimeout(() => { onSave(value); }, 500));\n }\n };\n return (_jsx(\"div\", { ref: ref, children: _jsx(\"div\", { className: EDIT_BOX, children: _jsx(\"div\", { className: \"w-full\", onClick: (e) => e.stopPropagation(), children: _jsx(Editor, { value: actualValue, onChange: _onChange, onSave: handleSave, onCancel: onCancel }) }) }) }));\n}\nexport function TextDataViewer({ value, placeholder }) {\n if (!value) {\n return (_jsx(\"span\", { className: 'text-gray-400', children: placeholder || 'Missing value' }));\n }\n else {\n return (_jsx(\"span\", { children: value == null ? '' : value.toString() }));\n }\n}\nexport function TextDataEditor({ value, onChange, onCancel, onSave }) {\n const ref = useRef(null);\n useEffect(() => {\n ref.current?.focus();\n }, []);\n const onKeyUp = (e) => {\n switch (e.key) {\n case \"Enter\":\n onSave?.();\n break;\n case \"Escape\":\n onCancel?.();\n break;\n }\n };\n const _onChange = (e) => {\n onChange(e.target.value);\n };\n return (_jsx(\"input\", { onKeyUp: onKeyUp, ref: ref, value: value, onChange: _onChange, className: Styles.INPUT_UNSTYLED, style: { fontSize: \"inherit\" } }));\n}\nexport function EditableText(props) {\n if (!props.viewer) {\n props.viewer = TextDataViewer;\n }\n if (!props.editor) {\n props.editor = TextDataEditor;\n }\n return (_jsx(Editable, { ...props }));\n}\n//# sourceMappingURL=Editable.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { useState } from 'react';\nimport { ChevronDown, ChevronRight, Plus } from 'lucide-react';\nimport { Button, useToast } from '@vertesia/ui/core';\nimport { TypeNames } from '../type-signature.js';\nimport { Editable } from './Editable.js';\nimport { getEditableSchemaProperty } from './EditableSchemaProperty.js';\nimport { PropertyEditor } from './PropertyEditor.js';\nimport { PropertyViewer } from './PropertyViewer.js';\n// do not exit edit mode when user is clicking inside the type suggestion popup\nfunction skipClickOutside(e) {\n const target = e.target;\n return !!(target.closest && target.closest('.schema-type-suggest-popup'));\n}\n;\nexport function SchemaEditor({ schema, readonly = false }) {\n return (_jsxs(\"ul\", { className: \"\", children: [schema.children.map(prop => {\n return renderProperty(prop, readonly);\n }), !readonly ? _jsx(AddPropertyButton, { parent: schema.root }) : null] }));\n}\nfunction renderProperty(node, readonly) {\n return (node.isParent ?\n _jsx(ParentItem, { property: node, readonly: readonly }, node.name)\n :\n _jsx(SimpleItem, { node: node, readonly: readonly }, node.name));\n}\nfunction SimpleItem({ node, readonly }) {\n return (_jsx(\"li\", { children: _jsx(PropertyTitleBar, { property: node, readonly: readonly }) }));\n}\nfunction ParentItem({ property, readonly }) {\n const [isOpen, setOpen] = useState(true);\n const Icon = isOpen ? ChevronDown : ChevronRight;\n return (_jsxs(\"li\", { children: [_jsxs(\"div\", { className: 'flex items-center w-full', children: [_jsx(\"button\", { onClick: () => setOpen(!isOpen), children: _jsx(Icon, { className: \"size-4\" }) }), _jsx(\"div\", { className: 'flex-1', children: _jsx(PropertyTitleBar, { property: property, readonly: readonly }) })] }), isOpen &&\n _jsxs(\"ul\", { className: \"ml-4 border-l border-gray-400 border-dashed\", children: [(property.children || []).map(prop => renderProperty(prop, readonly)), !readonly ? _jsx(AddPropertyButton, { parent: property }) : null] })] }));\n}\nexport function validatePropertyName(propertyName) {\n if (!propertyName) {\n return 'Name is required';\n }\n if (/^[a-zA-Z0-9_]+[?]?$/.test(propertyName)) {\n return undefined; // valid\n }\n return 'Only letters, numbers, underscores or question mark are allowed (a-zA-Z0-9_?)';\n}\nfunction PropertyTitleBar({ property, readonly }) {\n const toast = useToast();\n const onChange = (value) => {\n try {\n if (value.description && typeof value.description !== 'string') {\n value.description = undefined;\n }\n const update = property.getUpdateFromNameAndTypeSignature(value.name, value.type);\n if (property.update({ ...update, description: value.description })) {\n property.reloadTree();\n }\n }\n catch (err) {\n toast({\n status: 'error',\n title: 'Invalid property declaration',\n description: err.message,\n duration: 9000\n });\n return false;\n }\n return true;\n };\n const isNew = property.resetIsNew();\n const editableProp = getEditableSchemaProperty(property);\n return (_jsx(Editable, { value: editableProp, onChange: onChange, onDelete: () => {\n property.remove();\n property.reloadTree();\n }, editor: PropertyEditor, viewer: PropertyViewer, outlineOnHover: true, isEditing: isNew, skipClickOutside: skipClickOutside, readonly: readonly, onValidate: (property) => validatePropertyName(property.name) }));\n}\nfunction AddPropertyButton({ parent }) {\n const add = () => {\n const name = parent.findAvailableChildName(\"new_property_\");\n const child = parent.addChild(name, { isObject: false, isArray: false, isNullable: false, name: TypeNames.string }, true);\n child.isNew = true;\n parent.reloadTree();\n };\n return (_jsxs(Button, { variant: \"ghost\", onClick: add, children: [_jsx(Plus, { className: 'size-4' }), \"Add property\"] }));\n}\n//# sourceMappingURL=SchemaEditor.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { useEffect, useRef } from \"react\";\nexport function SvgIcon({ content, ...props }) {\n const containerRef = useRef(null);\n useEffect(() => {\n if (!containerRef.current)\n return;\n // Parse the SVG string\n const parser = new DOMParser();\n const doc = parser.parseFromString(content, 'image/svg+xml');\n const svgEl = doc.querySelector('svg');\n if (!svgEl) {\n console.warn('SvgIcon: No <svg> element found in provided string');\n containerRef.current.innerHTML = '';\n return;\n }\n // Apply all passed props to the SVG element\n props && Object.entries(props).forEach(([key, value]) => {\n if (value == null)\n return;\n const attrName = key === 'className' ? 'class' : key;\n svgEl.setAttribute(attrName, String(value));\n });\n // Clear and append the new SVG\n containerRef.current.innerHTML = '';\n containerRef.current.appendChild(svgEl);\n }, [content, props]);\n return _jsx(\"span\", { ref: containerRef });\n}\nexport function createSvgIcon(content) {\n const IconComponent = (props) => {\n return _jsx(SvgIcon, { content: content, ...props });\n };\n return IconComponent;\n}\n//# sourceMappingURL=SvgIcon.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { useState, useRef } from \"react\";\nimport { UploadIcon } from \"lucide-react\";\nimport { Button } from \"@vertesia/ui/core\";\n/**\n * A reusable drop zone component for file uploads\n *\n * @example\n * <DropZone\n * onDrop={handleFileSelect}\n * message=\"Drag and drop files here\"\n * buttonLabel=\"Select Files\"\n * />\n */\nexport function DropZone({ onDrop, message, buttonLabel = \"Upload Files\", allowFolders = true, className = \"\" }) {\n const [isDragging, setIsDragging] = useState(false);\n const dropZoneRef = useRef(null);\n const handleDragOver = (e) => {\n e.preventDefault();\n if (e.dataTransfer.types.includes('Files')) {\n setIsDragging(true);\n }\n };\n const handleDragLeave = (e) => {\n e.preventDefault();\n // Only set dragging to false if leaving the container (not entering a child)\n if (dropZoneRef.current && !dropZoneRef.current.contains(e.relatedTarget)) {\n setIsDragging(false);\n }\n };\n const handleDrop = async (e) => {\n e.preventDefault();\n setIsDragging(false);\n if (e.dataTransfer.items && e.dataTransfer.items.length > 0) {\n // Handle folders using the DataTransferItemList API which supports directory reading\n const items = Array.from(e.dataTransfer.items);\n const files = [];\n const folders = new Set();\n const processEntry = async (entry) => {\n if (entry.isFile) {\n // Get file\n const file = await new Promise((resolve) => {\n entry.file((file) => {\n // Store full path in the file object for location use\n Object.defineProperty(file, \"webkitRelativePath\", {\n writable: true,\n value: entry.fullPath.substring(1), // Remove leading slash\n });\n resolve(file);\n });\n });\n // Skip hidden files\n if (!file.name.startsWith(\".\") && file.size > 0) {\n files.push(file);\n }\n // Add folder path to tracking\n const folderPath = entry.fullPath.substring(1).split(\"/\").slice(0, -1).join(\"/\");\n if (folderPath) {\n folders.add(folderPath);\n }\n }\n else if (entry.isDirectory) {\n // Get folder reader\n const reader = entry.createReader();\n const entries = await new Promise((resolve) => {\n reader.readEntries((entries) => {\n resolve(entries);\n });\n });\n // Process all entries\n await Promise.all(entries.map(processEntry));\n // Add this folder to tracking\n const folderPath = entry.fullPath.substring(1);\n if (folderPath) {\n folders.add(folderPath);\n }\n }\n };\n try {\n // Process all dropped items\n await Promise.all(items.map((item) => {\n const entry = item.webkitGetAsEntry ? item.webkitGetAsEntry() : item;\n if (entry) {\n return processEntry(entry);\n }\n return Promise.resolve();\n }));\n if (files.length > 0) {\n const topLevelFolders = new Set(Array.from(folders)\n .map((path) => path.split(\"/\")[0])\n .filter(Boolean));\n const folderCount = topLevelFolders.size;\n const fileCount = files.length;\n let message = \"\";\n if (folderCount > 0) {\n message =\n folderCount === 1\n ? `Preparing to upload 1 folder with ${fileCount} files...`\n : `Preparing to upload ${folderCount} folders with ${fileCount} files...`;\n }\n else {\n message = `Preparing to upload ${fileCount} file${fileCount === 1 ? \"\" : \"s\"}...`;\n }\n onDrop(files, { count: files.length, message });\n }\n }\n catch (error) {\n console.error(\"Error processing dropped files:\", error);\n // Fallback to simple file array if folder processing fails\n const fileArray = Array.from(e.dataTransfer.files);\n if (fileArray.length > 0) {\n onDrop(fileArray);\n }\n }\n }\n else if (e.dataTransfer.files && e.dataTransfer.files.length > 0) {\n // Fallback for browsers that don't support items API\n const fileArray = Array.from(e.dataTransfer.files);\n onDrop(fileArray);\n }\n };\n const handleChange = (e) => {\n if (e.target.files && e.target.files.length > 0) {\n const fileArray = Array.from(e.target.files);\n // Check if there are directories (with webkitRelativePath)\n const hasDirectories = fileArray.some((file) => file.webkitRelativePath && file.webkitRelativePath.includes(\"/\"));\n if (hasDirectories) {\n // Count the unique top-level directories\n const topLevelDirs = new Set(fileArray.map((file) => file.webkitRelativePath?.split(\"/\")[0]).filter(Boolean));\n const folderCount = topLevelDirs.size;\n const fileCount = fileArray.length;\n // Create custom message with folder info\n const formattedMessage = folderCount === 1\n ? `Preparing to upload 1 folder with ${fileCount} files...`\n : `Preparing to upload ${folderCount} folders with ${fileCount} files...`;\n const customMessage = {\n count: fileArray.length,\n message: formattedMessage,\n };\n onDrop(fileArray, customMessage);\n }\n else {\n // Regular file upload\n const feedback = {\n count: fileArray.length,\n message: `Preparing to upload ${fileArray.length} file${fileArray.length === 1 ? \"\" : \"s\"}...`,\n };\n onDrop(fileArray, feedback);\n }\n }\n };\n const selectFile = () => {\n const fileInput = document.createElement(\"input\");\n fileInput.type = \"file\";\n fileInput.multiple = true;\n fileInput.accept = \"*\";\n fileInput?.click();\n fileInput.onchange = (event) => {\n handleChange(event);\n };\n };\n const selectFolder = () => {\n const folderInput = document.createElement(\"input\");\n folderInput.type = \"file\";\n folderInput.multiple = true;\n folderInput.accept = \"*\";\n folderInput.webkitdirectory = true; // webkitdirectory is not standard but widely supported\n folderInput?.click();\n folderInput.onchange = (event) => {\n handleChange(event);\n };\n };\n return (_jsxs(\"div\", { className: `flex flex-col items-center justify-center py-12 border-2 rounded-lg transition-colors ${isDragging ? \"border-color-primary bg-color-primary/10\" : \"border-dashed border-color-border\"} ${className}`, onDragOver: handleDragOver, onDragLeave: handleDragLeave, onDrop: handleDrop, children: [_jsx(UploadIcon, { className: `h-12 w-12 mb-3 transition-colors ${isDragging ? \"text-primary\" : \"text-muted/50\"}` }), _jsx(\"p\", { className: \"text-muted\", children: message }), _jsxs(\"div\", { className: \"flex gap-2 justify-center mt-2\", children: [_jsx(Button, { onClick: selectFile, children: buttonLabel }), allowFolders && (_jsx(Button, { onClick: selectFolder, children: \"Select Folder\" }))] })] }));\n}\n//# sourceMappingURL=DropZone.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { CheckCircleIcon } from \"lucide-react\";\nimport { useState } from \"react\";\n/**\n * Displays a collapsible category of upload results\n *\n * @example\n * <UploadResultCategory\n * title=\"Successfully Uploaded\"\n * count={3}\n * icon={<CheckCircleIcon className=\"h-4 w-4 text-green-500\" />}\n * items={[\"document1.pdf\", \"document2.pdf\", \"document3.pdf\"]}\n * />\n */\nexport function UploadResultCategory({ title, count, icon = _jsx(CheckCircleIcon, { className: \"h-4 w-4 text-green-500\" }), items }) {\n const [isExpanded, setIsExpanded] = useState(false);\n return (_jsxs(\"div\", { className: \"border border-color-border rounded-md overflow-hidden\", children: [_jsxs(\"div\", { className: \"flex items-center justify-between p-3 bg-color-muted/10 cursor-pointer\", onClick: () => setIsExpanded(!isExpanded), children: [_jsxs(\"div\", { className: \"flex items-center\", children: [_jsx(\"span\", { className: \"mr-2\", children: icon }), _jsx(\"span\", { className: \"font-medium\", children: title }), _jsx(\"span\", { className: \"ml-2 px-2 py-0.5 bg-color-muted/20 rounded-full text-xs\", children: count })] }), _jsx(\"button\", { className: \"text-muted\", children: _jsx(\"svg\", { className: `h-5 w-5 transition-transform ${isExpanded ? 'transform rotate-180' : ''}`, fill: \"none\", viewBox: \"0 0 24 24\", stroke: \"currentColor\", children: _jsx(\"path\", { strokeLinecap: \"round\", strokeLinejoin: \"round\", strokeWidth: 2, d: \"M19 9l-7 7-7-7\" }) }) })] }), isExpanded && (_jsx(\"div\", { className: \"p-3 border-t border-color-border max-h-48 overflow-y-auto\", children: items.length > 0 ? (_jsx(\"ul\", { className: \"space-y-1\", children: items.map((item, index) => (_jsx(\"li\", { className: \"text-sm py-1 px-2 rounded hover:bg-color-muted/10\", children: item }, index))) })) : (_jsx(\"div\", { className: \"text-sm text-muted py-2\", children: \"No items to display\" })) }))] }));\n}\n//# sourceMappingURL=UploadResultCategory.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { CheckCircleIcon, AlertCircleIcon, XCircleIcon } from \"lucide-react\";\nimport { UploadResultCategory } from \"./UploadResultCategory\";\n/**\n * Displays a summary of upload results with collapsible categories\n *\n * @example\n * <UploadSummary\n * files={[\n * { name: \"document1.pdf\", status: \"success\" },\n * { name: \"document2.pdf\", status: \"skipped\" }\n * ]}\n * location=\"/reports/2023\"\n * />\n */\nexport function UploadSummary({ files, className = \"\", location, collection }) {\n // Group files by status\n const successFiles = files.filter(f => f.status === 'success');\n const updatedFiles = files.filter(f => f.status === 'updated');\n const skippedFiles = files.filter(f => f.status === 'skipped');\n const failedFiles = files.filter(f => f.status === 'failed');\n // Calculate counts\n const successCount = successFiles.length;\n const updatedCount = updatedFiles.length;\n const skippedCount = skippedFiles.length;\n const failedCount = failedFiles.length;\n const totalCount = files.length;\n return (_jsxs(\"div\", { className: `flex flex-col py-2 ${className}`, children: [_jsxs(\"div\", { className: \"flex items-center mb-4\", children: [_jsx(\"div\", { className: \"size-8 mr-4 rounded-full bg-success/10 flex items-center justify-center\", children: _jsx(CheckCircleIcon, { className: \"size-4 text-success\" }) }), _jsx(\"div\", { children: _jsxs(\"p\", { className: \"text-muted\", children: [totalCount, \" file\", totalCount !== 1 ? \"s\" : \"\", \" processed\", collection ? ` in collection '${collection}'` : \"\", location ? ` in folder '${location}'` : \"\"] }) })] }), _jsxs(\"div\", { className: \"space-y-3 mt-2\", children: [successCount > 0 && (_jsx(UploadResultCategory, { title: \"Successfully Uploaded\", count: successCount, icon: _jsx(CheckCircleIcon, { className: \"h-4 w-4 text-green-500\" }), items: successFiles.map(f => f.name) })), updatedCount > 0 && (_jsx(UploadResultCategory, { title: \"Successfully Updated\", count: updatedCount, icon: _jsx(CheckCircleIcon, { className: \"h-4 w-4 text-blue-500\" }), items: updatedFiles.map(f => f.name) })), skippedCount > 0 && (_jsx(UploadResultCategory, { title: \"Skipped (Already Existed)\", count: skippedCount, icon: _jsx(AlertCircleIcon, { className: \"h-4 w-4 text-amber-500\" }), items: skippedFiles.map(f => f.name) })), failedCount > 0 && (_jsx(UploadResultCategory, { title: \"Failed to Upload\", count: failedCount, icon: _jsx(XCircleIcon, { className: \"h-4 w-4 text-red-500\" }), items: failedFiles.map(f => f.name) }))] })] }));\n}\n//# sourceMappingURL=UploadSummary.js.map","export const ATTRIBUTE_GROUP_KEY = ':@';\nexport const ATTRIBUTE_TEXT = '#text';\nexport const ATTRIBUTE_COMMENT = '#comment';\nexport const ATTRIBUTE_CDATA = '#cdata';\nexport const DECLARATION_TAG = 'DECLARATION_TAG';\nexport const TAG = 'TAG';\nexport const defaultTheme = {\n tagColor: '#d43900',\n textColor: '#333',\n attributeKeyColor: '#2a7ab0',\n attributeValueColor: '#008000',\n separatorColor: '#333',\n commentColor: '#aaa',\n cdataColor: '#1d781d',\n fontFamily: 'monospace',\n};\nexport const darkTheme = {\n attributeKeyColor: '#FFD700',\n attributeValueColor: '#FF4500',\n tagColor: '#87CEFA',\n textColor: '#00FF00',\n separatorColor: '#FFD700',\n commentColor: '#BEBEBE',\n cdataColor: '#33CC66',\n fontFamily: 'monospace',\n};\n//# sourceMappingURL=index.js.map","import { createContext, useContext } from 'react';\nimport { defaultTheme } from '../constants';\nconst defaultState = {\n theme: defaultTheme,\n collapsible: false,\n indentSize: 2,\n};\nexport const XMLViewerContext = createContext(defaultState);\nexport const useXMLViewerContext = () => useContext(XMLViewerContext);\n//# sourceMappingURL=xml-viewer-context.js.map","import { XMLParser, XMLValidator } from 'fast-xml-parser';\nimport { useMemo } from 'react';\nimport { ATTRIBUTE_CDATA, ATTRIBUTE_COMMENT } from '../constants';\nconst parser = new XMLParser({\n preserveOrder: true,\n ignoreAttributes: false,\n attributeNamePrefix: '',\n allowBooleanAttributes: true,\n commentPropName: ATTRIBUTE_COMMENT,\n cdataPropName: ATTRIBUTE_CDATA,\n parseTagValue: false,\n});\nexport default function useXMLViewer(xml) {\n return useMemo(() => {\n try {\n if (!XMLValidator.validate(xml)) {\n throw new Error('Invalid XML!');\n }\n const json = parser.parse(xml);\n if (typeof xml === 'string' && xml.trim().length > 0 && json.length === 0) {\n throw new Error('Invalid XML!');\n }\n return { json, valid: true };\n }\n catch (e) {\n const error = e;\n return { json: null, valid: false, errorMessage: `Fail to parse: ${error.message}` };\n }\n }, [xml]);\n}\n//# sourceMappingURL=useXMLViewer.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { useXMLViewerContext } from '../../context/xml-viewer-context';\nexport function CDataTag(props) {\n const { indentation, children, isInline } = props;\n const { theme } = useXMLViewerContext();\n return (_jsxs(\"div\", { style: { color: theme.cdataColor }, children: [_jsx(\"span\", { children: `${indentation}<![CDATA[` }), children, _jsx(\"span\", { children: `${isInline ? '' : indentation}]]>` })] }));\n}\n//# sourceMappingURL=index.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { useXMLViewerContext } from '../../context/xml-viewer-context';\nexport function CollapseIcon(props) {\n const { collapsible, theme } = useXMLViewerContext();\n const { collapsed } = props;\n return collapsible ? (_jsx(\"span\", { style: { position: 'relative' }, children: _jsx(\"span\", { style: { position: 'absolute', right: '0', border: 0, padding: 0, background: 'none' }, children: _jsx(Caret, { fill: theme.separatorColor, style: { transform: `rotate(${collapsed ? 0 : 90}deg)`, transition: 'transform 0.2s' } }) }) })) : null;\n}\nfunction Caret({ ...attrs }) {\n return (_jsx(\"svg\", { width: \"16px\", height: \"16px\", viewBox: \"0 0 24 24\", ...attrs, children: _jsx(\"path\", { d: \"M9 17.898C9 18.972 10.2649 19.546 11.0731 18.8388L17.3838 13.3169C18.1806 12.6197 18.1806 11.3801 17.3838 10.6829L11.0731 5.16108C10.2649 4.45388 9 5.02785 9 6.1018V17.898Z\" }) }));\n}\n//# sourceMappingURL=index.js.map","import { isNil } from 'lodash-es';\nimport { useEffect, useState } from 'react';\nimport { useXMLViewerContext } from '../context/xml-viewer-context';\nexport function useCollapsible(level) {\n const { collapsible, initialCollapsedDepth } = useXMLViewerContext();\n const [collapsed, setCollapsed] = useState(() => isNil(initialCollapsedDepth) || !collapsible ? false : level >= initialCollapsedDepth);\n const toggleCollapsed = () => setCollapsed((currentCollapsed) => !currentCollapsed);\n useEffect(() => {\n setCollapsed(isNil(initialCollapsedDepth) || !collapsible ? false : level >= initialCollapsedDepth);\n }, [initialCollapsedDepth, level, collapsible]);\n return {\n collapsed,\n buttonProps: !collapsible\n ? {}\n : {\n onClick: toggleCollapsed,\n role: 'button',\n style: { cursor: 'pointer' },\n },\n };\n}\n//# sourceMappingURL=useCollapsible.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { CollapseIcon } from '../../components/CollapseIcon';\nimport { useXMLViewerContext } from '../../context/xml-viewer-context';\nimport { useCollapsible } from '../../hooks/useCollapsible';\nexport function CommentTag(props) {\n const { indentation, children, isInline, level } = props;\n const { theme } = useXMLViewerContext();\n const { collapsed, buttonProps } = useCollapsible(level);\n return (_jsxs(\"div\", { style: { color: theme.commentColor }, children: [_jsxs(\"span\", { ...buttonProps, children: [_jsx(\"span\", { children: indentation }), _jsx(CollapseIcon, { collapsed: collapsed }), _jsx(\"span\", { children: '<!-- ' })] }), !collapsed && children, collapsed && '...', _jsx(\"span\", { children: `${isInline || collapsed ? ' ' : indentation}-->` })] }));\n}\n//# sourceMappingURL=index.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { useXMLViewerContext } from '../../context/xml-viewer-context';\nexport function Attributes(props) {\n const { attributes } = props;\n const { theme } = useXMLViewerContext();\n if (!attributes) {\n return null;\n }\n return (_jsx(\"span\", { children: Object.entries(attributes).map(([key, value]) => (_jsxs(\"span\", { children: [_jsx(\"span\", { style: { color: theme.attributeKeyColor }, children: ` ${key}` }), _jsx(\"span\", { style: { color: theme.separatorColor }, children: \"=\" }), _jsx(\"span\", { style: { color: theme.attributeValueColor }, children: `\"${value}\"` })] }, `attribute-${key}`))) }));\n}\n//# sourceMappingURL=index.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { Attributes } from '../../components/Attributes';\nimport { useXMLViewerContext } from '../../context/xml-viewer-context';\nexport function DeclarationTag(props) {\n const { indentation, tagKey, attributes } = props;\n const { theme } = useXMLViewerContext();\n return (_jsxs(\"div\", { children: [_jsx(\"span\", { style: { color: theme.separatorColor }, children: `${indentation}<?` }), _jsx(\"span\", { style: { color: theme.tagColor }, children: `${tagKey.slice(1)}` }), _jsx(Attributes, { attributes: attributes }), _jsx(\"span\", { style: { color: theme.separatorColor }, children: '?>' })] }));\n}\n//# sourceMappingURL=index.js.map","import { omit } from 'lodash-es';\nimport { ATTRIBUTE_CDATA, ATTRIBUTE_COMMENT, ATTRIBUTE_GROUP_KEY, ATTRIBUTE_TEXT, DECLARATION_TAG, TAG, } from '../constants';\nexport function getIndentationString(size, level) {\n return new Array(level * size + 1).join(' ');\n}\nexport function hasBreakLines(elements) {\n return typeof elements === 'string' && elements.includes('\\n');\n}\nexport function isInlineTextElement(elements) {\n if (typeof elements === 'string') {\n return false;\n }\n return (elements.length === 1 &&\n ATTRIBUTE_TEXT in elements[0] &&\n !hasBreakLines(elements[0][ATTRIBUTE_TEXT]));\n}\nexport function getTagType(tagKey) {\n switch (tagKey) {\n case ATTRIBUTE_TEXT:\n case ATTRIBUTE_CDATA:\n case ATTRIBUTE_COMMENT:\n return tagKey;\n default:\n return tagKey.startsWith('?') ? DECLARATION_TAG : TAG;\n }\n}\nexport function getTagProps(element) {\n const attributes = element[ATTRIBUTE_GROUP_KEY];\n const elementWithoutAttributes = omit(element, ATTRIBUTE_GROUP_KEY);\n const [[tagKey, subElements]] = Object.entries(elementWithoutAttributes);\n const type = getTagType(tagKey);\n return { attributes, tagKey, subElements, type };\n}\nexport function hasAttributes(attributes) {\n if (!attributes) {\n return false;\n }\n return Object.keys(attributes).length > 0;\n}\n//# sourceMappingURL=index.js.map","import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from \"react/jsx-runtime\";\nimport { Attributes } from '../../components/Attributes';\nimport { CollapseIcon } from '../../components/CollapseIcon';\nimport { useXMLViewerContext } from '../../context/xml-viewer-context';\nimport { hasAttributes } from '../../helpers';\nimport { useCollapsible } from '../../hooks/useCollapsible';\nexport function Tag(props) {\n const { indentation, tagKey, attributes, children, isInline, hasChildren, level } = props;\n const { collapsed, buttonProps } = useCollapsible(level);\n const { theme } = useXMLViewerContext();\n return (_jsxs(\"div\", { children: [_jsxs(\"span\", { ...buttonProps, children: [_jsx(\"span\", { children: indentation }), _jsx(CollapseIcon, { collapsed: collapsed }), _jsx(\"span\", { style: { color: theme.separatorColor }, children: '<' }), _jsx(\"span\", { style: { color: theme.tagColor }, children: `${tagKey}` }), !collapsed && _jsx(Attributes, { attributes: attributes }), collapsed && hasAttributes(attributes) && ' ...', _jsx(\"span\", { style: { color: theme.separatorColor }, children: !hasChildren ? ' />' : '>' })] }), hasChildren && (_jsxs(_Fragment, { children: [!collapsed && children, collapsed && '...', _jsx(\"span\", { style: { color: theme.separatorColor }, children: `${isInline || collapsed ? '' : indentation}</` }), _jsx(\"span\", { style: { color: theme.tagColor }, children: `${tagKey}` }), _jsx(\"span\", { style: { color: theme.separatorColor }, children: '>' })] }))] }));\n}\n//# sourceMappingURL=index.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { useXMLViewerContext } from '../../context/xml-viewer-context';\nimport { hasBreakLines } from '../../helpers';\nexport function TextElement(props) {\n const { hasSiblings, text, indentation, isText } = props;\n const { theme } = useXMLViewerContext();\n const style = isText ? { color: theme.textColor } : undefined;\n return hasBreakLines(text) || hasSiblings ? (_jsx(\"div\", { style: style, children: text\n .split('\\n')\n .filter((element) => !!element.trim())\n .map((line, index) => (_jsx(\"div\", { children: `${indentation}${line.trim()}` }, `${index}`))) })) : (_jsx(\"span\", { style: style, children: text }));\n}\n//# sourceMappingURL=index.js.map","import { jsx as _jsx, Fragment as _Fragment } from \"react/jsx-runtime\";\nimport { CDataTag } from '../../components/CDataTag';\nimport { CommentTag } from '../../components/CommentTag';\nimport { DeclarationTag } from '../../components/DeclarationTag';\nimport { Tag } from '../../components/Tag';\nimport { TextElement } from '../../components/TextElement';\nimport { ATTRIBUTE_CDATA, ATTRIBUTE_COMMENT, ATTRIBUTE_TEXT, DECLARATION_TAG } from '../../constants';\nimport { useXMLViewerContext } from '../../context/xml-viewer-context';\nimport { getIndentationString, getTagProps, isInlineTextElement } from '../../helpers';\nexport function Elements(props) {\n const { elements, level = 0, isText = true } = props;\n const { indentSize } = useXMLViewerContext();\n if (!Array.isArray(elements) || elements.length === 0) {\n return null;\n }\n return (_jsx(_Fragment, { children: elements.map((element, index) => {\n const { tagKey, attributes, subElements, type } = getTagProps(element);\n const hasSiblings = elements.length > 1;\n const indentation = getIndentationString(indentSize, level);\n const key = `${level}-${index}`;\n const isInline = isInlineTextElement(subElements);\n switch (type) {\n case ATTRIBUTE_TEXT:\n return (_jsx(TextElement, { text: subElements, indentation: indentation, hasSiblings: hasSiblings, isText: isText }, key));\n case ATTRIBUTE_COMMENT:\n return (_jsx(CommentTag, { isInline: isInline, indentation: indentation, level: level, children: _jsx(Elements, { elements: subElements, level: level + 1, isText: false }) }, key));\n case ATTRIBUTE_CDATA:\n return (_jsx(CDataTag, { indentation: indentation, isInline: isInline, children: _jsx(Elements, { elements: subElements, level: level + 1, isText: false }) }, key));\n case DECLARATION_TAG:\n return (_jsx(DeclarationTag, { indentation: indentation, tagKey: tagKey, attributes: attributes }, key));\n default:\n return (_jsx(Tag, { indentation: indentation, tagKey: tagKey, attributes: attributes, isInline: isInline, hasChildren: subElements.length > 0, level: level, children: _jsx(Elements, { elements: subElements, level: level + 1 }) }, key));\n }\n }) }));\n}\n//# sourceMappingURL=index.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nexport function InvalidXml() {\n return _jsx(\"div\", { children: \"Invalid XML!\" });\n}\n//# sourceMappingURL=index.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { useEffect, useMemo, useState } from 'react';\nimport { darkTheme, defaultTheme } from '../constants';\nimport { XMLViewerContext } from '../context/xml-viewer-context';\nimport useXMLViewer from '../hooks/useXMLViewer';\nimport { Elements } from './Elements';\nimport { InvalidXml } from './InvalidXml';\nexport function XMLViewer(props) {\n const { theme: customTheme, xml, collapsible = false, indentSize = 2, invalidXml, initalCollapsedDepth, initialCollapsedDepth, } = props;\n // Detect dark mode from document root class (set by ThemeProvider)\n const [isDarkMode, setIsDarkMode] = useState(() => {\n return document.documentElement.classList.contains('dark');\n });\n useEffect(() => {\n const root = document.documentElement;\n const observer = new MutationObserver(() => {\n setIsDarkMode(root.classList.contains('dark'));\n });\n observer.observe(root, { attributes: true, attributeFilter: ['class'] });\n return () => observer.disconnect();\n }, []);\n // Compute theme based on dark mode, then apply custom overrides\n const theme = useMemo(() => {\n const baseTheme = isDarkMode ? darkTheme : defaultTheme;\n return { ...baseTheme, ...customTheme };\n }, [isDarkMode, customTheme]);\n const { json, valid } = useXMLViewer(xml);\n const context = useMemo(() => ({\n theme,\n collapsible,\n indentSize,\n initialCollapsedDepth: initialCollapsedDepth ?? initalCollapsedDepth,\n }), [theme, collapsible, indentSize, initalCollapsedDepth, initialCollapsedDepth]);\n if (!valid) {\n return invalidXml ? invalidXml : _jsx(InvalidXml, {});\n }\n return (_jsx(XMLViewerContext.Provider, { value: context, children: _jsx(\"div\", { className: \"rxv-container\", style: { whiteSpace: 'pre-wrap', fontFamily: theme.fontFamily, overflowWrap: 'break-word' }, children: _jsx(Elements, { elements: json }) }) }));\n}\n//# sourceMappingURL=XMLViewer.js.map"],"names":["VEditorApi","VgetValue","VsetValue","constructor","this","getValue","setValue","value","MonacoEditor","onChange","className","editorRef","language","debounceTimeout","options","beforeMount","onMount","defaultValue","editorValue","setEditorValue","useState","editorInstanceRef","useRef","theme","useTheme","getValueRef","setValueRef","newValue","current","useEffect","undefined","debouncedOnChange","useMemo","debounce","update","handleEditorChange","useCallback","actualValue","docChanged","state","doc","toString","length","handleEditorDidMount","editor","monacoInstance","defineTheme","base","inherit","rules","colors","setTheme","effectiveValue","defaultOptions","fontSize","fontFamily","minimap","enabled","scrollBeyondLastLine","wordWrap","lineNumbers","folding","lineDecorationsWidth","lineNumbersMinChars","automaticLayout","formatOnPaste","formatOnType","tabSize","insertSpaces","glyphMargin","renderValidationDecorations","renderLineHighlight","hover","delay","quickSuggestions","other","comments","strings","_jsx","clsx","children","Editor","height","FieldSetContext","createContext","FieldSetContextProvider","Provider","useFieldSet","ctx","useContext","Error","FormContext","object","components","disabled","_FormContext","useForm","FormContextProvider","Input","React","forwardRef","type","props","ref","String","booleanValue","setBooleanValue","schema","isBoolean","Styles","INPUT","_onChange","ev","target","checked","Form","onSubmit","observer","evt","stopPropagation","preventDefault","GeneratedFormFields","properties","map","renderProperty","GeneratedForm","_jsxs","prop","isList","ListField","name","isObject","CompositeField","ScalarField","inline","Component","inputType","getInputType","handleOnChange","event","isNumber","parseFloat","isListItem","FormItem","label","title","required","isRequired","description","items","item","index","ListItem","list","onDelete","remove","deleteItem","Button","variant","onClick","add","Plus","arraySchema","Trash2","Schema","_validator","load","validator","ajv","Ajv","allErrors","strict","addFormats","compile","Object","keys","forEach","loadProperty","hasProperties","propertySchema","property","ArrayPropertySchema","PropertySchema","validate","errors","addProperty","typeOrSchema","removeProperty","Array","isArray","filter","x","getProperty","parent","super","isMulti","isReadOnly","readOnly","default","enum","values","includes","concat","isString","getArrayElementType","computeTitleFromName","replace","toUpperCase","slice","_name","format","Node","isRoot","root","path","isScalar","node","ManagedObjectBase","ManagedListProperty","getOrInitArrayProperty","ManagedObjectProperty","getOrInitObjectProperty","ManagedProperty","setPropertyValue","getPropertyValue","out","push","Symbol","iterator","ManagedObject","_v","newItem","ManageObjectEntry","ManagedScalarEntry","splice","i","l","trim","pop","key","Date","now","FormLabel","FormHelper","FormError","JSONCode","data","jsonString","JSON","stringify","error","console","domReadOnly","JSONView","entries","PropertyElement","PropertyTitle","BlockElement","info","getValueInfo","ValueType","Inline","Paragraph","Prose","ArrayProperty","inlineLength","join","itemMediumLength","isInline","useBullet","DotBadge","ItemProperty","bullet","content","len","JSONDisplay","viewCode","CodeBlockRendererRegistry","registerComponent","component","getComponent","Context","CodeBlockRendererProvider","registry","_Fragment","useCodeBlockRendererRegistry","useCodeBlockComponent","ArtifactUrlCacheContext","useArtifactUrlCache","getArtifactCacheKey","runId","disposition","getFileCacheKey","parseUrlScheme","rawUrl","startsWith","scheme","mapSchemeToRoute","useResolvedUrl","artifactRunId","client","useUserSession","urlCache","clientRef","urlCacheRef","mappedRoute","setState","url","isLoading","cacheKey","cached","getUrl","retryCount","setRetryCount","fetchUrl","async","prev","currentClient","currentUrlCache","getOrFetch","files","getArtifactDownloadUrl","getDownloadUrl","err","errorMessage","message","cancelled","doFetch","retry","c","TYPE_CONFIG","chart","icon","BarChart3","defaultHeight","mermaid","GitBranch","proposal","MessageSquare","code","Code","image","Image","link","Link","expand","Download","table","Table","markdown","FileText","CodeBlockPlaceholder","onRetry","config","displayHeight","style","minHeight","IconComponent","_","animationDelay","CodeBlockErrorBoundary","hasError","getDerivedStateFromError","componentDidCatch","errorInfo","onError","handleRetry","render","fallbackCode","MarkdownLink","href","ExistingLink","rest","rawHref","rel","ResolvedLink","MarkdownImage","src","alt","ExistingImg","rawSrc","ResolvedImage","MarkdownFigure","caption","ResolvedFigure","CALLOUT_TYPES","note","tip","warning","important","caution","CALLOUT_LABELS","remarkDirectiveHandler","tree","visit","d","attrs","attributes","hName","hProperties","width","titleNode","unshift","fromEntries","k","class","CUSTOM_SCHEME_PREFIXES","CUSTOM_LINK_REGEX","INLINE_CODE_REGEX","FENCED_CODE_BLOCK_REGEX","LINK_TITLE_SUFFIX_REGEX","hasCustomScheme","destination","some","prefix","normalizeCustomLinksInText","text","_fullMatch","open","close","destinationWithOptionalTitle","trimmed","closeIdx","indexOf","titleMatch","match","titleStart","wrapCustomDestination","normalizeOutsideInlineCode","result","lastIndex","exec","SINGLE_LINE_DIRECTIVE","cn","inputs","twMerge","VegaErrorDisplay","chartTitle","FullscreenDialog","isOpen","onClose","DialogPrimitive","Root","onOpenChange","Portal","Overlay","Content","onEscapeKeyDown","Close","asChild","X","Title","Description","CHART_COLORS","categorical","blues","purples","diverging","viewHasField","view","fields","encoding","field","channel","layer","viewHasColorEncoding","checkEncoding","colorField","color","findArtifactReferences","spec","currentPath","references","artifactPath","nestedKeys","VegaLiteChart","memo","vegaSpec","isExporting","setIsExporting","isCopied","setIsCopied","setError","isFullscreen","setIsFullscreen","viewRef","fullscreenViewRef","containerRef","resolvedSpec","setResolvedSpec","isLoadingArtifacts","setIsLoadingArtifacts","artifactError","setArtifactError","mode","isDashboard","showFullscreenButton","enableFullscreen","baseHeight","rowCount","vconcat","columns","Math","ceil","facet","max","calculateAutoHeight","resolvedData","Map","pathKey","response","fetch","ok","statusText","toLowerCase","endsWith","csvText","Papa","parse","header","skipEmptyLines","dynamicTyping","jsonData","json","set","newSpec","split","lastKey","replaceArtifactData","resolveArtifacts","isDarkMode","setIsDarkMode","isDarkModeRef","checkDarkMode","newDarkMode","document","documentElement","classList","contains","MutationObserver","observe","attributeFilter","disconnect","containerWidth","setContainerWidth","containerWidthRef","resizeTimeout","resizeObserver","ResizeObserver","clearTimeout","setTimeout","contentRect","initialWidth","clientWidth","hasArtifactReferences","processedSpec","specToUse","parameterValues","updateParams","params","param","updateNestedViews","views","hconcat","applyParameterValues","concatKeys","rootSelectionParams","select","paramName","selectFields","hasLegendBinding","bind","concatArray","targetViewIndex","targetView","p","fixVegaLiteSelectionParams","scaleSpecWidths","availableWidth","childCount","totalSpacing","spacing","widthPerChild","floor","child","currentWidth","buildFullSpec","forFullscreen","isDark","baseConfig","background","stroke","range","category","heatmap","ramp","mark","tooltip","bar","cornerRadiusTopLeft","cornerRadiusTopRight","line","strokeWidth","strokeCap","point","size","filled","area","fillOpacity","rect","cornerRadius","arc","circle","axis","labelColor","titleColor","gridColor","domainColor","tickColor","labelFont","titleFont","labelFontSize","titleFontSize","titleFontWeight","legend","symbolSize","font","fontWeight","getDarkModeConfig","calculatedWidth","window","min","innerWidth","isConcatenatedView","autosize","scaledSpec","specWidth","_specWidth","specWithoutWidth","$schema","handleCopy","toCanvas","toBlob","blob","navigator","clipboard","write","ClipboardItem","handleExport","toImageURL","createElement","download","click","handleNewView","handleFullscreenNewView","handleError","toggleFullscreen","Toolbar","Check","Copy","Minimize2","Maximize2","Loader2","chartSpec","fullscreenSpec","localStorage","getItem","log","hasData","dataLength","minWidth","VegaEmbed","onEmbed","renderer","actions","prevProps","nextProps","MERMAID_FONT_FAMILY","MermaidDiagram","svg","setSvg","uniqueId","useId","id","normalizedCode","normalized","inDoubleQuote","inSingleQuote","char","j","normalizeMermaidCodeForBrowser","renderedSvg","responsiveSvg","_full","nextAttrs","test","_styleFull","styleValue","makeSvgResponsive","renderDiagram","dangerouslySetInnerHTML","__html","initialize","startOnLoad","securityLevel","suppressErrorRendering","flowchart","htmlLabels","useMaxWidth","nodeSpacing","rankSpacing","padding","sequence","themeVariables","VARIANT_STYLES","border","bg","success","VARIANT_ICONS","HelpCircle","AlertCircle","CheckCircle","AskUserWidget","question","onSelect","onMultiSelect","allowFreeResponse","multiSelect","placeholder","hideIcon","hideBorder","cardClassName","headerClassName","iconClassName","questionClassName","descriptionClassName","optionsClassName","buttonClassName","inputContainerClassName","inputClassName","submitButtonClassName","inputValue","setInputValue","selectedOptions","setSelectedOptions","Set","inputRef","styles","DefaultIcon","handleSubmit","borderClass","MarkdownRenderer","option","has","toggleOption","optionId","next","delete","from","Send","e","onKeyDown","shiftKey","useArtifactContent","parseJson","rawContent","contentType","fetchContent","ext","detectContentType","signedUrl","status","toVegaLiteSpec","obj","library","TableRenderer","headers","rows","first","row","h","val","cell","CodeRenderer","sanitizeSvg","DOMPurify","sanitize","USE_PROFILES","svgFilters","ADD_TAGS","FORBID_TAGS","a","w","v","MockupRenderer","processedSvg","raw","margin","overflowX","ImageRenderer","loading","ArtifactContentRenderer","renderType","actualType","autoDetectRenderType","fragmentContent","hasTemplate","template","hasVegaLiteChart","FusionFragmentProvider","ChartComponent","FusionFragmentHandler","markdownContent","CodeBlockContext","CodeBlockHandlerProvider","onProposalSelect","onProposalSubmit","useCodeBlockContext","isIncompleteJson","incompleteIndicators","lowerMessage","ind","braceCount","bracketCount","inString","escaped","parseChartJson","jsonStart","jsonEnd","lastIndexOf","VegaLiteCodeBlockHandler","incomplete","ChartCodeBlockHandler","hasVegaSchema","isExplicitVegaLite","detectChartLibrary","MermaidCodeBlockHandler","trimmedCode","ProposalCodeBlockHandler","widgetProps","opt","multiple","MockupCodeBlockHandler","ExpandCodeBlockHandler","isExpandLanguage","createDefaultCodeBlockHandlers","vegalite","mockup","askuser","ALLOWED_CUSTOM_SCHEMES","customUrlTransform","defaultUrlTransform","remarkRemoveComments","SKIP","defaultCodeBlockHandlers","remarkPlugins","removeComments","codeClassName","inlineCodeClassName","linkClassName","imageClassName","codeBlockRegistry","normalizedMarkdown","normalizeDirectives","normalizeCustomSchemeLinks","_match","indent","remarkPluginsArray","remarkGfm","remarkDirective","remarkAlert","remarkDefinitionList","remarkSupersub","remarkMath","rehypePluginsArray","rehypeKatex","remarkRehypeOptions","handlers","defListHastHandlers","componentsWithOverrides","baseComponents","ExistingCode","img","codeClassName_","codeChildren","CustomComponent","DefaultHandler","linkChildren","Markdown","rehypePlugins","urlTransform","PopoverContext","usePopoverContext","__SLOT_NAME","processSlots","slots","Children","slotName","isValidElement","processOneSlot","defineSlot","computeElementProps","Popover","triggerProps","trigger","contentProps","ResolvedPopover","middleware","offset","defaultOffset","dismiss","placement","strategy","zIndex","setIsOpen","floating","useFloating","shift","flip","whileElementsMounted","autoUpdate","floatingStyles","refs","setReference","setFloating","context","dismissInteraction","useDismiss","clickInteraction","useClick","hoverInteraction","useHover","handleClose","safePolygon","blockPointerEvents","restMs","getHoverProps","getReferenceProps","getFloatingProps","useInteractions","isMounted","transitionStyles","useTransitionStyles","transition","FloatingPortal","FloatingFocusManager","PopoverTrigger","_props","PopoverContent","Progress","percent","PropertiesView","VTooltip","Info","TypeNames","setPropertyType","typeObj","isNullable","getTypeSignature","typeName","t","getFirstNotNullType","getItemTypeName","displayTypeName","find","Trigger","new_prop_name_cnt","ManagedSchema","source","SchemaNode","loadChildren","isEmpty","reload","withSource","uri","withChangeListener","cb","replaceSchema","clone","loader","_getPropertiesSchema","isParent","isNew","resetIsNew","getNameSignature","getSignature","reloadTree","_loadChildren","childSchema","findAvailableChildName","addChild","newSchema","addRequired","updated","newName","newProperties","setPropertyName","setRequireProperty","typeChanged","getUpdateFromNameAndTypeSignature","nameSig","typeSig","substring","parseTypeSignature","string","any","updateFromNameAndTypeSignature","updateFromSignature","getEditableSchemaProperty","TYPE_OPTIONS","types","sort","makeTypeOptions","PropertyEditor","onCancel","onSave","isModalOpen","setModalOpen","PropertyNameEditor","PropertyTypeEditor","AlignLeft","EditDescriptionModal","focus","onKeyUp","INPUT_UNSTYLED","display","SelectBox","onBlur","popupClass","Modal","ModalTitle","EditDescriptionModalForm","currentValue","setCurrentValue","ModalBody","ModalFooter","PropertyViewer","useSchema","jsonSchema","setSchema","VIEW_BOX","VIEW_BOX_HOVER","EDIT_BOX","Editable","outlineOnHover","editOnClick","viewer","skipClickOutside","isEditing","readonly","onValidate","on","off","isOn","useFlag","validationError","setValidationError","DataEdit","DataView","onEdit","Viewer","btnStyle","tabIndex","SquarePen","setActualValue","latestValue","debounceTimer","setDebounceTimer","handleSave","useClickOutside","autoSave","closest","SchemaEditor","AddPropertyButton","ParentItem","SimpleItem","PropertyTitleBar","setOpen","ChevronDown","ChevronRight","validatePropertyName","propertyName","toast","useToast","editableProp","duration","SvgIcon","svgEl","DOMParser","parseFromString","querySelector","warn","innerHTML","attrName","setAttribute","appendChild","createSvgIcon","DropZone","onDrop","buttonLabel","allowFolders","isDragging","setIsDragging","dropZoneRef","handleChange","fileArray","file","webkitRelativePath","folderCount","Boolean","fileCount","formattedMessage","customMessage","count","feedback","onDragOver","dataTransfer","onDragLeave","relatedTarget","folders","processEntry","entry","isFile","Promise","resolve","defineProperty","writable","fullPath","folderPath","isDirectory","reader","createReader","readEntries","all","webkitGetAsEntry","UploadIcon","fileInput","accept","onchange","folderInput","webkitdirectory","UploadResultCategory","CheckCircleIcon","isExpanded","setIsExpanded","fill","viewBox","strokeLinecap","strokeLinejoin","UploadSummary","location","collection","successFiles","f","updatedFiles","skippedFiles","failedFiles","successCount","updatedCount","skippedCount","failedCount","totalCount","AlertCircleIcon","XCircleIcon","ATTRIBUTE_TEXT","ATTRIBUTE_COMMENT","ATTRIBUTE_CDATA","DECLARATION_TAG","defaultTheme","tagColor","textColor","attributeKeyColor","attributeValueColor","separatorColor","commentColor","cdataColor","darkTheme","XMLViewerContext","collapsible","indentSize","useXMLViewerContext","parser","XMLParser","preserveOrder","ignoreAttributes","attributeNamePrefix","allowBooleanAttributes","commentPropName","cdataPropName","parseTagValue","CDataTag","indentation","CollapseIcon","collapsed","position","right","Caret","transform","useCollapsible","level","initialCollapsedDepth","setCollapsed","isNil","buttonProps","currentCollapsed","role","cursor","CommentTag","Attributes","DeclarationTag","tagKey","hasBreakLines","elements","getTagProps","element","elementWithoutAttributes","omit","subElements","getTagType","hasAttributes","Tag","hasChildren","TextElement","hasSiblings","isText","Elements","getIndentationString","isInlineTextElement","InvalidXml","XMLViewer","customTheme","xml","invalidXml","initalCollapsedDepth","valid","XMLValidator","useXMLViewer","whiteSpace","overflowWrap"],"m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T,QACAmoC,cACAC,aACAqB,sBAAuBA,GAAyBiC,IAChD,CAAC1rC,EAAOmoC,EAAaC,EAAYsD,EAAsBjC,IAC3D,OAAKkC,EAGGpoC,EAAK2kC,GAAiBnkC,SAAU,CAAE/E,MAAOs5B,EAAS70B,SAAUF,EAAK,MAAO,CAAEpE,UAAW,gBAAiByV,MAAO,CAAEk3B,WAAY,WAAY9pC,WAAYhC,EAAMgC,WAAY+pC,aAAc,cAAgBtoC,SAAUF,EAAK2nC,GAAU,CAAEb,SAAUjrB,QAFrOqsB,GAA0BloC,EAAK8nC,GAAY,CAAA,EAG1D"}
1
+ {"version":3,"file":"vertesia-ui-widgets.js","sources":["esm/widgets/monacoEditor/MonacoEditor.js","esm/widgets/form/FormContext.js","esm/widgets/form/inputs.js","esm/widgets/form/Form.js","esm/widgets/form/schema.js","esm/widgets/form/ManagedObject.js","esm/widgets/form/fields.js","esm/widgets/json-view/JSONCode.js","esm/widgets/json-view/JSONView.js","esm/widgets/json-view/JSONDisplay.js","esm/widgets/json-view/JSONSwitcher.js","esm/core/components/libs/utils.js","esm/i18n/instance.js","esm/i18n/index.js","esm/features/agent/chat/useArtifactUrlCache.js","esm/features/agent/chat/VegaLiteChart.js","esm/widgets/markdown/CodeBlockContext.js","esm/widgets/markdown/CodeBlockPlaceholder.js","esm/widgets/markdown/ArtifactContentRenderer.js","esm/features/agent/chat/AskUserWidget.js","esm/widgets/markdown/MermaidDiagram.js","esm/widgets/markdown/useArtifactContent.js","esm/widgets/markdown/codeBlockHandlers.js","esm/widgets/markdown/CodeBlockRendering.js","esm/widgets/markdown/useResolvedUrl.js","esm/widgets/markdown/MarkdownFigure.js","esm/widgets/markdown/MarkdownImage.js","esm/widgets/markdown/MarkdownLink.js","esm/widgets/markdown/normalizeCustomSchemeLinks.js","esm/widgets/markdown/normalizeDirectives.js","esm/widgets/markdown/remarkDirectiveHandler.js","esm/widgets/markdown/MarkdownRenderer.js","esm/widgets/Progress.js","esm/widgets/properties/PropertiesView.js","esm/widgets/schema-editor/type-signature.js","esm/widgets/schema-editor/json-schema4-utils.js","esm/widgets/schema-editor/ManagedSchema.js","esm/widgets/schema-editor/editor/EditableSchemaProperty.js","esm/widgets/schema-editor/editor/PropertyEditor.js","esm/widgets/schema-editor/editor/PropertyViewer.js","esm/widgets/schema-editor/editor/SchemaContext.js","esm/widgets/schema-editor/editor/Editable.js","esm/widgets/schema-editor/editor/SchemaEditor.js","esm/widgets/SvgIcon.js","esm/widgets/upload/DropZone.js","esm/widgets/upload/UploadResultCategory.js","esm/widgets/upload/UploadSummary.js","esm/widgets/xml-viewer/constants/index.js","esm/widgets/xml-viewer/context/xml-viewer-context.js","esm/widgets/xml-viewer/hooks/useXMLViewer.js","esm/widgets/xml-viewer/components/CDataTag/index.js","esm/widgets/xml-viewer/components/CollapseIcon/index.js","esm/widgets/xml-viewer/hooks/useCollapsible.js","esm/widgets/xml-viewer/components/CommentTag/index.js","esm/widgets/xml-viewer/components/Attributes/index.js","esm/widgets/xml-viewer/components/DeclarationTag/index.js","esm/widgets/xml-viewer/helpers/index.js","esm/widgets/xml-viewer/components/Tag/index.js","esm/widgets/xml-viewer/components/TextElement/index.js","esm/widgets/xml-viewer/components/Elements/index.js","esm/widgets/xml-viewer/components/InvalidXml/index.js","esm/widgets/xml-viewer/components/XMLViewer.js"],"sourcesContent":["import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { Editor } from '@monaco-editor/react';\nimport { useTheme } from '@vertesia/ui/core';\nimport debounce from 'debounce';\nimport clsx from 'clsx';\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nexport class VEditorApi {\n VgetValue;\n VsetValue;\n constructor(VgetValue, VsetValue) {\n this.VgetValue = VgetValue;\n this.VsetValue = VsetValue;\n }\n getValue() {\n return this.VgetValue();\n }\n setValue(value) {\n this.VsetValue(value || '');\n }\n}\nexport function MonacoEditor({ onChange, value, className, editorRef, language = 'javascript', debounceTimeout = 0, options = {}, beforeMount, onMount, defaultValue, }) {\n const [editorValue, setEditorValue] = useState(value || defaultValue || '');\n const editorInstanceRef = useRef(null);\n const { theme } = useTheme();\n const getValueRef = useRef(() => editorValue);\n const setValueRef = useRef((newValue) => {\n setEditorValue(newValue);\n if (editorInstanceRef.current) {\n editorInstanceRef.current.setValue(newValue);\n }\n });\n useEffect(() => {\n getValueRef.current = () => editorValue;\n }, [editorValue]);\n useEffect(() => {\n if (editorRef) {\n editorRef.current = new VEditorApi(() => getValueRef.current(), (value) => setValueRef.current(value));\n }\n return () => {\n if (editorRef) {\n editorRef.current = undefined;\n }\n };\n }, [editorRef]);\n const debouncedOnChange = useMemo(() => {\n if (!onChange)\n return undefined;\n if (debounceTimeout > 0) {\n return debounce((update) => onChange(update), debounceTimeout);\n }\n else {\n return onChange;\n }\n }, [onChange, debounceTimeout]);\n const handleEditorChange = useCallback((newValue) => {\n const actualValue = newValue || '';\n setEditorValue(actualValue);\n if (debouncedOnChange) {\n const update = {\n docChanged: true,\n state: {\n doc: {\n toString: () => actualValue,\n length: actualValue.length\n }\n }\n };\n // Using type assertion through unknown to avoid complex type mocking\n debouncedOnChange(update);\n }\n }, [debouncedOnChange]);\n const handleEditorDidMount = useCallback((editor, monacoInstance) => {\n editorInstanceRef.current = editor;\n // Update the setValue ref to use the actual editor instance\n setValueRef.current = (newValue) => {\n setEditorValue(newValue);\n editor.setValue(newValue);\n };\n // Set up custom theme for better error line highlighting\n monacoInstance.editor.defineTheme('errorLineTheme', {\n base: theme === 'dark' ? 'vs-dark' : 'vs',\n inherit: true,\n rules: [],\n colors: {\n 'editorError.background': '#ffebee',\n 'editorError.border': '#f44336',\n },\n });\n monacoInstance.editor.setTheme('errorLineTheme');\n // Call custom onMount if provided\n onMount?.(editor, monacoInstance);\n }, [onMount, theme]);\n // Update editor value when prop changes from outside\n useEffect(() => {\n const effectiveValue = value || defaultValue || '';\n if (effectiveValue !== editorValue) {\n setEditorValue(effectiveValue);\n if (editorInstanceRef.current) {\n editorInstanceRef.current.setValue(effectiveValue);\n }\n }\n }, [value]); // Only depend on value prop, not editorValue\n const defaultOptions = {\n fontSize: 14,\n fontFamily: 'monospace',\n minimap: { enabled: false },\n scrollBeyondLastLine: false,\n wordWrap: 'on',\n lineNumbers: 'on',\n folding: false,\n lineDecorationsWidth: 10,\n lineNumbersMinChars: 3,\n automaticLayout: true,\n formatOnPaste: true,\n formatOnType: true,\n tabSize: 2,\n insertSpaces: true,\n glyphMargin: true, // Enable better error reporting\n renderValidationDecorations: 'on', // Show error squiggles\n renderLineHighlight: 'line', // Highlight entire line for errors\n hover: {\n enabled: true,\n delay: 100\n }, // Enable hover for error messages\n quickSuggestions: {\n other: true,\n comments: true,\n strings: true\n }, // Show problems panel information\n ...options\n };\n return (_jsx(\"div\", { className: clsx(className, 'w-full h-full!'), children: _jsx(Editor, { className: \"h-full w-full\", height: \"100%\", theme: theme === 'dark' ? 'vs-dark' : 'light', language: language, value: editorValue, onChange: handleEditorChange, onMount: handleEditorDidMount, beforeMount: beforeMount, options: defaultOptions, defaultValue: defaultValue || '' }) }));\n}\n//# sourceMappingURL=MonacoEditor.js.map","import { createContext, useContext } from \"react\";\nconst FieldSetContext = createContext(undefined);\nconst FieldSetContextProvider = FieldSetContext.Provider;\nexport function useFieldSet() {\n const ctx = useContext(FieldSetContext);\n if (!ctx) {\n throw new Error('useFieldSet must be used within a Form or FieldSet element');\n }\n return ctx;\n}\nexport class FormContext {\n object;\n components;\n disabled;\n constructor(object, components = {}, disabled = false) {\n this.object = object;\n this.components = components;\n this.disabled = disabled;\n }\n}\nconst _FormContext = createContext(undefined);\nexport function useForm() {\n const ctx = useContext(_FormContext);\n if (!ctx) {\n throw new Error('useForm must be used within a Form element');\n }\n return ctx;\n}\nconst FormContextProvider = _FormContext.Provider;\nexport { FieldSetContextProvider, FormContextProvider };\n//# sourceMappingURL=FormContext.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport clsx from \"clsx\";\nimport React, { useState } from \"react\";\nimport { Styles } from \"@vertesia/ui/core\";\nconst Input = React.forwardRef(({ object, type = 'text', onChange, ...props }, ref) => {\n const [actualValue, setValue] = useState(object.value != null ? String(object.value) : '');\n const [booleanValue, setBooleanValue] = useState(object.schema.isBoolean && object.value === true);\n if (props.className) {\n props.className = clsx(Styles.INPUT, props.className);\n }\n else {\n props.className = Styles.INPUT;\n }\n const _onChange = (ev) => {\n if (props.disabled)\n return;\n setValue(ev.target.value);\n if (object.schema.isBoolean) {\n object.value = ev.target.checked;\n setBooleanValue(object.value);\n }\n else {\n object.value = ev.target.value;\n }\n onChange && onChange(ev);\n };\n if (type === 'textarea') {\n return (_jsx(\"textarea\", { ref: ref, ...props, value: actualValue, onChange: _onChange }));\n }\n else if (type === 'checkbox') {\n return (_jsx(\"input\", { ref: ref, ...props, type: \"checkbox\", checked: booleanValue, onChange: _onChange, className: \"form-check-input\" }));\n }\n else {\n return (_jsx(\"input\", { ref: ref, ...props, type: type, value: actualValue, onChange: _onChange }));\n }\n});\nexport { Input };\n//# sourceMappingURL=inputs.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { Button, FormItem } from \"@vertesia/ui/core\";\nimport clsx from \"clsx\";\nimport { Plus, Trash2 } from \"lucide-react\";\nimport { useState } from \"react\";\nimport { FormContext, FormContextProvider, useForm } from \"./FormContext.js\";\nimport { Input } from \"./inputs.js\";\nexport function Form({ object, components, onSubmit, children, onChange, disabled }) {\n const _onSubmit = (evt) => {\n evt.stopPropagation();\n evt.preventDefault();\n onSubmit && onSubmit(object.value);\n };\n object.observer = onChange;\n return (_jsx(FormContextProvider, { value: new FormContext(object, components || {}, disabled ?? false), children: _jsx(\"form\", { className: \"w-full\", onSubmit: _onSubmit, children: children }) }));\n}\nfunction GeneratedFormFields() {\n const ctx = useForm();\n return (_jsx(\"div\", { className: 'flex flex-col gap-4 w-full', children: ctx.object.properties.map(renderProperty) }));\n}\nexport function GeneratedForm({ children, ...props }) {\n return (_jsxs(Form, { ...props, children: [_jsx(GeneratedFormFields, {}), children] }));\n}\nfunction renderProperty(prop) {\n if (prop.isList) {\n return _jsx(ListField, { object: prop }, prop.name);\n }\n else if (prop.isObject) {\n return _jsx(CompositeField, { object: prop }, prop.name);\n }\n else {\n return _jsx(ScalarField, { object: prop }, prop.name);\n }\n}\nfunction renderItemProperty(prop, editor) {\n if (prop.isList) {\n return _jsx(ListField, { object: prop });\n }\n else if (prop.isObject) {\n return _jsx(CompositeField, { object: prop });\n }\n else {\n return _jsx(ScalarField, { object: prop, editor: editor });\n }\n}\nexport function ScalarField({ object, editor, inline = false }) {\n if (!editor) {\n editor = object.schema.editor;\n }\n const { components, disabled } = useForm();\n const Component = (editor && components[editor]) || Input;\n const inputType = object.getInputType();\n if (inputType === 'checkbox') {\n inline = true;\n }\n const handleOnChange = (event) => {\n if (disabled)\n return;\n if (object.schema.isBoolean) {\n object.value = event.target.checked;\n }\n else if (object.schema.isNumber) {\n object.value = parseFloat(event.target.value);\n }\n else {\n object.value = event.target.value;\n }\n };\n if (object.isListItem) {\n // List items don't need the FormItem wrapper (no label, description, etc.)\n return _jsx(Component, { object: object, type: inputType, onChange: handleOnChange, disabled: disabled });\n }\n return (_jsx(FormItem, { label: object.title, required: object.schema.isRequired, description: object.schema.description, className: clsx('flex', inline ? 'flex-row items-center' : 'flex-col'), children: _jsx(Component, { object: object, type: inputType, onChange: handleOnChange, disabled: disabled }) }));\n}\nfunction CompositeField({ object }) {\n return (_jsxs(\"div\", { className: \"flex flex-col gap-4 my-4 py-2 pl-4 border-l-4 border-l-solid border-l-slate-100 dark:border-l-slate-600\", children: [!object.isListItem && _jsx(\"div\", { className: 'text-gray-900 dark:text-gray-200 font-semibold', children: object.title }), object.properties.map(renderProperty)] }));\n}\nfunction ListField({ object }) {\n const [value, setValue] = useState(object.value || []);\n const { disabled } = useForm();\n const addItem = () => {\n if (disabled)\n return;\n object.add();\n setValue([...object.value]);\n };\n const deleteItem = (index) => {\n if (disabled)\n return;\n object.remove(index);\n setValue([...object.value]);\n };\n return (_jsxs(\"div\", { className: \"flex flex-col gap-4 my-4 py-2 pl-4 border-l-4 border-l-solid border-l-slate-100 darK:border-l-slate-600\", children: [!object.isListItem && _jsx(\"div\", { className: 'text-gray-900 dark:text-gray-200 font-semibold', children: object.title }), object.items.map((item, index) => {\n return _jsx(ListItem, { object: item, list: object, onDelete: () => deleteItem(index), disabled: disabled }, `${index}-${value[index] ?? ''}`);\n }), _jsx(\"div\", { children: _jsxs(Button, { variant: 'secondary', onClick: addItem, disabled: disabled, children: [_jsx(Plus, { className: \"size-6\" }), \" Add\"] }) })] }));\n}\nfunction ListItem({ list, object, onDelete, disabled }) {\n return (_jsxs(\"div\", { className: 'flex gap-2 w-full', children: [_jsx(\"div\", { className: \"flex-1\", children: renderItemProperty(object, list.schema.arraySchema.editor) }), _jsx(Button, { variant: 'secondary', onClick: onDelete, disabled: disabled, children: _jsx(Trash2, { className: 'size-4' }) })] }));\n}\n//# sourceMappingURL=Form.js.map","import Ajv from \"ajv\";\nimport addFormats from \"ajv-formats\";\nfunction createSchemaFromType(type) {\n if (type === 'object') {\n return { type: 'object', properties: {} };\n }\n else if (type === 'array') {\n return { type: 'array', items: {} };\n }\n else {\n return { type };\n }\n}\nexport class Schema {\n schema;\n properties = {};\n _validator;\n constructor(schema) {\n this.schema = schema || { type: 'object', properties: {} };\n this.load();\n }\n get validator() {\n if (!this._validator) {\n const ajv = new Ajv({ allErrors: true, strict: false });\n addFormats(ajv);\n this._validator = ajv.compile(this.schema);\n }\n return this._validator;\n }\n load() {\n if (this.schema.properties) {\n const properties = this.schema.properties;\n Object.keys(properties).forEach(name => {\n this.loadProperty(name, properties[name]);\n });\n }\n }\n hasProperties() {\n return Object.keys(this.properties).length > 0;\n }\n get title() {\n return this.schema.title || this.schema.name;\n }\n get description() {\n return this.schema.description;\n }\n loadProperty(name, propertySchema) {\n let property;\n if (propertySchema.type === 'array') {\n property = new ArrayPropertySchema(this, name, propertySchema);\n }\n else {\n property = new PropertySchema(this, name, propertySchema);\n }\n this.properties[name] = property;\n return property;\n }\n get type() {\n return this.schema.type;\n }\n validate(value) {\n if (!this.validator(value)) {\n return this.validator.errors || [];\n }\n else {\n return null;\n }\n }\n addProperty(name, typeOrSchema, isRequired = false) {\n if (this.schema.type !== 'object') {\n this.schema.type = 'object';\n }\n if (!this.schema.properties) {\n this.schema.properties = {};\n }\n const propertySchema = typeof typeOrSchema === 'string' ? createSchemaFromType(typeOrSchema) : typeOrSchema;\n const property = this.loadProperty(name, propertySchema);\n this.schema.properties[property.name] = property.schema;\n if (isRequired) {\n property.isRequired = true;\n }\n return property;\n }\n removeProperty(name) {\n if (this.schema.properties) {\n delete this.schema.properties[name];\n if (Array.isArray(this.schema.required)) {\n this.schema.required = this.schema.required.filter(x => x !== name);\n }\n }\n delete this.properties[name];\n }\n getProperty(name) {\n return this.properties[name];\n }\n get editor() {\n return this.schema.editor;\n }\n}\nexport class PropertySchema extends Schema {\n parent;\n name;\n constructor(parent, name, schema) {\n super(schema);\n this.parent = parent;\n this.name = name;\n if (schema.type === 'array') {\n throw new Error(\"Array property must be instantiated using ArrayPropertySchema\");\n }\n if (schema.type === 'object' && !schema.properties) {\n schema.properties = {};\n }\n }\n get isMulti() {\n return false;\n }\n get isReadOnly() {\n return !!this.schema.readOnly;\n }\n set isReadOnly(value) {\n this.schema.readOnly = value;\n }\n get defaultValue() {\n return this.schema.default;\n }\n set defaultValue(value) {\n this.schema.default = value;\n }\n get enum() {\n return this.schema.enum;\n }\n set enum(values) {\n this.schema.enum = values;\n }\n get isRequired() {\n const required = this.parent.schema.required;\n return required ? required.includes(this.name) : false;\n }\n set isRequired(value) {\n let required = Array.isArray(this.parent.schema.required) ? this.parent.schema.required : [];\n if (value) {\n required = required.concat(this.name);\n }\n else {\n required = required.filter(x => x !== this.name);\n }\n this.parent.schema.required = required;\n }\n get type() {\n return this.schema.type;\n }\n set type(value) {\n if (this.schema.type !== value) {\n this.schema.type = value;\n if (value !== 'object') { // remove sub properties\n this.properties = {};\n this.schema.properties = undefined;\n }\n }\n }\n remove() {\n this.parent.removeProperty(this.name);\n }\n get isBoolean() {\n return this.type === 'boolean';\n }\n get isString() {\n return this.type === 'string';\n }\n get isNumber() {\n return this.type === 'number' || this.type === 'integer';\n }\n get isObject() {\n return this.type === 'object';\n }\n}\nfunction getArrayElementType(schema) {\n if (schema.type !== 'array') {\n throw new Error('Expecting an array schema');\n }\n if (!schema.items) {\n schema.items = {};\n }\n else if (Array.isArray(schema.items)) {\n throw new Error('Tuple arrays are not supported');\n }\n return schema.items;\n}\nexport class ArrayPropertySchema extends PropertySchema {\n arraySchema;\n constructor(parent, name, schema) {\n super(parent, name, getArrayElementType(schema));\n this.arraySchema = schema;\n }\n get isMulti() {\n return true;\n }\n}\n//# sourceMappingURL=schema.js.map","import { Schema } from \"./schema.js\";\nexport function computeTitleFromName(name) {\n name = name.replace(/_/g, ' ').replace(/([a-z0-9])&([A-Z])/g, \"$1 $2\");\n return name[0].toUpperCase() + name.slice(1);\n}\nfunction getInputType(_name, schema) {\n if (schema.editor) {\n return schema.editor;\n }\n // Check format as fallback (e.g., \"document\", \"media\", \"date\", etc.)\n if (schema.schema.format) {\n return schema.schema.format;\n }\n switch (schema.type) {\n case 'number':\n case 'integer':\n return 'number';\n case 'boolean':\n return 'checkbox';\n case 'string':\n return \"text\";\n default:\n return 'text';\n }\n}\nexport class Node {\n parent;\n schema;\n name;\n // change observer\n observer; // return false to stop bubbling\n constructor(parent, schema, name) {\n this.parent = parent;\n this.schema = schema;\n this.name = name;\n }\n get isRoot() {\n return !this.parent;\n }\n get root() {\n return this.parent ? this.parent.root : this;\n }\n get path() {\n return this.parent ? this.parent.path.concat(this.name) : [];\n }\n get isScalar() {\n return false;\n }\n get isListItem() {\n return false;\n }\n get isObject() {\n return false;\n }\n get isList() {\n return false;\n }\n get title() {\n return this.schema.title || computeTitleFromName(this.name);\n }\n onChange(node) {\n if (this.observer) {\n if (this.observer(this) === false) {\n return;\n }\n ;\n }\n this.parent && this.parent.onChange(node);\n }\n}\nexport class ManagedObjectBase extends Node {\n constructor(parent, schema, name) {\n super(parent, schema, name);\n }\n get isObject() {\n return true;\n }\n getProperty(name) {\n const schema = this.schema.properties[name];\n if (schema.isMulti) {\n return new ManagedListProperty(this, schema, this.getOrInitArrayProperty(name));\n }\n else if (schema.isObject) {\n return new ManagedObjectProperty(this, schema, schema.name, this.getOrInitObjectProperty(name));\n }\n else {\n return new ManagedProperty(this, schema);\n }\n }\n getOrInitObjectProperty(name) {\n let value = this.value[name];\n if (!value) {\n this.value[name] = value = {};\n }\n return value;\n }\n getOrInitArrayProperty(name) {\n let value = this.value[name];\n if (!value) {\n this.value[name] = value = [];\n }\n return value;\n }\n setPropertyValue(name, value) {\n if (this.value[name] !== value) {\n this.value[name] = value;\n return true;\n }\n return false;\n }\n getPropertyValue(name) {\n return this.value[name];\n }\n get properties() {\n const out = [];\n for (const schema of Object.values(this.schema.properties)) {\n if (schema.isMulti) {\n out.push(new ManagedListProperty(this, schema, this.getOrInitArrayProperty(schema.name)));\n }\n else if (schema.isObject) {\n out.push(new ManagedObjectProperty(this, schema, schema.name, this.getOrInitObjectProperty(schema.name)));\n }\n else {\n out.push(new ManagedProperty(this, schema));\n }\n }\n return out;\n }\n [Symbol.iterator]() {\n return this.properties[Symbol.iterator]();\n }\n}\nexport class ManagedObject extends ManagedObjectBase {\n value;\n constructor(schema, value = {}) {\n super(null, schema instanceof Schema ? schema : new Schema(schema), '#root');\n this.value = value;\n }\n}\nexport class ManagedObjectProperty extends ManagedObjectBase {\n value;\n constructor(parent, schema, name, value) {\n super(parent, schema, name);\n this.value = value;\n }\n}\nexport class ManagedProperty extends Node {\n constructor(parent, schema) {\n super(parent, schema, schema.name);\n if (parent.value[this.name] === undefined && schema.defaultValue !== undefined) {\n parent.value[this.name] = schema.defaultValue;\n }\n }\n get isScalar() {\n return true;\n }\n set value(value) {\n const changed = this.parent.setPropertyValue(this.name, value);\n if (changed) {\n this.onChange(this);\n }\n }\n get value() {\n return this.parent.getPropertyValue(this.name);\n }\n getInputType() {\n return getInputType(this.name, this.schema);\n }\n}\nexport class ManagedListProperty extends Node {\n value;\n items = [];\n constructor(parent, schema, value) {\n super(parent, schema, schema.name);\n this.value = value;\n for (const _v of this.value) {\n this.add();\n }\n }\n get isList() {\n return true;\n }\n newItem(index) {\n if (this.schema.isObject) {\n return new ManageObjectEntry(this, index);\n }\n else {\n return new ManagedScalarEntry(this, index);\n }\n }\n add() {\n const item = this.newItem(this.items.length);\n this.items.push(item);\n return item;\n }\n //TODO change is fired even if the removed item is transient\n // how to mark an item as transient (an added item not yet set by the user)\n remove(index) {\n const value = this.value;\n if (index >= 0 && index < this.items.length) {\n this.items.splice(index, 1);\n // update indexes\n for (let i = 0, l = this.items.length; i < l; i++) {\n const item = this.items[i];\n item.index = i;\n item.name = String(i);\n }\n }\n if (Array.isArray(value) && index >= 0 && index < value.length) {\n value.splice(index, 1);\n // TODO trigger onChange only if this item isn't transient\n this.onChange(this);\n }\n }\n [Symbol.iterator]() {\n return this.items[Symbol.iterator]();\n }\n item(index) {\n if (index < 0 || index >= this.value.length) {\n return undefined;\n }\n const item = this.value[index];\n if (this.schema.isObject) {\n return new ManagedObjectProperty(this, this.schema, String(index), item);\n }\n else {\n return new ManagedScalarEntry(this, index);\n }\n }\n /**\n * remove undefined items from the end of the list if any\n */\n trim() {\n while (this.items[this.items.length - 1] === undefined) {\n this.items.pop();\n }\n }\n}\nexport class ManageObjectEntry extends ManagedObjectBase {\n index;\n key;\n constructor(parent, index) {\n super(parent, parent.schema, String(index));\n this.index = index;\n if (parent.value[index] === undefined) {\n parent.value[index] = {};\n }\n this.key = this.name + '@' + Date.now();\n }\n get isListItem() {\n return true;\n }\n set value(value) {\n this.parent.value[this.index] = value;\n }\n get value() {\n return this.parent.value[this.index];\n }\n}\nexport class ManagedScalarEntry extends Node {\n index;\n key;\n constructor(parent, index) {\n super(parent, parent.schema, String(index));\n this.index = index;\n if (parent.value[index] === undefined && parent.schema.defaultValue !== undefined) {\n parent.value[index] = parent.schema.defaultValue;\n }\n this.key = this.name + '@' + Date.now();\n }\n get isScalar() {\n return true;\n }\n get isListItem() {\n return true;\n }\n set value(value) {\n this.parent.value[this.index] = value;\n }\n get value() {\n return this.parent.value[this.index];\n }\n getInputType() {\n return getInputType(this.name, this.schema);\n }\n}\n//# sourceMappingURL=ManagedObject.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { FormItem } from \"@vertesia/ui/core\";\nexport function FormLabel({ label, required, children }) {\n return (_jsx(FormItem, { label: label, required: required, children: children }));\n}\nexport function FormHelper({ children }) {\n return (_jsx(\"p\", { className: \"mt-2 text-sm text-gray-500\", children: children }));\n}\nexport function FormError({ children }) {\n return (_jsx(\"p\", { className: \"mt-2 text-sm text-red-600\", children: children }));\n}\n//# sourceMappingURL=fields.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { useTheme } from '@vertesia/ui/core';\nimport { MonacoEditor } from '../monacoEditor/MonacoEditor';\nimport { useMemo } from 'react';\nexport function JSONCode({ data, className }) {\n const { theme } = useTheme();\n // Convert data to formatted JSON string\n const jsonString = useMemo(() => {\n try {\n return JSON.stringify(data, null, 2);\n }\n catch (error) {\n console.error('Failed to stringify JSON:', error);\n return '{}';\n }\n }, [data]);\n return (_jsx(\"div\", { className: `h-full pb-2 mb-2 ${className || ''}`, children: _jsx(MonacoEditor, { value: jsonString, language: \"json\", theme: theme === 'dark' ? 'vs-dark' : 'vs', options: {\n readOnly: true,\n domReadOnly: true,\n } }) }));\n}\n//# sourceMappingURL=JSONCode.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { DotBadge } from \"@vertesia/ui/core\";\nimport clsx from \"clsx\";\nimport { computeTitleFromName } from \"../form/ManagedObject.js\";\nexport function JSONView({ value }) {\n return _jsx(\"div\", { className: \"flex flex-col gap-4 px-2 h-full overflow-auto\", children: Object.entries(value).map(([key, value]) => _jsx(PropertyElement, { name: key, value: value }, key)) });\n}\nfunction PropertyTitle({ name }) {\n return (_jsx(\"div\", { className: 'text-md font-semibold', children: computeTitleFromName(name) }));\n}\nfunction BlockElement({ children, className }) {\n return (_jsx(\"div\", { className: clsx('flex flex-col gap-4 py-2 pl-4 border-l-4 border-l-solid border-l-slate-100 dark:border-l-slate-600', className), children: children }));\n}\nfunction PropertyElement({ name, value }) {\n const info = getValueInfo(value);\n switch (info.type) {\n case ValueType.Inline:\n return (_jsxs(\"div\", { className: 'w-full flex gap-2', children: [_jsx(PropertyTitle, { name: name + ':' }), _jsx(\"p\", { children: info.value })] }));\n case ValueType.Paragraph:\n return (_jsxs(\"div\", { children: [_jsx(PropertyTitle, { name: name }), _jsx(\"p\", { children: info.value })] }));\n case ValueType.Prose:\n return (_jsxs(\"div\", { className: \"prose dark:prose-invert\", children: [_jsx(PropertyTitle, { name: name }), _jsx(\"div\", { className: 'vprose dark:prose-invert', children: info.value })] }));\n case ValueType.Array:\n return (_jsx(ArrayProperty, { name: name, value: value }));\n case ValueType.Object:\n return (_jsxs(\"div\", { children: [_jsx(PropertyTitle, { name: name }), _jsx(BlockElement, { className: 'mt-2', children: Object.entries(value).map(([key, value]) => _jsx(PropertyElement, { name: key, value: value }, key)) })] }));\n }\n}\nfunction ArrayProperty({ name, value }) {\n const inlineLength = value.join(' ').length;\n const itemMediumLength = inlineLength / value.length;\n const isInline = (typeof value[0] === 'string') && (inlineLength < 80 || inlineLength < 400 && itemMediumLength < 32);\n const useBullet = value.length > 9;\n return isInline ? (_jsxs(\"div\", { className: 'flex gap-2 flex-wrap', children: [name && _jsx(PropertyTitle, { name: name + ':' }), value.map((item, index) => _jsx(DotBadge, { children: String(item) }, index))] })) : (_jsxs(\"div\", { children: [name && _jsx(PropertyTitle, { name: name }), _jsx(\"div\", { className: 'flex flex-col gap-2', children: value.map((value, index) => _jsx(ItemProperty, { index: index, value: value, useBullet: useBullet }, index)) })] }));\n}\nfunction ItemProperty({ index, value, useBullet }) {\n const bullet = useBullet ? _jsx(\"span\", { className: 'text-xl', children: \"\\u2022\" }) : _jsxs(\"span\", { children: [index + 1, \".\"] });\n const info = getValueInfo(value);\n let content;\n switch (info.type) {\n case ValueType.Object:\n content = _jsx(BlockElement, { children: Object.entries(value).map(([key, value]) => _jsx(PropertyElement, { name: key, value: value }, key)) });\n break;\n case ValueType.Array:\n content = _jsx(ArrayProperty, { value: value });\n break;\n case ValueType.Prose:\n content = _jsx(\"div\", { className: \"prose dark:prose-invert\", children: info.value });\n break;\n default:\n content = _jsx(\"div\", { children: info.value });\n break;\n }\n return (_jsxs(\"div\", { className: 'flex gap-4 hover:bg-slate-50 dark:hover:bg-slate-800 py-2 pr-2 pl-4', children: [_jsx(\"div\", { className: 'font-semibold text-gray-600 dark:text-gray-400', children: bullet }), _jsx(\"div\", { children: content })] }));\n}\nvar ValueType;\n(function (ValueType) {\n ValueType[ValueType[\"Inline\"] = 0] = \"Inline\";\n ValueType[ValueType[\"Paragraph\"] = 1] = \"Paragraph\";\n ValueType[ValueType[\"Prose\"] = 2] = \"Prose\";\n ValueType[ValueType[\"Array\"] = 3] = \"Array\";\n ValueType[ValueType[\"Object\"] = 4] = \"Object\";\n})(ValueType || (ValueType = {}));\nfunction getValueInfo(value) {\n if (value == null) {\n return {\n value: '-',\n type: ValueType.Inline\n };\n }\n if (Array.isArray(value)) {\n return {\n value,\n type: ValueType.Array\n };\n }\n const type = typeof value;\n if (type === 'string') {\n const len = value.length;\n let type;\n if (len < 80) {\n type = ValueType.Inline;\n }\n else if (len > 400) {\n type = ValueType.Prose;\n }\n else {\n type = ValueType.Paragraph;\n value = value.replace(/(?:\\n\\n)+/g, '\\n\\n');\n }\n return { type, value };\n }\n else if (type === 'number' || type === 'boolean') {\n return {\n value: String(value),\n type: ValueType.Inline\n };\n }\n else {\n return {\n value,\n type: ValueType.Object\n };\n }\n}\n//# sourceMappingURL=JSONView.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { useUITranslation } from \"@vertesia/ui/i18n\";\nimport { JSONCode } from './JSONCode.js';\nimport { JSONView } from './JSONView.js';\nexport function JSONDisplay({ value, viewCode = false }) {\n const { t } = useUITranslation();\n if (!value) {\n return (_jsx(\"pre\", { className: \"whitespace-pre-wrap\", children: t('misc.noData') }));\n }\n return (_jsx(\"div\", { className: 'relative w-full h-full flex flex-col', children: viewCode\n ? _jsx(JSONCode, { data: value })\n : _jsx(\"div\", { className: \"flex-1 min-h-0 overflow-auto\", children: _jsx(JSONView, { value: value }) }) }));\n}\n//# sourceMappingURL=JSONDisplay.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { Button } from \"@vertesia/ui/core\";\nexport function JSONSwitcher({ title, viewCode, setViewCode }) {\n return (_jsxs(\"div\", { className: \"flex items-center gap-1 bg-muted mb-2 p-1 rounded\", children: [_jsx(Button, { variant: viewCode ? \"ghost\" : \"primary\", size: \"sm\", alt: \"Preview properties\", onClick: () => setViewCode(false), children: title }), _jsx(Button, { variant: viewCode ? \"primary\" : \"ghost\", size: \"sm\", alt: \"View in JSON format\", onClick: () => setViewCode(true), children: \"JSON\" })] }));\n}\n//# sourceMappingURL=JSONSwitcher.js.map","import { clsx } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\nexport function cn(...inputs) {\n return twMerge(clsx(inputs));\n}\n//# sourceMappingURL=utils.js.map","import i18next from 'i18next';\nimport { initReactI18next } from 'react-i18next';\nimport ar from './locales/ar.json';\nimport de from './locales/de.json';\nimport en from './locales/en.json';\nimport es from './locales/es.json';\nimport fr from './locales/fr.json';\nimport it from './locales/it.json';\nimport ja from './locales/ja.json';\nimport ko from './locales/ko.json';\nimport pt from './locales/pt.json';\nimport ru from './locales/ru.json';\nimport tr from './locales/tr.json';\nimport zh from './locales/zh.json';\nimport zhTW from './locales/zh-TW.json';\nexport const NAMESPACE = 'vertesia.ui';\n// Scoped instance — does NOT touch the global i18next singleton\nconst i18nInstance = i18next.createInstance();\nvoid i18nInstance.use(initReactI18next).init({\n resources: {\n ar: { [NAMESPACE]: ar },\n de: { [NAMESPACE]: de },\n en: { [NAMESPACE]: en },\n es: { [NAMESPACE]: es },\n fr: { [NAMESPACE]: fr },\n it: { [NAMESPACE]: it },\n ja: { [NAMESPACE]: ja },\n ko: { [NAMESPACE]: ko },\n pt: { [NAMESPACE]: pt },\n ru: { [NAMESPACE]: ru },\n tr: { [NAMESPACE]: tr },\n zh: { [NAMESPACE]: zh },\n 'zh-TW': { [NAMESPACE]: zhTW },\n },\n fallbackLng: 'en',\n ns: [NAMESPACE],\n defaultNS: NAMESPACE,\n interpolation: {\n escapeValue: false, // React already escapes\n },\n react: {\n useSuspense: false, // Translations are bundled, no async loading\n },\n});\nexport { i18nInstance };\n//# sourceMappingURL=instance.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { useEffect } from 'react';\nimport { I18nextProvider, useTranslation } from 'react-i18next';\nimport { i18nInstance, NAMESPACE } from './instance.js';\nfunction detectLanguage(lng) {\n return lng ?? navigator.language?.split('-')[0] ?? 'en';\n}\nexport function I18nProvider({ lng, children }) {\n // Set language synchronously on first render to avoid flash of wrong language\n const language = detectLanguage(lng);\n if (i18nInstance.language !== language) {\n void i18nInstance.changeLanguage(language);\n }\n // Also react to prop changes\n useEffect(() => {\n const lang = detectLanguage(lng);\n if (i18nInstance.language !== lang) {\n void i18nInstance.changeLanguage(lang);\n }\n }, [lng]);\n return (_jsx(I18nextProvider, { i18n: i18nInstance, children: children }));\n}\n/**\n * Hook for components inside @vertesia/ui to get translation functions.\n * Always binds to the 'vertesia.ui' namespace on the scoped instance.\n */\nexport function useUITranslation() {\n return useTranslation(NAMESPACE, { i18n: i18nInstance });\n}\nexport { i18nInstance, NAMESPACE } from './instance.js';\n//# sourceMappingURL=index.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport React, { createContext, useContext, useCallback, useRef } from \"react\";\nconst ArtifactUrlCacheContext = createContext(null);\n/**\n * Provider component that maintains a cache of resolved artifact URLs.\n * This prevents re-fetching the same artifact URL multiple times during re-renders.\n */\nexport function ArtifactUrlCacheProvider({ children }) {\n const cacheRef = useRef(new Map());\n const pendingRef = useRef(new Map());\n const getUrl = useCallback((key) => {\n return cacheRef.current.get(key);\n }, []);\n const setUrl = useCallback((key, url) => {\n cacheRef.current.set(key, url);\n }, []);\n const getOrFetch = useCallback(async (key, fetcher) => {\n // Return cached URL if available\n const cached = cacheRef.current.get(key);\n if (cached) {\n return cached;\n }\n // Return pending promise if a fetch is already in progress\n const pending = pendingRef.current.get(key);\n if (pending) {\n return pending;\n }\n // Start new fetch and cache the promise\n const promise = fetcher().then((url) => {\n cacheRef.current.set(key, url);\n pendingRef.current.delete(key);\n return url;\n }).catch((err) => {\n pendingRef.current.delete(key);\n throw err;\n });\n pendingRef.current.set(key, promise);\n return promise;\n }, []);\n const value = React.useMemo(() => ({ getUrl, setUrl, getOrFetch }), [getUrl, setUrl, getOrFetch]);\n return (_jsx(ArtifactUrlCacheContext.Provider, { value: value, children: children }));\n}\n/**\n * Hook to access the artifact URL cache.\n * Returns null if used outside of ArtifactUrlCacheProvider.\n */\nexport function useArtifactUrlCache() {\n return useContext(ArtifactUrlCacheContext);\n}\n/**\n * Generate a cache key for an artifact URL.\n */\nexport function getArtifactCacheKey(runId, path, disposition = \"inline\") {\n return `artifact:${runId}:${path}:${disposition}`;\n}\n/**\n * Generate a cache key for a file URL.\n */\nexport function getFileCacheKey(path) {\n return `file:${path}`;\n}\n//# sourceMappingURL=useArtifactUrlCache.js.map","import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from \"react/jsx-runtime\";\nimport * as DialogPrimitive from '@radix-ui/react-dialog';\nimport { Check, Copy, Download, Loader2, Maximize2, Minimize2, X } from 'lucide-react';\nimport Papa from 'papaparse';\nimport { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { VegaEmbed } from 'react-vega';\nimport { cn } from '../../../core/components/libs/utils';\nimport { useUITranslation } from '../../../i18n/index.js';\nimport { useUserSession } from '@vertesia/ui/session';\nimport { getArtifactCacheKey, getFileCacheKey, useArtifactUrlCache } from './useArtifactUrlCache';\n// Constants\nconst DEFAULT_CHART_HEIGHT = 280;\nconst DEFAULT_DASHBOARD_HEIGHT = 500;\n// Error display component\nfunction VegaErrorDisplay({ error, chartTitle }) {\n return (_jsx(\"div\", { className: \"flex items-center justify-center h-full bg-red-50 dark:bg-red-950 rounded-md p-4\", children: _jsxs(\"div\", { className: \"text-center\", children: [_jsxs(\"p\", { className: \"text-sm font-medium text-red-600 dark:text-red-400\", children: [\"Cannot render \", chartTitle || 'Vega-Lite', \" chart\"] }), _jsx(\"p\", { className: \"text-xs text-red-500 dark:text-red-500 mt-1 max-w-xs truncate\", children: error })] }) }));\n}\n// Fullscreen dialog component with smooth animations\nfunction FullscreenDialog({ isOpen, onClose, title, description, children, }) {\n const { t } = useUITranslation();\n return (_jsx(DialogPrimitive.Root, { open: isOpen, onOpenChange: (open) => !open && onClose(), children: _jsxs(DialogPrimitive.Portal, { children: [_jsx(DialogPrimitive.Overlay, { className: \"fixed inset-0 z-50 bg-black/80 backdrop-blur-sm transition-all duration-300 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0\" }), _jsxs(DialogPrimitive.Content, { className: \"fixed inset-2 sm:inset-4 z-50 flex flex-col bg-white dark:bg-gray-900 rounded-xl shadow-2xl transition-all duration-300 ease-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-98 data-[state=open]:zoom-in-98 data-[state=closed]:slide-out-to-bottom-2 data-[state=open]:slide-in-from-bottom-2\", onEscapeKeyDown: onClose, children: [_jsx(DialogPrimitive.Close, { asChild: true, children: _jsx(\"button\", { onClick: onClose, className: \"absolute top-3 right-3 z-10 p-2 rounded-lg bg-white/80 dark:bg-gray-800/80 backdrop-blur-sm hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors duration-150 shadow-sm\", \"aria-label\": t('agent.closeFullscreen'), children: _jsx(X, { className: \"w-5 h-5 text-gray-600 dark:text-gray-300\" }) }) }), _jsx(\"div\", { className: \"flex-1 overflow-auto p-4 sm:p-6 animate-in fade-in-0 duration-500 delay-150\", children: children }), _jsx(\"div\", { className: \"flex items-center justify-between px-4 sm:px-6 py-3 border-t border-gray-200 dark:border-gray-800 bg-gray-50/50 dark:bg-gray-800/50 rounded-b-xl\", children: _jsxs(\"div\", { className: \"flex flex-col\", children: [_jsx(DialogPrimitive.Title, { className: \"text-base font-semibold text-gray-900 dark:text-gray-100\", children: title || t('agent.dashboard') }), description && (_jsx(DialogPrimitive.Description, { className: \"text-sm text-gray-500 dark:text-gray-400 mt-0.5\", children: description }))] }) })] })] }) }));\n}\n// Calculate height based on spec complexity\nfunction calculateAutoHeight(spec, mode) {\n if (mode === 'chart') {\n return DEFAULT_CHART_HEIGHT;\n }\n // For dashboard mode, try to calculate based on spec structure\n let rowCount = 1;\n if (spec.vconcat) {\n rowCount = Array.isArray(spec.vconcat) ? spec.vconcat.length : 1;\n }\n else if (spec.concat) {\n const columns = spec.columns || 2;\n const items = Array.isArray(spec.concat) ? spec.concat.length : 1;\n rowCount = Math.ceil(items / columns);\n }\n else if (spec.facet) {\n // Faceted charts - estimate based on data\n rowCount = 2; // Default estimate\n }\n // Base height per row + padding\n return Math.max(DEFAULT_DASHBOARD_HEIGHT, rowCount * 280 + 40);\n}\n// Modern color palette - vibrant but professional\nconst CHART_COLORS = {\n // Primary palette - vibrant gradients\n categorical: [\n '#6366f1', // indigo\n '#8b5cf6', // violet\n '#ec4899', // pink\n '#f43f5e', // rose\n '#f97316', // orange\n '#eab308', // yellow\n '#22c55e', // green\n '#14b8a6', // teal\n '#06b6d4', // cyan\n '#3b82f6', // blue\n ],\n // Sequential schemes\n blues: ['#dbeafe', '#93c5fd', '#3b82f6', '#1d4ed8', '#1e3a8a'],\n purples: ['#f3e8ff', '#c4b5fd', '#8b5cf6', '#6d28d9', '#4c1d95'],\n greens: ['#dcfce7', '#86efac', '#22c55e', '#15803d', '#14532d'],\n // Diverging\n diverging: ['#ef4444', '#fca5a5', '#fef3c7', '#86efac', '#22c55e'],\n};\n/**\n * Preprocess a Vega-Lite spec to fix duplicate signal names that occur\n * when params with selections are used in vconcat/hconcat layouts.\n *\n * The issue: Vega-Lite creates internal signals like `paramName_tuple` for\n * point selections. When a param is defined at the root level of a vconcat/hconcat\n * spec, Vega-Lite's compiler creates duplicate signals when propagating the\n * selection to sub-views.\n *\n * Solution: Move selection params from the root level to the first sub-view\n * (where selections typically originate). Cross-view references are preserved\n * so that clicking in one view filters other views.\n */\nfunction fixVegaLiteSelectionParams(spec) {\n // Deep clone the spec to avoid mutations\n const result = JSON.parse(JSON.stringify(spec));\n // Check if this is a concatenated spec with root-level selection params\n const concatKeys = ['vconcat', 'hconcat', 'concat'];\n const hasConcatViews = concatKeys.some(key => Array.isArray(result[key]));\n if (!hasConcatViews) {\n // Not a concatenated spec, no special handling needed\n return result;\n }\n // Check for selection params at the root level\n const rootSelectionParams = [];\n if (Array.isArray(result.params)) {\n for (const param of result.params) {\n if (param && typeof param === 'object' && param.name && param.select) {\n rootSelectionParams.push({ name: param.name, param });\n }\n }\n }\n if (rootSelectionParams.length === 0) {\n // No selection params at root level, no special handling needed\n return result;\n }\n // Strategy: Move the selection param to the first sub-view that has an\n // encoding field matching the selection. Keep cross-view references intact\n // so filtering works across views.\n for (const { name: paramName, param } of rootSelectionParams) {\n const selectFields = param.select?.fields || [];\n const hasLegendBinding = param.select?.bind === 'legend';\n // Find the concat array\n let concatArray = null;\n for (const key of concatKeys) {\n if (Array.isArray(result[key])) {\n concatArray = result[key];\n break;\n }\n }\n if (!concatArray || concatArray.length === 0)\n continue;\n // Find the first view that has the selection field in its encoding\n // This is typically where users click to make selections\n let targetViewIndex = 0;\n for (let i = 0; i < concatArray.length; i++) {\n const view = concatArray[i];\n if (viewHasField(view, selectFields) || (hasLegendBinding && viewHasColorEncoding(view, selectFields))) {\n targetViewIndex = i;\n break;\n }\n }\n // Move the param to the target view\n const targetView = concatArray[targetViewIndex];\n if (!targetView.params) {\n targetView.params = [];\n }\n targetView.params.push(param);\n // Remove the param from root level\n result.params = result.params.filter((p) => p.name !== paramName);\n // Cross-view references are kept intact - Vega-Lite handles signal\n // propagation from the view where the selection is defined to other views\n }\n // Clean up empty params array at root\n if (Array.isArray(result.params) && result.params.length === 0) {\n delete result.params;\n }\n return result;\n}\n/**\n * Apply parameter values to a Vega-Lite spec.\n * Updates the 'value' field of named params, allowing models to set\n * initial values for interactive controls (sliders, dropdowns, etc.).\n * @exported for testing\n */\nexport function applyParameterValues(spec, parameterValues) {\n if (!parameterValues || Object.keys(parameterValues).length === 0) {\n return spec;\n }\n const result = JSON.parse(JSON.stringify(spec));\n // Helper to update params in a view\n const updateParams = (params) => {\n for (const param of params) {\n if (param && typeof param === 'object' && param.name && param.name in parameterValues) {\n param.value = parameterValues[param.name];\n }\n }\n };\n // Update root-level params\n if (Array.isArray(result.params)) {\n updateParams(result.params);\n }\n // Update params in nested views (vconcat, hconcat, concat)\n const updateNestedViews = (views) => {\n if (!Array.isArray(views))\n return;\n for (const view of views) {\n if (view && Array.isArray(view.params)) {\n updateParams(view.params);\n }\n // Recursively handle nested concatenations\n if (view.vconcat)\n updateNestedViews(view.vconcat);\n if (view.hconcat)\n updateNestedViews(view.hconcat);\n if (view.concat)\n updateNestedViews(view.concat);\n // Handle layers\n if (Array.isArray(view.layer)) {\n for (const layer of view.layer) {\n if (layer && Array.isArray(layer.params)) {\n updateParams(layer.params);\n }\n }\n }\n }\n };\n if (result.vconcat)\n updateNestedViews(result.vconcat);\n if (result.hconcat)\n updateNestedViews(result.hconcat);\n if (result.concat)\n updateNestedViews(result.concat);\n if (Array.isArray(result.layer)) {\n for (const layer of result.layer) {\n if (layer && Array.isArray(layer.params)) {\n updateParams(layer.params);\n }\n }\n }\n return result;\n}\n/**\n * Check if a view has encoding using any of the specified fields.\n */\nfunction viewHasField(view, fields) {\n if (!view || !view.encoding)\n return false;\n for (const field of fields) {\n for (const channel of Object.values(view.encoding)) {\n if (channel && typeof channel === 'object' && channel.field === field) {\n return true;\n }\n }\n }\n // Also check nested layers\n if (Array.isArray(view.layer)) {\n for (const layer of view.layer) {\n if (viewHasField(layer, fields))\n return true;\n }\n }\n return false;\n}\n/**\n * Check if a view has color encoding using any of the specified fields.\n */\nfunction viewHasColorEncoding(view, fields) {\n if (!view)\n return false;\n const checkEncoding = (encoding) => {\n if (!encoding)\n return false;\n const colorField = encoding.color?.field;\n return colorField && fields.includes(colorField);\n };\n if (checkEncoding(view.encoding))\n return true;\n // Check nested layers\n if (Array.isArray(view.layer)) {\n for (const layer of view.layer) {\n if (checkEncoding(layer.encoding))\n return true;\n }\n }\n return false;\n}\n/**\n * Walk the Vega-Lite spec and find all artifact: URL references in data.url fields.\n * Returns an array of references with their paths in the spec tree.\n */\nfunction findArtifactReferences(spec, currentPath = []) {\n const references = [];\n if (!spec || typeof spec !== 'object') {\n return references;\n }\n // Check if this object has a data.url that's an artifact reference\n if (spec.data && typeof spec.data === 'object') {\n const url = spec.data.url;\n if (typeof url === 'string' && url.startsWith('artifact:')) {\n references.push({\n path: [...currentPath, 'data'],\n artifactPath: url.replace(/^artifact:/, '').trim(),\n });\n }\n }\n // Recursively check nested objects (layer, vconcat, hconcat, concat, spec, etc.)\n const nestedKeys = ['layer', 'vconcat', 'hconcat', 'concat', 'spec', 'repeat', 'facet'];\n for (const key of nestedKeys) {\n if (key in spec) {\n const value = spec[key];\n if (Array.isArray(value)) {\n value.forEach((item, index) => {\n references.push(...findArtifactReferences(item, [...currentPath, key, String(index)]));\n });\n }\n else if (typeof value === 'object' && value !== null) {\n references.push(...findArtifactReferences(value, [...currentPath, key]));\n }\n }\n }\n return references;\n}\n/**\n * Deep clone and update the spec by replacing artifact URLs with resolved data values.\n */\nfunction replaceArtifactData(spec, resolvedData) {\n const result = JSON.parse(JSON.stringify(spec));\n for (const [pathKey, data] of resolvedData) {\n const path = pathKey.split('.');\n let current = result;\n // Navigate to the parent of the data object\n for (let i = 0; i < path.length - 1; i++) {\n if (current[path[i]] === undefined) {\n break;\n }\n current = current[path[i]];\n }\n // Replace data.url with data.values\n const lastKey = path[path.length - 1];\n if (current[lastKey] && typeof current[lastKey] === 'object') {\n delete current[lastKey].url;\n current[lastKey].values = data;\n }\n }\n return result;\n}\n// Get dark mode config for Vega with enhanced styling\nfunction getDarkModeConfig(isDark) {\n const baseConfig = {\n background: 'transparent',\n view: { stroke: 'transparent' },\n // Modern color range\n range: {\n category: CHART_COLORS.categorical,\n diverging: CHART_COLORS.diverging,\n heatmap: CHART_COLORS.purples,\n ramp: CHART_COLORS.blues,\n },\n // Enable tooltips by default for all mark types with enhanced styling\n mark: { tooltip: true },\n bar: {\n tooltip: true,\n cornerRadiusTopLeft: 4,\n cornerRadiusTopRight: 4,\n },\n line: {\n tooltip: true,\n strokeWidth: 2.5,\n strokeCap: 'round',\n },\n point: {\n tooltip: true,\n size: 60,\n filled: true,\n },\n area: {\n tooltip: true,\n fillOpacity: 0.7,\n line: true,\n },\n rect: {\n tooltip: true,\n cornerRadius: 2,\n },\n arc: {\n tooltip: true,\n cornerRadius: 4,\n },\n circle: {\n tooltip: true,\n size: 80,\n },\n };\n if (isDark) {\n return {\n ...baseConfig,\n axis: {\n labelColor: '#a1a1aa',\n titleColor: '#e4e4e7',\n gridColor: '#3f3f46',\n domainColor: '#52525b',\n tickColor: '#52525b',\n labelFont: 'Inter, system-ui, sans-serif',\n titleFont: 'Inter, system-ui, sans-serif',\n labelFontSize: 11,\n titleFontSize: 12,\n titleFontWeight: 500,\n },\n legend: {\n labelColor: '#a1a1aa',\n titleColor: '#e4e4e7',\n labelFont: 'Inter, system-ui, sans-serif',\n titleFont: 'Inter, system-ui, sans-serif',\n labelFontSize: 11,\n titleFontSize: 12,\n symbolSize: 100,\n },\n title: {\n color: '#fafafa',\n font: 'Inter, system-ui, sans-serif',\n fontSize: 14,\n fontWeight: 600,\n },\n };\n }\n return {\n ...baseConfig,\n axis: {\n labelColor: '#71717a',\n titleColor: '#3f3f46',\n gridColor: '#e4e4e7',\n domainColor: '#d4d4d8',\n tickColor: '#d4d4d8',\n labelFont: 'Inter, system-ui, sans-serif',\n titleFont: 'Inter, system-ui, sans-serif',\n labelFontSize: 11,\n titleFontSize: 12,\n titleFontWeight: 500,\n },\n legend: {\n labelColor: '#71717a',\n titleColor: '#3f3f46',\n labelFont: 'Inter, system-ui, sans-serif',\n titleFont: 'Inter, system-ui, sans-serif',\n labelFontSize: 11,\n titleFontSize: 12,\n symbolSize: 100,\n },\n title: {\n color: '#18181b',\n font: 'Inter, system-ui, sans-serif',\n fontSize: 14,\n fontWeight: 600,\n },\n };\n}\nexport const VegaLiteChart = memo(function VegaLiteChart({ spec, artifactRunId }) {\n const { t } = useUITranslation();\n const { title, description, spec: vegaSpec, options } = spec;\n const [isExporting, setIsExporting] = useState(false);\n const [isCopied, setIsCopied] = useState(false);\n const [error, setError] = useState(null);\n const [isFullscreen, setIsFullscreen] = useState(false);\n const viewRef = useRef(null);\n const fullscreenViewRef = useRef(null);\n const containerRef = useRef(null);\n // Artifact resolution state\n const { client } = useUserSession();\n const urlCache = useArtifactUrlCache();\n // Use refs to avoid triggering effect re-runs when these stable values are accessed\n const clientRef = useRef(client);\n clientRef.current = client;\n const urlCacheRef = useRef(urlCache);\n urlCacheRef.current = urlCache;\n const [resolvedSpec, setResolvedSpec] = useState(null);\n const [isLoadingArtifacts, setIsLoadingArtifacts] = useState(false);\n const [artifactError, setArtifactError] = useState(null);\n // Determine mode and settings\n const mode = options?.mode || 'chart';\n const isDashboard = mode === 'dashboard';\n const showFullscreenButton = options?.enableFullscreen ?? isDashboard;\n // Calculate height\n const baseHeight = options?.height || calculateAutoHeight(vegaSpec, mode);\n // Resolve artifact URLs in the spec\n useEffect(() => {\n const references = findArtifactReferences(vegaSpec);\n // If no artifact references, use original spec\n if (references.length === 0) {\n setResolvedSpec(vegaSpec);\n setIsLoadingArtifacts(false);\n setArtifactError(null);\n return;\n }\n if (!artifactRunId) {\n console.warn('[VegaLiteChart] artifact references found but artifactRunId is missing!', {\n references: references.map(r => r.artifactPath),\n artifactRunId,\n });\n }\n else {\n console.info('[VegaLiteChart] resolving artifacts with runId:', artifactRunId, references.map(r => r.artifactPath));\n }\n let cancelled = false;\n setIsLoadingArtifacts(true);\n setArtifactError(null);\n const resolveArtifacts = async () => {\n const resolvedData = new Map();\n const currentClient = clientRef.current;\n const currentUrlCache = urlCacheRef.current;\n for (const ref of references) {\n try {\n const pathKey = ref.path.join('.');\n let url;\n // Determine if this is a shorthand path or full path\n if (artifactRunId && !ref.artifactPath.startsWith('agents/')) {\n // Shorthand path - use artifact API\n const cacheKey = getArtifactCacheKey(artifactRunId, ref.artifactPath, 'inline');\n if (currentUrlCache) {\n url = await currentUrlCache.getOrFetch(cacheKey, async () => {\n const result = await currentClient.files.getArtifactDownloadUrl(artifactRunId, ref.artifactPath, 'inline');\n return result.url;\n });\n }\n else {\n const result = await currentClient.files.getArtifactDownloadUrl(artifactRunId, ref.artifactPath, 'inline');\n url = result.url;\n }\n }\n else {\n // Full path - use files API\n const cacheKey = getFileCacheKey(ref.artifactPath);\n if (currentUrlCache) {\n url = await currentUrlCache.getOrFetch(cacheKey, async () => {\n const result = await currentClient.files.getDownloadUrl(ref.artifactPath);\n return result.url;\n });\n }\n else {\n const result = await currentClient.files.getDownloadUrl(ref.artifactPath);\n url = result.url;\n }\n }\n // Fetch the data from the resolved URL\n const response = await fetch(url);\n if (!response.ok) {\n throw new Error(`Failed to fetch artifact data: ${response.statusText}`);\n }\n // Detect CSV files by artifact path extension\n const isCsv = ref.artifactPath.toLowerCase().endsWith('.csv');\n let data;\n if (isCsv) {\n // Parse CSV to JSON array\n const csvText = await response.text();\n const parseResult = Papa.parse(csvText, {\n header: true,\n skipEmptyLines: true,\n dynamicTyping: true, // Auto-convert numbers and booleans\n });\n data = parseResult.data;\n }\n else {\n // Parse as JSON\n const jsonData = await response.json();\n data = Array.isArray(jsonData) ? jsonData : [jsonData];\n }\n resolvedData.set(pathKey, data);\n }\n catch (err) {\n console.error(`Failed to resolve artifact: ${ref.artifactPath}`, err);\n if (!cancelled) {\n setArtifactError(`Failed to load data from artifact: ${ref.artifactPath}`);\n }\n return;\n }\n }\n if (!cancelled) {\n const newSpec = replaceArtifactData(vegaSpec, resolvedData);\n setResolvedSpec(newSpec);\n setIsLoadingArtifacts(false);\n }\n };\n resolveArtifacts();\n return () => {\n cancelled = true;\n };\n }, [vegaSpec, artifactRunId]);\n // Detect dark mode\n const [isDarkMode, setIsDarkMode] = useState(false);\n const isDarkModeRef = useRef(false);\n useEffect(() => {\n const checkDarkMode = () => {\n const newDarkMode = document.documentElement.classList.contains('dark');\n // Only update state if dark mode actually changed\n if (newDarkMode !== isDarkModeRef.current) {\n isDarkModeRef.current = newDarkMode;\n setIsDarkMode(newDarkMode);\n }\n };\n checkDarkMode();\n const observer = new MutationObserver(checkDarkMode);\n observer.observe(document.documentElement, { attributes: true, attributeFilter: ['class'] });\n return () => observer.disconnect();\n }, []);\n // Track container width for responsive sizing\n const [containerWidth, setContainerWidth] = useState(0);\n const containerWidthRef = useRef(0);\n useEffect(() => {\n if (!containerRef.current)\n return;\n let resizeTimeout;\n const resizeObserver = new ResizeObserver((entries) => {\n // Debounce resize callbacks to ~100ms to avoid excessive state updates\n clearTimeout(resizeTimeout);\n resizeTimeout = setTimeout(() => {\n const width = entries[0]?.contentRect.width;\n if (width && width !== containerWidthRef.current) {\n containerWidthRef.current = width;\n setContainerWidth(width);\n }\n }, 100);\n });\n resizeObserver.observe(containerRef.current);\n // Initial width\n const initialWidth = containerRef.current.clientWidth;\n containerWidthRef.current = initialWidth;\n setContainerWidth(initialWidth);\n return () => {\n clearTimeout(resizeTimeout);\n resizeObserver.disconnect();\n };\n }, []);\n // Check if there are artifact references that need resolution\n const hasArtifactReferences = useMemo(() => {\n return findArtifactReferences(vegaSpec).length > 0;\n }, [vegaSpec]);\n // Memoize the processed spec to fix Vega-Lite selection param issues\n // This handles the duplicate signal problem in concatenated views\n const processedSpec = useMemo(() => {\n // If there are artifact references, we must wait for resolvedSpec\n // Don't fall back to vegaSpec which contains artifact: URLs\n if (hasArtifactReferences && !resolvedSpec) {\n return null;\n }\n let specToUse = resolvedSpec || vegaSpec;\n if (!specToUse)\n return null;\n // Apply parameter values if provided (allows model to set initial slider/dropdown values)\n if (options?.parameterValues) {\n specToUse = applyParameterValues(specToUse, options.parameterValues);\n }\n return fixVegaLiteSelectionParams(specToUse);\n }, [resolvedSpec, vegaSpec, hasArtifactReferences, options?.parameterValues]);\n // Scale widths in concatenated views to fit container\n const scaleSpecWidths = useCallback((spec, availableWidth) => {\n if (!spec || typeof spec !== 'object')\n return spec;\n // Handle hconcat - distribute width among children\n if (spec.hconcat && Array.isArray(spec.hconcat)) {\n const childCount = spec.hconcat.length;\n const spacing = spec.spacing ?? 10;\n const totalSpacing = spacing * (childCount - 1);\n const widthPerChild = Math.floor((availableWidth - totalSpacing) / childCount);\n return {\n ...spec,\n hconcat: spec.hconcat.map((child) => scaleSpecWidths(child, widthPerChild)),\n };\n }\n // Handle vconcat - each child gets full width\n if (spec.vconcat && Array.isArray(spec.vconcat)) {\n return {\n ...spec,\n vconcat: spec.vconcat.map((child) => scaleSpecWidths(child, availableWidth)),\n };\n }\n // Handle generic concat with columns\n if (spec.concat && Array.isArray(spec.concat)) {\n const columns = spec.columns ?? spec.concat.length;\n const spacing = spec.spacing ?? 10;\n const totalSpacing = spacing * (columns - 1);\n const widthPerChild = Math.floor((availableWidth - totalSpacing) / columns);\n return {\n ...spec,\n concat: spec.concat.map((child) => scaleSpecWidths(child, widthPerChild)),\n };\n }\n // For leaf views, set width if it's \"container\" or larger than available\n const currentWidth = spec.width;\n if (currentWidth === 'container' || (typeof currentWidth === 'number' && currentWidth > availableWidth)) {\n return { ...spec, width: availableWidth };\n }\n return spec;\n }, []);\n // Build the full Vega-Lite spec with defaults\n const buildFullSpec = useCallback((height, forFullscreen = false) => {\n if (!processedSpec)\n return null;\n const config = getDarkModeConfig(isDarkMode);\n // Use measured container width, window width for fullscreen (capped), or fallback\n const calculatedWidth = forFullscreen\n ? (typeof window !== 'undefined' ? Math.min(window.innerWidth - 80, 1400) : 1200)\n : (containerWidth > 0 ? containerWidth - 24 : 500);\n // Check if this is a concatenated view - autosize 'fit' only works for single/layered views\n const isConcatenatedView = 'vconcat' in processedSpec || 'hconcat' in processedSpec || 'concat' in processedSpec;\n // For concatenated views, use 'pad' which works correctly; for single views use 'fit'\n const autosize = isConcatenatedView\n ? { type: 'pad', contains: 'padding' }\n : { type: 'fit', contains: 'padding' };\n // Scale widths for concatenated views to fit container\n let scaledSpec = processedSpec;\n if (isConcatenatedView && calculatedWidth) {\n scaledSpec = scaleSpecWidths(processedSpec, calculatedWidth);\n }\n // Replace \"container\" width with our measured width - \"container\" relies on CSS which may not be ready\n const specWidth = scaledSpec.width;\n const width = isConcatenatedView ? undefined : (specWidth === 'container' ? calculatedWidth : (specWidth ?? calculatedWidth));\n // Destructure to remove width from spec so we can control it (only for non-concat views)\n const { width: _specWidth, ...specWithoutWidth } = scaledSpec;\n return {\n $schema: 'https://vega.github.io/schema/vega-lite/v6.json',\n ...(!isConcatenatedView && width ? { width } : {}),\n height: forFullscreen ? undefined : height,\n autosize,\n ...(isConcatenatedView ? scaledSpec : specWithoutWidth),\n // Override title if provided at top level\n ...(title && !processedSpec.title ? { title } : {}),\n // Apply theme config\n config: {\n ...config,\n ...processedSpec.config,\n },\n };\n }, [processedSpec, title, isDarkMode, containerWidth, scaleSpecWidths]);\n const handleCopy = useCallback(async () => {\n const view = isFullscreen ? fullscreenViewRef.current : viewRef.current;\n if (!view || isCopied)\n return;\n try {\n const canvas = await view.toCanvas(2);\n canvas.toBlob(async (blob) => {\n if (blob) {\n await navigator.clipboard.write([\n new ClipboardItem({ 'image/png': blob })\n ]);\n setIsCopied(true);\n setTimeout(() => setIsCopied(false), 2000);\n }\n }, 'image/png');\n }\n catch (err) {\n console.error('Failed to copy chart:', err);\n }\n }, [isCopied, isFullscreen]);\n const handleExport = useCallback(async () => {\n const view = isFullscreen ? fullscreenViewRef.current : viewRef.current;\n if (!view || isExporting)\n return;\n setIsExporting(true);\n try {\n const url = await view.toImageURL('png', 2);\n const link = document.createElement('a');\n link.download = `${title || 'chart'}.png`;\n link.href = url;\n link.click();\n }\n catch (err) {\n console.error('Failed to export chart:', err);\n }\n finally {\n setIsExporting(false);\n }\n }, [title, isExporting, isFullscreen]);\n const handleNewView = useCallback((view) => {\n viewRef.current = view;\n setError(null);\n }, []);\n const handleFullscreenNewView = useCallback((view) => {\n fullscreenViewRef.current = view;\n }, []);\n const handleError = useCallback((err) => {\n console.error('Vega-Lite rendering error:', err);\n setError(err instanceof Error ? err.message : 'Unknown error');\n }, []);\n const toggleFullscreen = useCallback(() => {\n setIsFullscreen(prev => !prev);\n }, []);\n // Clear error when spec changes\n useEffect(() => {\n setError(null);\n }, [vegaSpec]);\n // Toolbar component (reused in both views)\n const Toolbar = ({ className }) => (_jsxs(\"div\", { className: cn(\"flex items-center gap-2\", className), children: [_jsxs(\"button\", { onClick: handleCopy, disabled: isCopied, className: \"text-xs px-2 py-1 rounded border border-gray-300 dark:border-gray-700 bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 cursor-pointer transition-colors disabled:opacity-50 flex items-center gap-1\", title: t('agent.copyToClipboard'), children: [isCopied ? _jsx(Check, { className: \"w-3 h-3\" }) : _jsx(Copy, { className: \"w-3 h-3\" }), isCopied ? t('agent.copied') : t('agent.copy')] }), _jsxs(\"button\", { onClick: handleExport, disabled: isExporting, className: \"text-xs px-2 py-1 rounded border border-gray-300 dark:border-gray-700 bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 cursor-pointer transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-1\", title: t('agent.exportAsPng'), children: [_jsx(Download, { className: \"w-3 h-3\" }), isExporting ? t('agent.exporting') : t('agent.export')] }), showFullscreenButton && (_jsxs(\"button\", { onClick: toggleFullscreen, className: \"text-xs px-2 py-1 rounded border border-gray-300 dark:border-gray-700 bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 cursor-pointer transition-colors flex items-center gap-1\", title: isFullscreen ? t('agent.exitFullscreen') : t('agent.fullscreen'), children: [isFullscreen ? _jsx(Minimize2, { className: \"w-3 h-3\" }) : _jsx(Maximize2, { className: \"w-3 h-3\" }), isFullscreen ? t('agent.exit') : t('agent.fullscreen')] }))] }));\n // Show loading state when resolving artifacts\n // Also show loading if we have artifact refs but haven't resolved them yet\n // (covers the gap before the effect runs)\n if (isLoadingArtifacts || (hasArtifactReferences && !resolvedSpec)) {\n return (_jsx(\"div\", { className: \"bg-white dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-800 shadow-sm\", children: _jsxs(\"div\", { className: \"flex flex-col gap-2 p-3\", children: [_jsx(\"div\", { className: \"flex items-center justify-between\", children: _jsx(\"span\", { className: \"font-medium text-sm text-gray-900 dark:text-gray-100\", children: title || 'Chart' }) }), _jsx(\"div\", { className: \"flex items-center justify-center bg-gray-50 dark:bg-gray-800 rounded\", style: { width: '100%', height: baseHeight }, children: _jsxs(\"div\", { className: \"flex items-center gap-2 text-gray-500 dark:text-gray-400\", children: [_jsx(Loader2, { className: \"w-5 h-5 animate-spin\" }), _jsx(\"span\", { className: \"text-sm\", children: \"Loading data from artifacts...\" })] }) })] }) }));\n }\n // Show artifact error state\n if (artifactError) {\n return (_jsx(\"div\", { className: \"bg-white dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-800 shadow-sm\", children: _jsxs(\"div\", { className: \"flex flex-col gap-2 p-3\", children: [_jsx(\"div\", { className: \"flex items-center justify-between\", children: _jsx(\"span\", { className: \"font-medium text-sm text-gray-900 dark:text-gray-100\", children: title || 'Chart' }) }), _jsx(\"div\", { style: { width: '100%', height: baseHeight }, children: _jsx(VegaErrorDisplay, { error: artifactError, chartTitle: title }) })] }) }));\n }\n if (error) {\n return (_jsx(\"div\", { className: \"bg-white dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-800 shadow-sm\", children: _jsxs(\"div\", { className: \"flex flex-col gap-2 p-3\", children: [_jsx(\"div\", { className: \"flex items-center justify-between\", children: _jsx(\"span\", { className: \"font-medium text-sm text-gray-900 dark:text-gray-100\", children: title || 'Chart' }) }), _jsx(\"div\", { style: { width: '100%', height: baseHeight }, children: _jsx(VegaErrorDisplay, { error: error, chartTitle: title }) })] }) }));\n }\n // Build spec for rendering\n const chartSpec = buildFullSpec(baseHeight);\n const fullscreenSpec = buildFullSpec(0, true);\n // Handle case when spec isn't ready yet\n if (!chartSpec) {\n return null;\n }\n // Debug: Log renders to track unnecessary re-renders (enable with localStorage)\n if (typeof window !== 'undefined' && localStorage.getItem('DEBUG_VEGA_RENDERS')) {\n console.log('VegaLite rendering with spec:', {\n title,\n hasData: !!chartSpec.data?.values,\n dataLength: chartSpec.data?.values?.length,\n });\n }\n return (_jsxs(_Fragment, { children: [_jsx(\"div\", { className: cn(\"bg-white dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-800 shadow-sm\", isDashboard && \"border-2\"), children: _jsxs(\"div\", { className: \"flex flex-col gap-2 p-3\", children: [_jsxs(\"div\", { className: \"flex items-center justify-between\", children: [_jsxs(\"div\", { className: \"flex items-center gap-2\", children: [_jsx(\"span\", { className: \"font-medium text-sm text-gray-900 dark:text-gray-100\", children: title || (isDashboard ? 'Dashboard' : 'Chart') }), isDashboard && (_jsx(\"span\", { className: \"text-xs px-2 py-0.5 rounded-full bg-indigo-100 dark:bg-indigo-900 text-indigo-700 dark:text-indigo-300\", children: \"Interactive\" }))] }), _jsx(Toolbar, {})] }), description && (_jsx(\"span\", { className: \"text-xs text-gray-500 dark:text-gray-400\", children: description })), _jsx(\"div\", { ref: containerRef, className: \"bg-white dark:bg-gray-900 rounded overflow-hidden\", style: { width: '100%', height: baseHeight, minWidth: 0 }, children: _jsx(VegaEmbed, { spec: chartSpec, onEmbed: (result) => handleNewView(result.view), onError: handleError, options: { renderer: options?.renderer || 'canvas', actions: false } }) })] }) }), _jsxs(FullscreenDialog, { isOpen: isFullscreen, onClose: () => setIsFullscreen(false), title: title || (isDashboard ? 'Dashboard' : 'Chart'), description: description, children: [_jsx(\"div\", { className: \"w-full h-full min-h-[calc(100vh-200px)]\", children: fullscreenSpec && (_jsx(VegaEmbed, { spec: fullscreenSpec, onEmbed: (result) => handleFullscreenNewView(result.view), onError: handleError, options: { renderer: options?.renderer || 'canvas', actions: false } })) }), _jsx(\"div\", { className: \"absolute bottom-6 right-6\", children: _jsx(Toolbar, { className: \"bg-white dark:bg-gray-800 rounded-lg shadow-lg p-2 border border-gray-200 dark:border-gray-700\" }) })] })] }));\n}, (prevProps, nextProps) => {\n // Deep compare the spec to prevent re-renders when data hasn't changed\n return JSON.stringify(prevProps.spec) === JSON.stringify(nextProps.spec) &&\n prevProps.artifactRunId === nextProps.artifactRunId;\n});\n//# sourceMappingURL=VegaLiteChart.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport React, { useMemo } from 'react';\nconst CodeBlockContext = React.createContext({});\nexport function CodeBlockHandlerProvider({ children, artifactRunId, onProposalSelect, onProposalSubmit, MarkdownRenderer, }) {\n const value = useMemo(() => ({ artifactRunId, onProposalSelect, onProposalSubmit, MarkdownRenderer }), [artifactRunId, onProposalSelect, onProposalSubmit, MarkdownRenderer]);\n return _jsx(CodeBlockContext.Provider, { value: value, children: children });\n}\nexport function useCodeBlockContext() {\n return React.useContext(CodeBlockContext);\n}\n//# sourceMappingURL=CodeBlockContext.js.map","import { jsxs as _jsxs, jsx as _jsx } from \"react/jsx-runtime\";\nimport React from 'react';\nimport { BarChart3, GitBranch, MessageSquare, Code, Image, Link, Download, Table, FileText } from 'lucide-react';\nconst TYPE_CONFIG = {\n chart: { icon: BarChart3, label: 'chart', defaultHeight: 200 },\n mermaid: { icon: GitBranch, label: 'diagram', defaultHeight: 150 },\n proposal: { icon: MessageSquare, label: 'options', defaultHeight: 100 },\n code: { icon: Code, label: 'code', defaultHeight: 80 },\n image: { icon: Image, label: 'image', defaultHeight: 150 },\n link: { icon: Link, label: 'link', defaultHeight: 24 },\n expand: { icon: Download, label: 'content', defaultHeight: 100 },\n table: { icon: Table, label: 'table', defaultHeight: 150 },\n markdown: { icon: FileText, label: 'content', defaultHeight: 100 },\n 'fusion-fragment': { icon: Code, label: 'fragment', defaultHeight: 150 },\n};\n/**\n * Placeholder component shown while code blocks are loading.\n * Provides visual feedback and error states with retry capability.\n */\nexport function CodeBlockPlaceholder({ type, error, onRetry, message, height, }) {\n const config = TYPE_CONFIG[type];\n const displayHeight = height ?? config.defaultHeight;\n const isInline = type === 'link';\n if (error) {\n return (_jsxs(\"div\", { className: `flex items-center gap-2 rounded border border-destructive/30 bg-destructive/5 text-destructive ${isInline ? 'inline-flex px-2 py-1 text-sm' : 'p-4'}`, style: !isInline ? { minHeight: displayHeight } : undefined, children: [_jsxs(\"span\", { className: \"text-destructive\", children: [\"Failed to load \", config.label] }), onRetry && (_jsx(\"button\", { onClick: onRetry, className: \"ml-2 rounded bg-destructive/10 px-2 py-1 text-xs hover:bg-destructive/20 transition-colors\", children: \"Retry\" }))] }));\n }\n const IconComponent = config.icon;\n if (isInline) {\n return (_jsxs(\"span\", { className: \"inline-flex items-center gap-1 text-muted animate-pulse\", children: [_jsx(IconComponent, { className: \"h-3 w-3\" }), _jsx(\"span\", { children: message || `Loading ${config.label}...` })] }));\n }\n return (_jsxs(\"div\", { className: \"flex flex-col items-center justify-center gap-3 rounded border border-border bg-muted/30 animate-pulse\", style: { minHeight: displayHeight }, children: [_jsx(IconComponent, { className: \"h-8 w-8 text-muted\" }), _jsx(\"span\", { className: \"text-sm text-muted\", children: message || `Loading ${config.label}...` }), _jsx(\"div\", { className: \"flex gap-1\", children: [...Array(3)].map((_, i) => (_jsx(\"div\", { className: \"h-2 w-2 rounded-full bg-muted animate-bounce\", style: { animationDelay: `${i * 150}ms` } }, i))) })] }));\n}\nexport class CodeBlockErrorBoundary extends React.Component {\n constructor(props) {\n super(props);\n this.state = { hasError: false };\n }\n static getDerivedStateFromError(error) {\n return { hasError: true, error };\n }\n componentDidCatch(error, errorInfo) {\n console.error(`CodeBlock rendering error (${this.props.type}):`, error, errorInfo);\n this.props.onError?.(error);\n }\n handleRetry = () => {\n this.setState({ hasError: false, error: undefined });\n };\n render() {\n if (this.state.hasError) {\n const { type, fallbackCode } = this.props;\n return (_jsxs(\"div\", { className: \"space-y-2\", children: [_jsx(CodeBlockPlaceholder, { type: type, error: this.state.error?.message || 'Rendering failed', onRetry: this.handleRetry }), fallbackCode && (_jsxs(\"details\", { className: \"text-sm\", children: [_jsx(\"summary\", { className: \"cursor-pointer text-muted hover:text-foreground\", children: \"Show raw content\" }), _jsx(\"pre\", { className: \"mt-2 overflow-x-auto rounded bg-muted/50 p-2 text-xs\", children: _jsx(\"code\", { children: fallbackCode }) })] }))] }));\n }\n return this.props.children;\n }\n}\n//# sourceMappingURL=CodeBlockPlaceholder.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\n/**\n * ArtifactContentRenderer - Renders artifact content by type\n *\n * Supports rendering charts, tables, markdown, fusion fragments, and more.\n */\nimport { FusionFragmentHandler, FusionFragmentProvider } from '@vertesia/fusion-ux';\nimport DOMPurify from 'dompurify';\nimport { useMemo } from 'react';\nimport { VegaLiteChart } from '../../features/agent/chat/VegaLiteChart';\nimport { useCodeBlockContext } from './CodeBlockContext';\nimport { CodeBlockErrorBoundary, CodeBlockPlaceholder } from './CodeBlockPlaceholder';\n/**\n * Auto-detect render type from content and path\n */\nfunction autoDetectRenderType(content, path, contentType) {\n const ext = path.split('.').pop()?.toLowerCase();\n // SVG files → mockup renderer (inline SVG from text content)\n if (ext === 'svg') {\n return 'mockup';\n }\n // Image extensions (binary → rendered via URL)\n if (['png', 'jpg', 'jpeg', 'gif', 'webp'].includes(ext || '')) {\n return 'image';\n }\n // Markdown\n if (ext === 'md') {\n return 'markdown';\n }\n // CSV as table\n if (ext === 'csv') {\n return 'table';\n }\n // JSON content - try to detect chart or table\n if (contentType === 'json' && typeof content === 'object' && content !== null) {\n const obj = content;\n // Check for Vega-Lite schema\n if (typeof obj.$schema === 'string' && obj.$schema.includes('vega')) {\n return 'vega-lite';\n }\n // Check for wrapped Vega-Lite\n if (obj.library === 'vega-lite' && 'spec' in obj) {\n return 'vega-lite';\n }\n // Check for fusion fragment template with data\n if ('template' in obj && 'data' in obj) {\n return 'fusion-fragment';\n }\n // Check for table data (array of objects)\n if (Array.isArray(content) && content.length > 0 && typeof content[0] === 'object') {\n return 'table';\n }\n }\n // Default to code\n return 'code';\n}\nfunction toVegaLiteSpec(content) {\n if (typeof content !== 'object' || content === null) {\n return null;\n }\n const obj = content;\n if (obj.library === 'vega-lite' && 'spec' in obj && typeof obj.spec === 'object' && obj.spec !== null) {\n return obj;\n }\n if (typeof obj.$schema === 'string' && obj.$schema.includes('vega')) {\n return { library: 'vega-lite', spec: obj };\n }\n return null;\n}\n/**\n * Table renderer for array data or CSV\n */\nfunction TableRenderer({ content }) {\n const { headers, rows } = useMemo(() => {\n if (!Array.isArray(content) || content.length === 0) {\n return { headers: [], rows: [] };\n }\n // Extract headers from first object\n const first = content[0];\n if (typeof first !== 'object' || first === null) {\n return { headers: [], rows: [] };\n }\n const headers = Object.keys(first);\n const rows = content.map(row => headers.map(h => {\n const val = row[h];\n if (val === null || val === undefined)\n return '';\n if (typeof val === 'object')\n return JSON.stringify(val);\n return String(val);\n }));\n return { headers, rows };\n }, [content]);\n if (headers.length === 0) {\n return (_jsx(CodeBlockPlaceholder, { type: \"table\", error: \"No table data found\" }));\n }\n return (_jsxs(\"div\", { className: \"overflow-x-auto\", children: [_jsxs(\"table\", { className: \"min-w-full text-sm border-collapse\", children: [_jsx(\"thead\", { children: _jsx(\"tr\", { className: \"border-b\", children: headers.map((h, i) => (_jsx(\"th\", { className: \"px-3 py-2 text-left font-medium text-muted\", children: h }, i))) }) }), _jsx(\"tbody\", { children: rows.slice(0, 100).map((row, i) => (_jsx(\"tr\", { className: \"border-b border-muted/20\", children: row.map((cell, j) => (_jsx(\"td\", { className: \"px-3 py-2\", children: cell }, j))) }, i))) })] }), rows.length > 100 && (_jsxs(\"div\", { className: \"text-sm text-muted py-2\", children: [\"Showing 100 of \", rows.length, \" rows\"] }))] }));\n}\n/**\n * Code block renderer for raw content\n */\nfunction CodeRenderer({ content, path }) {\n const ext = path.split('.').pop()?.toLowerCase() || '';\n const code = typeof content === 'string' ? content : JSON.stringify(content, null, 2);\n return (_jsx(\"pre\", { className: \"overflow-x-auto p-3 bg-muted/10 rounded text-sm\", children: _jsx(\"code\", { className: `language-${ext}`, children: code }) }));\n}\n/**\n * Sanitize SVG markup using DOMPurify.\n * Allows only safe SVG elements; strips scripts, event handlers, and foreignObject.\n */\nexport function sanitizeSvg(svg) {\n return DOMPurify.sanitize(svg, {\n USE_PROFILES: { svg: true, svgFilters: true },\n ADD_TAGS: ['use'],\n FORBID_TAGS: ['foreignObject'],\n });\n}\n/**\n * Make SVG responsive — remove fixed dimensions, ensure viewBox.\n */\nexport function makeSvgResponsive(svg) {\n return svg.replace(/<svg([^>]*)>/i, (_full, attrs) => {\n let a = attrs;\n if (!/viewBox/i.test(a)) {\n const w = /\\swidth\\s*=\\s*[\"']?(\\d+(?:\\.\\d+)?)/i.exec(a);\n const h = /\\sheight\\s*=\\s*[\"']?(\\d+(?:\\.\\d+)?)/i.exec(a);\n if (w && h)\n a += ` viewBox=\"0 0 ${w[1]} ${h[1]}\"`;\n }\n a = a\n .replace(/\\swidth\\s*=\\s*(?:\"[^\"]*\"|'[^']*'|[^\\s>]+)/i, '')\n .replace(/\\sheight\\s*=\\s*(?:\"[^\"]*\"|'[^']*'|[^\\s>]+)/i, '');\n if (/style=\"/i.test(a)) {\n a = a.replace(/style=\"([^\"]*)\"/i, (_, v) => `style=\"${v};width:100%;height:auto;display:block;max-width:100%;\"`);\n }\n else {\n a += ' style=\"width:100%;height:auto;display:block;max-width:100%;\"';\n }\n if (!/preserveAspectRatio=/i.test(a)) {\n a += ' preserveAspectRatio=\"xMidYMid meet\"';\n }\n return `<svg${a}>`;\n });\n}\n/**\n * Mockup renderer — renders raw SVG content inline after sanitization.\n */\nfunction MockupRenderer({ content }) {\n const processedSvg = useMemo(() => {\n const raw = typeof content === 'string' ? content.trim() : '';\n if (!raw)\n return null;\n return makeSvgResponsive(sanitizeSvg(raw));\n }, [content]);\n if (!processedSvg) {\n return _jsx(CodeBlockPlaceholder, { type: \"expand\", error: \"Empty mockup\" });\n }\n return (_jsx(\"div\", { style: { margin: '16px 0', width: '100%', overflowX: 'auto' }, dangerouslySetInnerHTML: { __html: processedSvg } }));\n}\n/**\n * Image renderer\n */\nfunction ImageRenderer({ content, path }) {\n const url = typeof content === 'string' ? content : '';\n const alt = path.split('/').pop() || 'Artifact image';\n return (_jsx(\"img\", { src: url, alt: alt, className: \"max-w-full h-auto rounded\", loading: \"lazy\" }));\n}\n/**\n * ArtifactContentRenderer - Main component\n *\n * Renders artifact content based on explicit type or auto-detection.\n */\nexport function ArtifactContentRenderer({ content, renderType, path, runId, contentType, }) {\n const { MarkdownRenderer } = useCodeBlockContext();\n // Determine actual render type\n const actualType = useMemo(() => {\n if (renderType !== 'auto') {\n return renderType;\n }\n return autoDetectRenderType(content, path, contentType);\n }, [content, path, contentType, renderType]);\n // Render based on type\n switch (actualType) {\n case 'chart': {\n const spec = toVegaLiteSpec(content);\n if (!spec) {\n return (_jsx(CodeBlockPlaceholder, { type: \"chart\", error: \"Only Vega-Lite charts are supported. Recharts rendering has been retired.\" }));\n }\n return (_jsx(CodeBlockErrorBoundary, { type: \"chart\", fallbackCode: JSON.stringify(content, null, 2), children: _jsx(VegaLiteChart, { spec: spec, artifactRunId: runId }) }));\n }\n case 'vega-lite': {\n const spec = toVegaLiteSpec(content);\n if (!spec) {\n return (_jsx(CodeBlockPlaceholder, { type: \"chart\", error: \"Invalid Vega-Lite specification\" }));\n }\n return (_jsx(CodeBlockErrorBoundary, { type: \"chart\", fallbackCode: JSON.stringify(content, null, 2), children: _jsx(VegaLiteChart, { spec: spec, artifactRunId: runId }) }));\n }\n case 'fusion-fragment': {\n // For fusion fragments, content should have { template, data }\n // Wrap with FusionFragmentProvider to inject VegaLiteChart for embedded charts\n const fragmentContent = content;\n console.log('[ArtifactContentRenderer] fusion-fragment:', {\n hasTemplate: !!fragmentContent.template,\n hasData: !!fragmentContent.data,\n runId,\n hasVegaLiteChart: !!VegaLiteChart,\n });\n if (fragmentContent.template && fragmentContent.data) {\n return (_jsx(CodeBlockErrorBoundary, { type: \"fusion-fragment\", fallbackCode: JSON.stringify(content, null, 2), children: _jsx(FusionFragmentProvider, { data: fragmentContent.data, ChartComponent: VegaLiteChart, artifactRunId: runId, children: _jsx(FusionFragmentHandler, { code: JSON.stringify(fragmentContent.template), data: fragmentContent.data }) }) }));\n }\n // If no data wrapper, treat as template-only (needs context from parent provider)\n return (_jsx(CodeBlockErrorBoundary, { type: \"fusion-fragment\", fallbackCode: JSON.stringify(content, null, 2), children: _jsx(FusionFragmentHandler, { code: JSON.stringify(content) }) }));\n }\n case 'table':\n return (_jsx(CodeBlockErrorBoundary, { type: \"table\", fallbackCode: JSON.stringify(content, null, 2), children: _jsx(TableRenderer, { content: content }) }));\n case 'markdown': {\n const markdownContent = typeof content === 'string' ? content : String(content);\n return (_jsx(CodeBlockErrorBoundary, { type: \"markdown\", fallbackCode: markdownContent, children: MarkdownRenderer ? (_jsx(MarkdownRenderer, { artifactRunId: runId, children: markdownContent })) : (_jsx(\"pre\", { className: \"overflow-x-auto p-3 bg-muted/10 rounded text-sm\", children: _jsx(\"code\", { children: markdownContent }) })) }));\n }\n case 'mockup':\n return (_jsx(CodeBlockErrorBoundary, { type: \"expand\", fallbackCode: typeof content === 'string' ? content : path, children: _jsx(MockupRenderer, { content: content }) }));\n case 'image':\n return (_jsx(CodeBlockErrorBoundary, { type: \"image\", fallbackCode: path, children: _jsx(ImageRenderer, { content: content, path: path }) }));\n case 'code':\n default:\n return _jsx(CodeRenderer, { content: content, path: path });\n }\n}\n//# sourceMappingURL=ArtifactContentRenderer.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport React from \"react\";\nimport { Button } from \"@vertesia/ui/core\";\nimport { useUITranslation } from \"@vertesia/ui/i18n\";\nimport { MarkdownRenderer } from \"@vertesia/ui/widgets\";\nimport { MessageSquare, CheckCircle, XCircle, AlertCircle, HelpCircle, Send } from \"lucide-react\";\nconst VARIANT_STYLES = {\n default: {\n border: \"border-l-attention\",\n bg: \"bg-amber-50 dark:bg-amber-900/20\",\n icon: \"text-attention\",\n },\n warning: {\n border: \"border-l-destructive\",\n bg: \"bg-red-50 dark:bg-red-900/20\",\n icon: \"text-destructive\",\n },\n info: {\n border: \"border-l-info\",\n bg: \"bg-blue-50 dark:bg-blue-900/20\",\n icon: \"text-info\",\n },\n success: {\n border: \"border-l-success\",\n bg: \"bg-green-50 dark:bg-green-900/20\",\n icon: \"text-success\",\n },\n};\nconst VARIANT_ICONS = {\n default: HelpCircle,\n warning: AlertCircle,\n info: MessageSquare,\n success: CheckCircle,\n};\n/**\n * AskUserWidget - A styled component for displaying agent prompts/questions to users\n *\n * Use this when the agent needs user input, confirmation, or selection from options.\n * Supports both option selection and free-form text input.\n */\nexport function AskUserWidget({ question, description, options, onSelect, onMultiSelect, onSubmit, allowFreeResponse = false, multiSelect = false, placeholder, isLoading = false, icon, variant = \"default\", hideIcon = false, hideBorder = false, \n// Styling props\nclassName, cardClassName, headerClassName, iconClassName, questionClassName, descriptionClassName, optionsClassName, buttonClassName, inputContainerClassName, inputClassName, submitButtonClassName, }) {\n const { t } = useUITranslation();\n const resolvedPlaceholder = placeholder ?? t('agent.typeYourResponse');\n const [inputValue, setInputValue] = React.useState(\"\");\n const [selectedOptions, setSelectedOptions] = React.useState(new Set());\n const inputRef = React.useRef(null);\n const styles = VARIANT_STYLES[variant];\n const DefaultIcon = VARIANT_ICONS[variant];\n const toggleOption = (optionId) => {\n setSelectedOptions((prev) => {\n const next = new Set(prev);\n if (next.has(optionId)) {\n next.delete(optionId);\n }\n else {\n next.add(optionId);\n }\n return next;\n });\n };\n const handleMultiSubmit = () => {\n if (selectedOptions.size > 0 && onMultiSelect) {\n onMultiSelect(Array.from(selectedOptions));\n setSelectedOptions(new Set());\n }\n };\n const handleSubmit = () => {\n if (inputValue.trim() && onSubmit) {\n onSubmit(inputValue.trim());\n setInputValue(\"\");\n }\n };\n const handleKeyDown = (e) => {\n if (e.key === \"Enter\" && !e.shiftKey) {\n e.preventDefault();\n handleSubmit();\n }\n };\n const borderClass = hideBorder ? \"\" : `border-l-4 ${styles.border}`;\n return (_jsx(\"div\", { className: `my-4 font-sans ${className || \"\"}`, children: _jsxs(\"div\", { className: `${borderClass} ${styles.bg} rounded-r-lg shadow-sm ${cardClassName || \"\"}`, children: [_jsx(\"div\", { className: `px-4 py-3 ${headerClassName || \"\"}`, children: _jsxs(\"div\", { className: \"flex items-start gap-3\", children: [!hideIcon && (_jsx(\"div\", { className: `flex-shrink-0 mt-0.5 ${styles.icon} ${iconClassName || \"\"}`, children: icon || _jsx(DefaultIcon, { className: \"size-5\" }) })), _jsxs(\"div\", { className: \"flex-1 min-w-0\", children: [_jsx(\"div\", { className: `prose prose-sm dark:prose-invert max-w-none text-gray-900 dark:text-gray-100 ${questionClassName || \"\"}`, children: _jsx(MarkdownRenderer, { children: question }) }), description && (_jsx(\"p\", { className: `mt-1 text-sm text-gray-600 dark:text-gray-400 ${descriptionClassName || \"\"}`, children: description }))] })] }) }), options && options.length > 0 && (_jsx(\"div\", { className: `px-4 pb-3 pt-1 ${optionsClassName || \"\"}`, children: multiSelect ? (\n /* Multi-select mode with checkboxes */\n _jsxs(\"div\", { className: \"space-y-2\", children: [options.map((option) => (_jsxs(\"label\", { className: `flex items-start gap-3 px-4 py-3 rounded-lg cursor-pointer transition-colors\n ${selectedOptions.has(option.id)\n ? \"bg-blue-50 dark:bg-blue-900/30 border border-blue-300 dark:border-blue-700\"\n : \"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-700\"}\n ${isLoading ? \"opacity-50 cursor-not-allowed\" : \"\"}`, children: [_jsx(\"input\", { type: \"checkbox\", checked: selectedOptions.has(option.id), onChange: () => toggleOption(option.id), disabled: isLoading, className: \"mt-0.5 w-4 h-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700\" }), _jsxs(\"div\", { className: \"flex-1 overflow-hidden\", children: [_jsxs(\"div\", { className: \"flex items-center gap-2 text-sm font-medium text-gray-900 dark:text-gray-100 break-words\", children: [option.icon, _jsx(\"span\", { className: \"break-words\", children: option.label })] }), option.description && (_jsx(\"div\", { className: \"mt-1 text-sm text-gray-500 dark:text-gray-400 break-words whitespace-pre-wrap\", children: option.description }))] })] }, option.id))), _jsx(\"div\", { className: \"pt-2\", children: _jsxs(Button, { size: \"sm\", onClick: handleMultiSubmit, disabled: isLoading || selectedOptions.size === 0, className: \"flex items-center gap-2\", children: [_jsx(Send, { className: \"size-4\" }), selectedOptions.size > 0 ? t('agent.submitSelectionCount', { count: selectedOptions.size }) : t('agent.submitSelection')] }) })] })) : (\n /* Single-select mode - always use full-width card layout for clarity */\n _jsx(\"div\", { className: \"flex flex-col gap-2 w-full\", children: options.map((option) => (_jsx(\"button\", { onClick: () => onSelect?.(option.id), disabled: isLoading, className: `w-full text-left px-4 py-3 rounded-lg border border-gray-200 dark:border-gray-700\n bg-white dark:bg-gray-800\n hover:bg-gray-50 dark:hover:bg-gray-700 hover:border-gray-300 dark:hover:border-gray-600\n focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-1\n transition-colors\n ${isLoading ? \"opacity-50 cursor-not-allowed\" : \"cursor-pointer\"}\n ${buttonClassName || \"\"}`, children: _jsxs(\"div\", { className: \"flex items-start gap-3\", children: [option.icon && (_jsx(\"span\", { className: \"flex-shrink-0 mt-0.5 text-gray-500 dark:text-gray-400\", children: option.icon })), _jsxs(\"div\", { className: \"flex-1 overflow-hidden\", children: [_jsx(\"div\", { className: \"font-medium text-sm text-gray-900 dark:text-gray-100 break-words\", children: option.label }), option.description && (_jsx(\"div\", { className: \"mt-1 text-sm text-gray-500 dark:text-gray-400 break-words whitespace-pre-wrap\", children: option.description }))] })] }) }, option.id))) })) })), allowFreeResponse && (_jsx(\"div\", { className: `px-4 pb-3 pt-1 ${inputContainerClassName || \"\"}`, children: _jsxs(\"div\", { className: \"flex gap-2\", children: [_jsx(\"input\", { ref: inputRef, type: \"text\", value: inputValue, onChange: (e) => setInputValue(e.target.value), onKeyDown: handleKeyDown, placeholder: resolvedPlaceholder, disabled: isLoading, className: `flex-1 px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-800 focus:ring-2 focus:ring-blue-500 focus:border-transparent ${inputClassName || \"\"}` }), _jsx(Button, { size: \"sm\", onClick: handleSubmit, disabled: isLoading || !inputValue.trim(), className: submitButtonClassName, children: isLoading ? \"...\" : t('agent.send') })] }) }))] }) }));\n}\nexport function ConfirmationWidget({ question, description, onConfirm, onCancel, confirmLabel, cancelLabel, isLoading = false, variant = \"default\", className, }) {\n const { t } = useUITranslation();\n const resolvedConfirmLabel = confirmLabel ?? t('agent.yes');\n const resolvedCancelLabel = cancelLabel ?? t('agent.no');\n return (_jsx(AskUserWidget, { question: question, description: description, variant: variant, isLoading: isLoading, className: className, options: [\n {\n id: \"confirm\",\n label: resolvedConfirmLabel,\n icon: _jsx(CheckCircle, { className: \"size-4\" }),\n },\n {\n id: \"cancel\",\n label: resolvedCancelLabel,\n icon: _jsx(XCircle, { className: \"size-4\" }),\n },\n ], onSelect: (id) => {\n if (id === \"confirm\")\n onConfirm();\n else\n onCancel();\n } }));\n}\n//# sourceMappingURL=AskUserWidget.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { useEffect, useRef, useState, useId } from 'react';\nimport mermaid from 'mermaid';\nconst MERMAID_FONT_FAMILY = 'Inter, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif';\n/**\n * Browser-side Mermaid normalization:\n * - Convert escaped newlines in quoted labels (`\\n`, `\\\\n`) to HTML line breaks.\n * Mermaid web rendering handles `<br/>` labels more reliably than escaped `\\n`.\n */\nfunction normalizeMermaidCodeForBrowser(code) {\n const trimmed = code.trim();\n let normalized = '';\n let inDoubleQuote = false;\n let inSingleQuote = false;\n for (let i = 0; i < trimmed.length; i++) {\n const char = trimmed[i];\n const prev = i > 0 ? trimmed[i - 1] : '';\n if (char === '\"' && !inSingleQuote && prev !== '\\\\') {\n inDoubleQuote = !inDoubleQuote;\n normalized += char;\n continue;\n }\n if (char === \"'\" && !inDoubleQuote && prev !== '\\\\') {\n inSingleQuote = !inSingleQuote;\n normalized += char;\n continue;\n }\n if ((inDoubleQuote || inSingleQuote) && char === '\\\\') {\n let j = i;\n while (trimmed[j] === '\\\\') {\n j++;\n }\n if (trimmed[j] === 'n') {\n normalized += '<br/>';\n i = j;\n continue;\n }\n }\n normalized += char;\n }\n return normalized;\n}\n/**\n * Force Mermaid SVG output to scale with container width.\n * This keeps text and shapes proportional when the container shrinks/expands.\n */\nfunction makeSvgResponsive(svg) {\n return svg.replace(/<svg([^>]*)>/i, (_full, attrs) => {\n let nextAttrs = attrs\n .replace(/\\swidth=\"[^\"]*\"/i, '')\n .replace(/\\sheight=\"[^\"]*\"/i, '');\n if (/style=\"/i.test(nextAttrs)) {\n nextAttrs = nextAttrs.replace(/style=\"([^\"]*)\"/i, (_styleFull, styleValue) => `style=\"${styleValue};width:100%;height:auto;display:block;max-width:100%;\"`);\n }\n else {\n nextAttrs += ' style=\"width:100%;height:auto;display:block;max-width:100%;\"';\n }\n if (!/preserveAspectRatio=/i.test(nextAttrs)) {\n nextAttrs += ' preserveAspectRatio=\"xMidYMid meet\"';\n }\n return `<svg${nextAttrs}>`;\n });\n}\n// Initialize mermaid with a browser-focused config close to Mermaid Playground defaults.\nmermaid.initialize({\n startOnLoad: false,\n theme: 'default',\n securityLevel: 'loose',\n fontFamily: MERMAID_FONT_FAMILY,\n suppressErrorRendering: true,\n flowchart: {\n htmlLabels: true,\n useMaxWidth: true,\n nodeSpacing: 40,\n rankSpacing: 50,\n padding: 12,\n },\n sequence: {\n useMaxWidth: true,\n },\n themeVariables: {\n fontFamily: MERMAID_FONT_FAMILY,\n },\n});\n/**\n * MermaidDiagram - Renders mermaid diagram code as SVG\n *\n * Supports all mermaid diagram types including:\n * - flowchart/graph\n * - sequence\n * - class\n * - state\n * - er (entity relationship)\n * - gantt\n * - pie\n * - mindmap\n * - timeline\n * - and more\n */\nexport function MermaidDiagram({ code, className }) {\n const containerRef = useRef(null);\n const [svg, setSvg] = useState(null);\n const [error, setError] = useState(null);\n const uniqueId = useId().replace(/:/g, '_');\n useEffect(() => {\n let cancelled = false;\n const renderDiagram = async () => {\n if (!code.trim()) {\n setSvg(null);\n setError(null);\n return;\n }\n try {\n // Reset error state\n setError(null);\n // Generate unique ID for this render\n const id = `mermaid-${uniqueId}-${Date.now()}`;\n const normalizedCode = normalizeMermaidCodeForBrowser(code);\n // Render the diagram\n const { svg: renderedSvg } = await mermaid.render(id, normalizedCode);\n const responsiveSvg = makeSvgResponsive(renderedSvg);\n if (!cancelled) {\n setSvg(responsiveSvg);\n }\n }\n catch (err) {\n if (!cancelled) {\n const message = err instanceof Error ? err.message : 'Failed to render mermaid diagram';\n setError(message);\n setSvg(null);\n }\n }\n };\n renderDiagram();\n return () => {\n cancelled = true;\n };\n }, [code, uniqueId]);\n // Silently ignore mermaid syntax errors - just render nothing\n if (error) {\n return null;\n }\n if (!svg) {\n return (_jsx(\"div\", { className: `my-4 p-4 bg-gray-50 dark:bg-gray-800 rounded-lg animate-pulse ${className || ''}`, children: _jsx(\"div\", { className: \"h-32 bg-gray-200 dark:bg-gray-700 rounded\" }) }));\n }\n return (_jsx(\"div\", { ref: containerRef, className: `my-4 w-full overflow-x-auto [&_svg]:mx-auto [&_svg]:w-full [&_svg]:h-auto [&_svg]:max-w-full ${className || ''}`, dangerouslySetInnerHTML: { __html: svg } }));\n}\n//# sourceMappingURL=MermaidDiagram.js.map","/**\n * useArtifactContent - Hook to fetch artifact content from GCS\n *\n * Used by expand:* code blocks to fetch and render artifact content inline.\n */\nimport { useState, useEffect, useCallback, useRef } from 'react';\nimport { useUserSession } from '@vertesia/ui/session';\nimport { useArtifactUrlCache, getArtifactCacheKey, } from '../../features/agent/chat/useArtifactUrlCache';\n/**\n * Detect content type from path extension\n */\nfunction detectContentType(path) {\n const ext = path.split('.').pop()?.toLowerCase();\n switch (ext) {\n case 'json':\n return 'json';\n case 'md':\n case 'txt':\n case 'csv':\n case 'yaml':\n case 'yml':\n return 'text';\n case 'png':\n case 'jpg':\n case 'jpeg':\n case 'gif':\n case 'webp':\n case 'pdf':\n return 'binary';\n default:\n return 'text';\n }\n}\n/**\n * Hook to fetch artifact content from GCS.\n * Handles caching, loading states, and error handling.\n *\n * @example\n * ```tsx\n * const { data, isLoading, error } = useArtifactContent({\n * runId: artifactRunId,\n * path: 'direct/chart_123.json'\n * });\n * ```\n */\nexport function useArtifactContent({ runId, path, parseJson = true, }) {\n const { client } = useUserSession();\n const urlCache = useArtifactUrlCache();\n // Use refs to avoid triggering effect re-runs\n const clientRef = useRef(client);\n clientRef.current = client;\n const urlCacheRef = useRef(urlCache);\n urlCacheRef.current = urlCache;\n const [state, setState] = useState({\n data: undefined,\n rawContent: undefined,\n isLoading: true,\n error: undefined,\n contentType: undefined,\n });\n const [retryCount, setRetryCount] = useState(0);\n const fetchContent = useCallback(async () => {\n if (!runId) {\n setState({\n data: undefined,\n rawContent: undefined,\n isLoading: false,\n error: 'No run ID provided',\n contentType: undefined,\n });\n return;\n }\n if (!path) {\n setState({\n data: undefined,\n rawContent: undefined,\n isLoading: false,\n error: 'No artifact path provided',\n contentType: undefined,\n });\n return;\n }\n setState(prev => ({ ...prev, isLoading: true, error: undefined }));\n const currentClient = clientRef.current;\n const currentUrlCache = urlCacheRef.current;\n const contentType = detectContentType(path);\n try {\n // Get signed URL for the artifact\n const cacheKey = getArtifactCacheKey(runId, path, 'inline');\n let signedUrl;\n if (currentUrlCache) {\n signedUrl = await currentUrlCache.getOrFetch(cacheKey, async () => {\n const result = await currentClient.files.getArtifactDownloadUrl(runId, path, 'inline');\n return result.url;\n });\n }\n else {\n const result = await currentClient.files.getArtifactDownloadUrl(runId, path, 'inline');\n signedUrl = result.url;\n }\n // Fetch the actual content\n const response = await fetch(signedUrl);\n if (!response.ok) {\n throw new Error(`Failed to fetch artifact: ${response.status} ${response.statusText}`);\n }\n // For binary content, return the URL instead\n if (contentType === 'binary') {\n setState({\n data: signedUrl,\n rawContent: undefined,\n isLoading: false,\n error: undefined,\n contentType,\n });\n return;\n }\n const rawContent = await response.text();\n // Parse JSON if requested and content is JSON\n let data;\n if (parseJson && contentType === 'json') {\n try {\n data = JSON.parse(rawContent);\n }\n catch {\n // If JSON parse fails, treat as text\n data = rawContent;\n }\n }\n else {\n data = rawContent;\n }\n setState({\n data,\n rawContent,\n isLoading: false,\n error: undefined,\n contentType,\n });\n }\n catch (err) {\n const errorMessage = err instanceof Error ? err.message : 'Failed to fetch artifact';\n console.error('Failed to fetch artifact content:', path, err);\n setState({\n data: undefined,\n rawContent: undefined,\n isLoading: false,\n error: errorMessage,\n contentType,\n });\n }\n }, [runId, path, parseJson]);\n useEffect(() => {\n fetchContent();\n }, [fetchContent, retryCount]);\n const retry = useCallback(() => {\n setState({\n data: undefined,\n rawContent: undefined,\n isLoading: true,\n error: undefined,\n contentType: undefined,\n });\n setRetryCount(c => c + 1);\n }, []);\n return {\n data: state.data,\n rawContent: state.rawContent,\n isLoading: state.isLoading,\n error: state.error,\n contentType: state.contentType,\n retry,\n };\n}\n//# sourceMappingURL=useArtifactContent.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { useMemo } from 'react';\nimport { AskUserWidget } from '../../features/agent/chat/AskUserWidget';\nimport { VegaLiteChart } from '../../features/agent/chat/VegaLiteChart';\nimport { ArtifactContentRenderer, makeSvgResponsive, sanitizeSvg } from './ArtifactContentRenderer';\nimport { useCodeBlockContext } from './CodeBlockContext';\nimport { CodeBlockErrorBoundary, CodeBlockPlaceholder } from './CodeBlockPlaceholder';\nimport { MermaidDiagram } from './MermaidDiagram';\nimport { useArtifactContent } from './useArtifactContent';\n/**\n * Check if JSON parsing failed due to incomplete content (streaming)\n * vs actually invalid JSON structure\n */\nfunction isIncompleteJson(code) {\n const trimmed = code.trim();\n // Empty or very short content is likely incomplete\n if (trimmed.length < 2)\n return true;\n // Must start with { for a valid JSON object\n if (!trimmed.startsWith('{'))\n return false;\n // Try to parse - if it succeeds, it's not incomplete\n try {\n JSON.parse(trimmed);\n return false; // Valid JSON\n }\n catch (e) {\n const message = e instanceof Error ? e.message : '';\n // Common indicators of incomplete JSON during streaming\n const incompleteIndicators = [\n 'unexpected end',\n 'unterminated string',\n 'expected',\n 'unexpected token',\n ];\n const lowerMessage = message.toLowerCase();\n if (incompleteIndicators.some(ind => lowerMessage.includes(ind))) {\n // Additional check: count brackets to see if they're unbalanced\n let braceCount = 0;\n let bracketCount = 0;\n let inString = false;\n let escaped = false;\n for (const char of trimmed) {\n if (escaped) {\n escaped = false;\n continue;\n }\n if (char === '\\\\') {\n escaped = true;\n continue;\n }\n if (char === '\"') {\n inString = !inString;\n continue;\n }\n if (!inString) {\n if (char === '{')\n braceCount++;\n else if (char === '}')\n braceCount--;\n else if (char === '[')\n bracketCount++;\n else if (char === ']')\n bracketCount--;\n }\n }\n // If brackets are unbalanced or we're in an unclosed string, it's incomplete\n return braceCount > 0 || bracketCount > 0 || inString;\n }\n // For other parse errors, consider it invalid rather than incomplete\n return false;\n }\n}\n/**\n * Parses chart JSON from code block content.\n * Handles cases where extra content is appended after the JSON.\n */\nfunction parseChartJson(code) {\n try {\n let raw = code.trim();\n const jsonStart = raw.indexOf('{');\n const jsonEnd = raw.lastIndexOf('}');\n if (jsonStart !== -1 && jsonEnd > jsonStart) {\n raw = raw.slice(jsonStart, jsonEnd + 1);\n }\n return JSON.parse(raw);\n }\n catch {\n return null;\n }\n}\n/**\n * Detects the chart library from a parsed spec\n */\nfunction detectChartLibrary(spec) {\n // Detect Vega-Lite by $schema containing \"vega\"\n const hasVegaSchema = typeof spec.$schema === 'string' && spec.$schema.includes('vega');\n const isExplicitVegaLite = spec.library === 'vega-lite' && 'spec' in spec;\n if (hasVegaSchema || isExplicitVegaLite) {\n return 'vega-lite';\n }\n return null;\n}\n/**\n * Vega-Lite code block handler\n * Always renders with VegaLiteChart directly - no routing through AgentChart\n */\nexport function VegaLiteCodeBlockHandler({ code }) {\n const { artifactRunId } = useCodeBlockContext();\n if (!artifactRunId) {\n console.warn('[VegaLiteCodeBlockHandler] artifactRunId is missing from CodeBlockContext');\n }\n // Check if JSON is incomplete (streaming in progress)\n const incomplete = useMemo(() => isIncompleteJson(code), [code]);\n const chartSpec = useMemo(() => {\n if (incomplete)\n return null;\n const spec = parseChartJson(code);\n if (!spec)\n return null;\n // Wrap as VegaLiteChartSpec format\n return { library: 'vega-lite', spec };\n }, [code, incomplete]);\n // Show loading placeholder for incomplete JSON (streaming)\n if (incomplete) {\n return (_jsx(CodeBlockPlaceholder, { type: \"chart\", message: \"Loading chart...\" }));\n }\n if (!chartSpec) {\n return (_jsx(CodeBlockPlaceholder, { type: \"chart\", error: \"Invalid Vega-Lite specification\" }));\n }\n // Render VegaLiteChart directly - bypass AgentChart routing\n return (_jsx(CodeBlockErrorBoundary, { type: \"chart\", fallbackCode: code, children: _jsx(VegaLiteChart, { spec: chartSpec, artifactRunId: artifactRunId }) }));\n}\n/**\n * Chart code block handler\n * `chart` now accepts Vega-Lite specifications only.\n */\nexport function ChartCodeBlockHandler({ code }) {\n const { artifactRunId } = useCodeBlockContext();\n if (!artifactRunId) {\n console.warn('[ChartCodeBlockHandler] artifactRunId is missing from CodeBlockContext');\n }\n // Check if JSON is incomplete (streaming in progress)\n const incomplete = useMemo(() => isIncompleteJson(code), [code]);\n const chartSpec = useMemo(() => {\n if (incomplete)\n return null;\n const spec = parseChartJson(code);\n if (!spec)\n return null;\n const library = detectChartLibrary(spec);\n if (!library)\n return null;\n // If already wrapped, use as-is.\n if (spec.library === 'vega-lite' && 'spec' in spec && typeof spec.spec === 'object') {\n return spec;\n }\n // Native Vega-Lite spec - wrap it.\n return { library: 'vega-lite', spec };\n }, [code, incomplete]);\n // Show loading placeholder for incomplete JSON (streaming)\n if (incomplete) {\n return (_jsx(CodeBlockPlaceholder, { type: \"chart\", message: \"Loading chart...\" }));\n }\n if (!chartSpec) {\n return (_jsx(CodeBlockPlaceholder, { type: \"chart\", error: \"Invalid Vega-Lite chart specification\" }));\n }\n return (_jsx(CodeBlockErrorBoundary, { type: \"chart\", fallbackCode: code, children: _jsx(VegaLiteChart, { spec: chartSpec, artifactRunId: artifactRunId }) }));\n}\n/**\n * Mermaid diagram code block handler\n */\nexport function MermaidCodeBlockHandler({ code }) {\n const trimmedCode = code.trim();\n if (!trimmedCode) {\n return (_jsx(CodeBlockPlaceholder, { type: \"mermaid\", error: \"Empty diagram\" }));\n }\n return (_jsx(CodeBlockErrorBoundary, { type: \"mermaid\", fallbackCode: code, children: _jsx(MermaidDiagram, { code: trimmedCode }) }));\n}\n/**\n * Proposal/AskUser code block handler\n */\nexport function ProposalCodeBlockHandler({ code }) {\n const { onProposalSelect, onProposalSubmit } = useCodeBlockContext();\n // Check if JSON is incomplete (streaming in progress)\n const incomplete = useMemo(() => isIncompleteJson(code), [code]);\n const widgetProps = useMemo(() => {\n if (incomplete)\n return null;\n try {\n const raw = code.trim();\n const spec = JSON.parse(raw);\n if (!spec.options || (!spec.question && !spec.title)) {\n return null;\n }\n const props = {\n question: spec.question || spec.title || '',\n description: spec.description,\n options: Array.isArray(spec.options)\n ? spec.options.map((opt) => ({\n id: opt.id || opt.value || '',\n label: opt.label || '',\n description: opt.description,\n }))\n : undefined,\n allowFreeResponse: spec.allowFreeResponse ?? spec.multiple,\n variant: spec.variant,\n onSelect: onProposalSelect,\n onSubmit: onProposalSubmit,\n };\n if (!props.question || !props.options?.length) {\n return null;\n }\n return props;\n }\n catch {\n return null;\n }\n }, [code, onProposalSelect, onProposalSubmit, incomplete]);\n // Show loading placeholder for incomplete JSON (streaming)\n if (incomplete) {\n return (_jsx(CodeBlockPlaceholder, { type: \"proposal\", message: \"Loading options...\" }));\n }\n if (!widgetProps) {\n return (_jsx(CodeBlockPlaceholder, { type: \"proposal\", error: \"Invalid proposal specification\" }));\n }\n return (_jsx(CodeBlockErrorBoundary, { type: \"proposal\", fallbackCode: code, children: _jsx(AskUserWidget, { ...widgetProps }) }));\n}\n/**\n * Mockup code block handler — renders inline SVG after sanitization.\n */\nexport function MockupCodeBlockHandler({ code }) {\n const processedSvg = useMemo(() => {\n const trimmed = code.trim();\n if (!trimmed)\n return null;\n return makeSvgResponsive(sanitizeSvg(trimmed));\n }, [code]);\n if (!processedSvg) {\n return (_jsx(CodeBlockPlaceholder, { type: \"code\", error: \"Empty mockup\" }));\n }\n return (_jsx(CodeBlockErrorBoundary, { type: \"code\", fallbackCode: code, children: _jsx(\"div\", { style: { margin: '16px 0', width: '100%', overflowX: 'auto' }, dangerouslySetInnerHTML: { __html: processedSvg } }) }));\n}\n/**\n * Expand code block handler - fetches artifact and renders content inline.\n *\n * Usage: ```expand:chart, ```expand:table, ```expand:markdown, ```expand:fusion-fragment, etc.\n * The type after colon specifies the renderer.\n *\n * @example\n * ```expand:chart\n * direct/chart_abc123.json\n * ```\n */\nexport function ExpandCodeBlockHandler({ code, language }) {\n const { artifactRunId } = useCodeBlockContext();\n const artifactPath = code.trim();\n // Extract render type from language (e.g., \"expand:chart\" → \"chart\")\n const renderType = useMemo(() => {\n if (!language?.includes(':')) {\n return 'auto';\n }\n const type = language.split(':')[1];\n // Validate known types\n const validTypes = [\n 'chart', 'vega-lite', 'table', 'markdown',\n 'fusion-fragment', 'mockup', 'code', 'image', 'auto'\n ];\n return validTypes.includes(type) ? type : 'auto';\n }, [language]);\n // Fetch artifact content from GCS\n const { data, isLoading, error, contentType } = useArtifactContent({\n runId: artifactRunId,\n path: artifactPath,\n });\n if (!artifactRunId) {\n return (_jsx(CodeBlockPlaceholder, { type: \"expand\", error: \"No artifact run ID available\" }));\n }\n if (isLoading) {\n return (_jsx(CodeBlockPlaceholder, { type: \"expand\", message: `Loading ${artifactPath}...` }));\n }\n if (error) {\n return (_jsx(CodeBlockPlaceholder, { type: \"expand\", error: `Failed to load artifact: ${error}` }));\n }\n if (data === undefined) {\n return (_jsx(CodeBlockPlaceholder, { type: \"expand\", error: \"No content found in artifact\" }));\n }\n // Render with explicit type\n return (_jsx(ArtifactContentRenderer, { content: data, renderType: renderType, path: artifactPath, runId: artifactRunId, contentType: contentType }));\n}\n/**\n * Check if a language string is an expand:* pattern\n */\nexport function isExpandLanguage(language) {\n return language?.startsWith('expand') ?? false;\n}\n/**\n * Creates the default code block handlers map.\n *\n * These handlers are used as fallbacks when no custom handler is registered\n * via CodeBlockRendererRegistry for a given language. The priority order in\n * MarkdownRenderer is:\n *\n * 1. User-registered handlers (via CodeBlockRendererRegistry)\n * 2. Default handlers (from this function)\n * 3. Existing code component (if passed via components prop)\n * 4. Default <code> element rendering\n *\n * This allows users to override default behavior for specific languages\n * while still getting built-in support for charts, diagrams, and proposals.\n */\nexport function createDefaultCodeBlockHandlers() {\n return {\n // Chart handler for generic chart code blocks (Vega-Lite only)\n chart: ChartCodeBlockHandler,\n // Vega-Lite handlers - always treat as Vega-Lite\n 'vega-lite': VegaLiteCodeBlockHandler,\n 'vegalite': VegaLiteCodeBlockHandler,\n // Mermaid handler\n mermaid: MermaidCodeBlockHandler,\n // Mockup handler (inline SVG)\n mockup: MockupCodeBlockHandler,\n svg: MockupCodeBlockHandler,\n // Proposal handlers\n proposal: ProposalCodeBlockHandler,\n askuser: ProposalCodeBlockHandler,\n };\n}\n//# sourceMappingURL=codeBlockHandlers.js.map","import { jsx as _jsx, Fragment as _Fragment } from \"react/jsx-runtime\";\nimport { createContext, useContext, useMemo } from \"react\";\nexport class CodeBlockRendererRegistry {\n components = {};\n registerComponent(language, component) {\n this.components[language] = component;\n }\n getComponent(language) {\n return this.components[language];\n }\n}\nconst Context = createContext(null);\n/**\n * the compoennts must be memoized to avoid rerendering the provider unnecessarily\n * @param param0\n * @returns\n */\nexport function CodeBlockRendererProvider({ components, children }) {\n const registry = useMemo(() => {\n const registry = new CodeBlockRendererRegistry();\n for (const [language, component] of Object.entries(components)) {\n registry.registerComponent(language, component);\n }\n return registry;\n }, [components]);\n return (_jsx(_Fragment, { children: _jsx(Context.Provider, { value: registry, children: children }) }));\n}\nexport function useCodeBlockRendererRegistry() {\n return useContext(Context);\n}\nexport function useCodeBlockComponent(language) {\n const registry = useContext(Context);\n if (registry) {\n return registry.getComponent(language);\n }\n return undefined;\n}\n//# sourceMappingURL=CodeBlockRendering.js.map","import { useState, useEffect, useCallback, useRef } from 'react';\nimport { useUserSession } from '@vertesia/ui/session';\nimport { useArtifactUrlCache, getArtifactCacheKey, getFileCacheKey, } from '../../features/agent/chat/useArtifactUrlCache';\n/**\n * Parses a URL and returns its scheme and path\n */\nexport function parseUrlScheme(rawUrl) {\n if (rawUrl.startsWith('artifact:')) {\n return { scheme: 'artifact', path: rawUrl.slice(9).trim() };\n }\n if (rawUrl.startsWith('image:')) {\n return { scheme: 'image', path: rawUrl.slice(6).trim() };\n }\n if (rawUrl.startsWith('store:')) {\n return { scheme: 'store', path: rawUrl.slice(6).trim() };\n }\n if (rawUrl.startsWith('document://')) {\n return { scheme: 'document', path: rawUrl.slice(11).trim() };\n }\n if (rawUrl.startsWith('collection:')) {\n return { scheme: 'collection', path: rawUrl.slice(11).trim() };\n }\n return { scheme: 'standard', path: rawUrl };\n}\n/**\n * Maps internal URL schemes to application routes\n */\nexport function mapSchemeToRoute(scheme, path) {\n switch (scheme) {\n case 'store':\n return path ? `/store/objects/${path}` : null;\n case 'document':\n return path ? `/store/objects/${path}` : null;\n case 'collection':\n return path ? `/store/collections/${path}` : null;\n default:\n return null;\n }\n}\n/**\n * Hook to resolve custom URL schemes (artifact:, image:, etc.) to actual URLs.\n * Handles caching, loading states, and error handling.\n */\nexport function useResolvedUrl({ rawUrl, artifactRunId, disposition = 'inline', }) {\n const { client } = useUserSession();\n const urlCache = useArtifactUrlCache();\n // Use refs to avoid triggering effect/callback re-runs when these stable values are accessed\n const clientRef = useRef(client);\n clientRef.current = client;\n const urlCacheRef = useRef(urlCache);\n urlCacheRef.current = urlCache;\n const { scheme, path } = parseUrlScheme(rawUrl);\n // For schemes that map to routes, resolve immediately\n const mappedRoute = mapSchemeToRoute(scheme, path);\n const [state, setState] = useState(() => {\n // If it's a mapped route, use that immediately\n if (mappedRoute) {\n return { url: mappedRoute, isLoading: false, error: undefined };\n }\n // If it's a standard URL, use as-is\n if (scheme === 'standard') {\n return { url: rawUrl, isLoading: false, error: undefined };\n }\n // For artifact/image schemes, check cache first\n if (urlCache && (scheme === 'artifact' || scheme === 'image')) {\n let cacheKey;\n if (scheme === 'artifact' && artifactRunId && !path.startsWith('agents/')) {\n cacheKey = getArtifactCacheKey(artifactRunId, path, disposition);\n }\n else {\n cacheKey = getFileCacheKey(path);\n }\n const cached = urlCache.getUrl(cacheKey);\n if (cached) {\n return { url: cached, isLoading: false, error: undefined };\n }\n }\n // Need to fetch\n return { url: undefined, isLoading: true, error: undefined };\n });\n const [retryCount, setRetryCount] = useState(0);\n const fetchUrl = useCallback(async () => {\n // Skip if already resolved or standard URL\n if (mappedRoute || scheme === 'standard') {\n return;\n }\n // Only artifact and image schemes need async resolution\n if (scheme !== 'artifact' && scheme !== 'image') {\n setState({ url: undefined, isLoading: false, error: `Unknown scheme: ${scheme}` });\n return;\n }\n setState(prev => ({ ...prev, isLoading: true, error: undefined }));\n const currentClient = clientRef.current;\n const currentUrlCache = urlCacheRef.current;\n try {\n let url;\n if (scheme === 'artifact') {\n if (artifactRunId && !path.startsWith('agents/')) {\n const cacheKey = getArtifactCacheKey(artifactRunId, path, disposition);\n if (currentUrlCache) {\n url = await currentUrlCache.getOrFetch(cacheKey, async () => {\n const result = await currentClient.files.getArtifactDownloadUrl(artifactRunId, path, disposition);\n return result.url;\n });\n }\n else {\n const result = await currentClient.files.getArtifactDownloadUrl(artifactRunId, path, disposition);\n url = result.url;\n }\n }\n else {\n const cacheKey = getFileCacheKey(path);\n if (currentUrlCache) {\n url = await currentUrlCache.getOrFetch(cacheKey, async () => {\n const result = await currentClient.files.getDownloadUrl(path);\n return result.url;\n });\n }\n else {\n const result = await currentClient.files.getDownloadUrl(path);\n url = result.url;\n }\n }\n }\n else {\n // image: scheme\n const cacheKey = getFileCacheKey(path);\n if (currentUrlCache) {\n url = await currentUrlCache.getOrFetch(cacheKey, async () => {\n const result = await currentClient.files.getDownloadUrl(path);\n return result.url;\n });\n }\n else {\n const result = await currentClient.files.getDownloadUrl(path);\n url = result.url;\n }\n }\n setState({ url, isLoading: false, error: undefined });\n }\n catch (err) {\n const errorMessage = err instanceof Error ? err.message : 'Failed to resolve URL';\n console.error('Failed to resolve URL:', path, err);\n setState({ url: undefined, isLoading: false, error: errorMessage });\n }\n }, [scheme, path, artifactRunId, disposition, mappedRoute]);\n useEffect(() => {\n // Skip if already resolved\n if (state.url && !state.error) {\n return;\n }\n let cancelled = false;\n const doFetch = async () => {\n await fetchUrl();\n };\n if (!cancelled) {\n doFetch();\n }\n return () => {\n cancelled = true;\n };\n }, [fetchUrl, retryCount, state.url, state.error]);\n const retry = useCallback(() => {\n setState({ url: undefined, isLoading: true, error: undefined });\n setRetryCount(c => c + 1);\n }, []);\n return {\n url: state.url,\n isLoading: state.isLoading,\n error: state.error,\n scheme,\n retry,\n };\n}\n//# sourceMappingURL=useResolvedUrl.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { useResolvedUrl, parseUrlScheme } from './useResolvedUrl';\nimport { CodeBlockPlaceholder } from './CodeBlockPlaceholder';\n/**\n * Markdown figure component for images with captions.\n * Wraps the image in a <figure> element with a <figcaption>.\n *\n * Usage in markdown: ![alt text](image-url \"Caption text\")\n */\nexport function MarkdownFigure({ src, alt, caption, className, artifactRunId, }) {\n const rawSrc = src || '';\n const { scheme } = parseUrlScheme(rawSrc);\n // For standard URLs, render directly\n if (scheme === 'standard') {\n return (_jsxs(\"figure\", { className: \"my-4\", children: [_jsx(\"img\", { src: src, alt: alt, className: className }), _jsx(\"figcaption\", { className: \"mt-2 text-sm text-muted text-center italic\", children: caption })] }));\n }\n // For artifact: and image: URLs, use the resolver\n return (_jsx(ResolvedFigure, { rawSrc: rawSrc, alt: alt, caption: caption, artifactRunId: artifactRunId, className: className }));\n}\n/**\n * Internal component for figures that need async URL resolution\n */\nfunction ResolvedFigure({ rawSrc, alt, caption, artifactRunId, className, }) {\n const { url, isLoading, error, retry } = useResolvedUrl({\n rawUrl: rawSrc,\n artifactRunId,\n disposition: 'inline',\n });\n if (isLoading) {\n return _jsx(CodeBlockPlaceholder, { type: \"image\", message: alt ? `Loading ${alt}...` : undefined });\n }\n if (error) {\n return (_jsx(CodeBlockPlaceholder, { type: \"image\", error: error, onRetry: retry }));\n }\n if (!url) {\n return null;\n }\n return (_jsxs(\"figure\", { className: \"my-4\", children: [_jsx(\"img\", { src: url, alt: alt, className: className }), _jsx(\"figcaption\", { className: \"mt-2 text-sm text-muted text-center italic\", children: caption })] }));\n}\n//# sourceMappingURL=MarkdownFigure.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { useResolvedUrl, parseUrlScheme } from './useResolvedUrl';\nimport { CodeBlockPlaceholder } from './CodeBlockPlaceholder';\n/**\n * Markdown image component with support for custom URL schemes.\n * Handles artifact: and image: URLs with loading states and error handling.\n */\nexport function MarkdownImage({ node, src, alt, className, artifactRunId, ExistingImg, ...rest }) {\n const rawSrc = src || '';\n const { scheme } = parseUrlScheme(rawSrc);\n // For standard URLs, delegate to existing component or render directly\n if (scheme === 'standard') {\n if (typeof ExistingImg === 'function') {\n return _jsx(ExistingImg, { node: node, src: src, alt: alt, ...rest });\n }\n return _jsx(\"img\", { src: src, alt: alt, className: className, ...rest });\n }\n // For artifact: and image: URLs, use the resolver\n return (_jsx(ResolvedImage, { rawSrc: rawSrc, alt: alt, artifactRunId: artifactRunId, className: className, rest: rest }));\n}\n/**\n * Internal component for images that need async URL resolution\n */\nfunction ResolvedImage({ rawSrc, alt, artifactRunId, className, rest, }) {\n const { url, isLoading, error, retry } = useResolvedUrl({\n rawUrl: rawSrc,\n artifactRunId,\n disposition: 'inline',\n });\n if (isLoading) {\n return _jsx(CodeBlockPlaceholder, { type: \"image\", message: alt ? `Loading ${alt}...` : undefined });\n }\n if (error) {\n return (_jsx(CodeBlockPlaceholder, { type: \"image\", error: error, onRetry: retry }));\n }\n if (!url) {\n return null;\n }\n return _jsx(\"img\", { src: url, alt: alt, className: className, ...rest });\n}\n//# sourceMappingURL=MarkdownImage.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { useResolvedUrl, parseUrlScheme, mapSchemeToRoute } from './useResolvedUrl';\nimport { CodeBlockPlaceholder } from './CodeBlockPlaceholder';\n/**\n * Markdown link component with support for custom URL schemes.\n * Handles artifact:, image:, store:, document://, and collection: URLs.\n */\nexport function MarkdownLink({ node, href, children, className, artifactRunId, ExistingLink, ...rest }) {\n const rawHref = href || '';\n const { scheme, path } = parseUrlScheme(rawHref);\n // For schemes that map directly to routes (store:, document://, collection:)\n const mappedRoute = mapSchemeToRoute(scheme, path);\n if (mappedRoute) {\n if (typeof ExistingLink === 'function') {\n return (_jsx(ExistingLink, { node: node, href: mappedRoute, ...rest, children: children }));\n }\n return (_jsx(\"a\", { href: mappedRoute, ...rest, className: className, target: \"_blank\", rel: \"noopener noreferrer\", children: children }));\n }\n // For standard URLs, delegate to existing component or render directly\n if (scheme === 'standard') {\n if (typeof ExistingLink === 'function') {\n return (_jsx(ExistingLink, { node: node, href: href, ...rest, children: children }));\n }\n return (_jsx(\"a\", { href: href, ...rest, className: className, target: \"_blank\", rel: \"noopener noreferrer\", children: children }));\n }\n // For artifact: and image: URLs, use the resolver\n return (_jsx(ResolvedLink, { rawHref: rawHref, artifactRunId: artifactRunId, className: className, rest: rest, children: children }));\n}\n/**\n * Internal component for links that need async URL resolution\n */\nfunction ResolvedLink({ rawHref, artifactRunId, className, children, rest, }) {\n const { url, isLoading, error, retry } = useResolvedUrl({\n rawUrl: rawHref,\n artifactRunId,\n disposition: 'attachment',\n });\n if (isLoading) {\n return (_jsx(\"span\", { className: \"inline-flex items-center gap-1 text-muted\", children: _jsx(CodeBlockPlaceholder, { type: \"link\" }) }));\n }\n if (error) {\n return (_jsx(\"span\", { className: \"inline-flex items-center gap-1\", children: _jsx(CodeBlockPlaceholder, { type: \"link\", error: error, onRetry: retry }) }));\n }\n return (_jsx(\"a\", { href: url || '#', ...rest, className: className, target: \"_blank\", rel: \"noopener noreferrer\", children: children }));\n}\n//# sourceMappingURL=MarkdownLink.js.map","const CUSTOM_SCHEME_PREFIXES = [\n 'artifact:',\n 'image:',\n 'store:',\n 'document://',\n 'collection:',\n];\nconst CUSTOM_LINK_REGEX = /(!?\\[[^\\]\\n]*\\]\\()((?:artifact:|image:|store:|document:\\/\\/|collection:)[^)]+)(\\))/g;\nconst INLINE_CODE_REGEX = /`[^`\\n]*`/g;\nconst FENCED_CODE_BLOCK_REGEX = /(^|\\n)(`{3,}|~{3,})[^\\n]*\\n[\\s\\S]*?\\n\\2(?=\\n|$)/g;\nconst LINK_TITLE_SUFFIX_REGEX = /\\s+(\"(?:[^\"\\\\]|\\\\.)*\"|'(?:[^'\\\\]|\\\\.)*'|\\([^)]*\\))\\s*$/;\nfunction hasCustomScheme(destination) {\n return CUSTOM_SCHEME_PREFIXES.some(prefix => destination.startsWith(prefix));\n}\nfunction wrapCustomDestination(destinationWithOptionalTitle) {\n const trimmed = destinationWithOptionalTitle.trim();\n // Preserve already angle-bracketed custom destinations.\n if (trimmed.startsWith('<')) {\n const closeIdx = trimmed.indexOf('>');\n if (closeIdx > 0) {\n const bracketedDestination = trimmed.slice(1, closeIdx).trim();\n if (hasCustomScheme(bracketedDestination)) {\n return destinationWithOptionalTitle;\n }\n }\n }\n const titleMatch = trimmed.match(LINK_TITLE_SUFFIX_REGEX);\n const titleStart = titleMatch?.index ?? -1;\n const destination = (titleStart >= 0 ? trimmed.slice(0, titleStart) : trimmed).trim();\n const title = titleStart >= 0 ? trimmed.slice(titleStart) : '';\n if (!hasCustomScheme(destination)) {\n return destinationWithOptionalTitle;\n }\n return `<${destination}>${title}`;\n}\nfunction normalizeCustomLinksInText(text) {\n return text.replace(CUSTOM_LINK_REGEX, (_fullMatch, open, destination, close) => {\n return `${open}${wrapCustomDestination(destination)}${close}`;\n });\n}\nfunction normalizeOutsideInlineCode(text) {\n let result = '';\n let lastIndex = 0;\n let match;\n INLINE_CODE_REGEX.lastIndex = 0;\n while ((match = INLINE_CODE_REGEX.exec(text)) !== null) {\n result += normalizeCustomLinksInText(text.slice(lastIndex, match.index));\n result += match[0];\n lastIndex = match.index + match[0].length;\n }\n result += normalizeCustomLinksInText(text.slice(lastIndex));\n return result;\n}\n/**\n * Normalizes inline markdown links/images with custom URL schemes so they parse\n * correctly even when paths contain spaces (e.g. artifact:out/INVOICE 2025-001.pdf).\n *\n * CommonMark requires destinations with spaces to be wrapped in <...>.\n * We apply this only outside fenced/inline code spans.\n */\nexport function normalizeCustomSchemeLinks(markdown) {\n if (!markdown || !CUSTOM_SCHEME_PREFIXES.some(prefix => markdown.includes(prefix))) {\n return markdown;\n }\n let result = '';\n let lastIndex = 0;\n let match;\n FENCED_CODE_BLOCK_REGEX.lastIndex = 0;\n while ((match = FENCED_CODE_BLOCK_REGEX.exec(markdown)) !== null) {\n result += normalizeOutsideInlineCode(markdown.slice(lastIndex, match.index));\n result += match[0];\n lastIndex = match.index + match[0].length;\n }\n result += normalizeOutsideInlineCode(markdown.slice(lastIndex));\n return result;\n}\n//# sourceMappingURL=normalizeCustomSchemeLinks.js.map","/**\n * Normalize Pandoc-style single-line fenced divs into remark-directive syntax.\n *\n * Pandoc allows single-line containers:\n * ::: pagebreak :::\n * ::: tip Some content here. :::\n *\n * remark-directive requires multi-line containers:\n * :::pagebreak\n * :::\n *\n * :::tip\n * Some content here.\n * :::\n *\n * This preprocessor converts the single-line form into multi-line so that\n * remark-directive can parse them correctly.\n */\n/**\n * Regex matching a single-line fenced div:\n * ::: name optional-content :::\n *\n * Groups:\n * [1] leading indent\n * [2] directive name (word chars only)\n * [3] optional inline content (may be empty)\n *\n * Only matches when both opening and closing ::: are on the SAME line,\n * so it won't interfere with properly formatted multi-line containers.\n */\nconst SINGLE_LINE_DIRECTIVE = /^([ \\t]*):::\\s*(\\w+)\\s*(.*?)\\s*:::[ \\t]*$/gm;\nexport function normalizeDirectives(markdown) {\n if (!markdown || !markdown.includes(':::')) {\n return markdown;\n }\n return markdown.replace(SINGLE_LINE_DIRECTIVE, (_match, indent, name, content) => {\n if (content) {\n // Has content → multi-line container directive\n return `${indent}:::${name}\\n${indent}${content}\\n${indent}:::`;\n }\n // No content → leaf directive (::name)\n return `${indent}::${name}`;\n });\n}\n//# sourceMappingURL=normalizeDirectives.js.map","/**\n * Custom remark plugin that transforms remark-directive nodes into\n * HTML elements for columns layout and callout containers.\n *\n * Supported directives:\n * :::columns → <div class=\"md-columns\">\n * :::column{width=50%}→ <div class=\"md-column\" style=\"width:50%\">\n * :::note / :::warning / :::tip / :::caution / :::important → callout <div>s\n * :::name → <div class=\"md-name\"> (generic fallback)\n */\nimport { visit } from 'unist-util-visit';\n// Callout types mapped to CSS modifier classes (semantic design system)\nconst CALLOUT_TYPES = {\n note: 'md-callout-info',\n tip: 'md-callout-info',\n warning: 'md-callout-attention',\n important: 'md-callout-attention',\n caution: 'md-callout-destructive',\n};\nconst CALLOUT_LABELS = {\n note: 'Note',\n tip: 'Tip',\n warning: 'Warning',\n important: 'Important',\n caution: 'Caution',\n};\nexport function remarkDirectiveHandler() {\n return (tree) => {\n visit(tree, (node) => {\n if (node.type !== 'containerDirective' &&\n node.type !== 'leafDirective' &&\n node.type !== 'textDirective') {\n return;\n }\n const d = node;\n const data = d.data || (d.data = {});\n const attrs = d.attributes || {};\n const name = d.name;\n // ::pagebreak / :::pagebreak → visual page break indicator\n if (name === 'pagebreak') {\n data.hName = 'hr';\n data.hProperties = { className: 'md-pagebreak' };\n return;\n }\n // :::columns → flex container\n if (name === 'columns') {\n data.hName = 'div';\n data.hProperties = { className: 'md-columns' };\n return;\n }\n // :::column{width=50%} → flex child with optional width\n if (name === 'column') {\n data.hName = 'div';\n const props = { className: 'md-column' };\n if (attrs.width) {\n props.style = `flex-basis:${attrs.width};flex-grow:0;flex-shrink:0`;\n }\n data.hProperties = props;\n return;\n }\n // Callout types\n if (name in CALLOUT_TYPES) {\n data.hName = 'div';\n data.hProperties = {\n className: `md-callout ${CALLOUT_TYPES[name]}`,\n 'data-callout-type': name,\n };\n // Prepend a title paragraph\n const label = CALLOUT_LABELS[name];\n if (label && d.children) {\n const titleNode = {\n type: 'paragraph',\n data: {\n hName: 'p',\n hProperties: { className: 'md-callout-title' },\n },\n children: [{ type: 'text', value: label }],\n };\n d.children.unshift(titleNode);\n }\n return;\n }\n // Generic fallback: :::name → <div class=\"md-name\">\n data.hName = 'div';\n data.hProperties = {\n className: `md-${name}`,\n ...Object.fromEntries(Object.entries(attrs).filter(([k]) => k !== 'class')),\n };\n if (attrs.class) {\n data.hProperties.className += ` ${attrs.class}`;\n }\n });\n };\n}\n//# sourceMappingURL=remarkDirectiveHandler.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport React from 'react';\nimport Markdown, { defaultUrlTransform } from 'react-markdown';\nimport rehypeKatex from 'rehype-katex';\nimport { defListHastHandlers, remarkDefinitionList } from 'remark-definition-list';\nimport remarkDirective from 'remark-directive';\nimport remarkGfm from 'remark-gfm';\nimport remarkAlert from 'remark-github-blockquote-alert';\nimport remarkMath from 'remark-math';\nimport remarkSupersub from 'remark-supersub';\nimport { SKIP, visit } from 'unist-util-visit';\nimport { CodeBlockHandlerProvider } from './CodeBlockContext';\nimport { createDefaultCodeBlockHandlers, ExpandCodeBlockHandler, isExpandLanguage, } from './codeBlockHandlers';\nimport { useCodeBlockRendererRegistry } from './CodeBlockRendering';\nimport { MarkdownFigure } from './MarkdownFigure';\nimport { MarkdownImage } from './MarkdownImage';\nimport { MarkdownLink } from './MarkdownLink';\nimport { normalizeCustomSchemeLinks } from './normalizeCustomSchemeLinks';\nimport { normalizeDirectives } from './normalizeDirectives';\nimport { remarkDirectiveHandler } from './remarkDirectiveHandler';\n// Custom URL schemes that we handle in our components\nconst ALLOWED_CUSTOM_SCHEMES = [\n 'artifact:',\n 'image:',\n 'store:',\n 'document:',\n 'document://',\n 'collection:',\n];\n/**\n * Custom URL transform that allows our custom schemes while using\n * the default transform for standard URLs (which sanitizes unsafe schemes).\n */\nfunction customUrlTransform(url) {\n if (ALLOWED_CUSTOM_SCHEMES.some(scheme => url.startsWith(scheme))) {\n return url;\n }\n return defaultUrlTransform(url);\n}\n/**\n * Remark plugin to remove HTML comments from markdown\n */\nfunction remarkRemoveComments() {\n return (tree) => {\n visit(tree, 'html', (node, index, parent) => {\n if (node.value && /<!--[\\s\\S]*?-->/.test(node.value)) {\n if (parent && typeof index === 'number' && parent.children) {\n parent.children.splice(index, 1);\n return [SKIP, index];\n }\n }\n });\n };\n}\n// Create default handlers once, outside component\nconst defaultCodeBlockHandlers = createDefaultCodeBlockHandlers();\nexport function MarkdownRenderer({ children, components, remarkPlugins = [], removeComments = true, artifactRunId, className, codeClassName, inlineCodeClassName, linkClassName, imageClassName, onProposalSelect, onProposalSubmit, }) {\n const codeBlockRegistry = useCodeBlockRendererRegistry();\n const normalizedMarkdown = React.useMemo(() => normalizeDirectives(normalizeCustomSchemeLinks(children)), [children]);\n // Remark plugins (markdown parsing)\n // Order matters: GFM first, then directive (must precede handler),\n // then definition-list/supersub, then math, then user plugins.\n const remarkPluginsArray = React.useMemo(() => {\n const result = [\n remarkGfm,\n remarkDirective,\n remarkDirectiveHandler,\n remarkAlert,\n remarkDefinitionList,\n remarkSupersub,\n remarkMath,\n ...remarkPlugins,\n ];\n if (removeComments) {\n result.push(remarkRemoveComments);\n }\n return result;\n }, [remarkPlugins, removeComments]);\n // Rehype plugins (HTML processing, including KaTeX for math)\n const rehypePluginsArray = React.useMemo(() => [rehypeKatex], []);\n // Remark-rehype bridge options (custom AST handlers for definition lists)\n const remarkRehypeOptions = React.useMemo(() => ({\n handlers: {\n ...defListHastHandlers,\n },\n }), []);\n const componentsWithOverrides = React.useMemo(() => {\n const baseComponents = components || {};\n const ExistingCode = baseComponents.code;\n const ExistingLink = baseComponents.a;\n const ExistingImg = baseComponents.img;\n const CodeComponent = ({ node, className: codeClassName_, children: codeChildren, ...props }) => {\n const match = /language-([\\w-]+)/.exec(codeClassName_ || '');\n const isInline = !match;\n const language = match ? match[1] : '';\n // Check registry for custom renderer (includes default handlers)\n if (!isInline && language) {\n // First check user-provided registry\n if (codeBlockRegistry) {\n const CustomComponent = codeBlockRegistry.getComponent(language);\n if (CustomComponent) {\n const code = String(codeChildren || '').trim();\n return _jsx(CustomComponent, { code: code, language: language });\n }\n }\n // Check for expand:* pattern (e.g., expand:chart, expand:table)\n if (isExpandLanguage(language)) {\n const code = String(codeChildren || '').trim();\n return _jsx(ExpandCodeBlockHandler, { code: code, language: language });\n }\n // Then check default handlers (chart, vega-lite, mermaid, proposal, askuser)\n const DefaultHandler = defaultCodeBlockHandlers[language];\n if (DefaultHandler) {\n const code = String(codeChildren || '').trim();\n return _jsx(DefaultHandler, { code: code, language: language });\n }\n }\n // Delegate to existing code component if provided\n if (typeof ExistingCode === 'function') {\n return (_jsx(ExistingCode, { node: node, className: codeClassName_, ...props, children: codeChildren }));\n }\n // Default code rendering\n const baseInlineClass = 'px-1.5 py-0.5 rounded';\n const baseCodeClass = '';\n return (_jsx(\"code\", { ...props, className: isInline\n ? `${baseInlineClass} ${inlineCodeClassName || ''}`\n : `${baseCodeClass} ${codeClassName || ''}`, children: codeChildren }));\n };\n const LinkComponent = (props) => {\n const { node, href, children: linkChildren, ...rest } = props;\n return (_jsx(MarkdownLink, { node: node, href: href, className: linkClassName, artifactRunId: artifactRunId, ExistingLink: ExistingLink, ...rest, children: linkChildren }));\n };\n const ImageComponent = (props) => {\n const { node, src, alt, title, ...rest } = props;\n // If image has a title, render as figure with caption\n if (title) {\n return (_jsx(MarkdownFigure, { src: src, alt: alt, caption: title, className: imageClassName, artifactRunId: artifactRunId }));\n }\n return (_jsx(MarkdownImage, { node: node, src: src, alt: alt, className: imageClassName, artifactRunId: artifactRunId, ExistingImg: ExistingImg, ...rest }));\n };\n return {\n ...baseComponents,\n code: CodeComponent,\n a: LinkComponent,\n img: ImageComponent,\n };\n }, [\n components,\n artifactRunId,\n codeBlockRegistry,\n codeClassName,\n inlineCodeClassName,\n linkClassName,\n imageClassName,\n ]);\n const markdownContent = (_jsx(CodeBlockHandlerProvider, { artifactRunId: artifactRunId, onProposalSelect: onProposalSelect, onProposalSubmit: onProposalSubmit, MarkdownRenderer: MarkdownRenderer, children: _jsx(Markdown, { remarkPlugins: remarkPluginsArray, rehypePlugins: rehypePluginsArray, remarkRehypeOptions: remarkRehypeOptions, components: componentsWithOverrides, urlTransform: customUrlTransform, children: normalizedMarkdown }) }));\n if (className) {\n return _jsx(\"div\", { className: `md-content ${className}`, children: markdownContent });\n }\n return _jsx(\"div\", { className: \"md-content\", children: markdownContent });\n}\n//# sourceMappingURL=MarkdownRenderer.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nexport function Progress({ percent }) {\n return (_jsx(\"div\", { className: \"w-full bg-gray-200 rounded-full h-2.5 dark:bg-gray-700\", children: _jsx(\"div\", { className: \"bg-blue-600 h-2.5 rounded-full\", style: { width: `${percent}%` } }) }));\n}\n//# sourceMappingURL=Progress.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { Table, VTooltip } from \"@vertesia/ui/core\";\nimport { Info } from \"lucide-react\";\nexport function PropertiesView({ className, properties }) {\n return (_jsx(Table, { className: className, children: _jsx(\"tbody\", { children: properties.map((property) => (_jsxs(\"tr\", { children: [_jsxs(\"td\", { className: 'w-1/3 font-semibold gap-2', children: [_jsx(\"span\", { children: property.name }), property.description &&\n _jsx(VTooltip, { description: property.description, placement: \"top\", children: _jsx(Info, { className: \"size-3 ml-2 text-muted-foreground\" }) })] }), _jsx(\"td\", { className: 'w-2/3', children: property.value ?? 'undefined' })] }, property.name))) }) }));\n}\n//# sourceMappingURL=PropertiesView.js.map","export var TypeNames;\n(function (TypeNames) {\n TypeNames[\"string\"] = \"string\";\n TypeNames[\"number\"] = \"number\";\n TypeNames[\"integer\"] = \"integer\";\n TypeNames[\"boolean\"] = \"boolean\";\n TypeNames[\"object\"] = \"object\";\n TypeNames[\"any\"] = \"any\";\n TypeNames[\"text\"] = \"text\";\n TypeNames[\"media\"] = \"media\";\n TypeNames[\"document\"] = \"document\";\n})(TypeNames || (TypeNames = {}));\nexport function parseTypeSignature(text) {\n text = text.trim();\n let isArray = false, isNullable = false;\n if (text.endsWith('?')) {\n isNullable = true;\n text = text.substring(0, text.length - 1).trim();\n }\n if (text.endsWith('[]')) {\n isArray = true;\n text = text.substring(0, text.length - 2).trim();\n }\n const name = TypeNames[text];\n if (!name) {\n throw new Error(`Unknown type \"${text}\"`);\n }\n return { name, isArray, isNullable, isObject: name === TypeNames.object };\n}\n//# sourceMappingURL=type-signature.js.map","export function setPropertyName(schema, name, newName) {\n if (schema.properties) {\n const properties = schema.properties;\n const newProperties = {};\n for (const key of Object.keys(properties)) {\n const value = properties[key];\n if (key === name) {\n newProperties[newName] = value;\n }\n else {\n newProperties[key] = value;\n }\n }\n schema.properties = newProperties;\n }\n if (schema.required) {\n schema.required = schema.required.map(x => x === name ? newName : x);\n }\n}\nexport function setRequireProperty(schema, name, isRequired) {\n if (Array.isArray(schema.required)) {\n const index = schema.required.indexOf(name);\n if (isRequired) {\n if (index < 0) {\n schema.required.push(name);\n }\n }\n else {\n if (index > -1) {\n schema.required.splice(index, 1);\n }\n }\n }\n else if (isRequired) {\n schema.required = [name];\n }\n}\nexport function setPropertyType(schema, type) {\n const isAny = type.name === \"any\";\n let typeObj = isAny ?\n undefined\n : (type.isNullable ?\n [type.name, \"null\"]\n : type.name);\n if (type.isArray) {\n schema.type = \"array\";\n schema.properties = undefined;\n if (!schema.items || Array.isArray(schema.items)) {\n schema.items = {\n type: typeObj,\n properties: type.isObject ? {} : undefined\n };\n }\n else {\n const items = schema.items;\n items.type = typeObj;\n if (type.isObject && !items.properties) {\n items.properties = {};\n }\n }\n }\n else {\n schema.type = typeObj;\n schema.items = undefined;\n if (type.isObject) {\n if (!schema.properties) {\n schema.properties = {};\n }\n }\n else {\n schema.properties = undefined;\n }\n }\n}\nexport function removeProperty(schema, name) {\n if (schema.properties) {\n delete schema.properties[name];\n if (Array.isArray(schema.required)) {\n schema.required = schema.required.filter(x => x !== name);\n }\n }\n}\n/**\n * Create a new property in the schema\n * @param schema\n * @param name\n * @param type\n * @param isRequired\n */\nexport function addProperty(schema, name, type, isRequired = false) {\n if (schema.type !== \"object\") {\n throw new Error(\"Cannot add property to a non-object schema\");\n }\n if (!schema.properties) {\n schema.properties = {};\n }\n const newSchema = {};\n setPropertyType(newSchema, type);\n schema.properties[name] = newSchema;\n if (isRequired) {\n if (Array.isArray(schema.required)) {\n addRequired(schema.required, name);\n }\n else {\n schema.required = [name];\n }\n }\n return newSchema;\n}\nexport function getTypeSignature(schema) {\n let isNullable = false, isArray = false;\n let typeName;\n const type = schema.type;\n if (Array.isArray(type)) {\n for (const t of type) {\n if (t === \"null\") {\n isNullable = true;\n }\n else if (!typeName) {\n typeName = t;\n }\n }\n }\n else {\n typeName = type;\n }\n if (!typeName) {\n typeName = \"any\";\n }\n if (typeName === 'array') {\n isArray = true;\n typeName = getItemTypeName(schema.items);\n }\n let displayTypeName = typeName;\n switch (schema.editor) {\n case 'textarea': {\n displayTypeName = 'text';\n break;\n }\n case 'media': {\n displayTypeName = 'media';\n break;\n }\n case 'document': {\n displayTypeName = 'document';\n break;\n }\n }\n return {\n isNullable,\n isArray,\n isObject: typeName === \"object\",\n name: displayTypeName\n };\n}\n// TODO we don't support array of arrays\n// for array of multiple type we get the first type\nfunction getItemTypeName(schema) {\n if (!schema) {\n return \"any\";\n }\n let name;\n if (Array.isArray(schema)) {\n name = getFirstNotNullType(schema[0].type);\n }\n else {\n name = getFirstNotNullType(schema.type);\n }\n if (name === \"array\" || name === \"null\") {\n name = \"any\";\n }\n return name;\n}\nfunction getFirstNotNullType(type) {\n if (!type) {\n return \"any\";\n }\n if (Array.isArray(type)) {\n return type.find(x => x !== \"null\") || \"any\";\n }\n return type;\n}\nfunction addRequired(required, name) {\n if (!required.includes(name)) {\n required.push(name);\n }\n}\n//# sourceMappingURL=json-schema4-utils.js.map","import { TypeNames, parseTypeSignature } from \"./type-signature.js\";\nimport { addProperty, getTypeSignature, removeProperty, setPropertyName, setPropertyType, setRequireProperty } from \"./json-schema4-utils.js\";\nlet new_prop_name_cnt = 0;\nexport class ManagedSchema {\n // the schema source contains information about where the schema was loaded\n // the uri serves to retrieve the schema and for now only store:ID URIs are supported\n source;\n onChange = () => { };\n schema;\n root;\n constructor(schema, title) {\n if (!schema) {\n this.schema = {\n title: title,\n type: \"object\",\n properties: {},\n };\n }\n else if (typeof schema === 'string') {\n this.schema = JSON.parse(schema);\n }\n else {\n this.schema = schema;\n }\n if (!this.schema.properties) {\n this.schema.properties = {};\n }\n this.root = new SchemaNode(\"\", this.schema, this);\n this.root.loadChildren();\n }\n get isEmpty() {\n return !this.root.children || this.root.children.length === 0;\n }\n get children() {\n return this.root.children;\n }\n reload() {\n this.root = new SchemaNode(\"\", this.schema, this);\n this.root.loadChildren();\n this.onChange?.(this);\n return this;\n }\n withSource(name, uri) {\n this.source = {\n uri,\n name\n };\n return this;\n }\n withChangeListener(cb) {\n this.onChange = cb;\n return this;\n }\n replaceSchema(schema) {\n if (!schema) {\n this.schema = {\n title: this.schema.title,\n type: \"object\",\n properties: {},\n };\n }\n else {\n this.schema = schema;\n }\n this.reload();\n }\n clone() {\n const clone = new ManagedSchema(this.schema);\n clone.source = this.source;\n if (this.onChange) {\n clone.withChangeListener(this.onChange);\n }\n return clone;\n }\n}\nexport class SchemaNode {\n schema;\n loader;\n parent;\n name;\n isRequired = false;\n type;\n children;\n constructor(name, schema, loader, parent) {\n this.schema = schema;\n this.loader = loader;\n this.parent = parent;\n this.name = name;\n this.type = getTypeSignature(schema);\n if (this.parent) {\n let required = this.parent._getPropertiesSchema().required;\n this.isRequired = required && Array.isArray(required) ? required.includes(name) : false;\n }\n }\n get title() {\n return this.schema.title;\n }\n set title(value) {\n this.schema.title = value;\n }\n get description() {\n return this.schema.description;\n }\n set description(value) {\n this.schema.description = value;\n }\n get isParent() {\n return this.type.isObject;\n }\n // the isNew is a hack to preserve the open state in UI after a node is created and the tree reloaded\n get isNew() {\n return !!this.schema.isNew;\n }\n set isNew(value) {\n if (value) {\n this.schema.isNew = true;\n }\n else {\n delete this.schema.isNew;\n }\n }\n resetIsNew() {\n const isNew = this.isNew;\n this.isNew = false;\n return isNew;\n }\n // end hack\n getNameSignature() {\n return `${this.name}${this.isRequired ? '' : '?'}`;\n }\n getTypeSignature() {\n return `${this.type.name}${this.type.isArray ? '[]' : ''}${this.type.isNullable ? '?' : ''}`;\n }\n getSignature() {\n return `${this.getNameSignature()}: ${this.getTypeSignature()}`;\n }\n reloadTree() {\n this.loader.reload();\n }\n loadChildren() {\n this.children = [];\n const itemProperties = this.schema.items?.properties;\n if (this.schema.items && itemProperties) {\n this._loadChildren(itemProperties, this.children);\n }\n else if (this.schema.properties) {\n this._loadChildren(this.schema.properties, this.children);\n }\n }\n _loadChildren(properties, children) {\n for (const name of Object.keys(properties)) {\n const childSchema = properties[name];\n const child = new SchemaNode(name, childSchema, this.loader, this);\n children.push(child);\n if (child.isParent) {\n child.loadChildren();\n }\n }\n }\n _getPropertiesSchema() {\n if (this.type.isArray && this.type.isObject) {\n return this.schema.items;\n }\n else {\n return this.schema;\n }\n }\n findAvailableChildName(prefix) {\n const properties = this._getPropertiesSchema().properties || {};\n let name;\n do {\n name = prefix + (++new_prop_name_cnt);\n } while (properties[name]);\n return name;\n }\n /**\n * Add a new child node\n */\n addChild(name, type, isRequired = false) {\n if (!this.type.isObject) {\n throw new Error(\"Cannot add child to a non object node\");\n }\n if (!this.children) {\n this.children = [];\n }\n let schema = this._getPropertiesSchema();\n const childSchema = addProperty(schema, name, type, isRequired);\n const child = new SchemaNode(name, childSchema, this.loader, this);\n this.children.push(child);\n return child;\n }\n /**\n * Remove this node\n */\n remove() {\n if (this.parent && this.parent.type.isObject) {\n const schema = this.parent._getPropertiesSchema();\n removeProperty(schema, this.name);\n if (this.parent.children) {\n this.parent.children = this.parent.children.filter(c => c.name !== this.name);\n }\n return true;\n }\n return false;\n }\n update(data) {\n let updated = false;\n if (data.name != null && this.name !== data.name) {\n if (this.parent) {\n setPropertyName(this.parent._getPropertiesSchema(), this.name, data.name);\n }\n this.name = data.name;\n updated = true;\n }\n if (data.isRequired != null && this.isRequired !== data.isRequired) {\n if (this.parent) {\n setRequireProperty(this.parent._getPropertiesSchema(), this.name, data.isRequired);\n }\n this.isRequired = data.isRequired;\n updated = true;\n }\n let actualType = data.type?.name;\n if (actualType === \"any\") {\n actualType = undefined;\n }\n const typeChanged = actualType !== this.schema.type;\n if (data.type) {\n setPropertyType(this.schema, data.type);\n this.type = data.type;\n if (this.type.isObject) {\n if (!this.children) {\n this.children = [];\n }\n }\n else {\n this.children = undefined;\n }\n updated = true;\n }\n // update editor field\n if (this.schema.editor && data.editor === null) {\n // explicitly set to null => delete current editor\n this.schema.editor = undefined;\n updated = true;\n }\n else if (data.editor) { // a new editor is set\n this.schema.editor = data.editor;\n updated = true;\n }\n else if (typeChanged) {\n // preserve editor only if the type didn't change\n this.schema.editor = undefined;\n updated = true;\n }\n if (data.description !== this.description) {\n this.description = data.description;\n updated = true;\n }\n return updated;\n }\n getUpdateFromNameAndTypeSignature(nameSig, typeSig) {\n let name = nameSig.trim();\n let isRequired = true;\n if (name.endsWith('?')) {\n name = name.substring(0, name.length - 1).trim();\n isRequired = false;\n }\n const type = parseTypeSignature(typeSig);\n let editor;\n if (type.name === 'text') {\n type.name = TypeNames.string;\n editor = 'textarea';\n }\n else if (type.name === 'media') {\n type.name = TypeNames.any;\n editor = 'media';\n }\n else if (type.name === 'document') {\n type.name = TypeNames.any;\n editor = 'document';\n }\n else {\n editor = null; // remove custom editor\n }\n return { name, type, isRequired, editor };\n }\n updateFromNameAndTypeSignature(nameSig, typeSig) {\n return this.update(this.getUpdateFromNameAndTypeSignature(nameSig, typeSig));\n }\n updateFromSignature(text) {\n text = text.trim();\n const index = text.indexOf(':');\n if (index < 0) {\n throw new Error(\"Expecting a name and a type separated by a colon\");\n }\n const nameSig = text.substring(0, index);\n const typeSig = text.substring(index + 1);\n return this.updateFromNameAndTypeSignature(nameSig, typeSig);\n }\n}\n//# sourceMappingURL=ManagedSchema.js.map","export function getEditableSchemaProperty(schema) {\n return {\n name: schema.getNameSignature(),\n type: schema.getTypeSignature(),\n description: schema.description\n };\n}\n//# sourceMappingURL=EditableSchemaProperty.js.map","import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from \"react/jsx-runtime\";\nimport { useEffect, useRef, useState } from 'react';\nimport { AlignLeft } from 'lucide-react';\nimport { Button, Modal, ModalBody, ModalFooter, ModalTitle, Styles, SelectBox } from '@vertesia/ui/core';\nimport { useUITranslation } from '../../../i18n/index.js';\nimport { TypeNames } from '../type-signature.js';\nfunction makeTypeOptions() {\n const types = Object.values(TypeNames);\n const options = [...types];\n for (const type of types) {\n options.push(type + '[]');\n }\n types.sort();\n return options;\n}\nconst TYPE_OPTIONS = makeTypeOptions();\nexport function PropertyEditor({ value, onChange, onCancel, onSave }) {\n const { t } = useUITranslation();\n const [isModalOpen, setModalOpen] = useState(false);\n if (!value)\n return null;\n const onNameChange = (text) => {\n onChange({ ...value, name: text });\n };\n const onTypeChange = (text) => {\n onChange({ ...value, type: text });\n };\n const onDescriptionChange = (text) => {\n if (text !== undefined && typeof text === 'string') {\n onChange({ ...value, description: text }, true);\n }\n setModalOpen(false);\n };\n return (_jsxs(\"div\", { className: \"flex items-center\", children: [_jsx(\"div\", { className: \"flex-1\", children: _jsx(PropertyNameEditor, { value: value.name, onChange: onNameChange, onCancel: onCancel, onSave: onSave }) }), _jsx(\"div\", { className: \"px-1 font-semibold\", children: \":\" }), _jsx(\"div\", { className: \"flex-1\", children: _jsx(PropertyTypeEditor, { value: value.type, onChange: onTypeChange, onCancel: onCancel, onSave: onSave }) }), _jsxs(\"div\", { children: [_jsx(Button, { variant: \"ghost\", size: \"xs\", onClick: () => setModalOpen(true), title: t('widgets.schema.editDescription'), children: _jsx(AlignLeft, { className: \"size-4\" }) }), _jsx(EditDescriptionModal, { value: value.description, isOpen: isModalOpen, onClose: onDescriptionChange })] })] }));\n}\nexport function PropertyNameEditor({ value, onChange, onCancel, onSave }) {\n const ref = useRef(null);\n useEffect(() => {\n ref.current?.focus();\n }, []);\n const onKeyUp = (e) => {\n switch (e.key) {\n case \"Enter\":\n onSave?.();\n break;\n case \"Escape\":\n onCancel?.();\n break;\n }\n };\n const _onChange = (e) => {\n onChange(e.target.value);\n };\n return (_jsx(\"input\", { onKeyUp: onKeyUp, ref: ref, value: value, onChange: _onChange, className: Styles.INPUT_UNSTYLED, style: { fontSize: \"inherit\", width: \"\", display: \"inline\" } }));\n}\nfunction PropertyTypeEditor({ value, onChange, onCancel, onSave }) {\n const onBlur = () => {\n onSave?.();\n };\n const onKeyDown = (e, isOpen) => {\n if (!isOpen) {\n if (e.key === 'Enter') {\n onSave?.();\n }\n else if (e.key === 'Escape') {\n onCancel?.();\n }\n }\n };\n return (_jsx(SelectBox, { className: Styles.INPUT_UNSTYLED, options: TYPE_OPTIONS, value: value || '', onBlur: onBlur, onChange: onChange, onKeyDown: onKeyDown, popupClass: \"schema-type-suggest-popup z-90\" }));\n}\nfunction EditDescriptionModal({ value, isOpen, onClose }) {\n const { t } = useUITranslation();\n return (_jsxs(Modal, { isOpen: isOpen, onClose: onClose, children: [_jsx(ModalTitle, { children: t('widgets.schema.editDescription') }), _jsx(EditDescriptionModalForm, { value: value, onSave: onClose })] }));\n}\nfunction EditDescriptionModalForm({ value, onSave }) {\n const { t } = useUITranslation();\n const ref = useRef(null);\n const [currentValue, setCurrentValue] = useState(value || '');\n useEffect(() => {\n ref.current && ref.current.focus();\n }, [ref.current]);\n return (_jsxs(_Fragment, { children: [_jsx(ModalBody, { className: \"h-max\", children: _jsx(\"textarea\", { ref: ref, className: \"dark:bg-gray-800 w-full h-full dark:text-white\", value: currentValue, onChange: (e) => setCurrentValue(e.target.value) }) }), _jsx(ModalFooter, { children: _jsx(Button, { onClick: () => onSave(currentValue), children: t('store.saveChanges') }) })] }));\n}\n//# sourceMappingURL=PropertyEditor.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nexport function PropertyViewer({ value }) {\n if (!value)\n return null;\n return (_jsxs(\"div\", { className: 'w-full flex items-baseline', children: [_jsx(\"div\", { children: value.name || '' }), _jsx(\"div\", { className: 'ml-2 text-sm text-muted', children: value.type || '' })] }));\n}\n//# sourceMappingURL=PropertyViewer.js.map","import { useState } from \"react\";\nimport { ManagedSchema } from \"../ManagedSchema.js\";\nexport function useSchema(jsonSchema) {\n const [schema, setSchema] = useState(new ManagedSchema(jsonSchema || { type: \"object\", properties: {} }).withChangeListener((schema) => {\n setSchema(schema.clone());\n }));\n return schema;\n}\n//# sourceMappingURL=SchemaContext.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport clsx from 'clsx';\nimport { useEffect, useRef, useState } from 'react';\nimport { SquarePen, Trash2 } from 'lucide-react';\nimport { Button, Styles, useClickOutside, useFlag } from '@vertesia/ui/core';\nconst VIEW_BOX = \"block text-sm sm:leading-6 rounded-md border-0 py-1.5 px-4\";\nconst VIEW_BOX_HOVER = `${VIEW_BOX} hover:shadow-xs hover:ring-1 hover:ring-inset hover:ring-ring`;\nconst EDIT_BOX = `${VIEW_BOX} shadow-xs ring-1 ring-inset ring-ring`;\nexport function Editable({ value, onChange, onDelete, outlineOnHover = false, editOnClick = true, placeholder, viewer, editor, skipClickOutside, isEditing = false, readonly = false, onValidate, }) {\n const { on, off, isOn } = useFlag(isEditing);\n const [validationError, setValidationError] = useState();\n const _onChange = (value) => {\n if (onValidate) {\n const err = onValidate(value);\n if (err) {\n setValidationError(err);\n return; // don't save\n }\n else {\n setValidationError(undefined);\n }\n }\n if (onChange(value)) {\n off();\n }\n };\n const _skipClickOutside = (e) => {\n if (skipClickOutside) {\n return skipClickOutside(e);\n }\n return false;\n };\n return (_jsxs(\"div\", { className: \"\", children: [isOn && !readonly ?\n _jsx(DataEdit, { value: value, onSave: _onChange, onCancel: off, editor: editor, skipClickOutside: _skipClickOutside })\n : _jsx(DataView, { value: value, onEdit: on, viewer: viewer, placeholder: placeholder, outlineOnHover: outlineOnHover, editOnClick: editOnClick, onDelete: onDelete, readonly: readonly }), validationError &&\n _jsx(\"div\", { className: \"text-red-500 text-sm\", children: validationError })] }));\n}\nfunction DataView({ viewer: Viewer, value, onEdit, editOnClick, outlineOnHover, placeholder, onDelete, readonly }) {\n const onClick = () => {\n editOnClick && onEdit();\n };\n const onKeyUp = (e) => {\n if (e.key === \"Enter\") {\n onEdit();\n }\n };\n const btnStyle = 'invisible group-hover:visible';\n return (_jsxs(\"div\", { tabIndex: 0, onKeyUp: onKeyUp, onClick: onClick, className: clsx(\"flex justify-start items-center group\", outlineOnHover ? VIEW_BOX_HOVER : VIEW_BOX, { 'cursor-pointer': editOnClick }), children: [_jsx(Viewer, { value: value, placeholder: placeholder }), _jsxs(\"div\", { className: 'ml-auto flex space-x-2', children: [!readonly && onDelete &&\n _jsx(Button, { variant: \"ghost\", size: \"sm\", className: btnStyle, onClick: onDelete, children: _jsx(Trash2, { className: \"size-4\" }) }), !readonly ?\n _jsx(Button, { variant: \"ghost\", size: \"sm\", className: btnStyle, onClick: onEdit, children: _jsx(SquarePen, { className: \"size-4\" }) })\n : null] })] }));\n}\nfunction DataEdit({ editor: Editor, value, onSave, onCancel, skipClickOutside }) {\n const [actualValue, setActualValue] = useState(value);\n const latestValue = useRef(value);\n const [debounceTimer, setDebounceTimer] = useState(null);\n const handleSave = () => {\n onSave(latestValue.current);\n };\n const ref = useClickOutside(handleSave, skipClickOutside);\n const _onChange = (value, autoSave = false) => {\n setActualValue(value);\n latestValue.current = value;\n if (autoSave) {\n if (debounceTimer) {\n clearTimeout(debounceTimer);\n }\n setDebounceTimer(setTimeout(() => { onSave(value); }, 500));\n }\n };\n return (_jsx(\"div\", { ref: ref, children: _jsx(\"div\", { className: EDIT_BOX, children: _jsx(\"div\", { className: \"w-full\", onClick: (e) => e.stopPropagation(), children: _jsx(Editor, { value: actualValue, onChange: _onChange, onSave: handleSave, onCancel: onCancel }) }) }) }));\n}\nexport function TextDataViewer({ value, placeholder }) {\n if (!value) {\n return (_jsx(\"span\", { className: 'text-gray-400', children: placeholder || 'Missing value' }));\n }\n else {\n return (_jsx(\"span\", { children: value == null ? '' : value.toString() }));\n }\n}\nexport function TextDataEditor({ value, onChange, onCancel, onSave }) {\n const ref = useRef(null);\n useEffect(() => {\n ref.current?.focus();\n }, []);\n const onKeyUp = (e) => {\n switch (e.key) {\n case \"Enter\":\n onSave?.();\n break;\n case \"Escape\":\n onCancel?.();\n break;\n }\n };\n const _onChange = (e) => {\n onChange(e.target.value);\n };\n return (_jsx(\"input\", { onKeyUp: onKeyUp, ref: ref, value: value, onChange: _onChange, className: Styles.INPUT_UNSTYLED, style: { fontSize: \"inherit\" } }));\n}\nexport function EditableText(props) {\n if (!props.viewer) {\n props.viewer = TextDataViewer;\n }\n if (!props.editor) {\n props.editor = TextDataEditor;\n }\n return (_jsx(Editable, { ...props }));\n}\n//# sourceMappingURL=Editable.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { useState } from 'react';\nimport { ChevronDown, ChevronRight, Plus } from 'lucide-react';\nimport { Button, useToast } from '@vertesia/ui/core';\nimport { useUITranslation } from '../../../i18n/index.js';\nimport { TypeNames } from '../type-signature.js';\nimport { Editable } from './Editable.js';\nimport { getEditableSchemaProperty } from './EditableSchemaProperty.js';\nimport { PropertyEditor } from './PropertyEditor.js';\nimport { PropertyViewer } from './PropertyViewer.js';\n// do not exit edit mode when user is clicking inside the type suggestion popup\nfunction skipClickOutside(e) {\n const target = e.target;\n return !!(target.closest && target.closest('.schema-type-suggest-popup'));\n}\n;\nexport function SchemaEditor({ schema, readonly = false }) {\n return (_jsxs(\"ul\", { className: \"\", children: [schema.children.map(prop => {\n return renderProperty(prop, readonly);\n }), !readonly ? _jsx(AddPropertyButton, { parent: schema.root }) : null] }));\n}\nfunction renderProperty(node, readonly) {\n return (node.isParent ?\n _jsx(ParentItem, { property: node, readonly: readonly }, node.name)\n :\n _jsx(SimpleItem, { node: node, readonly: readonly }, node.name));\n}\nfunction SimpleItem({ node, readonly }) {\n return (_jsx(\"li\", { children: _jsx(PropertyTitleBar, { property: node, readonly: readonly }) }));\n}\nfunction ParentItem({ property, readonly }) {\n const [isOpen, setOpen] = useState(true);\n const Icon = isOpen ? ChevronDown : ChevronRight;\n return (_jsxs(\"li\", { children: [_jsxs(\"div\", { className: 'flex items-center w-full', children: [_jsx(\"button\", { onClick: () => setOpen(!isOpen), children: _jsx(Icon, { className: \"size-4\" }) }), _jsx(\"div\", { className: 'flex-1', children: _jsx(PropertyTitleBar, { property: property, readonly: readonly }) })] }), isOpen &&\n _jsxs(\"ul\", { className: \"ml-4 border-l border-gray-400 border-dashed\", children: [(property.children || []).map(prop => renderProperty(prop, readonly)), !readonly ? _jsx(AddPropertyButton, { parent: property }) : null] })] }));\n}\nexport function validatePropertyName(propertyName) {\n if (!propertyName) {\n return 'Name is required';\n }\n if (/^[a-zA-Z0-9_]+[?]?$/.test(propertyName)) {\n return undefined; // valid\n }\n return 'Only letters, numbers, underscores or question mark are allowed (a-zA-Z0-9_?)';\n}\nfunction PropertyTitleBar({ property, readonly }) {\n const { t } = useUITranslation();\n const toast = useToast();\n const onChange = (value) => {\n try {\n if (value.description && typeof value.description !== 'string') {\n value.description = undefined;\n }\n const update = property.getUpdateFromNameAndTypeSignature(value.name, value.type);\n if (property.update({ ...update, description: value.description })) {\n property.reloadTree();\n }\n }\n catch (err) {\n toast({\n status: 'error',\n title: t('widgets.schema.invalidPropertyDeclaration'),\n description: err.message,\n duration: 9000\n });\n return false;\n }\n return true;\n };\n const isNew = property.resetIsNew();\n const editableProp = getEditableSchemaProperty(property);\n return (_jsx(Editable, { value: editableProp, onChange: onChange, onDelete: () => {\n property.remove();\n property.reloadTree();\n }, editor: PropertyEditor, viewer: PropertyViewer, outlineOnHover: true, isEditing: isNew, skipClickOutside: skipClickOutside, readonly: readonly, onValidate: (property) => validatePropertyName(property.name) }));\n}\nfunction AddPropertyButton({ parent }) {\n const add = () => {\n const name = parent.findAvailableChildName(\"new_property_\");\n const child = parent.addChild(name, { isObject: false, isArray: false, isNullable: false, name: TypeNames.string }, true);\n child.isNew = true;\n parent.reloadTree();\n };\n return (_jsxs(Button, { variant: \"ghost\", onClick: add, children: [_jsx(Plus, { className: 'size-4' }), \"Add property\"] }));\n}\n//# sourceMappingURL=SchemaEditor.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { useEffect, useRef } from \"react\";\nexport function SvgIcon({ content, ...props }) {\n const containerRef = useRef(null);\n useEffect(() => {\n if (!containerRef.current)\n return;\n // Parse the SVG string\n const parser = new DOMParser();\n const doc = parser.parseFromString(content, 'image/svg+xml');\n const svgEl = doc.querySelector('svg');\n if (!svgEl) {\n console.warn('SvgIcon: No <svg> element found in provided string');\n containerRef.current.innerHTML = '';\n return;\n }\n // Apply all passed props to the SVG element\n props && Object.entries(props).forEach(([key, value]) => {\n if (value == null)\n return;\n const attrName = key === 'className' ? 'class' : key;\n svgEl.setAttribute(attrName, String(value));\n });\n // Clear and append the new SVG\n containerRef.current.innerHTML = '';\n containerRef.current.appendChild(svgEl);\n }, [content, props]);\n return _jsx(\"span\", { ref: containerRef });\n}\nexport function createSvgIcon(content) {\n const IconComponent = (props) => {\n return _jsx(SvgIcon, { content: content, ...props });\n };\n return IconComponent;\n}\n//# sourceMappingURL=SvgIcon.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { useState, useRef } from \"react\";\nimport { UploadIcon } from \"lucide-react\";\nimport { Button } from \"@vertesia/ui/core\";\nimport { useUITranslation } from \"@vertesia/ui/i18n\";\n/**\n * A reusable drop zone component for file uploads\n *\n * @example\n * <DropZone\n * onDrop={handleFileSelect}\n * message=\"Drag and drop files here\"\n * buttonLabel=\"Select Files\"\n * />\n */\nexport function DropZone({ onDrop, message, buttonLabel, allowFolders = true, className = \"\" }) {\n const { t } = useUITranslation();\n const resolvedButtonLabel = buttonLabel ?? t('upload.uploadFiles');\n const [isDragging, setIsDragging] = useState(false);\n const dropZoneRef = useRef(null);\n const handleDragOver = (e) => {\n e.preventDefault();\n if (e.dataTransfer.types.includes('Files')) {\n setIsDragging(true);\n }\n };\n const handleDragLeave = (e) => {\n e.preventDefault();\n // Only set dragging to false if leaving the container (not entering a child)\n if (dropZoneRef.current && !dropZoneRef.current.contains(e.relatedTarget)) {\n setIsDragging(false);\n }\n };\n const handleDrop = async (e) => {\n e.preventDefault();\n setIsDragging(false);\n if (e.dataTransfer.items && e.dataTransfer.items.length > 0) {\n // Handle folders using the DataTransferItemList API which supports directory reading\n const items = Array.from(e.dataTransfer.items);\n const files = [];\n const folders = new Set();\n const processEntry = async (entry) => {\n if (entry.isFile) {\n // Get file\n const file = await new Promise((resolve) => {\n entry.file((file) => {\n // Store full path in the file object for location use\n Object.defineProperty(file, \"webkitRelativePath\", {\n writable: true,\n value: entry.fullPath.substring(1), // Remove leading slash\n });\n resolve(file);\n });\n });\n // Skip hidden files\n if (!file.name.startsWith(\".\") && file.size > 0) {\n files.push(file);\n }\n // Add folder path to tracking\n const folderPath = entry.fullPath.substring(1).split(\"/\").slice(0, -1).join(\"/\");\n if (folderPath) {\n folders.add(folderPath);\n }\n }\n else if (entry.isDirectory) {\n // Get folder reader\n const reader = entry.createReader();\n const entries = await new Promise((resolve) => {\n reader.readEntries((entries) => {\n resolve(entries);\n });\n });\n // Process all entries\n await Promise.all(entries.map(processEntry));\n // Add this folder to tracking\n const folderPath = entry.fullPath.substring(1);\n if (folderPath) {\n folders.add(folderPath);\n }\n }\n };\n try {\n // Process all dropped items\n await Promise.all(items.map((item) => {\n const entry = item.webkitGetAsEntry ? item.webkitGetAsEntry() : item;\n if (entry) {\n return processEntry(entry);\n }\n return Promise.resolve();\n }));\n if (files.length > 0) {\n const topLevelFolders = new Set(Array.from(folders)\n .map((path) => path.split(\"/\")[0])\n .filter(Boolean));\n const folderCount = topLevelFolders.size;\n const fileCount = files.length;\n let message = \"\";\n if (folderCount > 0) {\n message = t('upload.preparingFolder', { count: folderCount, folderCount, fileCount });\n }\n else {\n message = t('upload.preparingFiles', { count: fileCount });\n }\n onDrop(files, { count: files.length, message });\n }\n }\n catch (error) {\n console.error(\"Error processing dropped files:\", error);\n // Fallback to simple file array if folder processing fails\n const fileArray = Array.from(e.dataTransfer.files);\n if (fileArray.length > 0) {\n onDrop(fileArray);\n }\n }\n }\n else if (e.dataTransfer.files && e.dataTransfer.files.length > 0) {\n // Fallback for browsers that don't support items API\n const fileArray = Array.from(e.dataTransfer.files);\n onDrop(fileArray);\n }\n };\n const handleChange = (e) => {\n if (e.target.files && e.target.files.length > 0) {\n const fileArray = Array.from(e.target.files);\n // Check if there are directories (with webkitRelativePath)\n const hasDirectories = fileArray.some((file) => file.webkitRelativePath && file.webkitRelativePath.includes(\"/\"));\n if (hasDirectories) {\n // Count the unique top-level directories\n const topLevelDirs = new Set(fileArray.map((file) => file.webkitRelativePath?.split(\"/\")[0]).filter(Boolean));\n const folderCount = topLevelDirs.size;\n const fileCount = fileArray.length;\n // Create custom message with folder info\n const formattedMessage = t('upload.preparingFolder', { count: folderCount, folderCount, fileCount });\n const customMessage = {\n count: fileArray.length,\n message: formattedMessage,\n };\n onDrop(fileArray, customMessage);\n }\n else {\n // Regular file upload\n const feedback = {\n count: fileArray.length,\n message: t('upload.preparingFiles', { count: fileArray.length }),\n };\n onDrop(fileArray, feedback);\n }\n }\n };\n const selectFile = () => {\n const fileInput = document.createElement(\"input\");\n fileInput.type = \"file\";\n fileInput.multiple = true;\n fileInput.accept = \"*\";\n fileInput?.click();\n fileInput.onchange = (event) => {\n handleChange(event);\n };\n };\n const selectFolder = () => {\n const folderInput = document.createElement(\"input\");\n folderInput.type = \"file\";\n folderInput.multiple = true;\n folderInput.accept = \"*\";\n folderInput.webkitdirectory = true; // webkitdirectory is not standard but widely supported\n folderInput?.click();\n folderInput.onchange = (event) => {\n handleChange(event);\n };\n };\n return (_jsxs(\"div\", { className: `flex flex-col items-center justify-center py-12 border-2 rounded-lg transition-colors ${isDragging ? \"border-color-primary bg-color-primary/10\" : \"border-dashed border-color-border\"} ${className}`, onDragOver: handleDragOver, onDragLeave: handleDragLeave, onDrop: handleDrop, children: [_jsx(UploadIcon, { className: `h-12 w-12 mb-3 transition-colors ${isDragging ? \"text-primary\" : \"text-muted/50\"}` }), _jsx(\"p\", { className: \"text-muted\", children: message }), _jsxs(\"div\", { className: \"flex gap-2 justify-center mt-2\", children: [_jsx(Button, { onClick: selectFile, children: resolvedButtonLabel }), allowFolders && (_jsx(Button, { onClick: selectFolder, children: t('upload.selectFolder') }))] })] }));\n}\n//# sourceMappingURL=DropZone.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { CheckCircleIcon } from \"lucide-react\";\nimport { useState } from \"react\";\nimport { useUITranslation } from \"@vertesia/ui/i18n\";\n/**\n * Displays a collapsible category of upload results\n *\n * @example\n * <UploadResultCategory\n * title=\"Successfully Uploaded\"\n * count={3}\n * icon={<CheckCircleIcon className=\"h-4 w-4 text-green-500\" />}\n * items={[\"document1.pdf\", \"document2.pdf\", \"document3.pdf\"]}\n * />\n */\nexport function UploadResultCategory({ title, count, icon = _jsx(CheckCircleIcon, { className: \"h-4 w-4 text-green-500\" }), items }) {\n const { t } = useUITranslation();\n const [isExpanded, setIsExpanded] = useState(false);\n return (_jsxs(\"div\", { className: \"border border-color-border rounded-md overflow-hidden\", children: [_jsxs(\"div\", { className: \"flex items-center justify-between p-3 bg-color-muted/10 cursor-pointer\", onClick: () => setIsExpanded(!isExpanded), children: [_jsxs(\"div\", { className: \"flex items-center\", children: [_jsx(\"span\", { className: \"mr-2\", children: icon }), _jsx(\"span\", { className: \"font-medium\", children: title }), _jsx(\"span\", { className: \"ml-2 px-2 py-0.5 bg-color-muted/20 rounded-full text-xs\", children: count })] }), _jsx(\"button\", { className: \"text-muted\", children: _jsx(\"svg\", { className: `h-5 w-5 transition-transform ${isExpanded ? 'transform rotate-180' : ''}`, fill: \"none\", viewBox: \"0 0 24 24\", stroke: \"currentColor\", children: _jsx(\"path\", { strokeLinecap: \"round\", strokeLinejoin: \"round\", strokeWidth: 2, d: \"M19 9l-7 7-7-7\" }) }) })] }), isExpanded && (_jsx(\"div\", { className: \"p-3 border-t border-color-border max-h-48 overflow-y-auto\", children: items.length > 0 ? (_jsx(\"ul\", { className: \"space-y-1\", children: items.map((item, index) => (_jsx(\"li\", { className: \"text-sm py-1 px-2 rounded hover:bg-color-muted/10\", children: item }, index))) })) : (_jsx(\"div\", { className: \"text-sm text-muted py-2\", children: t('upload.noItems') })) }))] }));\n}\n//# sourceMappingURL=UploadResultCategory.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { CheckCircleIcon, AlertCircleIcon, XCircleIcon } from \"lucide-react\";\nimport { useUITranslation } from \"@vertesia/ui/i18n\";\nimport { UploadResultCategory } from \"./UploadResultCategory\";\n/**\n * Displays a summary of upload results with collapsible categories\n *\n * @example\n * <UploadSummary\n * files={[\n * { name: \"document1.pdf\", status: \"success\" },\n * { name: \"document2.pdf\", status: \"skipped\" }\n * ]}\n * location=\"/reports/2023\"\n * />\n */\nexport function UploadSummary({ files, className = \"\", location, collection }) {\n const { t } = useUITranslation();\n // Group files by status\n const successFiles = files.filter(f => f.status === 'success');\n const updatedFiles = files.filter(f => f.status === 'updated');\n const skippedFiles = files.filter(f => f.status === 'skipped');\n const failedFiles = files.filter(f => f.status === 'failed');\n // Calculate counts\n const successCount = successFiles.length;\n const updatedCount = updatedFiles.length;\n const skippedCount = skippedFiles.length;\n const failedCount = failedFiles.length;\n const totalCount = files.length;\n return (_jsxs(\"div\", { className: `flex flex-col py-2 ${className}`, children: [_jsxs(\"div\", { className: \"flex items-center mb-4\", children: [_jsx(\"div\", { className: \"size-8 mr-4 rounded-full bg-success/10 flex items-center justify-center\", children: _jsx(CheckCircleIcon, { className: \"size-4 text-success\" }) }), _jsx(\"div\", { children: _jsxs(\"p\", { className: \"text-muted\", children: [t('upload.filesProcessed', { count: totalCount }), collection ? t('upload.inCollection', { collection }) : \"\", location ? t('upload.inFolder', { location }) : \"\"] }) })] }), _jsxs(\"div\", { className: \"space-y-3 mt-2\", children: [successCount > 0 && (_jsx(UploadResultCategory, { title: t('upload.successfullyUploaded'), count: successCount, icon: _jsx(CheckCircleIcon, { className: \"h-4 w-4 text-green-500\" }), items: successFiles.map(f => f.name) })), updatedCount > 0 && (_jsx(UploadResultCategory, { title: t('upload.successfullyUpdated'), count: updatedCount, icon: _jsx(CheckCircleIcon, { className: \"h-4 w-4 text-blue-500\" }), items: updatedFiles.map(f => f.name) })), skippedCount > 0 && (_jsx(UploadResultCategory, { title: t('upload.skippedAlreadyExisted'), count: skippedCount, icon: _jsx(AlertCircleIcon, { className: \"h-4 w-4 text-amber-500\" }), items: skippedFiles.map(f => f.name) })), failedCount > 0 && (_jsx(UploadResultCategory, { title: t('upload.failedToUpload'), count: failedCount, icon: _jsx(XCircleIcon, { className: \"h-4 w-4 text-red-500\" }), items: failedFiles.map(f => f.name) }))] })] }));\n}\n//# sourceMappingURL=UploadSummary.js.map","export const ATTRIBUTE_GROUP_KEY = ':@';\nexport const ATTRIBUTE_TEXT = '#text';\nexport const ATTRIBUTE_COMMENT = '#comment';\nexport const ATTRIBUTE_CDATA = '#cdata';\nexport const DECLARATION_TAG = 'DECLARATION_TAG';\nexport const TAG = 'TAG';\nexport const defaultTheme = {\n tagColor: '#d43900',\n textColor: '#333',\n attributeKeyColor: '#2a7ab0',\n attributeValueColor: '#008000',\n separatorColor: '#333',\n commentColor: '#aaa',\n cdataColor: '#1d781d',\n fontFamily: 'monospace',\n};\nexport const darkTheme = {\n attributeKeyColor: '#FFD700',\n attributeValueColor: '#FF4500',\n tagColor: '#87CEFA',\n textColor: '#00FF00',\n separatorColor: '#FFD700',\n commentColor: '#BEBEBE',\n cdataColor: '#33CC66',\n fontFamily: 'monospace',\n};\n//# sourceMappingURL=index.js.map","import { createContext, useContext } from 'react';\nimport { defaultTheme } from '../constants';\nconst defaultState = {\n theme: defaultTheme,\n collapsible: false,\n indentSize: 2,\n};\nexport const XMLViewerContext = createContext(defaultState);\nexport const useXMLViewerContext = () => useContext(XMLViewerContext);\n//# sourceMappingURL=xml-viewer-context.js.map","import { XMLParser, XMLValidator } from 'fast-xml-parser';\nimport { useMemo } from 'react';\nimport { ATTRIBUTE_CDATA, ATTRIBUTE_COMMENT } from '../constants';\nconst parser = new XMLParser({\n preserveOrder: true,\n ignoreAttributes: false,\n attributeNamePrefix: '',\n allowBooleanAttributes: true,\n commentPropName: ATTRIBUTE_COMMENT,\n cdataPropName: ATTRIBUTE_CDATA,\n parseTagValue: false,\n});\nexport default function useXMLViewer(xml) {\n return useMemo(() => {\n try {\n if (!XMLValidator.validate(xml)) {\n throw new Error('Invalid XML!');\n }\n const json = parser.parse(xml);\n if (typeof xml === 'string' && xml.trim().length > 0 && json.length === 0) {\n throw new Error('Invalid XML!');\n }\n return { json, valid: true };\n }\n catch (e) {\n const error = e;\n return { json: null, valid: false, errorMessage: `Fail to parse: ${error.message}` };\n }\n }, [xml]);\n}\n//# sourceMappingURL=useXMLViewer.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { useXMLViewerContext } from '../../context/xml-viewer-context';\nexport function CDataTag(props) {\n const { indentation, children, isInline } = props;\n const { theme } = useXMLViewerContext();\n return (_jsxs(\"div\", { style: { color: theme.cdataColor }, children: [_jsx(\"span\", { children: `${indentation}<![CDATA[` }), children, _jsx(\"span\", { children: `${isInline ? '' : indentation}]]>` })] }));\n}\n//# sourceMappingURL=index.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { useXMLViewerContext } from '../../context/xml-viewer-context';\nexport function CollapseIcon(props) {\n const { collapsible, theme } = useXMLViewerContext();\n const { collapsed } = props;\n return collapsible ? (_jsx(\"span\", { style: { position: 'relative' }, children: _jsx(\"span\", { style: { position: 'absolute', right: '0', border: 0, padding: 0, background: 'none' }, children: _jsx(Caret, { fill: theme.separatorColor, style: { transform: `rotate(${collapsed ? 0 : 90}deg)`, transition: 'transform 0.2s' } }) }) })) : null;\n}\nfunction Caret({ ...attrs }) {\n return (_jsx(\"svg\", { width: \"16px\", height: \"16px\", viewBox: \"0 0 24 24\", ...attrs, children: _jsx(\"path\", { d: \"M9 17.898C9 18.972 10.2649 19.546 11.0731 18.8388L17.3838 13.3169C18.1806 12.6197 18.1806 11.3801 17.3838 10.6829L11.0731 5.16108C10.2649 4.45388 9 5.02785 9 6.1018V17.898Z\" }) }));\n}\n//# sourceMappingURL=index.js.map","import { isNil } from 'lodash-es';\nimport { useEffect, useState } from 'react';\nimport { useXMLViewerContext } from '../context/xml-viewer-context';\nexport function useCollapsible(level) {\n const { collapsible, initialCollapsedDepth } = useXMLViewerContext();\n const [collapsed, setCollapsed] = useState(() => isNil(initialCollapsedDepth) || !collapsible ? false : level >= initialCollapsedDepth);\n const toggleCollapsed = () => setCollapsed((currentCollapsed) => !currentCollapsed);\n useEffect(() => {\n setCollapsed(isNil(initialCollapsedDepth) || !collapsible ? false : level >= initialCollapsedDepth);\n }, [initialCollapsedDepth, level, collapsible]);\n return {\n collapsed,\n buttonProps: !collapsible\n ? {}\n : {\n onClick: toggleCollapsed,\n role: 'button',\n style: { cursor: 'pointer' },\n },\n };\n}\n//# sourceMappingURL=useCollapsible.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { CollapseIcon } from '../../components/CollapseIcon';\nimport { useXMLViewerContext } from '../../context/xml-viewer-context';\nimport { useCollapsible } from '../../hooks/useCollapsible';\nexport function CommentTag(props) {\n const { indentation, children, isInline, level } = props;\n const { theme } = useXMLViewerContext();\n const { collapsed, buttonProps } = useCollapsible(level);\n return (_jsxs(\"div\", { style: { color: theme.commentColor }, children: [_jsxs(\"span\", { ...buttonProps, children: [_jsx(\"span\", { children: indentation }), _jsx(CollapseIcon, { collapsed: collapsed }), _jsx(\"span\", { children: '<!-- ' })] }), !collapsed && children, collapsed && '...', _jsx(\"span\", { children: `${isInline || collapsed ? ' ' : indentation}-->` })] }));\n}\n//# sourceMappingURL=index.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { useXMLViewerContext } from '../../context/xml-viewer-context';\nexport function Attributes(props) {\n const { attributes } = props;\n const { theme } = useXMLViewerContext();\n if (!attributes) {\n return null;\n }\n return (_jsx(\"span\", { children: Object.entries(attributes).map(([key, value]) => (_jsxs(\"span\", { children: [_jsx(\"span\", { style: { color: theme.attributeKeyColor }, children: ` ${key}` }), _jsx(\"span\", { style: { color: theme.separatorColor }, children: \"=\" }), _jsx(\"span\", { style: { color: theme.attributeValueColor }, children: `\"${value}\"` })] }, `attribute-${key}`))) }));\n}\n//# sourceMappingURL=index.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { Attributes } from '../../components/Attributes';\nimport { useXMLViewerContext } from '../../context/xml-viewer-context';\nexport function DeclarationTag(props) {\n const { indentation, tagKey, attributes } = props;\n const { theme } = useXMLViewerContext();\n return (_jsxs(\"div\", { children: [_jsx(\"span\", { style: { color: theme.separatorColor }, children: `${indentation}<?` }), _jsx(\"span\", { style: { color: theme.tagColor }, children: `${tagKey.slice(1)}` }), _jsx(Attributes, { attributes: attributes }), _jsx(\"span\", { style: { color: theme.separatorColor }, children: '?>' })] }));\n}\n//# sourceMappingURL=index.js.map","import { omit } from 'lodash-es';\nimport { ATTRIBUTE_CDATA, ATTRIBUTE_COMMENT, ATTRIBUTE_GROUP_KEY, ATTRIBUTE_TEXT, DECLARATION_TAG, TAG, } from '../constants';\nexport function getIndentationString(size, level) {\n return new Array(level * size + 1).join(' ');\n}\nexport function hasBreakLines(elements) {\n return typeof elements === 'string' && elements.includes('\\n');\n}\nexport function isInlineTextElement(elements) {\n if (typeof elements === 'string') {\n return false;\n }\n return (elements.length === 1 &&\n ATTRIBUTE_TEXT in elements[0] &&\n !hasBreakLines(elements[0][ATTRIBUTE_TEXT]));\n}\nexport function getTagType(tagKey) {\n switch (tagKey) {\n case ATTRIBUTE_TEXT:\n case ATTRIBUTE_CDATA:\n case ATTRIBUTE_COMMENT:\n return tagKey;\n default:\n return tagKey.startsWith('?') ? DECLARATION_TAG : TAG;\n }\n}\nexport function getTagProps(element) {\n const attributes = element[ATTRIBUTE_GROUP_KEY];\n const elementWithoutAttributes = omit(element, ATTRIBUTE_GROUP_KEY);\n const [[tagKey, subElements]] = Object.entries(elementWithoutAttributes);\n const type = getTagType(tagKey);\n return { attributes, tagKey, subElements, type };\n}\nexport function hasAttributes(attributes) {\n if (!attributes) {\n return false;\n }\n return Object.keys(attributes).length > 0;\n}\n//# sourceMappingURL=index.js.map","import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from \"react/jsx-runtime\";\nimport { Attributes } from '../../components/Attributes';\nimport { CollapseIcon } from '../../components/CollapseIcon';\nimport { useXMLViewerContext } from '../../context/xml-viewer-context';\nimport { hasAttributes } from '../../helpers';\nimport { useCollapsible } from '../../hooks/useCollapsible';\nexport function Tag(props) {\n const { indentation, tagKey, attributes, children, isInline, hasChildren, level } = props;\n const { collapsed, buttonProps } = useCollapsible(level);\n const { theme } = useXMLViewerContext();\n return (_jsxs(\"div\", { children: [_jsxs(\"span\", { ...buttonProps, children: [_jsx(\"span\", { children: indentation }), _jsx(CollapseIcon, { collapsed: collapsed }), _jsx(\"span\", { style: { color: theme.separatorColor }, children: '<' }), _jsx(\"span\", { style: { color: theme.tagColor }, children: `${tagKey}` }), !collapsed && _jsx(Attributes, { attributes: attributes }), collapsed && hasAttributes(attributes) && ' ...', _jsx(\"span\", { style: { color: theme.separatorColor }, children: !hasChildren ? ' />' : '>' })] }), hasChildren && (_jsxs(_Fragment, { children: [!collapsed && children, collapsed && '...', _jsx(\"span\", { style: { color: theme.separatorColor }, children: `${isInline || collapsed ? '' : indentation}</` }), _jsx(\"span\", { style: { color: theme.tagColor }, children: `${tagKey}` }), _jsx(\"span\", { style: { color: theme.separatorColor }, children: '>' })] }))] }));\n}\n//# sourceMappingURL=index.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { useXMLViewerContext } from '../../context/xml-viewer-context';\nimport { hasBreakLines } from '../../helpers';\nexport function TextElement(props) {\n const { hasSiblings, text, indentation, isText } = props;\n const { theme } = useXMLViewerContext();\n const style = isText ? { color: theme.textColor } : undefined;\n return hasBreakLines(text) || hasSiblings ? (_jsx(\"div\", { style: style, children: text\n .split('\\n')\n .filter((element) => !!element.trim())\n .map((line, index) => (_jsx(\"div\", { children: `${indentation}${line.trim()}` }, `${index}`))) })) : (_jsx(\"span\", { style: style, children: text }));\n}\n//# sourceMappingURL=index.js.map","import { jsx as _jsx, Fragment as _Fragment } from \"react/jsx-runtime\";\nimport { CDataTag } from '../../components/CDataTag';\nimport { CommentTag } from '../../components/CommentTag';\nimport { DeclarationTag } from '../../components/DeclarationTag';\nimport { Tag } from '../../components/Tag';\nimport { TextElement } from '../../components/TextElement';\nimport { ATTRIBUTE_CDATA, ATTRIBUTE_COMMENT, ATTRIBUTE_TEXT, DECLARATION_TAG } from '../../constants';\nimport { useXMLViewerContext } from '../../context/xml-viewer-context';\nimport { getIndentationString, getTagProps, isInlineTextElement } from '../../helpers';\nexport function Elements(props) {\n const { elements, level = 0, isText = true } = props;\n const { indentSize } = useXMLViewerContext();\n if (!Array.isArray(elements) || elements.length === 0) {\n return null;\n }\n return (_jsx(_Fragment, { children: elements.map((element, index) => {\n const { tagKey, attributes, subElements, type } = getTagProps(element);\n const hasSiblings = elements.length > 1;\n const indentation = getIndentationString(indentSize, level);\n const key = `${level}-${index}`;\n const isInline = isInlineTextElement(subElements);\n switch (type) {\n case ATTRIBUTE_TEXT:\n return (_jsx(TextElement, { text: subElements, indentation: indentation, hasSiblings: hasSiblings, isText: isText }, key));\n case ATTRIBUTE_COMMENT:\n return (_jsx(CommentTag, { isInline: isInline, indentation: indentation, level: level, children: _jsx(Elements, { elements: subElements, level: level + 1, isText: false }) }, key));\n case ATTRIBUTE_CDATA:\n return (_jsx(CDataTag, { indentation: indentation, isInline: isInline, children: _jsx(Elements, { elements: subElements, level: level + 1, isText: false }) }, key));\n case DECLARATION_TAG:\n return (_jsx(DeclarationTag, { indentation: indentation, tagKey: tagKey, attributes: attributes }, key));\n default:\n return (_jsx(Tag, { indentation: indentation, tagKey: tagKey, attributes: attributes, isInline: isInline, hasChildren: subElements.length > 0, level: level, children: _jsx(Elements, { elements: subElements, level: level + 1 }) }, key));\n }\n }) }));\n}\n//# sourceMappingURL=index.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nexport function InvalidXml() {\n return _jsx(\"div\", { children: \"Invalid XML!\" });\n}\n//# sourceMappingURL=index.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { useEffect, useMemo, useState } from 'react';\nimport { darkTheme, defaultTheme } from '../constants';\nimport { XMLViewerContext } from '../context/xml-viewer-context';\nimport useXMLViewer from '../hooks/useXMLViewer';\nimport { Elements } from './Elements';\nimport { InvalidXml } from './InvalidXml';\nexport function XMLViewer(props) {\n const { theme: customTheme, xml, collapsible = false, indentSize = 2, invalidXml, initalCollapsedDepth, initialCollapsedDepth, } = props;\n // Detect dark mode from document root class (set by ThemeProvider)\n const [isDarkMode, setIsDarkMode] = useState(() => {\n return document.documentElement.classList.contains('dark');\n });\n useEffect(() => {\n const root = document.documentElement;\n const observer = new MutationObserver(() => {\n setIsDarkMode(root.classList.contains('dark'));\n });\n observer.observe(root, { attributes: true, attributeFilter: ['class'] });\n return () => observer.disconnect();\n }, []);\n // Compute theme based on dark mode, then apply custom overrides\n const theme = useMemo(() => {\n const baseTheme = isDarkMode ? darkTheme : defaultTheme;\n return { ...baseTheme, ...customTheme };\n }, [isDarkMode, customTheme]);\n const { json, valid } = useXMLViewer(xml);\n const context = useMemo(() => ({\n theme,\n collapsible,\n indentSize,\n initialCollapsedDepth: initialCollapsedDepth ?? initalCollapsedDepth,\n }), [theme, collapsible, indentSize, initalCollapsedDepth, initialCollapsedDepth]);\n if (!valid) {\n return invalidXml ? invalidXml : _jsx(InvalidXml, {});\n }\n return (_jsx(XMLViewerContext.Provider, { value: context, children: _jsx(\"div\", { className: \"rxv-container\", style: { whiteSpace: 'pre-wrap', fontFamily: theme.fontFamily, overflowWrap: 'break-word' }, children: _jsx(Elements, { elements: json }) }) }));\n}\n//# sourceMappingURL=XMLViewer.js.map"],"names":["VEditorApi","VgetValue","VsetValue","constructor","this","getValue","setValue","value","MonacoEditor","onChange","className","editorRef","language","debounceTimeout","options","beforeMount","onMount","defaultValue","editorValue","setEditorValue","useState","editorInstanceRef","useRef","theme","useTheme","getValueRef","setValueRef","newValue","current","useEffect","undefined","debouncedOnChange","useMemo","debounce","update","handleEditorChange","useCallback","actualValue","docChanged","state","doc","toString","length","handleEditorDidMount","editor","monacoInstance","defineTheme","base","inherit","rules","colors","setTheme","effectiveValue","defaultOptions","fontSize","fontFamily","minimap","enabled","scrollBeyondLastLine","wordWrap","lineNumbers","folding","lineDecorationsWidth","lineNumbersMinChars","automaticLayout","formatOnPaste","formatOnType","tabSize","insertSpaces","glyphMargin","renderValidationDecorations","renderLineHighlight","hover","delay","quickSuggestions","other","comments","strings","_jsx","clsx","children","Editor","height","FieldSetContext","createContext","FieldSetContextProvider","Provider","useFieldSet","ctx","useContext","Error","FormContext","object","components","disabled","_FormContext","useForm","FormContextProvider","Input","React","forwardRef","type","props","ref","String","booleanValue","setBooleanValue","schema","isBoolean","Styles","INPUT","_onChange","ev","target","checked","Form","onSubmit","observer","evt","stopPropagation","preventDefault","GeneratedFormFields","properties","map","renderProperty","GeneratedForm","_jsxs","prop","isList","ListField","name","isObject","CompositeField","ScalarField","inline","Component","inputType","getInputType","handleOnChange","event","isNumber","parseFloat","isListItem","FormItem","label","title","required","isRequired","description","items","item","index","ListItem","list","onDelete","remove","deleteItem","Button","variant","onClick","add","Plus","arraySchema","Trash2","Schema","_validator","load","validator","ajv","Ajv","allErrors","strict","addFormats","compile","Object","keys","forEach","loadProperty","hasProperties","propertySchema","property","ArrayPropertySchema","PropertySchema","validate","errors","addProperty","typeOrSchema","removeProperty","Array","isArray","filter","x","getProperty","parent","super","isMulti","isReadOnly","readOnly","default","enum","values","includes","concat","isString","getArrayElementType","computeTitleFromName","replace","toUpperCase","slice","_name","format","Node","isRoot","root","path","isScalar","node","ManagedObjectBase","ManagedListProperty","getOrInitArrayProperty","ManagedObjectProperty","getOrInitObjectProperty","ManagedProperty","setPropertyValue","getPropertyValue","out","push","Symbol","iterator","ManagedObject","_v","newItem","ManageObjectEntry","ManagedScalarEntry","splice","i","l","trim","pop","key","Date","now","FormLabel","FormHelper","FormError","JSONCode","data","jsonString","JSON","stringify","error","console","domReadOnly","JSONView","entries","PropertyElement","PropertyTitle","BlockElement","info","getValueInfo","ValueType","Inline","Paragraph","Prose","ArrayProperty","inlineLength","join","itemMediumLength","isInline","useBullet","DotBadge","ItemProperty","bullet","content","len","JSONDisplay","viewCode","t","useUITranslation","JSONSwitcher","setViewCode","size","alt","cn","inputs","twMerge","NAMESPACE","i18nInstance","i18next","createInstance","useTranslation","i18n","use","initReactI18next","init","resources","ar","de","en","es","fr","it","ja","ko","pt","ru","tr","zh","fallbackLng","ns","defaultNS","interpolation","escapeValue","react","useSuspense","ArtifactUrlCacheContext","useArtifactUrlCache","getArtifactCacheKey","runId","disposition","getFileCacheKey","VegaErrorDisplay","chartTitle","FullscreenDialog","isOpen","onClose","DialogPrimitive","Root","open","onOpenChange","Portal","Overlay","Content","onEscapeKeyDown","Close","asChild","X","Title","Description","CHART_COLORS","categorical","blues","purples","diverging","viewHasField","view","fields","encoding","field","channel","layer","viewHasColorEncoding","checkEncoding","colorField","color","findArtifactReferences","spec","currentPath","references","url","startsWith","artifactPath","nestedKeys","VegaLiteChart","memo","artifactRunId","vegaSpec","isExporting","setIsExporting","isCopied","setIsCopied","setError","isFullscreen","setIsFullscreen","viewRef","fullscreenViewRef","containerRef","client","useUserSession","urlCache","clientRef","urlCacheRef","resolvedSpec","setResolvedSpec","isLoadingArtifacts","setIsLoadingArtifacts","artifactError","setArtifactError","mode","isDashboard","showFullscreenButton","enableFullscreen","baseHeight","rowCount","vconcat","columns","Math","ceil","facet","max","calculateAutoHeight","r","warn","cancelled","async","resolvedData","Map","currentClient","currentUrlCache","pathKey","cacheKey","getOrFetch","files","getArtifactDownloadUrl","getDownloadUrl","response","fetch","ok","statusText","toLowerCase","endsWith","csvText","text","Papa","parse","header","skipEmptyLines","dynamicTyping","jsonData","json","set","err","newSpec","result","split","lastKey","replaceArtifactData","resolveArtifacts","isDarkMode","setIsDarkMode","isDarkModeRef","checkDarkMode","newDarkMode","document","documentElement","classList","contains","MutationObserver","observe","attributes","attributeFilter","disconnect","containerWidth","setContainerWidth","containerWidthRef","resizeTimeout","resizeObserver","ResizeObserver","clearTimeout","setTimeout","width","contentRect","initialWidth","clientWidth","hasArtifactReferences","processedSpec","specToUse","parameterValues","updateParams","params","param","updateNestedViews","views","hconcat","applyParameterValues","concatKeys","some","rootSelectionParams","select","paramName","selectFields","hasLegendBinding","bind","concatArray","targetViewIndex","targetView","p","fixVegaLiteSelectionParams","scaleSpecWidths","availableWidth","childCount","totalSpacing","spacing","widthPerChild","floor","child","currentWidth","buildFullSpec","forFullscreen","config","isDark","baseConfig","background","stroke","range","category","heatmap","ramp","mark","tooltip","bar","cornerRadiusTopLeft","cornerRadiusTopRight","line","strokeWidth","strokeCap","point","filled","area","fillOpacity","rect","cornerRadius","arc","circle","axis","labelColor","titleColor","gridColor","domainColor","tickColor","labelFont","titleFont","labelFontSize","titleFontSize","titleFontWeight","legend","symbolSize","font","fontWeight","getDarkModeConfig","calculatedWidth","window","min","innerWidth","isConcatenatedView","autosize","scaledSpec","specWidth","_specWidth","specWithoutWidth","$schema","handleCopy","toCanvas","toBlob","blob","navigator","clipboard","write","ClipboardItem","handleExport","toImageURL","link","createElement","download","href","click","handleNewView","handleFullscreenNewView","handleError","message","toggleFullscreen","prev","Toolbar","Check","Copy","Download","Minimize2","Maximize2","style","Loader2","chartSpec","fullscreenSpec","localStorage","getItem","log","hasData","dataLength","_Fragment","minWidth","VegaEmbed","onEmbed","onError","renderer","actions","prevProps","nextProps","CodeBlockContext","CodeBlockHandlerProvider","onProposalSelect","onProposalSubmit","MarkdownRenderer","useCodeBlockContext","TYPE_CONFIG","chart","icon","BarChart3","defaultHeight","mermaid","GitBranch","proposal","MessageSquare","code","Code","image","Image","Link","expand","table","Table","markdown","FileText","CodeBlockPlaceholder","onRetry","displayHeight","minHeight","IconComponent","_","animationDelay","CodeBlockErrorBoundary","hasError","getDerivedStateFromError","componentDidCatch","errorInfo","handleRetry","setState","render","fallbackCode","toVegaLiteSpec","obj","library","TableRenderer","headers","rows","first","row","h","val","cell","j","CodeRenderer","ext","sanitizeSvg","svg","DOMPurify","sanitize","USE_PROFILES","svgFilters","ADD_TAGS","FORBID_TAGS","makeSvgResponsive","_full","attrs","a","test","w","exec","v","MockupRenderer","processedSvg","raw","margin","overflowX","dangerouslySetInnerHTML","__html","ImageRenderer","src","loading","ArtifactContentRenderer","renderType","contentType","actualType","autoDetectRenderType","fragmentContent","hasTemplate","template","hasVegaLiteChart","FusionFragmentProvider","ChartComponent","FusionFragmentHandler","markdownContent","VARIANT_STYLES","border","bg","warning","success","VARIANT_ICONS","HelpCircle","AlertCircle","CheckCircle","AskUserWidget","question","onSelect","onMultiSelect","allowFreeResponse","multiSelect","placeholder","isLoading","hideIcon","hideBorder","cardClassName","headerClassName","iconClassName","questionClassName","descriptionClassName","optionsClassName","buttonClassName","inputContainerClassName","inputClassName","submitButtonClassName","resolvedPlaceholder","inputValue","setInputValue","selectedOptions","setSelectedOptions","Set","inputRef","styles","DefaultIcon","handleSubmit","borderClass","option","has","id","toggleOption","optionId","next","delete","from","Send","count","e","onKeyDown","shiftKey","MERMAID_FONT_FAMILY","MermaidDiagram","setSvg","uniqueId","useId","normalizedCode","trimmed","normalized","inDoubleQuote","inSingleQuote","char","normalizeMermaidCodeForBrowser","renderedSvg","responsiveSvg","nextAttrs","_styleFull","styleValue","renderDiagram","useArtifactContent","parseJson","rawContent","retryCount","setRetryCount","fetchContent","detectContentType","signedUrl","status","errorMessage","retry","c","isIncompleteJson","incompleteIndicators","lowerMessage","ind","braceCount","bracketCount","inString","escaped","parseChartJson","jsonStart","indexOf","jsonEnd","lastIndexOf","VegaLiteCodeBlockHandler","incomplete","ChartCodeBlockHandler","hasVegaSchema","isExplicitVegaLite","detectChartLibrary","MermaidCodeBlockHandler","trimmedCode","ProposalCodeBlockHandler","widgetProps","opt","multiple","MockupCodeBlockHandler","ExpandCodeBlockHandler","isExpandLanguage","createDefaultCodeBlockHandlers","vegalite","mockup","askuser","initialize","startOnLoad","securityLevel","suppressErrorRendering","flowchart","htmlLabels","useMaxWidth","nodeSpacing","rankSpacing","padding","sequence","themeVariables","CodeBlockRendererRegistry","registerComponent","component","getComponent","Context","CodeBlockRendererProvider","registry","useCodeBlockRendererRegistry","useCodeBlockComponent","parseUrlScheme","rawUrl","scheme","mapSchemeToRoute","useResolvedUrl","mappedRoute","cached","getUrl","fetchUrl","doFetch","MarkdownFigure","caption","rawSrc","ResolvedFigure","MarkdownImage","ExistingImg","rest","ResolvedImage","MarkdownLink","ExistingLink","rawHref","rel","ResolvedLink","CUSTOM_SCHEME_PREFIXES","CUSTOM_LINK_REGEX","INLINE_CODE_REGEX","FENCED_CODE_BLOCK_REGEX","LINK_TITLE_SUFFIX_REGEX","hasCustomScheme","destination","prefix","normalizeCustomLinksInText","_fullMatch","close","destinationWithOptionalTitle","closeIdx","titleMatch","match","titleStart","wrapCustomDestination","normalizeOutsideInlineCode","lastIndex","SINGLE_LINE_DIRECTIVE","CALLOUT_TYPES","note","tip","important","caution","CALLOUT_LABELS","remarkDirectiveHandler","tree","visit","d","hName","hProperties","titleNode","unshift","fromEntries","k","class","ALLOWED_CUSTOM_SCHEMES","customUrlTransform","defaultUrlTransform","remarkRemoveComments","SKIP","defaultCodeBlockHandlers","remarkPlugins","removeComments","codeClassName","inlineCodeClassName","linkClassName","imageClassName","codeBlockRegistry","normalizedMarkdown","normalizeDirectives","normalizeCustomSchemeLinks","_match","indent","remarkPluginsArray","remarkGfm","remarkDirective","remarkAlert","remarkDefinitionList","remarkSupersub","remarkMath","rehypePluginsArray","rehypeKatex","remarkRehypeOptions","handlers","defListHastHandlers","componentsWithOverrides","baseComponents","ExistingCode","img","codeClassName_","codeChildren","CustomComponent","DefaultHandler","linkChildren","Markdown","rehypePlugins","urlTransform","Progress","percent","PropertiesView","VTooltip","placement","Info","TypeNames","setPropertyType","typeObj","isNullable","getTypeSignature","typeName","getFirstNotNullType","getItemTypeName","displayTypeName","find","new_prop_name_cnt","ManagedSchema","source","SchemaNode","loadChildren","isEmpty","reload","withSource","uri","withChangeListener","cb","replaceSchema","clone","loader","_getPropertiesSchema","isParent","isNew","resetIsNew","getNameSignature","getSignature","reloadTree","itemProperties","_loadChildren","childSchema","findAvailableChildName","addChild","newSchema","addRequired","updated","newName","newProperties","setPropertyName","setRequireProperty","typeChanged","getUpdateFromNameAndTypeSignature","nameSig","typeSig","substring","parseTypeSignature","string","any","updateFromNameAndTypeSignature","updateFromSignature","getEditableSchemaProperty","TYPE_OPTIONS","types","sort","makeTypeOptions","PropertyEditor","onCancel","onSave","isModalOpen","setModalOpen","PropertyNameEditor","PropertyTypeEditor","AlignLeft","EditDescriptionModal","focus","onKeyUp","INPUT_UNSTYLED","display","SelectBox","onBlur","popupClass","Modal","ModalTitle","EditDescriptionModalForm","currentValue","setCurrentValue","ModalBody","ModalFooter","PropertyViewer","useSchema","jsonSchema","setSchema","VIEW_BOX","VIEW_BOX_HOVER","EDIT_BOX","Editable","outlineOnHover","editOnClick","viewer","skipClickOutside","isEditing","readonly","onValidate","on","off","isOn","useFlag","validationError","setValidationError","DataEdit","DataView","onEdit","Viewer","btnStyle","tabIndex","SquarePen","setActualValue","latestValue","debounceTimer","setDebounceTimer","handleSave","useClickOutside","autoSave","closest","SchemaEditor","AddPropertyButton","ParentItem","SimpleItem","PropertyTitleBar","setOpen","ChevronDown","ChevronRight","validatePropertyName","propertyName","toast","useToast","editableProp","duration","SvgIcon","svgEl","DOMParser","parseFromString","querySelector","innerHTML","attrName","setAttribute","appendChild","createSvgIcon","DropZone","onDrop","buttonLabel","allowFolders","resolvedButtonLabel","isDragging","setIsDragging","dropZoneRef","handleChange","fileArray","file","webkitRelativePath","folderCount","Boolean","fileCount","formattedMessage","customMessage","feedback","onDragOver","dataTransfer","onDragLeave","relatedTarget","folders","processEntry","entry","isFile","Promise","resolve","defineProperty","writable","fullPath","folderPath","isDirectory","reader","createReader","readEntries","all","webkitGetAsEntry","UploadIcon","fileInput","accept","onchange","folderInput","webkitdirectory","UploadResultCategory","CheckCircleIcon","isExpanded","setIsExpanded","fill","viewBox","strokeLinecap","strokeLinejoin","UploadSummary","location","collection","successFiles","f","updatedFiles","skippedFiles","failedFiles","successCount","updatedCount","skippedCount","failedCount","totalCount","AlertCircleIcon","XCircleIcon","ATTRIBUTE_TEXT","ATTRIBUTE_COMMENT","ATTRIBUTE_CDATA","DECLARATION_TAG","defaultTheme","tagColor","textColor","attributeKeyColor","attributeValueColor","separatorColor","commentColor","cdataColor","darkTheme","XMLViewerContext","collapsible","indentSize","useXMLViewerContext","parser","XMLParser","preserveOrder","ignoreAttributes","attributeNamePrefix","allowBooleanAttributes","commentPropName","cdataPropName","parseTagValue","CDataTag","indentation","CollapseIcon","collapsed","position","right","Caret","transform","transition","useCollapsible","level","initialCollapsedDepth","setCollapsed","isNil","buttonProps","currentCollapsed","role","cursor","CommentTag","Attributes","DeclarationTag","tagKey","hasBreakLines","elements","getTagProps","element","elementWithoutAttributes","omit","subElements","getTagType","hasAttributes","Tag","hasChildren","TextElement","hasSiblings","isText","Elements","getIndentationString","isInlineTextElement","InvalidXml","XMLViewer","customTheme","xml","invalidXml","initalCollapsedDepth","valid","XMLValidator","useXMLViewer","context","whiteSpace","overflowWrap"],"mappings":"ukEAMO,MAAMA,GACTC,UACAC,UACA,WAAAC,CAAYF,EAAWC,GACnBE,KAAKH,UAAYA,EACjBG,KAAKF,UAAYA,CACrB,CACA,QAAAG,GACI,OAAOD,KAAKH,WAChB,CACA,QAAAK,CAASC,GACLH,KAAKF,UAAUK,GAAS,GAC5B,EAEG,SAASC,IAAaC,SAAEA,EAAQF,MAAEA,EAAKG,UAAEA,EAASC,UAAEA,EAASC,SAAEA,EAAW,aAAYC,gBAAEA,EAAkB,EAACC,QAAEA,EAAU,CAAA,EAAEC,YAAEA,EAAWC,QAAEA,EAAOC,aAAEA,IACpJ,MAAOC,EAAaC,GAAkBC,EAASb,GAASU,GAAgB,IAClEI,EAAoBC,EAAO,OAC3BC,MAAEA,GAAUC,IACZC,EAAcH,EAAO,IAAMJ,GAC3BQ,EAAcJ,EAAQK,IACxBR,EAAeQ,GACXN,EAAkBO,SAClBP,EAAkBO,QAAQtB,SAASqB,KAG3CE,EAAU,KACNJ,EAAYG,QAAU,IAAMV,GAC7B,CAACA,IACJW,EAAU,KAC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