@vertesia/ui 1.5.0-dev.20260807.073259Z → 1.5.0-dev.20260826.064249Z

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 (432) hide show
  1. package/README.md +1 -7
  2. package/lib/core/components/shadcn/filters/comboBox/DateCombobox.js +1 -1
  3. package/lib/core/components/shadcn/filters/comboBox/DateCombobox.js.map +1 -1
  4. package/lib/core/components/shadcn/filters/filter/dateFilter.d.ts.map +1 -1
  5. package/lib/core/components/shadcn/filters/filter/dateFilter.js +1 -1
  6. package/lib/core/components/shadcn/filters/filter/dateFilter.js.map +1 -1
  7. package/lib/core/components/shadcn/filters/filters.d.ts.map +1 -1
  8. package/lib/core/components/shadcn/filters/filters.js +1 -1
  9. package/lib/core/components/shadcn/filters/filters.js.map +1 -1
  10. package/lib/core/components/shadcn/index.d.ts +1 -0
  11. package/lib/core/components/shadcn/index.d.ts.map +1 -1
  12. package/lib/core/components/shadcn/index.js +1 -0
  13. package/lib/core/components/shadcn/index.js.map +1 -1
  14. package/lib/core/components/shadcn/modal/dialog.d.ts.map +1 -1
  15. package/lib/core/components/shadcn/modal/dialog.js +1 -3
  16. package/lib/core/components/shadcn/modal/dialog.js.map +1 -1
  17. package/lib/core/components/shadcn/overflowTabs.d.ts +59 -0
  18. package/lib/core/components/shadcn/overflowTabs.d.ts.map +1 -0
  19. package/lib/core/components/shadcn/overflowTabs.js +173 -0
  20. package/lib/core/components/shadcn/overflowTabs.js.map +1 -0
  21. package/lib/core/components/shadcn/selectBox.js +2 -2
  22. package/lib/core/components/shadcn/selectBox.js.map +1 -1
  23. package/lib/core/components/shadcn/theme/ThemeProvider.d.ts +3 -1
  24. package/lib/core/components/shadcn/theme/ThemeProvider.d.ts.map +1 -1
  25. package/lib/core/components/shadcn/theme/ThemeProvider.js +8 -9
  26. package/lib/core/components/shadcn/theme/ThemeProvider.js.map +1 -1
  27. package/lib/core/utils/dayjs.d.ts +12 -0
  28. package/lib/core/utils/dayjs.d.ts.map +1 -0
  29. package/lib/core/utils/dayjs.js +16 -0
  30. package/lib/core/utils/dayjs.js.map +1 -0
  31. package/lib/env/index.d.ts +17 -0
  32. package/lib/env/index.d.ts.map +1 -1
  33. package/lib/env/index.js +18 -1
  34. package/lib/env/index.js.map +1 -1
  35. package/lib/features/agent/PayloadBuilder.d.ts +1 -0
  36. package/lib/features/agent/PayloadBuilder.d.ts.map +1 -1
  37. package/lib/features/agent/PayloadBuilder.js +22 -5
  38. package/lib/features/agent/PayloadBuilder.js.map +1 -1
  39. package/lib/features/agent/chat/AgentRightPanel.d.ts.map +1 -1
  40. package/lib/features/agent/chat/AgentRightPanel.js +3 -135
  41. package/lib/features/agent/chat/AgentRightPanel.js.map +1 -1
  42. package/lib/features/agent/chat/ArtifactsTab.d.ts.map +1 -1
  43. package/lib/features/agent/chat/ArtifactsTab.js +1 -1
  44. package/lib/features/agent/chat/ArtifactsTab.js.map +1 -1
  45. package/lib/features/agent/chat/AskUserWidget.d.ts.map +1 -1
  46. package/lib/features/agent/chat/AskUserWidget.js +19 -4
  47. package/lib/features/agent/chat/AskUserWidget.js.map +1 -1
  48. package/lib/features/agent/chat/ModernAgentConversation.d.ts +6 -0
  49. package/lib/features/agent/chat/ModernAgentConversation.d.ts.map +1 -1
  50. package/lib/features/agent/chat/ModernAgentConversation.js +99 -29
  51. package/lib/features/agent/chat/ModernAgentConversation.js.map +1 -1
  52. package/lib/features/agent/chat/ModernAgentOutput/ActiveWorkstreamsSummary.d.ts.map +1 -1
  53. package/lib/features/agent/chat/ModernAgentOutput/ActiveWorkstreamsSummary.js +10 -9
  54. package/lib/features/agent/chat/ModernAgentOutput/ActiveWorkstreamsSummary.js.map +1 -1
  55. package/lib/features/agent/chat/ModernAgentOutput/AllMessagesMixed.d.ts.map +1 -1
  56. package/lib/features/agent/chat/ModernAgentOutput/AllMessagesMixed.js +5 -8
  57. package/lib/features/agent/chat/ModernAgentOutput/AllMessagesMixed.js.map +1 -1
  58. package/lib/features/agent/chat/ModernAgentOutput/AttachmentPreview.d.ts.map +1 -1
  59. package/lib/features/agent/chat/ModernAgentOutput/AttachmentPreview.js +45 -4
  60. package/lib/features/agent/chat/ModernAgentOutput/AttachmentPreview.js.map +1 -1
  61. package/lib/features/agent/chat/ModernAgentOutput/BatchProgressPanel.js +1 -1
  62. package/lib/features/agent/chat/ModernAgentOutput/BatchProgressPanel.js.map +1 -1
  63. package/lib/features/agent/chat/ModernAgentOutput/Header.d.ts.map +1 -1
  64. package/lib/features/agent/chat/ModernAgentOutput/Header.js +3 -3
  65. package/lib/features/agent/chat/ModernAgentOutput/Header.js.map +1 -1
  66. package/lib/features/agent/chat/ModernAgentOutput/MessageItem.d.ts.map +1 -1
  67. package/lib/features/agent/chat/ModernAgentOutput/MessageItem.js +1 -1
  68. package/lib/features/agent/chat/ModernAgentOutput/MessageItem.js.map +1 -1
  69. package/lib/features/agent/chat/ModernAgentOutput/StreamingMessage.d.ts.map +1 -1
  70. package/lib/features/agent/chat/ModernAgentOutput/StreamingMessage.js +1 -1
  71. package/lib/features/agent/chat/ModernAgentOutput/StreamingMessage.js.map +1 -1
  72. package/lib/features/agent/chat/ModernAgentOutput/ToolCallGroup.js +1 -1
  73. package/lib/features/agent/chat/ModernAgentOutput/ToolCallGroup.js.map +1 -1
  74. package/lib/features/agent/chat/ModernAgentOutput/WorkstreamTabs.d.ts.map +1 -1
  75. package/lib/features/agent/chat/ModernAgentOutput/WorkstreamTabs.js +9 -121
  76. package/lib/features/agent/chat/ModernAgentOutput/WorkstreamTabs.js.map +1 -1
  77. package/lib/features/agent/chat/ModernAgentOutput/utils.d.ts +6 -0
  78. package/lib/features/agent/chat/ModernAgentOutput/utils.d.ts.map +1 -1
  79. package/lib/features/agent/chat/ModernAgentOutput/utils.js +19 -11
  80. package/lib/features/agent/chat/ModernAgentOutput/utils.js.map +1 -1
  81. package/lib/features/agent/chat/VegaLiteChart.d.ts.map +1 -1
  82. package/lib/features/agent/chat/VegaLiteChart.js +11 -3
  83. package/lib/features/agent/chat/VegaLiteChart.js.map +1 -1
  84. package/lib/features/agent/chat/hooks/useAgentStream.d.ts.map +1 -1
  85. package/lib/features/agent/chat/hooks/useAgentStream.js +3 -0
  86. package/lib/features/agent/chat/hooks/useAgentStream.js.map +1 -1
  87. package/lib/features/document-viewer/UniversalDocumentViewer.d.ts.map +1 -1
  88. package/lib/features/document-viewer/UniversalDocumentViewer.js +1 -1
  89. package/lib/features/document-viewer/UniversalDocumentViewer.js.map +1 -1
  90. package/lib/features/facets/AgentRunnerFacetsNav.d.ts +14 -2
  91. package/lib/features/facets/AgentRunnerFacetsNav.d.ts.map +1 -1
  92. package/lib/features/facets/AgentRunnerFacetsNav.js +20 -2
  93. package/lib/features/facets/AgentRunnerFacetsNav.js.map +1 -1
  94. package/lib/features/facets/CollectionsFacetsNav.d.ts +3 -3
  95. package/lib/features/facets/CollectionsFacetsNav.d.ts.map +1 -1
  96. package/lib/features/facets/CollectionsFacetsNav.js +6 -1
  97. package/lib/features/facets/CollectionsFacetsNav.js.map +1 -1
  98. package/lib/features/facets/DocumentsFacetsNav.d.ts +3 -3
  99. package/lib/features/facets/DocumentsFacetsNav.d.ts.map +1 -1
  100. package/lib/features/facets/DocumentsFacetsNav.js +20 -8
  101. package/lib/features/facets/DocumentsFacetsNav.js.map +1 -1
  102. package/lib/features/facets/InteractionsFacetsNav.d.ts +3 -3
  103. package/lib/features/facets/InteractionsFacetsNav.d.ts.map +1 -1
  104. package/lib/features/facets/InteractionsFacetsNav.js +11 -1
  105. package/lib/features/facets/InteractionsFacetsNav.js.map +1 -1
  106. package/lib/features/facets/PromptsFacetsNav.d.ts +3 -3
  107. package/lib/features/facets/PromptsFacetsNav.d.ts.map +1 -1
  108. package/lib/features/facets/PromptsFacetsNav.js +6 -1
  109. package/lib/features/facets/PromptsFacetsNav.js.map +1 -1
  110. package/lib/features/facets/RunsFacetsNav.d.ts +4 -14
  111. package/lib/features/facets/RunsFacetsNav.d.ts.map +1 -1
  112. package/lib/features/facets/RunsFacetsNav.js +26 -15
  113. package/lib/features/facets/RunsFacetsNav.js.map +1 -1
  114. package/lib/features/facets/WorkflowExecutionsFacetsNav.d.ts +4 -3
  115. package/lib/features/facets/WorkflowExecutionsFacetsNav.d.ts.map +1 -1
  116. package/lib/features/facets/WorkflowExecutionsFacetsNav.js +18 -10
  117. package/lib/features/facets/WorkflowExecutionsFacetsNav.js.map +1 -1
  118. package/lib/features/facets/index.d.ts +1 -1
  119. package/lib/features/facets/index.d.ts.map +1 -1
  120. package/lib/features/facets/index.js.map +1 -1
  121. package/lib/features/facets/utils/SearchInterface.d.ts +4 -3
  122. package/lib/features/facets/utils/SearchInterface.d.ts.map +1 -1
  123. package/lib/features/facets/utils/SearchInterface.js +4 -0
  124. package/lib/features/facets/utils/SearchInterface.js.map +1 -1
  125. package/lib/features/layout/GenericPageNavHeader.d.ts +8 -1
  126. package/lib/features/layout/GenericPageNavHeader.d.ts.map +1 -1
  127. package/lib/features/layout/GenericPageNavHeader.js +9 -1
  128. package/lib/features/layout/GenericPageNavHeader.js.map +1 -1
  129. package/lib/features/magic-pdf/DownloadPopover.d.ts +3 -2
  130. package/lib/features/magic-pdf/DownloadPopover.d.ts.map +1 -1
  131. package/lib/features/magic-pdf/DownloadPopover.js.map +1 -1
  132. package/lib/features/magic-pdf/GroundedExtractionView.d.ts.map +1 -1
  133. package/lib/features/magic-pdf/GroundedExtractionView.js +51 -64
  134. package/lib/features/magic-pdf/GroundedExtractionView.js.map +1 -1
  135. package/lib/features/oauth/McpConnectionsButton.d.ts +1 -1
  136. package/lib/features/oauth/McpConnectionsButton.d.ts.map +1 -1
  137. package/lib/features/oauth/McpConnectionsButton.js +2 -2
  138. package/lib/features/oauth/McpConnectionsButton.js.map +1 -1
  139. package/lib/features/oauth/McpConnectionsDialog.d.ts +1 -1
  140. package/lib/features/oauth/McpConnectionsDialog.js +2 -2
  141. package/lib/features/oauth/McpConnectionsDialog.js.map +1 -1
  142. package/lib/features/oauth/useMcpConnections.d.ts +4 -5
  143. package/lib/features/oauth/useMcpConnections.d.ts.map +1 -1
  144. package/lib/features/oauth/useMcpConnections.js +20 -4
  145. package/lib/features/oauth/useMcpConnections.js.map +1 -1
  146. package/lib/features/pdf-viewer/PdfPageRenderer.d.ts.map +1 -1
  147. package/lib/features/pdf-viewer/PdfPageRenderer.js +9 -11
  148. package/lib/features/pdf-viewer/PdfPageRenderer.js.map +1 -1
  149. package/lib/features/pdf-viewer/lazyReactPdf.d.ts +10 -0
  150. package/lib/features/pdf-viewer/lazyReactPdf.d.ts.map +1 -0
  151. package/lib/features/pdf-viewer/lazyReactPdf.js +25 -0
  152. package/lib/features/pdf-viewer/lazyReactPdf.js.map +1 -0
  153. package/lib/features/store/collections/CollectionsTable.d.ts.map +1 -1
  154. package/lib/features/store/collections/CollectionsTable.js +1 -3
  155. package/lib/features/store/collections/CollectionsTable.js.map +1 -1
  156. package/lib/features/store/collections/EditCollectionView.js +1 -1
  157. package/lib/features/store/collections/EditCollectionView.js.map +1 -1
  158. package/lib/features/store/objects/ExportPropertiesModal.d.ts +3 -1
  159. package/lib/features/store/objects/ExportPropertiesModal.d.ts.map +1 -1
  160. package/lib/features/store/objects/ExportPropertiesModal.js +5 -5
  161. package/lib/features/store/objects/ExportPropertiesModal.js.map +1 -1
  162. package/lib/features/store/objects/components/ContentOverview.d.ts.map +1 -1
  163. package/lib/features/store/objects/components/ContentOverview.js +4 -10
  164. package/lib/features/store/objects/components/ContentOverview.js.map +1 -1
  165. package/lib/features/store/objects/components/TextEditorPanel.d.ts.map +1 -1
  166. package/lib/features/store/objects/components/TextEditorPanel.js +8 -3
  167. package/lib/features/store/objects/components/TextEditorPanel.js.map +1 -1
  168. package/lib/features/store/objects/layout/renderers.d.ts.map +1 -1
  169. package/lib/features/store/objects/layout/renderers.js +1 -5
  170. package/lib/features/store/objects/layout/renderers.js.map +1 -1
  171. package/lib/features/store/objects/search/DocumentSearchContext.d.ts +29 -62
  172. package/lib/features/store/objects/search/DocumentSearchContext.d.ts.map +1 -1
  173. package/lib/features/store/objects/search/DocumentSearchContext.js +2 -0
  174. package/lib/features/store/objects/search/DocumentSearchContext.js.map +1 -1
  175. package/lib/features/store/objects/upload/DocumentUploadModal.d.ts +6 -1
  176. package/lib/features/store/objects/upload/DocumentUploadModal.d.ts.map +1 -1
  177. package/lib/features/store/objects/upload/DocumentUploadModal.js +4 -3
  178. package/lib/features/store/objects/upload/DocumentUploadModal.js.map +1 -1
  179. package/lib/features/store/objects/upload/useSmartFileUploadProcessing.d.ts.map +1 -1
  180. package/lib/features/store/objects/upload/useSmartFileUploadProcessing.js +2 -2
  181. package/lib/features/store/objects/upload/useSmartFileUploadProcessing.js.map +1 -1
  182. package/lib/features/store/types/ContentObjectTypesTable.d.ts.map +1 -1
  183. package/lib/features/store/types/ContentObjectTypesTable.js +1 -3
  184. package/lib/features/store/types/ContentObjectTypesTable.js.map +1 -1
  185. package/lib/features/store/types/IntakePolicyEditor.d.ts.map +1 -1
  186. package/lib/features/store/types/IntakePolicyEditor.js +11 -1
  187. package/lib/features/store/types/IntakePolicyEditor.js.map +1 -1
  188. package/lib/features/store/types/ObjectSchemaEditor.d.ts.map +1 -1
  189. package/lib/features/store/types/ObjectSchemaEditor.js +6 -2
  190. package/lib/features/store/types/ObjectSchemaEditor.js.map +1 -1
  191. package/lib/features/store/types/TableLayoutEditor.d.ts.map +1 -1
  192. package/lib/features/store/types/TableLayoutEditor.js +2 -0
  193. package/lib/features/store/types/TableLayoutEditor.js.map +1 -1
  194. package/lib/features/store/types/TypeRegistry.d.ts +272 -0
  195. package/lib/features/store/types/TypeRegistry.d.ts.map +1 -1
  196. package/lib/features/store/types/search/ObjectTypeSearchContext.d.ts +271 -0
  197. package/lib/features/store/types/search/ObjectTypeSearchContext.d.ts.map +1 -1
  198. package/lib/features/user/UserInfo.d.ts.map +1 -1
  199. package/lib/features/user/UserInfo.js +2 -4
  200. package/lib/features/user/UserInfo.js.map +1 -1
  201. package/lib/features/views/ViewActions.d.ts +32 -0
  202. package/lib/features/views/ViewActions.d.ts.map +1 -0
  203. package/lib/features/views/ViewActions.js +186 -0
  204. package/lib/features/views/ViewActions.js.map +1 -0
  205. package/lib/features/views/ViewDropTarget.d.ts +15 -0
  206. package/lib/features/views/ViewDropTarget.d.ts.map +1 -0
  207. package/lib/features/views/ViewDropTarget.js +79 -0
  208. package/lib/features/views/ViewDropTarget.js.map +1 -0
  209. package/lib/features/views/ViewExperience.d.ts +3 -2
  210. package/lib/features/views/ViewExperience.d.ts.map +1 -1
  211. package/lib/features/views/ViewExperience.js +103 -12
  212. package/lib/features/views/ViewExperience.js.map +1 -1
  213. package/lib/features/views/ViewNavigation.d.ts +1 -1
  214. package/lib/features/views/ViewNavigation.d.ts.map +1 -1
  215. package/lib/features/views/ViewNavigation.js +14 -5
  216. package/lib/features/views/ViewNavigation.js.map +1 -1
  217. package/lib/features/views/ViewResults.d.ts +1 -1
  218. package/lib/features/views/ViewResults.d.ts.map +1 -1
  219. package/lib/features/views/ViewResults.js +124 -34
  220. package/lib/features/views/ViewResults.js.map +1 -1
  221. package/lib/features/views/index.d.ts +1 -0
  222. package/lib/features/views/index.d.ts.map +1 -1
  223. package/lib/features/views/index.js +1 -0
  224. package/lib/features/views/index.js.map +1 -1
  225. package/lib/features/views/types.d.ts +46 -1
  226. package/lib/features/views/types.d.ts.map +1 -1
  227. package/lib/features/views/viewState.d.ts.map +1 -1
  228. package/lib/features/views/viewState.js +34 -0
  229. package/lib/features/views/viewState.js.map +1 -1
  230. package/lib/i18n/LanguageProvider.d.ts +3 -1
  231. package/lib/i18n/LanguageProvider.d.ts.map +1 -1
  232. package/lib/i18n/LanguageProvider.js +9 -7
  233. package/lib/i18n/LanguageProvider.js.map +1 -1
  234. package/lib/i18n/instance.d.ts +2 -0
  235. package/lib/i18n/instance.d.ts.map +1 -1
  236. package/lib/i18n/instance.js +45 -26
  237. package/lib/i18n/instance.js.map +1 -1
  238. package/lib/i18n/locales/ar.json +261 -15
  239. package/lib/i18n/locales/de.json +259 -13
  240. package/lib/i18n/locales/en.json +30 -4
  241. package/lib/i18n/locales/es.json +260 -14
  242. package/lib/i18n/locales/fr.json +259 -13
  243. package/lib/i18n/locales/it.json +259 -13
  244. package/lib/i18n/locales/ja.json +257 -10
  245. package/lib/i18n/locales/ko.json +257 -10
  246. package/lib/i18n/locales/pt.json +259 -13
  247. package/lib/i18n/locales/ru.json +256 -10
  248. package/lib/i18n/locales/tr.json +256 -10
  249. package/lib/i18n/locales/zh-TW.json +257 -10
  250. package/lib/i18n/locales/zh.json +257 -10
  251. package/lib/session/UserSessionProvider.d.ts.map +1 -1
  252. package/lib/session/UserSessionProvider.js +8 -16
  253. package/lib/session/UserSessionProvider.js.map +1 -1
  254. package/lib/session/auth/composable.d.ts.map +1 -1
  255. package/lib/session/auth/composable.js +25 -19
  256. package/lib/session/auth/composable.js.map +1 -1
  257. package/lib/session/auth/firebase.js +1 -1
  258. package/lib/session/auth/firebase.js.map +1 -1
  259. package/lib/shell/VertesiaShell.d.ts.map +1 -1
  260. package/lib/shell/VertesiaShell.js +2 -1
  261. package/lib/shell/VertesiaShell.js.map +1 -1
  262. package/lib/shell/apps/AppInstallationProvider.d.ts +4 -2
  263. package/lib/shell/apps/AppInstallationProvider.d.ts.map +1 -1
  264. package/lib/shell/apps/IframeAppContextSync.d.ts +3 -0
  265. package/lib/shell/apps/IframeAppContextSync.d.ts.map +1 -0
  266. package/lib/shell/apps/IframeAppContextSync.js +95 -0
  267. package/lib/shell/apps/IframeAppContextSync.js.map +1 -0
  268. package/lib/shell/apps/iframe-auth.d.ts +55 -0
  269. package/lib/shell/apps/iframe-auth.d.ts.map +1 -0
  270. package/lib/shell/apps/iframe-auth.js +154 -0
  271. package/lib/shell/apps/iframe-auth.js.map +1 -0
  272. package/lib/shell/apps/index.d.ts +2 -0
  273. package/lib/shell/apps/index.d.ts.map +1 -1
  274. package/lib/shell/apps/index.js +2 -0
  275. package/lib/shell/apps/index.js.map +1 -1
  276. package/lib/vertesia-ui-core.js +4 -4
  277. package/lib/vertesia-ui-core.js.map +1 -1
  278. package/lib/vertesia-ui-env.js +1 -1
  279. package/lib/vertesia-ui-env.js.map +1 -1
  280. package/lib/vertesia-ui-features.js +32 -34
  281. package/lib/vertesia-ui-features.js.map +1 -1
  282. package/lib/vertesia-ui-i18n.js +16 -16
  283. package/lib/vertesia-ui-i18n.js.map +1 -1
  284. package/lib/vertesia-ui-rich-text.js +4 -4
  285. package/lib/vertesia-ui-rich-text.js.map +1 -1
  286. package/lib/vertesia-ui-router.js +1 -1
  287. package/lib/vertesia-ui-router.js.map +1 -1
  288. package/lib/vertesia-ui-session.js +1 -1
  289. package/lib/vertesia-ui-session.js.map +1 -1
  290. package/lib/vertesia-ui-shell.js +1 -1
  291. package/lib/vertesia-ui-shell.js.map +1 -1
  292. package/lib/vertesia-ui-widgets.js +20 -20
  293. package/lib/vertesia-ui-widgets.js.map +1 -1
  294. package/lib/widgets/markdown/MarkdownRenderer.d.ts.map +1 -1
  295. package/lib/widgets/markdown/MarkdownRenderer.js +43 -2
  296. package/lib/widgets/markdown/MarkdownRenderer.js.map +1 -1
  297. package/lib/widgets/markdown/MermaidDiagram.d.ts.map +1 -1
  298. package/lib/widgets/markdown/MermaidDiagram.js +35 -22
  299. package/lib/widgets/markdown/MermaidDiagram.js.map +1 -1
  300. package/lib/widgets/monacoEditor/MonacoEditor.d.ts.map +1 -1
  301. package/lib/widgets/monacoEditor/MonacoEditor.js +14 -10
  302. package/lib/widgets/monacoEditor/MonacoEditor.js.map +1 -1
  303. package/lib/widgets/xml-viewer/hooks/useCollapsible.d.ts +1 -1
  304. package/package.json +24 -29
  305. package/src/core/components/shadcn/filters/comboBox/DateCombobox.tsx +1 -1
  306. package/src/core/components/shadcn/filters/filter/dateFilter.tsx +1 -1
  307. package/src/core/components/shadcn/filters/filters.tsx +1 -1
  308. package/src/core/components/shadcn/index.ts +1 -0
  309. package/src/core/components/shadcn/modal/dialog.test.tsx +35 -0
  310. package/src/core/components/shadcn/modal/dialog.tsx +0 -4
  311. package/src/core/components/shadcn/overflowTabs.tsx +320 -0
  312. package/src/core/components/shadcn/selectBox.tsx +2 -2
  313. package/src/core/components/shadcn/theme/ThemeProvider.tsx +10 -9
  314. package/src/core/utils/dayjs.ts +17 -0
  315. package/src/css/base.css +78 -0
  316. package/src/env/index.test.ts +94 -0
  317. package/src/env/index.ts +36 -1
  318. package/src/features/agent/PayloadBuilder.test.ts +68 -0
  319. package/src/features/agent/PayloadBuilder.tsx +28 -4
  320. package/src/features/agent/chat/AgentRightPanel.tsx +2 -252
  321. package/src/features/agent/chat/ArtifactsTab.tsx +1 -0
  322. package/src/features/agent/chat/AskUserWidget.test.tsx +20 -1
  323. package/src/features/agent/chat/AskUserWidget.tsx +22 -6
  324. package/src/features/agent/chat/ModernAgentConversation.test.tsx +160 -0
  325. package/src/features/agent/chat/ModernAgentConversation.tsx +111 -31
  326. package/src/features/agent/chat/ModernAgentOutput/ActiveWorkstreamsSummary.tsx +86 -67
  327. package/src/features/agent/chat/ModernAgentOutput/AllMessagesMixed.test.tsx +90 -7
  328. package/src/features/agent/chat/ModernAgentOutput/AllMessagesMixed.tsx +4 -6
  329. package/src/features/agent/chat/ModernAgentOutput/AttachmentPreview.test.ts +103 -1
  330. package/src/features/agent/chat/ModernAgentOutput/AttachmentPreview.tsx +50 -4
  331. package/src/features/agent/chat/ModernAgentOutput/BatchProgressPanel.tsx +1 -1
  332. package/src/features/agent/chat/ModernAgentOutput/Header.tsx +18 -1
  333. package/src/features/agent/chat/ModernAgentOutput/MessageItem.tsx +1 -1
  334. package/src/features/agent/chat/ModernAgentOutput/StreamingMessage.tsx +1 -1
  335. package/src/features/agent/chat/ModernAgentOutput/ToolCallGroup.tsx +1 -1
  336. package/src/features/agent/chat/ModernAgentOutput/WorkstreamTabs.tsx +37 -167
  337. package/src/features/agent/chat/ModernAgentOutput/utils.test.ts +94 -0
  338. package/src/features/agent/chat/ModernAgentOutput/utils.ts +19 -10
  339. package/src/features/agent/chat/VegaLiteChart.tsx +32 -14
  340. package/src/features/agent/chat/hooks/useAgentStream.test.tsx +18 -0
  341. package/src/features/agent/chat/hooks/useAgentStream.ts +3 -0
  342. package/src/features/document-viewer/UniversalDocumentViewer.tsx +1 -1
  343. package/src/features/facets/AgentRunnerFacetsNav.tsx +44 -4
  344. package/src/features/facets/CollectionsFacetsNav.tsx +15 -4
  345. package/src/features/facets/DocumentsFacetsNav.tsx +25 -8
  346. package/src/features/facets/FacetQueryHandlers.test.ts +84 -0
  347. package/src/features/facets/InteractionsFacetsNav.tsx +20 -4
  348. package/src/features/facets/PromptsFacetsNav.tsx +15 -4
  349. package/src/features/facets/RunsFacetsNav.test.ts +59 -0
  350. package/src/features/facets/RunsFacetsNav.tsx +40 -30
  351. package/src/features/facets/WorkflowExecutionsFacetsNav.test.ts +57 -0
  352. package/src/features/facets/WorkflowExecutionsFacetsNav.tsx +36 -16
  353. package/src/features/facets/index.ts +1 -0
  354. package/src/features/facets/utils/SearchInterface.tsx +12 -3
  355. package/src/features/layout/GenericPageNavHeader.tsx +16 -0
  356. package/src/features/magic-pdf/DownloadPopover.tsx +1 -2
  357. package/src/features/magic-pdf/GroundedExtractionView.test.tsx +7 -1
  358. package/src/features/magic-pdf/GroundedExtractionView.tsx +162 -242
  359. package/src/features/oauth/McpConnectionsButton.test.tsx +18 -1
  360. package/src/features/oauth/McpConnectionsButton.tsx +6 -2
  361. package/src/features/oauth/McpConnectionsDialog.tsx +3 -3
  362. package/src/features/oauth/useMcpConnections.test.ts +1 -0
  363. package/src/features/oauth/useMcpConnections.ts +24 -7
  364. package/src/features/pdf-viewer/PdfPageRenderer.tsx +76 -71
  365. package/src/features/pdf-viewer/lazyReactPdf.ts +33 -0
  366. package/src/features/store/collections/CollectionsTable.tsx +1 -4
  367. package/src/features/store/collections/EditCollectionView.tsx +1 -1
  368. package/src/features/store/objects/ExportPropertiesModal.tsx +25 -16
  369. package/src/features/store/objects/components/ContentOverview.tsx +2 -28
  370. package/src/features/store/objects/components/TextEditorPanel.tsx +13 -3
  371. package/src/features/store/objects/layout/renderers.tsx +1 -6
  372. package/src/features/store/objects/search/DocumentSearchContext.ts +4 -2
  373. package/src/features/store/objects/upload/DocumentUploadModal.tsx +10 -3
  374. package/src/features/store/objects/upload/useSmartFileUploadProcessing.ts +15 -6
  375. package/src/features/store/types/ContentObjectTypesTable.tsx +1 -4
  376. package/src/features/store/types/IntakePolicyEditor.tsx +11 -1
  377. package/src/features/store/types/ObjectSchemaEditor.tsx +6 -2
  378. package/src/features/store/types/TableLayoutEditor.tsx +2 -0
  379. package/src/features/user/UserInfo.test.tsx +10 -0
  380. package/src/features/user/UserInfo.tsx +2 -7
  381. package/src/features/views/ViewActions.test.tsx +80 -0
  382. package/src/features/views/ViewActions.tsx +352 -0
  383. package/src/features/views/ViewDropTarget.test.tsx +150 -0
  384. package/src/features/views/ViewDropTarget.tsx +140 -0
  385. package/src/features/views/ViewExperience.test.tsx +72 -0
  386. package/src/features/views/ViewExperience.tsx +189 -22
  387. package/src/features/views/ViewMedia.test.tsx +180 -0
  388. package/src/features/views/ViewNavigation.test.tsx +42 -0
  389. package/src/features/views/ViewNavigation.tsx +43 -5
  390. package/src/features/views/ViewResults.tsx +243 -26
  391. package/src/features/views/index.ts +1 -0
  392. package/src/features/views/types.ts +50 -0
  393. package/src/features/views/viewState.test.ts +7 -1
  394. package/src/features/views/viewState.ts +32 -0
  395. package/src/i18n/LanguageProvider.tsx +15 -8
  396. package/src/i18n/instance.test.ts +30 -0
  397. package/src/i18n/instance.ts +67 -40
  398. package/src/i18n/locales/ar.json +1157 -911
  399. package/src/i18n/locales/de.json +1113 -867
  400. package/src/i18n/locales/en.json +30 -4
  401. package/src/i18n/locales/es.json +1124 -878
  402. package/src/i18n/locales/fr.json +1124 -878
  403. package/src/i18n/locales/it.json +1124 -878
  404. package/src/i18n/locales/ja.json +1113 -866
  405. package/src/i18n/locales/ko.json +1113 -866
  406. package/src/i18n/locales/pt.json +1124 -878
  407. package/src/i18n/locales/ru.json +1135 -889
  408. package/src/i18n/locales/tr.json +1113 -867
  409. package/src/i18n/locales/zh-TW.json +1113 -866
  410. package/src/i18n/locales/zh.json +1113 -866
  411. package/src/i18n/rtl.test.ts +16 -7
  412. package/src/rich-text/VertesiaRichTextEditor.test.tsx +33 -1
  413. package/src/session/UserSessionProvider.tsx +8 -20
  414. package/src/session/auth/composable.scope.test.ts +1 -1
  415. package/src/session/auth/composable.test.ts +61 -1
  416. package/src/session/auth/composable.ts +29 -23
  417. package/src/session/auth/firebase.ts +1 -1
  418. package/src/shell/VertesiaShell.tsx +2 -0
  419. package/src/shell/apps/IframeAppContextSync.test.tsx +196 -0
  420. package/src/shell/apps/IframeAppContextSync.tsx +101 -0
  421. package/src/shell/apps/iframe-auth.test.ts +118 -0
  422. package/src/shell/apps/iframe-auth.ts +193 -0
  423. package/src/shell/apps/index.ts +2 -0
  424. package/src/widgets/markdown/ArtifactEditingSurface.test.tsx +12 -3
  425. package/src/widgets/markdown/MarkdownRenderer.tsx +50 -2
  426. package/src/widgets/markdown/MermaidDiagram.tsx +38 -22
  427. package/src/widgets/monacoEditor/MonacoEditor.tsx +27 -20
  428. package/lib/features/magic-pdf/GroundedExtractionAssistantPanel.d.ts +0 -25
  429. package/lib/features/magic-pdf/GroundedExtractionAssistantPanel.d.ts.map +0 -1
  430. package/lib/features/magic-pdf/GroundedExtractionAssistantPanel.js +0 -42
  431. package/lib/features/magic-pdf/GroundedExtractionAssistantPanel.js.map +0 -1
  432. package/src/features/magic-pdf/GroundedExtractionAssistantPanel.tsx +0 -86
