libre-webui 0.39.0 → 0.40.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (198) hide show
  1. package/backend/dist/persistence/extensionTypes.d.ts +2 -0
  2. package/backend/dist/persistence/extensionTypes.d.ts.map +1 -1
  3. package/backend/dist/persistence/extensionTypes.js.map +1 -1
  4. package/backend/dist/persistence/postgresExtensionRepositories.d.ts.map +1 -1
  5. package/backend/dist/persistence/postgresExtensionRepositories.js +6 -0
  6. package/backend/dist/persistence/postgresExtensionRepositories.js.map +1 -1
  7. package/backend/dist/persistence/sqliteExtensionRepositories.d.ts.map +1 -1
  8. package/backend/dist/persistence/sqliteExtensionRepositories.js +7 -0
  9. package/backend/dist/persistence/sqliteExtensionRepositories.js.map +1 -1
  10. package/backend/dist/routes/email.d.ts.map +1 -1
  11. package/backend/dist/routes/email.js +51 -1
  12. package/backend/dist/routes/email.js.map +1 -1
  13. package/backend/dist/routes/tts.d.ts.map +1 -1
  14. package/backend/dist/routes/tts.js +6 -1
  15. package/backend/dist/routes/tts.js.map +1 -1
  16. package/backend/dist/services/agentCliService.d.ts.map +1 -1
  17. package/backend/dist/services/agentCliService.js +1 -0
  18. package/backend/dist/services/agentCliService.js.map +1 -1
  19. package/backend/dist/services/emailService.d.ts +17 -3
  20. package/backend/dist/services/emailService.d.ts.map +1 -1
  21. package/backend/dist/services/emailService.js +73 -11
  22. package/backend/dist/services/emailService.js.map +1 -1
  23. package/backend/dist/services/pluginCredentialsService.d.ts +3 -0
  24. package/backend/dist/services/pluginCredentialsService.d.ts.map +1 -1
  25. package/backend/dist/services/pluginCredentialsService.js +18 -5
  26. package/backend/dist/services/pluginCredentialsService.js.map +1 -1
  27. package/backend/dist/services/pluginService.d.ts +9 -0
  28. package/backend/dist/services/pluginService.d.ts.map +1 -1
  29. package/backend/dist/services/pluginService.js +31 -14
  30. package/backend/dist/services/pluginService.js.map +1 -1
  31. package/backend/dist/services/workRuntimeService.d.ts +5 -0
  32. package/backend/dist/services/workRuntimeService.d.ts.map +1 -1
  33. package/backend/dist/services/workRuntimeService.js +243 -84
  34. package/backend/dist/services/workRuntimeService.js.map +1 -1
  35. package/backend/dist/utils/emailMarkdown.js +3 -3
  36. package/backend/dist/utils/emailMarkdown.js.map +1 -1
  37. package/backend/dist/utils/pluginDefinitionTrust.d.ts +7 -0
  38. package/backend/dist/utils/pluginDefinitionTrust.d.ts.map +1 -1
  39. package/backend/dist/utils/pluginDefinitionTrust.js +49 -1
  40. package/backend/dist/utils/pluginDefinitionTrust.js.map +1 -1
  41. package/backend/package.json +1 -1
  42. package/frontend/dist/artifact-runtime/.build-fingerprint +1 -1
  43. package/frontend/dist/artifact-runtime/mermaid.js +366 -366
  44. package/frontend/dist/assets/index-DLfU_qNT.js +75 -0
  45. package/frontend/dist/assets/index-DtS3qhdq.css +2 -0
  46. package/frontend/dist/assets/xterm-B1njb2Cr.css +1 -0
  47. package/frontend/dist/index.html +27 -26
  48. package/frontend/dist/js/ArtifactContainer-BjzltfdU.js +1 -0
  49. package/frontend/dist/js/{ArtifactDemoPage-Ddpy2O_v.js → ArtifactDemoPage-DWua6xj9.js} +1 -1
  50. package/frontend/dist/js/{ArtifactSandboxFrame-CdsAqv8H.js → ArtifactSandboxFrame-CR9ghP0A.js} +1 -1
  51. package/frontend/dist/js/ArtifactSlideOutPanel-DX2nL3AS.js +1 -0
  52. package/frontend/dist/js/AutomationModal-DZe-C2jN.js +1 -0
  53. package/frontend/dist/js/AutomationsPage-CrCcnTyk.js +1 -0
  54. package/frontend/dist/js/AvatarUpload-nPS0QHod.js +1 -0
  55. package/frontend/dist/js/Button-Dh2UJA-B.js +1 -0
  56. package/frontend/dist/js/CalendarPage-D2WiWglM.js +1 -0
  57. package/frontend/dist/js/ChannelsPage-COp2T8FQ.js +1 -0
  58. package/frontend/dist/js/ChatPage-CUfAlpdt.js +14 -0
  59. package/frontend/dist/js/ConnectModels-emc3dv4A.js +1 -0
  60. package/frontend/dist/js/EvaluationsPage-CbyeDkz_.js +2 -0
  61. package/frontend/dist/js/FirstTimeSetup-C4ffQRMN.js +1 -0
  62. package/frontend/dist/js/GalleryPage-D4Ci_3dv.js +1 -0
  63. package/frontend/dist/js/HomePage-C3IhEERN.js +1 -0
  64. package/frontend/dist/js/LanguageSwitcher-BQqDJPwm.js +1 -0
  65. package/frontend/dist/js/ModelManagerModals-DhY8Rme6.js +1 -0
  66. package/frontend/dist/js/NotesPage-j812I1BN.js +3 -0
  67. package/frontend/dist/js/PasswordStrengthMeter-BSEtQBJp.js +1 -0
  68. package/frontend/dist/js/PersonasPage--YWoThqF.js +13 -0
  69. package/frontend/dist/js/PluginUsagePage-CZiMdmjI.js +1 -0
  70. package/frontend/dist/js/{RichMessageContent-BfYbVBFz.js → RichMessageContent-BLI0hhzR.js} +2 -2
  71. package/frontend/dist/js/RichMessageContent-BXv5baJ_.js +1 -0
  72. package/frontend/dist/js/SettingsModal-C6aVzSI-.js +19 -0
  73. package/frontend/dist/js/SettingsToggle-CkLLtFbz.js +1 -0
  74. package/frontend/dist/js/ShareDialog-DQskc17d.js +1 -0
  75. package/frontend/dist/js/StrandsPage-DENhVKcz.js +1 -0
  76. package/frontend/dist/js/SystemPage-C86ypXG4.js +1 -0
  77. package/frontend/dist/js/UserManagementPanel-D1CS0KPn.js +1 -0
  78. package/frontend/dist/js/WhatsNewModal-B31A_UQY.js +1 -0
  79. package/frontend/dist/js/WorkPage-DEXBL5J7.js +7 -0
  80. package/frontend/dist/js/api-DRAKhdz7.js +1 -0
  81. package/frontend/dist/js/{api-BrHW-VGd.js → api-Dcz1G4Ib.js} +4 -2
  82. package/frontend/dist/js/{appNavigation-B6xYIgLi.js → appNavigation-C5A9BF_G.js} +1 -1
  83. package/frontend/dist/js/appStore-0_qlwS8f.js +2 -0
  84. package/frontend/dist/js/appVersion-D5lk_2zb.js +1 -0
  85. package/frontend/dist/js/ar-BZntyucf.js +2 -0
  86. package/frontend/dist/js/authStore-C4dzH1NY.js +1 -0
  87. package/frontend/dist/js/{authStore-DjAsRpNL.js → authStore-COgKeTRv.js} +3 -3
  88. package/frontend/dist/js/bn-BDCaFQu-.js +2 -0
  89. package/frontend/dist/js/chatStore-CVTbkZyb.js +3 -0
  90. package/frontend/dist/js/{client-DppLngAs.js → client-jaxZzn-I.js} +2 -2
  91. package/frontend/dist/js/{composerStyles-C83jssgZ.js → composerStyles-BEx0XAp6.js} +1 -1
  92. package/frontend/dist/js/{config-4_s8hdqO.js → config-Da1yh9sC.js} +1 -1
  93. package/frontend/dist/js/confirmStore-CKkUtP9c.js +1 -0
  94. package/frontend/dist/js/cs-BCmN--jQ.js +2 -0
  95. package/frontend/dist/js/da-B895dAyV.js +2 -0
  96. package/frontend/dist/js/de-B0ZhC0dm.js +2 -0
  97. package/frontend/dist/js/es-D7eaw4_W.js +2 -0
  98. package/frontend/dist/js/{evaluationsApi-DyuW7IJ_.js → evaluationsApi-BwaxBVpl.js} +1 -1
  99. package/frontend/dist/js/fr-DsB0gLW4.js +2 -0
  100. package/frontend/dist/js/hi-CLeU3ung.js +2 -0
  101. package/frontend/dist/js/id-Cdq6tOTi.js +2 -0
  102. package/frontend/dist/js/is-DJ1tHaAT.js +2 -0
  103. package/frontend/dist/js/it-9K1R4CeT.js +2 -0
  104. package/frontend/dist/js/ja-BYP_3M5M.js +2 -0
  105. package/frontend/dist/js/ko-CNtjlaDm.js +2 -0
  106. package/frontend/dist/js/liveAnnouncerStore-B6mS-JWC.js +1 -0
  107. package/frontend/dist/js/messageCodeStyles-D3cWF9XO.js +2 -0
  108. package/frontend/dist/js/ms-A_IVO_qt.js +2 -0
  109. package/frontend/dist/js/nl-CrKWO3ea.js +2 -0
  110. package/frontend/dist/js/pl-BrpSuyDP.js +2 -0
  111. package/frontend/dist/js/pt-BHbpB5BM.js +2 -0
  112. package/frontend/dist/js/ru-DzLsS9zY.js +2 -0
  113. package/frontend/dist/js/{strandsApi-BFbeEpAY.js → strandsApi-COxSPh_5.js} +1 -1
  114. package/frontend/dist/js/sv-VU2CjzNj.js +2 -0
  115. package/frontend/dist/js/{teamEventStream-DsAS6P4m.js → teamEventStream-RNJYm84u.js} +1 -1
  116. package/frontend/dist/js/th-DV2hNXXc.js +2 -0
  117. package/frontend/dist/js/tr-DvVZ9jxF.js +2 -0
  118. package/frontend/dist/js/ui-CI0OdG9q.js +2 -0
  119. package/frontend/dist/js/ui-vendor-6S05F84J.js +1 -0
  120. package/frontend/dist/js/uk-MFFDRo2m.js +2 -0
  121. package/frontend/dist/js/useChat-BSkqxHnH.js +13 -0
  122. package/frontend/dist/js/useDictation-D9whH12W.js +1 -0
  123. package/frontend/dist/js/vi-CfZ-U8Cw.js +2 -0
  124. package/frontend/dist/js/{work-CdbmBok5.js → work-C7MYlv5S.js} +1 -1
  125. package/frontend/dist/js/{workModels-BM2Zyiba.js → workAnnouncements-CAsI8P7c.js} +1 -1
  126. package/frontend/dist/js/workApi-BJfbaV6k.js +1 -0
  127. package/frontend/dist/js/{workApi-UPxumrEF.js → workApi-Ck8nTlJn.js} +1 -1
  128. package/frontend/dist/js/zh-CTl_raYa.js +2 -0
  129. package/package.json +3 -2
  130. package/plugins/codex-oauth.json +1 -0
  131. package/frontend/dist/assets/index-D99DS5c6.js +0 -57
  132. package/frontend/dist/assets/index-Dz1JufgZ.css +0 -1
  133. package/frontend/dist/assets/xterm-B8QFf3JU.css +0 -1
  134. package/frontend/dist/js/ArtifactContainer-Cn7X9HGm.js +0 -1
  135. package/frontend/dist/js/ArtifactSlideOutPanel-cVd9X80o.js +0 -1
  136. package/frontend/dist/js/AutomationModal-B4UaWjkk.js +0 -1
  137. package/frontend/dist/js/AutomationsPage-huCrvLUp.js +0 -1
  138. package/frontend/dist/js/AvatarUpload-CG-w6Mpt.js +0 -1
  139. package/frontend/dist/js/Button-j68Q8KVh.js +0 -1
  140. package/frontend/dist/js/CalendarPage-CZXT1w99.js +0 -1
  141. package/frontend/dist/js/ChannelsPage-DbtdHnSL.js +0 -1
  142. package/frontend/dist/js/ChatPage-BZE65kiq.js +0 -14
  143. package/frontend/dist/js/ConnectModels-DD4bLgdq.js +0 -1
  144. package/frontend/dist/js/EvaluationsPage-Dq53LaXd.js +0 -2
  145. package/frontend/dist/js/FirstTimeSetup-BoJIfuQT.js +0 -1
  146. package/frontend/dist/js/GalleryPage-DKwqeB2A.js +0 -1
  147. package/frontend/dist/js/HomePage-C8bCJfls.js +0 -1
  148. package/frontend/dist/js/LanguageSwitcher-B_YyU5JG.js +0 -1
  149. package/frontend/dist/js/ModelManagerModals-BzjZ-QwL.js +0 -1
  150. package/frontend/dist/js/NotesPage-CnaAp_w_.js +0 -3
  151. package/frontend/dist/js/PasswordStrengthMeter-DI4RDv67.js +0 -1
  152. package/frontend/dist/js/PersonasPage-CH3GUKph.js +0 -13
  153. package/frontend/dist/js/PluginUsagePage-d54K2gAj.js +0 -1
  154. package/frontend/dist/js/RichMessageContent-CDxxs3Tt.js +0 -1
  155. package/frontend/dist/js/SettingsModal-BvtJcvow.js +0 -19
  156. package/frontend/dist/js/SettingsToggle-DrJ0Bapi.js +0 -1
  157. package/frontend/dist/js/ShareDialog-DaSxkTKS.js +0 -1
  158. package/frontend/dist/js/StrandsPage-BQwz0mWq.js +0 -1
  159. package/frontend/dist/js/SystemPage-BqNZoFxR.js +0 -1
  160. package/frontend/dist/js/UserManagementPanel-C3T1ReJJ.js +0 -1
  161. package/frontend/dist/js/WhatsNewModal-CLcU2Ugk.js +0 -1
  162. package/frontend/dist/js/WorkPage-BpjGn--1.js +0 -8
  163. package/frontend/dist/js/api-K_hhqPdx.js +0 -1
  164. package/frontend/dist/js/appStore-DkRdQQeY.js +0 -2
  165. package/frontend/dist/js/appVersion-BVtSqLVj.js +0 -1
  166. package/frontend/dist/js/ar-XTZGEtBr.js +0 -2
  167. package/frontend/dist/js/authStore-DBS6Kbvh.js +0 -1
  168. package/frontend/dist/js/bn-JiK7ZWmy.js +0 -2
  169. package/frontend/dist/js/chatStore-DpVxt9VX.js +0 -3
  170. package/frontend/dist/js/cs-D8ju18CO.js +0 -2
  171. package/frontend/dist/js/da-BJWcAoUc.js +0 -2
  172. package/frontend/dist/js/de-CLJLmy69.js +0 -2
  173. package/frontend/dist/js/es-BvqHEL-3.js +0 -2
  174. package/frontend/dist/js/fr-B8ZoZomI.js +0 -2
  175. package/frontend/dist/js/goober.modern-BaHbaW3_.js +0 -1
  176. package/frontend/dist/js/hi-AzJLALo-.js +0 -2
  177. package/frontend/dist/js/id-DZYGQhvC.js +0 -2
  178. package/frontend/dist/js/is-Da_kvtzW.js +0 -2
  179. package/frontend/dist/js/it-B90zSlqn.js +0 -2
  180. package/frontend/dist/js/ja-DU_K1GOr.js +0 -2
  181. package/frontend/dist/js/ko-DicfoO-e.js +0 -2
  182. package/frontend/dist/js/messageCodeStyles-CuQPkfEK.js +0 -2
  183. package/frontend/dist/js/ms-CfH7wjUY.js +0 -2
  184. package/frontend/dist/js/nl-ELlOz-B3.js +0 -2
  185. package/frontend/dist/js/pl-33dayyUk.js +0 -2
  186. package/frontend/dist/js/pt-aIXSQPCT.js +0 -2
  187. package/frontend/dist/js/ru-BSvGtBtW.js +0 -2
  188. package/frontend/dist/js/sv-B7KOz81W.js +0 -2
  189. package/frontend/dist/js/th-DgpjGxvA.js +0 -2
  190. package/frontend/dist/js/tr-BQTbl2h-.js +0 -2
  191. package/frontend/dist/js/ui-Aq8MP7Ph.js +0 -2
  192. package/frontend/dist/js/ui-vendor-DVTj_sKN.js +0 -1
  193. package/frontend/dist/js/uk-JLymloot.js +0 -2
  194. package/frontend/dist/js/useChat-D3ZAGz70.js +0 -10
  195. package/frontend/dist/js/useDictation-B6l8QzeM.js +0 -1
  196. package/frontend/dist/js/vi-BXdLOJ8q.js +0 -2
  197. package/frontend/dist/js/workApi-D1xtiG3Q.js +0 -1
  198. package/frontend/dist/js/zh-gdUf9sXa.js +0 -2
@@ -0,0 +1 @@
1
+ .xterm{cursor:text;-webkit-user-select:none;user-select:none;position:relative}.xterm.focus,.xterm:focus{outline:none}.xterm .xterm-helpers{z-index:5;position:absolute;top:0}.xterm .xterm-helper-textarea{opacity:0;z-index:-5;white-space:nowrap;resize:none;border:0;width:0;height:0;margin:0;padding:0;position:absolute;top:0;left:-9999em;overflow:hidden}.xterm .composition-view{color:#fff;white-space:nowrap;z-index:1;background:#000;display:none;position:absolute}.xterm .composition-view.active{display:block}.xterm .xterm-viewport{cursor:default;background-color:#000;position:absolute;inset:0;overflow-y:scroll}.xterm .xterm-screen{position:relative}.xterm .xterm-screen canvas{position:absolute;top:0;left:0}.xterm-char-measure-element{visibility:hidden;line-height:normal;display:inline-block;position:absolute;top:0;left:-9999em}.xterm.enable-mouse-events{cursor:default}.xterm.xterm-cursor-pointer,.xterm .xterm-cursor-pointer{cursor:pointer}.xterm.column-select.focus{cursor:crosshair}.xterm .xterm-accessibility:not(.debug),.xterm .xterm-message{z-index:10;color:#0000;pointer-events:none;position:absolute;inset:0}.xterm .xterm-accessibility-tree:not(.debug) ::selection{color:#0000}.xterm .xterm-accessibility-tree{-webkit-user-select:text;user-select:text;white-space:pre;font-family:monospace}.xterm .xterm-accessibility-tree>div{transform-origin:0;width:-moz-fit-content;width:fit-content}.xterm .live-region{width:1px;height:1px;position:absolute;left:-9999px;overflow:hidden}.xterm-dim{opacity:1!important}.xterm-underline-1{text-decoration:underline}.xterm-underline-2{-webkit-text-decoration:underline double;text-decoration:underline double}.xterm-underline-3{-webkit-text-decoration:underline wavy;text-decoration:underline wavy}.xterm-underline-4{-webkit-text-decoration:underline dotted;text-decoration:underline dotted}.xterm-underline-5{-webkit-text-decoration:underline dashed;text-decoration:underline dashed}.xterm-overline{text-decoration:overline}.xterm-overline.xterm-underline-1{text-decoration:underline overline}.xterm-overline.xterm-underline-2{-webkit-text-decoration:overline double underline;text-decoration:overline double underline}.xterm-overline.xterm-underline-3{-webkit-text-decoration:overline wavy underline;text-decoration:overline wavy underline}.xterm-overline.xterm-underline-4{-webkit-text-decoration:overline dotted underline;text-decoration:overline dotted underline}.xterm-overline.xterm-underline-5{-webkit-text-decoration:overline dashed underline;text-decoration:overline dashed underline}.xterm-strikethrough{text-decoration:line-through}.xterm-screen .xterm-decoration-container .xterm-decoration{z-index:6;position:absolute}.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer{z-index:7}.xterm-decoration-overview-ruler{z-index:8;pointer-events:none;position:absolute;top:0;right:0}.xterm-decoration-top{z-index:2;position:relative}.xterm .xterm-scrollable-element>.scrollbar{cursor:default}.xterm .xterm-scrollable-element>.scrollbar>.scra{cursor:pointer;font-size:11px!important}.xterm .xterm-scrollable-element>.visible{opacity:1;z-index:11;background:0 0;transition:opacity .1s linear}.xterm .xterm-scrollable-element>.invisible{opacity:0;pointer-events:none}.xterm .xterm-scrollable-element>.invisible.fade{transition:opacity .8s linear}.xterm .xterm-scrollable-element>.shadow{display:none;position:absolute}.xterm .xterm-scrollable-element>.shadow.top{width:100%;height:3px;box-shadow:var(--vscode-scrollbar-shadow,#000) 0 6px 6px -6px inset;display:block;top:0;left:3px}.xterm .xterm-scrollable-element>.shadow.left{width:3px;height:100%;box-shadow:var(--vscode-scrollbar-shadow,#000) 6px 0 6px -6px inset;display:block;top:3px;left:0}.xterm .xterm-scrollable-element>.shadow.top-left-corner{width:3px;height:3px;display:block;top:0;left:0}.xterm .xterm-scrollable-element>.shadow.top.left{box-shadow:var(--vscode-scrollbar-shadow,#000) 6px 0 6px -6px inset}
@@ -89,7 +89,7 @@
89
89
  name="twitter:image:alt"
90
90
  content="Libre WebUI icon over a retro-futuristic cityscape"
91
91
  />
92
- <script type="module" crossorigin src="/assets/index-D99DS5c6.js"></script>
92
+ <script type="module" crossorigin src="/assets/index-DLfU_qNT.js"></script>
93
93
  <link rel="modulepreload" crossorigin href="/js/rolldown-runtime-hePW80VL.js">
94
94
  <link rel="modulepreload" crossorigin href="/js/react-vendor-CR5VJ85Q.js">
95
95
  <link rel="modulepreload" crossorigin href="/js/useQuery-BTKpXudI.js">
@@ -97,38 +97,39 @@
97
97
  <link rel="modulepreload" crossorigin href="/js/router-vendor-DqMnEJWK.js">
98
98
  <link rel="modulepreload" crossorigin href="/js/utils-vendor-DPJG-EG_.js">
99
99
  <link rel="modulepreload" crossorigin href="/js/utils-B-Bhh1pF.js">
100
- <link rel="modulepreload" crossorigin href="/js/goober.modern-BaHbaW3_.js">
101
- <link rel="modulepreload" crossorigin href="/js/ui-vendor-DVTj_sKN.js">
102
- <link rel="modulepreload" crossorigin href="/js/config-4_s8hdqO.js">
103
- <link rel="modulepreload" crossorigin href="/js/client-DppLngAs.js">
104
- <link rel="modulepreload" crossorigin href="/js/strandsApi-BFbeEpAY.js">
105
- <link rel="modulepreload" crossorigin href="/js/workApi-UPxumrEF.js">
106
- <link rel="modulepreload" crossorigin href="/js/api-BrHW-VGd.js">
107
- <link rel="modulepreload" crossorigin href="/js/chatStore-DpVxt9VX.js">
100
+ <link rel="modulepreload" crossorigin href="/js/appStore-0_qlwS8f.js">
101
+ <link rel="modulepreload" crossorigin href="/js/ui-vendor-6S05F84J.js">
102
+ <link rel="modulepreload" crossorigin href="/js/config-Da1yh9sC.js">
103
+ <link rel="modulepreload" crossorigin href="/js/client-jaxZzn-I.js">
104
+ <link rel="modulepreload" crossorigin href="/js/strandsApi-COxSPh_5.js">
105
+ <link rel="modulepreload" crossorigin href="/js/workApi-Ck8nTlJn.js">
106
+ <link rel="modulepreload" crossorigin href="/js/api-Dcz1G4Ib.js">
107
+ <link rel="modulepreload" crossorigin href="/js/chatStore-CVTbkZyb.js">
108
108
  <link rel="modulepreload" crossorigin href="/js/useTranslation-Boi0fB1B.js">
109
- <link rel="modulepreload" crossorigin href="/js/Button-j68Q8KVh.js">
110
- <link rel="modulepreload" crossorigin href="/js/appStore-DkRdQQeY.js">
111
- <link rel="modulepreload" crossorigin href="/js/authStore-DjAsRpNL.js">
112
- <link rel="modulepreload" crossorigin href="/js/welcomePrompts-to5mv_gx.js">
113
- <link rel="modulepreload" crossorigin href="/js/messageCodeStyles-CuQPkfEK.js">
109
+ <link rel="modulepreload" crossorigin href="/js/Button-Dh2UJA-B.js">
114
110
  <link rel="modulepreload" crossorigin href="/js/useDialogFocus-zSGHkpE4.js">
115
- <link rel="modulepreload" crossorigin href="/js/ui-Aq8MP7Ph.js">
116
- <link rel="modulepreload" crossorigin href="/js/AvatarUpload-CG-w6Mpt.js">
111
+ <link rel="modulepreload" crossorigin href="/js/messageCodeStyles-D3cWF9XO.js">
112
+ <link rel="modulepreload" crossorigin href="/js/ui-CI0OdG9q.js">
113
+ <link rel="modulepreload" crossorigin href="/js/confirmStore-CKkUtP9c.js">
114
+ <link rel="modulepreload" crossorigin href="/js/liveAnnouncerStore-B6mS-JWC.js">
115
+ <link rel="modulepreload" crossorigin href="/js/authStore-COgKeTRv.js">
116
+ <link rel="modulepreload" crossorigin href="/js/welcomePrompts-to5mv_gx.js">
117
+ <link rel="modulepreload" crossorigin href="/js/AvatarUpload-nPS0QHod.js">
117
118
  <link rel="modulepreload" crossorigin href="/js/Logo-DnfVtjgj.js">
118
119
  <link rel="modulepreload" crossorigin href="/js/LogoMark-BzObGdA9.js">
119
- <link rel="modulepreload" crossorigin href="/js/ShareDialog-DaSxkTKS.js">
120
- <link rel="modulepreload" crossorigin href="/js/teamEventStream-DsAS6P4m.js">
121
- <link rel="modulepreload" crossorigin href="/js/work-CdbmBok5.js">
122
- <link rel="modulepreload" crossorigin href="/js/workModels-BM2Zyiba.js">
120
+ <link rel="modulepreload" crossorigin href="/js/ShareDialog-DQskc17d.js">
121
+ <link rel="modulepreload" crossorigin href="/js/teamEventStream-RNJYm84u.js">
122
+ <link rel="modulepreload" crossorigin href="/js/work-C7MYlv5S.js">
123
+ <link rel="modulepreload" crossorigin href="/js/workAnnouncements-CAsI8P7c.js">
123
124
  <link rel="modulepreload" crossorigin href="/js/artifactHtml-DDmfpcB0.js">
124
- <link rel="modulepreload" crossorigin href="/js/useChat-D3ZAGz70.js">
125
- <link rel="modulepreload" crossorigin href="/js/LanguageSwitcher-B_YyU5JG.js">
126
- <link rel="modulepreload" crossorigin href="/js/appNavigation-B6xYIgLi.js">
125
+ <link rel="modulepreload" crossorigin href="/js/useChat-BSkqxHnH.js">
126
+ <link rel="modulepreload" crossorigin href="/js/LanguageSwitcher-BQqDJPwm.js">
127
+ <link rel="modulepreload" crossorigin href="/js/appNavigation-C5A9BF_G.js">
127
128
  <link rel="modulepreload" crossorigin href="/js/ttsBatching-kFVEE3Ip.js">
128
129
  <link rel="modulepreload" crossorigin href="/js/TurnstileWidget-tI50c7Kc.js">
129
- <link rel="modulepreload" crossorigin href="/js/PasswordStrengthMeter-DI4RDv67.js">
130
- <link rel="modulepreload" crossorigin href="/js/appVersion-BVtSqLVj.js">
131
- <link rel="stylesheet" crossorigin href="/assets/index-Dz1JufgZ.css">
130
+ <link rel="modulepreload" crossorigin href="/js/PasswordStrengthMeter-BSEtQBJp.js">
131
+ <link rel="modulepreload" crossorigin href="/js/appVersion-D5lk_2zb.js">
132
+ <link rel="stylesheet" crossorigin href="/assets/index-DtS3qhdq.css">
132
133
  </head>
133
134
  <body>
134
135
  <div id="root"></div>
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-vendor-CR5VJ85Q.js";import{t as r}from"./logger-BR4forr_.js";import{t as i}from"./useTranslation-Boi0fB1B.js";import{t as a}from"./utils-B-Bhh1pF.js";import{t as o}from"./appStore-0_qlwS8f.js";import{An as s,Ln as c,Mt as l,Nn as u,Rn as d,Tn as f,er as p,g as m,rn as h,yn as g}from"./ui-vendor-6S05F84J.js";import{t as _}from"./Button-Dh2UJA-B.js";import{i as v,r as y}from"./artifactHtml-DDmfpcB0.js";import{t as b}from"./OptimizedSyntaxHighlighter-B0g8cxZQ.js";import{t as x}from"./ArtifactSandboxFrame-CR9ghP0A.js";var S=e(t(),1),C=n(),w=r(`components:artifact-renderer`),T=({artifact:e,className:t})=>{let{t:n}=i(),[r,T]=(0,S.useState)(!1),[E,D]=(0,S.useState)(`preview`),{theme:O,openArtifactPanel:k,artifactPanelOpen:A,artifactPanelArtifact:j}=o(),M=async e=>{try{await navigator.clipboard.writeText(e),T(!0),setTimeout(()=>T(!1),2e3)}catch(e){w.error(`Failed to copy:`,e)}},N=()=>{let t=e.type===`html`?y(e.content,e.title):e.content,n=new Blob([t],{type:P(e.type)}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`${e.title}.${F(e.type)}`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(r)},P=e=>{switch(e){case`html`:return`text/html`;case`react`:return`text/javascript`;case`svg`:return`image/svg+xml`;case`css`:return`text/css`;case`json`:return`application/json`;default:return`text/plain`}},F=e=>{switch(e){case`html`:return`html`;case`react`:return`jsx`;case`svg`:return`svg`;case`css`:return`css`;case`json`:return`json`;default:return`txt`}},I=()=>{switch(e.type){case`html`:return(0,C.jsx)(h,{className:`h-4 w-4`});case`react`:return(0,C.jsx)(c,{className:`h-4 w-4`});case`svg`:return(0,C.jsx)(g,{className:`h-4 w-4`});case`code`:return(0,C.jsx)(c,{className:`h-4 w-4`});default:return(0,C.jsx)(g,{className:`h-4 w-4`})}},L=()=>(0,C.jsx)(`div`,{"data-testid":`artifact-html-fallback`,className:`w-full h-64 sm:h-80 lg:h-96 flex items-center justify-center bg-gray-50 dark:bg-dark-100 rounded-lg border border-gray-200 dark:border-dark-200 p-4`,children:(0,C.jsxs)(`div`,{className:`max-w-sm text-center`,children:[(0,C.jsx)(m,{className:`h-8 w-8 text-primary-500 mx-auto mb-3`}),(0,C.jsx)(`p`,{className:`text-sm font-medium text-gray-900 dark:text-gray-100`,children:n(`artifacts.previewUnavailable`)}),(0,C.jsx)(`p`,{className:`mt-1 text-sm text-gray-600 dark:text-gray-400`,children:n(`artifacts.previewUnavailableDescription`)}),(0,C.jsxs)(_,{variant:`outline`,size:`sm`,onClick:()=>D(`code`),className:`mt-4`,children:[(0,C.jsx)(d,{className:`h-3.5 w-3.5 mr-1.5`}),n(`artifacts.code`)]})]})}),R=t=>e.content.trim()?(0,C.jsx)(x,{content:e.content,title:e.title,kind:t,colorScheme:O.mode===`light`?`light`:`dark`,className:`w-full h-64 sm:h-80 lg:h-96 border-0 rounded-lg`,fallback:L()}):L(),z=()=>(0,C.jsx)(`iframe`,{"data-testid":`artifact-svg-preview`,srcDoc:v(e.content,e.title),className:`w-full h-64 sm:h-80 lg:h-96 border-0 rounded-lg bg-white`,sandbox:``,title:e.title}),B=()=>(0,C.jsx)(`div`,{className:`relative max-h-64 sm:max-h-80 lg:max-h-96 overflow-auto`,children:(0,C.jsx)(b,{language:(()=>{if(e.language)return e.language;switch(e.type){case`html`:return`html`;case`react`:return`jsx`;case`svg`:return`xml`;case`json`:return`json`;default:return`text`}})(),isDark:O.mode!==`light`,className:`m-0! rounded-lg!`,codeTheme:`night`,showLineNumbers:!0,backgroundColor:O.mode===`light`?void 0:`rgb(var(--color-dark-50))`,children:e.content})}),V=()=>{try{let t=JSON.parse(e.content),n=JSON.stringify(t,null,2);return(0,C.jsx)(`div`,{className:`relative max-h-64 sm:max-h-80 lg:max-h-96 overflow-auto`,children:(0,C.jsx)(b,{language:`json`,isDark:O.mode!==`light`,className:`m-0! rounded-lg!`,codeTheme:`night`,showLineNumbers:!0,backgroundColor:O.mode===`light`?void 0:`rgb(var(--color-dark-50))`,children:n})})}catch{return(0,C.jsx)(`div`,{className:`w-full h-32 flex items-center justify-center bg-gray-50 dark:bg-dark-100 rounded-lg border border-gray-200 dark:border-dark-200`,children:(0,C.jsxs)(`div`,{className:`text-center`,children:[(0,C.jsx)(m,{className:`h-8 w-8 text-primary-500 mx-auto mb-2`}),(0,C.jsx)(`p`,{className:`text-sm text-gray-600 dark:text-dark-600`,children:n(`artifacts.invalidJson`)})]})})}},H=()=>{if(E===`code`)return B();switch(e.type){case`html`:return R(`html`);case`react`:return R(`react`);case`mermaid`:return R(`mermaid`);case`svg`:return z();case`json`:return V();default:return B()}},U=()=>e.type===`html`||e.type===`svg`||e.type===`react`||e.type===`mermaid`;return A&&j!==null&&j.title.trim().toLowerCase()===e.title.trim().toLowerCase()?(0,C.jsxs)(`button`,{type:`button`,"data-testid":`artifact-collapsed-card`,onClick:()=>k(e),title:n(`artifacts.openInPanel`),className:a(`flex w-full max-w-full items-center gap-3 rounded-xl border border-gray-200 bg-white px-4 py-3 text-start shadow-xs transition-colors animate-fade-in`,`hover:bg-gray-50 dark:border-dark-200 dark:bg-dark-25 dark:hover:bg-dark-100`,t),children:[(0,C.jsx)(`div`,{className:`shrink-0 text-gray-600 dark:text-gray-400`,children:I()}),(0,C.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium text-gray-900 dark:text-gray-100`,children:e.title}),(0,C.jsx)(`span`,{className:`shrink-0 rounded-full bg-primary-50 px-2 py-1 text-xs font-medium text-primary-700 dark:bg-primary-900/20 dark:text-primary-300`,children:e.type.toUpperCase()}),(0,C.jsx)(l,{className:`h-4 w-4 shrink-0 text-gray-400 dark:text-dark-500`})]}):(0,C.jsxs)(`div`,{className:a(`border border-gray-200 dark:border-dark-200 rounded-xl bg-white dark:bg-dark-25 shadow-lg transition-all duration-300 hover:shadow-xl`,`w-full max-w-full overflow-hidden animate-fade-in`,`max-h-[400px] flex flex-col`,t),children:[(0,C.jsxs)(`div`,{className:`px-1.5 py-1.5 sm:p-4 border-b border-gray-100 dark:border-dark-200 shrink-0`,children:[(0,C.jsxs)(`div`,{className:`flex flex-col gap-2 sm:hidden`,children:[(0,C.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,C.jsx)(`div`,{className:`h-4 w-4 shrink-0 flex items-center justify-center`,children:I()}),(0,C.jsx)(`h3`,{className:`font-medium text-gray-900 dark:text-gray-100 truncate text-sm leading-tight flex-1`,children:e.title})]}),(0,C.jsxs)(`div`,{className:`flex items-center justify-end gap-0.5`,children:[U()&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(_,{variant:E===`preview`?`primary`:`ghost`,size:`sm`,onClick:()=>D(`preview`),className:`h-5 px-0.5 text-xs`,title:n(`artifacts.previewMode`),children:(0,C.jsx)(f,{className:`h-2.5 w-2.5`})}),(0,C.jsx)(_,{variant:E===`code`?`primary`:`ghost`,size:`sm`,onClick:()=>D(`code`),className:`h-5 px-0.5 text-xs`,title:n(`artifacts.codeMode`),children:(0,C.jsx)(d,{className:`h-2.5 w-2.5`})}),(0,C.jsx)(`div`,{className:`w-px h-2 bg-gray-300 dark:bg-gray-600 mx-0.5`})]}),(0,C.jsx)(_,{variant:`ghost`,size:`sm`,onClick:()=>M(e.content),className:`h-5 w-5 p-0 hover:bg-gray-100 dark:hover:bg-dark-200 touch-manipulation`,title:n(`artifacts.copyContent`),children:r?(0,C.jsx)(p,{className:`h-2.5 w-2.5 text-green-500`}):(0,C.jsx)(u,{className:`h-2.5 w-2.5`})}),(0,C.jsx)(_,{variant:`ghost`,size:`sm`,onClick:N,className:`h-5 w-5 p-0 hover:bg-gray-100 dark:hover:bg-dark-200 touch-manipulation`,title:n(`artifacts.download`),children:(0,C.jsx)(s,{className:`h-2.5 w-2.5`})}),(0,C.jsx)(_,{variant:`ghost`,size:`sm`,onClick:()=>k(e),className:`h-5 w-5 p-0 hover:bg-gray-100 dark:hover:bg-dark-200 touch-manipulation border border-gray-200 dark:border-dark-300 hover:border-gray-300 dark:hover:border-dark-400`,title:n(`artifacts.openInPanel`),children:(0,C.jsx)(l,{className:`h-2.5 w-2.5`})})]})]}),(0,C.jsxs)(`div`,{className:`hidden sm:flex items-center justify-between gap-2`,children:[(0,C.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0 flex-1`,children:[(0,C.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0 flex-1`,children:[(0,C.jsx)(`div`,{className:`shrink-0`,children:I()}),(0,C.jsx)(`h3`,{className:`font-semibold text-gray-900 dark:text-gray-100 truncate`,children:e.title})]}),(0,C.jsx)(`span`,{className:`text-xs bg-primary-50 dark:bg-primary-900/20 text-primary-700 dark:text-primary-300 px-2 py-1 rounded-full font-medium shrink-0`,children:e.type.toUpperCase()})]}),(0,C.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[U()&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(_,{variant:E===`preview`?`primary`:`ghost`,size:`sm`,onClick:()=>D(`preview`),className:`h-8 px-3 text-xs`,title:n(`artifacts.previewMode`),children:[(0,C.jsx)(f,{className:`h-3 w-3 mr-1`}),n(`artifacts.preview`)]}),(0,C.jsxs)(_,{variant:E===`code`?`primary`:`ghost`,size:`sm`,onClick:()=>D(`code`),className:`h-8 px-3 text-xs`,title:n(`artifacts.codeMode`),children:[(0,C.jsx)(d,{className:`h-3 w-3 mr-1`}),n(`artifacts.code`)]}),(0,C.jsx)(`div`,{className:`w-px h-4 bg-gray-300 dark:bg-gray-600 mx-1`})]}),(0,C.jsx)(_,{variant:`ghost`,size:`sm`,onClick:()=>M(e.content),className:`h-8 w-8 p-0 hover:bg-gray-100 dark:hover:bg-dark-200`,title:n(`artifacts.copyContent`),children:r?(0,C.jsx)(p,{className:`h-4 w-4 text-green-500`}):(0,C.jsx)(u,{className:`h-4 w-4`})}),(0,C.jsx)(_,{variant:`ghost`,size:`sm`,onClick:N,className:`h-8 w-8 p-0 hover:bg-gray-100 dark:hover:bg-dark-200`,title:n(`artifacts.download`),children:(0,C.jsx)(s,{className:`h-4 w-4`})}),(0,C.jsx)(_,{variant:`ghost`,size:`sm`,onClick:()=>k(e),className:`h-8 w-8 p-0 hover:bg-gray-100 dark:hover:bg-dark-200`,title:n(`artifacts.openInPanel`),children:(0,C.jsx)(l,{className:`h-4 w-4`})})]})]})]}),(0,C.jsxs)(`div`,{className:`p-4 flex-1 overflow-hidden min-h-0`,children:[e.description&&(0,C.jsx)(`p`,{className:`text-sm text-gray-600 dark:text-gray-400 mb-4`,children:e.description}),(0,C.jsx)(`div`,{className:`h-full overflow-auto`,children:H()})]}),(0,C.jsx)(`div`,{className:`flex items-center justify-between p-3 border-t border-gray-100 dark:border-dark-200 bg-gray-50 dark:bg-dark-100/50 shrink-0`,children:(0,C.jsxs)(`div`,{className:`text-xs text-gray-500 dark:text-gray-400`,children:[n(`artifacts.created`),`:`,` `,new Date(e.createdAt).toLocaleString()]})})]})},E=({artifacts:e,className:t})=>!e||e.length===0?null:(0,C.jsx)(`div`,{className:a(`space-y-3`,t),children:e.map(e=>(0,C.jsx)(T,{artifact:e},e.id))});export{E as t};
@@ -1,4 +1,4 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-vendor-CR5VJ85Q.js";import{t as r}from"./Button-j68Q8KVh.js";import{o as i}from"./ui-Aq8MP7Ph.js";import{t as a}from"./ArtifactContainer-Cn7X9HGm.js";var o=e(t(),1),s=n(),c=[{id:`demo-html-1`,type:`html`,title:`Interactive Button Demo`,description:`A simple HTML page with interactive elements`,content:`<div style="text-align: center; padding: 20px;">
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-vendor-CR5VJ85Q.js";import{t as r}from"./Button-Dh2UJA-B.js";import{s as i}from"./ui-CI0OdG9q.js";import{t as a}from"./ArtifactContainer-BjzltfdU.js";var o=e(t(),1),s=n(),c=[{id:`demo-html-1`,type:`html`,title:`Interactive Button Demo`,description:`A simple HTML page with interactive elements`,content:`<div style="text-align: center; padding: 20px;">
2
2
  <h1 style="color: #333; font-family: Arial, sans-serif;">Welcome to Libre WebUI!</h1>
3
3
  <p style="color: #666; font-size: 16px;">This is an interactive HTML artifact.</p>
4
4
  <button
@@ -1,4 +1,4 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-vendor-CR5VJ85Q.js";import{t as r}from"./logger-BR4forr_.js";import{t as i}from"./config-4_s8hdqO.js";import{a,l as o,n as s,o as c,r as l,t as u}from"./artifactHtml-DDmfpcB0.js";var d=e(t(),1),f=`${i.replace(/\/+$/,``)}/artifacts/sandbox`,p=window.location.protocol===`file:`?new URL(f).origin:window.location.origin,m=`/artifact-runtime`,h=`runtime`,g=`react`,_=`babel`,v=`tailwind`,y=`fonts`,b={react:g,"react-dom":g,"react-dom/client":g,"react/jsx-runtime":g,"react/jsx-dev-runtime":g,recharts:`recharts`,"lucide-react":`lucide-react`,d3:`d3`,three:`three`,papaparse:`papaparse`,lodash:`lodash`,"lodash-es":`lodash`,mermaid:`mermaid`,"chart.js":`chart`,"chart.js/auto":`chart`,tone:`tone`,mathjs:`mathjs`,"plotly.js":`plotly`,"plotly.js-dist-min":`plotly`,"framer-motion":`framer-motion`,"motion/react":`framer-motion`,motion:`framer-motion`,"three/addons/controls/OrbitControls.js":`three`,"three/examples/jsm/controls/OrbitControls.js":`three`},x=[h,g,_,v],S=[h,`mermaid`],C=[{pattern:/cdn\.tailwindcss\.com/i,bundle:v},{pattern:/(?:^|\/)tailwindcss(?:@[\d.]+)?(?:\/|$)/i,bundle:v},{pattern:/(?:^|\/)chart\.js(?:@[\d.]+)?(?:\/|$|\?)/i,bundle:`chart`},{pattern:/(?:^|\/)chart(?:\.min)?\.js(?:$|\?)/i,bundle:`chart`},{pattern:/(?:^|\/)d3(?:@[\d.]+)?(?:\/|$|\?)/i,bundle:`d3`},{pattern:/(?:^|\/)d3(?:\.min)?\.js(?:$|\?)/i,bundle:`d3`},{pattern:/(?:^|\/)three(?:@[\d.]+)?(?:\/|$|\?)/i,bundle:`three`},{pattern:/(?:^|\/)three(?:\.min)?\.js(?:$|\?)/i,bundle:`three`},{pattern:/papaparse/i,bundle:`papaparse`},{pattern:/(?:^|\/)lodash(?:@[\d.]+)?(?:\/|$|\?)/i,bundle:`lodash`},{pattern:/(?:^|\/)lodash(?:\.min)?\.js(?:$|\?)/i,bundle:`lodash`},{pattern:/fonts\.(?:googleapis|gstatic)\.com/i,bundle:y},{pattern:/mermaid/i,bundle:`mermaid`},{pattern:/(?:^|\/)tone(?:@[\d.]+)?(?:\/|$|\?)|tone(?:\.min)?\.js/i,bundle:`tone`},{pattern:/mathjs|math(?:\.min)?\.js/i,bundle:`mathjs`},{pattern:/plotly/i,bundle:`plotly`},{pattern:/framer-motion|(?:^|\/)motion(?:@[\d.]+)?(?:\/|$)/i,bundle:`framer-motion`},{pattern:/react-dom/i,bundle:g},{pattern:/(?:^|\/)react(?:@[\d.]+)?(?:\/|$|\?)/i,bundle:g},{pattern:/babel(?:-standalone|\/standalone)/i,bundle:_}],w=`__libreArtifactRuntime`;function T(e){if(b[e])return e;let t=C.find(({pattern:t})=>t.test(e))?.bundle??Object.values(b).find(t=>e.startsWith(`${t}/`));return t?Object.entries(b).find(([,e])=>e===t)?.[0]??null:null}function E(e){let t=new Set,n=e.matchAll(/(?:from|import|require)\s*\(?\s*['"`]([^'"`]+)['"`]/g);for(let[,e]of n){let n=T(e);n&&t.add(b[n])}return[...t]}var D=/\b(?:flex|grid|hidden|absolute|relative|(?:p|m|px|py|mx|my|mt|mb|ml|mr|gap|space)-\d|(?:w|h|max-w|min-h)-(?:\d|full|screen|auto)|text-(?:xs|sm|base|lg|xl|\dxl|center|left|right|white|black|gray-\d)|bg-(?:white|black|transparent|[a-z]+-\d)|rounded(?:-[a-z]+)?|shadow(?:-[a-z]+)?|border(?:-\d)?|items-(?:center|start|end)|justify-(?:center|between|around|end)|font-(?:bold|medium|semibold|light)|hover:[a-z-]+|(?:sm|md|lg|xl):[a-z-]+)\b/g;function O(e){let t=[...e.matchAll(/class\s*=\s*("|')(.*?)\1/gi)].map(e=>e[2]).join(` `);return new Set(t.match(D)??[]).size>=3}function k(e){let t=new Set;for(let[n,r]of Object.entries(b)){let i=n.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);RegExp(`(?:from|import|require)\\s*\\(?\\s*['"\`]${i}['"\`]`).test(e)&&t.add(r)}return[...t]}function A(e){return C.find(({pattern:t})=>t.test(e))?.bundle??null}function j(e){let t=new Set;for(let n of e.matchAll(/\b(?:src|href)\s*=\s*("|')(.*?)\1/gi))t.add(n[2]);for(let n of e.matchAll(/(?:from|import|require)\s*\(?\s*['"`]([^'"`]+)['"`]/g))t.add(n[1]);return[...t]}function M(e){let t=new Set;for(let n of j(e)){let e=A(n);e&&t.add(e)}return[...t]}var N=`35f90e513d3ddf5d`,P=new Map;function F(e){let t=P.get(e);if(t)return t;let n=fetch(`${p}${m}/${e}.js?v=${N}`,{credentials:`same-origin`,cache:`no-cache`}).then(t=>{if(!t.ok)throw Error(`The artifact runtime bundle "${e}" is unavailable (HTTP ${t.status}).`);return t.text()});return n.catch(()=>P.delete(e)),P.set(e,n),n}async function I(e){let t=await Promise.all(e.map(F));return Object.fromEntries(e.map((e,n)=>[e,t[n]]))}var L=`
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-vendor-CR5VJ85Q.js";import{t as r}from"./logger-BR4forr_.js";import{t as i}from"./config-Da1yh9sC.js";import{a,l as o,n as s,o as c,r as l,t as u}from"./artifactHtml-DDmfpcB0.js";var d=e(t(),1),f=`${i.replace(/\/+$/,``)}/artifacts/sandbox`,p=window.location.protocol===`file:`?new URL(f).origin:window.location.origin,m=`/artifact-runtime`,h=`runtime`,g=`react`,_=`babel`,v=`tailwind`,y=`fonts`,b={react:g,"react-dom":g,"react-dom/client":g,"react/jsx-runtime":g,"react/jsx-dev-runtime":g,recharts:`recharts`,"lucide-react":`lucide-react`,d3:`d3`,three:`three`,papaparse:`papaparse`,lodash:`lodash`,"lodash-es":`lodash`,mermaid:`mermaid`,"chart.js":`chart`,"chart.js/auto":`chart`,tone:`tone`,mathjs:`mathjs`,"plotly.js":`plotly`,"plotly.js-dist-min":`plotly`,"framer-motion":`framer-motion`,"motion/react":`framer-motion`,motion:`framer-motion`,"three/addons/controls/OrbitControls.js":`three`,"three/examples/jsm/controls/OrbitControls.js":`three`},x=[h,g,_,v],S=[h,`mermaid`],C=[{pattern:/cdn\.tailwindcss\.com/i,bundle:v},{pattern:/(?:^|\/)tailwindcss(?:@[\d.]+)?(?:\/|$)/i,bundle:v},{pattern:/(?:^|\/)chart\.js(?:@[\d.]+)?(?:\/|$|\?)/i,bundle:`chart`},{pattern:/(?:^|\/)chart(?:\.min)?\.js(?:$|\?)/i,bundle:`chart`},{pattern:/(?:^|\/)d3(?:@[\d.]+)?(?:\/|$|\?)/i,bundle:`d3`},{pattern:/(?:^|\/)d3(?:\.min)?\.js(?:$|\?)/i,bundle:`d3`},{pattern:/(?:^|\/)three(?:@[\d.]+)?(?:\/|$|\?)/i,bundle:`three`},{pattern:/(?:^|\/)three(?:\.min)?\.js(?:$|\?)/i,bundle:`three`},{pattern:/papaparse/i,bundle:`papaparse`},{pattern:/(?:^|\/)lodash(?:@[\d.]+)?(?:\/|$|\?)/i,bundle:`lodash`},{pattern:/(?:^|\/)lodash(?:\.min)?\.js(?:$|\?)/i,bundle:`lodash`},{pattern:/fonts\.(?:googleapis|gstatic)\.com/i,bundle:y},{pattern:/mermaid/i,bundle:`mermaid`},{pattern:/(?:^|\/)tone(?:@[\d.]+)?(?:\/|$|\?)|tone(?:\.min)?\.js/i,bundle:`tone`},{pattern:/mathjs|math(?:\.min)?\.js/i,bundle:`mathjs`},{pattern:/plotly/i,bundle:`plotly`},{pattern:/framer-motion|(?:^|\/)motion(?:@[\d.]+)?(?:\/|$)/i,bundle:`framer-motion`},{pattern:/react-dom/i,bundle:g},{pattern:/(?:^|\/)react(?:@[\d.]+)?(?:\/|$|\?)/i,bundle:g},{pattern:/babel(?:-standalone|\/standalone)/i,bundle:_}],w=`__libreArtifactRuntime`;function T(e){if(b[e])return e;let t=C.find(({pattern:t})=>t.test(e))?.bundle??Object.values(b).find(t=>e.startsWith(`${t}/`));return t?Object.entries(b).find(([,e])=>e===t)?.[0]??null:null}function E(e){let t=new Set,n=e.matchAll(/(?:from|import|require)\s*\(?\s*['"`]([^'"`]+)['"`]/g);for(let[,e]of n){let n=T(e);n&&t.add(b[n])}return[...t]}var D=/\b(?:flex|grid|hidden|absolute|relative|(?:p|m|px|py|mx|my|mt|mb|ml|mr|gap|space)-\d|(?:w|h|max-w|min-h)-(?:\d|full|screen|auto)|text-(?:xs|sm|base|lg|xl|\dxl|center|left|right|white|black|gray-\d)|bg-(?:white|black|transparent|[a-z]+-\d)|rounded(?:-[a-z]+)?|shadow(?:-[a-z]+)?|border(?:-\d)?|items-(?:center|start|end)|justify-(?:center|between|around|end)|font-(?:bold|medium|semibold|light)|hover:[a-z-]+|(?:sm|md|lg|xl):[a-z-]+)\b/g;function O(e){let t=[...e.matchAll(/class\s*=\s*("|')(.*?)\1/gi)].map(e=>e[2]).join(` `);return new Set(t.match(D)??[]).size>=3}function k(e){let t=new Set;for(let[n,r]of Object.entries(b)){let i=n.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);RegExp(`(?:from|import|require)\\s*\\(?\\s*['"\`]${i}['"\`]`).test(e)&&t.add(r)}return[...t]}function A(e){return C.find(({pattern:t})=>t.test(e))?.bundle??null}function j(e){let t=new Set;for(let n of e.matchAll(/\b(?:src|href)\s*=\s*("|')(.*?)\1/gi))t.add(n[2]);for(let n of e.matchAll(/(?:from|import|require)\s*\(?\s*['"`]([^'"`]+)['"`]/g))t.add(n[1]);return[...t]}function M(e){let t=new Set;for(let n of j(e)){let e=A(n);e&&t.add(e)}return[...t]}var N=`cdc4441c07ad66b3`,P=new Map;function F(e){let t=P.get(e);if(t)return t;let n=fetch(`${p}${m}/${e}.js?v=${N}`,{credentials:`same-origin`,cache:`no-cache`}).then(t=>{if(!t.ok)throw Error(`The artifact runtime bundle "${e}" is unavailable (HTTP ${t.status}).`);return t.text()});return n.catch(()=>P.delete(e)),P.set(e,n),n}async function I(e){let t=await Promise.all(e.map(F));return Object.fromEntries(e.map((e,n)=>[e,t[n]]))}var L=`
2
2
  html, body { margin: 0; min-height: 100%; }
3
3
  body {
4
4
  background: #ffffff;
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,r as n,t as r}from"./react-vendor-CR5VJ85Q.js";import{t as i}from"./logger-BR4forr_.js";import{T as ee,t as te}from"./chatStore-CVTbkZyb.js";import{t as ne}from"./useTranslation-Boi0fB1B.js";import{t as a}from"./utils-B-Bhh1pF.js";import{t as o}from"./appStore-0_qlwS8f.js";import{An as re,Ln as s,Nn as ie,Or as ae,Qn as oe,Rn as c,Tn as l,Zn as u,er as se,g as d,n as ce,rn as le,tn as ue,yn as f}from"./ui-vendor-6S05F84J.js";import{t as p}from"./Button-Dh2UJA-B.js";import{i as de,r as fe}from"./artifactHtml-DDmfpcB0.js";import{t as m}from"./OptimizedSyntaxHighlighter-B0g8cxZQ.js";import{t as pe}from"./ArtifactSandboxFrame-CR9ghP0A.js";var h=e(t(),1),me=n(),g=r(),he=i(`components:artifact-slide-out-panel`),_=320,ge=.9,_e=400,ve=`(min-width: 768px)`,ye=`(min-width: 1024px)`,v=e=>{let[t,n]=(0,h.useState)(()=>typeof window<`u`&&window.matchMedia(e).matches);return(0,h.useEffect)(()=>{let t=window.matchMedia(e),r=()=>n(t.matches);return t.addEventListener(`change`,r),()=>t.removeEventListener(`change`,r)},[e]),t},y=()=>{let{t:e,i18n:t}=ne(),n=ee(t.language),{artifactPanelOpen:r,artifactPanelArtifact:i,openArtifactPanel:y,closeArtifactPanel:b,theme:x,artifactPanelWidth:S,setArtifactPanelWidth:C,artifactPanelResizing:w,setArtifactPanelResizing:T,sidebarOpen:E,sidebarCompact:D}=o(),O=v(ve),k=v(ye)?E?D?64:288:0:E&&D?64:0,A=(0,h.useCallback)(()=>O?Math.max(_,window.innerWidth-k-_e):window.innerWidth*ge,[O,k]),j=te(e=>e.currentSession),M=h.useMemo(()=>{if(!i)return[];let e=i.title.trim().toLowerCase(),t=(j?.messages??[]).flatMap(e=>e.artifacts??[]).filter(t=>t.title.trim().toLowerCase()===e);return t.some(e=>e.id===i.id||e.content===i.content)?t:[...t,i]},[j,i]),N=M.findIndex(e=>e.id===i?.id);N===-1&&i&&(N=M.findIndex(e=>e.content===i.content));let[P,F]=(0,h.useState)(!1),[I,L]=(0,h.useState)(`preview`),R=(0,h.useRef)(null),z=(0,h.useRef)(null),B=(0,h.useRef)(0),V=(0,h.useRef)(0),H=(0,h.useRef)(null),U=(0,h.useRef)(null),W=(0,h.useRef)(S),G=i?.id??null;G!==z.current&&(z.current=G,I!==`preview`&&L(`preview`));let K=(0,h.useCallback)(e=>{W.current=e,U.current===null&&(U.current=window.requestAnimationFrame(()=>{U.current=null,C(W.current)}))},[C]),q=(0,h.useCallback)(()=>{H.current=null,T(!1),U.current!==null&&(window.cancelAnimationFrame(U.current),U.current=null,C(W.current))},[T,C]),be=(0,h.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),H.current=e.pointerId,V.current=S,B.current=e.clientX,W.current=S,e.currentTarget.setPointerCapture(e.pointerId),T(!0)},[S,T]),xe=e=>{if(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`)return;e.preventDefault();let t=n?e.key===`ArrowRight`:e.key===`ArrowLeft`,r=e.shiftKey?96:24;C(Math.min(A(),Math.max(_,S+(t?r:-r))))},J=(0,h.useCallback)(e=>{if(!w||H.current!==null&&e.pointerId!==H.current)return;e.preventDefault();let t=(B.current-e.clientX)*(n?-1:1),r=Math.min(A(),Math.max(_,V.current+t));K(r)},[w,n,K,A]);if((0,h.useEffect)(()=>{if(!w){document.body.style.userSelect=``,document.body.style.cursor=``;return}let e=e=>{(H.current===null||e.pointerId===H.current)&&q()};return window.addEventListener(`pointermove`,J,{passive:!1}),window.addEventListener(`pointerup`,e),window.addEventListener(`pointercancel`,e),window.addEventListener(`blur`,q),document.body.style.userSelect=`none`,document.body.style.cursor=`col-resize`,()=>{window.removeEventListener(`pointermove`,J),window.removeEventListener(`pointerup`,e),window.removeEventListener(`pointercancel`,e),window.removeEventListener(`blur`,q),document.body.style.userSelect=``,document.body.style.cursor=``}},[w,J,q]),(0,h.useEffect)(()=>{let e=()=>{let e=A();S>e&&C(e)};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[S,C,A]),(0,h.useEffect)(()=>{if(O)return;let e=e=>{e.key===`Escape`&&r&&b()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[r,b,O]),(0,h.useEffect)(()=>{if(O)return;let e=e=>{w||R.current&&!R.current.contains(e.target)&&r&&b()},t=setTimeout(()=>{window.addEventListener(`mousedown`,e)},100);return()=>{clearTimeout(t),window.removeEventListener(`mousedown`,e)}},[r,b,w,O]),!i)return null;let Y=i,Se=async t=>{try{await navigator.clipboard.writeText(t),F(!0),setTimeout(()=>F(!1),2e3)}catch(t){he.error(`Failed to copy:`,t),ae.error(e(`chat.message.copyFailed`))}},Ce=()=>{let e=Y.type===`html`?fe(Y.content,Y.title):Y.content,t=new Blob([e],{type:we(Y.type)}),n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=`${Y.title}.${Te(Y.type)}`,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(n)},we=e=>{switch(e){case`html`:return`text/html`;case`react`:return`text/javascript`;case`svg`:return`image/svg+xml`;case`css`:return`text/css`;case`json`:return`application/json`;default:return`text/plain`}},Te=e=>{switch(e){case`html`:return`html`;case`react`:return`jsx`;case`svg`:return`svg`;case`css`:return`css`;case`json`:return`json`;default:return`txt`}},Ee=()=>{switch(Y.type){case`html`:return(0,g.jsx)(le,{className:`h-5 w-5`});case`react`:return(0,g.jsx)(s,{className:`h-5 w-5`});case`svg`:return(0,g.jsx)(f,{className:`h-5 w-5`});case`code`:return(0,g.jsx)(s,{className:`h-5 w-5`});default:return(0,g.jsx)(f,{className:`h-5 w-5`})}},X=()=>(0,g.jsx)(`div`,{"data-testid":`artifact-html-fallback`,className:`w-full h-full flex items-center justify-center bg-gray-50 dark:bg-dark-100 rounded-lg border border-gray-200 dark:border-dark-200 p-4`,children:(0,g.jsxs)(`div`,{className:`max-w-sm text-center`,children:[(0,g.jsx)(d,{className:`h-8 w-8 text-primary-500 mx-auto mb-3`}),(0,g.jsx)(`p`,{className:`text-sm font-medium text-gray-900 dark:text-gray-100`,children:e(`artifacts.previewUnavailable`)}),(0,g.jsx)(`p`,{className:`mt-1 text-sm text-gray-600 dark:text-gray-400`,children:e(`artifacts.previewUnavailableDescription`)}),(0,g.jsxs)(p,{variant:`outline`,size:`sm`,onClick:()=>L(`code`),className:`mt-4`,children:[(0,g.jsx)(c,{className:`h-3.5 w-3.5 me-1.5`}),e(`artifacts.code`)]})]})}),Z=e=>Y.content.trim()?(0,g.jsx)(pe,{content:Y.content,title:Y.title,kind:e,colorScheme:x.mode===`light`?`light`:`dark`,className:a(`w-full h-full border-0 rounded-lg bg-white`,w&&`pointer-events-none`),fallback:X()}):X(),De=()=>(0,g.jsx)(`iframe`,{"data-testid":`artifact-svg-preview`,srcDoc:de(Y.content,Y.title),className:`w-full h-full border-0 rounded-lg bg-white`,sandbox:``,title:Y.title}),Q=()=>(0,g.jsx)(`div`,{className:`h-full overflow-auto`,children:(0,g.jsx)(m,{language:(()=>{if(Y.language)return Y.language;switch(Y.type){case`html`:return`html`;case`react`:return`jsx`;case`svg`:return`xml`;case`json`:return`json`;default:return`text`}})(),isDark:x.mode!==`light`,className:`m-0! rounded-lg! h-full!`,codeTheme:`night`,showLineNumbers:!0,backgroundColor:x.mode===`light`?void 0:`rgb(var(--color-dark-50))`,children:Y.content})}),Oe=()=>{try{let e=JSON.parse(Y.content),t=JSON.stringify(e,null,2);return(0,g.jsx)(`div`,{className:`h-full overflow-auto`,children:(0,g.jsx)(m,{language:`json`,isDark:x.mode!==`light`,className:`m-0! rounded-lg! h-full!`,codeTheme:`night`,showLineNumbers:!0,backgroundColor:x.mode===`light`?void 0:`rgb(var(--color-dark-50))`,children:t})})}catch{return(0,g.jsx)(`div`,{className:`w-full h-full flex items-center justify-center bg-gray-50 dark:bg-dark-100 rounded-lg`,children:(0,g.jsxs)(`div`,{className:`text-center`,children:[(0,g.jsx)(d,{className:`h-8 w-8 text-primary-500 mx-auto mb-2`}),(0,g.jsx)(`p`,{className:`text-sm text-gray-600 dark:text-dark-600`,children:e(`artifacts.invalidJson`)})]})})}},ke=()=>{if(I===`code`)return Q();switch(Y.type){case`html`:return Z(`html`);case`react`:return Z(`react`);case`mermaid`:return Z(`mermaid`);case`svg`:return De();case`json`:return Oe();default:return Q()}},Ae=()=>Y.type===`html`||Y.type===`svg`||Y.type===`react`||Y.type===`mermaid`,$=typeof window<`u`&&window.innerWidth<640,je=$?`100%`:`${S}px`,Me=(0,g.jsxs)(g.Fragment,{children:[!O&&(0,g.jsx)(`div`,{className:a(`fixed inset-0 bg-black/30 dark:bg-black/50 z-40 transition-opacity duration-300`,r?`opacity-100`:`opacity-0 pointer-events-none`)}),w&&(0,g.jsx)(`div`,{className:a(`fixed inset-0 cursor-col-resize select-none`,O?`z-40`:`z-55`),"aria-hidden":`true`}),(0,g.jsxs)(`div`,{ref:R,"data-testid":`artifact-slide-out-panel`,style:{width:je},className:a(`fixed top-0 inset-e-0 h-full`,O?`z-30`:`z-50`,`bg-white dark:bg-dark-25`,`shadow-2xl border-s border-gray-200 dark:border-dark-200`,`flex flex-col`,`transform transition-transform duration-300 ease-out`,r?`translate-x-0`:`translate-x-full rtl:-translate-x-full`),children:[!$&&(0,g.jsxs)(`div`,{onPointerDown:be,onKeyDown:xe,role:`separator`,"aria-orientation":`vertical`,tabIndex:0,"aria-label":e(`artifacts.resizePanel`),"aria-valuenow":Math.round(S),"aria-valuemin":_,"aria-valuemax":Math.round(A()),"data-testid":`artifact-resize-handle`,title:e(`artifacts.dragEdgeToResize`),className:a(`focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary-500`,`absolute inset-s-0 top-0 bottom-0 w-4 -ms-2 cursor-col-resize z-56`,`flex items-center justify-center`,`touch-none select-none group`),children:[(0,g.jsx)(`div`,{className:a(`w-1 h-16 rounded-full transition-all duration-200`,`bg-gray-300 dark:bg-dark-300`,`group-hover:bg-primary-500 group-hover:h-24 group-focus-visible:bg-primary-500`,w&&`bg-primary-500 h-24`)}),(0,g.jsx)(`div`,{className:a(`absolute left-1/2 -translate-x-1/2 opacity-0 group-hover:opacity-100 transition-opacity`,`text-gray-400 dark:text-dark-500`,w&&`opacity-100`),children:(0,g.jsx)(ue,{className:`h-4 w-4`})})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-1.5 border-b border-gray-200 dark:border-dark-200 ps-3 pe-2 py-1.5`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0 flex-1`,children:[(0,g.jsx)(`div`,{className:`text-gray-600 dark:text-gray-400 shrink-0`,children:Ee()}),(0,g.jsx)(`h2`,{className:`text-sm font-semibold text-gray-900 dark:text-gray-100 truncate`,title:Y.description||`${e(`artifacts.created`)}: ${new Date(Y.createdAt).toLocaleString(t.language)}`,children:Y.title}),(0,g.jsx)(`span`,{className:`hidden sm:inline text-[10px] bg-primary-50 dark:bg-primary-900/20 text-primary-700 dark:text-primary-300 px-1.5 py-0.5 rounded-full font-medium shrink-0`,children:Y.type.toUpperCase()})]}),M.length>1&&N!==-1&&(0,g.jsxs)(`div`,{className:`flex items-center gap-0.5 shrink-0`,children:[(0,g.jsx)(p,{variant:`ghost`,size:`sm`,disabled:N===0,onClick:()=>y(M[N-1]),className:`h-7 w-7 p-0`,title:e(`artifacts.previousVersion`),"aria-label":e(`artifacts.previousVersion`),children:(0,g.jsx)(oe,{className:`h-3.5 w-3.5 rtl:rotate-180`})}),(0,g.jsx)(`span`,{className:`whitespace-nowrap text-xs tabular-nums text-gray-500 dark:text-dark-600`,children:e(`artifacts.versionOf`,{current:N+1,total:M.length})}),(0,g.jsx)(p,{variant:`ghost`,size:`sm`,disabled:N===M.length-1,onClick:()=>y(M[N+1]),className:`h-7 w-7 p-0`,title:e(`artifacts.nextVersion`),"aria-label":e(`artifacts.nextVersion`),children:(0,g.jsx)(u,{className:`h-3.5 w-3.5 rtl:rotate-180`})})]}),Ae()&&(0,g.jsxs)(`div`,{className:`flex items-center gap-0.5 shrink-0`,children:[(0,g.jsxs)(p,{variant:I===`preview`?`primary`:`ghost`,size:`sm`,onClick:()=>L(`preview`),className:`h-7 px-2 text-xs`,title:e(`artifacts.previewMode`),"aria-pressed":I===`preview`,children:[(0,g.jsx)(l,{className:`h-3.5 w-3.5 me-1`}),e(`artifacts.preview`)]}),(0,g.jsxs)(p,{variant:I===`code`?`primary`:`ghost`,size:`sm`,onClick:()=>L(`code`),className:`h-7 px-2 text-xs`,title:e(`artifacts.codeMode`),"aria-pressed":I===`code`,children:[(0,g.jsx)(c,{className:`h-3.5 w-3.5 me-1`}),e(`artifacts.code`)]})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-0.5 shrink-0`,children:[(0,g.jsx)(p,{variant:`ghost`,size:`sm`,onClick:()=>Se(Y.content),className:`h-7 w-7 p-0 hover:bg-gray-100 dark:hover:bg-dark-200`,title:e(`artifacts.copyContent`),"aria-label":e(`artifacts.copyContent`),children:P?(0,g.jsx)(se,{className:`h-3.5 w-3.5 text-green-500`}):(0,g.jsx)(ie,{className:`h-3.5 w-3.5`})}),(0,g.jsx)(p,{variant:`ghost`,size:`sm`,onClick:Ce,className:`h-7 w-7 p-0 hover:bg-gray-100 dark:hover:bg-dark-200`,title:e(`artifacts.download`),"aria-label":e(`artifacts.download`),children:(0,g.jsx)(re,{className:`h-3.5 w-3.5`})}),(0,g.jsx)(p,{variant:`ghost`,size:`sm`,onClick:b,className:`h-7 w-7 p-0 hover:bg-gray-100 dark:hover:bg-dark-200`,title:e(O?`common.close`:`artifacts.closePanelEsc`),"aria-label":e(O?`common.close`:`artifacts.closePanelEsc`),children:(0,g.jsx)(ce,{className:`h-4 w-4`})})]})]}),(0,g.jsx)(`div`,{className:`flex-1 p-2 overflow-hidden`,children:ke()})]})]});return(0,me.createPortal)(Me,document.body)};export{y as ArtifactSlideOutPanel};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,r as n,t as r}from"./react-vendor-CR5VJ85Q.js";import{t as i}from"./useTranslation-Boi0fB1B.js";import{t as a}from"./utils-B-Bhh1pF.js";import{Bn as o,Or as s,n as c,tt as l,v as u}from"./ui-vendor-6S05F84J.js";import{t as d}from"./useDialogFocus-zSGHkpE4.js";import{T as f}from"./api-Dcz1G4Ib.js";import{t as p}from"./workApi-Ck8nTlJn.js";import{c as m,d as h,l as g,n as _}from"./calendarDates-Co3o_05Y.js";var v=e(t(),1),y=n(),b=[`channel-mention`,`channel-dm`,`channel-invite`,`share`,`calendar-reminder`,`media-ready`,`media-failed`,`budget-alert`,`work-run-finished`,`work-run-attention`,`work-takeover`,`work-approval`,`system`],x=e=>e.length>0&&e.every(e=>e.kind===`event`),S=(e,t,n)=>new Intl.DateTimeFormat(n,{hour:`numeric`,minute:`2-digit`}).format(new Date(2024,0,1,e,t)),C=(e,t)=>new Intl.DateTimeFormat(t,{weekday:`long`}).format(new Date(2024,0,7+e)),w=(e,t,n)=>new Intl.DateTimeFormat(n,{month:`long`,day:`numeric`}).format(new Date(2024,e-1,t));function T(e,t,n){switch(e.kind){case`event`:return n(e.match?`automations.trigger.eventMatching`:`automations.trigger.event`,{event:n(`automations.triggers.events.${e.event}`),match:e.match??``});case`once`:return n(`automations.trigger.once`,{when:new Intl.DateTimeFormat(t,{dateStyle:`medium`,timeStyle:`short`}).format(new Date(e.at))});case`hourly`:{let t=e.startHour!==void 0||e.endHour!==void 0?` (${e.startHour??0}–${e.endHour??23})`:``;return n(`automations.trigger.hourly`,{minute:String(e.minute).padStart(2,`0`)})+t}case`daily`:return n(`automations.trigger.daily`,{time:S(e.hour,e.minute,t)});case`weekly`:return n(`automations.trigger.weekly`,{day:C(e.dayOfWeek,t),time:S(e.hour,e.minute,t)});case`monthly`:return n(`automations.trigger.monthly`,{day:e.dayOfMonth,time:S(e.hour,e.minute,t)});case`yearly`:return n(`automations.trigger.yearly`,{date:w(e.month,e.dayOfMonth,t),time:S(e.hour,e.minute,t)})}}function E(e,t,n){return e.map(e=>T(e,t,n)).join(` · `)}function D(e){let t=(e,t,n)=>typeof e==`number`&&Number.isSafeInteger(e)&&e>=t&&e<=n;switch(e.kind){case`event`:return b.includes(e.event)&&(e.match===void 0||typeof e.match==`string`&&e.match.length<=200);case`once`:return t(e.at,0,864e13);case`hourly`:return t(e.minute,0,59)&&(e.startHour===void 0||t(e.startHour,0,23))&&(e.endHour===void 0||t(e.endHour,0,23))&&(e.startHour===void 0||e.endHour===void 0||e.endHour>=e.startHour);case`daily`:return t(e.hour,0,23)&&t(e.minute,0,59);case`weekly`:return t(e.dayOfWeek,0,6)&&t(e.hour,0,23)&&t(e.minute,0,59);case`monthly`:return t(e.dayOfMonth,1,31)&&t(e.hour,0,23)&&t(e.minute,0,59);case`yearly`:return t(e.month,1,12)&&t(e.dayOfMonth,1,31)&&t(e.hour,0,23)&&t(e.minute,0,59);default:return!1}}var O=r(),k=[`event`,`once`,`hourly`,`daily`,`weekly`,`monthly`,`yearly`],A=`rounded-lg border border-black/8 bg-white px-2 py-1 text-[13px] text-gray-900 focus:border-primary-500/40 focus:outline-hidden dark:border-white/8 dark:bg-dark-100 dark:text-dark-900`,j=(e,t)=>`${String(e).padStart(2,`0`)}:${String(t).padStart(2,`0`)}`,M=e=>{switch(e){case`event`:return{kind:`event`,event:`channel-mention`};case`once`:{let e=new Date;return e.setHours(e.getHours()+1,0,0,0),{kind:`once`,at:e.getTime()}}case`hourly`:return{kind:`hourly`,minute:0};case`daily`:return{kind:`daily`,hour:8,minute:0};case`weekly`:return{kind:`weekly`,dayOfWeek:1,hour:9,minute:0};case`monthly`:return{kind:`monthly`,dayOfMonth:1,hour:9,minute:0};case`yearly`:return{kind:`yearly`,month:1,dayOfMonth:1,hour:9,minute:0}}};function N({trigger:e,onChange:t,onRemove:n}){let{t:r,i18n:a}=i(),s=h(a.language,`short`),c=new Intl.DateTimeFormat(a.language,{month:`long`}),l=n=>{let[r,i]=(n||`00:00`).split(`:`).map(Number);e.kind!==`hourly`&&e.kind!==`once`&&e.kind!==`event`&&t({...e,hour:r,minute:i})},d=e.kind!==`once`&&e.kind!==`hourly`&&e.kind!==`event`?(0,O.jsx)(`input`,{type:`time`,"aria-label":r(`automations.form.time`),value:j(e.hour,e.minute),onChange:e=>l(e.target.value),className:A}):null;return(0,O.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 rounded-xl border border-black/6 bg-black/2 px-2.5 py-2 dark:border-white/6 dark:bg-white/3`,"data-testid":`automation-trigger`,children:[(0,O.jsx)(o,{className:`h-3.5 w-3.5 shrink-0 text-gray-400 dark:text-dark-500`}),(0,O.jsx)(`select`,{"aria-label":r(`automations.form.frequency`),value:e.kind,onChange:e=>t(M(e.target.value)),className:A,"data-testid":`automation-trigger-kind`,children:k.map(e=>(0,O.jsx)(`option`,{value:e,children:r(`automations.kind.${e}`)},e))}),e.kind===`event`&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`select`,{"aria-label":r(`automations.form.event`),value:e.event,onChange:n=>t({...e,event:n.target.value}),className:A,"data-testid":`automation-trigger-event`,children:b.map(e=>(0,O.jsx)(`option`,{value:e,children:r(`automations.triggers.events.${e}`)},e))}),(0,O.jsx)(`input`,{type:`text`,"aria-label":r(`automations.form.eventMatch`),placeholder:r(`automations.form.eventMatchPlaceholder`),value:e.match??``,onChange:n=>t({...e,match:n.target.value.slice(0,200)}),className:`${A} min-w-0 flex-1`,"data-testid":`automation-trigger-match`})]}),e.kind===`once`&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`input`,{type:`date`,"aria-label":r(`calendar.date`),value:m(e.at),onChange:n=>t({...e,at:_(n.target.value,g(e.at))}),className:A}),(0,O.jsx)(`input`,{type:`time`,"aria-label":r(`automations.form.time`),value:g(e.at),onChange:n=>t({...e,at:_(m(e.at),n.target.value)}),className:A})]}),e.kind===`hourly`&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`label`,{className:`flex items-center gap-1 text-[12px] text-gray-500 dark:text-dark-500`,children:[r(`automations.form.minute`),(0,O.jsx)(`input`,{type:`number`,min:0,max:59,value:e.minute,onChange:n=>t({...e,minute:Math.min(59,Math.max(0,Number(n.target.value)))}),className:`${A} w-16`})]}),(0,O.jsxs)(`label`,{className:`flex items-center gap-1 text-[12px] text-gray-500 dark:text-dark-500`,children:[r(`automations.form.fromHour`),(0,O.jsx)(`input`,{type:`number`,min:0,max:23,value:e.startHour??0,onChange:n=>t({...e,startHour:Math.min(23,Math.max(0,Number(n.target.value)))}),className:`${A} w-16`})]}),(0,O.jsxs)(`label`,{className:`flex items-center gap-1 text-[12px] text-gray-500 dark:text-dark-500`,children:[r(`automations.form.toHour`),(0,O.jsx)(`input`,{type:`number`,min:0,max:23,value:e.endHour??23,onChange:n=>t({...e,endHour:Math.min(23,Math.max(0,Number(n.target.value)))}),className:`${A} w-16`})]})]}),e.kind===`weekly`&&(0,O.jsx)(`select`,{"aria-label":r(`automations.form.weekday`),value:e.dayOfWeek,onChange:n=>t({...e,dayOfWeek:Number(n.target.value)}),className:A,children:s.map((e,t)=>(0,O.jsx)(`option`,{value:t,children:e},e))}),(e.kind===`monthly`||e.kind===`yearly`)&&(0,O.jsxs)(`label`,{className:`flex items-center gap-1 text-[12px] text-gray-500 dark:text-dark-500`,children:[r(`automations.form.dayOfMonth`),(0,O.jsx)(`input`,{type:`number`,min:1,max:31,value:e.dayOfMonth,onChange:n=>t({...e,dayOfMonth:Math.min(31,Math.max(1,Number(n.target.value)))}),className:`${A} w-16`})]}),e.kind===`yearly`&&(0,O.jsx)(`select`,{"aria-label":r(`automations.form.month`),value:e.month,onChange:n=>t({...e,month:Number(n.target.value)}),className:A,children:Array.from({length:12},(e,t)=>(0,O.jsx)(`option`,{value:t+1,children:c.format(new Date(2024,t,1))},t+1))}),d,n&&(0,O.jsx)(`button`,{type:`button`,onClick:n,"aria-label":r(`common.delete`),className:`ms-auto rounded-md p-1 text-red-500 transition-colors hover:bg-red-50 dark:hover:bg-red-900/20`,children:(0,O.jsx)(u,{className:`h-3.5 w-3.5`})})]})}var P=`w-full rounded-lg border border-black/8 bg-white px-2.5 py-1.5 text-[13px] text-gray-900 focus:border-primary-500/40 focus:outline-hidden dark:border-white/8 dark:bg-dark-100 dark:text-dark-900`,F=`mb-1 block text-[11px] font-medium uppercase tracking-wide text-gray-400 dark:text-dark-500`,I=e=>e.isPlugin&&e.pluginId?`plugin:${e.pluginId}`:e.isAgent&&e.agentId?`agent:${e.agentId}`:`ollama`;function L({open:e,automation:t,initial:n,fixedWorkTaskId:r,models:i,saving:a,onClose:o,onSave:s}){return e?(0,O.jsx)(R,{automation:t,initial:n,fixedWorkTaskId:r,models:i,saving:a,onClose:o,onSave:s},t?.id??n?.name??`new`):null}function R({automation:e,initial:t,fixedWorkTaskId:n,models:r,saving:o,onClose:u,onSave:m}){let{t:h}=i(),g=(0,v.useRef)(null);d(g,{onClose:u});let _=!!(n??e?.workTaskId),[b,S]=(0,v.useState)(e?.name??t?.name??``),[C,w]=(0,v.useState)(e?.instructions??t?.instructions??``),[T,E]=(0,v.useState)(e?.triggers??t?.triggers??[{kind:`daily`,hour:8,minute:0}]),[k,A]=(0,v.useState)(e?.model??``),[j,M]=(0,v.useState)(e?.notify??`app`),[L,R]=(0,v.useState)(e?.target??`chat`),[z,B]=(0,v.useState)(e?.workPolicyId??``),[V,H]=(0,v.useState)([]);(0,v.useEffect)(()=>{if(L!==`work`||_)return;let e=!1;return p.listPolicies().then(t=>{!e&&t.success&&Array.isArray(t.data)&&H(t.data)}).catch(()=>void 0),()=>{e=!0}},[L,_]);let[U,W]=(0,v.useState)(e?.webhookEnabled===!0),[G,K]=(0,v.useState)(null),[q,J]=(0,v.useState)(!1),Y=async()=>{if(e){J(!0);try{let t=await f.rotateWebhookSecret(e.id);if(!t.success||!t.data)throw Error(t.error);W(!0),K(t.data)}catch{s.error(h(`automations.webhook.failed`,{defaultValue:`Could not update the webhook.`}))}finally{J(!1)}}},X=async()=>{if(e){J(!0);try{let t=await f.disableWebhook(e.id);if(!t.success)throw Error(t.error);W(!1),K(null)}catch{s.error(h(`automations.webhook.failed`,{defaultValue:`Could not update the webhook.`}))}finally{J(!1)}}},Z=b.trim().length>0&&C.trim().length>0&&T.length>0&&T.every(D);return(0,y.createPortal)((0,O.jsx)(`div`,{className:`fixed inset-0 z-2147483647 flex items-center justify-center bg-gray-950/55 p-4 backdrop-blur-md`,onClick:u,children:(0,O.jsx)(`div`,{ref:g,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`automation-modal-title`,tabIndex:-1,"data-testid":`automation-modal`,className:`flex max-h-[90vh] w-full max-w-lg flex-col overflow-hidden rounded-3xl border border-black/[0.07] bg-white shadow-[0_24px_80px_rgba(0,0,0,0.24)] animate-scale-in dark:border-white/8 dark:bg-dark-25`,onClick:e=>e.stopPropagation(),children:(0,O.jsxs)(`div`,{"data-testid":`automation-scroll-region`,className:`min-h-0 overflow-y-auto p-6 scrollbar-thin`,children:[(0,O.jsxs)(`div`,{className:`mb-4 flex items-center justify-between`,children:[(0,O.jsx)(`h3`,{id:`automation-modal-title`,className:`text-lg font-medium tracking-[-0.02em] text-gray-950 dark:text-dark-950`,children:h(e?`automations.editAutomation`:`automations.newAutomation`)}),(0,O.jsx)(`button`,{onClick:u,"aria-label":h(`common.close`),className:`rounded-xl p-2 transition-colors hover:bg-gray-100 dark:hover:bg-dark-200`,children:(0,O.jsx)(c,{size:20,className:`text-gray-500`})})]}),(0,O.jsxs)(`div`,{className:`space-y-4`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`label`,{htmlFor:`automation-name`,className:F,children:h(`automations.form.name`)}),(0,O.jsx)(`input`,{id:`automation-name`,"data-testid":`automation-name`,type:`text`,value:b,onChange:e=>S(e.target.value),placeholder:h(`automations.form.namePlaceholder`),className:P,maxLength:200,autoFocus:!0})]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`span`,{className:F,children:h(`automations.form.triggers`)}),(0,O.jsxs)(`div`,{className:`space-y-2`,children:[T.map((e,t)=>(0,O.jsx)(N,{trigger:e,onChange:e=>E(n=>n.map((n,r)=>r===t?e:n)),onRemove:T.length>1?()=>E(e=>e.filter((e,n)=>n!==t)):void 0},t)),x(T)&&(0,O.jsx)(`p`,{"data-testid":`automation-event-only-hint`,className:`text-[12px] text-gray-500 dark:text-dark-500`,children:h(`automations.form.eventOnlyHint`)}),T.length<5&&(0,O.jsxs)(`button`,{type:`button`,onClick:()=>E(e=>[...e,{kind:`daily`,hour:8,minute:0}]),"data-testid":`automation-add-trigger`,className:`flex items-center gap-1.5 rounded-lg px-2 py-1 text-[12px] font-medium text-primary-600 transition-colors hover:bg-primary-500/10 dark:text-primary-400`,children:[(0,O.jsx)(l,{className:`h-3.5 w-3.5`}),h(`automations.form.addTrigger`)]})]})]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`label`,{htmlFor:`automation-instructions`,className:F,children:h(`automations.form.instructions`)}),(0,O.jsx)(`textarea`,{id:`automation-instructions`,"data-testid":`automation-instructions`,value:C,onChange:e=>w(e.target.value),placeholder:h(`automations.form.instructionsPlaceholder`),rows:5,className:P,maxLength:2e4})]}),_&&(0,O.jsx)(`p`,{"data-testid":`automation-task-bound-note`,className:`rounded-lg bg-primary-500/10 px-3 py-2 text-[12px] leading-relaxed text-primary-700 dark:text-primary-300`,children:h(`automations.form.taskBoundNote`,{defaultValue:`This routine runs inside the agent's own workspace and conversation, with the agent's model and runtime.`})}),(0,O.jsxs)(`div`,{className:a(`grid grid-cols-2 gap-3`,_&&`hidden`),children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`label`,{htmlFor:`automation-target`,className:F,children:h(`automations.form.target`)}),(0,O.jsxs)(`select`,{id:`automation-target`,"data-testid":`automation-target`,value:L,onChange:e=>R(e.target.value),className:P,children:[(0,O.jsx)(`option`,{value:`chat`,children:h(`automations.form.targetChat`)}),(0,O.jsx)(`option`,{value:`work`,children:h(`automations.form.targetWork`)})]})]}),L===`work`&&V.length>0&&(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`label`,{htmlFor:`automation-work-policy`,className:F,children:h(`automations.form.workPolicy`)}),(0,O.jsxs)(`select`,{id:`automation-work-policy`,"data-testid":`automation-work-policy`,value:z,onChange:e=>B(e.target.value),className:P,children:[(0,O.jsx)(`option`,{value:``,children:h(`automations.form.workPolicyDefault`)}),V.map(e=>(0,O.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]})]}),(0,O.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,O.jsxs)(`div`,{className:a(_&&`hidden`),children:[(0,O.jsx)(`label`,{htmlFor:`automation-model`,className:F,children:h(`automations.form.model`)}),(0,O.jsxs)(`select`,{id:`automation-model`,value:k,onChange:e=>A(e.target.value),className:P,children:[(0,O.jsx)(`option`,{value:``,children:h(`automations.form.modelAuto`)}),r.map(e=>(0,O.jsx)(`option`,{value:e.name,children:e.name},e.name))]})]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`label`,{htmlFor:`automation-notify`,className:F,children:h(`automations.form.notification`)}),(0,O.jsxs)(`select`,{id:`automation-notify`,value:j,onChange:e=>M(e.target.value),className:P,children:[(0,O.jsx)(`option`,{value:`app`,children:h(`automations.form.notifyApp`)}),(0,O.jsx)(`option`,{value:`off`,children:h(`automations.form.notifyOff`)})]})]})]}),e&&(0,O.jsxs)(`div`,{"data-testid":`automation-webhook`,className:`rounded-xl border border-gray-200 p-3 dark:border-dark-300`,children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,O.jsxs)(`div`,{className:`min-w-0`,children:[(0,O.jsx)(`p`,{className:`text-sm font-medium text-gray-900 dark:text-gray-100`,children:h(`automations.webhook.title`,{defaultValue:`Webhook trigger`})}),(0,O.jsx)(`p`,{className:`mt-0.5 text-xs text-gray-500 dark:text-dark-600`,children:U?h(`automations.webhook.enabledHint`,{defaultValue:`External systems can fire this automation with the secret. Rotating invalidates the previous secret.`}):h(`automations.webhook.disabledHint`,{defaultValue:`Let an external system (CI, cron, home automation) fire this automation with a POST and a secret.`})})]}),(0,O.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[(0,O.jsx)(`button`,{type:`button`,"data-testid":`automation-webhook-rotate`,onClick:()=>void Y(),disabled:q,className:`rounded-lg border border-gray-200 px-2.5 py-1.5 text-xs font-medium text-gray-700 transition-colors hover:bg-gray-100 disabled:opacity-50 dark:border-dark-300 dark:text-dark-700 dark:hover:bg-dark-200`,children:U?h(`automations.webhook.rotate`,{defaultValue:`Rotate secret`}):h(`automations.webhook.enable`,{defaultValue:`Enable`})}),U&&(0,O.jsx)(`button`,{type:`button`,"data-testid":`automation-webhook-disable`,onClick:()=>void X(),disabled:q,className:`rounded-lg border border-gray-200 px-2.5 py-1.5 text-xs font-medium text-gray-700 transition-colors hover:bg-gray-100 disabled:opacity-50 dark:border-dark-300 dark:text-dark-700 dark:hover:bg-dark-200`,children:h(`automations.webhook.disable`,{defaultValue:`Disable`})})]})]}),G&&(0,O.jsxs)(`div`,{"data-testid":`automation-webhook-secret`,className:`mt-2 space-y-1 rounded-lg bg-gray-50 p-2 dark:bg-dark-100`,children:[(0,O.jsx)(`p`,{className:`text-[11px] text-gray-500 dark:text-dark-600`,children:h(`automations.webhook.revealHint`,{defaultValue:`Shown once. Send it as a Bearer token or an X-Libre-Webhook-Secret header.`})}),(0,O.jsxs)(`code`,{dir:`ltr`,className:`block break-all font-mono text-xs text-gray-800 dark:text-gray-200`,children:[`POST `,G.path]}),(0,O.jsx)(`code`,{dir:`ltr`,className:`block break-all font-mono text-xs text-gray-800 dark:text-gray-200`,children:G.secret})]})]}),(0,O.jsxs)(`div`,{className:`flex justify-end gap-3 border-t border-gray-200 pt-4 dark:border-dark-300`,children:[(0,O.jsx)(`button`,{onClick:u,"data-testid":`automation-cancel`,className:`rounded-xl px-4 py-2 text-sm font-medium text-gray-700 transition-colors hover:bg-gray-100 dark:text-dark-700 dark:hover:bg-dark-200`,children:h(`common.cancel`)}),(0,O.jsx)(`button`,{onClick:()=>{if(!Z)return;if(_){m({name:b.trim(),instructions:C.trim(),triggers:T,notify:j,target:`work`,workTaskId:n??e?.workTaskId});return}let t=r.find(e=>e.name===k);m({name:b.trim(),instructions:C.trim(),triggers:T,...t?{provider:I(t),model:t.name}:{},notify:j,target:L,...L===`work`&&z?{workPolicyId:z}:{}})},disabled:o||!Z,"data-testid":`automation-save`,className:`rounded-xl bg-gray-950 px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-gray-800 disabled:cursor-not-allowed disabled:opacity-50 dark:bg-white dark:text-gray-950 dark:hover:bg-gray-100`,children:h(o?`common.saving`:`common.save`)})]})]})]})})}),document.body)}export{E as n,x as r,L as t};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-vendor-CR5VJ85Q.js";import{d as r}from"./router-vendor-DqMnEJWK.js";import{t as i}from"./logger-BR4forr_.js";import{t as a}from"./chatStore-CVTbkZyb.js";import{t as o}from"./useTranslation-Boi0fB1B.js";import{i as s,t as c}from"./utils-B-Bhh1pF.js";import{Gn as l,Or as u,Rt as ee,Un as d,Wn as f,Z as te,it as ne,kn as re,lt as ie,st as ae,t as p,tt as oe,v as m}from"./ui-vendor-6S05F84J.js";import{t as h}from"./Button-Dh2UJA-B.js";import{i as g,n as _,r as v}from"./ui-CI0OdG9q.js";import{t as se}from"./confirmStore-CKkUtP9c.js";import{T as y}from"./api-Dcz1G4Ib.js";import{n as b,r as x,t as S}from"./AutomationModal-DZe-C2jN.js";var C=e(t(),1),w=n();function T({days:e,locale:t}){let{t:n}=o(),r=e.reduce((e,t)=>e+t.succeeded,0),i=e.reduce((e,t)=>e+t.failed,0),a=Math.max(1,...e.map(e=>e.succeeded+e.failed)),s=new Intl.DateTimeFormat(t,{month:`short`,day:`numeric`}),c=new Date,l=e=>s.format(new Date(c.getFullYear(),c.getMonth(),c.getDate()-29+e));return(0,w.jsxs)(`div`,{className:`rounded-2xl border border-black/6 bg-white/60 px-4 py-3 dark:border-white/[0.07] dark:bg-dark-100/60`,"data-testid":`automation-run-strip`,children:[(0,w.jsxs)(`div`,{className:`mb-2 flex items-center justify-between`,children:[(0,w.jsx)(`p`,{className:`text-[12px] font-medium text-gray-700 dark:text-dark-700`,children:n(`automations.runHistory`)}),(0,w.jsxs)(`p`,{className:`text-[11px] text-gray-400 dark:text-dark-500`,children:[(0,w.jsxs)(`span`,{className:`text-emerald-600 dark:text-emerald-400`,children:[r,` `,n(`automations.succeeded`)]}),` · `,(0,w.jsxs)(`span`,{className:`text-red-500 dark:text-red-400`,children:[i,` `,n(`automations.failed`)]})]})]}),(0,w.jsx)(`div`,{className:`flex h-12 items-end gap-[3px]`,children:e.map((e,t)=>{let n=e.succeeded+e.failed;if(n===0)return(0,w.jsx)(`div`,{title:l(t),className:`h-[3px] flex-1 rounded-xs bg-black/6 dark:bg-white/8`},t);let r=Math.max(6,Math.round(n/a*48)),i=Math.round(e.failed/n*r);return(0,w.jsxs)(`div`,{title:`${l(t)}: ${e.succeeded}✓ ${e.failed}✗`,className:`flex flex-1 flex-col justify-end overflow-hidden rounded-xs`,style:{height:r},children:[(0,w.jsx)(`div`,{className:`w-full bg-emerald-500/80`,style:{height:r-i}}),i>0&&(0,w.jsx)(`div`,{className:`w-full bg-red-500/80`,style:{height:i}})]},t)})})]})}var E=[{id:`morningBrief`,instructions:`Put together my morning brief: the top world, business, and tech headlines from the last 24 hours with one-line summaries, and one story worth reading in depth and why. Keep the whole thing scannable.`,triggers:[{kind:`daily`,hour:7,minute:30}]},{id:`newsDigest`,instructions:`Summarize the most important AI news from the last 24 hours: model releases, notable research papers, funding rounds, and policy changes. For each item add one sentence on why it matters. Skip minor product updates and rumors.`,triggers:[{kind:`daily`,hour:8,minute:0}]},{id:`weeklyReview`,instructions:`Help me wrap the week: prompt me to reflect on what I accomplished, what is still open, and what the top priorities for next week should be. Structure it as a short template I can fill in.`,triggers:[{kind:`weekly`,dayOfWeek:5,hour:16,minute:0}]},{id:`monthlyReport`,instructions:`Draft a monthly status report outline: key accomplishments, metrics to review, risks, and goals for the next month. Leave placeholders where my specifics belong.`,triggers:[{kind:`monthly`,dayOfMonth:1,hour:9,minute:0}]}],D=i(`pages:automations`),O=()=>{let{t:e,i18n:t}=o(),n=r(),i=a(e=>e.models),O=a(e=>e.loadModels),[A,j]=(0,C.useState)(`automations`),[M,N]=(0,C.useState)([]),[P,F]=(0,C.useState)([]),[I,L]=(0,C.useState)(null),[R,z]=(0,C.useState)(!0),[B,V]=(0,C.useState)(!1),[H,U]=(0,C.useState)(null),[W,G]=(0,C.useState)(null),[K,q]=(0,C.useState)(!1),[J,Y]=(0,C.useState)(null),X=(0,C.useRef)(null),[ce,Z]=(0,C.useState)(0),Q=(0,C.useCallback)(()=>Z(e=>e+1),[]);(0,C.useEffect)(()=>{let t=!1;return Promise.all([y.getAutomations(),y.getRuns(),y.getRunsSummary()]).then(([e,n,r])=>{t||(e.success&&e.data&&N(e.data),n.success&&n.data&&F(n.data),r.success&&r.data&&L(r.data))}).catch(n=>{t||(D.error(`Failed to load automations:`,n),u.error(e(`automations.loadFailed`)))}).finally(()=>{t||z(!1)}),()=>{t=!0}},[ce,e]),(0,C.useEffect)(()=>{i.length===0&&O({quiet:!0})},[i.length,O]),(0,C.useEffect)(()=>{A===`runs`&&y.markRunsSeen().then(()=>y.getRunsSummary()).then(e=>{e.success&&e.data&&L(e.data)}).catch(()=>void 0)},[A,P.length]),(0,C.useEffect)(()=>{if(!J)return;X.current?.querySelector(`[role="menuitem"]`)?.focus();let e=e=>{X.current?.contains(e.target)||Y(null)},t=e=>{e.key===`Escape`&&(X.current?.querySelector(`[aria-haspopup="menu"]`)?.focus(),Y(null))};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[J]);let le=e=>{if(e.key!==`ArrowDown`&&e.key!==`ArrowUp`)return;let t=Array.from(e.currentTarget.querySelectorAll(`[role="menuitem"]`));if(t.length===0)return;e.preventDefault();let n=t.indexOf(document.activeElement);t[e.key===`ArrowDown`?(n+1)%t.length:(n-1+t.length)%t.length]?.focus()},ue=()=>{U(null),G(null),V(!0)},de=t=>{U(null),G({name:e(`automations.templates.${t.id}.name`),instructions:t.instructions,triggers:t.triggers}),V(!0)},fe=e=>{U(e),G(null),Y(null),V(!0)},pe=async t=>{q(!0);try{let n=H?await y.updateAutomation(H.id,t):await y.createAutomation(t);n.success?(V(!1),Q()):u.error(n.error||e(`automations.saveFailed`))}catch(t){D.error(`Failed to save automation:`,t),u.error(e(`automations.saveFailed`))}finally{q(!1)}},$=async(t,n)=>{if(X.current?.querySelector(`[aria-haspopup="menu"]`)?.focus(),Y(null),n!==`delete`||await se({title:e(`automations.deleteConfirmTitle`,{name:t.name}),description:e(`automations.deleteConfirmDescription`),destructive:!0}))try{n===`pause`?await y.pauseAutomation(t.id):n===`resume`?await y.resumeAutomation(t.id):n===`run`?(await y.runAutomationNow(t.id),u.success(e(`automations.runQueued`))):await y.deleteAutomation(t.id),Q()}catch(t){D.error(`Automation ${n} failed:`,t),u.error(e(`automations.actionFailed`))}},me=e=>e.status===`succeeded`?(0,w.jsx)(l,{className:`h-4 w-4 text-emerald-500`}):e.status===`failed`?(0,w.jsx)(d,{className:`h-4 w-4 text-red-500`}):(0,w.jsx)(ee,{className:`h-4 w-4 animate-spin text-gray-400`}),he=t=>M.find(e=>e.id===t)?.name??e(`automations.deletedAutomation`);return(0,w.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden`,"data-testid":`automations-page`,children:[(0,w.jsx)(g,{title:e(`automations.title`),actions:(0,w.jsxs)(h,{size:`sm`,onClick:ue,"data-testid":`automation-new`,className:`h-7 gap-1 px-2.5 text-[12px]`,children:[(0,w.jsx)(oe,{className:`h-3.5 w-3.5`}),e(`automations.newAutomation`)]}),children:(0,w.jsx)(`div`,{role:`tablist`,"aria-label":e(`automations.title`),className:`flex items-center rounded-xl bg-black/4 p-0.5 dark:bg-white/6`,onKeyDown:e=>{if(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`)return;let t=A===`automations`?`runs`:`automations`;e.preventDefault(),j(t),document.getElementById(`automations-tab-${t}`)?.focus()},children:[`automations`,`runs`].map(t=>(0,w.jsx)(`button`,{id:`automations-tab-${t}`,type:`button`,role:`tab`,"aria-selected":A===t,tabIndex:A===t?0:-1,onClick:()=>j(t),"data-testid":`automations-tab-${t}`,className:c(`rounded-[10px] px-2.5 py-1 text-[12px] font-medium transition-colors`,A===t?`bg-white text-gray-900 shadow-xs dark:bg-dark-200 dark:text-dark-900`:`text-gray-500 hover:text-gray-800 dark:text-dark-500 dark:hover:text-dark-800`),children:e(`automations.tab.${t}`)},t))})}),(0,w.jsxs)(`div`,{role:`tabpanel`,"aria-labelledby":`automations-tab-${A}`,className:`scroll-region min-h-0 flex-1 overflow-y-auto px-4 py-4 scrollbar-thin`,children:[A===`automations`?R?(0,w.jsx)(_,{srOnly:!0}):M.length===0?(0,w.jsx)(v,{icon:p,title:e(`automations.empty`)}):(0,w.jsx)(`div`,{className:`mx-auto w-full max-w-3xl space-y-2`,children:M.map(n=>(0,w.jsx)(`div`,{"data-testid":`automation-row`,className:`rounded-2xl border border-black/6 bg-white/60 px-4 py-3 dark:border-white/[0.07] dark:bg-dark-100/60`,children:(0,w.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,w.jsxs)(`div`,{className:`min-w-0`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,w.jsx)(`p`,{className:`truncate text-[14px] font-medium text-gray-900 dark:text-dark-900`,children:n.name}),(0,w.jsx)(`span`,{className:c(`rounded-full px-2 py-0.5 text-[10px] font-medium uppercase tracking-wide`,n.status===`active`?`bg-emerald-500/10 text-emerald-600 dark:text-emerald-400`:`bg-gray-500/10 text-gray-500 dark:text-dark-500`),children:e(`automations.status.${n.status}`)})]}),(0,w.jsxs)(`p`,{className:`mt-0.5 truncate text-[12px] text-gray-500 dark:text-dark-500`,children:[b(n.triggers,t.language,e),!x(n.triggers)&&n.nextRunAt&&(0,w.jsxs)(w.Fragment,{children:[` · `,e(`automations.nextRun`,{when:new Intl.DateTimeFormat(t.language,{month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`}).format(n.nextRunAt)})]})]})]}),(0,w.jsxs)(`div`,{ref:J===n.id?X:void 0,className:`relative shrink-0`,children:[(0,w.jsx)(`button`,{type:`button`,"aria-haspopup":`menu`,"aria-expanded":J===n.id,onClick:()=>Y(e=>e===n.id?null:n.id),"aria-label":e(`automations.actions`),"data-testid":`automation-menu`,className:`rounded-lg p-1.5 text-gray-400 transition-colors hover:bg-black/4 hover:text-gray-700 dark:hover:bg-white/6 dark:hover:text-dark-800`,children:(0,w.jsx)(re,{className:`h-4 w-4`})}),J===n.id&&(0,w.jsxs)(`div`,{role:`menu`,onKeyDown:le,className:`absolute inset-e-0 top-8 z-20 w-44 rounded-xl border border-black/[0.07] bg-white p-1 shadow-lg dark:border-white/8 dark:bg-dark-100`,children:[(0,w.jsx)(k,{icon:ae,label:e(`common.edit`),onClick:()=>fe(n)}),n.status===`active`?(0,w.jsx)(k,{icon:ie,label:e(`automations.pause`),onClick:()=>$(n,`pause`)}):(0,w.jsx)(k,{icon:ne,label:e(`automations.resume`),onClick:()=>$(n,`resume`)}),(0,w.jsx)(k,{icon:te,label:e(`automations.runNow`),onClick:()=>$(n,`run`)}),(0,w.jsx)(k,{icon:m,label:e(`common.delete`),destructive:!0,onClick:()=>$(n,`delete`)})]})]})]})},n.id))}):null,A===`automations`&&!R&&(0,w.jsxs)(`div`,{className:`mx-auto mt-8 w-full max-w-3xl`,children:[(0,w.jsx)(`p`,{className:`mb-2 text-[11px] font-medium uppercase tracking-wide text-gray-400 dark:text-dark-500`,children:e(`automations.templatesTitle`)}),(0,w.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:E.map(n=>(0,w.jsxs)(`button`,{type:`button`,onClick:()=>de(n),"data-testid":`automation-template`,className:`rounded-2xl border border-black/6 bg-white/40 px-4 py-3 text-start transition-colors hover:bg-white/80 dark:border-white/[0.07] dark:bg-dark-100/40 dark:hover:bg-dark-100/80`,children:[(0,w.jsx)(`p`,{className:`text-[13px] font-medium text-gray-900 dark:text-dark-900`,children:e(`automations.templates.${n.id}.name`)}),(0,w.jsx)(`p`,{className:`mt-0.5 text-[12px] text-gray-500 dark:text-dark-500`,children:e(`automations.templates.${n.id}.description`)}),(0,w.jsx)(`p`,{className:`mt-1.5 text-[11px] text-gray-400 dark:text-dark-500`,children:b(n.triggers,t.language,e)})]},n.id))})]}),A===`runs`&&(0,w.jsxs)(`div`,{className:`mx-auto w-full max-w-3xl space-y-4`,children:[I&&(0,w.jsx)(T,{days:I.days,locale:t.language}),P.length===0?(0,w.jsx)(v,{icon:f,size:`sm`,title:e(`automations.noRuns`)}):(0,w.jsx)(`div`,{className:`space-y-1`,"data-testid":`automation-run-list`,children:P.map(r=>(0,w.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl border border-black/5 bg-white/50 px-3 py-2 dark:border-white/6 dark:bg-dark-100/50`,children:[me(r),(0,w.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,w.jsx)(`p`,{className:`truncate text-[13px] text-gray-900 dark:text-dark-900`,children:he(r.automationId)}),(0,w.jsxs)(`p`,{className:`truncate text-[11px] text-gray-400 dark:text-dark-500`,children:[s(r.scheduledFor,t.language),r.error&&(0,w.jsxs)(w.Fragment,{children:[` · `,(0,w.jsx)(`span`,{className:`text-red-500`,children:r.error})]})]})]}),r.sessionId&&(0,w.jsx)(`button`,{onClick:()=>n(`/c/${r.sessionId}`),"data-testid":`automation-run-open`,className:`shrink-0 rounded-lg px-2.5 py-1 text-[12px] font-medium text-primary-600 transition-colors hover:bg-primary-500/10 dark:text-primary-400`,children:e(`automations.openChat`)}),r.workTaskId&&(0,w.jsx)(`button`,{onClick:()=>n(`/work/${r.workTaskId}`),"data-testid":`automation-run-open-task`,className:`shrink-0 rounded-lg px-2.5 py-1 text-[12px] font-medium text-primary-600 transition-colors hover:bg-primary-500/10 dark:text-primary-400`,children:e(`automations.openTask`)})]},r.id))})]})]}),(0,w.jsx)(S,{open:B,automation:H,initial:W,models:i,saving:K,onClose:()=>V(!1),onSave:e=>void pe(e)})]})};function k({icon:e,label:t,destructive:n,onClick:r}){return(0,w.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:r,className:c(`flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-start text-[13px] transition-colors`,n?`text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-900/20`:`text-gray-700 hover:bg-black/4 dark:text-dark-700 dark:hover:bg-white/6`),children:[(0,w.jsx)(e,{className:`h-3.5 w-3.5`}),t]})}export{O as default};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-vendor-CR5VJ85Q.js";import{t as r}from"./logger-BR4forr_.js";import{t as i}from"./useTranslation-Boi0fB1B.js";import{Or as a,c as o,n as s,p as c}from"./ui-vendor-6S05F84J.js";import{t as l}from"./Button-Dh2UJA-B.js";import"./ui-CI0OdG9q.js";var u=e(t(),1),d=n(),f=r(`components:avatar-upload`),p=({value:e,onChange:t,className:n=``})=>{let{t:r}=i(),p=(0,u.useRef)(null),[m,h]=(0,u.useState)(!1),[g,_]=(0,u.useState)(!1),v=async e=>{if(!e.type.startsWith(`image/`)){a.error(r(`user.avatar.invalidFile`));return}if(e.size>2097152){a.error(r(`user.avatar.fileTooLarge`));return}h(!0);try{let n=new FileReader;n.onload=e=>{let n=e.target?.result;t(n),a.success(r(`user.avatar.uploaded`))},n.onerror=()=>{a.error(r(`user.avatar.readFailed`))},n.readAsDataURL(e)}catch(e){f.error(`Failed to upload avatar:`,e),a.error(r(`user.avatar.uploadFailed`))}finally{h(!1)}},y=e=>{let t=e.target.files?.[0];t&&v(t)},b=e=>{e.preventDefault(),_(!0)},x=e=>{e.preventDefault(),_(!1)},S=e=>{e.preventDefault(),_(!1);let t=e.dataTransfer.files?.[0];t&&v(t)},C=()=>{t(``),a.success(r(`user.avatar.removed`))},w=()=>e||null;return(0,d.jsx)(`div`,{className:`space-y-4 ${n}`,children:(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`label`,{className:`block text-sm font-medium text-gray-700 dark:text-dark-600 mb-2`,children:r(`user.avatar.label`)}),(0,d.jsxs)(`div`,{className:`flex items-start gap-4`,children:[(0,d.jsx)(`div`,{className:`shrink-0`,children:(0,d.jsx)(`div`,{className:`w-20 h-20 rounded-full overflow-hidden bg-gray-100 dark:bg-dark-200 border-2 border-gray-300 dark:border-dark-300 flex items-center justify-center`,children:w()?(0,d.jsx)(`img`,{src:w(),alt:`Avatar preview`,className:`w-full h-full object-cover`}):(0,d.jsx)(o,{className:`h-8 w-8 text-gray-400 dark:text-gray-500`})})}),(0,d.jsxs)(`div`,{className:`flex-1 space-y-3`,children:[e?(0,d.jsxs)(`div`,{className:`flex items-center gap-3 p-3 bg-gray-50 dark:bg-dark-200 rounded-lg`,children:[(0,d.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,d.jsx)(`p`,{className:`text-sm font-medium text-gray-900 dark:text-gray-100 truncate`,children:r(`user.avatar.customAvatar`)}),(0,d.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400`,children:r(`user.avatar.clickToChange`)})]}),(0,d.jsx)(l,{variant:`ghost`,size:`sm`,onClick:C,className:`text-red-600 hover:text-red-700 hover:bg-red-50 dark:text-red-400 dark:hover:text-red-300 dark:hover:bg-red-900/20`,children:(0,d.jsx)(s,{className:`h-4 w-4`})})]}):(0,d.jsxs)(`div`,{className:`border-2 border-dashed rounded-lg p-4 text-center cursor-pointer transition-colors ${g?`border-primary-500 bg-primary-50 dark:bg-primary-900/20`:`border-gray-300 dark:border-gray-600 hover:border-gray-400 dark:hover:border-gray-500`}`,onDragOver:b,onDragLeave:x,onDrop:S,onClick:()=>p.current?.click(),children:[(0,d.jsx)(c,{className:`h-8 w-8 mx-auto text-gray-400 dark:text-gray-500 mb-2`}),(0,d.jsx)(`p`,{className:`text-sm font-medium text-gray-900 dark:text-gray-100 mb-2`,children:r(`user.avatar.uploadAvatarImage`)}),(0,d.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400 mb-2`,children:r(`user.avatar.dragAndDrop`)}),(0,d.jsxs)(l,{variant:`outline`,size:`sm`,disabled:m,className:`mx-auto`,children:[(0,d.jsx)(c,{className:`h-4 w-4 mr-2`}),r(m?`user.avatar.uploading`:`user.avatar.chooseImage`)]})]}),(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`label`,{className:`block text-xs font-medium text-gray-600 dark:text-gray-400 mb-1`,children:r(`user.avatar.enterImageUrl`)}),(0,d.jsx)(`input`,{type:`url`,value:e,onChange:e=>t(e.target.value),className:`w-full px-3 py-2 text-sm border border-gray-300 dark:border-dark-300 rounded-md bg-white dark:bg-dark-50 text-gray-900 dark:text-dark-800`,placeholder:`https://example.com/avatar.jpg`})]})]})]}),(0,d.jsx)(`input`,{ref:p,type:`file`,accept:`image/*`,onChange:y,className:`hidden`}),(0,d.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400 mt-2`,children:r(`user.avatar.supportedFormats`)})]})})};export{p as t};
@@ -0,0 +1 @@
1
+ import"./rolldown-runtime-hePW80VL.js";import{i as e,t}from"./react-vendor-CR5VJ85Q.js";import{t as n}from"./utils-B-Bhh1pF.js";e();var r=t(),i=({variant:e=`primary`,size:t=`md`,loading:i=!1,disabled:a,children:o,className:s,...c})=>(0,r.jsxs)(`button`,{className:n(`group relative inline-flex select-none items-center justify-center rounded-xl border font-medium tracking-[-0.01em] transition-[background-color,border-color,color,box-shadow,opacity] duration-150 ease-out focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary-500 focus-visible:ring-offset-2 focus-visible:ring-offset-canvas dark:focus-visible:ring-primary-400 disabled:cursor-not-allowed disabled:opacity-40 motion-reduce:transition-none`,{primary:`border-transparent bg-ink text-ink-inverse shadow-subtle hover:opacity-90`,secondary:`border-line bg-surface-raised text-ink shadow-subtle hover:border-line-strong hover:bg-surface-subtle`,outline:`border-line bg-transparent text-ink hover:border-line-strong hover:bg-surface-subtle`,ghost:`border-transparent bg-transparent text-ink-muted shadow-none hover:bg-surface-subtle hover:text-ink`,danger:`border-transparent bg-error-600 text-white shadow-subtle hover:bg-error-700 dark:bg-error-500 dark:text-ink-inverse dark:hover:bg-error-400`}[e],{sm:`h-8 px-3 text-sm gap-1.5`,md:`h-10 px-4 text-sm gap-2`,lg:`h-11 px-5 text-base gap-2.5`}[t],s),disabled:a||i,"aria-busy":i||void 0,...c,children:[i&&(0,r.jsxs)(`svg`,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`,fill:`none`,viewBox:`0 0 24 24`,children:[(0,r.jsx)(`circle`,{className:`opacity-25`,cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,strokeWidth:`4`}),(0,r.jsx)(`path`,{className:`opacity-75`,fill:`currentColor`,d:`M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z`})]}),o]});export{i as t};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,r as n,t as r}from"./react-vendor-CR5VJ85Q.js";import{d as i}from"./router-vendor-DqMnEJWK.js";import{t as a}from"./logger-BR4forr_.js";import{t as o}from"./useTranslation-Boi0fB1B.js";import{t as s}from"./utils-B-Bhh1pF.js";import{An as c,B as l,Bn as u,Gn as d,Or as f,Qn as p,Zn as m,g as h,n as g,p as _,tt as v,v as y}from"./ui-vendor-6S05F84J.js";import{t as b}from"./Button-Dh2UJA-B.js";import{t as x}from"./useDialogFocus-zSGHkpE4.js";import{i as S}from"./ui-CI0OdG9q.js";import{t as ee}from"./confirmStore-CKkUtP9c.js";import{O as C,T as w}from"./api-Dcz1G4Ib.js";import{t as T}from"./ShareDialog-DQskc17d.js";import{a as E,c as D,d as O,i as k,l as A,n as j,o as M,r as N,s as P,t as F,u as I}from"./calendarDates-Co3o_05Y.js";var L=e(t(),1),R=r(),z={event:`bg-primary-500/15 text-primary-700 hover:bg-primary-500/25 dark:text-primary-300`,automation:`bg-warning-500/15 text-ink hover:bg-warning-500/25`,runSucceeded:`bg-emerald-500/15 text-emerald-700 hover:bg-emerald-500/25 dark:text-emerald-300`,runFailed:`bg-red-500/15 text-red-700 hover:bg-red-500/25 dark:text-red-300`};function B({event:e,label:t,onClick:n}){let{t:r}=o(),i=e.variant===`automation`?{Icon:u,label:r(`calendar.chipStatus.automation`)}:e.variant===`runSucceeded`?{Icon:d,label:r(`calendar.chipStatus.runSucceeded`)}:e.variant===`runFailed`?{Icon:h,label:r(`calendar.chipStatus.runFailed`)}:null;return(0,R.jsxs)(`button`,{type:`button`,"data-testid":`calendar-event-chip`,"data-variant":e.variant??`event`,title:e.title,onClick:e=>{e.stopPropagation(),n()},className:s(`flex w-full items-center gap-1 rounded-md px-1.5 py-0.5 text-start text-[11px] leading-4 transition-colors`,z[e.variant??`event`],e.baseEventId&&`opacity-75`),children:[i&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(i.Icon,{className:`h-3 w-3 shrink-0`,"aria-hidden":`true`}),(0,R.jsx)(`span`,{className:`sr-only`,children:i.label})]}),(0,R.jsx)(`span`,{className:`min-w-0 truncate`,children:t})]})}var V=3;function te({year:e,monthIndex:t,events:n,onDayClick:r,onEventClick:i,onShowDay:a}){let{t:c,i18n:l}=o(),u=(0,L.useMemo)(()=>N(e,t),[e,t]),d=new Date,f=(0,L.useMemo)(()=>{let e=new Map;for(let t of n){let n=new Date(t.startAt),r=`${n.getFullYear()}-${n.getMonth()}-${n.getDate()}`,i=e.get(r);i?i.push(t):e.set(r,[t])}return e},[n]),p=(0,L.useMemo)(()=>O(l.language),[l.language]),m=(0,L.useMemo)(()=>new Intl.DateTimeFormat(l.language,{weekday:`long`,month:`long`,day:`numeric`,year:`numeric`}),[l.language]);return(0,R.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,"data-testid":`calendar-month-grid`,children:[(0,R.jsx)(`div`,{className:`grid grid-cols-7 border-b border-black/6 dark:border-white/[0.07]`,children:p.map(e=>(0,R.jsx)(`div`,{className:`px-2 py-1.5 text-center text-[11px] font-medium uppercase tracking-wide text-gray-400 dark:text-dark-500`,children:e},e))}),(0,R.jsx)(`div`,{className:`grid min-h-0 flex-1 grid-cols-7 grid-rows-6`,children:u.map(e=>{let n=e.getMonth()===t,o=k(e,d),u=`${e.getFullYear()}-${e.getMonth()}-${e.getDate()}`,p=f.get(u)??[],h=p.length-V;return(0,R.jsxs)(`div`,{role:`gridcell`,"data-testid":`calendar-day-cell`,onClick:()=>r(e),className:s(`flex min-h-0 cursor-pointer flex-col gap-0.5 border-b border-e border-black/4 p-1 transition-colors hover:bg-black/2 dark:border-white/4 dark:hover:bg-white/3`,!n&&`opacity-40`),children:[(0,R.jsx)(`button`,{type:`button`,"aria-label":c(`calendar.newEventOn`,{date:m.format(e)}),"aria-current":o?`date`:void 0,className:s(`flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-[12px]`,o?`bg-ink font-semibold text-ink-inverse`:`text-ink-muted`),children:e.getDate()}),(0,R.jsxs)(`div`,{className:`flex min-h-0 flex-col gap-0.5 overflow-hidden`,children:[p.slice(0,V).map(e=>(0,R.jsx)(B,{event:e,label:e.allDay?e.title:`${P(e.startAt,l.language)} ${e.title}`,onClick:()=>i(e)},e.id)),h>0&&(0,R.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),a?.(e)},title:c(`calendar.showDay`,{date:m.format(e)}),className:`rounded-sm px-1 text-start text-[10px] text-ink-muted hover:text-ink`,children:c(`calendar.more`,{n:h})})]})]},u)})})]})}var H=48;function ne({anchor:e,events:t,dayCount:n=7,onDayClick:r,onEventClick:i}){let{t:a,i18n:c}=o(),l=(0,L.useMemo)(()=>n===1?[new Date(e.getFullYear(),e.getMonth(),e.getDate())]:I(e),[e,n]),u=new Date,d=(0,L.useMemo)(()=>new Intl.DateTimeFormat(c.language,{hour:`numeric`}),[c.language]),f=(0,L.useMemo)(()=>new Intl.DateTimeFormat(c.language,{weekday:`long`,month:`long`,day:`numeric`,hour:`numeric`}),[c.language]),p=(0,L.useRef)(null),[m,h]=(0,L.useState)(`0-9`),g=(e,t,n)=>{let r=c.dir()===`rtl`?-1:1,i={ArrowRight:[r,0],ArrowLeft:[-r,0],ArrowDown:[0,1],ArrowUp:[0,-1]}[e.key];if(!i)return;let a=Math.min(l.length-1,Math.max(0,t+i[0])),o=Math.min(23,Math.max(0,n+i[1]));e.preventDefault();let s=`${a}-${o}`;h(s),p.current?.querySelector(`[data-slot="${s}"]`)?.focus()},_=(0,L.useMemo)(()=>new Intl.DateTimeFormat(c.language,{weekday:`short`,day:`numeric`}),[c.language]),v=e=>t.filter(t=>t.allDay&&k(new Date(t.startAt),e)),y=e=>t.filter(t=>!t.allDay&&k(new Date(t.startAt),e));return(0,R.jsx)(`div`,{className:`scroll-region min-h-0 flex-1 overflow-y-auto scrollbar-thin`,"data-testid":`calendar-week-grid`,children:(0,R.jsxs)(`div`,{ref:p,className:`grid grid-cols-[3.5rem_repeat(7,1fr)]`,children:[(0,R.jsx)(`div`,{className:`sticky top-0 z-10 border-b border-black/6 bg-surface dark:border-white/[0.07]`}),l.map(e=>(0,R.jsxs)(`div`,{className:`sticky top-0 z-10 border-b border-e border-black/6 bg-surface px-1 py-1.5 dark:border-white/[0.07]`,children:[(0,R.jsx)(`span`,{className:s(`block truncate text-center text-[11px] font-medium`,k(e,u)?`text-primary-600 dark:text-primary-400`:`text-gray-500 dark:text-dark-500`),children:_.format(e)}),(0,R.jsx)(`div`,{className:`mt-0.5 space-y-0.5`,children:v(e).map(e=>(0,R.jsx)(B,{event:e,label:e.title,onClick:()=>i(e)},e.id))})]},e.toISOString())),Array.from({length:24},(e,t)=>(0,R.jsxs)(L.Fragment,{children:[(0,R.jsx)(`div`,{className:`relative border-b border-black/4 pe-1.5 text-end text-[10px] text-gray-400 dark:border-white/4 dark:text-dark-500`,children:(0,R.jsx)(`span`,{className:`relative -top-1.5`,children:t>0?d.format(new Date(2024,0,1,t)):``})}),l.map((e,n)=>{let o=`${n}-${t}`,s=y(e).filter(e=>new Date(e.startAt).getHours()===t);return(0,R.jsxs)(`div`,{onClick:()=>r(e,t),style:{height:H},className:`relative cursor-pointer space-y-0.5 overflow-hidden border-b border-e border-black/4 p-0.5 transition-colors hover:bg-black/2 dark:border-white/4 dark:hover:bg-white/3`,children:[(0,R.jsx)(`button`,{type:`button`,"data-slot":o,tabIndex:m===o?0:-1,"aria-label":a(`calendar.newEventOn`,{date:f.format(new Date(e.getFullYear(),e.getMonth(),e.getDate(),t))}),onFocus:()=>h(o),onKeyDown:e=>g(e,n,t),className:`absolute inset-0 focus-visible:-outline-offset-2`}),s.map(e=>(0,R.jsx)(`div`,{className:`relative`,children:(0,R.jsx)(B,{event:e,label:`${P(e.startAt,c.language)} ${e.title}`,onClick:()=>i(e)})},e.id))]},`${e.toISOString()}-${t}`)})]},t))]})})}var U=n(),W=e=>!e||e.kind===`once`||e.kind===`hourly`||e.kind===`event`?`none`:e.kind,G=(e,t)=>{let n=new Date(t),r=n.getHours(),i=n.getMinutes();switch(e){case`daily`:return{kind:`daily`,hour:r,minute:i};case`weekly`:return{kind:`weekly`,dayOfWeek:n.getDay(),hour:r,minute:i};case`monthly`:return{kind:`monthly`,dayOfMonth:n.getDate(),hour:r,minute:i};case`yearly`:return{kind:`yearly`,month:n.getMonth()+1,dayOfMonth:n.getDate(),hour:r,minute:i};default:return null}},K=`w-full rounded-lg border border-black/8 bg-white px-2.5 py-1.5 text-[13px] text-gray-900 focus:border-primary-500 focus:outline-hidden focus:ring-2 focus:ring-primary-500/30 dark:border-white/8 dark:bg-dark-100 dark:text-dark-900`,q=`mb-1 block text-[11px] font-medium uppercase tracking-wide text-gray-400 dark:text-dark-500`;function re({open:e,event:t,initialStartAt:n,calendars:r,saving:i,onClose:a,onSave:o,onDelete:s}){return e?(0,R.jsx)(J,{event:t,initialStartAt:n,calendars:r,saving:i,onClose:a,onSave:o,onDelete:s},`${t?.id??`new`}:${n}`):null}function J({event:e,initialStartAt:t,calendars:n,saving:r,onClose:i,onSave:a,onDelete:s}){let{t:c}=o(),l=(0,L.useRef)(null);x(l,{onClose:i});let u=e?.startAt??t,[d,f]=(0,L.useState)(e?.title??``),[p,m]=(0,L.useState)(e?.notes??``),[h,_]=(0,L.useState)(D(u)),[v,b]=(0,L.useState)(e?A(u):`09:00`),[S,C]=(0,L.useState)(e?.endAt===void 0?``:A(e.endAt)),[w,T]=(0,L.useState)(e?.allDay??!1),[E,O]=(0,L.useState)(W(e?.recurrence)),[k,M]=(0,L.useState)(e?.calendarId??``),[N,P]=(0,L.useState)(e?.reminderMinutes===void 0?``:String(e.reminderMinutes)),F=()=>{if(!d.trim()||!h)return;let e=j(h,w?``:v),t=!w&&S?j(h,S):null;a({title:d.trim(),notes:p.trim()?p.trim():void 0,startAt:e,endAt:t!==null&&t>e?t:null,allDay:w,recurrence:G(E,e),calendarId:k||null,reminderMinutes:N?Number(N):null})},I=[{value:``,label:c(`calendar.reminderNone`)},{value:`5`,label:c(`calendar.reminderMinutes`,{minutes:5})},{value:`15`,label:c(`calendar.reminderMinutes`,{minutes:15})},{value:`30`,label:c(`calendar.reminderMinutes`,{minutes:30})},{value:`60`,label:c(`calendar.reminderHour`)},{value:`1440`,label:c(`calendar.reminderDay`)}],z=[{value:`none`,label:c(`calendar.repeatNone`)},{value:`daily`,label:c(`calendar.repeatDaily`)},{value:`weekly`,label:c(`calendar.repeatWeekly`)},{value:`monthly`,label:c(`calendar.repeatMonthly`)},{value:`yearly`,label:c(`calendar.repeatYearly`)}];return(0,U.createPortal)((0,R.jsx)(`div`,{className:`fixed inset-0 z-2147483647 flex items-center justify-center bg-gray-950/55 p-4 backdrop-blur-md`,onClick:i,children:(0,R.jsxs)(`div`,{ref:l,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`calendar-event-modal-title`,"data-testid":`calendar-event-modal`,className:`w-full max-w-md rounded-3xl border border-black/[0.07] bg-white p-6 shadow-[0_24px_80px_rgba(0,0,0,0.24)] animate-scale-in dark:border-white/8 dark:bg-dark-25`,onClick:e=>e.stopPropagation(),children:[(0,R.jsxs)(`div`,{className:`mb-4 flex items-center justify-between`,children:[(0,R.jsx)(`h3`,{id:`calendar-event-modal-title`,className:`text-lg font-medium tracking-[-0.02em] text-gray-950 dark:text-dark-950`,children:c(e?`calendar.editEvent`:`calendar.newEvent`)}),(0,R.jsx)(`button`,{type:`button`,onClick:i,"aria-label":c(`common.close`),className:`rounded-xl p-2 transition-colors hover:bg-gray-100 dark:hover:bg-dark-200`,children:(0,R.jsx)(g,{size:20,className:`text-gray-500`})})]}),(0,R.jsxs)(`div`,{className:`space-y-3`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`label`,{htmlFor:`calendar-event-title`,className:q,children:c(`calendar.eventTitle`)}),(0,R.jsx)(`input`,{id:`calendar-event-title`,"data-testid":`calendar-event-title`,type:`text`,value:d,onChange:e=>f(e.target.value),placeholder:c(`calendar.titlePlaceholder`),className:K,maxLength:200,autoFocus:!0})]}),(0,R.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`label`,{htmlFor:`calendar-event-date`,className:q,children:c(`calendar.date`)}),(0,R.jsx)(`input`,{id:`calendar-event-date`,type:`date`,value:h,onChange:e=>_(e.target.value),className:K})]}),(0,R.jsx)(`div`,{className:`flex items-end pb-1.5`,children:(0,R.jsxs)(`label`,{className:`flex items-center gap-2 text-[13px] text-gray-700 dark:text-dark-700`,children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:w,onChange:e=>T(e.target.checked),className:`h-4 w-4 rounded-sm accent-primary-500`}),c(`calendar.allDay`)]})})]}),!w&&(0,R.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`label`,{htmlFor:`calendar-event-start`,className:q,children:c(`calendar.start`)}),(0,R.jsx)(`input`,{id:`calendar-event-start`,type:`time`,value:v,onChange:e=>b(e.target.value),className:K})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`label`,{htmlFor:`calendar-event-end`,className:q,children:c(`calendar.end`)}),(0,R.jsx)(`input`,{id:`calendar-event-end`,type:`time`,value:S,onChange:e=>C(e.target.value),className:K})]})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`label`,{htmlFor:`calendar-event-repeat`,className:q,children:c(`calendar.repeat`)}),(0,R.jsx)(`select`,{id:`calendar-event-repeat`,value:E,onChange:e=>O(e.target.value),className:K,children:z.map(e=>(0,R.jsx)(`option`,{value:e.value,children:e.label},e.value))})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`label`,{htmlFor:`calendar-event-notes`,className:q,children:c(`calendar.notes`)}),(0,R.jsx)(`textarea`,{id:`calendar-event-notes`,value:p,onChange:e=>m(e.target.value),rows:3,className:K,maxLength:1e4})]}),(0,R.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`label`,{htmlFor:`calendar-event-calendar`,className:q,children:c(`calendar.calendarLabel`)}),(0,R.jsxs)(`select`,{id:`calendar-event-calendar`,value:k,onChange:e=>M(e.target.value),className:K,"data-testid":`calendar-event-calendar`,children:[(0,R.jsx)(`option`,{value:``,children:c(`calendar.personalCalendar`)}),n.map(e=>(0,R.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`label`,{htmlFor:`calendar-event-reminder`,className:q,children:c(`calendar.reminderLabel`)}),(0,R.jsx)(`select`,{id:`calendar-event-reminder`,value:N,onChange:e=>P(e.target.value),className:K,"data-testid":`calendar-event-reminder`,children:I.map(e=>(0,R.jsx)(`option`,{value:e.value,children:e.label},e.value))})]})]}),(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-t border-gray-200 pt-4 dark:border-dark-300`,children:[e&&s?(0,R.jsxs)(`button`,{type:`button`,onClick:async()=>{await ee({title:c(`calendar.deleteEventConfirmTitle`,{title:e.title}),description:e.recurrence?c(`calendar.deleteRecurringEventConfirmDescription`):c(`calendar.deleteEventConfirmDescription`),destructive:!0})&&s()},"data-testid":`calendar-event-delete`,className:`flex items-center gap-1.5 rounded-xl px-3 py-2 text-sm font-medium text-red-600 transition-colors hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-900/20`,children:[(0,R.jsx)(y,{className:`h-4 w-4`}),c(`common.delete`)]}):(0,R.jsx)(`span`,{}),(0,R.jsxs)(`div`,{className:`flex gap-3`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:i,className:`rounded-xl px-4 py-2 text-sm font-medium text-gray-700 transition-colors hover:bg-gray-100 dark:text-dark-700 dark:hover:bg-dark-200`,children:c(`common.cancel`)}),(0,R.jsx)(`button`,{type:`button`,onClick:F,disabled:r||!d.trim(),"data-testid":`calendar-event-save`,className:`rounded-xl bg-gray-950 px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-gray-800 disabled:cursor-not-allowed disabled:opacity-50 dark:bg-white dark:text-gray-950 dark:hover:bg-gray-100`,children:c(r?`common.saving`:`common.save`)})]})]})]})]})}),document.body)}var Y=a(`pages:calendar`),X=()=>{let{t:e,i18n:t}=o(),n=i(),[r,a]=(0,L.useState)(`month`),[u,d]=(0,L.useState)(()=>new Date),[h,y]=(0,L.useState)([]),[x,D]=(0,L.useState)([]),[O,k]=(0,L.useState)(!1),[A,j]=(0,L.useState)(null),[N,P]=(0,L.useState)(()=>Date.now()),[I,z]=(0,L.useState)(!1),[B,V]=(0,L.useState)([]),[H,U]=(0,L.useState)(``),[W,G]=(0,L.useState)(!1),[K,q]=(0,L.useState)(null),J=L.useRef(null),X=(0,L.useMemo)(()=>{if(r===`month`){let e=new Date(u.getFullYear(),u.getMonth(),1),t=M(e);return{from:t.getTime(),to:F(t,42).getTime()}}if(r===`day`){let e=new Date(u.getFullYear(),u.getMonth(),u.getDate());return{from:e.getTime(),to:F(e,1).getTime()}}let e=M(u);return{from:e.getTime(),to:F(e,7).getTime()}},[u,r]),[Z,ie]=(0,L.useState)(0),Q=(0,L.useCallback)(()=>ie(e=>e+1),[]);(0,L.useEffect)(()=>{C.getCalendars().then(t=>{t.success&&t.data?V(t.data):f.error(e(`calendar.loadFailed`))}).catch(t=>{Y.error(`Failed to load calendars:`,t),f.error(e(`calendar.loadFailed`))})},[Z,e]),(0,L.useEffect)(()=>{let t=!1;return C.getEvents(X.from,X.to).then(e=>{t||e.success&&e.data&&y(e.data)}).catch(n=>{t||(Y.error(`Failed to load calendar events:`,n),f.error(e(`calendar.loadFailed`)))}),Promise.all([w.getOccurrences(X.from,X.to),w.getRuns({from:X.from,to:X.to}),w.getAutomations()]).then(([n,r,i])=>{if(t)return;let a=Date.now(),o=t=>i.data?.find(e=>e.id===t)?.name??e(`automations.deletedAutomation`),s=[];for(let e of n.data??[])e.at<=a||s.push({id:`automation:${e.automationId}:${e.at}`,title:e.name,startAt:e.at,allDay:!1,createdAt:e.at,updatedAt:e.at,variant:`automation`});for(let e of r.data??[])(e.status===`succeeded`||e.status===`failed`)&&s.push({id:`run:${e.id}`,title:o(e.automationId),startAt:e.scheduledFor,allDay:!1,createdAt:e.createdAt,updatedAt:e.createdAt,variant:e.status===`succeeded`?`runSucceeded`:`runFailed`,...e.sessionId?{sessionId:e.sessionId}:{}});D(s)}).catch(e=>{t||Y.error(`Failed to project automations onto the calendar:`,e)}),()=>{t=!0}},[X.from,X.to,Z,e]);let ae=(0,L.useMemo)(()=>[...h,...x].sort((e,t)=>e.startAt-t.startAt),[h,x]),oe=e=>{d(t=>r===`month`?new Date(t.getFullYear(),t.getMonth()+e,1):F(t,e*(r===`day`?1:7)))},$=(e,t=9)=>{j(null),P(new Date(e.getFullYear(),e.getMonth(),e.getDate(),t,0).getTime()),k(!0)},se=t=>{if(t.variant===`runSucceeded`||t.variant===`runFailed`){t.sessionId?n(`/c/${t.sessionId}`):n(`/automations`);return}if(t.variant===`automation`){n(`/automations`);return}if(t.shared&&t.shared.permission!==`write`){f(e(`calendar.sharedReadOnly`));return}if(t.baseEventId){let e=h.find(e=>e.id===t.baseEventId);j(e??t)}else j(t);k(!0)},ce=async t=>{z(!0);try{let n=A?await C.updateEvent(A.id,t):await C.createEvent(t);n.success?(k(!1),Q()):f.error(n.error||e(`calendar.saveFailed`))}catch(t){Y.error(`Failed to save calendar event:`,t),f.error(e(`calendar.saveFailed`))}finally{z(!1)}},le=async()=>{if(A){z(!0);try{let t=await C.deleteEvent(A.id);t.success?(k(!1),Q()):f.error(t.error||e(`calendar.deleteFailed`))}catch(t){Y.error(`Failed to delete calendar event:`,t),f.error(e(`calendar.deleteFailed`))}finally{z(!1)}}},ue=r===`month`?E(u.getFullYear(),u.getMonth(),t.language):new Intl.DateTimeFormat(t.language,{month:`long`,day:`numeric`,year:`numeric`}).format(r===`day`?u:M(u)),de=async()=>{let t=H.trim();if(!t||W)return;G(!0);let n=await C.createCalendar({name:t}).catch(()=>void 0);G(!1),n?.success?(U(``),Q()):f.error(e(`calendar.calendarSaveFailed`))},fe=async t=>{if(await ee({title:e(`calendar.deleteCalendarConfirmTitle`,{name:t.name}),description:e(`calendar.deleteCalendarConfirmDescription`),destructive:!0}))try{let e=await C.deleteCalendar(t.id);if(!e.success)throw Error(e.error);Q()}catch(t){Y.error(`Failed to delete calendar:`,t),f.error(e(`calendar.calendarDeleteFailed`))}},pe=async t=>{try{let e=await C.exportIcs(t),n=URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=`calendar.ics`,r.click(),URL.revokeObjectURL(n)}catch(t){Y.error(`Failed to export the calendar:`,t),f.error(e(`calendar.exportFailed`))}},me=async t=>{try{let n=await t.text(),r=await C.importIcs(n);r.success&&r.data?(f.success(e(`calendar.importResult`,{total:r.data.imported})),Q()):f.error(r.error||e(`calendar.importFailed`))}catch(t){Y.error(`Failed to import the calendar:`,t),f.error(e(`calendar.importFailed`))}};return(0,R.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden`,"data-testid":`calendar-page`,children:[(0,R.jsx)(S,{title:e(`calendar.title`),actions:(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`div`,{className:`flex items-center rounded-xl bg-black/4 p-0.5 dark:bg-white/6`,children:[`month`,`week`,`day`].map(t=>(0,R.jsx)(`button`,{type:`button`,onClick:()=>a(t),"aria-pressed":r===t,"data-testid":`calendar-view-${t}`,className:s(`rounded-[10px] px-2.5 py-1 text-[12px] font-medium transition-colors focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary-500 focus-visible:ring-offset-2 focus-visible:ring-offset-canvas`,r===t?`bg-white text-gray-900 shadow-xs dark:bg-dark-200 dark:text-dark-900`:`text-gray-500 hover:text-gray-800 dark:text-dark-500 dark:hover:text-dark-800`),children:e(`calendar.${t}`)},t))}),(0,R.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[(0,R.jsx)(b,{size:`sm`,variant:`ghost`,onClick:()=>oe(-1),className:`h-7 w-7 p-0`,title:e(`calendar.previous`),"aria-label":e(`calendar.previous`),children:(0,R.jsx)(p,{className:`h-4 w-4 rtl:rotate-180`})}),(0,R.jsx)(b,{size:`sm`,variant:`ghost`,onClick:()=>d(new Date),className:`h-7 px-2 text-[12px]`,children:e(`calendar.today`)}),(0,R.jsx)(b,{size:`sm`,variant:`ghost`,onClick:()=>oe(1),className:`h-7 w-7 p-0`,title:e(`calendar.next`),"aria-label":e(`calendar.next`),children:(0,R.jsx)(m,{className:`h-4 w-4 rtl:rotate-180`})})]}),(0,R.jsxs)(b,{size:`sm`,onClick:()=>$(u),"data-testid":`calendar-new-event`,className:`h-7 gap-1 px-2.5 text-[12px]`,children:[(0,R.jsx)(v,{className:`h-3.5 w-3.5`}),e(`calendar.newEvent`)]})]}),children:(0,R.jsx)(`span`,{className:`text-sm text-ink-muted`,"data-testid":`calendar-range-label`,children:ue})}),(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 border-b border-black/6 px-4 py-2 dark:border-white/[0.07]`,children:[B.map(t=>(0,R.jsxs)(`span`,{className:`inline-flex max-w-full items-center gap-1.5 rounded-full border border-black/8 px-2.5 py-1 text-xs text-gray-700 dark:border-white/10 dark:text-dark-800`,"data-testid":`calendar-chip`,children:[(0,R.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full`,style:{backgroundColor:t.color??`#8b8b8b`}}),(0,R.jsx)(`span`,{className:`truncate`,title:t.name,children:t.name}),t.shared?(0,R.jsx)(`span`,{className:`text-[10px] uppercase text-gray-400 dark:text-dark-500`,children:e(`calendar.sharedBadge`)}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`button`,{type:`button`,onClick:()=>q(t),className:`-my-1.5 inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-full text-ink-muted hover:text-ink`,title:e(`calendar.shareCalendar`),"aria-label":e(`calendar.shareCalendarNamed`,{name:t.name}),"data-testid":`calendar-share`,children:(0,R.jsx)(l,{className:`h-3 w-3`})}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>void fe(t),className:`-my-1.5 inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-full text-ink-muted hover:text-error-700`,title:e(`common.delete`),"aria-label":e(`calendar.deleteCalendarNamed`,{name:t.name}),children:(0,R.jsx)(g,{className:`h-3 w-3`})})]})]},t.id)),(0,R.jsxs)(`form`,{className:`flex min-w-0 max-w-full items-center gap-1`,onSubmit:e=>{e.preventDefault(),de()},children:[(0,R.jsx)(`input`,{type:`text`,value:H,disabled:W,onChange:e=>U(e.target.value),placeholder:e(`calendar.newCalendarPlaceholder`),"aria-label":e(`calendar.newCalendarPlaceholder`),className:`min-w-0 w-36 rounded-full border border-dashed border-black/12 bg-transparent px-2.5 py-1 text-base text-gray-700 placeholder:text-gray-400 focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary-500 focus-visible:ring-offset-2 focus-visible:ring-offset-canvas dark:border-white/16 dark:text-dark-800 sm:text-xs`,"data-testid":`calendar-new-calendar`}),(0,R.jsx)(b,{type:`submit`,size:`sm`,variant:`ghost`,disabled:!H.trim(),loading:W,className:`h-7 shrink-0 px-2 text-xs`,"data-testid":`calendar-create-calendar`,children:e(`common.save`)})]}),(0,R.jsxs)(`div`,{className:`ms-auto flex items-center gap-1`,children:[(0,R.jsx)(`input`,{ref:J,type:`file`,accept:`.ics,text/calendar`,className:`hidden`,onChange:e=>{let t=e.target.files?.[0];t&&me(t),e.target.value=``}}),(0,R.jsxs)(b,{size:`sm`,variant:`ghost`,onClick:()=>J.current?.click(),className:`h-7 gap-1 px-2 text-[12px]`,"data-testid":`calendar-import`,children:[(0,R.jsx)(_,{className:`h-3.5 w-3.5`}),e(`calendar.importIcs`)]}),(0,R.jsxs)(b,{size:`sm`,variant:`ghost`,onClick:()=>void pe(),className:`h-7 gap-1 px-2 text-[12px]`,"data-testid":`calendar-export`,children:[(0,R.jsx)(c,{className:`h-3.5 w-3.5`}),e(`calendar.exportIcs`)]})]})]}),r===`month`?(0,R.jsx)(te,{year:u.getFullYear(),monthIndex:u.getMonth(),events:ae,onDayClick:e=>$(e),onEventClick:se,onShowDay:e=>{d(e),a(`day`)}}):(0,R.jsx)(ne,{anchor:u,events:ae,dayCount:r===`day`?1:7,onDayClick:(e,t)=>$(e,t),onEventClick:se}),K&&(0,R.jsx)(T,{resourceType:`calendar`,resourceId:K.id,resourceLabel:K.name,onClose:()=>q(null)}),(0,R.jsx)(re,{open:O,event:A,initialStartAt:N,calendars:B.filter(e=>!e.shared||e.shared.permission===`write`),saving:I,onClose:()=>k(!1),onSave:e=>void ce(e),onDelete:()=>void le()})]})};export{X as default};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-vendor-CR5VJ85Q.js";import{i as r}from"./router-vendor-DqMnEJWK.js";import{t as i}from"./logger-BR4forr_.js";import{t as a}from"./chatStore-CVTbkZyb.js";import{t as o}from"./useTranslation-Boi0fB1B.js";import{i as s,t as c}from"./utils-B-Bhh1pF.js";import{$n as l,At as u,Fn as d,H as ee,It as f,Or as p,Ot as m,Qt as h,Rt as te,W as g,Zn as _,at as ne,dr as re,er as v,n as y,r as ie,s as ae,st as b,tt as oe,ut as x,v as se,wn as ce,yr as le}from"./ui-vendor-6S05F84J.js";import{t as S}from"./Button-Dh2UJA-B.js";import{_ as C,g as w,i as ue,n as de,r as T,t as E,v as D}from"./ui-CI0OdG9q.js";import{t as O}from"./confirmStore-CKkUtP9c.js";import{D as k}from"./api-Dcz1G4Ib.js";import{t as fe}from"./authStore-COgKeTRv.js";import{t as pe}from"./teamEventStream-RNJYm84u.js";var A=e(t(),1),j=n(),me=[`👍`,`🎉`,`❤️`,`😄`,`👀`,`🚀`],M=180,N=({calls:e})=>{let{t}=o(),[n,r]=(0,A.useState)(!1),i=e.some(e=>e.status===`denied`);return(0,j.jsxs)(`div`,{className:`mt-1`,"data-testid":`channel-tool-calls`,children:[(0,j.jsxs)(`button`,{type:`button`,onClick:()=>r(e=>!e),"aria-expanded":n,className:`flex items-center gap-1 text-[11px] font-medium text-gray-500 hover:text-gray-700 dark:text-dark-600 dark:hover:text-dark-800`,"data-testid":`channel-tool-calls-toggle`,children:[n?(0,j.jsx)(l,{className:`h-3 w-3`}):(0,j.jsx)(_,{className:`h-3 w-3`}),(0,j.jsx)(ie,{className:`h-3 w-3`}),t(`channels.toolCalls.summary`,{total:e.length})]}),n&&(0,j.jsxs)(`div`,{className:`mt-1 space-y-1`,children:[e.map(e=>(0,j.jsxs)(`div`,{className:`rounded-lg border border-black/6 px-2 py-1 dark:border-white/8`,"data-testid":`channel-tool-call`,children:[(0,j.jsxs)(`div`,{className:`flex items-baseline gap-1.5`,children:[(0,j.jsx)(`span`,{dir:`ltr`,className:`min-w-0 truncate text-[11px] font-medium text-gray-700 dark:text-dark-800`,children:e.name}),(0,j.jsx)(`span`,{className:c(`shrink-0 text-[10px]`,e.status===`succeeded`?`text-emerald-600 dark:text-emerald-400`:e.status===`denied`?`text-amber-600 dark:text-amber-400`:e.status===`failed`?`text-red-500`:`text-gray-400 dark:text-dark-500`),children:t(`tools.callStatus.${e.status}`)})]}),e.resultPreview&&(0,j.jsx)(`p`,{dir:`ltr`,className:`mt-0.5 whitespace-pre-wrap wrap-break-word font-mono text-[10px] leading-snug text-gray-500 dark:text-dark-600`,children:e.resultPreview.slice(0,M)})]},e.id)),i&&(0,j.jsx)(`p`,{className:`text-[10px] text-gray-400 dark:text-dark-500`,children:t(`channels.toolCalls.deniedHint`)})]})]})},P=({message:e,currentUserId:t,canModerate:n,actions:r,compact:i=!1})=>{let{t:a,i18n:l}=o(),[u,d]=(0,A.useState)(!1),[ee,f]=(0,A.useState)(e.content),[p,h]=(0,A.useState)(!1),g=e.authorKind===`model`,_=!g&&e.author?.userId===t&&!e.deleted,ie=g?e.model??a(`channels.modelAuthor`):e.author?.username??a(`channels.unknownAuthor`);return(0,j.jsxs)(`div`,{className:c(`group relative rounded-xl px-2.5 py-1.5 hover:bg-black/2.5 dark:hover:bg-white/3`,i&&`px-2 py-1`),"data-testid":`channel-message`,children:[(0,j.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[g&&(0,j.jsx)(re,{className:`h-3.5 w-3.5 shrink-0 self-center text-primary-500`}),(0,j.jsx)(`span`,{className:c(`shrink-0 text-[13px] font-semibold`,g?`text-primary-600 dark:text-primary-400`:`text-gray-900 dark:text-dark-900`),children:ie}),(0,j.jsx)(`span`,{className:`shrink-0 text-[11px] text-gray-400 dark:text-dark-500`,children:s(e.createdAt,l.language)}),e.editedAt&&!e.deleted&&(0,j.jsx)(`span`,{className:`shrink-0 text-[10px] text-gray-400 dark:text-dark-500`,children:a(`channels.edited`)}),e.pinnedAt&&(0,j.jsx)(ne,{role:`img`,"aria-label":a(`channels.pins`),className:`h-3 w-3 shrink-0 text-amber-500`})]}),e.deleted?(0,j.jsx)(`p`,{className:`text-[13px] italic text-gray-400 dark:text-dark-500`,children:a(`channels.deletedMessage`)}):u?(0,j.jsxs)(`div`,{className:`mt-1 flex items-end gap-1.5`,children:[(0,j.jsx)(`textarea`,{value:ee,onChange:e=>f(e.target.value),rows:2,"aria-label":a(`channels.edit`),className:`min-w-0 flex-1 resize-none rounded-lg border border-black/8 bg-transparent px-2 py-1 text-[13px] focus:border-primary-500 focus:outline-hidden focus:ring-2 focus:ring-primary-500/30 dark:border-white/10 dark:text-dark-900`,"data-testid":`channel-message-edit`}),(0,j.jsx)(`button`,{type:`button`,onClick:()=>{r.onEdit(e,ee),d(!1)},"aria-label":a(`channels.confirmEdit`),title:a(`channels.confirmEdit`),className:`rounded-md p-1.5 text-emerald-600 hover:bg-emerald-50 dark:hover:bg-emerald-900/20`,children:(0,j.jsx)(v,{className:`h-3.5 w-3.5`})}),(0,j.jsx)(`button`,{type:`button`,onClick:()=>d(!1),"aria-label":a(`channels.cancelEdit`),title:a(`channels.cancelEdit`),className:`rounded-md p-1.5 text-gray-400 hover:bg-black/4 dark:hover:bg-white/6`,children:(0,j.jsx)(y,{className:`h-3.5 w-3.5`})})]}):(0,j.jsxs)(j.Fragment,{children:[e.pending?(0,j.jsxs)(`p`,{className:`flex items-center gap-1.5 text-[13px] text-gray-400 dark:text-dark-500`,children:[(0,j.jsx)(te,{className:`h-3.5 w-3.5 animate-spin`}),a(`channels.modelThinking`)]}):e.error?(0,j.jsx)(`p`,{className:`text-[13px] text-red-500`,children:e.error}):(0,j.jsx)(`p`,{className:`whitespace-pre-wrap wrap-break-word text-[13px] leading-relaxed text-gray-800 dark:text-dark-800`,children:e.content}),g&&(e.toolCalls?.length??0)>0&&(0,j.jsx)(N,{calls:e.toolCalls}),(e.attachments?.length??0)>0&&(0,j.jsx)(`div`,{className:`mt-1 space-y-1`,children:e.attachments.map(e=>(0,j.jsxs)(`button`,{type:`button`,onClick:()=>void r.onDownload(e.id,e.filename),className:`flex items-center gap-1.5 rounded-lg border border-black/6 px-2 py-1 text-[12px] text-gray-600 hover:bg-black/3 dark:border-white/8 dark:text-dark-700 dark:hover:bg-white/4`,"data-testid":`channel-attachment`,children:[(0,j.jsx)(x,{className:`h-3 w-3`}),(0,j.jsx)(`span`,{className:`min-w-0 truncate`,children:e.filename})]},e.id))})]}),(e.reactions?.length??0)>0&&(0,j.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1`,children:e.reactions.map(t=>(0,j.jsxs)(`button`,{type:`button`,"aria-pressed":t.mine,onClick:()=>void r.onReact(e,t.emoji,t.mine),className:c(`rounded-full border px-1.5 py-0.5 text-[11px]`,t.mine?`border-primary-400/50 bg-primary-500/10 text-primary-600 dark:text-primary-400`:`border-black/8 text-gray-600 hover:bg-black/3 dark:border-white/10 dark:text-dark-700`),"data-testid":`channel-reaction`,children:[t.emoji,` `,t.count]},t.emoji))}),!i&&(e.replyCount??0)>0&&r.onReply&&(0,j.jsxs)(`button`,{type:`button`,onClick:()=>r.onReply(e),className:`mt-1 flex items-center gap-1 text-[11px] font-medium text-primary-600 hover:underline dark:text-primary-400`,"data-testid":`channel-reply-count`,children:[(0,j.jsx)(m,{className:`h-3 w-3`}),a(`channels.replyCount`,{total:e.replyCount})]}),!e.deleted&&!u&&(0,j.jsxs)(`div`,{className:`absolute -top-2.5 inset-e-2 hidden items-center gap-0.5 rounded-lg border border-black/8 bg-white px-1 py-0.5 shadow-xs group-focus-within:flex group-hover:flex [@media(hover:none)]:flex dark:border-white/10 dark:bg-dark-50`,children:[(0,j.jsxs)(`div`,{className:`relative`,children:[(0,j.jsx)(`button`,{type:`button`,onClick:()=>h(e=>!e),className:`rounded-sm p-1 text-gray-400 hover:text-gray-700 dark:hover:text-dark-800`,title:a(`channels.react`),"aria-label":a(`channels.react`),"aria-haspopup":`true`,"aria-expanded":p,"data-testid":`channel-react`,children:(0,j.jsx)(ce,{className:`h-3.5 w-3.5`})}),p&&(0,j.jsx)(`div`,{className:`absolute inset-e-0 top-6 z-10 flex gap-0.5 rounded-lg border border-black/8 bg-white p-1 shadow-md dark:border-white/10 dark:bg-dark-50`,children:me.map(t=>(0,j.jsx)(`button`,{type:`button`,onClick:()=>{let n=!!e.reactions?.find(e=>e.emoji===t)?.mine;r.onReact(e,t,n),h(!1)},"aria-label":a(`channels.reactWith`,{emoji:t}),className:`rounded-sm p-0.5 text-sm hover:bg-black/5 dark:hover:bg-white/8`,children:t},t))})]}),r.onReply&&!e.parentId&&(0,j.jsx)(`button`,{type:`button`,onClick:()=>r.onReply(e),className:`rounded-sm p-1 text-gray-400 hover:text-gray-700 dark:hover:text-dark-800`,title:a(`channels.reply`),"aria-label":a(`channels.reply`),"data-testid":`channel-reply`,children:(0,j.jsx)(m,{className:`h-3.5 w-3.5`})}),(0,j.jsx)(`button`,{type:`button`,onClick:()=>void r.onPin(e),className:`rounded-sm p-1 text-gray-400 hover:text-amber-500`,title:e.pinnedAt?a(`channels.unpin`):a(`channels.pin`),"aria-label":e.pinnedAt?a(`channels.unpin`):a(`channels.pin`),"data-testid":`channel-pin`,children:(0,j.jsx)(ne,{className:`h-3.5 w-3.5`})}),_&&(0,j.jsx)(`button`,{type:`button`,onClick:()=>{f(e.content),d(!0)},className:`rounded-sm p-1 text-gray-400 hover:text-gray-700 dark:hover:text-dark-800`,title:a(`channels.edit`),"aria-label":a(`channels.edit`),"data-testid":`channel-edit`,children:(0,j.jsx)(b,{className:`h-3.5 w-3.5`})}),(_||n)&&(0,j.jsx)(`button`,{type:`button`,onClick:async()=>{await O({title:a(`channels.deleteMessageConfirmTitle`),description:a(`channels.deleteMessageConfirmDescription`),destructive:!0})&&await r.onDelete(e)},className:`rounded-sm p-1 text-gray-400 hover:text-red-500`,title:a(`channels.deleteMessage`),"aria-label":a(`channels.deleteMessage`),"data-testid":`channel-delete-message`,children:(0,j.jsx)(se,{className:`h-3.5 w-3.5`})})]})]})},F=i(`pages:channels`),he=e=>e.type===`dm`?(0,j.jsx)(u,{className:`h-3.5 w-3.5 shrink-0`}):e.type===`private`?(0,j.jsx)(f,{className:`h-3.5 w-3.5 shrink-0`}):(0,j.jsx)(h,{className:`h-3.5 w-3.5 shrink-0`}),I=e=>e.type===`dm`?e.dmPeer?.username??`…`:e.name,ge=()=>{let{t:e}=o(),t=fe(e=>e.user),n=a(e=>e.models),[i,s]=(0,A.useState)([]),[l,f]=(0,A.useState)(null),[_,v]=(0,A.useState)(!1),[ie,b]=(0,A.useState)(!1),[se,ce]=(0,A.useState)(!0),[C,w]=(0,A.useState)(null),[E,D]=(0,A.useState)(null),[me,M]=(0,A.useState)([]),[N,ge]=(0,A.useState)([]),[L,R]=(0,A.useState)(null),[z,xe]=(0,A.useState)(null),[Se,Ce]=(0,A.useState)([]),[B,we]=(0,A.useState)(``),[V,Te]=(0,A.useState)(``),[H,Ee]=(0,A.useState)(!1),[U,De]=(0,A.useState)(null),[Oe,ke]=(0,A.useState)(!1),[Ae,je]=(0,A.useState)(!1),[W,Me]=(0,A.useState)(``),[Ne,G]=(0,A.useState)(!1),Pe=(0,A.useRef)(null),Fe=(0,A.useRef)(null),[Ie,Le]=r(),K=(0,A.useMemo)(()=>i.find(e=>e.id===C)??null,[i,C]),[Re,ze]=(0,A.useState)(null);C!==Re&&(ze(C),D(null),xe(null),R(null));let q=K?.role===`owner`,J=(0,A.useCallback)(()=>{k.listMine().then(e=>{e.success&&e.data&&s(e.data)}).catch(e=>F.error(`Failed to load channels:`,e)).finally(()=>ce(!1))},[]);(0,A.useEffect)(()=>{J();let e=window.setInterval(J,3e4);return()=>window.clearInterval(e)},[J]);let Y=Ie.get(`channel`);Y&&C!==Y&&w(Y),(0,A.useEffect)(()=>{Y&&Le({},{replace:!0})},[Y,Le]);let X=(0,A.useRef)(null);(0,A.useLayoutEffect)(()=>(X.current=C?{channelId:C,requestId:0}:null,()=>{X.current=null}),[C]);let Z=(0,A.useCallback)(t=>{let n=X.current;if(!n||n.channelId!==t)return;let r=++n.requestId;k.listMessages(t,{limit:100}).then(e=>{X.current===n&&n.requestId===r&&e.success&&e.data&&D(e.data)}).catch(t=>{F.error(`Failed to load messages:`,t),p.error(e(`channels.loadFailed`),{id:`channels-load-failed`})})},[e]),Be=(0,A.useRef)(null);(0,A.useEffect)(()=>{Be.current=z},[z]);let Ve=(0,A.useCallback)(e=>{Z(e),k.markRead(e);let t=Be.current;t&&k.thread(t).then(e=>{e.success&&e.data&&Ce(e.data)}).catch(e=>F.error(`Failed to refresh thread:`,e))},[Z]);(0,A.useEffect)(()=>{if(!C)return;Z(C),k.markRead(C).then(J);let e=new AbortController;return pe({path:`/channels/${C}/events`,signal:e.signal,onEvent:()=>Ve(C)}),()=>e.abort()},[C,Z,J,Ve]);let He=E?.length??0;(0,A.useEffect)(()=>{let e=Fe.current;e&&(e.scrollTop=e.scrollHeight)},[He,C]),(0,A.useEffect)(()=>{if(!C||!L)return;let t=t=>{F.error(`Failed to load channel panel:`,t),p.error(e(`channels.loadFailed`))};L===`members`?k.listMembers(C).then(e=>{e.success&&e.data?M(e.data):t(e.error)}).catch(t):k.listPins(C).then(e=>{e.success&&e.data?ge(e.data):t(e.error)}).catch(t)},[C,L,e]),(0,A.useEffect)(()=>{z&&k.thread(z).then(t=>{t.success&&t.data?Ce(t.data):p.error(e(`channels.loadFailed`))}).catch(t=>{F.error(`Failed to load thread:`,t),p.error(e(`channels.loadFailed`))})},[z,e]);let Ue=()=>{v(!0),b(!1),k.listPublic().then(e=>{e.success&&e.data?f(e.data):b(!0)}).catch(e=>{F.error(`Failed to load public channels:`,e),b(!0)})},Q=async t=>{if(!C||H)return;let n=B.trim();if(n||U){Ee(!0);try{let r=await k.postMessage(C,{content:n,...t?{parentId:t}:{},...U?{attachmentIds:[U.id]}:{},...V?{mentionModel:V}:{}});if(r.success){if(we(``),De(null),Te(``),Z(C),t){let e=await k.thread(t);e.success&&e.data&&Ce(e.data)}}else p.error(r.error||e(`channels.sendFailed`))}catch(t){F.error(`Failed to send message:`,t),p.error(e(`channels.sendFailed`))}finally{Ee(!1)}}},We=async t=>{if(C)try{let n=await k.uploadAttachment(C,t);n.success&&n.data?De({id:n.data.id,filename:n.data.filename}):p.error(n.error||e(`channels.uploadFailed`))}catch(t){F.error(`Failed to upload attachment:`,t),p.error(e(`channels.uploadFailed`))}},Ge=async()=>{if(C&&W.trim()){if((await k.addMember(C,W.trim()).catch(()=>void 0))?.success){Me(``);let t=await k.listMembers(C).catch(()=>void 0);t?.success&&t.data&&M(t.data),p.success(e(`channels.memberAdded`))}else p.error(e(`channels.memberAddFailed`))}},Ke={onReply:e=>xe(e.id),onEdit:async(t,n)=>{(await k.editMessage(t.id,n).catch(()=>void 0))?.success?C&&Z(C):p.error(e(`channels.editFailed`))},onDelete:async t=>{(await k.deleteMessage(t.id).catch(()=>void 0))?.success?C&&Z(C):p.error(e(`channels.deleteMessageFailed`))},onPin:async t=>{(await k.setPinned(t.id,!t.pinnedAt).catch(()=>void 0))?.success||p.error(e(`channels.pinFailed`)),C&&Z(C)},onReact:async(t,n,r)=>{(await(r?k.removeReaction(t.id,n):k.addReaction(t.id,n)).catch(()=>void 0))?.success||p.error(e(`channels.reactFailed`)),C&&Z(C)},onDownload:async(t,n)=>{try{let e=await k.downloadAttachment(t),r=URL.createObjectURL(e),i=document.createElement(`a`);i.href=r,i.download=n,i.click(),URL.revokeObjectURL(r)}catch(t){F.error(`Failed to download attachment:`,t),p.error(e(`channels.downloadFailed`))}}},$=Se[0];return(0,j.jsxs)(`div`,{className:`flex h-full min-h-0`,children:[(0,j.jsxs)(`aside`,{className:c(`flex w-64 shrink-0 flex-col border-e border-black/6 dark:border-white/6`,C?`hidden md:flex`:`flex`),"data-testid":`channel-rail`,children:[(0,j.jsx)(ue,{title:e(`channels.title`),className:`gap-y-1 px-3`,actions:(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`button`,{type:`button`,onClick:Ue,title:e(`channels.browsePublic`),"aria-label":e(`channels.browsePublic`),className:`rounded-md p-1.5 text-gray-500 hover:bg-black/4 dark:text-dark-600 dark:hover:bg-white/6`,"data-testid":`channels-browse`,children:(0,j.jsx)(d,{className:`h-4 w-4`})}),(0,j.jsx)(`button`,{type:`button`,onClick:()=>je(!0),title:e(`channels.newDm`),"aria-label":e(`channels.newDm`),className:`rounded-md p-1.5 text-gray-500 hover:bg-black/4 dark:text-dark-600 dark:hover:bg-white/6`,"data-testid":`channels-new-dm`,children:(0,j.jsx)(u,{className:`h-4 w-4`})}),(0,j.jsx)(`button`,{type:`button`,onClick:()=>ke(!0),title:e(`channels.newChannel`),"aria-label":e(`channels.newChannel`),className:`rounded-md p-1.5 text-gray-500 hover:bg-black/4 dark:text-dark-600 dark:hover:bg-white/6`,"data-testid":`channels-new`,children:(0,j.jsx)(oe,{className:`h-4 w-4`})})]})}),(0,j.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-2 pb-3 scrollbar-thin`,children:se?(0,j.jsx)(de,{size:`sm`,srOnly:!0}):i.length===0?(0,j.jsx)(T,{icon:h,size:`sm`,title:e(`channels.empty`)}):i.map(t=>(0,j.jsxs)(`button`,{type:`button`,onClick:()=>w(t.id),className:c(`flex w-full items-center gap-2 rounded-lg px-2 py-1.5 text-start text-[13px]`,C===t.id?`bg-black/5 text-gray-900 dark:bg-white/8 dark:text-dark-900`:`text-gray-600 hover:bg-black/3 dark:text-dark-700 dark:hover:bg-white/4`),"data-testid":`channel-item`,children:[he(t),(0,j.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:I(t)}),(t.unreadCount??0)>0&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`span`,{className:`rounded-full bg-primary-600 px-1.5 text-[10px] font-semibold leading-4 text-white`,"data-testid":`channel-unread`,"aria-hidden":`true`,children:t.unreadCount}),(0,j.jsx)(`span`,{className:`sr-only`,children:e(`channels.unreadCount`,{total:t.unreadCount})})]})]},t.id))})]}),(0,j.jsx)(`main`,{className:`flex min-w-0 flex-1 flex-col`,children:K?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`header`,{className:`flex items-center gap-2 border-b border-black/6 px-4 py-2.5 dark:border-white/6`,children:[(0,j.jsx)(`button`,{type:`button`,onClick:()=>w(null),"aria-label":e(`common.back`),title:e(`common.back`),className:`rounded-md p-1 text-gray-500 hover:bg-black/4 md:hidden dark:text-dark-600`,children:(0,j.jsx)(le,{className:`h-4 w-4 rtl:rotate-180`})}),he(K),(0,j.jsx)(`h2`,{className:`min-w-0 flex-1 truncate text-sm font-semibold text-gray-900 dark:text-dark-900`,"data-testid":`channel-title`,children:I(K)}),(0,j.jsx)(`button`,{type:`button`,onClick:()=>R(L===`pins`?null:`pins`),title:e(`channels.pins`),"aria-label":e(`channels.pins`),"aria-pressed":L===`pins`,className:`rounded-md p-1.5 text-gray-500 hover:bg-black/4 dark:text-dark-600 dark:hover:bg-white/6`,"data-testid":`channel-pins-toggle`,children:(0,j.jsx)(ne,{className:`h-4 w-4`})}),(0,j.jsx)(`button`,{type:`button`,onClick:()=>R(L===`members`?null:`members`),title:e(`channels.members`),"aria-label":e(`channels.members`),"aria-pressed":L===`members`,className:`rounded-md p-1.5 text-gray-500 hover:bg-black/4 dark:text-dark-600 dark:hover:bg-white/6`,"data-testid":`channel-members-toggle`,children:(0,j.jsx)(ae,{className:`h-4 w-4`})}),q&&K.type!==`dm`&&(0,j.jsx)(`button`,{type:`button`,onClick:()=>G(!0),title:e(`channels.settings`),"aria-label":e(`channels.settings`),className:`rounded-md p-1.5 text-gray-500 hover:bg-black/4 dark:text-dark-600 dark:hover:bg-white/6`,"data-testid":`channel-settings`,children:(0,j.jsx)(ee,{className:`h-4 w-4`})})]}),(0,j.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[(0,j.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,j.jsx)(`div`,{ref:Fe,className:`min-h-0 flex-1 space-y-1 overflow-y-auto px-4 py-3 scrollbar-thin`,"data-testid":`channel-timeline`,children:E===null?(0,j.jsx)(de,{size:`sm`,srOnly:!0}):E.length===0?(0,j.jsx)(T,{icon:m,size:`sm`,title:e(`channels.noMessages`)}):E.map(e=>(0,j.jsx)(P,{message:e,currentUserId:t?.id,canModerate:q,actions:Ke},e.id))}),(0,j.jsxs)(`div`,{className:`border-t border-black/6 p-3 dark:border-white/6`,children:[U&&(0,j.jsxs)(`div`,{className:`mb-2 flex items-center gap-2 rounded-lg border border-black/6 px-2.5 py-1.5 text-xs text-gray-600 dark:border-white/8 dark:text-dark-700`,children:[(0,j.jsx)(x,{className:`h-3.5 w-3.5`}),(0,j.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:U.filename}),(0,j.jsx)(`button`,{type:`button`,onClick:()=>De(null),"aria-label":e(`channels.removeAttachment`),title:e(`channels.removeAttachment`),className:`rounded-sm p-0.5 text-gray-500 hover:text-red-500`,children:(0,j.jsx)(y,{className:`h-3.5 w-3.5`})})]}),(0,j.jsxs)(`div`,{className:`flex items-end gap-1.5`,children:[(0,j.jsx)(`input`,{ref:Pe,type:`file`,className:`hidden`,onChange:e=>{let t=e.target.files?.[0];t&&We(t),e.target.value=``}}),(0,j.jsx)(`button`,{type:`button`,onClick:()=>Pe.current?.click(),title:e(`channels.attach`),"aria-label":e(`channels.attach`),className:`rounded-md p-2 text-gray-500 hover:bg-black/4 dark:text-dark-600 dark:hover:bg-white/6`,"data-testid":`channel-attach`,children:(0,j.jsx)(x,{className:`h-4 w-4`})}),(0,j.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,j.jsx)(re,{className:c(`h-4 w-4`,V?`text-primary-500`:`text-gray-400 dark:text-dark-500`)}),(0,j.jsxs)(`select`,{value:V,onChange:e=>Te(e.target.value),className:`max-w-[130px] rounded-md border border-black/8 bg-transparent px-1 py-1 text-[11px] text-gray-600 focus:border-primary-500 focus:outline-hidden focus:ring-2 focus:ring-primary-500/30 dark:border-white/10 dark:bg-dark-100 dark:text-dark-700`,title:e(`channels.askModel`),"aria-label":e(`channels.askModel`),"data-testid":`channel-mention-model`,children:[(0,j.jsx)(`option`,{value:``,children:e(`channels.noModel`)}),n.map(e=>(0,j.jsx)(`option`,{value:e.name,children:e.name},e.name))]})]}),(0,j.jsx)(`textarea`,{value:B,onChange:e=>we(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),Q())},rows:1,placeholder:e(`channels.composerPlaceholder`),"aria-label":e(`channels.composerPlaceholder`),className:`max-h-32 min-w-0 flex-1 resize-none rounded-xl border border-black/8 bg-transparent px-3 py-2 text-[13px] text-gray-900 placeholder:text-gray-400 focus:border-primary-500 focus:outline-hidden focus:ring-2 focus:ring-primary-500/30 dark:border-white/10 dark:text-dark-900`,"data-testid":`channel-composer`}),(0,j.jsx)(S,{size:`sm`,disabled:H||!B.trim()&&!U,onClick:()=>void Q(),"aria-label":e(`channels.send`),title:e(`channels.send`),"data-testid":`channel-send`,children:H?(0,j.jsx)(te,{className:`h-4 w-4 animate-spin`}):(0,j.jsx)(g,{className:`h-4 w-4`})})]})]})]}),z&&(0,j.jsxs)(`aside`,{className:`flex w-80 shrink-0 flex-col border-s border-black/6 dark:border-white/6`,"data-testid":`channel-thread`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-black/6 px-3 py-2 dark:border-white/6`,children:[(0,j.jsx)(`span`,{className:`flex-1 text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-dark-600`,children:e(`channels.thread`)}),(0,j.jsx)(`button`,{type:`button`,onClick:()=>xe(null),"aria-label":e(`channels.closeThread`),title:e(`channels.closeThread`),className:`rounded-md p-1 text-gray-400 hover:bg-black/4 dark:hover:bg-white/6`,children:(0,j.jsx)(y,{className:`h-3.5 w-3.5`})})]}),(0,j.jsx)(`div`,{className:`min-h-0 flex-1 space-y-1 overflow-y-auto px-3 py-2 scrollbar-thin`,children:Se.map(e=>(0,j.jsx)(P,{message:e,currentUserId:t?.id,canModerate:q,actions:{...Ke,onReply:void 0},compact:!0},e.id))}),(0,j.jsxs)(`div`,{className:`flex items-end gap-1.5 border-t border-black/6 p-2 dark:border-white/6`,children:[(0,j.jsx)(`textarea`,{value:B,onChange:e=>we(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),$&&Q($.id))},rows:1,placeholder:e(`channels.replyPlaceholder`),"aria-label":e(`channels.replyPlaceholder`),className:`min-w-0 flex-1 resize-none rounded-lg border border-black/8 bg-transparent px-2.5 py-1.5 text-[13px] text-gray-900 focus:border-primary-500 focus:outline-hidden focus:ring-2 focus:ring-primary-500/30 dark:border-white/10 dark:text-dark-900`,"data-testid":`channel-thread-composer`}),(0,j.jsx)(S,{size:`sm`,disabled:H||!B.trim(),onClick:()=>$&&void Q($.id),"aria-label":e(`channels.send`),title:e(`channels.send`),children:(0,j.jsx)(g,{className:`h-3.5 w-3.5`})})]})]}),L&&(0,j.jsxs)(`aside`,{className:`flex w-72 shrink-0 flex-col border-s border-black/6 dark:border-white/6`,"data-testid":`channel-${L}-panel`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-black/6 px-3 py-2 dark:border-white/6`,children:[(0,j.jsx)(`span`,{className:`flex-1 text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-dark-600`,children:e(L===`members`?`channels.members`:`channels.pins`)}),(0,j.jsx)(`button`,{type:`button`,onClick:()=>R(null),"aria-label":e(`common.close`),title:e(`common.close`),className:`rounded-md p-1 text-gray-400 hover:bg-black/4 dark:hover:bg-white/6`,children:(0,j.jsx)(y,{className:`h-3.5 w-3.5`})})]}),(0,j.jsx)(`div`,{className:`min-h-0 flex-1 space-y-1.5 overflow-y-auto px-3 py-2 scrollbar-thin`,children:L===`members`?(0,j.jsxs)(j.Fragment,{children:[q&&K.type===`private`&&(0,j.jsxs)(`div`,{className:`mb-2 flex gap-1.5`,children:[(0,j.jsx)(`input`,{type:`text`,value:W,onChange:e=>Me(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.nativeEvent.isComposing&&Ge()},placeholder:e(`channels.invitePlaceholder`),"aria-label":e(`channels.invitePlaceholder`),className:`min-w-0 flex-1 rounded-lg border border-black/8 bg-transparent px-2 py-1 text-xs focus:border-primary-500 focus:outline-hidden focus:ring-2 focus:ring-primary-500/30 dark:border-white/10 dark:text-dark-800`,"data-testid":`channel-invite-name`}),(0,j.jsx)(S,{size:`sm`,disabled:!W.trim(),onClick:()=>void Ge(),"aria-label":e(`channels.invite`),title:e(`channels.invite`),"data-testid":`channel-invite-submit`,children:(0,j.jsx)(oe,{className:`h-3.5 w-3.5`})})]}),me.map(n=>(0,j.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg px-2 py-1.5 text-[13px] text-gray-700 dark:text-dark-800`,"data-testid":`channel-member`,children:[(0,j.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:n.username}),(0,j.jsx)(`span`,{className:`text-[10px] uppercase text-gray-400 dark:text-dark-500`,children:n.role===`owner`?e(`channels.roleOwner`):``}),q&&n.userId!==t?.id&&K.type!==`dm`&&(0,j.jsx)(`button`,{type:`button`,onClick:async()=>{await O({title:e(`channels.removeMemberConfirm`,{name:n.username}),description:e(`channels.removeMemberConfirmDescription`),confirmLabel:e(`common.remove`),destructive:!0})&&((await k.removeMember(K.id,n.userId).catch(()=>void 0))?.success?M(e=>e.filter(e=>e.userId!==n.userId)):p.error(e(`channels.removeMemberFailed`)))},className:`rounded-sm p-1 text-red-500 hover:bg-red-50 dark:hover:bg-red-900/20`,title:e(`channels.removeMember`),"aria-label":e(`channels.removeMemberNamed`,{name:n.username}),children:(0,j.jsx)(y,{className:`h-3 w-3`})})]},n.userId)),!q&&K.type!==`dm`&&(0,j.jsx)(S,{size:`sm`,variant:`ghost`,className:`mt-2 w-full text-red-500`,onClick:async()=>{await O({title:e(`channels.leaveConfirm`,{name:I(K)}),description:e(`channels.leaveConfirmDescription`),confirmLabel:e(`channels.leave`),destructive:!0})&&((await k.removeMember(K.id,t?.id??``).catch(()=>void 0))?.success?(w(null),J()):p.error(e(`channels.leaveFailed`)))},"data-testid":`channel-leave`,children:e(`channels.leave`)})]}):N.length===0?(0,j.jsx)(`p`,{className:`pt-4 text-center text-xs text-gray-400 dark:text-dark-500`,children:e(`channels.noPins`)}):N.map(e=>(0,j.jsx)(P,{message:e,currentUserId:t?.id,canModerate:q,actions:Ke,compact:!0},e.id))})]})]})]}):(0,j.jsx)(T,{icon:m,title:e(`channels.selectPrompt`),className:`flex-1 justify-center`})}),Oe&&(0,j.jsx)(_e,{onClose:()=>ke(!1),onCreated:e=>{ke(!1),J(),w(e.id)}}),Ae&&(0,j.jsx)(ve,{onClose:()=>je(!1),onOpened:e=>{je(!1),J(),w(e.id)}}),_&&(0,j.jsx)(ye,{channels:l,failed:ie,onRetry:Ue,onClose:()=>v(!1),onJoined:e=>{v(!1),J(),w(e)}}),Ne&&K&&(0,j.jsx)(be,{channel:K,onClose:()=>G(!1),onChanged:()=>{G(!1),J()},onDeleted:()=>{G(!1),w(null),J()}})]})},_e=({onClose:e,onCreated:t})=>{let{t:n}=o(),[r,i]=(0,A.useState)(``),[a,s]=(0,A.useState)(`public`),[c,l]=(0,A.useState)(``),[u,d]=(0,A.useState)(!1);return(0,j.jsxs)(w,{titleId:`create-channel-title`,title:n(`channels.newChannel`),onClose:e,testId:`create-channel-modal`,footer:(0,j.jsx)(S,{size:`sm`,disabled:u||!r.trim(),onClick:()=>{d(!0),k.create({type:a,name:r.trim(),...c.trim()?{description:c.trim()}:{}}).then(e=>{e.success&&e.data?t(e.data):p.error(e.error||n(`channels.createFailed`))}).catch(()=>p.error(n(`channels.createFailed`))).finally(()=>d(!1))},"data-testid":`create-channel-submit`,children:n(`channels.create`)}),children:[(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`label`,{htmlFor:`create-channel-name`,className:D,children:n(`channels.nameLabel`)}),(0,j.jsx)(`input`,{id:`create-channel-name`,className:C,value:r,onChange:e=>i(e.target.value),"data-testid":`create-channel-name`})]}),(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`label`,{htmlFor:`create-channel-type`,className:D,children:n(`channels.typeLabel`)}),(0,j.jsxs)(`select`,{id:`create-channel-type`,className:C,value:a,onChange:e=>s(e.target.value),"data-testid":`create-channel-type`,children:[(0,j.jsx)(`option`,{value:`public`,children:n(`channels.typePublic`)}),(0,j.jsx)(`option`,{value:`private`,children:n(`channels.typePrivate`)})]})]}),(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`label`,{htmlFor:`create-channel-description`,className:D,children:n(`channels.descriptionLabel`)}),(0,j.jsx)(`textarea`,{id:`create-channel-description`,className:C,rows:2,value:c,onChange:e=>l(e.target.value)})]})]})},ve=({onClose:e,onOpened:t})=>{let{t:n}=o(),[r,i]=(0,A.useState)(``),[a,s]=(0,A.useState)(!1),c=()=>{r.trim()&&(s(!0),k.openDm(r.trim()).then(e=>{e.success&&e.data?t(e.data):p.error(e.error||n(`channels.dmFailed`))}).catch(()=>p.error(n(`channels.dmFailed`))).finally(()=>s(!1)))};return(0,j.jsx)(w,{titleId:`open-dm-title`,title:n(`channels.newDm`),subtitle:n(`channels.dmHint`),onClose:e,testId:`open-dm-modal`,footer:(0,j.jsx)(S,{size:`sm`,disabled:a||!r.trim(),onClick:c,"data-testid":`open-dm-submit`,children:n(`channels.openDm`)}),children:(0,j.jsx)(`input`,{className:C,value:r,onChange:e=>i(e.target.value),onKeyDown:e=>{e.key===`Enter`&&c()},placeholder:n(`channels.dmPlaceholder`),"aria-label":n(`channels.dmPlaceholder`),"data-testid":`open-dm-username`})})},ye=({channels:e,failed:t,onRetry:n,onClose:r,onJoined:i})=>{let{t:a}=o();return(0,j.jsx)(w,{titleId:`browse-channels-title`,title:a(`channels.browsePublic`),onClose:r,testId:`browse-channels-modal`,children:t&&e===null?(0,j.jsx)(E,{size:`sm`,message:a(`channels.loadFailed`),onRetry:n}):e===null?(0,j.jsx)(de,{size:`sm`,srOnly:!0}):e.length===0?(0,j.jsx)(T,{icon:d,size:`sm`,title:a(`channels.noPublic`)}):e.map(e=>(0,j.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-black/6 px-3 py-2 dark:border-white/8`,"data-testid":`browse-channel-item`,children:[(0,j.jsx)(h,{className:`h-3.5 w-3.5 shrink-0 text-gray-400`}),(0,j.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px] text-gray-800 dark:text-dark-800`,children:e.name}),e.isMember?(0,j.jsx)(`span`,{className:`text-[11px] text-gray-400`,children:a(`channels.joined`)}):(0,j.jsx)(S,{size:`sm`,onClick:()=>void k.join(e.id).then(t=>{t.success?i(e.id):p.error(a(`channels.joinFailed`))}).catch(()=>p.error(a(`channels.joinFailed`))),"data-testid":`browse-channel-join`,children:a(`channels.join`)})]},e.id))})},be=({channel:e,onClose:t,onChanged:n,onDeleted:r})=>{let{t:i}=o(),[a,s]=(0,A.useState)(e.name),[c,l]=(0,A.useState)(e.description??``),[u,d]=(0,A.useState)(!1);return(0,j.jsxs)(w,{titleId:`channel-settings-title`,title:i(`channels.settings`),onClose:t,testId:`channel-settings-modal`,footer:(0,j.jsxs)(`div`,{className:`flex w-full items-center justify-between`,children:[(0,j.jsx)(S,{size:`sm`,variant:`ghost`,className:`text-red-500`,onClick:async()=>{await O({title:i(`channels.deleteConfirm`,{name:e.name}),description:i(`channels.deleteConfirmDescription`),confirmLabel:i(`channels.delete`),destructive:!0})&&((await k.delete(e.id).catch(()=>void 0))?.success?r():p.error(i(`channels.deleteFailed`)))},"data-testid":`channel-delete`,children:i(`channels.delete`)}),(0,j.jsx)(S,{size:`sm`,disabled:u||!a.trim(),onClick:()=>{d(!0),k.update(e.id,{name:a.trim(),description:c.trim()}).then(e=>{e.success?n():p.error(i(`channels.saveFailed`))}).catch(()=>p.error(i(`channels.saveFailed`))).finally(()=>d(!1))},"data-testid":`channel-settings-save`,children:i(`channels.save`)})]}),children:[(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`label`,{htmlFor:`channel-settings-name`,className:D,children:i(`channels.nameLabel`)}),(0,j.jsx)(`input`,{id:`channel-settings-name`,className:C,value:a,onChange:e=>s(e.target.value)})]}),(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`label`,{htmlFor:`channel-settings-description`,className:D,children:i(`channels.descriptionLabel`)}),(0,j.jsx)(`textarea`,{id:`channel-settings-description`,className:C,rows:2,value:c,onChange:e=>l(e.target.value)})]})]})};export{ge as default};