@@ -1,2 +1,2 @@
1
- import{Fragment as e,jsx as t,jsxs as n}from"react/jsx-runtime";import{createContext as r,useCallback as i,useContext as a,useEffect as o,useMemo as s,useRef as c,useState as l}from"react";import{Avatar as u,Button as d,Center as f,ErrorBox as p,Input as m,MenuList as h,Modal as g,ModalBody as _,ModalFooter as v,ModalTitle as y,ModeToggle as b,Popover as x,PopoverContent as S,PopoverTrigger as C,RadioGroup as w,SelectBox as T,Spinner as E,Tabs as D,TabsBar as O,TabsPanel as k,ThemeProvider as A,ToastProvider as ee,VTooltip as j,errorMessage as M,useFetch as N,useToast as P}from"@vertesia/ui/core";import{AuthenticationServiceError as F,CredentialError as I,DevSessionProvider as te,LastSelectedAccountId_KEY as L,LastSelectedProjectId_KEY as R,NoAccessibleAccountError as z,RequestedScopeUnavailableError as B,RestrictedEnvironmentError as ne,UserNotFoundError as re,UserSessionProvider as V,fetchComposableTokenFromFirebaseToken as ie,fetchComposableTokenFromVertesiaToken as ae,getCurrentVertesiaToken as oe,getFirebaseAuth as H,setFirebaseTenant as se,useUXTracking as ce,useUserSession as U}from"@vertesia/ui/session";import{LanguageBoundI18nProvider as le,LanguageProvider as ue,useUITranslation as W}from"@vertesia/ui/i18n";import{AlertTriangle as de,ArrowRight as fe,Check as pe,CopyIcon as me,LockIcon as he,LockKeyhole as ge,Mail as _e,ShieldOff as ve}from"lucide-react";import{Permission as ye,REQUESTED_SCOPE_UNAVAILABLE_ERROR_CODE as be,getTenantIdFromProject as xe}from"@vertesia/common";import{Env as G}from"@vertesia/ui/env";import{RegionTag as Se}from"@vertesia/ui/layout";import{GithubAuthProvider as Ce,GoogleAuthProvider as we,OAuthProvider as Te,signInWithRedirect as Ee,signOut as De}from"firebase/auth";import{useLocation as Oe,useNavigate as ke}from"@vertesia/ui/router";import{TypeRegistryProvider as Ae,UserPermissionProvider as je,useUserPermissions as Me}from"@vertesia/ui/features";import Ne from"clsx";import{AnimatePresence as Pe,motion as Fe}from"framer-motion";const Ie=r(null);function Le({installation:e,children:n}){return t(Ie.Provider,{value:e,children:n})}function Re(){return a(Ie)}function ze({app:e,onChange:r,placeholder:i}){let{client:a,project:o}=U(),{data:s,error:c}=N(()=>a.apps.getAppInstallationProjects(e),[e.id,e.name]);return c?n(`span`,{className:`text-red-600`,children:[`Error: failed to fetch projects: `,M(c)]}):t(Be,{placeholder:i,initialValue:o?.id,projects:s||[],onChange:e=>{r&&!r(e)||(localStorage.setItem(L,e.account),localStorage.setItem(`${R}-${e.account}`,e.id),window.location.reload())}})}function Be({initialValue:e,projects:n,onChange:r,placeholder:i=`Select Project`}){let[a,o]=l();return t(T,{by:`id`,value:!a&&e?n.find(t=>t.id===e):a,options:n,optionLabel:e=>e.name,placeholder:i,onChange:e=>{o(e),r(e)}})}function Ve({name:e,AccessDenied:n=Ue,children:r}){return e?t(He,{name:e,AccessDenied:n,children:r}):t(We,{})}function He({name:e,AccessDenied:n=Ue,children:r}){let{authToken:i,client:a}=U(),[s,c]=l(null),[u,d]=l(`loading`);if(o(()=>{i?i.apps.includes(e)?a.apps.getAppInstallationByName(e).then(t=>{t?(d(`loaded`),c(t)):(console.log(`App ${e} not found!`),d(`error`))}):d(`error`):d(`loading`)},[e,i,a.apps.getAppInstallationByName]),u===`loading`)return null;if(u===`error`)return t(n,{name:e});if(s)return t(Le,{installation:s,children:r})}function Ue({name:e}){let{project:r,accounts:i,client:a}=U(),{t:c}=W(),[u,d]=l(),{data:p}=N(()=>a.apps.getAppInstallationProjects({name:e}),[e]),{projectsByOrg:m,orgOptions:h}=s(()=>{if(!p||!i)return{projectsByOrg:{},orgOptions:[]};let e={};for(let t of p)e[t.account]||(e[t.account]=[]),e[t.account].push(t);return{projectsByOrg:e,orgOptions:i.filter(t=>e[t.id]?.length>0)}},[p,i]);o(()=>{!u&&h.length>0&&d(h[0].id)},[h,u]);let g=e=>{localStorage.setItem(L,e.account),localStorage.setItem(`${R}-${e.account}`,e.id),window.location.reload()},_=u&&m[u]||[],v=h.find(e=>e.id===u);return n(f,{className:`pt-10 flex flex-col items-center text-center text-gray-700`,children:[t(he,{className:`w-10 h-10 mb-4 text-gray-500`}),t(`div`,{className:`text-xl font-semibold`,children:c(`shell.accessDenied`)}),n(`div`,{className:`mt-2 text-sm text-gray-500`,children:[`You don't have permission to view the `,t(`span`,{className:`font-semibold`,children:e}),` app in project:`,` `,n(`span`,{className:`font-semibold`,children:[`«`,r?.name,`»`]}),`.`]}),h.length===0&&p!==void 0&&t(`div`,{className:`mt-4 text-sm text-gray-500`,children:`This app is not installed in any project you have access to.`}),h.length>0&&n(`div`,{className:`mt-4 flex flex-row gap-4 items-end`,children:[h.length>1&&n(`div`,{children:[t(`div`,{className:`text-sm text-gray-500 mb-2`,children:c(`shell.organization`)}),t(T,{by:`id`,value:v,options:h,optionLabel:e=>e.name,placeholder:c(`shell.selectOrganization`),onChange:e=>d(e.id)})]}),n(`div`,{children:[h.length>1&&t(`div`,{className:`text-sm text-gray-500 mb-2`,children:c(`login.terminal.project`)}),t(T,{by:`id`,value:void 0,options:_,optionLabel:e=>e.name,placeholder:c(`shell.selectProject`),onChange:g})]})]})]})}function We(){let{t:e}=W();return n(f,{className:`pt-10 flex flex-col items-center text-center text-gray-700`,children:[t(he,{className:`w-10 h-10 mb-4 text-gray-500`}),t(`div`,{className:`text-xl font-semibold`,children:e(`shell.applicationNotRegistered`)}),n(`div`,{className:`mt-2 text-sm text-gray-500`,children:[`Before starting to code a Vertesia application you must register an application manifest in Vertesia Studio then install it in one or more projects.`,t(`p`,{}),`Then use the created app name as a parameter to`,` `,t(`code`,{children:`<StandaloneApp name="your-app-name">`}),` in the `,t(`code`,{children:`src/main.tsx`}),` file.`]})]})}function Ge(){let e=U(),{client:r}=e,{t:i}=W(),[a,s]=l(!1),[c,u]=l([]);o(()=>{r.account.listInvites().then(e=>{if(e.length>0){let t=e.filter(e=>e.data.account);if(t.length===0){console.log(`No valid invites found, closing modal`);return}console.log(`Found valid invites`,t.length),s(!0),u(t)}else console.log(`No invites found, closing modal`),s(!1)}).catch(e=>{console.error(`Error fetching invites`,e)})},[r.account.listInvites]);let f=()=>s(!1),p=async t=>{await r.account.acceptInvite(t.id),await e.authCallback,await e.fetchAccounts(),await e.fetchProjects(t.data.account.id);let n=c.filter(e=>e.id!==t.id).filter(e=>e.data.account);n.length>0?u(n):f()},m=async e=>{await r.account.rejectInvite(e.id);let t=c.filter(t=>t.id!==e.id);u(t),t.length===0&&f()},h=c.map(e=>e.data.account?n(`div`,{className:`flex flex-row w-full justify-between border rounded-sm px-2 py-2 `,children:[n(`div`,{className:`flex flex-col`,children:[t(`div`,{className:`w-full font-semibold`,children:e.data.account.name??e.data.account}),e.data.project&&n(`div`,{className:`w-full text-base`,children:[`- `,e.data.project.name]}),n(`div`,{className:`text-xs`,children:[`Role: `,e.data.role]}),e.data.invited_by&&n(`div`,{className:`text-xs`,children:[`by `,e.data.invited_by.name??e.data.invited_by]})]}),n(`div`,{className:`flex flex-col gap-4`,children:[t(d,{size:`xs`,onClick:()=>p(e),children:i(`login.accept`)}),` `,t(d,{size:`xs`,variant:`secondary`,onClick:()=>m(e),children:i(`login.reject`)})]})]},e.id):(console.warn(`Invite has no account data`,e),null));return t(`div`,{children:n(g,{isOpen:a,onClose:f,children:[t(y,{children:i(`login.reviewInvites`)}),n(_,{children:[t(`div`,{className:`text-sm pb-4`,children:`You have received the following invites to join other accounts. Please review and accept or declined them.`}),h]})]})})}function Ke(e){return n(`svg`,{viewBox:`0 0 48 48`,"aria-hidden":`true`,...e,children:[t(`path`,{fill:`#FFC107`,d:`M43.6 20.5H42V20H24v8h11.3c-1.6 4.7-6.1 8-11.3 8a12 12 0 0 1 0-24c3 0 5.8 1.1 7.9 3l5.7-5.7A20 20 0 1 0 24 44c11 0 20-9 20-20 0-1.2-.1-2.3-.4-3.5z`}),t(`path`,{fill:`#FF3D00`,d:`M6.3 14.7l6.6 4.8A12 12 0 0 1 24 12c3 0 5.8 1.1 7.9 3l5.7-5.7A20 20 0 0 0 6.3 14.7z`}),t(`path`,{fill:`#4CAF50`,d:`M24 44c5.2 0 10-2 13.6-5.2l-6.3-5.3A12 12 0 0 1 12.7 28.5l-6.6 5.1A20 20 0 0 0 24 44z`}),t(`path`,{fill:`#1976D2`,d:`M43.6 20.5H42V20H24v8h11.3a12 12 0 0 1-4 5.5l6.3 5.3C37.9 36.6 44 31 44 24c0-1.2-.1-2.3-.4-3.5z`})]})}function qe(e){return t(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":`true`,...e,children:t(`path`,{fill:`currentColor`,fillRule:`evenodd`,clipRule:`evenodd`,d:`M12 2C6.48 2 2 6.58 2 12.25c0 4.54 2.87 8.39 6.84 9.75.5.09.68-.22.68-.49v-1.7c-2.78.62-3.37-1.36-3.37-1.36-.46-1.18-1.11-1.5-1.11-1.5-.91-.63.07-.62.07-.62 1 .07 1.53 1.05 1.53 1.05.89 1.57 2.34 1.12 2.91.86.09-.66.35-1.12.63-1.38-2.22-.26-4.56-1.14-4.56-5.07 0-1.12.39-2.03 1.03-2.75-.1-.26-.45-1.3.1-2.7 0 0 .84-.28 2.76 1.05A9.4 9.4 0 0 1 12 7.07c.85 0 1.71.12 2.51.34 1.91-1.33 2.75-1.05 2.75-1.05.55 1.4.2 2.44.1 2.7.64.72 1.03 1.63 1.03 2.75 0 3.94-2.34 4.81-4.57 5.06.36.32.68.94.68 1.9v2.81c0 .27.18.59.69.49C19.13 20.64 22 16.78 22 12.25 22 6.58 17.52 2 12 2z`})})}function Je(e){return n(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":`true`,...e,children:[t(`path`,{fill:`#F25022`,d:`M2 2h9.5v9.5H2z`}),t(`path`,{fill:`#7FBA00`,d:`M12.5 2H22v9.5h-9.5z`}),t(`path`,{fill:`#00A4EF`,d:`M2 12.5h9.5V22H2z`}),t(`path`,{fill:`#FFB900`,d:`M12.5 12.5H22V22h-9.5z`})]})}const Ye=ge,Xe={google:Ke,github:qe,microsoft:Je,oidc:Ye};function Ze(e){return e&&e in Xe?Xe[e]:Ye}function K({children:e,centered:n=!1}){return t(`div`,{className:n?`w-full max-w-[420px] flex flex-col gap-6 items-center text-center`:`w-full max-w-[420px] flex flex-col gap-6`,children:e})}function q({eyebrow:e,title:r,body:i,variant:a=`info`}){return n(`div`,{children:[e&&t(`div`,{className:`${a===`destructive`?`text-destructive`:`text-info`} text-[12.5px] font-medium mb-2`,children:e}),t(`h1`,{className:`text-foreground text-[22px] font-semibold tracking-tight leading-tight mb-1.5`,children:r}),i&&t(`p`,{className:`text-muted text-sm leading-relaxed`,children:i})]})}const Qe={primary:`h-[42px] gap-2.5 rounded-md bg-foreground text-background hover:opacity-90 disabled:opacity-50 disabled:cursor-not-allowed`,loading:`h-[42px] gap-2.5 rounded-md bg-foreground text-background opacity-90`,ghost:`h-9 text-muted hover:text-foreground`};function J({variant:e=`primary`,className:n=``,type:r=`button`,disabled:i,...a}){return t(d,{variant:`unstyled`,size:`none`,type:r,disabled:e===`loading`||i,className:`cursor-pointer inline-flex items-center justify-center text-sm font-medium transition ${Qe[e]} ${n}`.trim(),...a})}function $e({size:e=`xs`,className:n=``,type:r=`button`,...i}){let a=`cursor-pointer ${e===`smaller`?`!text-[11px]`:`!text-xs`} text-muted hover:text-foreground !transition px-2 py-1 !rounded underline decoration-transparent hover:decoration-current underline-offset-[3px]`;return t(d,{variant:`unstyled`,size:`none`,type:r,className:n?`${a} ${n}`:a,...i})}const et={circle:`size-9 rounded-full text-sm ring-4 ring-background ring-offset-1 ring-offset-border`,square:`size-[30px] rounded-md text-[11px]`};function tt({initials:e,shape:n=`circle`}){return t(`span`,{className:`bg-info text-info-foreground grid place-items-center font-semibold shrink-0 ${et[n]}`,children:e})}function nt({children:e}){return t(`div`,{className:`inline-grid place-items-center size-14 rounded-xl bg-info-background border border-info/15 mb-3.5`,children:e})}function rt({title:e,subtitle:r,titleClass:i,subtitleClass:a}){return n(`div`,{className:`flex-1 min-w-0`,children:[t(`div`,{className:i,children:e}),t(`div`,{className:a,children:r})]})}const it={tenant:{topRow:`flex items-center gap-2.5 px-3 py-2.5`,title:`text-[13.5px] font-semibold text-foreground leading-tight`,subtitle:`text-[11.5px] text-muted leading-tight mt-0.5`,bottomRow:`flex items-center gap-2.5 px-3 py-1.5 border-t border-border bg-muted-background`,mailBox:`size-[30px] grid place-items-center shrink-0`,mailIcon:`size-4 text-muted`,email:`text-sm text-foreground/80 flex-1 truncate`,actionSize:`xs`},returning:{topRow:`flex items-center gap-3 px-3.5 py-2.5`,title:`text-sm font-semibold text-foreground truncate`,subtitle:`text-xs text-foreground/80 truncate`,bottomRow:`flex items-center gap-3 px-3.5 py-1 border-t border-border bg-muted-background`,mailBox:`w-9 h-6 grid place-items-center shrink-0`,mailIcon:`size-3.5 text-muted`,email:`text-xs text-foreground/80 flex-1 truncate`,actionSize:`smaller`}};function at({variant:e=`returning`,badge:r,title:i,subtitle:a,email:o,actionLabel:s,onAction:c}){let l=it[e];return n(`div`,{className:`rounded-md border border-border bg-background overflow-hidden`,children:[n(`div`,{className:l.topRow,children:[r,t(rt,{title:i,subtitle:a,titleClass:l.title,subtitleClass:l.subtitle})]}),n(`div`,{className:l.bottomRow,children:[t(`div`,{className:l.mailBox,children:t(_e,{className:l.mailIcon})}),t(`span`,{className:l.email,children:o}),t($e,{size:l.actionSize,onClick:c,children:s})]})]})}function ot({badge:e,title:r,subtitle:i,actionLabel:a,onAction:o}){return n(`div`,{className:`flex items-center gap-3 px-3.5 py-2.5 rounded-md border border-border bg-muted-background`,children:[e,t(rt,{title:r,subtitle:i,titleClass:`text-sm font-semibold text-foreground truncate`,subtitleClass:`text-xs text-muted truncate`}),t($e,{onClick:o,children:a})]})}function st({email:e,actionLabel:r,onAction:i}){return n(`div`,{className:`flex items-center gap-2 px-3 py-2 rounded-md border border-border bg-muted-background`,children:[t(_e,{className:`size-4 text-muted shrink-0`}),t(`span`,{className:`text-sm text-foreground/80 flex-1 truncate`,children:e}),t($e,{onClick:i,children:r})]})}function ct({provider:e,label:r,onClick:i,variant:a=`outline`}){let o=Ze(e);return a===`arrow`?n(d,{variant:`unstyled`,size:`none`,onClick:i,className:`cursor-pointer group h-[42px] w-full inline-flex items-center gap-3 ps-3.5 pe-3 rounded-md border border-border bg-background text-sm font-medium text-foreground transition hover:bg-muted-background`,children:[t(o,{className:`!size-[18px] shrink-0`}),t(`span`,{className:`flex-1 text-start`,children:r}),t(fe,{className:`!size-3.5 text-muted opacity-0 group-hover:opacity-100 group-hover:translate-x-0.5 rtl:group-hover:-translate-x-0.5 transition`})]}):n(d,{variant:`outline`,onClick:i,className:`w-full py-5 flex rounded-lg transition duration-150 text-center ${a===`filled`?`!bg-foreground text-background hover:!bg-foreground/90`:`hover:shadow-sm`}`,children:[t(o,{className:`!size-[18px]`}),t(`span`,{className:`text-sm font-medium`,children:r})]})}function lt({icon:e,title:r,meta:i}){return n(`div`,{className:`flex items-center gap-2.5 px-3 py-2.5 rounded-md bg-destructive-background border border-destructive/20`,children:[t(e,{className:`size-5 text-destructive shrink-0`}),n(`div`,{className:`flex-1 min-w-0 text-sm`,children:[t(`div`,{className:`font-semibold text-destructive`,children:r}),t(`div`,{className:`text-xs text-destructive/80`,children:i})]})]})}function ut({inputRef:e,label:r,placeholder:i,value:a,onChange:o,invalid:s=!1,error:c}){return n(`div`,{className:`flex flex-col gap-1.5`,children:[t(`label`,{htmlFor:`vt-login-email`,className:`text-xs font-medium text-foreground/80`,children:r}),t(`input`,{ref:e,id:`vt-login-email`,name:`vt-login-email`,type:`email`,className:`h-[42px] px-3.5 rounded-md border border-border bg-background text-sm text-foreground placeholder:text-muted-foreground outline-none transition focus:border-info focus:ring-4 focus:ring-info/15 aria-[invalid=true]:border-destructive aria-[invalid=true]:ring-destructive/15`,placeholder:i,value:a,onChange:e=>o(e.target.value),"aria-invalid":s,autoComplete:`off`,autoCorrect:`off`,autoCapitalize:`off`,spellCheck:!1,"data-1p-ignore":!0,"data-lpignore":`true`,"data-form-type":`other`}),c&&t(`div`,{role:`alert`,className:`text-xs text-destructive`,children:c})]})}const dt=`vt.lastSuccessfulLogin`,ft=`vt.pendingSignin`;function pt(){try{let e=localStorage.getItem(dt);if(!e)return null;let t=JSON.parse(e);return!t?.email||!t?.lastProvider?null:t}catch{return null}}function mt(e){try{localStorage.setItem(dt,JSON.stringify(e))}catch{}}function ht(){try{localStorage.removeItem(dt)}catch{}}function gt(){try{let e=sessionStorage.getItem(ft);return e?JSON.parse(e):null}catch{return null}}function _t(e){try{sessionStorage.setItem(ft,JSON.stringify(e))}catch{}}function vt(){try{sessionStorage.removeItem(ft)}catch{}}async function yt(){ht(),vt();try{await De(H())}catch{}}function bt(e){let t=e||window.location.pathname||`/`;return t[0]!==`/`&&(t=`/${t}`),t}const xt={google:(e,t)=>{let n=new we;return n.addScope(`profile`),n.addScope(`email`),n.setCustomParameters({redirect_uri:window.location.origin+bt(t),...e?{login_hint:e}:{prompt:`select_account`}}),n},github:e=>{let t=new Ce;return t.addScope(`profile`),t.addScope(`email`),e&&t.setCustomParameters({login:e}),t},microsoft:e=>{let t=new Te(`microsoft.com`);return t.addScope(`profile`),t.addScope(`email`),e&&t.setCustomParameters({login_hint:e}),t},oidc:e=>{let t=new Te(`oidc.main`);return e&&t.setCustomParameters({login_hint:e}),t}};function St(e,t,n){return xt[e](t,n)}async function Ct(e,t,n){if(!t)return{ok:!1,reason:`no-email`};let r=await se(t),i=H(),a=e,o;return r?(r.provider&&(a=r.provider),o=r.label||r.name||void 0,localStorage.setItem(`tenantName`,o??``)):(localStorage.removeItem(`tenantName`),i.tenantId&&=null),_t({email:t,provider:a,tenantName:o}),Ee(i,St(a,t,n)),{ok:!0}}function wt(e,t){let n=H();localStorage.removeItem(`tenantName`),n.tenantId&&=null,Ee(n,St(e,void 0,t))}function Y(e){return e===`google`?`Google`:e===`github`?`GitHub`:e===`microsoft`?`Microsoft`:`Sign In`}function Tt(e){if(!e)return``;let t=e.lastIndexOf(`@`);return t>0?e.slice(0,t):e}function Et(e){if(!e)return``;let t=e.lastIndexOf(`@`);return t>0?e.slice(t+1):``}function Dt(e){return e&&e.charAt(0).toUpperCase()+e.slice(1)}function Ot(e){return(e||`?`).charAt(0).toUpperCase()}function kt(e){let t=Tt(e).split(/[._-]+/).filter(Boolean)[0]||`friend`;return t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()}function At(e){for(let t of e)if(t.trim()===``)return!0;return!1}function jt(e){let t=(e||``).trim(),n=t.indexOf(`@`);if(n<=0||n!==t.lastIndexOf(`@`))return!1;let r=t.slice(n+1),i=r.indexOf(`.`);return i>0&&i<r.length-1&&!At(t)}function Mt(e){let t=e;for(let e=0;t!=null&&e<8;e++){if((t instanceof Error?t.message:String(t)).includes(`Customer-domain user requires an invite to join`))return!0;t=t instanceof Error?t.cause:void 0}return!1}function Nt({provider:e,onCancel:r}){let{t:i}=W(),a=Ze(e),o=e===`oidc`?i(`auth.pending.genericProvider`):Y(e);return n(K,{centered:!0,children:[n(`div`,{children:[t(nt,{children:t(a,{className:e===`oidc`?`size-6 text-info`:`size-6`})}),t(q,{title:i(`auth.pending.title`,{provider:o}),body:i(`auth.pending.body`)})]}),n(`div`,{className:`w-full flex flex-col gap-2`,children:[n(J,{variant:`loading`,children:[t(E,{}),t(`span`,{children:i(`auth.pending.authenticating`)})]}),r&&t(J,{variant:`ghost`,onClick:r,children:i(`auth.pending.cancel`)})]})]})}function Pt({initialEmail:r,onProceed:i}){let{t:a}=W(),[s,u]=l(r??``),[d,f]=l(!1),[p,m]=l(!1),h=c(null);return o(()=>{h.current?.focus()},[]),n(K,{children:[t(q,{eyebrow:a(`auth.email.eyebrow`),title:a(`auth.email.title`),body:a(`auth.email.body`)}),n(`form`,{onSubmit:async e=>{if(e.preventDefault(),!p){if(!jt(s)){f(!0);return}f(!1),m(!0);try{let e=await se(s.trim().toLowerCase());i(s.trim().toLowerCase(),e??void 0)}catch{i(s.trim().toLowerCase(),void 0)}finally{m(!1)}}},noValidate:!0,className:`flex flex-col ${d?`gap-2`:`gap-6`}`,children:[t(ut,{inputRef:h,label:a(`auth.email.label`),placeholder:a(`auth.email.placeholder`),value:s,onChange:e=>{u(e),d&&f(!1)},invalid:d,error:d?a(`auth.email.invalidError`):void 0}),t(J,{type:`submit`,disabled:p,children:p?t(E,{}):n(e,{children:[t(`span`,{children:a(`auth.continue`)}),t(fe,{className:`!size-3.5`})]})})]})]})}const Ft=[`google`,`github`,`microsoft`];function It({email:e,onBack:r,onProviderClicked:i,redirectTo:a}){let{t:o}=W(),s=async t=>{i(t),await Ct(t,e,a)};return n(K,{children:[t(q,{eyebrow:o(`auth.providers.eyebrow`),title:o(`auth.providers.title`),body:o(`auth.providers.bodyConsumer`)}),t(st,{email:e,actionLabel:o(`auth.change`),onAction:r}),t(`div`,{className:`flex flex-col gap-2`,children:Ft.map(e=>t(ct,{provider:e,label:o(`auth.continueWithProvider`,{provider:Y(e)}),onClick:()=>s(e),variant:`arrow`},e))})]})}function X({details:r,identity:i,kind:a,onContinue:s,onUseDifferentAccount:u}){let{t:d}=W(),[f,p]=l(!1),m=c(null);o(()=>{m.current?.focus()},[]);let h=a===`scopeProject`||a===`scopeAccount`,g;g=a===`scopeProject`?{eyebrow:d(`auth.recovery.scopeProject.eyebrow`),title:d(`auth.recovery.scopeProject.title`),body:d(`auth.recovery.scopeProject.body`)}:a===`scopeAccount`?{eyebrow:d(`auth.recovery.scopeAccount.eyebrow`),title:d(`auth.recovery.scopeAccount.title`),body:d(`auth.recovery.scopeAccount.body`)}:a===`noAccessibleAccount`?{eyebrow:d(`auth.recovery.noAccessibleAccount.eyebrow`),title:d(`auth.recovery.noAccessibleAccount.title`),body:d(`auth.recovery.noAccessibleAccount.body`)}:a===`credential`?{eyebrow:d(`auth.recovery.credential.eyebrow`),title:d(`auth.recovery.credential.title`),body:d(`auth.recovery.credential.body`)}:{eyebrow:d(`auth.recovery.service.eyebrow`),title:d(`auth.recovery.service.title`),body:d(`auth.recovery.service.body`)};let _=e=>{f||(p(!0),e())};return n(K,{children:[n(`div`,{role:`alert`,"aria-live":`assertive`,children:[t(nt,{children:t(de,{className:`size-7 text-attention`,"aria-hidden":`true`})}),t(q,{eyebrow:g.eyebrow,title:g.title,body:g.body})]}),i&&t(ot,{badge:t(tt,{initials:Ot(i.email)}),title:i.name||kt(i.email),subtitle:i.email,actionLabel:d(`auth.returning.notYou`),onAction:u}),n(`div`,{className:`flex flex-col gap-2`,children:[s&&t(J,{ref:m,className:`w-full`,disabled:f,onClick:()=>_(s),children:d(h?`auth.recovery.continue`:`auth.recovery.tryAgain`)}),t(J,{ref:s?void 0:m,variant:s?`ghost`:`primary`,disabled:f,onClick:()=>_(u),children:d(`auth.recovery.useDifferentAccount`)}),(a===`noAccessibleAccount`||a===`service`)&&n(`p`,{className:`text-center text-xs text-muted`,children:[d(`auth.recovery.supportPrefix`),` `,t(`a`,{className:`text-info`,href:`mailto:support@vertesiahq.com`,children:`support@vertesiahq.com`})]})]}),r&&n(`details`,{className:`rounded-lg border border-mixer-muted/30 bg-mixer-muted/10 px-4 py-3 text-sm`,children:[t(`summary`,{className:`cursor-pointer font-medium text-muted marker:text-muted focus-visible:outline-2 focus-visible:outline-offset-2`,children:d(`auth.recovery.technicalDetails`)}),n(`dl`,{className:`mt-3 grid grid-cols-[max-content_minmax(0,1fr)] gap-x-3 gap-y-2 text-xs`,children:[r.errorCode&&n(e,{children:[t(`dt`,{className:`text-muted`,children:d(`auth.recovery.errorCode`)}),t(`dd`,{className:`wrap-break-word font-mono`,children:r.errorCode})]}),r.status&&n(e,{children:[t(`dt`,{className:`text-muted`,children:d(`auth.recovery.httpStatus`)}),t(`dd`,{className:`font-mono`,children:r.status})]}),r.accountId&&n(e,{children:[t(`dt`,{className:`text-muted`,children:d(`auth.recovery.requestedAccount`)}),t(`dd`,{className:`wrap-break-word font-mono`,children:r.accountId})]}),r.projectId&&n(e,{children:[t(`dt`,{className:`text-muted`,children:d(`auth.recovery.requestedProject`)}),t(`dd`,{className:`wrap-break-word font-mono`,children:r.projectId})]}),t(`dt`,{className:`text-muted`,children:d(`auth.recovery.errorMessage`)}),t(`dd`,{className:`wrap-break-word font-mono`,children:r.message})]})]})]})}const Lt={dev1:`us1`};function Rt(e){let t=e&&Lt[e]||e;return t?`https://cloud.${t}.vertesia.io/`:`https://cloud.vertesia.io/`}function zt({onUseDifferentEmail:e}){let{t:r}=W(),i=Rt(G.region),[a,s]=l(15);return o(()=>{yt()},[]),o(()=>{let e=setTimeout(()=>{window.location.href=i},15*1e3),t=setInterval(()=>{s(e=>e>0?e-1:0)},1e3);return()=>{clearTimeout(e),clearInterval(t)}},[i]),n(K,{children:[t(q,{variant:`destructive`,eyebrow:r(`auth.restricted.eyebrow`),title:r(`auth.restricted.title`),body:r(`auth.restricted.body`)}),n(`div`,{className:`flex flex-col gap-2`,children:[t(lt,{icon:ve,title:r(`auth.restricted.calloutTitle`),meta:r(`auth.restricted.calloutMeta`)}),t(J,{className:`w-full`,onClick:()=>{window.location.href=i},children:r(`auth.restricted.redirect`)}),t(J,{variant:`ghost`,onClick:e,children:r(`auth.restricted.useDifferent`)}),t(`p`,{className:`text-center text-xs text-muted`,children:r(`auth.restricted.autoRedirect`,{seconds:a})})]})]})}function Bt({session:e,onNotYou:r,onProviderClicked:i,redirectTo:a}){let{t:o}=W(),s=e.name?e.name.split(` `)[0]||e.name:kt(e.email),c=e.name||kt(e.email),l=t(tt,{initials:Ot(e.email)}),u=!!e.tenantName,d=e.lastProvider===`oidc`?o(`auth.continueWithSignIn`):o(`auth.continueWithProvider`,{provider:Y(e.lastProvider)}),f=async t=>{i(t),await Ct(t,e.email,a)};return n(K,{children:[t(q,{eyebrow:o(`auth.returning.eyebrow`),title:o(`auth.returning.title`,{name:s}),body:o(`auth.returning.body`)}),u&&e.tenantName?t(at,{variant:`returning`,badge:l,title:c,subtitle:e.tenantName,email:e.email,actionLabel:o(`auth.returning.notYou`),onAction:r}):t(ot,{badge:l,title:c,subtitle:e.email,actionLabel:o(`auth.returning.notYou`),onAction:r}),n(`div`,{className:`flex flex-col gap-2`,children:[t(ct,{provider:e.lastProvider,label:d,onClick:()=>f(e.lastProvider),variant:`filled`}),t(J,{variant:`ghost`,onClick:r,children:o(`auth.returning.useDifferent`)})]})]})}function Vt({email:e,tenantName:r,onBack:i}){let{t:a}=W(),o=r||a(`auth.blocked.tenantFallback`),s=Et(e),c=r||(s?a(`auth.blocked.teamFromDomain`,{domain:Dt(s)}):a(`auth.blocked.tenantFallback`));return n(K,{children:[t(q,{variant:`destructive`,eyebrow:a(`auth.blocked.eyebrow`),title:a(`auth.blocked.title`),body:a(`auth.blocked.body`,{name:o,email:e})}),n(`div`,{className:`flex flex-col gap-2`,children:[t(lt,{icon:ve,title:c,meta:a(`auth.blocked.tenantMeta`,{email:e})}),t(J,{variant:`ghost`,onClick:i,children:a(`auth.blocked.useDifferent`)})]})]})}function Z({provider:e,email:n,redirectTo:r,variant:i=`outline`,onClick:a}){let{t:o}=W();return t(ct,{provider:e,label:e===`oidc`?o(`auth.continueWithSignIn`):o(`auth.continueWithProvider`,{provider:Y(e)}),onClick:()=>{a?.(),n?Ct(e,n,r):wt(e,r)},variant:i})}function Ht(e){return e.split(/\s+/).filter(Boolean).slice(0,2).map(e=>e.charAt(0).toUpperCase()).join(``)}function Ut({email:e,tenant:r,onBack:i,onProviderClicked:a,redirectTo:o}){let{t:s}=W(),c=r.label||r.name||s(`auth.blocked.tenantFallback`),l=r.provider===`google`||r.provider===`github`||r.provider===`microsoft`?r.provider:`oidc`,u=l===`oidc`?s(`auth.tenant.viaIdpFallback`):Y(l);return n(K,{children:[t(q,{eyebrow:s(`auth.tenant.eyebrow`),title:s(`auth.tenant.title`,{name:c}),body:s(`auth.tenant.body`)}),t(at,{variant:`tenant`,badge:t(tt,{initials:Ht(c),shape:`square`}),title:c,subtitle:s(`auth.tenant.viaIdp`,{idp:u}),email:e,actionLabel:s(`auth.change`),onAction:i}),n(`div`,{className:`flex flex-col gap-2`,children:[t(Z,{provider:l,email:e,redirectTo:o,variant:`filled`,onClick:a}),t(J,{variant:`ghost`,onClick:i,children:s(`auth.tenant.notPartOf`,{name:c})})]})]})}function Wt({onSignup:r,goBack:i}){let{t:a}=W(),[s,c]=l(void 0),[u,f]=l(void 0),[p,h]=l(void 0),[g,_]=l(void 0),[v,y]=l(void 0),[b,x]=l(void 0),[S,C]=l(void 0),E=s===`company`,D=[{id:1,label:a(`signup.size1to10`)},{id:11,label:a(`signup.size11to100`)},{id:101,label:a(`signup.size101to1000`)},{id:1001,label:a(`signup.size1001to5000`)},{id:5001,label:a(`signup.size5000plus`)}],O=[{id:`personal`,label:a(`signup.personal`),description:a(`signup.personalDescription`)},{id:`company`,label:a(`signup.company`),description:a(`signup.companyDescription`)}],k=[{id:`testing`,label:a(`signup.justTesting`)},{id:`exploring`,label:a(`signup.activelyExploring`)},{id:`using`,label:a(`signup.alreadyUsing`)},{id:`migrating`,label:a(`signup.migratingLLMs`)},{id:`other`,label:a(`signup.other`)}];o(()=>{let e=H().currentUser;if(!e){console.error(`No user found`);return}x(e)},[]);let A=()=>s?E&&!p?(C(a(`signup.pleaseEnterOrgName`)),!1):E&&!u?(C(a(`signup.pleaseSelectCompanySize`)),!1):!0:(C(a(`signup.pleaseSelectAccountType`)),!1);return n(`div`,{className:`flex flex-col space-y-2`,children:[n(`div`,{className:`prose`,children:[t(`p`,{className:`prose text-sm text-muted pt-4`,children:a(`signup.welcomeMessage`,{name:b?.displayName,email:b?.email})}),S&&t(`div`,{className:`text-destructive`,children:S})]}),t(Q,{label:a(`signup.accountType`),children:t(w,{options:O,selected:O.find(e=>e.id===s),onSelect:e=>c(e.id)})}),E&&n(e,{children:[t(Q,{label:a(`signup.companySize`),children:t(T,{className:`w-full border border-accent bg-muted`,value:u,options:D,onChange:f,optionLabel:e=>e?.label,placeholder:a(`signup.selectCompanySize`)})}),t(Q,{label:a(`signup.companyName`),children:t(m,{value:p,onChange:h,type:`text`,required:!0})}),t(Q,{label:a(`signup.companyWebsite`),children:t(m,{value:g,onChange:_,type:`text`})})]}),t(Q,{label:a(`signup.projectMaturity`),children:t(T,{className:`w-full border border-accent bg-muted`,options:k,value:k.find(e=>e.id===v),optionLabel:e=>e?.label,placeholder:a(`signup.selectProjectMaturity`),onChange:e=>y(e?.id)})}),n(`div`,{className:`pt-8 flex flex-col`,children:[t(d,{variant:`primary`,onClick:async()=>{if(!A()||!s)return;let e={accountType:s,companyName:p,companySize:u?.id,companyWebsite:g,maturity:v};window.localStorage.setItem(`composableSignupData`,JSON.stringify(e));let t=await H().currentUser?.getIdToken();if(console.log(`Got firebase token`,H(),t),!t){console.error(`No firebase token found`);return}r(e,t)},size:`xl`,children:t(`span`,{className:`text-lg`,children:a(`signup.signUp`)})}),t(d,{variant:`ghost`,size:`xl`,className:`mt-4`,onClick:i,children:t(`span`,{className:``,children:a(`signup.wrongAccountGoBack`)})})]})]})}function Q({label:e,children:r}){return n(`div`,{className:`flex flex-col space-y-2 pt-4`,children:[t(`div`,{className:`text-sm text-muted`,children:e}),r]})}function Gt({allowedPrefix:e,isNested:n=!1,lightLogo:r,darkLogo:i,preservePath:a,suppressAuthErrorPrefix:o}){let s=typeof window>`u`?``:window.location.pathname,c=Kt(s,e),l=Kt(s,o);return c?null:t(Jt,{isNested:n,lightLogo:r,darkLogo:i,preservePath:a,suppressAuthError:l})}function Kt(e,t){return(Array.isArray(t)?t:t?[t]:[]).some(t=>e===t||e.startsWith(t.endsWith(`/`)?t:`${t}/`))}function qt(e){return e instanceof re||e instanceof ne||e instanceof B||e instanceof z||e instanceof I||e instanceof F}function Jt({isNested:e=!1,lightLogo:r,darkLogo:a,preservePath:s,suppressAuthError:c}){let{t:u}=W(),{isLoading:d,user:f,authError:p,signOut:m}=U(),{trackEvent:h}=ce(),[g,_]=l(()=>pt()),[v,y]=l(()=>pt()?`returning`:`email`),[b,x]=l(``),[S,C]=l(void 0),[w,T]=l(null),E=p instanceof B||p instanceof z?p.identity:void 0,D=E&&g?.email.toLowerCase()===E.email.toLowerCase()?g:void 0,O=E?{email:E.email,name:E.name??D?.name}:void 0;o(()=>{if(!s&&!d&&!p){let e=new URL(document.baseURI).pathname||`/`;history.replaceState({},``,e)}},[p,d,s]),o(()=>{if(p){if(p instanceof re)y(`signup`);else if(p instanceof ne)y(`restricted`);else if(p instanceof B)y(`scopeUnavailable`);else if(p instanceof z)y(`noAccessibleAccount`);else if(p instanceof I)y(`credentialFailure`);else if(p instanceof F)y(`serviceFailure`);else if(Mt(p)){let e=gt();e&&x(e.email),y(`blocked`)}}},[p]),o(()=>{if(!f)return;let e=gt();e&&(mt({email:e.email,lastProvider:e.provider,tenantName:e.tenantName,name:f.name||void 0}),vt())},[f]);let k=i((e,t)=>{x(e),C(t),y(t?`tenant`:`providers`)},[]),A=i(()=>{y(`email`),C(void 0)},[]),ee=i(()=>{ht(),vt(),_(null),x(``),C(void 0),y(`email`),m()},[m]),j=i(e=>{(S||g?.tenantName)&&h(`enterprise_signin`,{provider:e}),T(e),y(`pending`)},[h,g?.tenantName,S]),M=i(()=>{_(null),x(``),C(void 0),y(`email`),yt()},[]),N=i(()=>{G.logger.info(`Authentication recovery action selected`,{vertesia:{recovery_action:`use_different_account`}}),_(null),x(``),C(void 0),y(`email`),yt().finally(()=>m())},[m]),P=i(()=>{p instanceof B&&(G.logger.info(`Authentication recovery action selected`,{vertesia:{error_code:be,selector_source:p.selectorSource,requested_scope:p.requestedScope,recovery_action:`continue_sanitized`}}),window.location.replace(p.recoveryUrl??window.location.href))},[p]),te=i(()=>{G.logger.info(`Authentication recovery action selected`,{vertesia:{recovery_action:`retry`}}),window.location.reload()},[]),L=(e,t)=>{let n={signupData:e,firebaseToken:t};fetch(`${G.endpoints.studio}/auth/signup`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(n)}).then(()=>{h(`sign_up`),window.location.href=`/`})},R=c&&p!==void 0&&!qt(p);if(d||f||R)return null;let V=null;if(v===`pending`&&w)V=t(Nt,{provider:w});else if(v===`blocked`)V=t(Vt,{email:b||g?.email||``,tenantName:S?.label||S?.name||g?.tenantName||void 0,onBack:M});else if(v===`restricted`)V=t(zt,{onUseDifferentEmail:M});else if(v===`scopeUnavailable`&&p instanceof B){let e=p.requestedScope===`project`?`scopeProject`:`scopeAccount`;V=t(X,{details:{accountId:p.accountId,errorCode:p.errorCode,message:p.message,projectId:p.projectId,status:p.status},identity:O,kind:e,onContinue:P,onUseDifferentAccount:N})}else V=v===`noAccessibleAccount`&&p instanceof z?t(X,{details:{errorCode:p.errorCode,message:p.message,status:p.status},identity:O,kind:`noAccessibleAccount`,onUseDifferentAccount:N}):v===`credentialFailure`&&p instanceof I?t(X,{details:{errorCode:p.errorCode,message:p.message,status:p.status},kind:`credential`,onUseDifferentAccount:N}):v===`serviceFailure`&&p instanceof F?t(X,{details:{errorCode:p.errorCode,message:p.message,status:p.status},kind:`service`,onContinue:te,onUseDifferentAccount:N}):v===`signup`&&!localStorage.getItem(`tenantName`)?t(Wt,{onSignup:L,goBack:M}):v===`tenant`&&S?t(Ut,{email:b,tenant:S,onBack:A,onProviderClicked:()=>j(S.provider??`oidc`)}):v===`providers`?t(It,{email:b,onBack:A,onProviderClicked:j}):v===`returning`&&g?t(Bt,{session:g,onNotYou:ee,onProviderClicked:j}):t(Pt,{initialEmail:b,onProceed:k});return t(`div`,{style:{zIndex:999998},className:`${e?`absolute`:`fixed`} inset-0 overflow-y-auto bg-background`,children:t(`div`,{className:`min-h-full flex flex-col items-center justify-center py-12 px-4`,children:n(`div`,{className:`flex flex-col items-center w-full`,children:[(r||a)&&n(`div`,{className:`mb-7`,children:[r&&t(`img`,{src:r,alt:`Vertesia`,className:`h-10 block dark:hidden`}),a&&t(`img`,{src:a,alt:`Vertesia`,className:`h-10 hidden dark:block`})]}),V,p&&!qt(p)&&!Mt(p)&&t(`div`,{className:`mt-6 max-w-[420px] text-center text-sm text-muted`,children:n(`div`,{children:[u(`auth.signInError`),t(`br`,{}),u(`auth.signInErrorContact`),t(`a`,{className:`text-info mx-1`,href:`mailto:support@vertesiahq.com`,children:`support@vertesiahq.com`}),u(`auth.signInErrorPersists`)]})}),n(`div`,{className:`flex items-center gap-5 mt-10 text-xs text-muted-foreground`,children:[t(`a`,{href:`https://vertesiahq.com/privacy`,className:`hover:text-foreground transition`,children:u(`auth.privacyPolicy`)}),t(`span`,{className:`text-border`,children:`·`}),t(`a`,{href:`https://vertesiahq.com/terms`,className:`hover:text-foreground transition`,children:u(`auth.termsOfService`)}),t(`span`,{className:`text-border`,children:`·`}),t(Se,{className:`cursor-default`})]})]})})})}const Yt=new Set([`127.0.0.1`,`localhost`]);function Xt(e){if(!e)return null;let t;try{t=decodeURIComponent(e)}catch{return null}let n;try{n=new URL(t)}catch{return null}return n.protocol!==`http:`||!n.port||n.username||n.password||!Yt.has(n.hostname)?null:n.toString()}function Zt(e){let t=new URLSearchParams(e.search),n=Xt(t.get(`redirect_uri`)),r=t.get(`code`);return!n||!r?null:{redirect:n,code:r,profile:t.get(`profile`)??`default`,project:t.get(`project`)??void 0,account:t.get(`account`)??void 0}}function Qt(){let[e,n]=l(),[r,i]=l(),a=Zt(Oe()),o=P(),{t:s}=W();return t(`div`,{className:`w-full flex flex-col items-center gap-4 mt-24`,children:a?e?t(en,{payload:e,error:r}):t($t,{clientInfo:a,onAccept:async e=>{if(!a)return;if(!e.profile){o({title:s(`login.terminal.profileRequired`),description:s(`login.terminal.profileRequiredDesc`),status:`error`,duration:2e3});return}if(!e.account){o({title:s(`login.terminal.accountRequired`),description:s(`login.terminal.accountRequiredDesc`),status:`error`,duration:2e3});return}if(!e.project){o({title:s(`login.terminal.projectRequired`),description:s(`login.terminal.projectRequiredDesc`),status:`error`,duration:2e3});return}let t;try{let r=oe(),i=r?await ae(r,e.account,e.project,24*3600):await ie(e.account,e.project,24*3600);i?(t={...e,studio_server_url:G.endpoints.studio,zeno_server_url:G.endpoints.zeno,token:i},await fetch(a.redirect,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)}),n(t)):o({title:s(`login.terminal.failedToGetToken`),status:`error`,duration:5e3})}catch(e){t?(i(e instanceof Error?e:Error(M(e))),n(t)):o({title:s(`login.terminal.errorAuthorizingClient`),description:M(e),status:`error`,duration:5e3})}}}):t(p,{title:s(`login.terminal.invalidRequest`),children:s(`login.terminal.invalidRequestDesc`)})})}function $t({onAccept:r,clientInfo:i}){let{client:a,user:o}=U(),{data:s,error:c}=N(()=>o?a.projects.list():Promise.resolve([]),[o]),{t:l}=W();if(c)return t(p,{title:l(`login.terminal.errorLoadingProjects`),children:M(c)});let u=G.isLocalDev?l(`login.terminal.envLocalDev`):G.isDev?l(`login.terminal.envStaging`):l(`login.terminal.envProduction`);return o&&s?n(e,{children:[n(`div`,{className:`w-1/3`,children:[n(`div`,{className:`mb-4 text-xl font-semibold text-info`,children:[`Authorizing client on `,u,` environment.`]}),n(`div`,{className:`mb-2 text-md text-muted-foreground`,children:[t(`div`,{children:l(`login.terminal.clientWantsAuth`)}),n(`div`,{children:[`The client app code is `,t(`b`,{className:`text-foreground`,children:i.code}),`. You can check if the code is correct in the terminal.`]})]}),n(`div`,{className:`mb-2 text-sm text-muted-foreground`,children:[t(`div`,{children:l(`login.terminal.chooseAccountProject`)}),t(`div`,{children:l(`login.terminal.profileNameNote`)})]})]}),t(tn,{onAccept:r,allProjects:s,data:i})]}):t(E,{size:`lg`})}function en({payload:e,error:r}){let i=P(),{t:a}=W();return n(`div`,{children:[r?t(`div`,{children:t(p,{title:a(`login.terminal.failedToSendToken`),children:a(`login.terminal.failedToSendTokenDesc`,{error:r.message})})}):t(`div`,{children:a(`login.terminal.clientAuthenticated`)}),t(f,{className:`mt-4`,children:t(d,{variant:`secondary`,onClick:()=>{e&&(navigator.clipboard.writeText(JSON.stringify(e)),i({title:a(`login.terminal.authPayloadCopied`),description:r?a(`login.terminal.authPayloadCopiedWithError`,{error:r.message}):a(`login.terminal.authPayloadCopiedSuccess`),status:`success`,duration:5e3}))},children:a(`login.terminal.copyAuthPayload`)})})]})}function tn({allProjects:e,data:r,onAccept:i}){let{accounts:a,account:o,project:s}=U(),{t:c}=W(),[u,f]=l(()=>({profile:r.profile,account:r.account??o?.id,project:r.project??s?.id})),p=e=>{f({...u,profile:e})},h=e=>{f({...u,account:e.id,project:void 0})},g=e=>{f({...u,project:e.id})},_=e.filter(e=>e.account===u.account);return n(`div`,{className:`w-1/3`,children:[n(`div`,{className:`mb-4 flex flex-col gap-2`,children:[t(`span`,{className:`font-semibold text-muted-foreground`,children:c(`login.terminal.profileName`)}),t(m,{type:`text`,value:u.profile,onChange:p})]}),n(`div`,{className:`mb-4 flex flex-col gap-2`,children:[t(`span`,{className:`font-semibold text-muted-foreground`,children:c(`login.terminal.account`)}),t(nn,{value:u.account,onChange:h,accounts:a||[]})]}),n(`div`,{className:`mb-4 flex flex-col gap-2`,children:[t(`span`,{className:`font-semibold text-muted-foreground`,children:c(`login.terminal.project`)}),t(rn,{value:u.project,onChange:g,projects:_})]}),t(`div`,{className:`mb-4 text-sm text-attention`,children:c(`login.terminal.browserPermissionNote`)}),t(`div`,{children:t(d,{size:`xl`,onClick:()=>i(u),children:c(`login.terminal.authorizeClient`)})})]})}function nn({value:e,accounts:n,onChange:r}){let{t:i}=W();return t(T,{options:n,value:n?.find(t=>t.id===e),onChange:e=>{r(e)},by:`id`,optionLabel:e=>e.name,placeholder:i(`login.terminal.selectAccount`)})}function rn({value:e,projects:n,onChange:r}){let{t:i}=W();return t(T,{by:`id`,value:n.find(t=>t.id===e),options:n,optionLabel:e=>e.name,placeholder:i(`login.terminal.selectProject`),onChange:e=>{r(e)}})}function an({isOpen:e,onClose:r}){return n(g,{isOpen:e,onClose:r,children:[t(y,{children:`Sign In`}),n(_,{className:`flex flex-col gap-2`,children:[t(Z,{provider:`google`}),t(Z,{provider:`github`}),t(Z,{provider:`microsoft`})]}),t(v,{align:`right`,children:t(d,{variant:`ghost`,onClick:r,children:`Cancel`})})]})}function $({title:e,value:r}){function i(e){navigator.clipboard.writeText(e),o(!0),setTimeout(()=>o(!1),2e3)}let[a,o]=l(!1);return n(`div`,{className:`w-full flex justify-between items-center mb-1`,children:[n(`div`,{className:`flex flex-col w-[calc(100%-3rem)]`,children:[t(`div`,{className:`text-sm px-2 dark:text-slate-200`,children:e}),t(j,{description:r,size:`xs`,placement:`left`,children:n(`div`,{className:`text-xs truncate text-muted w-full text-start px-2`,children:[r,` `]})})]}),a?t(pe,{className:`size-4 cursor-pointer text-success`}):t(me,{className:`size-4 cursor-pointer text-gray-400 dark:text-slate-400`,onClick:()=>i(r)})]})}function on(){let{t:e}=W(),{account:r,project:i,client:a,authToken:o}=U(),s=a.baseUrl,c=a.store.baseUrl,l=c.replace(/\/+$/,``)!==s.replace(/\/+$/,``),u=G.endpoints.mcp??e(`user.unknown`),d=i?xe(i):``;return t(`div`,{className:`w-full`,children:n(D,{defaultValue:`user`,tabs:[{name:`user`,label:e(`user.user`),content:n(`div`,{className:`space-y-1 p-2`,children:[t($,{title:e(`user.organizationId`),value:r?.id??e(`user.unknown`)}),t($,{title:e(`user.projectId`),value:i?.id??e(`user.unknown`)}),t($,{title:e(`user.userId`),value:o?.sub??e(`user.unknown`)}),t($,{title:e(`user.organizationRoles`),value:o?.account_roles?.join(`,`)??e(`user.unknown`)}),t($,{title:e(`user.projectRoles`),value:o?.project_roles?.join(`,`)??e(`user.unknown`)})]})},{name:`environment`,label:e(`user.environment`),content:n(`div`,{className:`space-y-1 p-2`,children:[t($,{title:e(`user.tenantId`),value:d}),t($,{title:e(`user.environment`),value:G.type}),t($,{title:e(`user.server`),value:s}),l&&t($,{title:e(`user.store`),value:c}),t($,{title:e(`user.mcpServer`),value:u}),t($,{title:e(`user.appVersion`),value:G.version}),t($,{title:e(`user.sdkVersion`),value:G.sdkVersion||e(`user.unknown`)})]})}],fullWidth:!0,updateHash:!1,children:[t(O,{}),t(k,{})]})})}function sn(r){let{user:i,isLoading:a}=U(),[o,s]=l(!1);return a?t(E,{}):i?t(`div`,{className:`px-3`,children:t(cn,{asMenuTrigger:!0})}):n(e,{children:[t(d,{onClick:()=>s(!0),children:`Sign In`}),t(an,{isOpen:o,onClose:()=>s(!1)})]})}function cn({className:e,asMenuTrigger:r=!1}){let i=U(),a=ke(),o=Me(),{user:s}=i;if(!i||!s)return null;let c=o.hasPermission(ye.project_admin);return n(x,{click:!0,children:[t(C,{children:t(`div`,{className:Ne(e,`flex items-center justify-start`,r&&`cursor-pointer`),children:t(u,{size:`sm`,color:`bg-amber-500`,shape:`circle`,name:s?.name})})}),t(S,{align:`start`,className:`w-[280px] mx-2 my-1 p-0`,children:n(`div`,{className:`divide-y divide-gray-200 dark:divide-slate-700`,children:[n(`div`,{className:`py-2 ps-2`,children:[t(`p`,{className:`px-4 dark:text-white mb-1`,children:s?.name??`Unknown`}),t(`p`,{className:`px-4 text-xs text-gray-500`,children:s?.email??``})]}),t(`div`,{className:`w-full p-1`,children:t(on,{})}),t(`div`,{className:`py-2 ps-2`,children:t(b,{})}),t(`div`,{className:`py-2`,children:n(h,{children:[c&&t(h.Item,{className:`px-2`,onClick:()=>a(`/settings`,{replace:!0}),children:`Settings`}),t(h.Item,{className:`px-2`,onClick:()=>i.logout(),children:`Sign out`})]})})]})})]})}function ln(e){return e?e.endsWith(`@vertesiahq.com`)||e.endsWith(`@becomposable.com`)||e.endsWith(`@composableprompts.com`):!1}function un({icon:e}){let{isLoading:n}=U(),[r,i]=l(!0);return o(()=>{n||i(!1)},[n]),t(Pe,{children:r&&t(Fe.div,{style:{zIndex:999999,position:`fixed`,inset:0},className:`fixed inset-x-0 inset-y-0`,initial:{opacity:1},exit:{opacity:0},transition:{ease:`easeIn`,duration:.5},children:t(`div`,{style:{display:`flex`,width:`100%`,height:`100%`,alignItems:`center`,justifyContent:`center`},className:`flex w-full h-full items-center justify-center`,children:t(`div`,{className:`animate-[spin_4s_linear_infinite]`,children:t(`div`,{className:`animate-pulse rounded-full bg-transparent`,children:e||t(dn,{})})})})})})}function dn(){return n(`svg`,{width:`32`,height:`32`,className:`w-8 h-8 text-indigo-600`,viewBox:`0 0 50 50`,xmlns:`http://www.w3.org/2000/svg`,role:`img`,"aria-label":`Loading`,children:[t(`title`,{children:`Loading`}),t(`defs`,{children:n(`linearGradient`,{id:`spinner-gradient`,x1:`1`,y1:`0`,x2:`0`,y2:`1`,children:[t(`stop`,{offset:`0%`,stopColor:`currentColor`,stopOpacity:`1`}),t(`stop`,{offset:`100%`,stopColor:`currentColor`,stopOpacity:`0`})]})}),t(`circle`,{cx:`25`,cy:`25`,r:`20`,stroke:`url(#spinner-gradient)`,strokeWidth:`5`,fill:`none`,strokeLinecap:`round`})]})}function fn({children:r,lightLogo:i,darkLogo:a,loadingIcon:o,loadOnboardingStatus:s,preserveSignInPath:c,suppressSignInErrorPrefixes:l,authToken:u,defaultLanguage:d}){let f=t(Ae,{children:t(A,{defaultTheme:`system`,storageKey:`vite-ui-theme`,children:t(ue,{defaultLanguage:d,children:n(le,{children:[!u&&n(e,{children:[t(un,{icon:o}),t(Gt,{allowedPrefix:`/shared/`,darkLogo:a,lightLogo:i,preservePath:c,suppressAuthErrorPrefix:l})]}),t(je,{children:r})]})})})});return t(ee,{children:u?t(te,{token:u,children:f}):t(V,{loadOnboardingStatus:s,children:f})})}export{Ie as AppInstallationContext,Le as AppInstallationProvider,ze as AppProjectSelector,Ge as InviteAcceptModal,Gt as SigninScreen,Ve as StandaloneApp,He as StandaloneAppImpl,Qt as TerminalLogin,sn as UserSessionMenu,fn as VertesiaShell,ln as isVertesiaEmail,Re as useAppInstallation};
1
+ import{Fragment as e,jsx as t,jsxs as n}from"react/jsx-runtime";import{createContext as r,useCallback as i,useContext as a,useEffect as o,useMemo as s,useRef as c,useState as l}from"react";import{Avatar as u,Button as d,Center as f,ErrorBox as p,Input as m,MenuList as h,Modal as g,ModalBody as _,ModalFooter as v,ModalTitle as y,ModeToggle as b,Popover as x,PopoverContent as S,PopoverTrigger as C,RadioGroup as ee,SelectBox as w,Spinner as T,Tabs as te,TabsBar as E,TabsPanel as D,ThemeProvider as O,ToastProvider as ne,VTooltip as k,errorMessage as A,useFetch as j,useToast as re}from"@vertesia/ui/core";import{AuthenticationServiceError as ie,CredentialError as M,DevSessionProvider as ae,LastSelectedAccountId_KEY as N,LastSelectedProjectId_KEY as oe,NoAccessibleAccountError as P,RequestedScopeUnavailableError as F,RestrictedEnvironmentError as se,UserNotFoundError as ce,UserSessionProvider as I,fetchComposableTokenFromFirebaseToken as le,fetchComposableTokenFromVertesiaToken as ue,getCurrentVertesiaToken as de,getFirebaseAuth as L,setFirebaseTenant as fe,useUXTracking as pe,useUserSession as R}from"@vertesia/ui/session";import"@radix-ui/react-direction";import{LanguageBoundI18nProvider as me,LanguageProvider as he,useUITranslation as z}from"@vertesia/ui/i18n";import{AlertTriangle as ge,ArrowRight as _e,Check as ve,CopyIcon as ye,LockIcon as be,LockKeyhole as xe,Mail as Se,ShieldOff as Ce}from"lucide-react";import{Permission as we,REQUESTED_SCOPE_UNAVAILABLE_ERROR_CODE as Te,getTenantIdFromProject as Ee}from"@vertesia/common";import{Env as B}from"@vertesia/ui/env";import{RegionTag as De}from"@vertesia/ui/layout";import{GithubAuthProvider as Oe,GoogleAuthProvider as ke,OAuthProvider as Ae,signInWithRedirect as je,signOut as Me}from"firebase/auth";import{useLocation as Ne,useNavigate as Pe}from"@vertesia/ui/router";import{TypeRegistryProvider as Fe,UserPermissionProvider as Ie,useUserPermissions as Le}from"@vertesia/ui/features";import Re from"clsx";import{AnimatePresence as ze,motion as Be}from"framer-motion";const V=r(null);function Ve({installation:e,children:n}){return t(V.Provider,{value:e,children:n})}function He(){return a(V)}function Ue({app:e,onChange:r,placeholder:i}){let{client:a,project:o}=R(),{data:s,error:c}=j(()=>a.apps.getAppInstallationProjects(e),[e.id,e.name]);return c?n(`span`,{className:`text-red-600`,children:[`Error: failed to fetch projects: `,A(c)]}):t(We,{placeholder:i,initialValue:o?.id,projects:s||[],onChange:e=>{r&&!r(e)||(localStorage.setItem(N,e.account),localStorage.setItem(`${oe}-${e.account}`,e.id),window.location.reload())}})}function We({initialValue:e,projects:n,onChange:r,placeholder:i=`Select Project`}){let[a,o]=l(),s=e=>{o(e),r(e)},c=!a&&e?n.find(t=>t.id===e):a;return t(w,{by:`id`,value:c,options:n,optionLabel:e=>e.name,placeholder:i,onChange:s})}const Ge=r({theme:`system`,setTheme:()=>null}),Ke=()=>{let e=a(Ge);if(e===void 0)throw Error(`useTheme must be used within a ThemeProvider`);return e},qe=[`ar`,`de`,`en`,`es`,`fr`,`it`,`ja`,`ko`,`pt`,`ru`,`tr`,`zh`,`zh-TW`],Je=r({language:`en`,setLanguage:()=>null,isRTL:!1});function Ye(){let e=a(Je);if(e===void 0)throw Error(`useLanguage must be used within a LanguageProvider`);return e}const Xe=`vertesia:iframe-auth-request`,Ze=`vertesia:iframe-auth-response`,H=`vertesia:iframe-context-request`,Qe=`vertesia:iframe-context`,$e=`vertesia:iframe-navigate`,et=`vertesia:iframe-location-change`,tt=`__vertesia_slot`,U=`__vertesia_host_origin`,nt=`content`;function rt(e){if(!e||typeof e!=`object`)return!1;let t=e;return t.type===`vertesia:iframe-auth-request`&&typeof t.requestId==`string`&&!!t.requestId}function it(e){if(!e||typeof e!=`object`)return!1;let t=e;return t.type===`vertesia:iframe-auth-response`&&typeof t.requestId==`string`&&!!t.requestId&&(t.token===void 0||typeof t.token==`string`)}function at(e){return!e||typeof e!=`object`?!1:e.type===H}function ot(e){if(!e||typeof e!=`object`)return!1;let t=e;return t.type===`vertesia:iframe-context`&&(t.theme===`dark`||t.theme===`light`||t.theme===`system`)&&typeof t.language==`string`&&qe.includes(t.language)}function st(e){if(!e||typeof e!=`object`)return!1;let t=e;return t.type===`vertesia:iframe-navigate`&&typeof t.url==`string`&&!!t.url}function ct(e){if(!e||typeof e!=`object`)return!1;let t=e;return t.type===`vertesia:iframe-location-change`&&typeof t.url==`string`&&!!t.url}const W=new Set([`localhost`,`127.0.0.1`,`[::1]`]);function lt(e){if(e)try{let t=new URL(e),n=W.has(t.hostname);return t.protocol===`https:`||t.protocol===`http:`&&n?t:void 0}catch{return}}function ut(e){if(!e)return!1;let t=e.trim(),n=t.indexOf(`://`);if(n<0)return!1;let r=n+3,i=t.slice(r),a=i.search(/[/?#]/);return(a<0?i:i.slice(0,a)).includes(`@`)}function dt(e){if(e===`studio.vertesia.io`)return!0;let t=e.split(`.`);if(t.at(-2)!==`vertesia`||t.at(-1)!==`io`)return!1;let n=t.slice(0,-2),r=n.lastIndexOf(`cloud`);if(r>=0&&n.length-r<=2)return!0;let i=n.lastIndexOf(`ui`);return i>=0&&n.length-i===2}function ft(e){if(ut(e))return;let t=lt(e);if(!t)return;let n=t.hostname,r=dt(n),i=W.has(n)&&W.has(window.location.hostname);return t.protocol===`https:`&&r||i?t.origin:void 0}function pt(){return window.parent===window?void 0:ft(new URL(window.location.href).searchParams.get(U))||ft(document.referrer)}function mt(e=5e3){let t=pt();if(!t)return Promise.resolve(void 0);let n=crypto.randomUUID();return new Promise(r=>{let i,a,o=250,s=e=>{window.removeEventListener(`message`,c),clearTimeout(i),clearTimeout(a),r(e)},c=e=>{e.source!==window.parent||e.origin!==t||!it(e.data)||e.data.requestId===n&&e.data.token&&s(e.data.token)},l={type:Xe,requestId:n},u=()=>{window.parent.postMessage(l,t),a=window.setTimeout(u,o),o=Math.min(o*2,1e3)};i=window.setTimeout(()=>s(),e),window.addEventListener(`message`,c),u()})}function ht(e){if(e==null)return e;let t=new URL(window.location.href).searchParams.get(U);if(!t)return e;try{let n=new URL(e,window.location.href);return n.origin===window.location.origin?(n.searchParams.set(U,t),n):e}catch{return e}}function gt(){let{setTheme:e}=Ke(),{setLanguage:t}=Ye();return o(()=>{let n=pt();if(!n)return;let r=()=>{let e={type:et,url:window.location.href};window.parent.postMessage(e,n)},i=window.history.pushState,a=window.history.replaceState,o=(e,t,n)=>{i.call(window.history,e,t,ht(n)),r()},s=(e,t,n)=>{a.call(window.history,e,t,ht(n)),r()};window.history.pushState=o,window.history.replaceState=s;let c=i=>{if(i.source===window.parent&&i.origin===n){if(ot(i.data)){let n=i.data;e(n.theme,{persist:!1}),t(n.language,{persist:!1});return}if(st(i.data)){let e;try{e=new URL(i.data.url,window.location.href)}catch{return}if(e.origin!==window.location.origin)return;if(e.href===window.location.href){r();return}window.history.replaceState(window.history.state,``,e),window.dispatchEvent(new PopStateEvent(`popstate`,{state:window.history.state}))}}},l={type:H};return window.addEventListener(`message`,c),window.addEventListener(`popstate`,r),window.addEventListener(`hashchange`,r),window.parent.postMessage(l,n),r(),()=>{window.removeEventListener(`message`,c),window.removeEventListener(`popstate`,r),window.removeEventListener(`hashchange`,r),window.history.pushState===o&&(window.history.pushState=i),window.history.replaceState===s&&(window.history.replaceState=a)}},[t,e]),null}function _t({name:e,AccessDenied:n=yt,children:r}){return e?t(vt,{name:e,AccessDenied:n,children:r}):t(bt,{})}function vt({name:e,AccessDenied:n=yt,children:r}){let{authToken:i,client:a}=R(),[s,c]=l(null),[u,d]=l(`loading`);if(o(()=>{i?i.apps.includes(e)?a.apps.getAppInstallationByName(e).then(t=>{t?(d(`loaded`),c(t)):(console.log(`App ${e} not found!`),d(`error`))}):d(`error`):d(`loading`)},[e,i,a.apps.getAppInstallationByName]),u===`loading`)return null;if(u===`error`)return t(n,{name:e});if(s)return t(Ve,{installation:s,children:r})}function yt({name:e}){let{project:r,accounts:i,client:a}=R(),{t:c}=z(),[u,d]=l(),{data:p}=j(()=>a.apps.getAppInstallationProjects({name:e}),[e]),{projectsByOrg:m,orgOptions:h}=s(()=>{if(!p||!i)return{projectsByOrg:{},orgOptions:[]};let e={};for(let t of p)e[t.account]||(e[t.account]=[]),e[t.account].push(t);return{projectsByOrg:e,orgOptions:i.filter(t=>e[t.id]?.length>0)}},[p,i]);o(()=>{!u&&h.length>0&&d(h[0].id)},[h,u]);let g=e=>{localStorage.setItem(N,e.account),localStorage.setItem(`${oe}-${e.account}`,e.id),window.location.reload()},_=u&&m[u]||[],v=h.find(e=>e.id===u);return n(f,{className:`pt-10 flex flex-col items-center text-center text-gray-700`,children:[t(be,{className:`w-10 h-10 mb-4 text-gray-500`}),t(`div`,{className:`text-xl font-semibold`,children:c(`shell.accessDenied`)}),n(`div`,{className:`mt-2 text-sm text-gray-500`,children:[`You don't have permission to view the `,t(`span`,{className:`font-semibold`,children:e}),` app in project:`,` `,n(`span`,{className:`font-semibold`,children:[`«`,r?.name,`»`]}),`.`]}),h.length===0&&p!==void 0&&t(`div`,{className:`mt-4 text-sm text-gray-500`,children:`This app is not installed in any project you have access to.`}),h.length>0&&n(`div`,{className:`mt-4 flex flex-row gap-4 items-end`,children:[h.length>1&&n(`div`,{children:[t(`div`,{className:`text-sm text-gray-500 mb-2`,children:c(`shell.organization`)}),t(w,{by:`id`,value:v,options:h,optionLabel:e=>e.name,placeholder:c(`shell.selectOrganization`),onChange:e=>d(e.id)})]}),n(`div`,{children:[h.length>1&&t(`div`,{className:`text-sm text-gray-500 mb-2`,children:c(`login.terminal.project`)}),t(w,{by:`id`,value:void 0,options:_,optionLabel:e=>e.name,placeholder:c(`shell.selectProject`),onChange:g})]})]})]})}function bt(){let{t:e}=z();return n(f,{className:`pt-10 flex flex-col items-center text-center text-gray-700`,children:[t(be,{className:`w-10 h-10 mb-4 text-gray-500`}),t(`div`,{className:`text-xl font-semibold`,children:e(`shell.applicationNotRegistered`)}),n(`div`,{className:`mt-2 text-sm text-gray-500`,children:[`Before starting to code a Vertesia application you must register an application manifest in Vertesia Studio then install it in one or more projects.`,t(`p`,{}),`Then use the created app name as a parameter to`,` `,t(`code`,{children:`<StandaloneApp name="your-app-name">`}),` in the `,t(`code`,{children:`src/main.tsx`}),` file.`]})]})}function xt(){let e=R(),{client:r}=e,{t:i}=z(),[a,s]=l(!1),[c,u]=l([]);o(()=>{r.account.listInvites().then(e=>{if(e.length>0){let t=e.filter(e=>e.data.account);if(t.length===0){console.log(`No valid invites found, closing modal`);return}console.log(`Found valid invites`,t.length),s(!0),u(t)}else console.log(`No invites found, closing modal`),s(!1)}).catch(e=>{console.error(`Error fetching invites`,e)})},[r.account.listInvites]);let f=()=>s(!1),p=async t=>{await r.account.acceptInvite(t.id),await e.authCallback,await e.fetchAccounts(),await e.fetchProjects(t.data.account.id);let n=c.filter(e=>e.id!==t.id).filter(e=>e.data.account);n.length>0?u(n):f()},m=async e=>{await r.account.rejectInvite(e.id);let t=c.filter(t=>t.id!==e.id);u(t),t.length===0&&f()},h=c.map(e=>e.data.account?n(`div`,{className:`flex flex-row w-full justify-between border rounded-sm px-2 py-2 `,children:[n(`div`,{className:`flex flex-col`,children:[t(`div`,{className:`w-full font-semibold`,children:e.data.account.name??e.data.account}),e.data.project&&n(`div`,{className:`w-full text-base`,children:[`- `,e.data.project.name]}),n(`div`,{className:`text-xs`,children:[`Role: `,e.data.role]}),e.data.invited_by&&n(`div`,{className:`text-xs`,children:[`by `,e.data.invited_by.name??e.data.invited_by]})]}),n(`div`,{className:`flex flex-col gap-4`,children:[t(d,{size:`xs`,onClick:()=>p(e),children:i(`login.accept`)}),` `,t(d,{size:`xs`,variant:`secondary`,onClick:()=>m(e),children:i(`login.reject`)})]})]},e.id):(console.warn(`Invite has no account data`,e),null));return t(`div`,{children:n(g,{isOpen:a,onClose:f,children:[t(y,{children:i(`login.reviewInvites`)}),n(_,{children:[t(`div`,{className:`text-sm pb-4`,children:`You have received the following invites to join other accounts. Please review and accept or declined them.`}),h]})]})})}function St(e){return n(`svg`,{viewBox:`0 0 48 48`,"aria-hidden":`true`,...e,children:[t(`path`,{fill:`#FFC107`,d:`M43.6 20.5H42V20H24v8h11.3c-1.6 4.7-6.1 8-11.3 8a12 12 0 0 1 0-24c3 0 5.8 1.1 7.9 3l5.7-5.7A20 20 0 1 0 24 44c11 0 20-9 20-20 0-1.2-.1-2.3-.4-3.5z`}),t(`path`,{fill:`#FF3D00`,d:`M6.3 14.7l6.6 4.8A12 12 0 0 1 24 12c3 0 5.8 1.1 7.9 3l5.7-5.7A20 20 0 0 0 6.3 14.7z`}),t(`path`,{fill:`#4CAF50`,d:`M24 44c5.2 0 10-2 13.6-5.2l-6.3-5.3A12 12 0 0 1 12.7 28.5l-6.6 5.1A20 20 0 0 0 24 44z`}),t(`path`,{fill:`#1976D2`,d:`M43.6 20.5H42V20H24v8h11.3a12 12 0 0 1-4 5.5l6.3 5.3C37.9 36.6 44 31 44 24c0-1.2-.1-2.3-.4-3.5z`})]})}function Ct(e){return t(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":`true`,...e,children:t(`path`,{fill:`currentColor`,fillRule:`evenodd`,clipRule:`evenodd`,d:`M12 2C6.48 2 2 6.58 2 12.25c0 4.54 2.87 8.39 6.84 9.75.5.09.68-.22.68-.49v-1.7c-2.78.62-3.37-1.36-3.37-1.36-.46-1.18-1.11-1.5-1.11-1.5-.91-.63.07-.62.07-.62 1 .07 1.53 1.05 1.53 1.05.89 1.57 2.34 1.12 2.91.86.09-.66.35-1.12.63-1.38-2.22-.26-4.56-1.14-4.56-5.07 0-1.12.39-2.03 1.03-2.75-.1-.26-.45-1.3.1-2.7 0 0 .84-.28 2.76 1.05A9.4 9.4 0 0 1 12 7.07c.85 0 1.71.12 2.51.34 1.91-1.33 2.75-1.05 2.75-1.05.55 1.4.2 2.44.1 2.7.64.72 1.03 1.63 1.03 2.75 0 3.94-2.34 4.81-4.57 5.06.36.32.68.94.68 1.9v2.81c0 .27.18.59.69.49C19.13 20.64 22 16.78 22 12.25 22 6.58 17.52 2 12 2z`})})}function wt(e){return n(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":`true`,...e,children:[t(`path`,{fill:`#F25022`,d:`M2 2h9.5v9.5H2z`}),t(`path`,{fill:`#7FBA00`,d:`M12.5 2H22v9.5h-9.5z`}),t(`path`,{fill:`#00A4EF`,d:`M2 12.5h9.5V22H2z`}),t(`path`,{fill:`#FFB900`,d:`M12.5 12.5H22V22h-9.5z`})]})}const Tt=xe,Et={google:St,github:Ct,microsoft:wt,oidc:Tt};function Dt(e){return e&&e in Et?Et[e]:Tt}function G({children:e,centered:n=!1}){return t(`div`,{className:n?`w-full max-w-[420px] flex flex-col gap-6 items-center text-center`:`w-full max-w-[420px] flex flex-col gap-6`,children:e})}function K({eyebrow:e,title:r,body:i,variant:a=`info`}){return n(`div`,{children:[e&&t(`div`,{className:`${a===`destructive`?`text-destructive`:`text-info`} text-[12.5px] font-medium mb-2`,children:e}),t(`h1`,{className:`text-foreground text-[22px] font-semibold tracking-tight leading-tight mb-1.5`,children:r}),i&&t(`p`,{className:`text-muted text-sm leading-relaxed`,children:i})]})}const Ot={primary:`h-[42px] gap-2.5 rounded-md bg-foreground text-background hover:opacity-90 disabled:opacity-50 disabled:cursor-not-allowed`,loading:`h-[42px] gap-2.5 rounded-md bg-foreground text-background opacity-90`,ghost:`h-9 text-muted hover:text-foreground`};function q({variant:e=`primary`,className:n=``,type:r=`button`,disabled:i,...a}){return t(d,{variant:`unstyled`,size:`none`,type:r,disabled:e===`loading`||i,className:`cursor-pointer inline-flex items-center justify-center text-sm font-medium transition ${Ot[e]} ${n}`.trim(),...a})}function kt({size:e=`xs`,className:n=``,type:r=`button`,...i}){let a=`cursor-pointer ${e===`smaller`?`!text-[11px]`:`!text-xs`} text-muted hover:text-foreground !transition px-2 py-1 !rounded underline decoration-transparent hover:decoration-current underline-offset-[3px]`;return t(d,{variant:`unstyled`,size:`none`,type:r,className:n?`${a} ${n}`:a,...i})}const At={circle:`size-9 rounded-full text-sm ring-4 ring-background ring-offset-1 ring-offset-border`,square:`size-[30px] rounded-md text-[11px]`};function jt({initials:e,shape:n=`circle`}){return t(`span`,{className:`bg-info text-info-foreground grid place-items-center font-semibold shrink-0 ${At[n]}`,children:e})}function Mt({children:e}){return t(`div`,{className:`inline-grid place-items-center size-14 rounded-xl bg-info-background border border-info/15 mb-3.5`,children:e})}function Nt({title:e,subtitle:r,titleClass:i,subtitleClass:a}){return n(`div`,{className:`flex-1 min-w-0`,children:[t(`div`,{className:i,children:e}),t(`div`,{className:a,children:r})]})}const Pt={tenant:{topRow:`flex items-center gap-2.5 px-3 py-2.5`,title:`text-[13.5px] font-semibold text-foreground leading-tight`,subtitle:`text-[11.5px] text-muted leading-tight mt-0.5`,bottomRow:`flex items-center gap-2.5 px-3 py-1.5 border-t border-border bg-muted-background`,mailBox:`size-[30px] grid place-items-center shrink-0`,mailIcon:`size-4 text-muted`,email:`text-sm text-foreground/80 flex-1 truncate`,actionSize:`xs`},returning:{topRow:`flex items-center gap-3 px-3.5 py-2.5`,title:`text-sm font-semibold text-foreground truncate`,subtitle:`text-xs text-foreground/80 truncate`,bottomRow:`flex items-center gap-3 px-3.5 py-1 border-t border-border bg-muted-background`,mailBox:`w-9 h-6 grid place-items-center shrink-0`,mailIcon:`size-3.5 text-muted`,email:`text-xs text-foreground/80 flex-1 truncate`,actionSize:`smaller`}};function Ft({variant:e=`returning`,badge:r,title:i,subtitle:a,email:o,actionLabel:s,onAction:c}){let l=Pt[e];return n(`div`,{className:`rounded-md border border-border bg-background overflow-hidden`,children:[n(`div`,{className:l.topRow,children:[r,t(Nt,{title:i,subtitle:a,titleClass:l.title,subtitleClass:l.subtitle})]}),n(`div`,{className:l.bottomRow,children:[t(`div`,{className:l.mailBox,children:t(Se,{className:l.mailIcon})}),t(`span`,{className:l.email,children:o}),t(kt,{size:l.actionSize,onClick:c,children:s})]})]})}function It({badge:e,title:r,subtitle:i,actionLabel:a,onAction:o}){return n(`div`,{className:`flex items-center gap-3 px-3.5 py-2.5 rounded-md border border-border bg-muted-background`,children:[e,t(Nt,{title:r,subtitle:i,titleClass:`text-sm font-semibold text-foreground truncate`,subtitleClass:`text-xs text-muted truncate`}),t(kt,{onClick:o,children:a})]})}function Lt({email:e,actionLabel:r,onAction:i}){return n(`div`,{className:`flex items-center gap-2 px-3 py-2 rounded-md border border-border bg-muted-background`,children:[t(Se,{className:`size-4 text-muted shrink-0`}),t(`span`,{className:`text-sm text-foreground/80 flex-1 truncate`,children:e}),t(kt,{onClick:i,children:r})]})}function Rt({provider:e,label:r,onClick:i,variant:a=`outline`}){let o=Dt(e);return a===`arrow`?n(d,{variant:`unstyled`,size:`none`,onClick:i,className:`cursor-pointer group h-[42px] w-full inline-flex items-center gap-3 ps-3.5 pe-3 rounded-md border border-border bg-background text-sm font-medium text-foreground transition hover:bg-muted-background`,children:[t(o,{className:`!size-[18px] shrink-0`}),t(`span`,{className:`flex-1 text-start`,children:r}),t(_e,{className:`!size-3.5 text-muted opacity-0 group-hover:opacity-100 group-hover:translate-x-0.5 rtl:group-hover:-translate-x-0.5 transition`})]}):n(d,{variant:`outline`,onClick:i,className:`w-full py-5 flex rounded-lg transition duration-150 text-center ${a===`filled`?`!bg-foreground text-background hover:!bg-foreground/90`:`hover:shadow-sm`}`,children:[t(o,{className:`!size-[18px]`}),t(`span`,{className:`text-sm font-medium`,children:r})]})}function zt({icon:e,title:r,meta:i}){return n(`div`,{className:`flex items-center gap-2.5 px-3 py-2.5 rounded-md bg-destructive-background border border-destructive/20`,children:[t(e,{className:`size-5 text-destructive shrink-0`}),n(`div`,{className:`flex-1 min-w-0 text-sm`,children:[t(`div`,{className:`font-semibold text-destructive`,children:r}),t(`div`,{className:`text-xs text-destructive/80`,children:i})]})]})}function Bt({inputRef:e,label:r,placeholder:i,value:a,onChange:o,invalid:s=!1,error:c}){return n(`div`,{className:`flex flex-col gap-1.5`,children:[t(`label`,{htmlFor:`vt-login-email`,className:`text-xs font-medium text-foreground/80`,children:r}),t(`input`,{ref:e,id:`vt-login-email`,name:`vt-login-email`,type:`email`,className:`h-[42px] px-3.5 rounded-md border border-border bg-background text-sm text-foreground placeholder:text-muted-foreground outline-none transition focus:border-info focus:ring-4 focus:ring-info/15 aria-[invalid=true]:border-destructive aria-[invalid=true]:ring-destructive/15`,placeholder:i,value:a,onChange:e=>o(e.target.value),"aria-invalid":s,autoComplete:`off`,autoCorrect:`off`,autoCapitalize:`off`,spellCheck:!1,"data-1p-ignore":!0,"data-lpignore":`true`,"data-form-type":`other`}),c&&t(`div`,{role:`alert`,className:`text-xs text-destructive`,children:c})]})}const Vt=`vt.lastSuccessfulLogin`,Ht=`vt.pendingSignin`;function Ut(){try{let e=localStorage.getItem(Vt);if(!e)return null;let t=JSON.parse(e);return!t?.email||!t?.lastProvider?null:t}catch{return null}}function Wt(e){try{localStorage.setItem(Vt,JSON.stringify(e))}catch{}}function Gt(){try{localStorage.removeItem(Vt)}catch{}}function Kt(){try{let e=sessionStorage.getItem(Ht);return e?JSON.parse(e):null}catch{return null}}function qt(e){try{sessionStorage.setItem(Ht,JSON.stringify(e))}catch{}}function J(){try{sessionStorage.removeItem(Ht)}catch{}}async function Jt(){Gt(),J();try{await Me(L())}catch{}}function Yt(e){let t=e||window.location.pathname||`/`;return t[0]!==`/`&&(t=`/${t}`),t}const Xt={google:(e,t)=>{let n=new ke;return n.addScope(`profile`),n.addScope(`email`),n.setCustomParameters({redirect_uri:window.location.origin+Yt(t),...e?{login_hint:e}:{prompt:`select_account`}}),n},github:e=>{let t=new Oe;return t.addScope(`profile`),t.addScope(`email`),e&&t.setCustomParameters({login:e}),t},microsoft:e=>{let t=new Ae(`microsoft.com`);return t.addScope(`profile`),t.addScope(`email`),e&&t.setCustomParameters({login_hint:e}),t},oidc:e=>{let t=new Ae(`oidc.main`);return e&&t.setCustomParameters({login_hint:e}),t}};function Zt(e,t,n){return Xt[e](t,n)}async function Qt(e,t,n){if(!t)return{ok:!1,reason:`no-email`};let r=await fe(t),i=L(),a=e,o;return r?(r.provider&&(a=r.provider),o=r.label||r.name||void 0,localStorage.setItem(`tenantName`,o??``)):(localStorage.removeItem(`tenantName`),i.tenantId&&=null),qt({email:t,provider:a,tenantName:o}),je(i,Zt(a,t,n)),{ok:!0}}function $t(e,t){let n=L();localStorage.removeItem(`tenantName`),n.tenantId&&=null,je(n,Zt(e,void 0,t))}function Y(e){return e===`google`?`Google`:e===`github`?`GitHub`:e===`microsoft`?`Microsoft`:`Sign In`}function en(e){if(!e)return``;let t=e.lastIndexOf(`@`);return t>0?e.slice(0,t):e}function tn(e){if(!e)return``;let t=e.lastIndexOf(`@`);return t>0?e.slice(t+1):``}function nn(e){return e&&e.charAt(0).toUpperCase()+e.slice(1)}function rn(e){return(e||`?`).charAt(0).toUpperCase()}function an(e){let t=en(e).split(/[._-]+/).filter(Boolean)[0]||`friend`;return t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()}function on(e){for(let t of e)if(t.trim()===``)return!0;return!1}function sn(e){let t=(e||``).trim(),n=t.indexOf(`@`);if(n<=0||n!==t.lastIndexOf(`@`))return!1;let r=t.slice(n+1),i=r.indexOf(`.`);return i>0&&i<r.length-1&&!on(t)}function cn(e){let t=e;for(let e=0;t!=null&&e<8;e++){if((t instanceof Error?t.message:String(t)).includes(`Customer-domain user requires an invite to join`))return!0;t=t instanceof Error?t.cause:void 0}return!1}function ln({provider:e,onCancel:r}){let{t:i}=z(),a=Dt(e),o=e===`oidc`?i(`auth.pending.genericProvider`):Y(e);return n(G,{centered:!0,children:[n(`div`,{children:[t(Mt,{children:t(a,{className:e===`oidc`?`size-6 text-info`:`size-6`})}),t(K,{title:i(`auth.pending.title`,{provider:o}),body:i(`auth.pending.body`)})]}),n(`div`,{className:`w-full flex flex-col gap-2`,children:[n(q,{variant:`loading`,children:[t(T,{}),t(`span`,{children:i(`auth.pending.authenticating`)})]}),r&&t(q,{variant:`ghost`,onClick:r,children:i(`auth.pending.cancel`)})]})]})}function un({initialEmail:r,onProceed:i}){let{t:a}=z(),[s,u]=l(r??``),[d,f]=l(!1),[p,m]=l(!1),h=c(null);return o(()=>{h.current?.focus()},[]),n(G,{children:[t(K,{eyebrow:a(`auth.email.eyebrow`),title:a(`auth.email.title`),body:a(`auth.email.body`)}),n(`form`,{onSubmit:async e=>{if(e.preventDefault(),!p){if(!sn(s)){f(!0);return}f(!1),m(!0);try{let e=await fe(s.trim().toLowerCase());i(s.trim().toLowerCase(),e??void 0)}catch{i(s.trim().toLowerCase(),void 0)}finally{m(!1)}}},noValidate:!0,className:`flex flex-col ${d?`gap-2`:`gap-6`}`,children:[t(Bt,{inputRef:h,label:a(`auth.email.label`),placeholder:a(`auth.email.placeholder`),value:s,onChange:e=>{u(e),d&&f(!1)},invalid:d,error:d?a(`auth.email.invalidError`):void 0}),t(q,{type:`submit`,disabled:p,children:p?t(T,{}):n(e,{children:[t(`span`,{children:a(`auth.continue`)}),t(_e,{className:`!size-3.5`})]})})]})]})}const dn=[`google`,`github`,`microsoft`];function fn({email:e,onBack:r,onProviderClicked:i,redirectTo:a}){let{t:o}=z(),s=async t=>{i(t),await Qt(t,e,a)};return n(G,{children:[t(K,{eyebrow:o(`auth.providers.eyebrow`),title:o(`auth.providers.title`),body:o(`auth.providers.bodyConsumer`)}),t(Lt,{email:e,actionLabel:o(`auth.change`),onAction:r}),t(`div`,{className:`flex flex-col gap-2`,children:dn.map(e=>t(Rt,{provider:e,label:o(`auth.continueWithProvider`,{provider:Y(e)}),onClick:()=>s(e),variant:`arrow`},e))})]})}function X({details:r,identity:i,kind:a,onContinue:s,onUseDifferentAccount:u}){let{t:d}=z(),[f,p]=l(!1),m=c(null);o(()=>{m.current?.focus()},[]);let h=a===`scopeProject`||a===`scopeAccount`,g;g=a===`scopeProject`?{eyebrow:d(`auth.recovery.scopeProject.eyebrow`),title:d(`auth.recovery.scopeProject.title`),body:d(`auth.recovery.scopeProject.body`)}:a===`scopeAccount`?{eyebrow:d(`auth.recovery.scopeAccount.eyebrow`),title:d(`auth.recovery.scopeAccount.title`),body:d(`auth.recovery.scopeAccount.body`)}:a===`noAccessibleAccount`?{eyebrow:d(`auth.recovery.noAccessibleAccount.eyebrow`),title:d(`auth.recovery.noAccessibleAccount.title`),body:d(`auth.recovery.noAccessibleAccount.body`)}:a===`credential`?{eyebrow:d(`auth.recovery.credential.eyebrow`),title:d(`auth.recovery.credential.title`),body:d(`auth.recovery.credential.body`)}:{eyebrow:d(`auth.recovery.service.eyebrow`),title:d(`auth.recovery.service.title`),body:d(`auth.recovery.service.body`)};let _=e=>{f||(p(!0),e())};return n(G,{children:[n(`div`,{role:`alert`,"aria-live":`assertive`,children:[t(Mt,{children:t(ge,{className:`size-7 text-attention`,"aria-hidden":`true`})}),t(K,{eyebrow:g.eyebrow,title:g.title,body:g.body})]}),i&&t(It,{badge:t(jt,{initials:rn(i.email)}),title:i.name||an(i.email),subtitle:i.email,actionLabel:d(`auth.returning.notYou`),onAction:u}),n(`div`,{className:`flex flex-col gap-2`,children:[s&&t(q,{ref:m,className:`w-full`,disabled:f,onClick:()=>_(s),children:d(h?`auth.recovery.continue`:`auth.recovery.tryAgain`)}),t(q,{ref:s?void 0:m,variant:s?`ghost`:`primary`,disabled:f,onClick:()=>_(u),children:d(`auth.recovery.useDifferentAccount`)}),(a===`noAccessibleAccount`||a===`service`)&&n(`p`,{className:`text-center text-xs text-muted`,children:[d(`auth.recovery.supportPrefix`),` `,t(`a`,{className:`text-info`,href:`mailto:support@vertesiahq.com`,children:`support@vertesiahq.com`})]})]}),r&&n(`details`,{className:`rounded-lg border border-mixer-muted/30 bg-mixer-muted/10 px-4 py-3 text-sm`,children:[t(`summary`,{className:`cursor-pointer font-medium text-muted marker:text-muted focus-visible:outline-2 focus-visible:outline-offset-2`,children:d(`auth.recovery.technicalDetails`)}),n(`dl`,{className:`mt-3 grid grid-cols-[max-content_minmax(0,1fr)] gap-x-3 gap-y-2 text-xs`,children:[r.errorCode&&n(e,{children:[t(`dt`,{className:`text-muted`,children:d(`auth.recovery.errorCode`)}),t(`dd`,{className:`wrap-break-word font-mono`,children:r.errorCode})]}),r.status&&n(e,{children:[t(`dt`,{className:`text-muted`,children:d(`auth.recovery.httpStatus`)}),t(`dd`,{className:`font-mono`,children:r.status})]}),r.accountId&&n(e,{children:[t(`dt`,{className:`text-muted`,children:d(`auth.recovery.requestedAccount`)}),t(`dd`,{className:`wrap-break-word font-mono`,children:r.accountId})]}),r.projectId&&n(e,{children:[t(`dt`,{className:`text-muted`,children:d(`auth.recovery.requestedProject`)}),t(`dd`,{className:`wrap-break-word font-mono`,children:r.projectId})]}),t(`dt`,{className:`text-muted`,children:d(`auth.recovery.errorMessage`)}),t(`dd`,{className:`wrap-break-word font-mono`,children:r.message})]})]})]})}const pn={dev1:`us1`};function mn(e){let t=e&&pn[e]||e;return t?`https://cloud.${t}.vertesia.io/`:`https://cloud.vertesia.io/`}function hn({onUseDifferentEmail:e}){let{t:r}=z(),i=mn(B.region),[a,s]=l(15);return o(()=>{Jt()},[]),o(()=>{let e=setTimeout(()=>{window.location.href=i},15e3),t=setInterval(()=>{s(e=>e>0?e-1:0)},1e3);return()=>{clearTimeout(e),clearInterval(t)}},[i]),n(G,{children:[t(K,{variant:`destructive`,eyebrow:r(`auth.restricted.eyebrow`),title:r(`auth.restricted.title`),body:r(`auth.restricted.body`)}),n(`div`,{className:`flex flex-col gap-2`,children:[t(zt,{icon:Ce,title:r(`auth.restricted.calloutTitle`),meta:r(`auth.restricted.calloutMeta`)}),t(q,{className:`w-full`,onClick:()=>{window.location.href=i},children:r(`auth.restricted.redirect`)}),t(q,{variant:`ghost`,onClick:e,children:r(`auth.restricted.useDifferent`)}),t(`p`,{className:`text-center text-xs text-muted`,children:r(`auth.restricted.autoRedirect`,{seconds:a})})]})]})}function gn({session:e,onNotYou:r,onProviderClicked:i,redirectTo:a}){let{t:o}=z(),s=e.name?e.name.split(` `)[0]||e.name:an(e.email),c=e.name||an(e.email),l=t(jt,{initials:rn(e.email)}),u=!!e.tenantName,d=e.lastProvider===`oidc`?o(`auth.continueWithSignIn`):o(`auth.continueWithProvider`,{provider:Y(e.lastProvider)}),f=async t=>{i(t),await Qt(t,e.email,a)};return n(G,{children:[t(K,{eyebrow:o(`auth.returning.eyebrow`),title:o(`auth.returning.title`,{name:s}),body:o(`auth.returning.body`)}),u&&e.tenantName?t(Ft,{variant:`returning`,badge:l,title:c,subtitle:e.tenantName,email:e.email,actionLabel:o(`auth.returning.notYou`),onAction:r}):t(It,{badge:l,title:c,subtitle:e.email,actionLabel:o(`auth.returning.notYou`),onAction:r}),n(`div`,{className:`flex flex-col gap-2`,children:[t(Rt,{provider:e.lastProvider,label:d,onClick:()=>f(e.lastProvider),variant:`filled`}),t(q,{variant:`ghost`,onClick:r,children:o(`auth.returning.useDifferent`)})]})]})}function _n({email:e,tenantName:r,onBack:i}){let{t:a}=z(),o=r||a(`auth.blocked.tenantFallback`),s=tn(e),c=r||(s?a(`auth.blocked.teamFromDomain`,{domain:nn(s)}):a(`auth.blocked.tenantFallback`));return n(G,{children:[t(K,{variant:`destructive`,eyebrow:a(`auth.blocked.eyebrow`),title:a(`auth.blocked.title`),body:a(`auth.blocked.body`,{name:o,email:e})}),n(`div`,{className:`flex flex-col gap-2`,children:[t(zt,{icon:Ce,title:c,meta:a(`auth.blocked.tenantMeta`,{email:e})}),t(q,{variant:`ghost`,onClick:i,children:a(`auth.blocked.useDifferent`)})]})]})}function Z({provider:e,email:n,redirectTo:r,variant:i=`outline`,onClick:a}){let{t:o}=z(),s=e===`oidc`?o(`auth.continueWithSignIn`):o(`auth.continueWithProvider`,{provider:Y(e)});return t(Rt,{provider:e,label:s,onClick:()=>{a?.(),n?Qt(e,n,r):$t(e,r)},variant:i})}function vn(e){return e.split(/\s+/).filter(Boolean).slice(0,2).map(e=>e.charAt(0).toUpperCase()).join(``)}function yn({email:e,tenant:r,onBack:i,onProviderClicked:a,redirectTo:o}){let{t:s}=z(),c=r.label||r.name||s(`auth.blocked.tenantFallback`),l=r.provider===`google`||r.provider===`github`||r.provider===`microsoft`?r.provider:`oidc`,u=l===`oidc`?s(`auth.tenant.viaIdpFallback`):Y(l);return n(G,{children:[t(K,{eyebrow:s(`auth.tenant.eyebrow`),title:s(`auth.tenant.title`,{name:c}),body:s(`auth.tenant.body`)}),t(Ft,{variant:`tenant`,badge:t(jt,{initials:vn(c),shape:`square`}),title:c,subtitle:s(`auth.tenant.viaIdp`,{idp:u}),email:e,actionLabel:s(`auth.change`),onAction:i}),n(`div`,{className:`flex flex-col gap-2`,children:[t(Z,{provider:l,email:e,redirectTo:o,variant:`filled`,onClick:a}),t(q,{variant:`ghost`,onClick:i,children:s(`auth.tenant.notPartOf`,{name:c})})]})]})}function bn({onSignup:r,goBack:i}){let{t:a}=z(),[s,c]=l(void 0),[u,f]=l(void 0),[p,h]=l(void 0),[g,_]=l(void 0),[v,y]=l(void 0),[b,x]=l(void 0),[S,C]=l(void 0),T=s===`company`,te=[{id:1,label:a(`signup.size1to10`)},{id:11,label:a(`signup.size11to100`)},{id:101,label:a(`signup.size101to1000`)},{id:1001,label:a(`signup.size1001to5000`)},{id:5001,label:a(`signup.size5000plus`)}],E=[{id:`personal`,label:a(`signup.personal`),description:a(`signup.personalDescription`)},{id:`company`,label:a(`signup.company`),description:a(`signup.companyDescription`)}],D=[{id:`testing`,label:a(`signup.justTesting`)},{id:`exploring`,label:a(`signup.activelyExploring`)},{id:`using`,label:a(`signup.alreadyUsing`)},{id:`migrating`,label:a(`signup.migratingLLMs`)},{id:`other`,label:a(`signup.other`)}];o(()=>{let e=L().currentUser;if(!e){console.error(`No user found`);return}x(e)},[]);let O=()=>s?T&&!p?(C(a(`signup.pleaseEnterOrgName`)),!1):T&&!u?(C(a(`signup.pleaseSelectCompanySize`)),!1):!0:(C(a(`signup.pleaseSelectAccountType`)),!1);return n(`div`,{className:`flex flex-col space-y-2`,children:[n(`div`,{className:`prose`,children:[t(`p`,{className:`prose text-sm text-muted pt-4`,children:a(`signup.welcomeMessage`,{name:b?.displayName,email:b?.email})}),S&&t(`div`,{className:`text-destructive`,children:S})]}),t(Q,{label:a(`signup.accountType`),children:t(ee,{options:E,selected:E.find(e=>e.id===s),onSelect:e=>c(e.id)})}),T&&n(e,{children:[t(Q,{label:a(`signup.companySize`),children:t(w,{className:`w-full border border-accent bg-muted`,value:u,options:te,onChange:f,optionLabel:e=>e?.label,placeholder:a(`signup.selectCompanySize`)})}),t(Q,{label:a(`signup.companyName`),children:t(m,{value:p,onChange:h,type:`text`,required:!0})}),t(Q,{label:a(`signup.companyWebsite`),children:t(m,{value:g,onChange:_,type:`text`})})]}),t(Q,{label:a(`signup.projectMaturity`),children:t(w,{className:`w-full border border-accent bg-muted`,options:D,value:D.find(e=>e.id===v),optionLabel:e=>e?.label,placeholder:a(`signup.selectProjectMaturity`),onChange:e=>y(e?.id)})}),n(`div`,{className:`pt-8 flex flex-col`,children:[t(d,{variant:`primary`,onClick:async()=>{if(!O()||!s)return;let e={accountType:s,companyName:p,companySize:u?.id,companyWebsite:g,maturity:v};window.localStorage.setItem(`composableSignupData`,JSON.stringify(e));let t=await L().currentUser?.getIdToken();if(console.log(`Got firebase token`,L(),t),!t){console.error(`No firebase token found`);return}r(e,t)},size:`xl`,children:t(`span`,{className:`text-lg`,children:a(`signup.signUp`)})}),t(d,{variant:`ghost`,size:`xl`,className:`mt-4`,onClick:i,children:t(`span`,{className:``,children:a(`signup.wrongAccountGoBack`)})})]})]})}function Q({label:e,children:r}){return n(`div`,{className:`flex flex-col space-y-2 pt-4`,children:[t(`div`,{className:`text-sm text-muted`,children:e}),r]})}function xn({allowedPrefix:e,isNested:n=!1,lightLogo:r,darkLogo:i,preservePath:a,suppressAuthErrorPrefix:o}){let s=typeof window>`u`?``:window.location.pathname,c=Sn(s,e),l=Sn(s,o);return c?null:t(wn,{isNested:n,lightLogo:r,darkLogo:i,preservePath:a,suppressAuthError:l})}function Sn(e,t){return(Array.isArray(t)?t:t?[t]:[]).some(t=>e===t||e.startsWith(t.endsWith(`/`)?t:`${t}/`))}function Cn(e){return e instanceof ce||e instanceof se||e instanceof F||e instanceof P||e instanceof M||e instanceof ie}function wn({isNested:e=!1,lightLogo:r,darkLogo:a,preservePath:s,suppressAuthError:c}){let{t:u}=z(),{isLoading:d,user:f,authError:p,signOut:m}=R(),{trackEvent:h}=pe(),[g,_]=l(()=>Ut()),[v,y]=l(()=>Ut()?`returning`:`email`),[b,x]=l(``),[S,C]=l(void 0),[ee,w]=l(null),T=p instanceof F||p instanceof P?p.identity:void 0,te=T&&g?.email.toLowerCase()===T.email.toLowerCase()?g:void 0,E=T?{email:T.email,name:T.name??te?.name}:void 0;o(()=>{if(!s&&!d&&!p){let e=new URL(document.baseURI).pathname||`/`;history.replaceState({},``,e)}},[p,d,s]),o(()=>{if(p){if(p instanceof ce)y(`signup`);else if(p instanceof se)y(`restricted`);else if(p instanceof F)y(`scopeUnavailable`);else if(p instanceof P)y(`noAccessibleAccount`);else if(p instanceof M)y(`credentialFailure`);else if(p instanceof ie)y(`serviceFailure`);else if(cn(p)){let e=Kt();e&&x(e.email),y(`blocked`)}}},[p]),o(()=>{if(!f)return;let e=Kt();e&&(Wt({email:e.email,lastProvider:e.provider,tenantName:e.tenantName,name:f.name||void 0}),J())},[f]);let D=i((e,t)=>{x(e),C(t),y(t?`tenant`:`providers`)},[]),O=i(()=>{y(`email`),C(void 0)},[]),ne=i(()=>{Gt(),J(),_(null),x(``),C(void 0),y(`email`),m()},[m]),k=i(e=>{(S||g?.tenantName)&&h(`enterprise_signin`,{provider:e}),w(e),y(`pending`)},[h,g?.tenantName,S]),A=i(()=>{_(null),x(``),C(void 0),y(`email`),Jt()},[]),j=i(()=>{B.logger.info(`Authentication recovery action selected`,{vertesia:{recovery_action:`use_different_account`}}),_(null),x(``),C(void 0),y(`email`),Jt().finally(()=>m())},[m]),re=i(()=>{p instanceof F&&(B.logger.info(`Authentication recovery action selected`,{vertesia:{error_code:Te,selector_source:p.selectorSource,requested_scope:p.requestedScope,recovery_action:`continue_sanitized`}}),window.location.replace(p.recoveryUrl??window.location.href))},[p]),ae=i(()=>{B.logger.info(`Authentication recovery action selected`,{vertesia:{recovery_action:`retry`}}),window.location.reload()},[]),N=(e,t)=>{let n={signupData:e,firebaseToken:t};fetch(`${B.endpoints.studio}/auth/signup`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(n)}).then(()=>{h(`sign_up`),window.location.href=`/`})},oe=c&&p!==void 0&&!Cn(p);if(d||f||oe)return null;let I=null;if(v===`pending`&&ee)I=t(ln,{provider:ee});else if(v===`blocked`)I=t(_n,{email:b||g?.email||``,tenantName:S?.label||S?.name||g?.tenantName||void 0,onBack:A});else if(v===`restricted`)I=t(hn,{onUseDifferentEmail:A});else if(v===`scopeUnavailable`&&p instanceof F){let e=p.requestedScope===`project`?`scopeProject`:`scopeAccount`;I=t(X,{details:{accountId:p.accountId,errorCode:p.errorCode,message:p.message,projectId:p.projectId,status:p.status},identity:E,kind:e,onContinue:re,onUseDifferentAccount:j})}else I=v===`noAccessibleAccount`&&p instanceof P?t(X,{details:{errorCode:p.errorCode,message:p.message,status:p.status},identity:E,kind:`noAccessibleAccount`,onUseDifferentAccount:j}):v===`credentialFailure`&&p instanceof M?t(X,{details:{errorCode:p.errorCode,message:p.message,status:p.status},kind:`credential`,onUseDifferentAccount:j}):v===`serviceFailure`&&p instanceof ie?t(X,{details:{errorCode:p.errorCode,message:p.message,status:p.status},kind:`service`,onContinue:ae,onUseDifferentAccount:j}):v===`signup`&&!localStorage.getItem(`tenantName`)?t(bn,{onSignup:N,goBack:A}):v===`tenant`&&S?t(yn,{email:b,tenant:S,onBack:O,onProviderClicked:()=>k(S.provider??`oidc`)}):v===`providers`?t(fn,{email:b,onBack:O,onProviderClicked:k}):v===`returning`&&g?t(gn,{session:g,onNotYou:ne,onProviderClicked:k}):t(un,{initialEmail:b,onProceed:D});return t(`div`,{style:{zIndex:999998},className:`${e?`absolute`:`fixed`} inset-0 overflow-y-auto bg-background`,children:t(`div`,{className:`min-h-full flex flex-col items-center justify-center py-12 px-4`,children:n(`div`,{className:`flex flex-col items-center w-full`,children:[(r||a)&&n(`div`,{className:`mb-7`,children:[r&&t(`img`,{src:r,alt:`Vertesia`,className:`h-10 block dark:hidden`}),a&&t(`img`,{src:a,alt:`Vertesia`,className:`h-10 hidden dark:block`})]}),I,p&&!Cn(p)&&!cn(p)&&t(`div`,{className:`mt-6 max-w-[420px] text-center text-sm text-muted`,children:n(`div`,{children:[u(`auth.signInError`),t(`br`,{}),u(`auth.signInErrorContact`),t(`a`,{className:`text-info mx-1`,href:`mailto:support@vertesiahq.com`,children:`support@vertesiahq.com`}),u(`auth.signInErrorPersists`)]})}),n(`div`,{className:`flex items-center gap-5 mt-10 text-xs text-muted-foreground`,children:[t(`a`,{href:`https://vertesiahq.com/privacy`,className:`hover:text-foreground transition`,children:u(`auth.privacyPolicy`)}),t(`span`,{className:`text-border`,children:`·`}),t(`a`,{href:`https://vertesiahq.com/terms`,className:`hover:text-foreground transition`,children:u(`auth.termsOfService`)}),t(`span`,{className:`text-border`,children:`·`}),t(De,{className:`cursor-default`})]})]})})})}const Tn=new Set([`127.0.0.1`,`localhost`]);function En(e){if(!e)return null;let t;try{t=decodeURIComponent(e)}catch{return null}let n;try{n=new URL(t)}catch{return null}return n.protocol!==`http:`||!n.port||n.username||n.password||!Tn.has(n.hostname)?null:n.toString()}function Dn(e){let t=new URLSearchParams(e.search),n=En(t.get(`redirect_uri`)),r=t.get(`code`);return!n||!r?null:{redirect:n,code:r,profile:t.get(`profile`)??`default`,project:t.get(`project`)??void 0,account:t.get(`account`)??void 0}}function On(){let[e,n]=l(),[r,i]=l(),a=Dn(Ne()),o=re(),{t:s}=z(),c=a?e?t(An,{payload:e,error:r}):t(kn,{clientInfo:a,onAccept:async e=>{if(!a)return;if(!e.profile){o({title:s(`login.terminal.profileRequired`),description:s(`login.terminal.profileRequiredDesc`),status:`error`,duration:2e3});return}if(!e.account){o({title:s(`login.terminal.accountRequired`),description:s(`login.terminal.accountRequiredDesc`),status:`error`,duration:2e3});return}if(!e.project){o({title:s(`login.terminal.projectRequired`),description:s(`login.terminal.projectRequiredDesc`),status:`error`,duration:2e3});return}let t;try{let r=de(),i=r?await ue(r,e.account,e.project,86400):await le(e.account,e.project,86400);i?(t={...e,studio_server_url:B.endpoints.studio,zeno_server_url:B.endpoints.zeno,token:i},await fetch(a.redirect,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)}),n(t)):o({title:s(`login.terminal.failedToGetToken`),status:`error`,duration:5e3})}catch(e){t?(i(e instanceof Error?e:Error(A(e))),n(t)):o({title:s(`login.terminal.errorAuthorizingClient`),description:A(e),status:`error`,duration:5e3})}}}):t(p,{title:s(`login.terminal.invalidRequest`),children:s(`login.terminal.invalidRequestDesc`)});return t(`div`,{className:`w-full flex flex-col items-center gap-4 mt-24`,children:c})}function kn({onAccept:r,clientInfo:i}){let{client:a,user:o}=R(),{data:s,error:c}=j(()=>o?a.projects.list():Promise.resolve([]),[o]),{t:l}=z();if(c)return t(p,{title:l(`login.terminal.errorLoadingProjects`),children:A(c)});let u=B.isLocalDev?l(`login.terminal.envLocalDev`):B.isDev?l(`login.terminal.envStaging`):l(`login.terminal.envProduction`);return o&&s?n(e,{children:[n(`div`,{className:`w-1/3`,children:[n(`div`,{className:`mb-4 text-xl font-semibold text-info`,children:[`Authorizing client on `,u,` environment.`]}),n(`div`,{className:`mb-2 text-md text-muted-foreground`,children:[t(`div`,{children:l(`login.terminal.clientWantsAuth`)}),n(`div`,{children:[`The client app code is `,t(`b`,{className:`text-foreground`,children:i.code}),`. You can check if the code is correct in the terminal.`]})]}),n(`div`,{className:`mb-2 text-sm text-muted-foreground`,children:[t(`div`,{children:l(`login.terminal.chooseAccountProject`)}),t(`div`,{children:l(`login.terminal.profileNameNote`)})]})]}),t(jn,{onAccept:r,allProjects:s,data:i})]}):t(T,{size:`lg`})}function An({payload:e,error:r}){let i=re(),{t:a}=z();return n(`div`,{children:[r?t(`div`,{children:t(p,{title:a(`login.terminal.failedToSendToken`),children:a(`login.terminal.failedToSendTokenDesc`,{error:r.message})})}):t(`div`,{children:a(`login.terminal.clientAuthenticated`)}),t(f,{className:`mt-4`,children:t(d,{variant:`secondary`,onClick:()=>{e&&(navigator.clipboard.writeText(JSON.stringify(e)),i({title:a(`login.terminal.authPayloadCopied`),description:r?a(`login.terminal.authPayloadCopiedWithError`,{error:r.message}):a(`login.terminal.authPayloadCopiedSuccess`),status:`success`,duration:5e3}))},children:a(`login.terminal.copyAuthPayload`)})})]})}function jn({allProjects:e,data:r,onAccept:i}){let{accounts:a,account:o,project:s}=R(),{t:c}=z(),[u,f]=l(()=>({profile:r.profile,account:r.account??o?.id,project:r.project??s?.id})),p=e=>{f({...u,profile:e})},h=e=>{f({...u,account:e.id,project:void 0})},g=e=>{f({...u,project:e.id})},_=e.filter(e=>e.account===u.account);return n(`div`,{className:`w-1/3`,children:[n(`div`,{className:`mb-4 flex flex-col gap-2`,children:[t(`span`,{className:`font-semibold text-muted-foreground`,children:c(`login.terminal.profileName`)}),t(m,{type:`text`,value:u.profile,onChange:p})]}),n(`div`,{className:`mb-4 flex flex-col gap-2`,children:[t(`span`,{className:`font-semibold text-muted-foreground`,children:c(`login.terminal.account`)}),t(Mn,{value:u.account,onChange:h,accounts:a||[]})]}),n(`div`,{className:`mb-4 flex flex-col gap-2`,children:[t(`span`,{className:`font-semibold text-muted-foreground`,children:c(`login.terminal.project`)}),t(Nn,{value:u.project,onChange:g,projects:_})]}),t(`div`,{className:`mb-4 text-sm text-attention`,children:c(`login.terminal.browserPermissionNote`)}),t(`div`,{children:t(d,{size:`xl`,onClick:()=>i(u),children:c(`login.terminal.authorizeClient`)})})]})}function Mn({value:e,accounts:n,onChange:r}){let{t:i}=z();return t(w,{options:n,value:n?.find(t=>t.id===e),onChange:e=>{r(e)},by:`id`,optionLabel:e=>e.name,placeholder:i(`login.terminal.selectAccount`)})}function Nn({value:e,projects:n,onChange:r}){let{t:i}=z();return t(w,{by:`id`,value:n.find(t=>t.id===e),options:n,optionLabel:e=>e.name,placeholder:i(`login.terminal.selectProject`),onChange:e=>{r(e)}})}function Pn({isOpen:e,onClose:r}){return n(g,{isOpen:e,onClose:r,children:[t(y,{children:`Sign In`}),n(_,{className:`flex flex-col gap-2`,children:[t(Z,{provider:`google`}),t(Z,{provider:`github`}),t(Z,{provider:`microsoft`})]}),t(v,{align:`right`,children:t(d,{variant:`ghost`,onClick:r,children:`Cancel`})})]})}function $({title:e,value:r}){function i(e){navigator.clipboard.writeText(e),o(!0),setTimeout(()=>o(!1),2e3)}let[a,o]=l(!1);return n(`div`,{className:`w-full flex justify-between items-center mb-1`,children:[n(`div`,{className:`flex flex-col w-[calc(100%-3rem)]`,children:[t(`div`,{className:`text-sm px-2 dark:text-slate-200`,children:e}),t(k,{description:r,size:`xs`,placement:`left`,children:n(`div`,{className:`text-xs truncate text-muted w-full text-start px-2`,children:[r,` `]})})]}),a?t(ve,{className:`size-4 cursor-pointer text-success`}):t(ye,{className:`size-4 cursor-pointer text-gray-400 dark:text-slate-400`,onClick:()=>i(r)})]})}function Fn(){let{t:e}=z(),{account:r,project:i,client:a,authToken:o}=R(),s=a.baseUrl,c=a.store.baseUrl,l=c.replace(/\/+$/,``)!==s.replace(/\/+$/,``),u=B.endpoints.mcp??e(`user.unknown`),d=i?Ee(i):``,f=[{name:`user`,label:e(`user.user`),content:n(`div`,{className:`space-y-1 p-2`,children:[t($,{title:e(`user.organizationId`),value:r?.id??e(`user.unknown`)}),t($,{title:e(`user.projectId`),value:i?.id??e(`user.unknown`)}),t($,{title:e(`user.userId`),value:o?.sub??e(`user.unknown`)}),t($,{title:e(`user.organizationRoles`),value:o?.account_roles?.join(`,`)??e(`user.unknown`)}),t($,{title:e(`user.projectRoles`),value:o?.project_roles?.join(`,`)??e(`user.unknown`)})]})},{name:`environment`,label:e(`user.environment`),content:n(`div`,{className:`space-y-1 p-2`,children:[t($,{title:e(`user.tenantId`),value:d}),t($,{title:e(`user.environment`),value:B.type}),t($,{title:e(`user.server`),value:s}),l&&t($,{title:e(`user.store`),value:c}),t($,{title:e(`user.mcpServer`),value:u}),t($,{title:e(`user.appVersion`),value:B.version}),t($,{title:e(`user.sdkVersion`),value:B.sdkVersion||e(`user.unknown`)})]})}];return t(`div`,{className:`w-full`,children:n(te,{defaultValue:`user`,tabs:f,fullWidth:!0,updateHash:!1,children:[t(E,{}),t(D,{})]})})}function In(r){let{user:i,isLoading:a}=R(),[o,s]=l(!1);return a?t(T,{}):i?t(`div`,{className:`px-3`,children:t(Ln,{asMenuTrigger:!0})}):n(e,{children:[t(d,{onClick:()=>s(!0),children:`Sign In`}),t(Pn,{isOpen:o,onClose:()=>s(!1)})]})}function Ln({className:e,asMenuTrigger:r=!1}){let i=R(),a=Pe(),o=Le(),{user:s}=i;if(!i||!s)return null;let c=o.hasPermission(we.project_admin);return n(x,{click:!0,children:[t(C,{children:t(`div`,{className:Re(e,`flex items-center justify-start`,r&&`cursor-pointer`),children:t(u,{size:`sm`,color:`bg-amber-500`,shape:`circle`,name:s?.name})})}),t(S,{align:`start`,className:`w-[280px] mx-2 my-1 p-0`,children:n(`div`,{className:`divide-y divide-gray-200 dark:divide-slate-700`,children:[n(`div`,{className:`py-2 ps-2`,children:[t(`p`,{className:`px-4 dark:text-white mb-1`,children:s?.name??`Unknown`}),t(`p`,{className:`px-4 text-xs text-gray-500`,children:s?.email??``})]}),t(`div`,{className:`w-full p-1`,children:t(Fn,{})}),t(`div`,{className:`py-2 ps-2`,children:t(b,{})}),t(`div`,{className:`py-2`,children:n(h,{children:[c&&t(h.Item,{className:`px-2`,onClick:()=>a(`/settings`,{replace:!0}),children:`Settings`}),t(h.Item,{className:`px-2`,onClick:()=>i.logout(),children:`Sign out`})]})})]})})]})}function Rn(e){return e?e.endsWith(`@vertesiahq.com`)||e.endsWith(`@becomposable.com`)||e.endsWith(`@composableprompts.com`):!1}function zn({icon:e}){let{isLoading:n}=R(),[r,i]=l(!0);return o(()=>{n||i(!1)},[n]),t(ze,{children:r&&t(Be.div,{style:{zIndex:999999,position:`fixed`,inset:0},className:`fixed inset-x-0 inset-y-0`,initial:{opacity:1},exit:{opacity:0},transition:{ease:`easeIn`,duration:.5},children:t(`div`,{style:{display:`flex`,width:`100%`,height:`100%`,alignItems:`center`,justifyContent:`center`},className:`flex w-full h-full items-center justify-center`,children:t(`div`,{className:`animate-[spin_4s_linear_infinite]`,children:t(`div`,{className:`animate-pulse rounded-full bg-transparent`,children:e||t(Bn,{})})})})})})}function Bn(){return n(`svg`,{width:`32`,height:`32`,className:`w-8 h-8 text-indigo-600`,viewBox:`0 0 50 50`,xmlns:`http://www.w3.org/2000/svg`,role:`img`,"aria-label":`Loading`,children:[t(`title`,{children:`Loading`}),t(`defs`,{children:n(`linearGradient`,{id:`spinner-gradient`,x1:`1`,y1:`0`,x2:`0`,y2:`1`,children:[t(`stop`,{offset:`0%`,stopColor:`currentColor`,stopOpacity:`1`}),t(`stop`,{offset:`100%`,stopColor:`currentColor`,stopOpacity:`0`})]})}),t(`circle`,{cx:`25`,cy:`25`,r:`20`,stroke:`url(#spinner-gradient)`,strokeWidth:`5`,fill:`none`,strokeLinecap:`round`})]})}function Vn({children:r,lightLogo:i,darkLogo:a,loadingIcon:o,loadOnboardingStatus:s,preserveSignInPath:c,suppressSignInErrorPrefixes:l,authToken:u,defaultLanguage:d}){let f=t(Fe,{children:t(O,{defaultTheme:`system`,storageKey:`vite-ui-theme`,children:t(he,{defaultLanguage:d,children:n(me,{children:[t(gt,{}),!u&&n(e,{children:[t(zn,{icon:o}),t(xn,{allowedPrefix:`/shared/`,darkLogo:a,lightLogo:i,preservePath:c,suppressAuthErrorPrefix:l})]}),t(Ie,{children:r})]})})})});return t(ne,{children:u?t(ae,{token:u,children:f}):t(I,{loadOnboardingStatus:s,children:f})})}export{V as AppInstallationContext,Ve as AppInstallationProvider,Ue as AppProjectSelector,nt as IFRAME_APP_CONTENT_SLOT,Qe as IFRAME_APP_CONTEXT,H as IFRAME_APP_CONTEXT_REQUEST,U as IFRAME_APP_HOST_ORIGIN_PARAM,et as IFRAME_APP_LOCATION_CHANGE,$e as IFRAME_APP_NAVIGATE,tt as IFRAME_APP_SLOT_PARAM,Xe as IFRAME_AUTH_REQUEST,Ze as IFRAME_AUTH_RESPONSE,gt as IframeAppContextSync,xt as InviteAcceptModal,xn as SigninScreen,_t as StandaloneApp,vt as StandaloneAppImpl,On as TerminalLogin,In as UserSessionMenu,Vn as VertesiaShell,ot as isIframeAppContext,at as isIframeAppContextRequest,ct as isIframeAppLocationChange,st as isIframeAppNavigate,rt as isIframeAuthRequest,it as isIframeAuthResponse,Rn as isVertesiaEmail,mt as requestIframeHostAuthToken,pt as resolveIframeHostOrigin,He as useAppInstallation};
2
2
  //# sourceMappingURL=vertesia-ui-shell.js.map