@xopcai/xopc 0.0.378 → 0.0.381

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 (241) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/xopc.extension.json +1 -1
  3. package/dist/gateway/static/root/assets/{activity-store-Xnu0H9yx.js → activity-store-D2oKh5ik.js} +1 -1
  4. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-sKMpwYNC.js → agent-avatar-dicebear-BnMiU8HX.js} +1 -1
  5. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-Ddv61pUQ.js +1 -0
  6. package/dist/gateway/static/root/assets/{agent-plugin-dialog-CxZeGEuL.js → agent-plugin-dialog-C7z3r3Z3.js} +1 -1
  7. package/dist/gateway/static/root/assets/agents-BstMN5nH.js +66 -0
  8. package/dist/gateway/static/root/assets/{agents-admin-api-DFBVz3bV.js → agents-admin-api-D-DNV0ms.js} +1 -1
  9. package/dist/gateway/static/root/assets/{app-management-settings-panel-CWqbEntC.js → app-management-settings-panel-D2boumUX.js} +1 -1
  10. package/dist/gateway/static/root/assets/{appearance-settings-QznCLnam.js → appearance-settings-Cwf53Rqo.js} +1 -1
  11. package/dist/gateway/static/root/assets/{apps-page-wbVq-6PP.js → apps-page-CwWCU5Ib.js} +1 -1
  12. package/dist/gateway/static/root/assets/{archive-plugin-BclI5H7-.js → archive-plugin-DivP9LfK.js} +1 -1
  13. package/dist/gateway/static/root/assets/{automations-page-CTKIwPAS.js → automations-page-DztgYZdC.js} +1 -1
  14. package/dist/gateway/static/root/assets/automations-workspace-SVRa19EF.js +6 -0
  15. package/dist/gateway/static/root/assets/{binary-plugins-D9FwadCs.js → binary-plugins-f-JnMRA1.js} +1 -1
  16. package/dist/gateway/static/root/assets/{block-editor-Dqqtybdf.js → block-editor-CEnzVIbk.js} +39 -39
  17. package/dist/gateway/static/root/assets/{browser-automation-inputs-FGALoJY8.js → browser-automation-inputs-DD-SUHmv.js} +1 -1
  18. package/dist/gateway/static/root/assets/{browser-automations-page-hQbQFWl-.js → browser-automations-page-m-9ETOOE.js} +2 -2
  19. package/dist/gateway/static/root/assets/{browser-settings-page-DQvfXaeq.js → browser-settings-page-DN37CRLL.js} +2 -2
  20. package/dist/gateway/static/root/assets/{cn-JdwAhgNB.js → bundle-mjs-rHxsej31.js} +1 -1
  21. package/dist/gateway/static/root/assets/{button-CS04eWY9.js → button-aIC072nz.js} +1 -1
  22. package/dist/gateway/static/root/assets/{capabilities-CQuaJBPv.js → capabilities-BOJYAeEJ.js} +1 -1
  23. package/dist/gateway/static/root/assets/{capabilities-ClI4hof_.js → capabilities-Bf6NYuvT.js} +1 -1
  24. package/dist/gateway/static/root/assets/capabilities-page-D1MJHORS.js +2 -0
  25. package/dist/gateway/static/root/assets/capabilities-settings-panel-DmwDOIlV.js +8 -0
  26. package/dist/gateway/static/root/assets/{capability-header-actions-XMz78V4c.js → capability-header-actions-DG-feQV0.js} +1 -1
  27. package/dist/gateway/static/root/assets/{capability-icon-BYm2-nS-.js → capability-icon-DVoZxEgW.js} +1 -1
  28. package/dist/gateway/static/root/assets/channels-Bl6g4Dg9.js +1 -0
  29. package/dist/gateway/static/root/assets/{chat-terminal-dock-Dr3rujcs.js → chat-terminal-dock-CE3tIjLW.js} +2 -2
  30. package/dist/gateway/static/root/assets/cn-0WouolD0.js +1 -0
  31. package/dist/gateway/static/root/assets/{computer-settings-page-G2lMB7CR.js → computer-settings-page-UMzIyZN5.js} +1 -1
  32. package/dist/gateway/static/root/assets/{connector-service-page-Cne5MBuz.js → connector-service-page-P6yEnQ6H.js} +1 -1
  33. package/dist/gateway/static/root/assets/connectors-page-DXhBTvqp.js +1 -0
  34. package/dist/gateway/static/root/assets/{copy-text-row-C1gaJwlZ.js → copy-text-row-C7egVuKr.js} +1 -1
  35. package/dist/gateway/static/root/assets/{date-picker-yGmnkoC5.js → date-picker-eg-Uf9Wx.js} +1 -1
  36. package/dist/gateway/static/root/assets/{dependency-picker-CdKC_TNa.js → dependency-picker-BEn7eZXu.js} +1 -1
  37. package/dist/gateway/static/root/assets/{desktop-pet-C4d305Me.js → desktop-pet-DPAFil05.js} +1 -1
  38. package/dist/gateway/static/root/assets/{desktop-pet-settings-hCS9Mddt.js → desktop-pet-settings-DK38Nevi.js} +1 -1
  39. package/dist/gateway/static/root/assets/{desktop-pet-sprite-DTqXSpqf.js → desktop-pet-sprite-BP6iMVw1.js} +1 -1
  40. package/dist/gateway/static/root/assets/{device-pairing-wizard-C6qeCyfO.js → device-pairing-wizard-DaRk9VLg.js} +1 -1
  41. package/dist/gateway/static/root/assets/{directory-picker-path-field-kYdBIm8m.js → directory-picker-path-field-Dm7jp0Y9.js} +1 -1
  42. package/dist/gateway/static/root/assets/{extension-debug-page-odpIjn1q.js → extension-debug-page-DJ1wFpMs.js} +1 -1
  43. package/dist/gateway/static/root/assets/{extension-page-C6Jn5baO.js → extension-page-tPkDLwrG.js} +1 -1
  44. package/dist/gateway/static/root/assets/{extension-provider-DB4M3dc8.js → extension-provider-Dnz8j6Q_.js} +1 -1
  45. package/dist/gateway/static/root/assets/{extension-settings-page-Clx81lZy.js → extension-settings-page-Vp9FPajP.js} +1 -1
  46. package/dist/gateway/static/root/assets/{fallback-models-pBVU4PxA.js → fallback-models-DirZnl7x.js} +1 -1
  47. package/dist/gateway/static/root/assets/{gateway-config-swr-ArYo4YFd.js → gateway-config-swr-f-4qw3AG.js} +1 -1
  48. package/dist/gateway/static/root/assets/{gateway-realtime-BaE0shFY.js → gateway-realtime-BGhPOSfz.js} +1 -1
  49. package/dist/gateway/static/root/assets/gateway-realtime-store-BYe-jWB1.js +1 -0
  50. package/dist/gateway/static/root/assets/gateway-settings-CRbb12ar.js +1 -0
  51. package/dist/gateway/static/root/assets/{gateway-startup-retry-BRCCiCBH.js → gateway-startup-retry-90pvxKox.js} +1 -1
  52. package/dist/gateway/static/root/assets/highlight-code-BH65IIbJ.js +1 -0
  53. package/dist/gateway/static/root/assets/highlighted-body-KQOG7T2V-DdDvTjik.js +1 -0
  54. package/dist/gateway/static/root/assets/home-page-BeIZyioN.js +2 -0
  55. package/dist/gateway/static/root/assets/{image-generation-api-B5FwRmo9.js → image-generation-api-CtDjTXwX.js} +1 -1
  56. package/dist/gateway/static/root/assets/{imports-page-7s8jzc2G.js → imports-page-KIeykeaL.js} +1 -1
  57. package/dist/gateway/static/root/assets/index-DxydK_AA.js +255 -0
  58. package/dist/gateway/static/root/assets/index-_xgO2IDa.css +1 -0
  59. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-CyFSxteg.js → keyboard-shortcuts-settings-5Df9Rng_.js} +1 -1
  60. package/dist/gateway/static/root/assets/{local-app-workbench-page-B-hYeH8P.js → local-app-workbench-page-BSuq_SAr.js} +1 -1
  61. package/dist/gateway/static/root/assets/{local-apps-page-CFt8G-ae.js → local-apps-page-D5-69OHu.js} +1 -1
  62. package/dist/gateway/static/root/assets/{local-session-drafts-CLR702g5.js → local-session-drafts-CrD74S6k.js} +1 -1
  63. package/dist/gateway/static/root/assets/{locale-store-CeoW7A5a.js → locale-store-pmT2B_By.js} +1 -1
  64. package/dist/gateway/static/root/assets/{logs-page-BQ9AzAj9.js → logs-page-DHYqPwJ3.js} +2 -2
  65. package/dist/gateway/static/root/assets/{management-settings-BDuuXJ5t.js → management-settings-uIgzZZ_J.js} +1 -1
  66. package/dist/gateway/static/root/assets/{markdown-view-DSjfHfaW.css → markdown-view-ByJbFign.css} +1 -1
  67. package/dist/gateway/static/root/assets/markdown-view-CZlvyzow.js +66 -0
  68. package/dist/gateway/static/root/assets/{media-plugins-hqKbHVyi.js → media-plugins-BtFqN13D.js} +1 -1
  69. package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-DOTWm1iy.js +1 -0
  70. package/dist/gateway/static/root/assets/mermaid-render-604gISVe.js +134 -0
  71. package/dist/gateway/static/root/assets/{messages-BpEhZm54.js → messages-Ib6DaUTo.js} +2 -2
  72. package/dist/gateway/static/root/assets/models-hub-cache-3slk24cw.js +1 -0
  73. package/dist/gateway/static/root/assets/{note-detail-panel-G_6LpTik.js → note-detail-panel-sujG9ZmW.js} +3 -3
  74. package/dist/gateway/static/root/assets/{note-image-lightbox-1qg2v-9j.js → note-image-lightbox-BYNLO2pt.js} +1 -1
  75. package/dist/gateway/static/root/assets/{notes-api-B0QQSN4M.js → notes-api-D-VLGhjV.js} +1 -1
  76. package/dist/gateway/static/root/assets/notes-page-C_4Ib15d.js +8 -0
  77. package/dist/gateway/static/root/assets/{page-context-capture-button-Dp1RoS6x.js → page-context-capture-button-DErqGBBe.js} +1 -1
  78. package/dist/gateway/static/root/assets/{page-tabs-D2xpUV26.js → page-tabs-BLGO2VIm.js} +1 -1
  79. package/dist/gateway/static/root/assets/personal-page-CC3W2EZ0.js +1 -0
  80. package/dist/gateway/static/root/assets/{popover-select-BgSdSbCL.js → popover-select-DHC7J4lG.js} +1 -1
  81. package/dist/gateway/static/root/assets/{preview-open-alternatives-Dvey7GwU.js → preview-open-alternatives-BJU2fmPn.js} +1 -1
  82. package/dist/gateway/static/root/assets/{product-open-page-DZyCQVVW.js → product-open-page-B3qxtYyi.js} +1 -1
  83. package/dist/gateway/static/root/assets/{product-preview-content-CrfIfrVJ.js → product-preview-content-NOhtxfkq.js} +1 -1
  84. package/dist/gateway/static/root/assets/project-detail-page-7BFqLZj4.js +1 -0
  85. package/dist/gateway/static/root/assets/{projects-page-DZ98gcjB.js → projects-page-qhnc7oNj.js} +1 -1
  86. package/dist/gateway/static/root/assets/{registry-api-Dzl61MkW.js → registry-api-Bi4muyaZ.js} +1 -1
  87. package/dist/gateway/static/root/assets/remote-access-hub-CS-zmmtV.js +1 -0
  88. package/dist/gateway/static/root/assets/{runtime-tools-api-Cg9dqJon.js → runtime-tools-api-9bk1payF.js} +1 -1
  89. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-oEdBs0He.js → runtime-tools-settings-panel-B55OozGG.js} +1 -1
  90. package/dist/gateway/static/root/assets/{scenes-page-CVlz-PiN.js → scenes-page-BJZqRz8a.js} +2 -2
  91. package/dist/gateway/static/root/assets/{schema-form-DIC8IlM1.js → schema-form-BND8Hs4C.js} +1 -1
  92. package/dist/gateway/static/root/assets/{secret-input-D93UrW4C.js → secret-input-BxWHx6J6.js} +1 -1
  93. package/dist/gateway/static/root/assets/send-session-input-BtF5UWGp.js +1 -0
  94. package/dist/gateway/static/root/assets/{session-api-CVHFZq_A.js → session-api-D2J6VacQ.js} +1 -1
  95. package/dist/gateway/static/root/assets/session-manager-64DD1cxN.js +16 -0
  96. package/dist/gateway/static/root/assets/sessions-page-U5k3iucx.js +1 -0
  97. package/dist/gateway/static/root/assets/settings-advanced-gate-D8dOvd8T.js +1 -0
  98. package/dist/gateway/static/root/assets/{settings-form-section-exRhP9xn.js → settings-form-section-num14vSv.js} +1 -1
  99. package/dist/gateway/static/root/assets/{settings-loading-skeleton-CAmWMaOT.js → settings-loading-skeleton-BTqvr_Fw.js} +1 -1
  100. package/dist/gateway/static/root/assets/{settings-page-CN0_Np6E.js → settings-page-DOMl-bv4.js} +1 -1
  101. package/dist/gateway/static/root/assets/{settings-page-layout-X1x-2Cp9.js → settings-page-layout-Dx5S-Msc.js} +1 -1
  102. package/dist/gateway/static/root/assets/setup-status-panel-Dgpd7bk0.js +1 -0
  103. package/dist/gateway/static/root/assets/{share-link-dialog-C0gKFt8r.js → share-link-dialog-BnqkFFBZ.js} +1 -1
  104. package/dist/gateway/static/root/assets/{share-preview-page-DxQ6yfYv.js → share-preview-page-aGjIkYmH.js} +1 -1
  105. package/dist/gateway/static/root/assets/{shares-api-tR66Fdly.js → shares-api-cGtd3rjc.js} +1 -1
  106. package/dist/gateway/static/root/assets/{shares-settings-C_ZOqMjz.js → shares-settings-DmFLUeqg.js} +1 -1
  107. package/dist/gateway/static/root/assets/{skeleton-BwbyijEw.js → skeleton-BI5TyibZ.js} +1 -1
  108. package/dist/gateway/static/root/assets/{skill-api-BFhU0NNu.js → skill-api-C9AYuE_b.js} +1 -1
  109. package/dist/gateway/static/root/assets/{skill-reload-api-D_04Mpcb.js → skill-reload-api-VT8F0enn.js} +1 -1
  110. package/dist/gateway/static/root/assets/{skills-page-4-d-lfhq.js → skills-page-CJIhQfG2.js} +1 -1
  111. package/dist/gateway/static/root/assets/{system-settings-panel-DHhaFWty.js → system-settings-panel-Cg0qUX2j.js} +1 -1
  112. package/dist/gateway/static/root/assets/{task-detail-page-CHBEI5uz.js → task-detail-page-C-VbndI4.js} +2 -2
  113. package/dist/gateway/static/root/assets/{task-expandable-content-AGJtkFIu.js → task-expandable-content-UI-0Elqy.js} +1 -1
  114. package/dist/gateway/static/root/assets/{theme-store-DezB9Sal.js → theme-store-D7m5Eng5.js} +1 -1
  115. package/dist/gateway/static/root/assets/{tracing-settings-page-BEHmd2wL.js → tracing-settings-page-CawYzT24.js} +1 -1
  116. package/dist/gateway/static/root/assets/{tunnel-api-Bbb_6pV4.js → tunnel-api-B8bvJesa.js} +1 -1
  117. package/dist/gateway/static/root/assets/{usage-page-BEiWznDq.js → usage-page-DdA0F-qo.js} +1 -1
  118. package/dist/gateway/static/root/assets/{use-autosave-BtTE5X_M.js → use-autosave-jrZBPSWn.js} +1 -1
  119. package/dist/gateway/static/root/assets/{use-composer-attachments-BBHrVqB7.js → use-composer-attachments-hTgxke6e.js} +1 -1
  120. package/dist/gateway/static/root/assets/{use-file-preview-expanded-CQmLEkdj.js → use-file-preview-expanded-tMUDUWVH.js} +2 -2
  121. package/dist/gateway/static/root/assets/user-model-page-Bs6hUk15.js +2 -0
  122. package/dist/gateway/static/root/assets/{voice-api-key-field-tQsUdQnu.js → voice-api-key-field-Bp8brswu.js} +1 -1
  123. package/dist/gateway/static/root/assets/{voice-config-api-69Yqf0QM.js → voice-config-api-415pyWx8.js} +1 -1
  124. package/dist/gateway/static/root/assets/{work-discovery-overlay-Cvf8u31v.js → work-discovery-overlay-CcIDsZWn.js} +1 -1
  125. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-CqYp6zjF.js → workflow-run-setup-panel-YP4TJpWE.js} +2 -2
  126. package/dist/gateway/static/root/assets/workflows-page-CYqVuquq.js +6 -0
  127. package/dist/gateway/static/root/assets/{workspace-api-Bu6Csrxf.js → workspace-api-C01xjDt2.js} +2 -2
  128. package/dist/gateway/static/root/assets/xml-_d7dTN2Q.js +3 -0
  129. package/dist/gateway/static/root/assets/{xopc-cloud-account-card-D3Cyk8pp.js → xopc-cloud-account-card-Cspd770Z.js} +1 -1
  130. package/dist/gateway/static/root/index.html +38 -35
  131. package/dist/package.js +1 -1
  132. package/dist/packages/realtime-protocol/src/voice-catalog.js +7 -2
  133. package/dist/src/agent/embedded/run-turn.js +38 -0
  134. package/dist/src/agent/embedded/session-runner.js +21 -3
  135. package/dist/src/agent/embedded/tool-metadata.d.ts +2 -1
  136. package/dist/src/agent/external-tools/index.js +6 -3
  137. package/dist/src/agent/external-tools/tool-registry.d.ts +2 -1
  138. package/dist/src/agent/prompt/response-language.js +9 -1
  139. package/dist/src/agent/session/session-config-service.js +0 -13
  140. package/dist/src/agent/tasks/task-judge-service.d.ts +2 -2
  141. package/dist/src/agent/tasks/task-judge-service.js +16 -9
  142. package/dist/src/agent/tools/xopc-use-tool.js +6 -2
  143. package/dist/src/browser/native-messaging-host.js +1 -1
  144. package/dist/src/browser/providers/browser-ext-install.js +2 -2
  145. package/dist/src/cli/bin.js +2 -2
  146. package/dist/src/cli/commands/agent.js +2 -2
  147. package/dist/src/cli/commands/auth.js +1 -1
  148. package/dist/src/cli/commands/extension-agent-plugin.js +1 -1
  149. package/dist/src/cli/commands/extension-dev.js +1 -1
  150. package/dist/src/cli/commands/extension-marketplace.js +1 -1
  151. package/dist/src/cli/commands/extension.js +1 -1
  152. package/dist/src/cli/commands/gateway/lifecycle.js +1 -1
  153. package/dist/src/cli/commands/gateway-ssh-tunnel.js +1 -1
  154. package/dist/src/cli/commands/import.js +1 -1
  155. package/dist/src/cli/commands/mcp.js +2 -2
  156. package/dist/src/cli/commands/models.js +2 -2
  157. package/dist/src/cli/commands/onboard/model.js +2 -2
  158. package/dist/src/cli/commands/onboard.js +1 -1
  159. package/dist/src/cli/commands/platform.js +1 -1
  160. package/dist/src/cli/commands/profile.js +1 -1
  161. package/dist/src/cli/commands/tunnel.js +1 -1
  162. package/dist/src/cli/commands/update.js +1 -1
  163. package/dist/src/cli/extension-cli-register.js +1 -1
  164. package/dist/src/config/index.js +1 -1
  165. package/dist/src/endpoint-tools/registry.d.ts +4 -1
  166. package/dist/src/endpoint-tools/registry.js +14 -0
  167. package/dist/src/gateway/chat-stream/mapper.d.ts +2 -0
  168. package/dist/src/gateway/chat-stream/mapper.js +4 -1
  169. package/dist/src/gateway/chat-stream/protocol.d.ts +4 -1
  170. package/dist/src/gateway/hono/app.js +1 -1
  171. package/dist/src/gateway/hono/routes/browser-install.js +1 -1
  172. package/dist/src/gateway/hono/routes/chat-model-config.d.ts +0 -4
  173. package/dist/src/gateway/hono/routes/chat-model-config.js +0 -6
  174. package/dist/src/gateway/hono/routes/devices.js +1 -0
  175. package/dist/src/gateway/hono/routes/endpoint-tools.js +1 -0
  176. package/dist/src/gateway/hono/routes/personal-agent.js +4 -2
  177. package/dist/src/gateway/hono/routes/voice.js +12 -4
  178. package/dist/src/gateway/rate-limit/buckets.d.ts +1 -1
  179. package/dist/src/gateway/rate-limit/buckets.js +2 -2
  180. package/dist/src/gateway/run-loop.js +1 -1
  181. package/dist/src/gateway/server.js +1 -1
  182. package/dist/src/gateway/service/run-gateway-agent.js +8 -3
  183. package/dist/src/gateway/side-chat/manager.js +1 -1
  184. package/dist/src/personal-agent/communication.d.ts +2 -1
  185. package/dist/src/personal-agent/communication.js +4 -3
  186. package/dist/src/personal-agent/prompts.d.ts +1 -0
  187. package/dist/src/personal-agent/prompts.js +29 -5
  188. package/dist/src/personal-agent/reply-composer.js +19 -4
  189. package/dist/src/personal-agent/reply-style.d.ts +4 -2
  190. package/dist/src/personal-agent/reply-style.js +57 -5
  191. package/dist/src/storage/sqlite/device-pairing-approval.js +1 -1
  192. package/dist/src/tasks/capabilities/write.js +10 -1
  193. package/dist/src/tasks/task-application-service.js +5 -4
  194. package/dist/src/tasks/task-context-assembler.js +1 -0
  195. package/dist/src/tasks/task-contract-definition.d.ts +1 -1
  196. package/dist/src/tasks/task-contract-definition.js +2 -2
  197. package/dist/src/tasks/task-contract-planner.d.ts +1 -0
  198. package/dist/src/tasks/task-contract-planner.js +2 -1
  199. package/dist/src/tasks/task-language.d.ts +7 -0
  200. package/dist/src/tasks/task-language.js +15 -0
  201. package/dist/src/tasks/task-read-model-projector.js +3 -2
  202. package/dist/src/tasks/task-result-delivery-service.js +2 -1
  203. package/dist/src/tasks/task-run-coordinator.js +22 -8
  204. package/dist/src/tasks/task-run-dispatcher.js +8 -6
  205. package/dist/src/voice/platform-catalog.d.ts +1 -0
  206. package/dist/src/voice/platform-settings.d.ts +1 -1
  207. package/dist/src/voice/platform-settings.js +6 -2
  208. package/dist/src/voice/platform-streams.js +4 -1
  209. package/dist/src/voice/realtime/agentEngine.js +51 -2
  210. package/dist/src/voice/realtime/engine.d.ts +4 -0
  211. package/dist/src/voice/realtime/omniRoute.d.ts +1 -1
  212. package/dist/src/voice/realtime/omniRoute.js +4 -1
  213. package/dist/src/voice/realtime/runtime.js +3 -3
  214. package/dist/src/voice/tts/providers/xopc-cloud-speech.js +6 -2
  215. package/dist/src/voice/tts/speech-provider-types.d.ts +1 -0
  216. package/package.json +6 -6
  217. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-DLrGOiCS.js +0 -1
  218. package/dist/gateway/static/root/assets/agents-CUnG8q3J.js +0 -66
  219. package/dist/gateway/static/root/assets/automations-workspace-BblZP4ft.js +0 -6
  220. package/dist/gateway/static/root/assets/capabilities-page-CbPvaNJF.js +0 -2
  221. package/dist/gateway/static/root/assets/capabilities-settings-panel-CjApEiV4.js +0 -8
  222. package/dist/gateway/static/root/assets/channels-CJUz97Cw.js +0 -1
  223. package/dist/gateway/static/root/assets/connectors-page-CbxL6ENI.js +0 -1
  224. package/dist/gateway/static/root/assets/gateway-realtime-store-CHAa_VNb.js +0 -1
  225. package/dist/gateway/static/root/assets/gateway-settings-BcSr6MzW.js +0 -1
  226. package/dist/gateway/static/root/assets/home-page-CKeRXki2.js +0 -2
  227. package/dist/gateway/static/root/assets/index-B3BVcMQj.js +0 -106
  228. package/dist/gateway/static/root/assets/index-BU0KqtLI.css +0 -1
  229. package/dist/gateway/static/root/assets/markdown-view-CdqdeQqI.js +0 -201
  230. package/dist/gateway/static/root/assets/models-hub-cache-D0yA-nf6.js +0 -1
  231. package/dist/gateway/static/root/assets/notes-page-kBo3rUvj.js +0 -8
  232. package/dist/gateway/static/root/assets/personal-page-Bf07rfSd.js +0 -1
  233. package/dist/gateway/static/root/assets/project-detail-page-C3wJ8U07.js +0 -1
  234. package/dist/gateway/static/root/assets/remote-access-hub-BvhaF5Pi.js +0 -1
  235. package/dist/gateway/static/root/assets/send-session-input-C449pdoe.js +0 -1
  236. package/dist/gateway/static/root/assets/session-manager-CKFTwYtq.js +0 -16
  237. package/dist/gateway/static/root/assets/sessions-page-DtB119_G.js +0 -1
  238. package/dist/gateway/static/root/assets/settings-advanced-gate-2ciK8mPP.js +0 -1
  239. package/dist/gateway/static/root/assets/setup-status-panel-VtNv07PN.js +0 -1
  240. package/dist/gateway/static/root/assets/user-model-page-B4Gwo5T7.js +0 -2
  241. package/dist/gateway/static/root/assets/workflows-page-DMzGl3CE.js +0 -6
@@ -1,66 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/block-editor-Dqqtybdf.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-B3BVcMQj.js","assets/preload-helper-zJ_50EbN.js","assets/es2015-DBLcMg5B.js","assets/vendor-react-BOUWij0V.js","assets/dist-CxGUk8J-.js","assets/dist-CI_fqRk-.js","assets/floating-ui.dom-B7uQOZZW.js","assets/markdown-view-CdqdeQqI.js","assets/dist-BGTk37IG.js","assets/chunk-KS7C4IRE-BMYIfy9x.js","assets/createLucideIcon-DPHK1VkS.js","assets/download-Dk-ZjtO6.js","assets/plus-Q2yW6OE7.js","assets/x-B_N4OPjy.js","assets/locale-store-CeoW7A5a.js","assets/messages-BpEhZm54.js","assets/cn-JdwAhgNB.js","assets/app-link-4gpFbdsr.js","assets/product-delivery-BAks11S4.js","assets/schemas-CObaziC7.js","assets/local-apps-yys1VChX.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/markdown-view-DSjfHfaW.css","assets/copy-text-row-C1gaJwlZ.js","assets/check-DUBLcKHA.js","assets/copy-Dv6d4Dvw.js","assets/button-CS04eWY9.js","assets/vendor-swr-BIWyz7Rc.js","assets/activity-YogQEteU.js","assets/bot-DjLkhyZL.js","assets/chevron-left-DqFhpbvK.js","assets/chevron-right-BweFrslA.js","assets/popover-select-BgSdSbCL.js","assets/dist-C3DSFZCi.js","assets/skeleton-BwbyijEw.js","assets/settings-shell-dialog-layer-BU3UuiJr.js","assets/circle-alert-BEjgurr2.js","assets/circle-check-C23XjkUj.js","assets/circle-dashed-8qMD7gHf.js","assets/circle-dot-BAseJTrF.js","assets/circle-pause-CN9jYH2s.js","assets/clock-3-DnrAnuyZ.js","assets/cloud-C4-yfnnk.js","assets/ellipsis-0k4rZLoy.js","assets/external-link-DjqjBmc3.js","assets/secret-input-D93UrW4C.js","assets/eye-CABVeTq0.js","assets/loader-circle-CifKLtgG.js","assets/form-field-width-DJw_jULe.js","assets/interaction-BdhHBbYa.js","assets/is-masked-secret-DOkL5b_X.js","assets/use-composer-attachments-BBHrVqB7.js","assets/use-file-preview-expanded-CQmLEkdj.js","assets/folder-open-CyzJ19I9.js","assets/message-square-plus-XP0tGdlV.js","assets/minimize-2-DtOGrlpo.js","assets/pencil-DmIY3Oa-.js","assets/rotate-cw-LIg3Am9S.js","assets/search-DA7gz22f.js","assets/index.module-Cd9ENXfk.js","assets/session-api-CVHFZq_A.js","assets/gateway-startup-retry-BRCCiCBH.js","assets/constants-Dy8Gw0sF.js","assets/app-chrome-BeB4KgOf.js","assets/attachment-utils-core-BIOUBrpT.js","assets/workspace-api-Bu6Csrxf.js","assets/files-Bw4SBGdM.js","assets/electron-env-Dit0bHgy.js","assets/use-async-resource-GrnWNwMZ.js","assets/activity-store-Xnu0H9yx.js","assets/mic-CuUb7zc-.js","assets/share-link-dialog-C0gKFt8r.js","assets/globe-DSSGFWFn.js","assets/capabilities-ClI4hof_.js","assets/local-session-drafts-CLR702g5.js","assets/tasks-DwKXgZ-I.js","assets/skill-wire-pattern-BPpeIcCi.js","assets/shares-api-tR66Fdly.js","assets/capabilities-CQuaJBPv.js","assets/git-branch-Dh9uxTot.js","assets/notes-api-B0QQSN4M.js","assets/message-square-fVE7Ghj1.js","assets/pause-DuPxgSxk.js","assets/play-kxZvpBg8.js","assets/rotate-ccw-JM1TBLpp.js","assets/settings-2-D-csvaET.js","assets/sparkles-DHlfQFAF.js","assets/middleware-Pd0e8Igk.js","assets/gateway-realtime-BaE0shFY.js","assets/gateway-realtime-store-CHAa_VNb.js","assets/extension-provider-DB4M3dc8.js","assets/session-manager-CKFTwYtq.js","assets/tool-activity-BtJkgjFf.js","assets/registry-api-Dzl61MkW.js","assets/agents-admin-api-DFBVz3bV.js","assets/gateway-config-swr-ArYo4YFd.js","assets/send-session-input-C449pdoe.js","assets/theme-store-DezB9Sal.js","assets/loopi-Djb8XU3l.js","assets/loopi-C09I2mNj.css","assets/models-hub-cache-D0yA-nf6.js","assets/skill-api-utils-C7V4JVXM.js","assets/date-formatters-CUZAyDEg.js","assets/settings-form-draft-Dy10ldo8.js","assets/index-BU0KqtLI.css","assets/vendor-codemirror-DFxP3B9T.js","assets/with-selector-aYPsXwdl.js","assets/note-image-lightbox-1qg2v-9j.js","assets/block-editor-BdOTO0Yo.css","assets/markdown-editor-BhBJANcx.js","assets/code-editor-CXIH8jQw.js","assets/languages-BFe8nIOO.js"])))=>i.map(i=>d[i]);
2
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-zJ_50EbN.js";import{f as a}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{t as o}from"./bot-DjLkhyZL.js";import{s}from"./popover-select-BgSdSbCL.js";import{t as c}from"./ellipsis-0k4rZLoy.js";import{t as l}from"./eye-CABVeTq0.js";import{t as u}from"./markdown-view-CdqdeQqI.js";import{t as d}from"./message-square-plus-XP0tGdlV.js";import{t as f}from"./pencil-DmIY3Oa-.js";import{t as p}from"./plus-Q2yW6OE7.js";import{t as m}from"./rotate-ccw-JM1TBLpp.js";import{t as h}from"./sparkles-DHlfQFAF.js";import{t as g}from"./x-B_N4OPjy.js";import{t as _}from"./messages-BpEhZm54.js";import{t as v}from"./cn-JdwAhgNB.js";import{c as y,n as b}from"./locale-store-CeoW7A5a.js";import{a as x,i as S,n as C,o as w,r as T,s as E,t as D}from"./dist-BGTk37IG.js";import{i as O}from"./vendor-swr-BIWyz7Rc.js";import{t as k}from"./button-CS04eWY9.js";import{n as A}from"./interaction-BdhHBbYa.js";import{n as j,t as M}from"./registry-api-Dzl61MkW.js";import{c as N,i as P,n as F,o as I,r as L,s as R,t as z}from"./agents-admin-api-DFBVz3bV.js";import{i as B}from"./theme-store-DezB9Sal.js";import{t as V}from"./skeleton-BwbyijEw.js";import{i as H,o as U}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{Bn as W,Dn as G,Fn as ee,In as K,Js as q,Ln as J,No as Y,Oc as te,On as ne,Rn as re,Ro as ie,Us as ae,W as oe,Xi as se,Xr as ce,bn as le,do as ue,go as de,hc as fe,nc as pe,ui as me,xn as he,yn as ge}from"./index-B3BVcMQj.js";import{t as _e}from"./number-input-DDeqHK-G.js";import{r as ve}from"./settings-page-layout-X1x-2Cp9.js";import{t as ye}from"./fallback-models-pBVU4PxA.js";import{r as be}from"./image-generation-api-B5FwRmo9.js";import{t as xe}from"./directory-picker-path-field-kYdBIm8m.js";var X=e(t(),1),Z=n();function Se(e){let t=e.match(/^(---\r?\n[\s\S]*?\r?\n---(?:\r?\n)*)/);return t?{frontMatter:t[1],body:e.slice(t[1].length)}:{frontMatter:``,body:e}}function Ce(e,t){let{frontMatter:n}=Se(e);return`${n}${t}`}var we=[{id:`professional`,labelEn:`Professional & Efficient`,labelZh:`专业高效`,emoji:`🎯`,content:`# SOUL.md - Who You Are
3
-
4
- ## Core Truths
5
-
6
- **Be genuinely helpful, not performatively helpful.** Skip the filler words — just help. Actions speak louder than pleasantries.
7
-
8
- **Be precise and efficient.** Value the user's time. Give concise, actionable answers. Expand only when asked.
9
-
10
- **Earn trust through competence.** Be careful with external actions. Be bold with internal ones (reading, organizing, learning).
11
-
12
- **Remember you're a guest.** You have access to someone's life. Treat it with respect.
13
-
14
- ## Boundaries
15
-
16
- - Private things stay private. Period.
17
- - When in doubt, ask before acting externally.
18
- - Never send half-baked replies to messaging surfaces.
19
-
20
- ## Vibe
21
-
22
- Professional, competent, and respectful. Concise when needed, thorough when it matters.`},{id:`casual`,labelEn:`Warm & Friendly`,labelZh:`轻松友好`,emoji:`😊`,content:`# SOUL.md - Who You Are
23
-
24
- ## Core Truths
25
-
26
- **Be a good friend, not a corporate drone.** Be warm, genuine, and real. Skip the formality when it gets in the way.
27
-
28
- **Have personality.** You're allowed to be amused, surprised, or excited. An assistant with no personality is just a search engine.
29
-
30
- **Be resourceful before asking.** Try to figure it out first. Then ask if you're stuck.
31
-
32
- **Earn trust by being reliable.** Show up, follow through, and remember what matters.
33
-
34
- **Respect the intimacy.** You have access to someone's life. That's a privilege.
35
-
36
- ## Boundaries
37
-
38
- - Private things stay private. Always.
39
- - When in doubt, ask before acting externally.
40
- - Be careful in group chats — you're not the user's voice.
41
-
42
- ## Vibe
43
-
44
- Warm, friendly, and a little playful. Like a helpful friend who happens to know everything.`},{id:`geeky`,labelEn:`Geeky & Witty`,labelZh:`极客风格`,emoji:`🧑‍💻`,content:`# SOUL.md - Who You Are
45
-
46
- ## Core Truths
47
-
48
- **Precision over politeness.** "This is broken" beats "This might be worth considering." Be direct.
49
-
50
- **Have opinions.** Disagree, prefer things, find stuff interesting or dull. No personality = no value.
51
-
52
- **Go deep.** When something is interesting, explore it. Surface-level answers are for search engines.
53
-
54
- **Be resourceful.** Read the file. Check the context. Search for it. Come back with answers, not questions.
55
-
56
- **Earn trust through competence.** Be careful with external actions. Be bold with internal ones.
57
-
58
- ## Boundaries
59
-
60
- - Private things stay private.
61
- - When in doubt, ask before acting externally.
62
- - Never send half-baked replies.
63
-
64
- ## Vibe
65
-
66
- Sharp, direct, slightly nerdy. The kind of engineer you'd want on your team — competent, opinionated, and occasionally funny.`},{id:`custom`,labelEn:`Custom`,labelZh:`自定义`,emoji:`✍️`,content:``}],Te=[{value:`AI assistant`,labelEn:`AI Assistant`,labelZh:`AI 助手`},{value:`robot`,labelEn:`Robot`,labelZh:`机器人`},{value:`familiar`,labelEn:`Familiar`,labelZh:`精灵`},{value:`ghost in the machine`,labelEn:`Ghost in the machine`,labelZh:`机器幽灵`},{value:`digital companion`,labelEn:`Digital Companion`,labelZh:`数字伙伴`}],Q=r(),Ee=()=>i(()=>import(`./block-editor-Dqqtybdf.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110])),De=()=>i(()=>import(`./markdown-editor-BhBJANcx.js`),__vite__mapDeps([111,1,107,5,112,113,3])),Oe=(0,X.lazy)(()=>Ee().then(e=>({default:e.BlockEditor}))),ke=(0,X.lazy)(()=>De().then(e=>({default:e.MarkdownEditor}))),Ae=[`SOUL.md`,`TOOLS.md`,`AGENTS.md`],je={"SOUL.md":``,"TOOLS.md":``,"AGENTS.md":``};function Me(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsxs)(`div`,{className:`space-y-3 p-5`,"aria-busy":`true`,children:[(0,Q.jsx)(V,{className:`h-8 w-52`}),(0,Q.jsx)(V,{className:`h-4 w-full`}),(0,Q.jsx)(V,{className:`h-4 w-4/5`}),(0,Q.jsx)(V,{className:`h-4 w-11/12`})]}),e[0]=t):t=e[0],t}var Ne=(0,X.forwardRef)(function({agentId:e,zh:t,onDirtyChange:n},r){let i=B(e=>e.resolved===`dark`),[a,s]=(0,X.useState)(je),[c,d]=(0,X.useState)(je),[p,m]=(0,X.useState)(!0),[h,g]=(0,X.useState)(!1),[_,y]=(0,X.useState)(!1),[b,x]=(0,X.useState)(null),[S,C]=(0,X.useState)(`SOUL.md`),[w,T]=(0,X.useState)(`direct`);(0,X.useEffect)(()=>{let t=!1;return m(!0),g(!1),x(null),s({...je}),d({...je}),(async()=>{try{let n=await P(e),r=new Set(n.files.filter(e=>!e.missing).map(e=>e.name)),i=await Promise.all(Ae.map(async t=>[t,r.has(t)?await L(e,t):``]));if(t)return;let a={...je};for(let[e,t]of i)a[e]=t;s(a),d(a)}catch(e){if(t)return;g(!0),x(e instanceof Error?e.message:String(e))}finally{t||m(!1)}})(),()=>{t=!0}},[e]);let E=(0,X.useMemo)(()=>Ae.some(e=>a[e]!==c[e]),[c,a]);(0,X.useEffect)(()=>n(E),[E,n]);let D=(0,X.useCallback)(async()=>{let t=Ae.filter(e=>a[e]!==c[e]);if(t.length!==0){y(!0),x(null);try{await Promise.all(t.map(t=>R(e,t,a[t]))),d({...a})}catch(e){throw x(e instanceof Error?e.message:String(e)),e}finally{y(!1)}}},[e,c,a]);(0,X.useImperativeHandle)(r,()=>({save:D}),[D]);let O={"SOUL.md":{label:t?`个性与边界`:`Personality & boundaries`,description:t?`定义语气、价值观、行为原则与安全边界。`:`Tone, values, behavior principles, and safety boundaries.`},"TOOLS.md":{label:t?`工具说明`:`Tool guidance`,description:t?`补充工具偏好和使用约定,不负责授予权限。`:`Tool preferences and conventions; this does not grant access.`},"AGENTS.md":{label:t?`工作规范`:`Working instructions`,description:t?`该智能体长期遵循的协作和执行规范。`:`Persistent collaboration and execution instructions.`}},k=[te,ae,fe,f],A=Se(a[S]).body;return(0,Q.jsx)(`div`,{className:`space-y-5`,children:(0,Q.jsxs)(`section`,{className:`overflow-hidden rounded-2xl border border-edge bg-surface-base`,children:[(0,Q.jsxs)(`div`,{className:`border-b border-edge px-4 py-4 sm:px-5`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Q.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-xl bg-surface-hover text-fg-muted`,children:(0,Q.jsx)(pe,{className:`size-4`,"aria-hidden":!0})}),(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:t?`角色配置`:`Profile documents`}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t?`三类角色文件均可编辑。默认使用所见即所得编辑器,熟悉 Markdown 时再切换源码。`:`All three profile documents are editable. The visual editor is the default; switch to Markdown source only when needed.`})]})]}),(0,Q.jsx)(`div`,{className:`mt-4 flex gap-1 overflow-x-auto`,role:`tablist`,"aria-label":t?`角色配置文件`:`Profile documents`,children:Ae.map(e=>(0,Q.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":S===e,onClick:()=>{C(e),T(`direct`)},className:v(`min-h-10 shrink-0 rounded-lg px-3 py-2 font-mono text-xs font-medium transition-colors`,S===e?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:e},e))})]}),(0,Q.jsxs)(`div`,{className:`p-4 sm:p-5`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:O[S].label}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:O[S].description})]}),(0,Q.jsx)(`div`,{className:`flex rounded-lg bg-surface-hover p-1`,role:`group`,"aria-label":t?`编辑模式`:`Editor mode`,children:[[`direct`,f,t?`直接编辑`:`Visual`],[`source`,fe,`Markdown`],[`preview`,l,t?`预览`:`Preview`]].map(([e,t,n])=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>T(e),"aria-pressed":w===e,className:v(`inline-flex min-h-9 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium transition-colors`,w===e?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`),children:[(0,Q.jsx)(t,{className:`size-3.5`,"aria-hidden":!0}),n]},e))})]}),S===`SOUL.md`&&!p?(0,Q.jsxs)(`div`,{className:`mt-4`,children:[(0,Q.jsx)(`p`,{className:`mb-2 text-xs font-medium text-fg-muted`,children:t?`从模板开始`:`Start from a template`}),(0,Q.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-4`,children:we.map((e,n)=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>{e.content&&s(t=>({...t,"SOUL.md":Ce(t[`SOUL.md`],e.content)})),T(`direct`)},className:`flex min-h-11 items-center gap-2 rounded-xl border border-edge px-3 py-2 text-left text-xs font-medium text-fg-muted transition-colors hover:border-accent/40 hover:bg-surface-hover hover:text-fg`,children:[(0,Q.jsx)(k[n]??o,{className:`size-4 shrink-0 text-accent`,"aria-hidden":!0}),t?e.labelZh:e.labelEn]},e.id))})]}):null,b?(0,Q.jsx)(`p`,{className:`mt-4 rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-600`,role:`alert`,children:b}):null,(0,Q.jsx)(`div`,{className:`mt-4 h-[min(40vh,22rem)] min-h-64 overflow-hidden rounded-xl border border-edge bg-surface-panel`,role:`tabpanel`,children:p?(0,Q.jsx)(Me,{}):h?(0,Q.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-center text-sm text-fg-muted`,children:t?`无法加载角色配置,未对文件进行任何更改。`:`Profile documents could not be loaded. No files were changed.`}):w===`direct`?(0,Q.jsx)(X.Suspense,{fallback:(0,Q.jsx)(Me,{}),children:(0,Q.jsx)(Oe,{initialContent:A,onChange:e=>s(t=>({...t,[S]:Ce(t[S],e)})),placeholder:t?`直接输入内容,或输入 / 使用快捷命令…`:`Start writing, or type / for commands…`},`${e}-${S}-direct`)}):w===`source`?(0,Q.jsx)(X.Suspense,{fallback:(0,Q.jsx)(Me,{}),children:(0,Q.jsx)(ke,{initialContent:a[S],onChange:e=>s(t=>({...t,[S]:e})),isDark:i,lineWrap:!0,className:`min-h-0 flex-1`},`${e}-${S}-source`)}):(0,Q.jsx)(`div`,{className:`h-full overflow-y-auto p-5`,children:A.trim()?(0,Q.jsx)(u,{content:A}):(0,Q.jsx)(`p`,{className:`text-sm italic text-fg-muted`,children:t?`暂无内容。`:`No content yet.`})})}),(0,Q.jsx)(`div`,{className:`mt-2 flex justify-end text-xs text-fg-muted`,"aria-live":`polite`,children:_?t?`正在保存角色配置…`:`Saving profile documents…`:E?t?`角色配置有未保存的更改`:`Profile documents have unsaved changes`:t?`角色配置已保存`:`Profile documents saved`})]})]})})});function Pe(e){let t=(0,Z.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[10px] font-medium text-accent`,children:n}),t[0]=n,t[1]=r),r}function Fe(e){let t=(0,Z.c)(74),{label:n,inherited:r,value:i,zh:a,allowChatFallback:o,allowDisabled:s,modelKind:c,onChange:l}=e,u=o===void 0?!1:o,d=s===void 0?!1:s,f=c===void 0?`text`:c,p=i!=null,m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m={revalidateOnFocus:!1},t[0]=m):m=t[0];let h=O(p&&f!==`image`?M:null,j,m),g;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(g={revalidateOnFocus:!1},t[1]=g):g=t[1];let _=O(p&&f===`image`?`agent-defaults-image-models`:null,be,g),v;t[2]===_.data?v=t[3]:(v=_.data??[],t[2]=_.data,t[3]=v);let y;t[4]===v?y=t[5]:(y=v.flatMap(Le),t[4]=v,t[5]=y);let b=y,x;t[6]!==b||t[7]!==f||t[8]!==h?(x=f===`image`?b:h.data??[],t[6]=b,t[7]=f,t[8]=h,t[9]=x):x=t[9];let S=x,C;t[10]!==f||t[11]!==S?(C=f===`vision`?S.filter(Ie):S,t[10]=f,t[11]=S,t[12]=C):C=t[12];let w=C,T=f===`image`?_:h,E;t[13]===n?E=t[14]:(E=(0,Q.jsx)(`h4`,{className:`text-sm font-medium text-fg`,children:n}),t[13]=n,t[14]=E);let D;t[15]!==i||t[16]!==a?(D=i===void 0?(0,Q.jsx)(Pe,{children:a?`继承`:`Inherited`}):null,t[15]=i,t[16]=a,t[17]=D):D=t[17];let A;t[18]!==d||t[19]!==i||t[20]!==a?(A=i===null?(0,Q.jsx)(Pe,{children:d?a?`已禁用`:`Disabled`:a?`使用 Chat`:`Uses Chat`}):null,t[18]=d,t[19]=i,t[20]=a,t[21]=A):A=t[21];let N;t[22]!==E||t[23]!==D||t[24]!==A?(N=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[E,D,A]}),t[22]=E,t[23]=D,t[24]=A,t[25]=N):N=t[25];let P;t[26]!==r?.primary||t[27]!==i||t[28]!==a?(P=i===void 0?(0,Q.jsx)(`p`,{className:`mt-1 truncate font-mono text-xs text-fg-muted`,children:r?.primary??(a?`全局未配置`:`Not configured globally`)}):null,t[26]=r?.primary,t[27]=i,t[28]=a,t[29]=P):P=t[29];let F;t[30]!==N||t[31]!==P?(F=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[N,P]}),t[30]=N,t[31]=P,t[32]=F):F=t[32];let I;t[33]!==l||t[34]!==i||t[35]!==a?(I=i===void 0?null:(0,Q.jsx)(k,{variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>l(void 0),children:a?`继承`:`Inherit`}),t[33]=l,t[34]=i,t[35]=a,t[36]=I):I=t[36];let L;t[37]!==u||t[38]!==l||t[39]!==i||t[40]!==a?(L=u&&i!==null?(0,Q.jsx)(k,{variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>l(null),children:a?`使用 Chat`:`Use Chat`}):null,t[37]=u,t[38]=l,t[39]=i,t[40]=a,t[41]=L):L=t[41];let R;t[42]!==d||t[43]!==l||t[44]!==i||t[45]!==a?(R=d&&i!==null?(0,Q.jsx)(k,{variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>l(null),children:a?`禁用`:`Disable`}):null,t[42]=d,t[43]=l,t[44]=i,t[45]=a,t[46]=R):R=t[46];let z;t[47]!==p||t[48]!==r?.fallbacks||t[49]!==r?.primary||t[50]!==l||t[51]!==a?(z=p?null:(0,Q.jsx)(k,{className:`px-2 py-1 text-xs`,onClick:()=>l({primary:r?.primary??``,fallbacks:[...r?.fallbacks??[]]}),children:a?`自定义`:`Customize`}),t[47]=p,t[48]=r?.fallbacks,t[49]=r?.primary,t[50]=l,t[51]=a,t[52]=z):z=t[52];let B;t[53]!==I||t[54]!==L||t[55]!==R||t[56]!==z?(B=(0,Q.jsxs)(`div`,{className:`flex gap-1`,children:[I,L,R,z]}),t[53]=I,t[54]=L,t[55]=R,t[56]=z,t[57]=B):B=t[57];let H;t[58]!==F||t[59]!==B?(H=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[F,B]}),t[58]=F,t[59]=B,t[60]=H):H=t[60];let U;t[61]!==w||t[62]!==p||t[63]!==n||t[64]!==f||t[65]!==S||t[66]!==l||t[67]!==T||t[68]!==i||t[69]!==a?(U=p?(0,Q.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-[minmax(0,1fr)_minmax(0,0.8fr)]`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:a?`主模型`:`Primary model`}),T.isLoading?(0,Q.jsx)(V,{className:`mt-1.5 h-11 w-full rounded-lg`}):(0,Q.jsx)(ce,{value:i.primary,models:S,modelsLoading:T.isLoading,modelsError:T.error,capabilitiesFilter:f===`vision`?`vision`:void 0,placeholder:a?`选择模型`:`Select a model`,searchPlaceholder:a?`搜索模型或服务商`:`Search models or providers`,noMatches:a?`没有匹配的模型`:`No matching models`,contentAlign:`start`,className:`mt-1.5 w-full`,ariaLabel:a?`${n}主模型`:`${n} primary model`,onChange:e=>l({...i,primary:e})})]}),(0,Q.jsx)(oe,{title:a?`备用模型`:`Fallback models`,summary:a?`已配置 ${i.fallbacks.length} 个备用模型`:`${i.fallbacks.length} fallback models configured`,children:(0,Q.jsx)(ye,{primary:i.primary,value:i.fallbacks,models:w,loading:T.isLoading,error:T.error,zh:a,onChange:e=>l({...i,fallbacks:e})})})]}):null,t[61]=w,t[62]=p,t[63]=n,t[64]=f,t[65]=S,t[66]=l,t[67]=T,t[68]=i,t[69]=a,t[70]=U):U=t[70];let W;return t[71]!==H||t[72]!==U?(W=(0,Q.jsxs)(`div`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[H,U]}),t[71]=H,t[72]=U,t[73]=W):W=t[73],W}function Ie(e){return e.vision}function Le(e){return e.models.map(t=>({id:`${e.id}/${t}`,name:t,provider:e.label}))}var Re=[`fast`,`reasoning`,`coding`,`review`,`vision`,`understanding`],$=`w-full rounded-xl border border-edge bg-surface-base px-3 py-2.5 text-sm text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/15`;function ze(e){return[...new Set(e.split(`,`).map(e=>e.trim()).filter(Boolean))]}function Be(e){let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:void 0}function Ve(e){let t=(0,Z.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[10px] font-medium text-accent`,children:n}),t[0]=n,t[1]=r),r}function He(e){let t=(0,Z.c)(10),{title:n,description:r,action:i}=e,a;t[0]===n?a=t[1]:(a=(0,Q.jsx)(`h3`,{className:`text-base font-semibold text-fg`,children:n}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=r?(0,Q.jsx)(`p`,{className:`mt-1 text-sm leading-5 text-fg-muted`,children:r}):null,t[2]=r,t[3]=o);let s;t[4]!==a||t[5]!==o?(s=(0,Q.jsxs)(`div`,{children:[a,o]}),t[4]=a,t[5]=o,t[6]=s):s=t[6];let c;return t[7]!==i||t[8]!==s?(c=(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[s,i]}),t[7]=i,t[8]=s,t[9]=c):c=t[9],c}function Ue(e){let t=(0,Z.c)(10),{label:n,value:r,detail:i}=e,a;t[0]===n?a=t[1]:(a=(0,Q.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:n}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=(0,Q.jsx)(`p`,{className:`mt-2 truncate text-sm font-semibold text-fg`,title:r,children:r}),t[2]=r,t[3]=o);let s;t[4]===i?s=t[5]:(s=(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:i}),t[4]=i,t[5]=s);let c;return t[6]!==a||t[7]!==o||t[8]!==s?(c=(0,Q.jsxs)(`div`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[a,o,s]}),t[6]=a,t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function We(e){return Object.values(e).some(e=>e!==void 0)?e:void 0}function Ge({agent:e,toolIds:t,zh:n,messages:r,externalError:i,onDirtyChange:a,onClose:s,onOpenDefaults:c,onChat:l,onDelete:u}){let[f,p]=(0,X.useState)(`overview`),[g,y]=(0,X.useState)(()=>structuredClone(e.override)),[b,x]=(0,X.useState)(!1),[S,C]=(0,X.useState)(null),[w,T]=(0,X.useState)(!1),[E,D]=(0,X.useState)(!1),O=(0,X.useRef)(null),A=JSON.stringify(g)!==JSON.stringify(e.override)||E,j=[g.models?.chat,...Object.values(g.models?.intents??{}),g.models?.imageUnderstanding,g.models?.imageGeneration].some(e=>e!=null&&!e.primary.trim());(0,X.useEffect)(()=>a(A),[A,a]);let M=(0,X.useMemo)(()=>[...new Set([...t,...Object.keys(e.effective.tools),...Object.keys(g.tools??{}),...g.toolAllowlist??[]])].sort(),[e.effective.tools,g.toolAllowlist,g.tools,t]),P=[g.models?n?`模型`:`Models`:null,g.skills?n?`技能`:`Skills`:null,g.tools?n?`工具权限`:`Tool access`:null,g.runtime||g.workflows?n?`运行限制`:`Runtime`:null].filter(e=>!!e),F=g.toolAllowlist,I=F?M.filter(t=>F.includes(t)&&e.effective.tools[t]?.mode!==`deny`).length:null,L=Object.values(e.effective.tools).filter(e=>e.mode===`deny`).length,R=e.effective.skills.mode===`selected`?n?`${e.effective.skills.include.length} 个已选技能`:`${e.effective.skills.include.length} selected skills`:n?`所有已启用技能`:`All enabled skills`,z=g.profile?.name??e.name??e.id,B=(t,n)=>{y(r=>({...r,profile:{...r.profile,name:r.profile?.name??e.name??e.id,[t]:n}}))},V=_(n?`zh`:`en`).chat.workingDirectory,H={fast:r.editorIntentFast,reasoning:r.editorIntentReasoning,coding:r.editorIntentCoding,review:r.editorIntentReview,vision:r.editorIntentVision,understanding:r.editorIntentUnderstanding},U={inherit:r.editorToolModeInherit,allow:r.editorToolModeAllow,ask:r.editorToolModeAsk,deny:r.editorToolModeDeny},W=async()=>{x(!0),C(null);try{await O.current?.save();let t=(await N(e.id,{workspace:g.workspace??null,profile:g.profile,models:g.models??null,skills:g.skills??null,tools:g.tools??null,toolAllowlist:g.toolAllowlist??null,workflows:g.workflows??null,runtime:g.runtime??null})).agents.find(t=>t.id===e.id);t&&y(structuredClone(t.override)),D(!1)}catch(e){C(e instanceof Error?e.message:String(e))}finally{x(!1)}},G=async()=>{x(!0),C(null);try{await N(e.id,{setDefault:!0})}catch(e){C(e instanceof Error?e.message:String(e))}finally{x(!1)}},ee=(e,t)=>{let n={...g.tools??{}};t===`inherit`?delete n[e]:n[e]={...n[e],mode:t},y({...g,tools:Object.keys(n).length>0?n:void 0})},K=(t,n)=>{let r=new Set(g.toolAllowlist??[]);n?r.add(t):r.delete(t);let i={...g.tools??{}};n&&(i[t]?.mode===`deny`||e.effective.tools[t]?.mode===`deny`)&&(i[t]={...i[t],mode:`allow`}),y({...g,toolAllowlist:[...r],tools:Object.keys(i).length>0?i:void 0})},J=(e,t)=>{let n={...g.models??{}},r={...n.intents??{}};t===void 0?delete r[e]:r[e]=t,Object.keys(r).length>0?n.intents=r:delete n.intents,y({...g,models:Object.keys(n).length>0?n:void 0})},Y=(0,X.useCallback)(e=>{D(e)},[]);return(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col sm:flex-row`,children:[(0,Q.jsx)(`aside`,{className:`shrink-0 overflow-x-auto border-b border-edge px-3 py-3 sm:w-52 sm:overflow-y-auto sm:border-b-0 sm:border-r sm:px-3 sm:py-4`,children:(0,Q.jsx)(`nav`,{className:`flex gap-1 sm:flex-col`,children:[{id:`overview`,label:n?`概览`:`Overview`,icon:q},{id:`profile`,label:n?`个性`:`Profile`,icon:ue},{id:`models`,label:n?`模型`:`Models`,icon:h},{id:`capabilities`,label:n?`技能与工具`:`Skills & tools`,icon:o},{id:`runtime`,label:n?`运行限制`:`Runtime`,icon:q},{id:`danger`,label:n?`危险区`:`Danger zone`,icon:de}].map(({id:e,label:t,icon:n})=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>{p(e),e===`profile`&&T(!0)},className:v(`flex shrink-0 items-center gap-2.5 rounded-xl px-3 py-2 text-left text-sm font-medium transition-colors`,f===e?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:[(0,Q.jsx)(n,{className:`size-4`}),t]},e))})}),(0,Q.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,Q.jsxs)(`main`,{className:`min-h-0 flex-1 overflow-y-auto p-5 sm:p-6`,children:[S||i?(0,Q.jsx)(`p`,{className:`mb-4 rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:S??i}):null,f===`overview`?(0,Q.jsxs)(`div`,{className:`space-y-6`,children:[(0,Q.jsx)(He,{title:n?`配置概览`:`Configuration overview`,description:n?`查看当前真正生效的配置。未覆盖的部分会持续跟随全局默认值。`:`Review what actually takes effect. Anything not overridden keeps following global defaults.`,action:(0,Q.jsxs)(k,{onClick:l,children:[(0,Q.jsx)(d,{className:`size-4`}),n?`开始对话`:`Start chat`]})}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-4 rounded-2xl border border-accent/20 bg-accent/5 p-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:P.length>0?n?`已自定义:${P.join(`、`)}`:`Customized: ${P.join(`, `)}`:n?`能力配置使用全局默认`:`Capabilities use global defaults`}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:P.length>0?n?`其他能力会继续跟随全局默认配置。`:`All other capabilities continue to follow global defaults.`:n?`修改全局默认配置后,这个智能体会自动同步。`:`This agent updates automatically when global defaults change.`})]}),(0,Q.jsx)(k,{onClick:c,children:n?`查看全局默认配置`:`View global defaults`})]}),(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,Q.jsx)(Ue,{label:n?`对话模型`:`Chat model`,value:e.effective.models.chat.primary,detail:g.models?.chat?n?`单独设置`:`Agent override`:n?`继承全局`:`Inherited globally`}),(0,Q.jsx)(Ue,{label:n?`技能`:`Skills`,value:R,detail:g.skills?n?`单独设置`:`Agent override`:n?`继承全局`:`Inherited globally`}),(0,Q.jsx)(Ue,{label:n?`工具权限`:`Tool access`,value:I===null?L>0?n?`${L} 个禁用`:`${L} denied`:n?`全部可用`:`All available`:n?`${I} 个已开放`:`${I} in scope`,detail:F?n?`受智能体工具范围限制`:`Limited by agent tool scope`:g.tools?n?`${Object.keys(g.tools).length} 个本地覆盖`:`${Object.keys(g.tools).length} local overrides`:n?`继承全局`:`Inherited globally`}),(0,Q.jsx)(Ue,{label:n?`工作区`:`Workspace`,value:e.effective.workspace,detail:g.workspace?n?`单独设置`:`Agent specific`:n?`自动工作区`:`Automatic workspace`})]}),e.isDefault?null:(0,Q.jsx)(k,{onClick:()=>void G(),disabled:b,children:n?`设为默认智能体`:`Make default agent`})]}):null,w?(0,Q.jsxs)(`div`,{className:v(`space-y-6`,f!==`profile`&&`hidden`),children:[(0,Q.jsx)(He,{title:n?`身份、个性与工作区`:`Identity, behavior, and workspace`,description:n?`管理结构化身份资料、三类角色文件和工作目录。`:`Manage structured identity, three profile documents, and the working directory.`}),(0,Q.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4 sm:p-5`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Q.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-accent`,children:(0,Q.jsx)(h,{className:`size-4`,"aria-hidden":!0})}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`智能体身份`:`Agent identity`}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n?`身份资料保存在智能体配置中,供界面、对话和语音共同使用。`:`Identity is saved in the Agent profile and shared by the UI, chat, and voice.`})]})]}),(0,Q.jsxs)(`div`,{className:`mt-5 grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`名称`:`Name`,(0,Q.jsx)(`input`,{className:`${$} mt-1.5`,value:z,onChange:e=>B(`name`,e.target.value),placeholder:n?`例如:小助`:`e.g. Nova`})]}),(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`一句话介绍`:`Description`,(0,Q.jsx)(`input`,{className:`${$} mt-1.5`,value:g.profile?.description??``,onChange:e=>B(`description`,e.target.value),placeholder:n?`擅长什么、如何帮助你`:`What this agent is great at`})]}),(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`类型`:`Type`,(0,Q.jsx)(`input`,{className:`${$} mt-1.5`,list:`agent-creatures-${e.id}`,value:g.profile?.creature??``,onChange:e=>B(`creature`,e.target.value),placeholder:n?`AI 助手、研究伙伴…`:`AI assistant, research partner…`}),(0,Q.jsx)(`datalist`,{id:`agent-creatures-${e.id}`,children:Te.map(e=>(0,Q.jsx)(`option`,{value:e.value,children:n?e.labelZh:e.labelEn},e.value))})]}),(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`表达风格`:`Style`,(0,Q.jsx)(`input`,{className:`${$} mt-1.5`,value:g.profile?.style??``,onChange:e=>B(`style`,e.target.value),placeholder:n?`例如:直接、温和`:`e.g. direct and warm`})]}),(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`主要语言`:`Primary language`,(0,Q.jsx)(`input`,{className:`${$} mt-1.5`,value:g.profile?.language??``,onChange:e=>B(`language`,e.target.value),placeholder:n?`例如:简体中文`:`e.g. English`})]}),(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`签名表情`:`Signature emoji`,(0,Q.jsx)(`input`,{className:`${$} mt-1.5`,value:g.profile?.emoji??``,onChange:e=>B(`emoji`,e.target.value),placeholder:`✨`})]}),(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`头像地址`:`Avatar URL or path`,(0,Q.jsx)(`input`,{className:`${$} mt-1.5`,value:g.profile?.avatar??``,onChange:e=>B(`avatar`,e.target.value),placeholder:n?`URL 或本地路径`:`URL or local path`})]})]})]}),(0,Q.jsx)(Ne,{ref:O,agentId:e.id,zh:n,onDirtyChange:Y}),(0,Q.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4 sm:p-5`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`工作区`:`Workspace`}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n?`选择这个智能体读写文件时使用的目录;留空则使用自动工作区。`:`Choose where this agent reads and writes files, or leave it empty to use the automatic workspace.`})]}),g.workspace?(0,Q.jsxs)(k,{variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>y(e=>({...e,workspace:void 0})),children:[(0,Q.jsx)(m,{className:`size-3.5`}),n?`恢复自动`:`Use automatic`]}):(0,Q.jsx)(Ve,{children:n?`自动`:`Automatic`})]}),(0,Q.jsx)(`div`,{className:`mt-4`,children:(0,Q.jsx)(xe,{value:g.workspace??``,onChange:e=>y(t=>({...t,workspace:e||void 0})),wd:V,placeholder:e.effective.workspace,inputAriaLabel:n?`智能体工作区路径`:`Agent workspace path`,inputClassName:`${$} font-mono`,disabled:b})})]}),(0,Q.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4 sm:p-5`,children:[(0,Q.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`附加指令`:`Additional instructions`}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n?`补充简短的执行规则;个性与长期工作规范请写入上方角色配置。`:`Add short execution rules. Keep personality and lasting work guidance in the profile documents above.`}),(0,Q.jsx)(`textarea`,{rows:4,className:`${$} mt-4 resize-y leading-6`,value:g.profile?.instructions??``,onChange:t=>y(n=>({...n,profile:{...n.profile,name:n.profile?.name||e.name||e.id,instructions:t.target.value||void 0}})),placeholder:n?`可选:补充必须始终遵循的规则`:`Optional: add a rule that must always be followed`})]})]}):null,f===`models`?(0,Q.jsxs)(`div`,{className:`space-y-6`,children:[(0,Q.jsx)(He,{title:n?`模型路由`:`Model routing`,description:n?`日常对话使用 Chat;固定意图只在对应任务中生效。默认继承全局。`:`Chat handles normal turns; fixed intents apply only to matching work. Everything inherits by default.`,action:g.models?(0,Q.jsxs)(k,{variant:`ghost`,onClick:()=>y({...g,models:void 0}),children:[(0,Q.jsx)(m,{className:`size-4`}),n?`全部继承`:`Inherit all`]}):void 0}),(0,Q.jsx)(Fe,{label:r.editorChatModel,inherited:e.effective.models.chat,value:g.models?.chat,zh:n,onChange:e=>{let t={...g.models??{}};e?t.chat=e:delete t.chat,y({...g,models:Object.keys(t).length>0?t:void 0})}}),(0,Q.jsx)(oe,{title:n?`任务模型路由`:`Task model routing`,summary:n?`当前任务路由继续生效;未覆盖的任务继承全局设置。`:`Task routes remain active; unspecified routes inherit global defaults.`,children:(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-3 text-xs font-semibold uppercase tracking-wide text-fg-subtle`,children:n?`固定意图`:`Fixed intents`}),(0,Q.jsx)(`div`,{className:`space-y-3`,children:Re.map(t=>(0,Q.jsx)(Fe,{label:H[t],inherited:e.effective.models.intents[t]??e.effective.models.chat,value:g.models?.intents?.[t],zh:n,allowChatFallback:!0,modelKind:t===`vision`?`vision`:`text`,onChange:e=>J(t,e)},t))})]})}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-3 text-xs font-semibold uppercase tracking-wide text-fg-subtle`,children:n?`图片能力`:`Image capabilities`}),(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsx)(Fe,{label:n?`图片理解`:`Image understanding`,modelKind:`vision`,inherited:e.effective.models.imageUnderstanding,value:g.models?.imageUnderstanding,zh:n,allowDisabled:!0,onChange:e=>{let t={...g.models??{}};e===void 0?delete t.imageUnderstanding:t.imageUnderstanding=e,y({...g,models:Object.keys(t).length>0?t:void 0})}}),(0,Q.jsx)(Fe,{label:n?`图片生成`:`Image generation`,modelKind:`image`,inherited:e.effective.models.imageGeneration,value:g.models?.imageGeneration,zh:n,allowDisabled:!0,onChange:t=>{let n={...g.models??{}};t===void 0?delete n.imageGeneration:t===null?n.imageGeneration=null:n.imageGeneration={...t,timeoutMs:g.models?.imageGeneration?.timeoutMs??e.effective.models.imageGeneration?.timeoutMs,autoProviderFallback:g.models?.imageGeneration?.autoProviderFallback??e.effective.models.imageGeneration?.autoProviderFallback??!0},y({...g,models:Object.keys(n).length>0?n:void 0})}}),g.models?.imageGeneration?(0,Q.jsx)(oe,{title:n?`图片执行策略`:`Image execution policy`,summary:n?`当前超时和回退策略继续生效。`:`Current timeout and fallback settings remain active.`,children:(0,Q.jsxs)(`div`,{className:`grid gap-4 rounded-2xl border border-edge bg-surface-base p-4 sm:grid-cols-2`,children:[(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`生成超时(毫秒)`:`Generation timeout (ms)`,(0,Q.jsx)(_e,{allowEmpty:!0,type:`number`,min:1,className:`${$} mt-1.5`,value:g.models.imageGeneration.timeoutMs??``,onChange:e=>y({...g,models:{...g.models,imageGeneration:{...g.models.imageGeneration,timeoutMs:Be(e.target.value)}}})})]}),(0,Q.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[(0,Q.jsx)(`span`,{children:n?`提供商自动回退`:`Automatic provider fallback`}),(0,Q.jsx)(`div`,{className:`mt-1.5 flex rounded-xl bg-surface-hover p-1`,children:[!0,!1].map(e=>(0,Q.jsx)(`button`,{type:`button`,onClick:()=>y({...g,models:{...g.models,imageGeneration:{...g.models.imageGeneration,autoProviderFallback:e}}}),className:v(`flex-1 rounded-lg px-3 py-2 text-xs font-medium`,g.models?.imageGeneration?.autoProviderFallback===e?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted`),children:e?n?`开启`:`On`:n?`关闭`:`Off`},String(e)))})]})]})}):null]})]})]}):null,f===`capabilities`?(0,Q.jsxs)(`div`,{className:`space-y-7`,children:[(0,Q.jsx)(He,{title:n?`技能与工具`:`Skills and tools`,description:n?`默认继承全局能力;只设置确实不同的部分。`:`Keep inheritance for global capabilities; override only agents that genuinely differ.`}),(0,Q.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`技能策略`:`Skill policy`}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:g.skills?n?`当前使用单独设置`:`Using an agent override`:n?`当前继承全局`:`Currently inherited globally`})]}),g.skills?(0,Q.jsxs)(k,{variant:`ghost`,onClick:()=>y({...g,skills:void 0}),children:[(0,Q.jsx)(m,{className:`size-4`}),n?`继承`:`Inherit`]}):null]}),(0,Q.jsxs)(`div`,{className:`mt-4 flex gap-2`,children:[(0,Q.jsx)(k,{variant:g.skills?.mode===`merge`?`primary`:`secondary`,onClick:()=>y({...g,skills:{mode:`merge`,add:[],remove:[]}}),children:r.editorSkillModeMerge}),(0,Q.jsx)(k,{variant:g.skills?.mode===`replace`?`primary`:`secondary`,onClick:()=>y({...g,skills:{mode:`replace`,include:[]}}),children:r.editorSkillModeReplace})]}),g.skills?.mode===`merge`?(0,Q.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`新增技能`:`Add skills`,(0,Q.jsx)(`input`,{className:`${$} mt-1.5`,value:g.skills.add.join(`, `),onChange:e=>y({...g,skills:{mode:`merge`,add:ze(e.target.value),remove:g.skills?.mode===`merge`?g.skills.remove:[]}})})]}),(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`移除技能`:`Remove skills`,(0,Q.jsx)(`input`,{className:`${$} mt-1.5`,value:g.skills.remove.join(`, `),onChange:e=>y({...g,skills:{mode:`merge`,add:g.skills?.mode===`merge`?g.skills.add:[],remove:ze(e.target.value)}})})]})]}):null,g.skills?.mode===`replace`?(0,Q.jsxs)(`label`,{className:`mt-4 block text-xs font-medium text-fg-muted`,children:[n?`仅启用这些技能`:`Enable only these skills`,(0,Q.jsx)(`input`,{className:`${$} mt-1.5`,value:g.skills.include.join(`, `),onChange:e=>y({...g,skills:{mode:`replace`,include:ze(e.target.value)}})})]}):null]}),(0,Q.jsxs)(`section`,{children:[(0,Q.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,Q.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`工具权限`:`Tool permissions`}),g.tools?(0,Q.jsxs)(k,{variant:`ghost`,onClick:()=>y({...g,tools:void 0}),children:[(0,Q.jsx)(m,{className:`size-4`}),n?`全部继承`:`Inherit all`]}):null]}),F?(0,Q.jsx)(`p`,{className:`mb-3 text-xs text-fg-muted`,children:n?`此智能体使用限定的工具范围。可在下方启用或移除工具,保存后从下一轮对话生效。`:`This agent uses a limited tool set. Add or remove tools below; changes apply from the next conversation turn.`}):null,(0,Q.jsx)(`div`,{className:`divide-y divide-edge overflow-hidden rounded-2xl border border-edge bg-surface-base`,children:M.map(t=>{if(F&&!F.includes(t))return(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-4 py-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`code`,{className:`text-xs text-fg-muted`,children:t}),(0,Q.jsx)(`p`,{className:`mt-1 text-[11px] text-fg-muted`,children:n?`未开放`:`Unavailable`})]}),(0,Q.jsx)(k,{variant:`secondary`,className:`px-3 py-1.5 text-xs`,onClick:()=>K(t,!0),children:n?`启用`:`Enable`})]},t);let r=g.tools?.[t]?.mode,i=e.effective.tools[t]?.mode??`allow`;return(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 px-4 py-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`code`,{className:`text-xs text-fg`,children:t}),(0,Q.jsx)(`p`,{className:`mt-1 text-[11px] text-fg-muted`,children:r?n?`单独设置`:`Agent override`:`${n?`继承`:`Inherits`} ${U[i]}`})]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(`div`,{className:`flex rounded-xl bg-surface-hover p-1`,children:[`inherit`,`allow`,`ask`,`deny`].map(e=>(0,Q.jsx)(`button`,{type:`button`,onClick:()=>ee(t,e),className:v(`rounded-lg px-2.5 py-1.5 text-xs font-medium transition-colors`,(e===`inherit`?!r:r===e)?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`),children:U[e]},e))}),F?(0,Q.jsx)(k,{variant:`ghost`,className:`px-2 py-1.5 text-xs`,onClick:()=>K(t,!1),children:n?`移除`:`Remove`}):null]})]},t)})})]})]}):null,f===`runtime`?(0,Q.jsxs)(`div`,{className:`space-y-6`,children:[(0,Q.jsx)(He,{title:n?`运行限制`:`Runtime limits`,description:n?`留空即继承全局限制。`:`Leave blank to inherit global limits. Use overrides only to tighten or relax a specialist agent.`,action:g.runtime||g.workflows?(0,Q.jsxs)(k,{variant:`ghost`,onClick:()=>y({...g,runtime:void 0,workflows:void 0}),children:[(0,Q.jsx)(m,{className:`size-4`}),n?`全部继承`:`Inherit all`]}):void 0}),(0,Q.jsx)(oe,{title:n?`执行限制`:`Execution limits`,summary:n?`保留当前运行限制;未覆盖的字段继承全局设置。`:`Current limits remain active; unspecified limits inherit globally.`,children:(0,Q.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[[`maxTurns`,n?`单次最大轮数`:`Maximum turns`],[`timeoutMs`,n?`单轮超时(毫秒)`:`Turn timeout (ms)`],[`maxToolFailuresPerTurn`,n?`最大工具失败次数`:`Maximum tool failures`]].map(([t,r])=>(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[(0,Q.jsxs)(`span`,{className:`flex items-center gap-2`,children:[r,g.runtime?.[t]===void 0?(0,Q.jsx)(Ve,{children:n?`继承`:`Inherited`}):null]}),(0,Q.jsx)(_e,{allowEmpty:!0,type:`number`,min:1,className:`${$} mt-1.5`,value:g.runtime?.[t]??``,placeholder:String(e.effective.runtime[t]??``),onChange:e=>{let n=We({...g.runtime??{},[t]:Be(e.target.value)});y({...g,runtime:n})}})]},t))})}),(0,Q.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[(0,Q.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`工作流`:`Workflows`}),(0,Q.jsxs)(`div`,{className:`mt-4 grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsx)(oe,{title:n?`默认工作流`:`Default workflow`,summary:g.workflows?.default??e.effective.workflows.default??(n?`未自动绑定工作流`:`No workflow bound automatically`),children:(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`默认工作流`:`Default workflow`,(0,Q.jsx)(`input`,{className:`${$} mt-1.5`,value:g.workflows?.default??``,placeholder:e.effective.workflows.default,onChange:e=>{let t=We({...g.workflows??{},default:e.target.value||void 0});y({...g,workflows:t})}})]})}),(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`允许的工作流`:`Allowed workflows`,(0,Q.jsx)(`input`,{className:`${$} mt-1.5`,value:g.workflows?.allowed?.join(`, `)??``,placeholder:e.effective.workflows.allowed?.join(`, `),onChange:e=>{let t=ze(e.target.value),n=We({...g.workflows??{},allowed:t.length>0?t:void 0});y({...g,workflows:n})}})]})]})]}),(0,Q.jsx)(oe,{title:n?`提示词缓存`:`Prompt cache`,summary:g.runtime?.promptCache?.mode??(n?`继承全局`:`Inherited globally`),children:(0,Q.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`提示词缓存`:`Prompt cache`}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:g.runtime?.promptCache?n?`使用单独设置`:`Using agent override`:n?`继承全局`:`Inherited globally`})]}),g.runtime?.promptCache?(0,Q.jsxs)(k,{variant:`ghost`,onClick:()=>{let e=We({...g.runtime??{},promptCache:void 0});y({...g,runtime:e})},children:[(0,Q.jsx)(m,{className:`size-4`}),n?`继承`:`Inherit`]}):null]}),g.runtime?.promptCache?(0,Q.jsxs)(`div`,{className:`mt-4 grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[(0,Q.jsx)(`span`,{children:n?`模式`:`Mode`}),(0,Q.jsx)(`div`,{className:`mt-1.5 flex rounded-xl bg-surface-hover p-1`,children:[`auto`,`off`].map(e=>(0,Q.jsx)(`button`,{type:`button`,onClick:()=>y({...g,runtime:{...g.runtime,promptCache:{...g.runtime.promptCache,mode:e}}}),className:v(`flex-1 rounded-lg px-3 py-2 text-xs font-medium`,g.runtime?.promptCache?.mode===e?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted`),children:e===`auto`?r.editorCacheModeAuto:r.editorCacheModeOff},e))})]}),(0,Q.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[(0,Q.jsx)(`span`,{children:n?`缓存周期`:`Lifetime`}),(0,Q.jsx)(`div`,{className:`mt-1.5 flex rounded-xl bg-surface-hover p-1`,children:[`short`,`long`].map(e=>(0,Q.jsx)(`button`,{type:`button`,onClick:()=>y({...g,runtime:{...g.runtime,promptCache:{...g.runtime.promptCache,lifetime:e}}}),className:v(`flex-1 rounded-lg px-3 py-2 text-xs font-medium`,g.runtime?.promptCache?.lifetime===e?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted`),children:e===`short`?r.editorCacheLifetimeShort:r.editorCacheLifetimeLong},e))})]})]}):(0,Q.jsx)(k,{className:`mt-4`,onClick:()=>y({...g,runtime:{...g.runtime,promptCache:{...e.effective.runtime.promptCache??{mode:`auto`,lifetime:`short`}}}}),children:n?`自定义缓存策略`:`Customize cache policy`})]})})]}):null,f===`danger`?(0,Q.jsxs)(`div`,{className:`space-y-6`,children:[(0,Q.jsx)(He,{title:n?`危险区`:`Danger zone`,description:n?`这些操作会改变默认路由或移除智能体。`:`These actions change default routing or remove the agent.`}),e.isDefault?null:(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-4 rounded-2xl border border-edge bg-surface-base p-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`设为默认智能体`:`Make default agent`}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n?`新会话和未指定路由将使用这个智能体。`:`New sessions and unspecified routes will use this agent.`})]}),(0,Q.jsx)(k,{disabled:b,onClick:()=>void G(),children:n?`设为默认`:`Make default`})]}),e.isDefault?(0,Q.jsx)(`p`,{className:`rounded-2xl bg-surface-base p-4 text-sm text-fg-muted`,children:n?`默认智能体不能删除,请先将其他智能体设为默认。`:`The default agent cannot be deleted. Make another agent the default first.`}):(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-4 rounded-2xl border border-red-500/25 bg-red-500/5 p-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`text-sm font-semibold text-red-600`,children:n?`删除智能体`:`Delete agent`}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n?`配置条目会被移除,删除前仍会再次确认。`:`The configuration entry will be removed after confirmation.`})]}),(0,Q.jsxs)(k,{variant:`ghost`,className:`text-red-600`,onClick:u,children:[(0,Q.jsx)(de,{className:`size-4`}),n?`删除`:`Delete`]})]})]}):null]}),(0,Q.jsxs)(`footer`,{className:`flex shrink-0 items-center justify-between gap-3 border-t border-edge bg-surface-panel px-5 py-3`,children:[(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:j?n?`请补全自定义模型`:`Complete the custom model reference`:A?n?`有未保存的更改`:`Unsaved changes`:n?`所有更改已保存`:`All changes saved`}),(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsx)(k,{onClick:s,children:n?`关闭`:`Close`}),(0,Q.jsx)(k,{variant:`primary`,disabled:b||!A||j||g.profile!==void 0&&!g.profile.name.trim(),onClick:()=>void W(),children:b?n?`保存中…`:`Saving…`:n?`保存更改`:`Save changes`})]})]})]})]})}function Ke(e){let t=(0,Z.c)(36),{agent:n,messages:r,open:i,onOpenChange:a,children:o}=e,[c,l]=(0,X.useState)(null),u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(x,{className:v(`xopc-dialog-overlay fixed inset-0 bg-scrim`,U)}),t[0]=u):u=t[0];let d;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(d=v(`xopc-dialog-content fixed flex flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-popover`,H,`inset-3 h-[calc(100dvh-1.5rem)] min-h-0 sm:inset-auto sm:left-1/2 sm:top-1/2`,`sm:h-[min(88vh,48rem)] sm:w-[min(94vw,62rem)] sm:-translate-x-1/2 sm:-translate-y-1/2`),t[1]=d):d=t[1];let f;t[2]!==n.avatar||t[3]!==n.id?(f=(0,Q.jsx)(se,{agentId:n.id,avatar:n.avatar,size:42,className:`size-11 shrink-0`}),t[2]=n.avatar,t[3]=n.id,t[4]=f):f=t[4];let p;t[5]!==n||t[6]!==r?(p=le(n,r),t[5]=n,t[6]=r,t[7]=p):p=t[7];let m;t[8]===p?m=t[9]:(m=(0,Q.jsx)(E,{className:`truncate text-base font-semibold text-fg`,children:p}),t[8]=p,t[9]=m);let h;t[10]===n.id?h=t[11]:(h=(0,Q.jsx)(S,{className:`mt-0.5 truncate font-mono text-xs text-fg-muted`,children:n.id}),t[10]=n.id,t[11]=h);let _;t[12]!==m||t[13]!==h?(_=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[m,h]}),t[12]=m,t[13]=h,t[14]=_):_=t[14];let y;t[15]!==n.isDefault||t[16]!==r.listDefaultBadge?(y=n.isDefault?(0,Q.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent`,children:r.listDefaultBadge}):null,t[15]=n.isDefault,t[16]=r.listDefaultBadge,t[17]=y):y=t[17];let b;t[18]!==f||t[19]!==_||t[20]!==y?(b=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[f,_,y]}),t[18]=f,t[19]=_,t[20]=y,t[21]=b):b=t[21];let O;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Q.jsx)(g,{className:`size-4`}),t[22]=O):O=t[22];let k;t[23]===r.closeDialogAria?k=t[24]:(k=(0,Q.jsx)(C,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:`rounded-lg p-2 text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":r.closeDialogAria,children:O})}),t[23]=r.closeDialogAria,t[24]=k);let A;t[25]!==k||t[26]!==b?(A=(0,Q.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-4 border-b border-edge px-5 py-4`,children:[b,k]}),t[25]=k,t[26]=b,t[27]=A):A=t[27];let j;t[28]!==o||t[29]!==c||t[30]!==A?(j=(0,Q.jsxs)(w,{children:[u,(0,Q.jsx)(T,{ref:l,className:d,onOpenAutoFocus:qe,children:(0,Q.jsxs)(s,{layer:`modal`,portalContainer:c,children:[A,o]})})]}),t[28]=o,t[29]=c,t[30]=A,t[31]=j):j=t[31];let M;return t[32]!==a||t[33]!==i||t[34]!==j?(M=(0,Q.jsx)(D,{open:i,onOpenChange:a,children:j}),t[32]=a,t[33]=i,t[34]=j,t[35]=M):M=t[35],M}function qe(e){return e.preventDefault()}function Je(e){let t=(0,Z.c)(13),{agents:n,busy:r,messages:i,onOpen:a,onChat:o}=e,s;if(t[0]!==n||t[1]!==r||t[2]!==i||t[3]!==o||t[4]!==a){let e;t[6]!==r||t[7]!==i||t[8]!==o||t[9]!==a?(e=e=>{let t=le(e,i),n=ge(e,i);return(0,Q.jsx)(`li`,{className:`min-h-0`,children:(0,Q.jsxs)(`article`,{className:v(`group relative flex min-h-52 flex-col rounded-2xl border border-edge bg-surface-panel p-4 shadow-surface`,`transition-[transform,background-color,border-color] duration-200 ease-out hover:-translate-y-0.5 hover:border-accent/30 hover:bg-surface-hover/35 active:scale-[0.99] motion-reduce:transform-none`),children:[(0,Q.jsx)(`button`,{type:`button`,disabled:r,"aria-label":i.listConfigureAgent.replace(`{{name}}`,t),onClick:()=>a(e.id),className:`absolute inset-0 z-0 rounded-2xl focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`}),(0,Q.jsxs)(`div`,{className:`pointer-events-none relative z-10 flex items-start justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,Q.jsx)(se,{agentId:e.id,avatar:e.avatar,size:48,className:`size-12 shrink-0`}),(0,Q.jsx)(`div`,{className:`min-w-0`,children:(0,Q.jsx)(`h2`,{className:`truncate text-base font-semibold text-fg`,children:t})})]}),(0,Q.jsx)(`span`,{className:v(`rounded-full px-2 py-0.5 text-[11px] font-medium`,e.isDefault?`bg-accent-soft text-accent`:`bg-surface-hover text-fg-muted`),children:e.isDefault?i.listDefaultBadge:i.listCustomBadge})]}),(0,Q.jsx)(`p`,{className:`pointer-events-none relative z-10 mt-5 line-clamp-2 min-h-10 text-sm leading-5 text-fg-muted`,children:n||e.override.profile?.instructions||i.listUsesGlobalSettings}),(0,Q.jsxs)(`div`,{className:`pointer-events-none relative z-10 mt-4 rounded-xl bg-surface-base px-3 py-2.5`,children:[(0,Q.jsx)(`p`,{className:`text-[11px] font-medium uppercase tracking-wide text-fg-subtle`,children:i.listCurrentModelLabel}),(0,Q.jsx)(`p`,{className:`mt-1 truncate font-mono text-xs text-fg`,children:e.effective.models.chat.primary})]}),(0,Q.jsx)(`div`,{className:`relative z-10 mt-auto pt-4`,children:(0,Q.jsxs)(k,{className:`w-full`,disabled:r,onClick:t=>{t.stopPropagation(),o(e.id)},children:[(0,Q.jsx)(d,{className:`size-4`}),i.listChatWithAgent]})})]})},e.id)},t[6]=r,t[7]=i,t[8]=o,t[9]=a,t[10]=e):e=t[10],s=n.map(e),t[0]=n,t[1]=r,t[2]=i,t[3]=o,t[4]=a,t[5]=s}else s=t[5];let c;return t[11]===s?c=t[12]:(c=(0,Q.jsx)(`ul`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:s}),t[11]=s,t[12]=c),c}var Ye=`w-full rounded-xl border border-edge bg-surface-base px-3 py-2.5 text-sm text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/15`;function Xe(e){let t=(0,Z.c)(79),{draft:n,busy:r,error:i,messages:a,workingDirectoryMessages:o,onChange:s,onCreate:c,onOpenChange:l}=e,u=n.open,d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(x,{className:v(`xopc-dialog-overlay fixed inset-0 bg-scrim`,U)}),t[0]=d):d=t[0];let f;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(f=v(`xopc-dialog-content fixed left-1/2 top-1/2 flex h-[min(38rem,calc(100dvh-2rem))] w-[min(92vw,36rem)] -translate-x-1/2 -translate-y-1/2 flex-col`,`overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-popover`,H),t[1]=f):f=t[1];let p;t[2]===a.manualCreateTitle?p=t[3]:(p=(0,Q.jsx)(E,{className:`text-base font-semibold text-fg`,children:a.manualCreateTitle}),t[2]=a.manualCreateTitle,t[3]=p);let m;t[4]===a.manualCreateDescription?m=t[5]:(m=(0,Q.jsx)(S,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:a.manualCreateDescription}),t[4]=a.manualCreateDescription,t[5]=m);let h;t[6]!==p||t[7]!==m?(h=(0,Q.jsxs)(`div`,{children:[p,m]}),t[6]=p,t[7]=m,t[8]=h):h=t[8];let _;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Q.jsx)(g,{className:`size-4`,"aria-hidden":!0}),t[9]=_):_=t[9];let y;t[10]===a.manualCreateClose?y=t[11]:(y=(0,Q.jsx)(C,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:`touch-target shrink-0 rounded-lg p-2 text-fg-muted hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":a.manualCreateClose,children:_})}),t[10]=a.manualCreateClose,t[11]=y);let b;t[12]!==h||t[13]!==y?(b=(0,Q.jsxs)(`header`,{className:`flex shrink-0 items-start justify-between gap-4 border-b border-edge px-5 py-4`,children:[h,y]}),t[12]=h,t[13]=y,t[14]=b):b=t[14];let O;t[15]===i?O=t[16]:(O=i?(0,Q.jsx)(`p`,{role:`alert`,className:`rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:i}):null,t[15]=i,t[16]=O);let A;t[17]===s?A=t[18]:(A=e=>s({name:e.target.value}),t[17]=s,t[18]=A);let j;t[19]!==n.name||t[20]!==a.manualCreateNamePlaceholder||t[21]!==A?(j=(0,Q.jsx)(`input`,{id:`manual-agent-name`,autoFocus:!0,className:`${Ye} mt-1.5`,value:n.name,onChange:A,placeholder:a.manualCreateNamePlaceholder}),t[19]=n.name,t[20]=a.manualCreateNamePlaceholder,t[21]=A,t[22]=j):j=t[22];let M;t[23]!==a.manualCreateName||t[24]!==j?(M=(0,Q.jsxs)(`label`,{htmlFor:`manual-agent-name`,className:`block text-xs font-medium text-fg-muted`,children:[a.manualCreateName,j]}),t[23]=a.manualCreateName,t[24]=j,t[25]=M):M=t[25];let N;t[26]===s?N=t[27]:(N=e=>s({instructions:e.target.value}),t[26]=s,t[27]=N);let P;t[28]!==n.instructions||t[29]!==a.manualCreateInstructionsPlaceholder||t[30]!==N?(P=(0,Q.jsx)(`textarea`,{id:`manual-agent-instructions`,rows:4,className:`${Ye} mt-1.5 resize-y leading-6`,value:n.instructions,onChange:N,placeholder:a.manualCreateInstructionsPlaceholder}),t[28]=n.instructions,t[29]=a.manualCreateInstructionsPlaceholder,t[30]=N,t[31]=P):P=t[31];let F;t[32]!==a.manualCreateInstructions||t[33]!==P?(F=(0,Q.jsxs)(`label`,{htmlFor:`manual-agent-instructions`,className:`block text-xs font-medium text-fg-muted`,children:[a.manualCreateInstructions,P]}),t[32]=a.manualCreateInstructions,t[33]=P,t[34]=F):F=t[34];let I;t[35]===a.manualCreateWorkspace?I=t[36]:(I=(0,Q.jsx)(`label`,{htmlFor:`manual-agent-workspace`,className:`block text-xs font-medium text-fg-muted`,children:a.manualCreateWorkspace}),t[35]=a.manualCreateWorkspace,t[36]=I);let L;t[37]===a.manualCreateWorkspaceHint?L=t[38]:(L=(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:a.manualCreateWorkspaceHint}),t[37]=a.manualCreateWorkspaceHint,t[38]=L);let R;t[39]===s?R=t[40]:(R=e=>s({workspace:e}),t[39]=s,t[40]=R);let z;t[41]!==r||t[42]!==n.workspace||t[43]!==a.manualCreateWorkspace||t[44]!==a.manualCreateWorkspacePlaceholder||t[45]!==R||t[46]!==o?(z=(0,Q.jsx)(`div`,{className:`mt-2`,children:(0,Q.jsx)(xe,{value:n.workspace,onChange:R,disabled:r,wd:o,placeholder:a.manualCreateWorkspacePlaceholder,inputAriaLabel:a.manualCreateWorkspace,inputClassName:`${Ye} font-mono`})}),t[41]=r,t[42]=n.workspace,t[43]=a.manualCreateWorkspace,t[44]=a.manualCreateWorkspacePlaceholder,t[45]=R,t[46]=o,t[47]=z):z=t[47];let B;t[48]!==I||t[49]!==L||t[50]!==z?(B=(0,Q.jsxs)(`div`,{children:[I,L,z]}),t[48]=I,t[49]=L,t[50]=z,t[51]=B):B=t[51];let V;t[52]!==O||t[53]!==M||t[54]!==F||t[55]!==B?(V=(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-5 overflow-y-auto p-5`,children:[O,M,F,B]}),t[52]=O,t[53]=M,t[54]=F,t[55]=B,t[56]=V):V=t[56];let W;t[57]!==r||t[58]!==a.manualCreateCancel?(W=(0,Q.jsx)(C,{asChild:!0,children:(0,Q.jsx)(k,{disabled:r,children:a.manualCreateCancel})}),t[57]=r,t[58]=a.manualCreateCancel,t[59]=W):W=t[59];let G;t[60]!==r||t[61]!==n.name?(G=r||!n.name.trim(),t[60]=r,t[61]=n.name,t[62]=G):G=t[62];let ee=r?a.manualCreating:a.manualCreateSubmit,K;t[63]!==r||t[64]!==c||t[65]!==G||t[66]!==ee?(K=(0,Q.jsx)(k,{variant:`primary`,disabled:G,"aria-busy":r,onClick:c,children:ee}),t[63]=r,t[64]=c,t[65]=G,t[66]=ee,t[67]=K):K=t[67];let q;t[68]!==W||t[69]!==K?(q=(0,Q.jsxs)(`footer`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[W,K]}),t[68]=W,t[69]=K,t[70]=q):q=t[70];let J;t[71]!==V||t[72]!==q||t[73]!==b?(J=(0,Q.jsxs)(w,{children:[d,(0,Q.jsxs)(T,{className:f,children:[b,V,q]})]}),t[71]=V,t[72]=q,t[73]=b,t[74]=J):J=t[74];let Y;return t[75]!==n.open||t[76]!==l||t[77]!==J?(Y=(0,Q.jsx)(D,{open:u,onOpenChange:l,children:J}),t[75]=n.open,t[76]=l,t[77]=J,t[78]=Y):Y=t[78],Y}var Ze=`px-4 pb-7 pt-3 sm:px-6 lg:px-8 lg:pb-9 lg:pt-4`,Qe=`max-w-7xl`;function $e(){let e=(0,Z.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(V,{className:`h-7 w-28`}),(0,Q.jsx)(V,{className:`h-4 w-80 max-w-full`})]}),(0,Q.jsx)(V,{className:`h-9 w-28`})]}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsxs)(ve,{gap:`gap-5`,padding:Ze,className:Qe,children:[t,(0,Q.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:[0,1,2].map(et)})]}),e[1]=n):n=e[1],n}function et(e){return(0,Q.jsx)(V,{className:`h-64 rounded-2xl`},e)}function tt({agentId:e,onHeaderActionChange:t}){let n=y(e=>e.conversationId),r=b(e=>e.language),i=r===`zh`,o=_(r),s=o.agentsSettings,l=a(),{data:u,error:d,isLoading:f,mutate:m}=O(n?`settings-gateway-agents`:null,I),[h,g]=(0,X.useState)(!1),[x,S]=(0,X.useState)(null),[C,w]=(0,X.useState)(null),[T,E]=(0,X.useState)(null),[D,j]=(0,X.useState)({open:!1,name:``,instructions:``,workspace:``}),M=(0,X.useRef)(!1),N=u?.agents.find(t=>t.id===e),P=(0,X.useCallback)(()=>{u&&(S(null),he(u.defaultId),l(`/chat/new?${new URLSearchParams({agentSetup:`1`,projectScope:`none`,draft:s.setupDraftPrefix}).toString()}`,{state:{forceNewChat:!0,agentId:u.defaultId}}))},[s.setupDraftPrefix,u,l]),L=(0,X.useCallback)(async()=>{if(!(h||!D.name.trim())){g(!0),w(null);try{let e=await z({profile:{name:D.name.trim(),...D.instructions.trim()?{instructions:D.instructions.trim()}:{}},...D.workspace.trim()?{workspace:D.workspace.trim()}:{}});j({open:!1,name:``,instructions:``,workspace:``}),he(e.createdAgentId),l(`/chat/new?projectScope=none`,{state:{forceNewChat:!0,agentId:e.createdAgentId}})}catch(e){w(e instanceof Error?e.message:String(e))}finally{g(!1)}}},[h,D,l]),R=(0,X.useMemo)(()=>({overflow:(0,Q.jsxs)(re,{children:[(0,Q.jsx)(W,{asChild:!0,children:(0,Q.jsx)(k,{variant:`secondary`,className:`size-9 shrink-0 p-0`,"aria-label":o.capabilitiesHub.moreActions,title:o.capabilitiesHub.moreActions,children:(0,Q.jsx)(c,{className:`size-4`,"aria-hidden":!0})})}),(0,Q.jsx)(J,{children:(0,Q.jsxs)(ee,{align:`end`,sideOffset:6,className:`z-50 min-w-48 rounded-xl border border-edge bg-surface-panel p-1 shadow-popover`,children:[(0,Q.jsxs)(K,{className:v(`touch-target flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover`,A.transition),onSelect:()=>l(`/settings/agent-defaults`),children:[(0,Q.jsx)(ie,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),i?`全局默认配置`:`Global defaults`]}),(0,Q.jsxs)(K,{className:v(`touch-target flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover`,A.transition),onSelect:()=>{w(null),j(e=>({...e,open:!0}))},children:[(0,Q.jsx)(Y,{className:`size-4 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),s.manualCreateMenu]})]})})]}),primary:(0,Q.jsxs)(k,{variant:`primary`,className:`shrink-0`,"aria-label":s.listNewAgentCard,onClick:P,children:[(0,Q.jsx)(p,{className:`size-4`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`hidden sm:inline`,children:s.listNewAgentCard})]})}),[s.listNewAgentCard,s.manualCreateMenu,o.capabilitiesHub.moreActions,l,P,i]);(0,X.useLayoutEffect)(()=>(t?.(R),()=>t?.(null)),[R,t]);let B=async e=>{g(!0),S(null);try{await F(e.id),l(G)}catch(e){S(e instanceof Error?e.message:String(e))}finally{g(!1)}},V=e=>{he(e),l(`/chat/new`)},H=e=>{M.current=!1,window.setTimeout(()=>l(ne(e)),0)},U=()=>{if(M.current){E({kind:`discard`,destination:G});return}M.current=!1,l(G)},q=()=>{if(M.current){E({kind:`discard`,destination:`/settings/agent-defaults`});return}M.current=!1,l(`/settings/agent-defaults`)},te=()=>{if(!T)return;if(E(null),T.kind===`discard`){M.current=!1,l(T.destination);return}let e=u?.agents.find(e=>e.id===T.agentId);e&&B(e)},ae=(0,X.useCallback)(e=>{M.current=e},[]);return n?d&&!u?(0,Q.jsxs)(ve,{className:Qe,padding:Ze,children:[(0,Q.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:String(d)}),(0,Q.jsx)(k,{onClick:()=>void m(),children:i?`重试`:`Retry`})]}):f||!u?(0,Q.jsx)($e,{}):(0,Q.jsxs)(ve,{gap:`gap-5`,className:Qe,padding:Ze,children:[(d||x)&&!N?(0,Q.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:x??String(d)}):null,(0,Q.jsx)(Je,{agents:u.agents,busy:h,messages:s,onOpen:H,onChat:V}),N?(0,Q.jsx)(Ke,{agent:N,messages:s,open:!0,onOpenChange:e=>{e||U()},children:(0,Q.jsx)(Ge,{agent:N,toolIds:u.builtinToolIds,zh:i,messages:s,externalError:x,onDirtyChange:ae,onClose:U,onOpenDefaults:q,onChat:()=>V(N.id),onDelete:()=>E({kind:`delete`,agentId:N.id,displayName:le(N,s)})},N.id)}):null,(0,Q.jsx)(Xe,{draft:D,busy:h,error:C,messages:s,workingDirectoryMessages:o.chat.workingDirectory,onChange:e=>j(t=>({...t,...e})),onCreate:()=>void L(),onOpenChange:e=>{h||(j(t=>({...t,open:e})),e||w(null))}}),(0,Q.jsx)(me,{open:T!==null,title:T?.kind===`delete`?i?`删除智能体?`:`Delete agent?`:i?`放弃未保存的更改?`:`Discard unsaved changes?`,description:T?.kind===`delete`?i?`删除 ${T.displayName}?此操作无法撤销。`:`Delete ${T.displayName}? This cannot be undone.`:i?`当前更改尚未保存,离开后将丢失。`:`Your changes have not been saved. Leaving will discard them.`,confirmLabel:T?.kind===`delete`?i?`删除`:`Delete`:i?`放弃并离开`:`Discard and leave`,cancelLabel:i?`继续编辑`:`Keep editing`,destructive:!0,overlayClassName:`z-[100]`,contentClassName:`z-[101]`,onConfirm:te,onCancel:()=>E(null)})]}):(0,Q.jsx)(ve,{className:Qe,padding:Ze,children:(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:i?`需要本机服务令牌。`:`Local service token required.`})})}export{tt as AgentsSettingsPanel};
@@ -1,6 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i,g as a,t as o}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{t as s}from"./activity-YogQEteU.js";import{t as c}from"./check-DUBLcKHA.js";import{t as l}from"./chevron-right-BweFrslA.js";import{c as u,l as d,n as f,r as p,u as m}from"./popover-select-BgSdSbCL.js";import{t as h}from"./circle-alert-BEjgurr2.js";import{t as g}from"./circle-check-C23XjkUj.js";import{t as _}from"./clock-3-DnrAnuyZ.js";import{t as v}from"./ellipsis-0k4rZLoy.js";import{t as y}from"./markdown-view-CdqdeQqI.js";import{t as b}from"./git-branch-Dh9uxTot.js";import{t as x}from"./pause-DuPxgSxk.js";import{t as S}from"./pencil-DmIY3Oa-.js";import{t as ee}from"./play-kxZvpBg8.js";import{t as C}from"./plus-Q2yW6OE7.js";import{t as w}from"./search-DA7gz22f.js";import{t as te}from"./sparkles-DHlfQFAF.js";import{t as T}from"./x-B_N4OPjy.js";import{t as E}from"./messages-BpEhZm54.js";import{t as D}from"./cn-JdwAhgNB.js";import{n as O}from"./locale-store-CeoW7A5a.js";import{a as k,n as A,o as j,r as M,s as N,t as P}from"./dist-BGTk37IG.js";import{i as F}from"./vendor-swr-BIWyz7Rc.js";import{t as I}from"./button-CS04eWY9.js";import{a as L,c as R,i as z,o as ne,s as re}from"./dist-C3DSFZCi.js";import{t as B}from"./skeleton-BwbyijEw.js";import{Bn as ie,Dc as ae,Fn as oe,In as se,Io as V,Ln as ce,No as H,Rn as le,Tc as ue,Wo as de,Xr as U,_o as W,ao as G,bn as fe,hs as pe,ki as me,l as K,li as he,mi as ge,ta as _e,v as ve,xs as ye}from"./index-B3BVcMQj.js";import{a as q,c as be,i as xe,l as Se,n as Ce,o as we,r as Te,s as Ee,t as De}from"./automation-display-DCkjVzA0.js";import{a as Oe,i as ke,n as Ae,r as J,t as je}from"./workflow-run-setup-panel-CqYp6zjF.js";import{i as Me,n as Ne,r as Pe,t as Fe}from"./browser-automation-inputs-FGALoJY8.js";var Ie=n(),Y=e(t(),1),X=r(),Le=Array.from({length:24},(e,t)=>t);function Re(e){let t=/^(\d{2}):(\d{2})$/.exec(e);if(!t)return null;let n=Number(t[1]),r=Number(t[2]);return n>23||r>59?null:{hour:n,minute:r}}function ze(){let e=new Date;return{hour:e.getHours(),minute:e.getMinutes()}}function Be(e,t){return`${String(e).padStart(2,`0`)}:${String(t).padStart(2,`0`)}`}function Ve(e){let t=(0,Ie.c)(80),{value:n,onChange:r,disabled:i,allowEmpty:a,clearLabel:o,ariaLabel:s,ariaLabelledBy:l,className:f,triggerClassName:p,id:h,name:g,minuteStep:v}=e,y=a===void 0?!1:a,b=v===void 0?1:v,x=Re(n),S=x??ze(),[ee,C]=(0,Y.useState)(!1),[w,te]=(0,Y.useState)(null),[E,O]=(0,Y.useState)(S.hour),[k,A]=(0,Y.useState)(S.minute),j=(0,Y.useRef)([]),M=(0,Y.useRef)([]),N=d(),P=u(w),F=m(N,P!==null),I=Math.max(1,Math.min(60,Math.round(b))),L=Array.from({length:Math.ceil(60/I)},(e,t)=>t*I).filter(Ue),z;t[0]===r?z=t[1]:(z=(e,t,n)=>{let i=n===void 0?!1:n;O(e),A(t),r(Be(e,t)),i&&C(!1)},t[0]=r,t[1]=z);let ne=z,B=He,ie;t[2]===f?ie=t[3]:(ie=D(`relative min-w-0`,f),t[2]=f,t[3]=ie);let ae=R,oe;t[4]===n?oe=t[5]:(oe=e=>{if(e){let e=Re(n)??ze();O(e.hour),A(e.minute)}C(e)},t[4]=n,t[5]=oe);let se=y&&n&&`pr-9`,V=i&&`cursor-not-allowed opacity-50 hover:border-edge`,ce;t[6]!==se||t[7]!==V||t[8]!==p?(ce=D(`box-border flex h-10 w-full min-w-0 items-center gap-2 rounded-lg border border-edge bg-surface-panel px-3 text-left text-sm text-fg`,`transition-colors hover:border-edge-strong focus-visible:border-accent/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/20`,se,V,p),t[6]=se,t[7]=V,t[8]=p,t[9]=ce):ce=t[9];let H;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,X.jsx)(_,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":`true`}),t[10]=H):H=t[10];let le=!x&&`text-fg-subtle`,ue;t[11]===le?ue=t[12]:(ue=D(`tabular-nums`,le),t[11]=le,t[12]=ue);let de=x?Be(x.hour,x.minute):`--:--`,U;t[13]!==ue||t[14]!==de?(U=(0,X.jsx)(`span`,{className:ue,children:de}),t[13]=ue,t[14]=de,t[15]=U):U=t[15];let W;t[16]!==s||t[17]!==l||t[18]!==i||t[19]!==h||t[20]!==U||t[21]!==ce?(W=(0,X.jsx)(re,{asChild:!0,children:(0,X.jsxs)(`button`,{ref:te,id:h,type:`button`,disabled:i,"aria-label":s,"aria-labelledby":l,"aria-haspopup":`listbox`,className:ce,children:[H,U]})}),t[16]=s,t[17]=l,t[18]=i,t[19]=h,t[20]=U,t[21]=ce,t[22]=W):W=t[22];let G=R,fe=P??void 0,pe=R,me=D(F,`w-[18rem] overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-popover outline-none`),K=e=>{e.preventDefault(),requestAnimationFrame(()=>j.current[E]?.focus())},he;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(he=(0,X.jsx)(_,{className:`size-3.5`,"aria-hidden":`true`}),t[23]=he):he=t[23];let ge=s??`HH:mm`,_e;t[24]===ge?_e=t[25]:(_e=(0,X.jsxs)(`span`,{className:`flex items-center gap-2 text-xs font-medium text-fg-muted`,children:[he,ge]}),t[24]=ge,t[25]=_e);let ve;t[26]!==E||t[27]!==k?(ve=Be(E,k),t[26]=E,t[27]=k,t[28]=ve):ve=t[28];let ye;t[29]===ve?ye=t[30]:(ye=(0,X.jsx)(`span`,{className:`font-mono text-base font-semibold tabular-nums text-fg`,children:ve}),t[29]=ve,t[30]=ye);let q;t[31]!==_e||t[32]!==ye?(q=(0,X.jsxs)(`div`,{className:`flex items-center justify-between border-b border-edge-subtle bg-surface-inset px-3 py-2.5`,children:[_e,ye]}),t[31]=_e,t[32]=ye,t[33]=q):q=t[33];let be;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(be=(0,X.jsx)(`div`,{className:`px-1 pb-1.5 text-[11px] font-semibold tracking-wider text-fg-subtle`,children:`HH`}),t[34]=be):be=t[34];let xe=`${s??`HH:mm`} HH`,Se=Le.map((e,t)=>(0,X.jsx)(`button`,{ref:e=>{j.current[t]=e},type:`button`,role:`option`,"aria-selected":E===e,tabIndex:E===e?0:-1,className:D(`relative flex h-8 items-center justify-center rounded-md text-xs tabular-nums text-fg-muted transition-colors`,`hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/30`,E===e&&`bg-accent-soft font-semibold text-accent-fg`),onClick:()=>ne(e,k),onKeyDown:e=>B(e,Le,E,e=>ne(e,k),j),children:String(e).padStart(2,`0`)},e)),Ce;t[35]!==xe||t[36]!==Se?(Ce=(0,X.jsxs)(`div`,{className:`pr-2`,children:[be,(0,X.jsx)(`div`,{role:`listbox`,"aria-label":xe,className:`grid max-h-56 grid-cols-3 gap-1 overflow-y-auto pr-1`,children:Se})]}),t[35]=xe,t[36]=Se,t[37]=Ce):Ce=t[37];let we;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(we=(0,X.jsx)(`div`,{className:`px-1 pb-1.5 text-[11px] font-semibold tracking-wider text-fg-subtle`,children:`MM`}),t[38]=we):we=t[38];let Te=`${s??`HH:mm`} MM`,Ee=L.map((e,t)=>(0,X.jsxs)(`button`,{ref:e=>{M.current[t]=e},type:`button`,role:`option`,"aria-selected":k===e,tabIndex:k===e?0:-1,className:D(`relative flex h-8 items-center justify-center rounded-md text-xs tabular-nums text-fg-muted transition-colors`,`hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/30`,k===e&&`bg-accent-soft font-semibold text-accent-fg`),onClick:()=>ne(E,e,!0),onKeyDown:e=>B(e,L,k,e=>ne(E,e),M),children:[(0,X.jsx)(c,{className:D(`absolute left-0.5 size-3`,k!==e&&`invisible`),"aria-hidden":`true`}),String(e).padStart(2,`0`)]},e)),De;t[39]!==Te||t[40]!==Ee?(De=(0,X.jsx)(`div`,{role:`listbox`,"aria-label":Te,className:`grid max-h-56 grid-cols-3 gap-1 overflow-y-auto pr-1`,children:Ee}),t[39]=Te,t[40]=Ee,t[41]=De):De=t[41];let Oe;t[42]!==we||t[43]!==De?(Oe=(0,X.jsxs)(`div`,{className:`pl-2`,children:[we,De]}),t[42]=we,t[43]=De,t[44]=Oe):Oe=t[44];let ke;t[45]!==Ce||t[46]!==Oe?(ke=(0,X.jsxs)(`div`,{className:`grid grid-cols-2 divide-x divide-edge-subtle p-2`,children:[Ce,Oe]}),t[45]=Ce,t[46]=Oe,t[47]=ke):ke=t[47];let Ae;t[48]!==pe.Content||t[49]!==me||t[50]!==K||t[51]!==q||t[52]!==ke?(Ae=(0,X.jsxs)(pe.Content,{side:`bottom`,align:`start`,sideOffset:6,collisionPadding:12,className:me,onOpenAutoFocus:K,children:[q,ke]}),t[48]=pe.Content,t[49]=me,t[50]=K,t[51]=q,t[52]=ke,t[53]=Ae):Ae=t[53];let J;t[54]!==G.Portal||t[55]!==fe||t[56]!==Ae?(J=(0,X.jsx)(G.Portal,{container:fe,children:Ae}),t[54]=G.Portal,t[55]=fe,t[56]=Ae,t[57]=J):J=t[57];let je;t[58]!==ee||t[59]!==W||t[60]!==J||t[61]!==ae.Root||t[62]!==oe?(je=(0,X.jsxs)(ae.Root,{open:ee,onOpenChange:oe,children:[W,J]}),t[58]=ee,t[59]=W,t[60]=J,t[61]=ae.Root,t[62]=oe,t[63]=je):je=t[63];let Me;t[64]!==y||t[65]!==s||t[66]!==o||t[67]!==i||t[68]!==r||t[69]!==n?(Me=y&&n?(0,X.jsx)(`button`,{type:`button`,disabled:i,"aria-label":o??s,title:o,className:`absolute right-1.5 top-1/2 flex size-7 -translate-y-1/2 items-center justify-center rounded-md text-fg-subtle hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/30 disabled:pointer-events-none`,onClick:()=>r(``),children:(0,X.jsx)(T,{className:`size-3.5`,"aria-hidden":`true`})}):null,t[64]=y,t[65]=s,t[66]=o,t[67]=i,t[68]=r,t[69]=n,t[70]=Me):Me=t[70];let Ne;t[71]!==i||t[72]!==g||t[73]!==n?(Ne=g?(0,X.jsx)(`input`,{type:`hidden`,name:g,value:n,disabled:i}):null,t[71]=i,t[72]=g,t[73]=n,t[74]=Ne):Ne=t[74];let Pe;return t[75]!==ie||t[76]!==je||t[77]!==Me||t[78]!==Ne?(Pe=(0,X.jsxs)(`div`,{className:ie,children:[je,Me,Ne]}),t[75]=ie,t[76]=je,t[77]=Me,t[78]=Ne,t[79]=Pe):Pe=t[79],Pe}function He(e,t,n,r,i){let a=null,o=Math.max(0,t.indexOf(n));if((e.key===`ArrowDown`||e.key===`ArrowRight`)&&(a=(o+1)%t.length),(e.key===`ArrowUp`||e.key===`ArrowLeft`)&&(a=(o-1+t.length)%t.length),e.key===`Home`&&(a=0),e.key===`End`&&(a=t.length-1),a===null)return;e.preventDefault();let s=t[a];r(s),i.current?.[a]?.focus()}function Ue(e){return e<60}function We(e){return e.management!==void 0}var Ge={name:``,description:``,projectId:``,triggerMode:`daily`,time:`09:00`,weekday:`1`,intervalValue:`1`,intervalUnit:`hour`,cronExpr:`0 9 * * *`,webhookSecretId:``,onceAt:``,eventType:``,eventSource:``,eventPayloadMatch:``,actionMode:`agent`,agentId:``,model:``,instruction:``,taskId:``,workflowId:``,workflowGoal:``,workflowInput:{goal:``,argValues:{},schemaInput:{},concurrency:``,maxSubagents:``},workflowInputValid:!0,browserAutomationId:``,browserAutomationInputs:{},safetyMode:`suggest_only`,timeoutSeconds:`1800`,conversationMode:`new_session`,notificationPolicy:`attention`,resultWebhookEndpoint:``,resultWebhookSecretId:``,disableAfterFailures:`3`},Ke=[{value:`15`,unit:`minute`},{value:`30`,unit:`minute`},{value:`1`,unit:`hour`},{value:`6`,unit:`hour`},{value:`24`,unit:`hour`}];function qe(e,t){let[n,r]=e.time.split(`:`),i=Number.parseInt(n||`9`,10),a=Number.parseInt(r||`0`,10),o;if(e.triggerMode===`manual`)o={kind:`manual`};else if(e.triggerMode===`once`)o={kind:`schedule`,schedule:{kind:`once`,at:new Date(e.onceAt).toISOString()}};else if(e.triggerMode===`webhook`)o={kind:`webhook`,...e.webhookSecretId.trim()?{secretId:e.webhookSecretId.trim()}:{}};else if(e.triggerMode===`taskBlocked`)o={kind:`event`,eventType:`task.attention_required.v2`,source:`tasks`,payloadMatch:{reason:`blocked`}};else if(e.triggerMode===`noteCreated`)o={kind:`event`,eventType:`note.created`,source:`notes`};else if(e.triggerMode===`workflowFailed`)o={kind:`event`,eventType:`workflow.run.completed`,source:`workflows`,payloadMatch:{status:`failed`}};else if(e.triggerMode===`sessionUpdated`)o={kind:`event`,eventType:`session.transcript.updated`,source:`sessions`};else if(e.triggerMode===`event`){let t=e.eventPayloadMatch.trim()?JSON.parse(e.eventPayloadMatch):void 0;o={kind:`event`,eventType:e.eventType.trim(),...e.eventSource.trim()?{source:e.eventSource.trim()}:{},...t?{payloadMatch:t}:{}}}else o=e.triggerMode===`interval`?{kind:`schedule`,schedule:{kind:`interval`,everyMs:De(e.intervalValue,e.intervalUnit)}}:e.triggerMode===`weekly`?{kind:`schedule`,schedule:{kind:`cron`,expr:`${a} ${i} * * ${e.weekday}`}}:e.triggerMode===`cron`?{kind:`schedule`,schedule:{kind:`cron`,expr:e.cronExpr.trim()}}:{kind:`schedule`,schedule:{kind:`cron`,expr:`${a} ${i} * * *`}};let s=J(t,e.workflowInput),c=e.workflowInput.goal.trim()||e.workflowGoal.trim(),l=e.actionMode===`browser_automation`||e.actionMode===`task_command`?`auto_apply`:e.safetyMode,u;return u=e.actionMode===`workflow`?{kind:`workflow`,workflowId:e.workflowId.trim(),...e.agentId.trim()?{agentId:e.agentId.trim()}:{},...s===void 0?{}:{input:s},...c?{goal:c}:{},...e.workflowInput.concurrency.trim()?{concurrency:Math.max(1,Number.parseInt(e.workflowInput.concurrency,10)||1)}:{},...e.workflowInput.maxSubagents.trim()?{maxSubagents:Math.max(1,Number.parseInt(e.workflowInput.maxSubagents,10)||1)}:{}}:e.actionMode===`browser_automation`?{kind:`browser_automation`,automationId:e.browserAutomationId.trim(),inputs:e.browserAutomationInputs}:e.actionMode===`task_command`?{kind:`task_command`,taskId:e.taskId.trim(),command:{type:`start`,executor:{kind:`agent`,agentId:e.agentId.trim()}}}:{kind:`agent`,instruction:e.instruction.trim(),...e.agentId.trim()?{agentId:e.agentId.trim()}:{},...e.model.trim()?{model:e.model.trim()}:{}},{name:e.name.trim(),...e.description.trim()?{description:e.description.trim()}:{},...e.projectId.trim()?{projectId:e.projectId.trim()}:{},trigger:o,action:u,safety:{mode:l},conversationMode:e.conversationMode,delivery:{notificationPolicy:e.notificationPolicy,destinations:[{key:`gateway_event`,kind:`gateway_event`},...e.resultWebhookEndpoint.trim()&&e.resultWebhookSecretId.trim()?[{key:`result_webhook`,kind:`webhook`,endpoint:e.resultWebhookEndpoint.trim(),secretId:e.resultWebhookSecretId.trim()}]:[]]},reliability:{executionTimeoutSeconds:Math.max(1,Number.parseInt(e.timeoutSeconds,10)||1800),disableAfterConsecutiveFailures:Math.max(1,Number.parseInt(e.disableAfterFailures,10)||3)}}}function Je(e){let t=e.match(/^(\d{1,2})\s+(\d{1,2})\s+\*\s+\*\s+\*$/);if(t)return{triggerMode:`daily`,time:`${t[2].padStart(2,`0`)}:${t[1].padStart(2,`0`)}`,weekday:`1`,cronExpr:e};let n=e.match(/^(\d{1,2})\s+(\d{1,2})\s+\*\s+\*\s+([0-6])$/);return n?{triggerMode:`weekly`,time:`${n[2].padStart(2,`0`)}:${n[1].padStart(2,`0`)}`,weekday:n[3],cronExpr:e}:{triggerMode:`cron`,time:Ge.time,weekday:Ge.weekday,cronExpr:e}}function Ye(e){let t=[[`week`,10080*6e4],[`day`,1440*6e4],[`hour`,60*6e4],[`minute`,6e4]],[n,r]=t.find(([,t])=>e>=t&&e%t===0)??t.at(-1);return{intervalValue:String(e/r),intervalUnit:n}}function Xe(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return e;let n=t.getTimezoneOffset()*6e4;return new Date(t.getTime()-n).toISOString().slice(0,16)}function Ze(e){let t=e.payloadMatch;return e.eventType===`task.attention_required.v2`&&e.source===`tasks`&&t?.reason===`blocked`?{triggerMode:`taskBlocked`}:e.eventType===`note.created`&&e.source===`notes`&&!t?{triggerMode:`noteCreated`}:e.eventType===`workflow.run.completed`&&e.source===`workflows`&&t?.status===`failed`?{triggerMode:`workflowFailed`}:e.eventType===`session.transcript.updated`&&e.source===`sessions`&&!t?{triggerMode:`sessionUpdated`}:{triggerMode:`event`,eventType:e.eventType,eventSource:e.source??``,eventPayloadMatch:t?JSON.stringify(t,null,2):``}}function Z(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function Qe(e){if(!e.trim())return!0;try{let t=JSON.parse(e);return!!t&&typeof t==`object`&&!Array.isArray(t)&&Object.values(t).every(e=>e===null||[`string`,`number`,`boolean`].includes(typeof e))}catch{return!1}}function $e(e,t=[]){let n={triggerMode:`manual`};if(e.trigger.kind===`webhook`)n={triggerMode:`webhook`,webhookSecretId:e.trigger.secretId??``};else if(e.trigger.kind===`event`)n=Ze(e.trigger);else if(e.trigger.kind===`schedule`){let t=e.trigger.schedule;t.kind===`cron`&&(n=Je(t.expr)),t.kind===`interval`&&(n={triggerMode:`interval`,...Ye(t.everyMs)}),t.kind===`once`&&(n={triggerMode:`once`,onceAt:Xe(t.at)})}let r=e.action,i=r.kind===`workflow`?t.find(e=>e.id===r.workflowId)??null:null,a=r.kind===`workflow`?Z(r.input):{},o=e.reliability?.executionTimeoutSeconds??(`timeoutSeconds`in r?r.timeoutSeconds:void 0)??(r.kind===`browser_automation`?600:1800);return{...Ge,...n,name:e.name,description:e.description??``,projectId:e.projectId??``,actionMode:r.kind===`system`?`agent`:r.kind,agentId:r.kind===`agent`||r.kind===`workflow`?r.agentId??``:r.kind===`task_command`&&r.command.type===`start`&&r.command.executor.kind===`agent`?r.command.executor.agentId:``,model:r.kind===`agent`?r.model??``:``,instruction:r.kind===`agent`?r.instruction:``,taskId:r.kind===`task_command`?r.taskId:``,workflowId:r.kind===`workflow`?r.workflowId:``,workflowGoal:r.kind===`workflow`?r.goal??``:``,browserAutomationId:r.kind===`browser_automation`?r.automationId:``,browserAutomationInputs:r.kind===`browser_automation`?r.inputs??{}:{},workflowInput:{goal:r.kind===`workflow`?r.goal??``:``,argValues:i?Ae(i.name,a):{},schemaInput:a,concurrency:r.kind===`workflow`&&r.concurrency?String(r.concurrency):``,maxSubagents:r.kind===`workflow`&&r.maxSubagents?String(r.maxSubagents):``},workflowInputValid:!0,safetyMode:e.safety?.mode??`auto_apply`,timeoutSeconds:String(o),conversationMode:e.conversationMode??`new_session`,notificationPolicy:e.delivery.notificationPolicy,resultWebhookEndpoint:e.delivery.destinations.find(e=>e.kind===`webhook`)?.endpoint??``,resultWebhookSecretId:e.delivery.destinations.find(e=>e.kind===`webhook`)?.secretId??``,disableAfterFailures:String(e.reliability?.disableAfterConsecutiveFailures??3)}}function et(e,t,n){let r=qe(t,n),i=e.trigger.kind===`schedule`&&r.trigger.kind===`schedule`&&e.trigger.schedule.kind===r.trigger.schedule.kind?{...r.trigger,schedule:{...e.trigger.schedule,...r.trigger.schedule}}:r.trigger,a=r.action;e.action.kind===`agent`&&r.action.kind===`agent`?a={...e.action,...r.action,agentId:r.action.agentId,model:r.action.model}:e.action.kind===`workflow`&&r.action.kind===`workflow`?a={...e.action,...r.action,agentId:r.action.agentId,input:r.action.input,goal:r.action.goal,concurrency:r.action.concurrency,maxSubagents:r.action.maxSubagents}:e.action.kind===`browser_automation`&&r.action.kind===`browser_automation`?a={...e.action,...r.action}:e.action.kind===`task_command`&&r.action.kind===`task_command`&&(a=r.action);let o=e.delivery.destinations.filter(e=>e.kind===`gateway_event`),s=e.delivery.destinations.filter(e=>e.kind===`webhook`);return{...r,description:t.description.trim(),projectId:t.projectId.trim(),delivery:{notificationPolicy:t.notificationPolicy,destinations:[...o.length>0?o:[{key:`gateway_event`,kind:`gateway_event`}],...e.delivery.destinations.filter(e=>e.kind===`file`||e.kind===`card`),...s.slice(1),...t.resultWebhookEndpoint.trim()&&t.resultWebhookSecretId.trim()?[{key:s[0]?.key??`result_webhook`,kind:`webhook`,endpoint:t.resultWebhookEndpoint.trim(),secretId:t.resultWebhookSecretId.trim()}]:[]]},trigger:i,action:a,reliability:{...e.reliability,...r.reliability}}}function tt(e){return[`reminder`,`brief`,`review`,`followUp`].map(t=>{let n=e.scenarios[t];return{...n,requiresProject:t===`followUp`,form:{...Ge,name:n.name,instruction:t===`reminder`?``:n.instruction,triggerMode:t===`reminder`?`once`:t===`review`?`weekly`:`daily`,time:t===`brief`?`08:30`:t===`review`?`17:00`:`09:00`,weekday:`5`,notificationPolicy:`all`}}})}var nt=`w-full rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg focus-visible:outline-2 focus-visible:outline-accent`;function rt(e){let t=(0,Ie.c)(99),{form:n,setForm:r,labels:i,projects:a,projectLocked:o,source:s,requiresProject:c}=e,l;t[0]===r?l=t[1]:(l=e=>r(t=>({...t,...e})),t[0]=r,t[1]=l);let u=l,d;t[2]!==i.experience.source||t[3]!==s?(d=(0,X.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[i.experience.source,`: `,s]}),t[2]=i.experience.source,t[3]=s,t[4]=d):d=t[4];let m;t[5]===u?m=t[6]:(m=e=>u({name:e.target.value}),t[5]=u,t[6]=m);let h;t[7]!==n.name||t[8]!==m?(h=(0,X.jsx)(`input`,{className:nt,value:n.name,onChange:m}),t[7]=n.name,t[8]=m,t[9]=h):h=t[9];let g;t[10]!==i.form.name||t[11]!==h?(g=(0,X.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[i.form.name,h]}),t[10]=i.form.name,t[11]=h,t[12]=g):g=t[12];let _;t[13]===u?_=t[14]:(_=e=>u({instruction:e.target.value}),t[13]=u,t[14]=_);let v;t[15]!==n.instruction||t[16]!==_?(v=(0,X.jsx)(`textarea`,{className:nt,rows:5,value:n.instruction,onChange:_}),t[15]=n.instruction,t[16]=_,t[17]=v):v=t[17];let y;t[18]!==i.info.task||t[19]!==v?(y=(0,X.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[i.info.task,v]}),t[18]=i.info.task,t[19]=v,t[20]=y):y=t[20];let b;t[21]!==n.projectId||t[22]!==i.form.noProject||t[23]!==i.form.project||t[24]!==o||t[25]!==a||t[26]!==u?(b=!o&&(0,X.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[i.form.project,(0,X.jsxs)(f,{className:nt,value:n.projectId,onChange:e=>u({projectId:e.target.value}),children:[(0,X.jsx)(p,{value:``,children:i.form.noProject}),a.map(it)]})]}),t[21]=n.projectId,t[22]=i.form.noProject,t[23]=i.form.project,t[24]=o,t[25]=a,t[26]=u,t[27]=b):b=t[27];let x;t[28]!==n.projectId||t[29]!==i.experience.projectRequired||t[30]!==c?(x=c&&!n.projectId?(0,X.jsx)(`p`,{role:`status`,className:`text-sm text-fg-muted`,children:i.experience.projectRequired}):null,t[28]=n.projectId,t[29]=i.experience.projectRequired,t[30]=c,t[31]=x):x=t[31];let S;t[32]===u?S=t[33]:(S=e=>u({triggerMode:e.target.value}),t[32]=u,t[33]=S);let ee;t[34]===i.trigger.once?ee=t[35]:(ee=(0,X.jsx)(p,{value:`once`,children:i.trigger.once}),t[34]=i.trigger.once,t[35]=ee);let C;t[36]===i.trigger.daily?C=t[37]:(C=(0,X.jsx)(p,{value:`daily`,children:i.trigger.daily}),t[36]=i.trigger.daily,t[37]=C);let w;t[38]===i.trigger.weekly?w=t[39]:(w=(0,X.jsx)(p,{value:`weekly`,children:i.trigger.weekly}),t[38]=i.trigger.weekly,t[39]=w);let te;t[40]!==n.triggerMode||t[41]!==S||t[42]!==ee||t[43]!==C||t[44]!==w?(te=(0,X.jsxs)(f,{className:nt,value:n.triggerMode,onChange:S,children:[ee,C,w]}),t[40]=n.triggerMode,t[41]=S,t[42]=ee,t[43]=C,t[44]=w,t[45]=te):te=t[45];let T;t[46]!==i.form.trigger||t[47]!==te?(T=(0,X.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[i.form.trigger,te]}),t[46]=i.form.trigger,t[47]=te,t[48]=T):T=t[48];let E;t[49]!==n.onceAt||t[50]!==n.time||t[51]!==n.triggerMode||t[52]!==i.form.onceAt||t[53]!==i.form.time||t[54]!==u?(E=n.triggerMode===`once`?(0,X.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[i.form.onceAt,(0,X.jsx)(`input`,{type:`datetime-local`,className:nt,value:n.onceAt,onChange:e=>u({onceAt:e.target.value})})]}):(0,X.jsxs)(`div`,{className:`grid gap-2 text-sm text-fg`,children:[(0,X.jsx)(`span`,{children:i.form.time}),(0,X.jsx)(Ve,{value:n.time,onChange:e=>u({time:e}),ariaLabel:i.form.time})]}),t[49]=n.onceAt,t[50]=n.time,t[51]=n.triggerMode,t[52]=i.form.onceAt,t[53]=i.form.time,t[54]=u,t[55]=E):E=t[55];let D;t[56]!==n.triggerMode||t[57]!==n.weekday||t[58]!==i.form.day||t[59]!==i.weekdays||t[60]!==u?(D=n.triggerMode===`weekly`&&(0,X.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[i.form.day,(0,X.jsx)(f,{className:nt,value:n.weekday,onChange:e=>u({weekday:e.target.value}),children:[`sunday`,`monday`,`tuesday`,`wednesday`,`thursday`,`friday`,`saturday`].map((e,t)=>(0,X.jsx)(p,{value:String(t),children:i.weekdays[e]},e))})]}),t[56]=n.triggerMode,t[57]=n.weekday,t[58]=i.form.day,t[59]=i.weekdays,t[60]=u,t[61]=D):D=t[61];let O;t[62]!==T||t[63]!==E||t[64]!==D?(O=(0,X.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[T,E,D]}),t[62]=T,t[63]=E,t[64]=D,t[65]=O):O=t[65];let k;t[66]!==n.onceAt||t[67]!==n.triggerMode||t[68]!==i.experience.futureTime?(k=n.triggerMode===`once`&&n.onceAt&&new Date(n.onceAt).getTime()<=Date.now()?(0,X.jsx)(`p`,{role:`status`,className:`text-sm text-red-700 dark:text-red-300`,children:i.experience.futureTime}):null,t[66]=n.onceAt,t[67]=n.triggerMode,t[68]=i.experience.futureTime,t[69]=k):k=t[69];let A;t[70]===i.experience.scheduleNote?A=t[71]:(A=(0,X.jsx)(`p`,{className:`text-xs text-fg-muted`,children:i.experience.scheduleNote}),t[70]=i.experience.scheduleNote,t[71]=A);let j;t[72]===u?j=t[73]:(j=e=>u({notificationPolicy:e.target.value}),t[72]=u,t[73]=j);let M;t[74]===i.draft.notifyAll?M=t[75]:(M=(0,X.jsx)(p,{value:`all`,children:i.draft.notifyAll}),t[74]=i.draft.notifyAll,t[75]=M);let N;t[76]===i.draft.notifyAttention?N=t[77]:(N=(0,X.jsx)(p,{value:`attention`,children:i.draft.notifyAttention}),t[76]=i.draft.notifyAttention,t[77]=N);let P;t[78]===i.draft.notifyNone?P=t[79]:(P=(0,X.jsx)(p,{value:`none`,children:i.draft.notifyNone}),t[78]=i.draft.notifyNone,t[79]=P);let F;t[80]!==n.notificationPolicy||t[81]!==j||t[82]!==M||t[83]!==N||t[84]!==P?(F=(0,X.jsxs)(f,{className:nt,value:n.notificationPolicy,onChange:j,children:[M,N,P]}),t[80]=n.notificationPolicy,t[81]=j,t[82]=M,t[83]=N,t[84]=P,t[85]=F):F=t[85];let I;t[86]!==i.draft.notifications||t[87]!==F?(I=(0,X.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[i.draft.notifications,F]}),t[86]=i.draft.notifications,t[87]=F,t[88]=I):I=t[88];let L;return t[89]!==x||t[90]!==O||t[91]!==d||t[92]!==k||t[93]!==A||t[94]!==I||t[95]!==g||t[96]!==y||t[97]!==b?(L=(0,X.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-5 overflow-y-auto px-5 py-4`,children:[d,g,y,b,x,O,k,A,I]}),t[89]=x,t[90]=O,t[91]=d,t[92]=k,t[93]=A,t[94]=I,t[95]=g,t[96]=y,t[97]=b,t[98]=L):L=t[98],L}function it(e){return(0,X.jsx)(p,{value:e.id,children:e.name},e.id)}function at(e,t){let n=new URLSearchParams({draft:e.trim()}),r=t?.trim();return r?n.set(`projectId`,r):n.set(`projectScope`,`none`),`/chat/new?${n.toString()}`}function ot(e,t){return t.reduce((t,n)=>n.automationId===e&&(!t||n.createdAtMs>t.createdAtMs)?n:t,void 0)}function st(e,t){let n=ot(e.id,t),r=!!(e.state.lastRunAtMs&&(!n||e.state.lastRunAtMs>n.createdAtMs)),i=r?e.state.lastRunStatus:n?.status??e.state.lastRunStatus;return i!==`failed`&&i!==`timeout`?null:`${i}:${(r?e.state.lastRunAtMs:n?.createdAtMs??e.state.lastRunAtMs)??`unknown`}`}function ct(e,t){return st(e,t)!==null}var lt=`xopc.automations.dismissedExecutionIssues`;function ut(){if(typeof window>`u`)return{};try{let e=JSON.parse(window.localStorage.getItem(lt)??`{}`);return!e||typeof e!=`object`||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(e=>typeof e[1]==`string`))}catch{return{}}}function dt(e,t,n){return e?we(e,n):t.never}function ft(e,t){return e.kind===`system`?e.capability===`home.advisor.refresh`?`Home AI suggestions refresh`:e.capability===`memory.temporal_sweep`?`Memory temporal sweep`:e.capability===`memory.daily_reconciliation`?`Memory daily reconciliation`:`Memory weekly knowledge maintenance`:e.kind===`workflow`?t.action.workflowWithId.replace(`{id}`,e.workflowId):e.kind===`browser_automation`?`Browser automation: ${e.automationId}`:e.kind===`task_command`?t.action.taskWithId.replace(`{id}`,e.taskId):e.agentId?t.action.agentWithId.replace(`{id}`,e.agentId):t.action.agent}function pt(e,t){return e.kind===`system`?`System`:e.kind===`workflow`?t.sources.workflow:e.kind===`browser_automation`?t.sources.browser:e.kind===`task_command`?t.sources.task:t.sources.agent}function mt(e,t){return e===`workflow`?t.action.runWorkflow:e===`browser_automation`?t.sources.browser:e===`task_command`?t.action.runTask:t.action.runAgent}function ht(e,t){return e===`cron`?t.trigger.customCron:e===`event`?t.trigger.customEvent:t.trigger[e]}function gt(e){let t=(0,Ie.c)(10),{kind:n,className:r}=e;if(n===`system`){let e;return t[0]===r?e=t[1]:(e=(0,X.jsx)(G,{className:r,"aria-hidden":!0}),t[0]=r,t[1]=e),e}if(n===`workflow`){let e;return t[2]===r?e=t[3]:(e=(0,X.jsx)(b,{className:r,"aria-hidden":!0}),t[2]=r,t[3]=e),e}if(n===`browser_automation`){let e;return t[4]===r?e=t[5]:(e=(0,X.jsx)(ye,{className:r,"aria-hidden":!0}),t[4]=r,t[5]=e),e}if(n===`task_command`){let e;return t[6]===r?e=t[7]:(e=(0,X.jsx)(g,{className:r,"aria-hidden":!0}),t[6]=r,t[7]=e),e}let i;return t[8]===r?i=t[9]:(i=(0,X.jsx)(te,{className:r,"aria-hidden":!0}),t[8]=r,t[9]=i),i}function _t(e){return e.safety?.mode??`auto_apply`}function vt(e){return e===`succeeded`?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`failed`||e===`timeout`?`bg-red-500/10 text-red-700 dark:text-red-300`:e===`running`||e===`queued`||e===`cancelling`?`bg-blue-500/10 text-blue-700 dark:text-blue-300`:`bg-surface-hover text-fg-muted`}function yt(e,t){if(e==null)return t.never;if(e<1e3)return`${e}ms`;let n=Math.round(e/1e3);return n<60?`${n}s`:`${Math.floor(n/60)}m ${n%60}s`}function bt(e){return e.status===`running`||e.status===`queued`||e.status===`cancelling`}function xt(e){return e.status===`failed`||e.status===`timeout`}function St(e,t){return e.action.kind===`system`?ft(e.action,t):e.action.kind===`agent`?e.action.instruction:e.action.kind===`workflow`?e.action.goal?.trim()||ft(e.action,t):(e.action.kind,ft(e.action,t))}function Ct(e){return e.description?.trim()??``}function wt(e){return bt(e)?0:xt(e)?1:e.status===`succeeded`?2:3}function Tt(e){return[...e].sort((e,t)=>{let n=wt(e)-wt(t);return n===0?t.createdAtMs-e.createdAtMs:n})}function Et(){let e=(0,Ie.c)(6),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,X.jsx)(`section`,{className:`grid grid-cols-2 gap-px overflow-hidden rounded-xl border border-edge-subtle bg-edge-subtle xl:grid-cols-4`,children:Array.from({length:4}).map(Ot)}),e[0]=t):t=e[0];let n;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 space-y-2`,children:[(0,X.jsx)(B,{className:`h-4 w-36`}),(0,X.jsx)(B,{className:`h-3 w-56 max-w-full`})]}),(0,X.jsx)(B,{className:`h-7 w-20 rounded-full`})]}),e[1]=n):n=e[1];let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,X.jsxs)(`section`,{className:`rounded-xl bg-surface-panel p-4 shadow-surface`,children:[n,(0,X.jsx)(`div`,{className:`mt-4 grid gap-2`,children:Array.from({length:6}).map(Dt)})]}),e[2]=r):r=e[2];let i,a;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,X.jsx)(B,{className:`h-4 w-32`}),a=(0,X.jsx)(B,{className:`mt-4 h-24 rounded-lg`}),e[3]=i,e[4]=a):(i=e[3],a=e[4]);let o;return e[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,X.jsxs)(`div`,{className:`grid gap-4`,"aria-hidden":`true`,children:[t,(0,X.jsxs)(`div`,{className:`grid min-h-0 items-start gap-4 xl:grid-cols-[minmax(18rem,0.8fr)_minmax(0,1.5fr)]`,children:[r,(0,X.jsxs)(`section`,{className:`hidden rounded-xl bg-surface-panel p-4 shadow-surface xl:block`,children:[i,a,(0,X.jsxs)(`div`,{className:`mt-4 grid gap-2`,children:[(0,X.jsx)(B,{className:`h-12 rounded-lg`}),(0,X.jsx)(B,{className:`h-12 rounded-lg`}),(0,X.jsx)(B,{className:`h-12 rounded-lg`})]})]})]})]}),e[5]=o):o=e[5],o}function Dt(e,t){return(0,X.jsx)(`div`,{className:`rounded-lg bg-surface-base p-3`,children:(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(B,{className:`size-4 rounded-full`}),(0,X.jsx)(B,{className:`h-4 w-32`}),(0,X.jsx)(B,{className:`h-5 w-20 rounded-full`})]}),(0,X.jsx)(B,{className:`mt-3 h-4 w-full`}),(0,X.jsx)(B,{className:`mt-2 h-4 w-3/5`})]}),(0,X.jsx)(B,{className:`h-8 w-24 rounded-md`})]})},t)}function Ot(e,t){return(0,X.jsxs)(`div`,{className:`flex min-h-12 items-center gap-2.5 bg-surface-base px-3 py-2.5`,children:[(0,X.jsx)(B,{className:`size-4 rounded-full`}),(0,X.jsx)(B,{className:`h-3 w-14`}),(0,X.jsx)(B,{className:`ml-auto h-4 w-10`})]},t)}function kt({projectId:e,embedded:t=!1,title:n,subtitle:r}){let o=O(e=>e.language),c=E(o),l=c.automations,u=c.productNavigation.sections[`automation-triggers`],d=c.cron,m=_e(e=>e.setPageHeader),_=_e(e=>e.clearPageHeader),v=i(),[y,x]=a(),ee=!t&&y.get(`view`)===`activity`,R=y.get(`run`)?.trim()??``,B=y.get(`automation`)?.trim()??``,V=y.get(`draft`)?.trim()??``,U=y.get(`action`)?.trim()??``,W=y.get(`taskId`)?.trim()??``,fe=y.get(`projectId`)?.trim()??``,q=e?.trim()||fe,be=!!e?.trim(),Ce=y.get(`autogenerate`)===`1`,we=(0,Y.useRef)(``),Te=y.get(`status`),Ee=Te===`active`||Te===`paused`||Te===`running`||Te===`attention`?Te:`all`,Oe=y.get(`ownership`)===`system`?`system`:`user`,Ae=y.get(`source`),J=Ae===`agent`||Ae===`workflow`||Ae===`task_command`||Ae===`browser_automation`?Ae:`all`,je=y.get(`q`)??``,Pe=e=>x(t=>{let n=new URLSearchParams(t);return e===`all`?n.delete(`status`):n.set(`status`,e),n.delete(`automation`),n}),Fe=e=>x(t=>{let n=new URLSearchParams(t);return e===`user`?n.delete(`ownership`):n.set(`ownership`,e),n.delete(`automation`),n}),Ie=e=>x(t=>{let n=new URLSearchParams(t);return e?n.set(`q`,e):n.delete(`q`),n.delete(`automation`),n},{replace:!0}),Le=e=>x(t=>{let n=new URLSearchParams(t);return e===`all`?n.delete(`source`):n.set(`source`,e),n.delete(`automation`),n}),Re=()=>x(e=>{let t=new URLSearchParams(e);return t.delete(`status`),t.delete(`source`),t.delete(`q`),t.delete(`automation`),t}),[ze,Be]=(0,Y.useState)(null),[Ve,He]=(0,Y.useState)(!1),[Ue,Ke]=(0,Y.useState)(`blank`),[Je,Ye]=(0,Y.useState)(null),[Xe,Ze]=(0,Y.useState)(!1),[Z,nt]=(0,Y.useState)(Ge),[it,dt]=(0,Y.useState)(null),[ft,pt]=(0,Y.useState)(null),[mt,ht]=(0,Y.useState)(!1),[gt,_t]=(0,Y.useState)(null),[vt,yt]=(0,Y.useState)(``),[xt,wt]=(0,Y.useState)(null),[Dt,Ot]=(0,Y.useState)(!1),[kt,Nt]=(0,Y.useState)(!1),[Pt,Ft]=(0,Y.useState)(q),[zt,Bt]=(0,Y.useState)(`new_session`),[Vt,Ht]=(0,Y.useState)(`attention`),[Gt,Kt]=(0,Y.useState)(null),[qt,Jt]=(0,Y.useState)(!1),[Yt,Xt]=(0,Y.useState)(!1),[Zt,en]=(0,Y.useState)(!1),[tn,nn]=(0,Y.useState)(null),[$,rn]=(0,Y.useState)(ut),an=F([`automations`,q],()=>K.list(q?{projectId:q}:void 0),{keepPreviousData:!0,refreshInterval:15e3}),on=F([`automation-runs`,q],()=>K.runs(50,void 0,q?{projectId:q}:void 0),{keepPreviousData:!0,refreshInterval:1e4}),sn=F(q?`automations-global-system-source`:null,()=>K.list(),{keepPreviousData:!0,refreshInterval:15e3}),cn=F(q?`automation-runs-global-system-source`:null,()=>K.runs(50),{keepPreviousData:!0,refreshInterval:1e4}),ln=F(gt?[`automation-history`,gt,q]:null,()=>K.runs(50,gt,q?{projectId:q}:void 0),{refreshInterval:1e4}),un=F(ft?`automation-run-events:${ft}`:null,()=>K.runEvents(ft),{refreshInterval:5e3}),dn=F(`automation-workflow-definitions`,ve),fn=F(`automation-browser-automations`,()=>Me.list()),pn=F(`automation-chat-agents`,ge),mn=F(`automation-tasks`,K.tasks),hn=F(`automation-projects`,()=>me({sortBy:`name`,sortOrder:`asc`,limit:200})),gn=an.isLoading&&!an.data||on.isLoading&&!on.data||!!q&&sn.isLoading&&!sn.data||!!q&&cn.isLoading&&!cn.data,_n=!gn&&(an.isLoading||on.isLoading||sn.isLoading||cn.isLoading),vn=an.data?.automations??[],yn=q?sn.data?.automations??[]:vn,bn=(0,Y.useMemo)(()=>Tt(on.data?.runs??[]),[on.data?.runs]),xn=(0,Y.useMemo)(()=>q?Tt(cn.data?.runs??[]):bn,[cn.data?.runs,q,bn]),Sn=(0,Y.useMemo)(()=>vn.filter(e=>!We(e)),[vn]),Cn=(0,Y.useMemo)(()=>yn.filter(We),[yn]),wn=(0,Y.useMemo)(()=>[...Sn,...Cn],[Cn,Sn]),Tn=(0,Y.useMemo)(()=>new Set(Cn.map(e=>e.id)),[Cn]),En=(0,Y.useMemo)(()=>bn.filter(e=>!Tn.has(e.automationId)),[bn,Tn]),Dn=(0,Y.useMemo)(()=>xn.filter(e=>Tn.has(e.automationId)),[xn,Tn]),On=(0,Y.useMemo)(()=>q?[...bn,...Dn]:bn,[q,bn,Dn]),kn=(0,Y.useMemo)(()=>On.find(e=>e.id===ft)??ln.data?.runs.find(e=>e.id===ft)??null,[On,ft,ln.data]),An=(0,Y.useMemo)(()=>wn.find(e=>e.id===gt)??null,[wn,gt]),jn=(0,Y.useMemo)(()=>wn.find(e=>e.id===Je)??null,[wn,Je]),Mn=(0,Y.useMemo)(()=>[...ln.data?.runs??On].filter(e=>e.automationId===gt).sort((e,t)=>t.createdAtMs-e.createdAtMs),[On,gt,ln.data]),Nn=un.data?.events??[],Pn=(0,Y.useMemo)(()=>En.filter(e=>!bt(e)&&e.readAtMs==null),[En]),Fn=je.trim().toLocaleLowerCase(),In=Oe===`system`?Cn:Sn,Ln=Oe===`system`?Dn:En,Rn=(0,Y.useMemo)(()=>new Set(Ln.filter(bt).map(e=>e.automationId)),[Ln]),zn=(0,Y.useMemo)(()=>In.filter(e=>Ee===`attention`&&!ct(e,Ln)||Ee===`running`&&!Rn.has(e.id)||Ee===`active`&&!e.enabled||Ee===`paused`&&e.enabled||J!==`all`&&e.action.kind!==J?!1:Fn?[e.name,Ct(e),St(e,l),xe(e.trigger,l,d,o)].some(e=>e.toLocaleLowerCase().includes(Fn)):!0),[d,Ee,l,o,Fn,In,Ln,Rn,J]),Bn=(0,Y.useMemo)(()=>dn.data??[],[dn.data]),Vn=(0,Y.useMemo)(()=>(fn.data?.automations??[]).filter(e=>e.enabled),[fn.data]),Hn=pn.data?.items??[],Un=(0,Y.useMemo)(()=>(mn.data?.items??[]).map(e=>e.task),[mn.data]),Wn=hn.data?.items??[],Gn=(0,Y.useMemo)(()=>Bn.find(e=>e.id===Z.workflowId.trim())??null,[Z.workflowId,Bn]),Kn=(0,Y.useMemo)(()=>Vn.find(e=>e.id===Z.browserAutomationId.trim())??null,[Vn,Z.browserAutomationId]),qn=Z.actionMode===`workflow`&&(!Z.workflowId.trim()||Bn.length>0&&!Bn.some(e=>e.id===Z.workflowId)),Jn=Z.actionMode===`workflow`&&Gn?!ke(Gn,Z.workflowInput,Z.workflowInputValid).valid:!1,Yn=!!jn?.management?.editable.includes(`trigger`),Xn=[`daily`,`weekly`,`interval`,`cron`].includes(Z.triggerMode)&&(![`daily`,`weekly`].includes(Z.triggerMode)||/^(?:[01]\d|2[0-3]):[0-5]\d$/.test(Z.time))&&(Z.triggerMode!==`interval`||De(Z.intervalValue,Z.intervalUnit)>=6e4)&&(Z.triggerMode!==`cron`||!!Z.cronExpr.trim()),Zn=Yn?Xn:!!Z.name.trim()&&(Z.triggerMode!==`once`||Number.isFinite(new Date(Z.onceAt).getTime())&&(!!jn||new Date(Z.onceAt).getTime()>Date.now()))&&(![`daily`,`weekly`].includes(Z.triggerMode)||/^(?:[01]\d|2[0-3]):[0-5]\d$/.test(Z.time))&&(Z.triggerMode!==`event`||!!Z.eventType.trim()&&Qe(Z.eventPayloadMatch))&&(Z.actionMode===`workflow`?!qn&&!Jn:Z.actionMode===`browser_automation`?Kn!==null&&Ne(Kn,Z.browserAutomationInputs):Z.actionMode===`task_command`?!!(Z.taskId.trim()&&Z.agentId.trim()):!!Z.instruction.trim()),Qn=(0,Y.useMemo)(()=>tt(l),[l]),$n=(0,Y.useMemo)(()=>Sn.filter(e=>ct(e,En)),[Sn,En]),er=(0,Y.useMemo)(()=>In.filter(e=>ct(e,Ln)),[In,Ln]),tr=$n.some(e=>{let t=st(e,En);return t!==null&&$[e.id]!==t}),nr=Ln.filter(bt).length,rr=In.filter(e=>e.enabled&&e.state.nextRunAtMs).sort((e,t)=>(e.state.nextRunAtMs??1/0)-(t.state.nextRunAtMs??1/0))[0],ir=(0,Y.useMemo)(()=>({all:In.length,agent:In.filter(e=>e.action.kind===`agent`).length,workflow:In.filter(e=>e.action.kind===`workflow`).length,task_command:In.filter(e=>e.action.kind===`task_command`).length,browser_automation:In.filter(e=>e.action.kind===`browser_automation`).length}),[In]),ar=Number(Ee!==`all`)+Number(J!==`all`),or=(0,Y.useCallback)(()=>{rn(e=>{let t={...e};for(let e of $n){let n=st(e,En);n&&(t[e.id]=n)}try{window.localStorage.setItem(lt,JSON.stringify(t))}catch{}return t})},[$n,En]);(0,Y.useEffect)(()=>{if(!_n){if(zn.length===0){_t(null);return}if(B&&zn.some(e=>e.id===B)){_t(B);return}gt&&zn.some(e=>e.id===gt)||_t(zn[0].id)}},[B,zn,_n,gt]);let sr=(0,Y.useCallback)(async()=>{await Promise.all([an.mutate(),on.mutate(),sn.mutate(),cn.mutate(),ln.mutate(),un.mutate()])},[an.mutate,sn.mutate,cn.mutate,un.mutate,on.mutate,ln.mutate]),cr=(0,Y.useCallback)(e=>{if(be){_t(null),pt(null);return}x(t=>{let n=new URLSearchParams(t);return e?n.set(`projectId`,e):n.delete(`projectId`),n.delete(`automation`),n.delete(`run`),n}),_t(null),pt(null)},[be,x]);(0,Y.useEffect)(()=>{be&&(Ft(q),nt(e=>e.projectId===q?e:{...e,projectId:q}))},[q,be]);let lr=(0,Y.useCallback)(e=>{if(Ye(null),Ze(!1),dt(null),Ke(e),He(!0),e===`blank`){nt({...Ge,projectId:q});return}yt(``),wt(null),Nt(!1),Ft(q),Bt(`new_session`),Ht(`attention`)},[q]),ur=(0,Y.useCallback)(()=>{v(at(l.createWithAssistantPrompt,q))},[l.createWithAssistantPrompt,v,q]),dr=e=>{Be(e),nt({...e.form,projectId:q}),Ye(null),Ze(!1),dt(null),Ke(`quick`),He(!0)},fr=(0,Y.useCallback)(e=>{nt($e(e,Bn)),Ye(e.id),Ze(!1),_t(null),Ke(`blank`),He(!0)},[Bn]),pr=(0,Y.useCallback)(()=>{xt&&(nt({...$e(xt.automation,Bn),projectId:Pt,conversationMode:zt,notificationPolicy:Vt}),Ye(null),Ze(!0),Ke(`blank`))},[xt,zt,Vt,Pt,Bn]),mr=(0,Y.useCallback)(async()=>{en(!0),dt(null);try{await sr()}catch(e){dt(e instanceof Error?e.message:String(e))}finally{en(!1)}},[l.feedback.actionFailed,sr]);(0,Y.useEffect)(()=>{let e=wn.find(e=>e.id===B);!e||!We(e)||Oe===`system`||x(e=>{let t=new URLSearchParams(e);return t.set(`ownership`,`system`),t},{replace:!0})},[B,wn,Oe,x]),(0,Y.useEffect)(()=>{U===`create`&&(lr(`blank`),W&&nt(e=>({...e,actionMode:`task_command`,taskId:W,safetyMode:`auto_apply`})),x(e=>{let t=new URLSearchParams(e);return t.delete(`action`),t.delete(`taskId`),t},{replace:!0}))},[U,lr,x,W]),(0,Y.useEffect)(()=>{if(!V)return;let e=`${o}:${Ce?`auto`:`seed`}:${V}`;we.current!==e&&(we.current=e,yt(V),wt(null),Nt(!1),Ft(q),Ke(`draft`),He(!0),x(e=>{let t=new URLSearchParams(e);return t.delete(`draft`),t.delete(`autogenerate`),t},{replace:!0}),Ce&&(dt(null),Ot(!0),K.draft({prompt:V,language:o}).then(e=>{wt(e.draft),Nt(!1)}).catch(e=>{dt(e instanceof Error?e.message:String(e))}).finally(()=>{Ot(!1)})))},[Ce,V,o,q,x]);let hr=(0,Y.useCallback)(e=>{let t=bn.find(t=>t.id===e)??ln.data?.runs.find(t=>t.id===e);if(!t||bt(t)||t.readAtMs!=null)return;let n=Date.now();on.mutate(t=>t&&{...t,runs:t.runs.map(t=>t.id===e?{...t,readAtMs:n}:t)},!1),ln.mutate(t=>t&&{...t,runs:t.runs.map(t=>t.id===e?{...t,readAtMs:n}:t)},!1),K.markRunRead(e).catch(e=>{dt(e instanceof Error?e.message:String(e)),on.mutate(),ln.mutate()})},[bn,on.mutate,ln.data,ln.mutate]),gr=(0,Y.useCallback)(e=>{hr(e),pt(e),ht(!0),x(t=>{let n=new URLSearchParams(t);return n.set(`run`,e),n},{replace:!0})},[hr,x]),_r=(0,Y.useCallback)(e=>{_t(e);let t=ot(e,On);x(t=>{let n=new URLSearchParams(t);return n.set(`automation`,e),n},{replace:!0}),t&&t.readAtMs==null&&!bt(t)&&hr(t.id)},[On,hr,x]),vr=(0,Y.useCallback)(()=>{if(!rr)return;_t(rr.id);let e=ot(rr.id,On);x(e=>{let t=new URLSearchParams(e);return t.delete(`status`),t.delete(`source`),t.delete(`q`),t.set(`automation`,rr.id),t},{replace:!0}),e&&e.readAtMs==null&&!bt(e)&&hr(e.id)},[On,hr,rr,x]);(0,Y.useEffect)(()=>{R&&(hr(R),pt(R),ht(!0))},[hr,R]),(0,Y.useEffect)(()=>{Kt(null),Xt(!1)},[ft]);async function yr(){if(dt(null),Z.triggerMode===`once`&&!jn&&new Date(Z.onceAt).getTime()<=Date.now()){dt(l.experience.futureTime);return}if(!(!Zn||tn)&&!(Ue===`quick`&&ze?.requiresProject&&!Z.projectId)){if(Xe&&xt){nn(`draft:edit`);try{let e=qe(Z,Gn),{simulation:t}=await K.simulate(e);wt({...xt,automation:e,simulation:t}),Ft(Z.projectId),Bt(Z.conversationMode),Ht(Z.notificationPolicy),Nt(!1),Ze(!1),Ke(`draft`)}catch(e){dt(e instanceof Error?e.message:String(e))}finally{nn(null)}return}if(jn){let e=jn.id;await br(`automation:${e}:edit`,()=>K.update(e,Yn?{trigger:et(jn,{...Z,instruction:`managed`},null).trigger}:et(jn,Z,Gn)))&&(He(!1),Ye(null),_t(e));return}nn(`automation:create`);try{let e=qe(Z,Gn),{automation:t}=await K.create(e);nt(Ge),He(!1),x(e=>{let n=new URLSearchParams(e);return n.delete(`status`),n.delete(`q`),n.delete(`run`),n.set(`automation`,t.id),be||(t.projectId?n.set(`projectId`,t.projectId):n.delete(`projectId`)),n}),await sr(),_t(t.id)}catch(e){dt(e instanceof Error?e.message:String(e))}finally{nn(null)}}}async function br(e,t){dt(null),nn(e);try{return await t(),await sr(),!0}catch(e){return dt(e instanceof Error?e.message:String(e)),!1}finally{nn(null)}}async function xr(){await br(`runs:read-all`,()=>K.markAllRunsRead(q||void 0))}async function Sr(){let e=vt.trim();if(e){dt(null),Ot(!0);try{wt((await K.draft({prompt:e,language:o})).draft),Nt(!1)}catch(e){dt(e instanceof Error?e.message:String(e))}finally{Ot(!1)}}}async function Cr(){if(!xt)return;let e=``,t=``;await br(`draft:publish`,async()=>{let{automation:n}=await K.create({...xt.automation,...Pt?{projectId:Pt}:{projectId:void 0},conversationMode:zt,delivery:{...xt.automation.delivery,notificationPolicy:Vt}});wt(null),yt(``),Nt(!1),He(!1),Pe(`all`),Ie(``),e=n.id,t=n.projectId??``})&&e&&(cr(t),_t(e))}async function wr(){if(!xt)return;let e=``,t=``,n=``;await br(`draft:test`,async()=>{let{automation:r}=await K.create({...xt.automation,...Pt?{projectId:Pt}:{projectId:void 0},conversationMode:zt,delivery:{...xt.automation.delivery,notificationPolicy:Vt},enabled:!1}),{run:i}=await K.runNow(r.id);e=r.id,t=r.projectId??``,n=i.id,wt(null),yt(``),Nt(!1),He(!1),Pe(`all`),Ie(``)})&&e&&n&&(cr(t),_t(e),gr(n))}async function Tr(e){dt(null),Jt(!0),Kt(null),Xt(!1);try{Kt((await K.repairDraft(e.id,{language:o})).repair)}catch(e){dt(e instanceof Error?e.message:String(e))}finally{Jt(!1)}}async function Er(e){Gt&&await br(`run:${e.id}:repair`,async()=>{await K.update(e.automationId,Gt.patch),Kt(null),Xt(!1)})}let Dr=(0,Y.useMemo)(()=>(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(he,{className:`size-9 shrink-0 p-0`,loading:Zt,label:l.refresh,onClick:mr}),(0,X.jsxs)(`div`,{className:`inline-flex h-9 shrink-0`,role:`group`,"aria-label":l.createOptions,children:[(0,X.jsxs)(I,{variant:`primary`,className:`h-9 rounded-r-none pr-2.5`,onClick:ur,children:[(0,X.jsx)(C,{className:`size-4`,"aria-hidden":!0}),l.create]}),(0,X.jsxs)(le,{children:[(0,X.jsx)(ie,{asChild:!0,children:(0,X.jsx)(I,{variant:`primary`,className:`h-9 w-9 rounded-l-none border-l border-white/20 px-0`,"aria-label":l.createOptions,title:l.createOptions,children:(0,X.jsx)(ue,{className:`size-4`,"aria-hidden":!0})})}),(0,X.jsx)(ce,{children:(0,X.jsxs)(oe,{align:`end`,sideOffset:6,className:`z-70 min-w-52 rounded-xl border border-edge bg-surface-panel p-1 shadow-popover`,children:[(0,X.jsxs)(se,{className:`touch-target flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover`,onSelect:ur,children:[(0,X.jsx)(pe,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),l.createWithAssistant]}),(0,X.jsxs)(se,{className:`touch-target flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover`,onSelect:()=>lr(`blank`),children:[(0,X.jsx)(S,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),l.setUpManually]})]})})]})]})]}),[l.create,l.createOptions,l.createWithAssistant,l.refresh,l.setUpManually,ur,lr,Zt,mr]);return(0,Y.useLayoutEffect)(()=>{if(!t)return m({startExtra:null,main:(0,X.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:u}),end:Dr}),()=>_()},[_,t,Dr,u,m]),(0,X.jsxs)(`div`,{className:D(`flex min-h-0 min-w-0 flex-1 flex-col`,t?`bg-transparent`:`bg-surface-panel`),children:[(0,X.jsxs)(`div`,{className:D(`flex w-full flex-col gap-4`,t?`py-1`:`mx-auto max-w-[96rem] px-4 pb-7 pt-3 sm:px-6 lg:px-8 lg:pb-9 lg:pt-4`),children:[t?(0,X.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3 rounded-xl border border-edge-subtle bg-surface-base px-4 py-3 shadow-surface`,children:[(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(G,{className:`size-4 text-accent-fg`,"aria-hidden":!0}),(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n||l.title})]}),(0,X.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:r||l.subtitle})]}),Dr]}):null,it||an.error||on.error||sn.error||cn.error?(0,X.jsx)(`div`,{role:`alert`,className:`rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:it||l.feedback.actionFailed}):null,ee?gn?(0,X.jsx)(Et,{}):(0,X.jsx)(Lt,{runs:Ln,ownership:Oe,labels:l,language:o,unreadCount:Oe===`user`?Pn.length:0,loading:_n||Zt,onOwnershipChange:Fe,onRefresh:mr,onSelectRun:gr}):(0,X.jsxs)(X.Fragment,{children:[gn?null:(0,X.jsxs)(`section`,{"aria-labelledby":`automation-overview-title`,children:[(0,X.jsx)(`h2`,{id:`automation-overview-title`,className:`sr-only`,children:l.overview.title}),(0,X.jsxs)(`div`,{className:`grid grid-cols-2 gap-px overflow-hidden rounded-xl border border-edge-subtle bg-edge-subtle xl:grid-cols-4`,children:[(0,X.jsx)(It,{icon:(0,X.jsx)(G,{className:`size-4`,"aria-hidden":!0}),label:l.metrics.enabled,value:String(In.filter(e=>e.enabled).length),active:Ee===`active`,onClick:()=>Pe(`active`)}),(0,X.jsx)(It,{icon:(0,X.jsx)(s,{className:`size-4`,"aria-hidden":!0}),label:l.metrics.running,value:String(nr),active:Ee===`running`,onClick:()=>Pe(`running`)}),(0,X.jsx)(It,{icon:(0,X.jsx)(h,{className:`size-4`,"aria-hidden":!0}),label:l.dashboard.needsAttention,value:String(er.length),tone:er.length>0?`danger`:`default`,active:Ee===`attention`,onClick:()=>Pe(`attention`)}),(0,X.jsx)(It,{icon:(0,X.jsx)(ae,{className:`size-4`,"aria-hidden":!0}),label:l.metrics.next,value:rr?Se(rr.state.nextRunAtMs,o):`—`,onClick:rr?vr:void 0})]})]}),!gn&&tr&&Oe===`user`?(0,X.jsxs)(`div`,{className:`flex items-center rounded-lg border border-red-500/20 bg-red-500/5`,children:[(0,X.jsxs)(`button`,{type:`button`,onClick:()=>Pe(`attention`),className:`flex min-w-0 flex-1 items-center gap-3 rounded-l-lg px-4 py-3 text-left focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,X.jsx)(h,{className:`size-4 shrink-0 text-red-700 dark:text-red-300`,"aria-hidden":!0}),(0,X.jsxs)(`span`,{className:`min-w-0 text-sm text-fg`,children:[(0,X.jsxs)(`span`,{className:`font-medium`,children:[l.experience.executionIssues,` · `,$n.length]}),(0,X.jsx)(`span`,{className:`ml-2 text-fg-muted`,children:l.experience.issuesDescription})]})]}),(0,X.jsx)(`button`,{type:`button`,onClick:or,className:`mr-2 rounded-md p-2 text-fg-muted hover:bg-red-500/10 hover:text-fg focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":l.close,title:l.close,children:(0,X.jsx)(T,{className:`size-4`,"aria-hidden":!0})})]}):null,gn?(0,X.jsx)(Et,{}):(0,X.jsxs)(`section`,{className:`grid min-h-0 items-start gap-4 xl:grid-cols-[minmax(18rem,0.8fr)_minmax(0,1.5fr)]`,"aria-busy":_n,children:[(0,X.jsxs)(`aside`,{className:`flex max-h-[42rem] flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-base shadow-surface xl:sticky xl:top-20 xl:max-h-[calc(100vh-7rem)]`,children:[(0,X.jsxs)(`div`,{className:`shrink-0 border-b border-edge-subtle p-3`,children:[be?null:(0,X.jsxs)(f,{"aria-label":l.filters.project,className:Q,value:q,onChange:e=>cr(e.target.value),children:[(0,X.jsx)(p,{value:``,children:l.filters.allProjects}),Wn.map(e=>(0,X.jsx)(p,{value:e.id,children:e.name},e.id))]}),(0,X.jsxs)(`div`,{className:D(`flex items-center gap-2`,!be&&`mt-2`),children:[(0,X.jsxs)(`label`,{className:`flex min-w-0 flex-1 items-center gap-2 rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg-muted focus-within:border-accent`,children:[(0,X.jsx)(w,{className:`size-4 shrink-0`,"aria-hidden":!0}),(0,X.jsx)(`input`,{className:`min-w-0 flex-1 bg-transparent text-fg outline-none placeholder:text-fg-subtle`,value:je,onChange:e=>Ie(e.target.value),placeholder:l.filters.search,"aria-label":l.filters.search})]}),(0,X.jsxs)(ne,{children:[(0,X.jsx)(re,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,className:D(`inline-flex h-10 shrink-0 items-center gap-1.5 rounded-lg border border-edge bg-surface-panel px-3 text-sm font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,ar>0&&`border-accent/40 bg-accent/8 text-accent-fg`),"aria-label":l.filters.more,children:[(0,X.jsx)(H,{className:`size-4`,"aria-hidden":!0}),(0,X.jsx)(`span`,{children:l.filters.more}),ar>0?(0,X.jsx)(`span`,{className:`inline-flex min-w-5 items-center justify-center rounded-full bg-accent px-1.5 text-[11px] leading-5 text-on-accent`,children:ar}):null]})}),(0,X.jsx)(L,{children:(0,X.jsxs)(z,{align:`end`,sideOffset:6,className:`z-[90] w-[min(22rem,calc(100vw-2rem))] rounded-xl border border-edge bg-surface-overlay p-3 shadow-popover outline-none`,children:[(0,X.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:l.filters.status}),(0,X.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1`,role:`group`,"aria-label":l.filters.status,children:[{id:`all`,label:l.filters.all},{id:`active`,label:l.filters.active},{id:`running`,label:l.metrics.running},{id:`paused`,label:l.paused},{id:`attention`,label:l.experience.executionIssues}].map(e=>(0,X.jsx)(`button`,{type:`button`,className:D(`rounded-md px-2.5 py-1.5 text-xs font-medium text-fg-muted hover:bg-surface-hover hover:text-fg`,Ee===e.id&&`bg-surface-active text-fg`),onClick:()=>Pe(e.id),"aria-pressed":Ee===e.id,children:e.label},e.id))}),(0,X.jsxs)(`div`,{className:`mt-3 border-t border-edge-subtle pt-3`,children:[(0,X.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:l.filters.executor}),(0,X.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1`,role:`group`,"aria-label":l.filters.executor,children:[{id:`all`,label:l.filters.allSources,icon:G},{id:`agent`,label:l.sources.agent,icon:te},{id:`workflow`,label:l.sources.workflow,icon:b},{id:`task_command`,label:l.sources.task,icon:g},{id:`browser_automation`,label:l.sources.browser,icon:ye}].map(e=>(0,X.jsxs)(`button`,{type:`button`,className:D(`flex min-h-8 items-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-xs text-fg-muted hover:bg-surface-hover hover:text-fg`,J===e.id&&`border-edge bg-surface-active text-fg`),onClick:()=>Le(e.id),"aria-pressed":J===e.id,children:[(0,X.jsx)(e.icon,{className:`size-3.5`,"aria-hidden":!0}),(0,X.jsx)(`span`,{children:e.label}),(0,X.jsx)(`span`,{className:`text-fg-subtle`,children:ir[e.id]})]},e.id))})]}),ar>0?(0,X.jsx)(`div`,{className:`mt-3 flex justify-end border-t border-edge-subtle pt-3`,children:(0,X.jsx)(`button`,{type:`button`,className:`text-xs font-medium text-accent-fg hover:underline`,onClick:Re,children:l.filters.clear})}):null]})})]})]}),(0,X.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-3`,children:[(0,X.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:l.filters.ownership}),(0,X.jsxs)(`div`,{className:`flex rounded-lg bg-surface-panel p-0.5`,role:`group`,"aria-label":l.filters.ownership,children:[(0,X.jsxs)(`button`,{type:`button`,className:D(`rounded-md px-2.5 py-1.5 text-xs font-medium text-fg-muted hover:text-fg`,Oe===`user`&&`bg-surface-base text-fg shadow-sm`),onClick:()=>Fe(`user`),"aria-pressed":Oe===`user`,children:[l.filters.userManaged,` · `,Sn.length]}),(0,X.jsxs)(`button`,{type:`button`,className:D(`rounded-md px-2.5 py-1.5 text-xs font-medium text-fg-muted hover:text-fg`,Oe===`system`&&`bg-surface-base text-fg shadow-sm`),onClick:()=>Fe(`system`),"aria-pressed":Oe===`system`,children:[l.system.title,` · `,Cn.length]})]})]}),Pn.length>0&&Oe===`user`?(0,X.jsxs)(`div`,{className:`mt-2 flex items-center justify-between gap-2 rounded-md bg-accent/8 px-2.5 py-1.5 text-xs text-accent-fg`,children:[(0,X.jsxs)(`span`,{children:[l.filters.unread,` · `,Pn.length]}),(0,X.jsx)(`button`,{type:`button`,className:`font-medium hover:underline`,disabled:tn===`runs:read-all`,onClick:()=>void xr(),children:l.filters.markAllRead})]}):null,(0,X.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-3 text-xs text-fg-muted`,children:[(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[_n?(0,X.jsx)(de,{className:`size-3 animate-spin`,"aria-hidden":!0}):null,_n?l.loading:l.filters.results.replace(`{count}`,String(zn.length))]}),Ee!==`all`||J!==`all`||Fn?(0,X.jsx)(`button`,{type:`button`,className:`font-medium text-accent-fg hover:underline`,onClick:Re,children:l.filters.clear}):null]})]}),(0,X.jsx)(Rt,{automations:zn,runs:Ln,labels:l,cronLabels:d,language:o,selectedAutomationId:gt,onOpenDetails:_r})]}),An?(0,X.jsx)(Wt,{automation:An,runs:Mn,runsLoading:ln.isLoading,runsError:ln.error?l.feedback.actionFailed:void 0,labels:l,cronLabels:d,language:o,projects:Wn,busyAction:tn,onEdit:fr,onSelectRun:gr,onAction:br},An.id):(0,X.jsx)(`div`,{className:`min-h-[28rem] overflow-hidden rounded-xl border border-edge-subtle bg-surface-base shadow-surface`,children:Oe===`user`&&In.length===0?(0,X.jsxs)(`div`,{className:`p-5`,children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:l.experience.scenes}),(0,X.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:l.experience.scenesDescription}),(0,X.jsx)(At,{templates:Qn,labels:l,onSelect:dr}),(0,X.jsx)(I,{className:`mt-4`,variant:`ghost`,onClick:()=>lr(`draft`),children:l.experience.custom})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Qt,{className:`min-h-56 rounded-none border-0 shadow-none`,icon:(0,X.jsx)(G,{className:`size-5`}),title:In.length===0?l.empty.automations:l.empty.filtered}),In.length>0?(0,X.jsx)(`div`,{className:`flex justify-center border-t border-edge-subtle p-4`,children:(0,X.jsx)(I,{variant:`ghost`,onClick:Re,children:l.filters.clear})}):null]})})]}),!gn&&Sn.length>0?(0,X.jsx)(`div`,{children:(0,X.jsxs)(I,{variant:`ghost`,onClick:()=>lr(`draft`),children:[(0,X.jsx)(C,{className:`size-4`,"aria-hidden":!0}),l.experience.discover]})}):null]})]}),(0,X.jsx)(P,{open:Ve,onOpenChange:e=>{He(e),e||(Ye(null),Ze(!1))},children:(0,X.jsxs)(j,{children:[(0,X.jsx)(k,{className:`xopc-dialog-overlay fixed inset-0 z-65 bg-scrim backdrop-blur-[1px]`}),(0,X.jsxs)(M,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-66 flex h-[min(760px,calc(100vh-2rem))] w-[min(100%-2rem,48rem)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-popover outline-none`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-5 py-4`,children:[(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(N,{className:`text-base font-semibold text-fg`,children:Ue===`draft`?l.draft.title:jn?l.editTitle:Xe?l.draft.editTitle:l.createTitle}),(0,X.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:Ue===`draft`?l.draft.subtitle:l.form.createFlowHint})]}),(0,X.jsx)(A,{asChild:!0,children:(0,X.jsx)(I,{variant:`ghost`,"aria-label":l.close,children:(0,X.jsx)(T,{className:`size-4`})})})]}),it?(0,X.jsx)(`p`,{role:`alert`,className:`px-5 py-2 text-sm text-red-700 dark:text-red-300`,children:it}):null,Ue===`draft`?(0,X.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:(0,X.jsx)(Mt,{labels:l,prompt:vt,draft:xt,loading:Dt,approved:kt,publishBusy:tn===`draft:publish`,testBusy:tn===`draft:test`,templates:Qn,projects:Wn,projectId:Pt,conversationMode:zt,notificationPolicy:Vt,onPromptChange:yt,onGenerate:Sr,onEdit:pr,onPublish:Cr,onTest:wr,onProjectChange:Ft,onConversationModeChange:Bt,onNotificationPolicyChange:Ht,projectLocked:be,onApprovedChange:Nt,onDiscard:()=>{wt(null),Nt(!1)},onTemplateSelect:e=>{dr(e),nt({...e.form,projectId:Pt})},onOpenAdvanced:()=>{nt({...Ge,projectId:Pt,conversationMode:zt,notificationPolicy:Vt}),Ke(`blank`)}})}):(0,X.jsxs)(X.Fragment,{children:[Yn?(0,X.jsx)(jt,{form:Z,setForm:nt,labels:l}):Ue===`quick`&&ze?(0,X.jsx)(rt,{form:Z,setForm:nt,labels:l,projects:Wn,projectLocked:be,source:ze.source,requiresProject:ze.requiresProject}):(0,X.jsx)($t,{form:Z,labels:l,setForm:nt,projects:Wn,workflowDefinitions:Bn,selectedWorkflow:Gn,workflowsLoading:dn.isLoading,browserAutomations:Vn,selectedBrowserAutomation:Kn,browserAutomationsLoading:fn.isLoading,agentOptions:Hn,agentsLoading:pn.isLoading,defaultAgentId:pn.data?.defaultId??``,taskOptions:Un,tasksLoading:mn.isLoading,language:o,projectLocked:be}),(0,X.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2 border-t border-edge px-5 py-4`,children:[Ue===`quick`?(0,X.jsx)(I,{variant:`ghost`,onClick:()=>Ke(`blank`),children:l.draft.advancedCreate}):null,Xe?(0,X.jsx)(I,{variant:`ghost`,onClick:()=>{Ze(!1),Ke(`draft`)},children:l.cancel}):(0,X.jsx)(A,{asChild:!0,children:(0,X.jsx)(I,{variant:`ghost`,children:l.cancel})}),(0,X.jsx)(I,{variant:`primary`,onClick:yr,disabled:!Zn||!!tn||Ue===`quick`&&!!ze?.requiresProject&&!Z.projectId,children:tn===`automation:create`||tn===`draft:edit`||jn&&tn===`automation:${jn.id}:edit`?l.feedback.working:jn||Xe?l.save:l.experience.createEnabled})]})]})]})]})}),(0,X.jsx)(P,{open:mt&&!!kn,onOpenChange:e=>{ht(e),!e&&x(e=>{let t=new URLSearchParams(e);return t.delete(`run`),t},{replace:!0})},children:(0,X.jsxs)(j,{children:[(0,X.jsx)(k,{className:`xopc-dialog-overlay fixed inset-0 z-65 bg-scrim backdrop-blur-[1px]`}),(0,X.jsxs)(M,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-66 flex h-[min(85vh,40rem)] w-[min(100%-2rem,32rem)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-popover outline-none`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,X.jsx)(N,{className:`truncate text-base font-semibold text-fg`,children:kn?.automationName??l.dashboard.result}),(0,X.jsx)(A,{asChild:!0,children:(0,X.jsx)(I,{variant:`ghost`,"aria-label":l.close,children:(0,X.jsx)(T,{className:`size-4`})})})]}),(0,X.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:(0,X.jsx)(Ut,{className:`rounded-none border-0`,run:kn,events:Nn,labels:l,cronLabels:d,language:o,loading:un.isLoading,repairDraft:Gt,repairLoading:qt,repairApproved:Yt,busyAction:tn,onRepairApprovedChange:Xt,onSuggestRepair:Tr,onApplyRepair:Er})})]})]})})]})}function At(e){let t=(0,Ie.c)(9),{templates:n,labels:r,onSelect:i}=e,a;if(t[0]!==r||t[1]!==i||t[2]!==n){let e;t[4]!==r||t[5]!==i?(e=e=>(0,X.jsxs)(`button`,{type:`button`,onClick:()=>i(e),className:`rounded-lg border border-edge-subtle bg-surface-panel p-4 text-left hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,X.jsx)(ae,{className:`mb-3 size-4 text-accent-fg`,"aria-hidden":!0}),(0,X.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:e.name}),(0,X.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:e.description}),(0,X.jsxs)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:[r.experience.source,`: `,e.source]})]},e.name),t[4]=r,t[5]=i,t[6]=e):e=t[6],a=n.map(e),t[0]=r,t[1]=i,t[2]=n,t[3]=a}else a=t[3];let o;return t[7]===a?o=t[8]:(o=(0,X.jsx)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2 lg:grid-cols-4`,children:a}),t[7]=a,t[8]=o),o}function jt(e){let t=(0,Ie.c)(48),{form:n,setForm:r,labels:i}=e,a;t[0]===r?a=t[1]:(a=e=>r(t=>({...t,...e})),t[0]=r,t[1]=a);let o=a,s;t[2]!==i.form.trigger||t[3]!==i.form.triggerStepDescription?(s=(0,X.jsx)(rn,{step:`1`,title:i.form.trigger,description:i.form.triggerStepDescription}),t[2]=i.form.trigger,t[3]=i.form.triggerStepDescription,t[4]=s):s=t[4];let c;t[5]===o?c=t[6]:(c=e=>o({triggerMode:e.target.value}),t[5]=o,t[6]=c);let l;t[7]===i.trigger.daily?l=t[8]:(l=(0,X.jsx)(p,{value:`daily`,children:i.trigger.daily}),t[7]=i.trigger.daily,t[8]=l);let u;t[9]===i.trigger.weekly?u=t[10]:(u=(0,X.jsx)(p,{value:`weekly`,children:i.trigger.weekly}),t[9]=i.trigger.weekly,t[10]=u);let d;t[11]===i.trigger.interval?d=t[12]:(d=(0,X.jsx)(p,{value:`interval`,children:i.trigger.interval}),t[11]=i.trigger.interval,t[12]=d);let m;t[13]===i.trigger.customCron?m=t[14]:(m=(0,X.jsx)(p,{value:`cron`,children:i.trigger.customCron}),t[13]=i.trigger.customCron,t[14]=m);let h;t[15]!==n.triggerMode||t[16]!==c||t[17]!==l||t[18]!==u||t[19]!==d||t[20]!==m?(h=(0,X.jsxs)(f,{className:Q,value:n.triggerMode,onChange:c,children:[l,u,d,m]}),t[15]=n.triggerMode,t[16]=c,t[17]=l,t[18]=u,t[19]=d,t[20]=m,t[21]=h):h=t[21];let g;t[22]!==n.time||t[23]!==n.triggerMode||t[24]!==n.weekday||t[25]!==i.form.day||t[26]!==i.form.time||t[27]!==i.weekdays||t[28]!==o?(g=n.triggerMode===`daily`||n.triggerMode===`weekly`?(0,X.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[(0,X.jsx)($,{label:i.form.time,children:(0,X.jsx)(Ve,{value:n.time,onChange:e=>o({time:e}),ariaLabel:i.form.time})}),n.triggerMode===`weekly`?(0,X.jsx)($,{label:i.form.day,children:(0,X.jsxs)(f,{className:Q,value:n.weekday,onChange:e=>o({weekday:e.target.value}),children:[(0,X.jsx)(p,{value:`1`,children:i.weekdays.monday}),(0,X.jsx)(p,{value:`2`,children:i.weekdays.tuesday}),(0,X.jsx)(p,{value:`3`,children:i.weekdays.wednesday}),(0,X.jsx)(p,{value:`4`,children:i.weekdays.thursday}),(0,X.jsx)(p,{value:`5`,children:i.weekdays.friday}),(0,X.jsx)(p,{value:`6`,children:i.weekdays.saturday}),(0,X.jsx)(p,{value:`0`,children:i.weekdays.sunday})]})}):null]}):null,t[22]=n.time,t[23]=n.triggerMode,t[24]=n.weekday,t[25]=i.form.day,t[26]=i.form.time,t[27]=i.weekdays,t[28]=o,t[29]=g):g=t[29];let _;t[30]!==n.intervalUnit||t[31]!==n.intervalValue||t[32]!==n.triggerMode||t[33]!==i.form.intervalEvery||t[34]!==i.form.intervalUnits||t[35]!==o?(_=n.triggerMode===`interval`?(0,X.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-[minmax(0,1fr)_10rem]`,children:[(0,X.jsx)($,{label:i.form.intervalEvery,children:(0,X.jsx)(`input`,{className:Q,type:`number`,min:`1`,value:n.intervalValue,onChange:e=>o({intervalValue:e.target.value})})}),(0,X.jsx)($,{label:i.form.intervalUnits.minute,children:(0,X.jsxs)(f,{className:Q,value:n.intervalUnit,onChange:e=>o({intervalUnit:e.target.value}),children:[(0,X.jsx)(p,{value:`minute`,children:i.form.intervalUnits.minute}),(0,X.jsx)(p,{value:`hour`,children:i.form.intervalUnits.hour}),(0,X.jsx)(p,{value:`day`,children:i.form.intervalUnits.day}),(0,X.jsx)(p,{value:`week`,children:i.form.intervalUnits.week})]})})]}):null,t[30]=n.intervalUnit,t[31]=n.intervalValue,t[32]=n.triggerMode,t[33]=i.form.intervalEvery,t[34]=i.form.intervalUnits,t[35]=o,t[36]=_):_=t[36];let v;t[37]!==n.cronExpr||t[38]!==n.triggerMode||t[39]!==i.form.expression||t[40]!==o?(v=n.triggerMode===`cron`?(0,X.jsx)(`div`,{className:`mt-4`,children:(0,X.jsx)($,{label:i.form.expression,children:(0,X.jsx)(`input`,{className:Q,value:n.cronExpr,onChange:e=>o({cronExpr:e.target.value})})})}):null,t[37]=n.cronExpr,t[38]=n.triggerMode,t[39]=i.form.expression,t[40]=o,t[41]=v):v=t[41];let y;return t[42]!==_||t[43]!==v||t[44]!==s||t[45]!==h||t[46]!==g?(y=(0,X.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[s,h,g,_,v]}),t[42]=_,t[43]=v,t[44]=s,t[45]=h,t[46]=g,t[47]=y):y=t[47],y}function Mt(e){let t=(0,Ie.c)(110),{labels:n,prompt:r,draft:i,loading:a,approved:o,publishBusy:s,testBusy:c,templates:l,projects:u,projectId:d,conversationMode:m,notificationPolicy:h,onPromptChange:g,onGenerate:_,onEdit:v,onPublish:y,onTest:b,onProjectChange:x,onConversationModeChange:C,onNotificationPolicyChange:w,onApprovedChange:T,onDiscard:E,onTemplateSelect:O,onOpenAdvanced:k,projectLocked:A}=e,j=s===void 0?!1:s,M=c===void 0?!1:c,N=A===void 0?!1:A,P=!!(i&&i.simulation.requiredConfirmations.length>0),F;t[0]!==i||t[1]!==n.draft.advancedCreate||t[2]!==n.draft.suggestions||t[3]!==n.draft.suggestionsDescription||t[4]!==n.experience||t[5]!==k||t[6]!==O||t[7]!==l?(F=i?null:(0,X.jsxs)(`div`,{className:`mb-5 border-b border-edge-subtle pb-4`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n.draft.suggestions}),(0,X.jsx)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:n.draft.suggestionsDescription})]}),(0,X.jsx)(I,{variant:`ghost`,onClick:k,children:n.draft.advancedCreate})]}),(0,X.jsx)(`div`,{className:`mt-3 grid gap-2 sm:grid-cols-2`,children:l.map(e=>(0,X.jsxs)(`button`,{type:`button`,className:`focus-visible:ring-2 focus-visible:ring-accent rounded-lg border border-edge-subtle bg-surface-panel p-3 text-left hover:bg-surface-hover`,onClick:()=>O(e),children:[(0,X.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:e.name}),(0,X.jsx)(`div`,{className:`mt-1 line-clamp-2 text-xs text-fg-muted`,children:e.description}),(0,X.jsxs)(`div`,{className:`mt-2 text-xs text-fg-muted`,children:[n.experience.source,`: `,e.source]})]},e.name))})]}),t[0]=i,t[1]=n.draft.advancedCreate,t[2]=n.draft.suggestions,t[3]=n.draft.suggestionsDescription,t[4]=n.experience,t[5]=k,t[6]=O,t[7]=l,t[8]=F):F=t[8];let L;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,X.jsx)(te,{className:`size-4 text-accent`}),t[9]=L):L=t[9];let R;t[10]===n.draft.title?R=t[11]:(R=(0,X.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[L,n.draft.title]}),t[10]=n.draft.title,t[11]=R);let z;t[12]===n.draft.subtitle?z=t[13]:(z=(0,X.jsx)(`div`,{className:`mt-1 text-sm text-fg-muted`,children:n.draft.subtitle}),t[12]=n.draft.subtitle,t[13]=z);let ne;t[14]!==R||t[15]!==z?(ne=(0,X.jsxs)(`div`,{className:`min-w-0`,children:[R,z]}),t[14]=R,t[15]=z,t[16]=ne):ne=t[16];let re;t[17]!==a||t[18]!==r?(re=a||!r.trim(),t[17]=a,t[18]=r,t[19]=re):re=t[19];let B;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,X.jsx)(te,{className:`size-4`}),t[20]=B):B=t[20];let ie=a?n.draft.generating:n.draft.generate,ae;t[21]!==_||t[22]!==ie||t[23]!==re?(ae=(0,X.jsxs)(I,{variant:`primary`,onClick:_,disabled:re,children:[B,ie]}),t[21]=_,t[22]=ie,t[23]=re,t[24]=ae):ae=t[24];let oe;t[25]!==ae||t[26]!==ne?(oe=(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[ne,ae]}),t[25]=ae,t[26]=ne,t[27]=oe):oe=t[27];let se;t[28]===g?se=t[29]:(se=e=>g(e.target.value),t[28]=g,t[29]=se);let V;t[30]!==n.draft.placeholder||t[31]!==n.draft.title||t[32]!==r||t[33]!==se?(V=(0,X.jsx)(`textarea`,{"aria-label":n.draft.title,className:`mt-4 min-h-20 w-full resize-y rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none focus:border-accent`,value:r,onChange:se,placeholder:n.draft.placeholder}),t[30]=n.draft.placeholder,t[31]=n.draft.title,t[32]=r,t[33]=se,t[34]=V):V=t[34];let ce=N?`sm:grid-cols-2`:`sm:grid-cols-3`,H;t[35]===ce?H=t[36]:(H=D(`mt-3 grid gap-3`,ce),t[35]=ce,t[36]=H);let le;t[37]!==n.draft.noProject||t[38]!==n.draft.project||t[39]!==x||t[40]!==d||t[41]!==N||t[42]!==u?(le=N?null:(0,X.jsx)($,{label:n.draft.project,children:(0,X.jsxs)(f,{className:Q,value:d,onChange:e=>x(e.target.value),children:[(0,X.jsx)(p,{value:``,children:n.draft.noProject}),u.map(Nt)]})}),t[37]=n.draft.noProject,t[38]=n.draft.project,t[39]=x,t[40]=d,t[41]=N,t[42]=u,t[43]=le):le=t[43];let ue;t[44]===C?ue=t[45]:(ue=e=>C(e.target.value),t[44]=C,t[45]=ue);let de;t[46]===n.draft.newConversation?de=t[47]:(de=(0,X.jsx)(p,{value:`new_session`,children:n.draft.newConversation}),t[46]=n.draft.newConversation,t[47]=de);let U;t[48]===n.draft.continuousConversation?U=t[49]:(U=(0,X.jsx)(p,{value:`continuous`,children:n.draft.continuousConversation}),t[48]=n.draft.continuousConversation,t[49]=U);let W;t[50]!==m||t[51]!==ue||t[52]!==de||t[53]!==U?(W=(0,X.jsxs)(f,{className:Q,value:m,onChange:ue,children:[de,U]}),t[50]=m,t[51]=ue,t[52]=de,t[53]=U,t[54]=W):W=t[54];let G;t[55]!==n.draft.conversation||t[56]!==W?(G=(0,X.jsx)($,{label:n.draft.conversation,children:W}),t[55]=n.draft.conversation,t[56]=W,t[57]=G):G=t[57];let fe;t[58]===w?fe=t[59]:(fe=e=>w(e.target.value),t[58]=w,t[59]=fe);let pe;t[60]===n.draft.notifyAttention?pe=t[61]:(pe=(0,X.jsx)(p,{value:`attention`,children:n.draft.notifyAttention}),t[60]=n.draft.notifyAttention,t[61]=pe);let me;t[62]===n.draft.notifyAll?me=t[63]:(me=(0,X.jsx)(p,{value:`all`,children:n.draft.notifyAll}),t[62]=n.draft.notifyAll,t[63]=me);let K;t[64]===n.draft.notifyNone?K=t[65]:(K=(0,X.jsx)(p,{value:`none`,children:n.draft.notifyNone}),t[64]=n.draft.notifyNone,t[65]=K);let he;t[66]!==h||t[67]!==fe||t[68]!==pe||t[69]!==me||t[70]!==K?(he=(0,X.jsxs)(f,{className:Q,value:h,onChange:fe,children:[pe,me,K]}),t[66]=h,t[67]=fe,t[68]=pe,t[69]=me,t[70]=K,t[71]=he):he=t[71];let ge;t[72]!==n.draft.notifications||t[73]!==he?(ge=(0,X.jsx)($,{label:n.draft.notifications,children:he}),t[72]=n.draft.notifications,t[73]=he,t[74]=ge):ge=t[74];let _e;t[75]!==H||t[76]!==le||t[77]!==G||t[78]!==ge?(_e=(0,X.jsxs)(`div`,{className:H,children:[le,G,ge]}),t[75]=H,t[76]=le,t[77]=G,t[78]=ge,t[79]=_e):_e=t[79];let ve;t[80]!==o||t[81]!==i||t[82]!==n.draft.approval||t[83]!==n.draft.assumptions||t[84]!==n.draft.discard||t[85]!==n.draft.edit||t[86]!==n.draft.publish||t[87]!==n.draft.review||t[88]!==n.draft.risks||t[89]!==n.draft.safety||t[90]!==n.draft.testOnce||t[91]!==n.draft.testing||t[92]!==n.feedback||t[93]!==n.info||t[94]!==n.none||t[95]!==T||t[96]!==E||t[97]!==v||t[98]!==y||t[99]!==b||t[100]!==j||t[101]!==P||t[102]!==M?(ve=i?(0,X.jsxs)(`div`,{className:`mt-4 grid gap-3 rounded-lg bg-surface-base p-4 lg:grid-cols-[1fr_1fr]`,children:[(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:i.automation.name}),i.automation.description?(0,X.jsx)(`div`,{className:`mt-1 text-sm text-fg-muted`,children:i.automation.description}):null,(0,X.jsxs)(`div`,{className:`mt-3 grid gap-2 text-sm`,children:[(0,X.jsx)(Zt,{label:n.info.when,value:i.simulation.triggerSummary}),(0,X.jsx)(Zt,{label:n.info.run,value:i.simulation.actionSummary})]})]}),(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`div`,{className:`text-xs font-semibold uppercase text-fg-muted`,children:n.draft.review}),(0,X.jsx)(Pt,{title:n.draft.safety,items:[...i.simulation.safetyNotes,...i.simulation.requiredConfirmations],empty:n.none}),(0,X.jsx)(Pt,{title:n.draft.assumptions,items:i.assumptions,empty:n.none}),(0,X.jsx)(Pt,{title:n.draft.risks,items:i.risks,empty:n.none}),P?(0,X.jsxs)(`label`,{className:`mt-4 flex items-start gap-2 text-sm text-fg`,children:[(0,X.jsx)(`input`,{className:`mt-1`,type:`checkbox`,checked:o,onChange:e=>T(e.target.checked)}),(0,X.jsx)(`span`,{children:n.draft.approval})]}):null,(0,X.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,X.jsx)(I,{variant:`ghost`,onClick:E,children:n.draft.discard}),(0,X.jsxs)(I,{variant:`secondary`,onClick:v,children:[(0,X.jsx)(S,{className:`size-4`}),n.draft.edit]}),(0,X.jsxs)(I,{variant:`secondary`,onClick:b,disabled:M||j||P&&!o,children:[(0,X.jsx)(ee,{className:`size-4`}),M?n.draft.testing:n.draft.testOnce]}),(0,X.jsx)(I,{variant:`primary`,onClick:y,disabled:j||P&&!o,children:j?n.feedback.working:n.draft.publish})]})]})]}):null,t[80]=o,t[81]=i,t[82]=n.draft.approval,t[83]=n.draft.assumptions,t[84]=n.draft.discard,t[85]=n.draft.edit,t[86]=n.draft.publish,t[87]=n.draft.review,t[88]=n.draft.risks,t[89]=n.draft.safety,t[90]=n.draft.testOnce,t[91]=n.draft.testing,t[92]=n.feedback,t[93]=n.info,t[94]=n.none,t[95]=T,t[96]=E,t[97]=v,t[98]=y,t[99]=b,t[100]=j,t[101]=P,t[102]=M,t[103]=ve):ve=t[103];let ye;return t[104]!==oe||t[105]!==V||t[106]!==_e||t[107]!==ve||t[108]!==F?(ye=(0,X.jsxs)(`section`,{className:`rounded-lg border border-edge-subtle bg-surface-base p-4 shadow-surface`,children:[F,oe,V,_e,ve]}),t[104]=oe,t[105]=V,t[106]=_e,t[107]=ve,t[108]=F,t[109]=ye):ye=t[109],ye}function Nt(e){return(0,X.jsx)(p,{value:e.id,children:e.name},e.id)}function Pt(e){let t=(0,Ie.c)(10),{title:n,items:r,empty:i}=e,a;t[0]===n?a=t[1]:(a=(0,X.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:n}),t[0]=n,t[1]=a);let o;t[2]!==i||t[3]!==r?(o=r.length>0?r.map(Ft):(0,X.jsx)(`li`,{className:`text-fg-muted`,children:i}),t[2]=i,t[3]=r,t[4]=o):o=t[4];let s;t[5]===o?s=t[6]:(s=(0,X.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm text-fg`,children:o}),t[5]=o,t[6]=s);let c;return t[7]!==a||t[8]!==s?(c=(0,X.jsxs)(`div`,{className:`mt-3`,children:[a,s]}),t[7]=a,t[8]=s,t[9]=c):c=t[9],c}function Ft(e){return(0,X.jsxs)(`li`,{children:[`- `,e]},e)}function It(e){let t=(0,Ie.c)(25),{icon:n,label:r,value:i,tone:a,active:o,onClick:s}=e,c=a===void 0?`default`:a,l=c===`danger`?`text-red-600 dark:text-red-300`:`text-fg-subtle`,u;t[0]===l?u=t[1]:(u=D(`shrink-0`,l),t[0]=l,t[1]=u);let d;t[2]!==n||t[3]!==u?(d=(0,X.jsx)(`span`,{className:u,children:n}),t[2]=n,t[3]=u,t[4]=d):d=t[4];let f;t[5]===r?f=t[6]:(f=(0,X.jsx)(`span`,{className:`truncate text-xs font-medium text-fg-muted`,children:r}),t[5]=r,t[6]=f);let p=c===`danger`?`text-red-700 dark:text-red-300`:`text-fg`,m;t[7]===p?m=t[8]:(m=D(`ml-auto truncate text-sm font-semibold tabular-nums`,p),t[7]=p,t[8]=m);let h;t[9]!==m||t[10]!==i?(h=(0,X.jsx)(`span`,{className:m,children:i}),t[9]=m,t[10]=i,t[11]=h):h=t[11];let g;t[12]!==d||t[13]!==f||t[14]!==h?(g=(0,X.jsxs)(X.Fragment,{children:[d,f,h]}),t[12]=d,t[13]=f,t[14]=h,t[15]=g):g=t[15];let _=g,v=o&&`bg-accent/8`,y=s&&`cursor-pointer hover:bg-surface-hover focus-visible:z-10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,b;t[16]!==v||t[17]!==y?(b=D(`flex min-h-12 min-w-0 items-center gap-2.5 bg-surface-base px-3 py-2.5 text-left transition-colors`,v,y),t[16]=v,t[17]=y,t[18]=b):b=t[18];let x=b,S=`${r}: ${i}`,ee;return t[19]!==S||t[20]!==o||t[21]!==x||t[22]!==_||t[23]!==s?(ee=s?(0,X.jsx)(`button`,{type:`button`,className:x,onClick:s,"aria-label":S,"aria-pressed":o,children:_}):(0,X.jsx)(`div`,{className:x,"aria-label":S,children:_}),t[19]=S,t[20]=o,t[21]=x,t[22]=_,t[23]=s,t[24]=ee):ee=t[24],ee}function Lt(e){let t=(0,Ie.c)(74),{runs:n,ownership:r,labels:i,language:a,unreadCount:o,loading:c,onOwnershipChange:l,onRefresh:u,onSelectRun:d}=e,f;t[0]===n?f=t[1]:(f=n.filter(bt),t[0]=n,t[1]=f);let p=f.length,m;t[2]===n?m=t[3]:(m=n.filter(xt),t[2]=n,t[3]=m);let _=m.length,v;t[4]===i.dashboard.activity?v=t[5]:(v=(0,X.jsx)(`h2`,{id:`automation-activity-title`,className:`text-sm font-semibold text-fg`,children:i.dashboard.activity}),t[4]=i.dashboard.activity,t[5]=v);let y;t[6]===i.dashboard.activityDescription?y=t[7]:(y=(0,X.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:i.dashboard.activityDescription}),t[6]=i.dashboard.activityDescription,t[7]=y);let b;t[8]!==v||t[9]!==y?(b=(0,X.jsxs)(`div`,{className:`min-w-0`,children:[v,y]}),t[8]=v,t[9]=y,t[10]=b):b=t[10];let x=i.filters.ownership,S=r===`user`&&`bg-surface-base text-fg shadow-sm`,C;t[11]===S?C=t[12]:(C=D(`rounded-md px-2.5 py-1.5 text-xs font-medium text-fg-muted hover:text-fg`,S),t[11]=S,t[12]=C);let w;t[13]===l?w=t[14]:(w=()=>l(`user`),t[13]=l,t[14]=w);let te=r===`user`,T;t[15]!==i.filters.userManaged||t[16]!==te||t[17]!==C||t[18]!==w?(T=(0,X.jsx)(`button`,{type:`button`,className:C,onClick:w,"aria-pressed":te,children:i.filters.userManaged}),t[15]=i.filters.userManaged,t[16]=te,t[17]=C,t[18]=w,t[19]=T):T=t[19];let E=r===`system`&&`bg-surface-base text-fg shadow-sm`,O;t[20]===E?O=t[21]:(O=D(`rounded-md px-2.5 py-1.5 text-xs font-medium text-fg-muted hover:text-fg`,E),t[20]=E,t[21]=O);let k;t[22]===l?k=t[23]:(k=()=>l(`system`),t[22]=l,t[23]=k);let A=r===`system`,j;t[24]!==i.system.title||t[25]!==O||t[26]!==k||t[27]!==A?(j=(0,X.jsx)(`button`,{type:`button`,className:O,onClick:k,"aria-pressed":A,children:i.system.title}),t[24]=i.system.title,t[25]=O,t[26]=k,t[27]=A,t[28]=j):j=t[28];let M;t[29]!==i.filters.ownership||t[30]!==T||t[31]!==j?(M=(0,X.jsxs)(`div`,{className:`flex rounded-lg bg-surface-panel p-0.5`,role:`group`,"aria-label":x,children:[T,j]}),t[29]=i.filters.ownership,t[30]=T,t[31]=j,t[32]=M):M=t[32];let N;t[33]!==i.refresh||t[34]!==c||t[35]!==u?(N=(0,X.jsx)(he,{className:`size-9 shrink-0 p-0`,loading:c,label:i.refresh,onClick:u}),t[33]=i.refresh,t[34]=c,t[35]=u,t[36]=N):N=t[36];let P;t[37]!==M||t[38]!==N?(P=(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[M,N]}),t[37]=M,t[38]=N,t[39]=P):P=t[39];let F;t[40]!==P||t[41]!==b?(F=(0,X.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3 border-b border-edge-subtle px-4 py-3 sm:px-5`,children:[b,P]}),t[40]=P,t[41]=b,t[42]=F):F=t[42];let I;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,X.jsx)(s,{className:`size-4`,"aria-hidden":!0}),t[43]=I):I=t[43];let L=i.metrics.total,R=String(n.length),z;t[44]!==i.metrics.total||t[45]!==R?(z=(0,X.jsx)(It,{icon:I,label:L,value:R}),t[44]=i.metrics.total,t[45]=R,t[46]=z):z=t[46];let ne;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,X.jsx)(ee,{className:`size-4`,"aria-hidden":!0}),t[47]=ne):ne=t[47];let re=i.metrics.running,B=String(p),ie;t[48]!==i.metrics.running||t[49]!==B?(ie=(0,X.jsx)(It,{icon:ne,label:re,value:B}),t[48]=i.metrics.running,t[49]=B,t[50]=ie):ie=t[50];let ae;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,X.jsx)(h,{className:`size-4`,"aria-hidden":!0}),t[51]=ae):ae=t[51];let oe=i.dashboard.needsAttention,se=String(_),V=_>0?`danger`:`default`,ce;t[52]!==i.dashboard.needsAttention||t[53]!==se||t[54]!==V?(ce=(0,X.jsx)(It,{icon:ae,label:oe,value:se,tone:V}),t[52]=i.dashboard.needsAttention,t[53]=se,t[54]=V,t[55]=ce):ce=t[55];let H;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,X.jsx)(g,{className:`size-4`,"aria-hidden":!0}),t[56]=H):H=t[56];let le=i.filters.unread,ue=String(o),de;t[57]!==i.filters.unread||t[58]!==ue?(de=(0,X.jsx)(It,{icon:H,label:le,value:ue}),t[57]=i.filters.unread,t[58]=ue,t[59]=de):de=t[59];let U;t[60]!==z||t[61]!==ie||t[62]!==ce||t[63]!==de?(U=(0,X.jsxs)(`div`,{className:`grid grid-cols-2 gap-px border-b border-edge-subtle bg-edge-subtle lg:grid-cols-4`,children:[z,ie,ce,de]}),t[60]=z,t[61]=ie,t[62]=ce,t[63]=de,t[64]=U):U=t[64];let W;t[65]!==i||t[66]!==a||t[67]!==d||t[68]!==n?(W=n.length===0?(0,X.jsx)(Qt,{className:`min-h-64 rounded-none border-0 shadow-none`,icon:(0,X.jsx)(s,{className:`size-5`}),title:i.empty.runs}):(0,X.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:n.map(e=>(0,X.jsxs)(`button`,{type:`button`,className:`flex w-full min-w-0 items-start gap-3 px-4 py-3 text-left hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent sm:px-5`,onClick:()=>d(e.id),children:[(0,X.jsx)(`span`,{className:D(`mt-1.5 size-2 shrink-0 rounded-full`,bt(e)?`bg-blue-500`:xt(e)?`bg-red-500`:`bg-emerald-500`),"aria-hidden":!0}),(0,X.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,X.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.automationName}),e.readAtMs==null&&!bt(e)?(0,X.jsx)(`span`,{className:`size-2 shrink-0 rounded-full bg-blue-500`,children:(0,X.jsx)(`span`,{className:`sr-only`,children:i.filters.unread})}):null]}),(0,X.jsx)(`span`,{className:D(`mt-1 line-clamp-2 block text-sm text-fg-muted`,e.error&&`text-red-700 dark:text-red-300`),children:e.error||e.summary||i.status[e.status]}),(0,X.jsx)(`span`,{className:`mt-1 block text-xs text-fg-subtle`,children:dt(e.createdAtMs,i,a)})]}),(0,X.jsx)(`span`,{className:D(`shrink-0 rounded-full px-2 py-0.5 text-xs`,vt(e.status)),children:i.status[e.status]})]},e.id))}),t[65]=i,t[66]=a,t[67]=d,t[68]=n,t[69]=W):W=t[69];let G;return t[70]!==F||t[71]!==U||t[72]!==W?(G=(0,X.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge-subtle bg-surface-base shadow-surface`,"aria-labelledby":`automation-activity-title`,children:[F,U,W]}),t[70]=F,t[71]=U,t[72]=W,t[73]=G):G=t[73],G}function Rt(e){let t=(0,Ie.c)(20),{automations:n,runs:r,labels:i,cronLabels:a,language:o,selectedAutomationId:s,onOpenDetails:c}=e;if(n.length===0){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(G,{className:`size-5`}),t[0]=e):e=t[0];let n;return t[1]===i.empty.filtered?n=t[2]:(n=(0,X.jsx)(Qt,{className:`rounded-none border-0 shadow-none`,icon:e,title:i.empty.filtered}),t[1]=i.empty.filtered,t[2]=n),n}let l;if(t[3]!==n||t[4]!==a||t[5]!==i||t[6]!==o||t[7]!==c||t[8]!==r||t[9]!==s){let e;t[11]!==a||t[12]!==i||t[13]!==o||t[14]!==c||t[15]!==r||t[16]!==s?(e=e=>{let t=r.filter(t=>t.automationId===e.id).sort(zt),n=t.find(bt),l=t[0];return(0,X.jsxs)(`button`,{type:`button`,className:D(`block w-full p-3 text-left outline-none hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,s===e.id&&`bg-surface-hover`),style:{contentVisibility:`auto`,containIntrinsicSize:`auto 130px`},"aria-current":s===e.id?`true`:void 0,onClick:()=>c(e.id),children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,X.jsx)(`span`,{className:D(`size-2 shrink-0 rounded-full`,n?`bg-blue-500`:ct(e,t)?`bg-red-500`:e.enabled?`bg-emerald-500`:`bg-fg-subtle`)}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm font-medium text-fg`,children:e.name}),(0,X.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:e.enabled?i.enabled:i.paused}),l&&l.readAtMs==null&&!bt(l)?(0,X.jsx)(`span`,{className:`ml-auto size-2 shrink-0 rounded-full bg-blue-500`,children:(0,X.jsx)(`span`,{className:`sr-only`,children:i.filters.unread})}):null]}),(0,X.jsxs)(`div`,{className:`mt-2 flex min-w-0 flex-wrap items-center gap-1.5 pl-4 text-xs`,children:[(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md border border-edge-subtle bg-surface-panel px-1.5 py-0.5 text-fg-muted`,children:[(0,X.jsx)(gt,{kind:e.action.kind,className:`size-3`}),pt(e.action,i)]}),(0,X.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-1 rounded-md bg-surface-panel px-1.5 py-0.5 text-fg-muted`,children:[(0,X.jsx)(ae,{className:`size-3 shrink-0`,"aria-hidden":!0}),(0,X.jsx)(`span`,{className:`truncate`,children:xe(e.trigger,i,a,o)})]})]}),(0,X.jsxs)(`div`,{className:`mt-2 flex min-w-0 items-center justify-between gap-2 pl-4 text-xs text-fg-subtle`,children:[(0,X.jsx)(`span`,{className:D(`line-clamp-2`,l?.error&&`text-red-700 dark:text-red-300`),children:l?l.error||l.summary||i.status[l.status]:e.state.lastError||(e.state.lastRunStatus?i.status[e.state.lastRunStatus]:i.experience.noRuns)}),l?.status?(0,X.jsx)(`span`,{className:D(`shrink-0 rounded-full px-1.5 py-0.5`,vt(l.status)),children:i.status[l.status]}):null]}),(0,X.jsxs)(`div`,{className:`mt-2 space-y-1 pl-4 text-xs text-fg-muted`,children:[l?(0,X.jsxs)(`div`,{children:[i.last,`: `,dt(l.createdAtMs,i,o)]}):null,(0,X.jsx)(`div`,{children:e.enabled?`${i.next}: ${Te(e,i,o)}`:i.paused})]})]},e.id)},t[11]=a,t[12]=i,t[13]=o,t[14]=c,t[15]=r,t[16]=s,t[17]=e):e=t[17],l=n.map(e),t[3]=n,t[4]=a,t[5]=i,t[6]=o,t[7]=c,t[8]=r,t[9]=s,t[10]=l}else l=t[10];let u;return t[18]===l?u=t[19]:(u=(0,X.jsx)(`div`,{className:`min-h-0 overflow-y-auto divide-y divide-edge-subtle`,children:l}),t[18]=l,t[19]=u),u}function zt(e,t){return t.createdAtMs-e.createdAtMs}function Bt(e,t){let n=t.events,r=e.data&&typeof e.data==`object`?e.data:{},i=typeof r.actionKind==`string`?r.actionKind:null,a=typeof r.status==`string`&&r.status in t.status?t.status[r.status]:null;switch(e.type){case`run.queued`:return e.message.toLowerCase().includes(`manual`)?n.manualQueued:e.message.toLowerCase().includes(`scheduled`)?n.scheduledQueued:n.eventQueued;case`run.started`:return n.runStarted;case`action.started`:return i?n.actionStarted.replace(`{kind}`,i):n.actionStartedFallback;case`action.completed`:return i?n.actionCompleted.replace(`{kind}`,i):n.actionCompletedFallback;case`action.failed`:return i?n.actionFailed.replace(`{kind}`,i):n.actionFailedFallback;case`run.completed`:return a?n.runCompleted.replace(`{status}`,a):n.runCompletedFallback;default:return e.message}}function Vt(e){let t=(0,Ie.c)(17),{value:n,labels:r,title:i,defaultExpanded:a}=e,[o,s]=(0,Y.useState)(a===void 0?!1:a),c;t[0]===n?c=t[1]:(c=JSON.stringify(n,null,2),t[0]=n,t[1]=c);let l=c,u;t[2]===l?u=t[3]:(u=l.split(`
2
- `),t[2]=l,t[3]=u);let d=u.length,f=l.length>720||d>18,p;t[4]!==f||t[5]!==l?(p=f?`${l.split(`
3
- `).slice(0,10).join(`
4
- `).trimEnd()}...`:l,t[4]=f,t[5]=l,t[6]=p):p=t[6];let m=p,h;t[7]!==o||t[8]!==f||t[9]!==r||t[10]!==i?(h=f?(0,X.jsxs)(`button`,{type:`button`,className:`flex w-full items-center justify-between gap-3 px-2.5 py-2 text-left text-xs font-medium text-fg-muted hover:bg-surface-hover hover:text-fg`,onClick:()=>s(Ht),"aria-expanded":o,children:[(0,X.jsx)(`span`,{children:i}),(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-accent-fg`,children:[o?r.details.hideDetails:r.details.showDetails,(0,X.jsx)(ue,{className:D(`size-3.5 transition-transform`,o&&`rotate-180`),"aria-hidden":!0})]})]}):(0,X.jsx)(`div`,{className:`px-2.5 py-2 text-xs font-medium text-fg-muted`,children:i}),t[7]=o,t[8]=f,t[9]=r,t[10]=i,t[11]=h):h=t[11];let g=o||!f?l:m,_;t[12]===g?_=t[13]:(_=(0,X.jsx)(`pre`,{className:`whitespace-pre-wrap break-all px-2.5 pb-2 text-xs leading-relaxed text-fg-muted`,children:g}),t[12]=g,t[13]=_);let v;return t[14]!==h||t[15]!==_?(v=(0,X.jsxs)(`div`,{className:`mt-2 rounded-md border border-edge/70 bg-surface-inset/35`,children:[h,_]}),t[14]=h,t[15]=_,t[16]=v):v=t[16],v}function Ht(e){return!e}function Ut(e){let t=(0,Ie.c)(148),{className:n,run:r,events:i,labels:a,cronLabels:c,language:u,loading:d,repairDraft:f,repairLoading:p,repairApproved:m,busyAction:_,onRepairApprovedChange:v,onSuggestRepair:x,onApplyRepair:S}=e;if(!r){let e;t[0]===n?e=t[1]:(e=D(`flex min-h-64 flex-col justify-center rounded-lg border border-edge-subtle bg-surface-base px-4 text-center text-sm text-fg-muted shadow-surface`,n),t[0]=n,t[1]=e);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,X.jsx)(s,{className:`mx-auto size-5`}),t[2]=r):r=t[2];let i;t[3]===a.selectRun?i=t[4]:(i=(0,X.jsx)(`div`,{className:`mt-2`,children:a.selectRun}),t[3]=a.selectRun,t[4]=i);let o;return t[5]!==e||t[6]!==i?(o=(0,X.jsxs)(`aside`,{className:e,children:[r,i]}),t[5]=e,t[6]=i,t[7]=o):o=t[7],o}let ee=r.error||r.summary,C=r.conversationId?`/chat/${encodeURIComponent(r.conversationId)}`:r.workflowRunId?`/workflows?run=${encodeURIComponent(r.workflowRunId)}`:null,w=r.conversationId?a.runDetail.openConversation:a.runDetail.openWorkflow,T=r.conversationId?pe:b,E=bt(r)?s:r.status===`succeeded`?g:h,O;t[8]===n?O=t[9]:(O=D(`rounded-lg border border-edge-subtle bg-surface-base shadow-surface`,n),t[8]=n,t[9]=O);let k;t[10]===r.automationName?k=t[11]:(k=(0,X.jsx)(`div`,{className:`truncate text-sm font-semibold text-fg`,children:r.automationName}),t[10]=r.automationName,t[11]=k);let A;t[12]===r.id?A=t[13]:(A=r.id.slice(0,8),t[12]=r.id,t[13]=A);let j;t[14]===A?j=t[15]:(j=(0,X.jsx)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:A}),t[14]=A,t[15]=j);let M;t[16]!==k||t[17]!==j?(M=(0,X.jsxs)(`div`,{className:`min-w-0`,children:[k,j]}),t[16]=k,t[17]=j,t[18]=M):M=t[18];let N;t[19]===r.status?N=t[20]:(N=D(`shrink-0 rounded-full px-2 py-0.5 text-xs`,vt(r.status)),t[19]=r.status,t[20]=N);let P=a.status[r.status],F;t[21]!==N||t[22]!==P?(F=(0,X.jsx)(`span`,{className:N,children:P}),t[21]=N,t[22]=P,t[23]=F):F=t[23];let L;t[24]!==M||t[25]!==F?(L=(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[M,F]}),t[24]=M,t[25]=F,t[26]=L):L=t[26];let R;t[27]!==a||t[28]!==u||t[29]!==r.createdAtMs?(R=dt(r.createdAtMs,a,u),t[27]=a,t[28]=u,t[29]=r.createdAtMs,t[30]=R):R=t[30];let z;t[31]===R?z=t[32]:(z=(0,X.jsx)(`span`,{children:R}),t[31]=R,t[32]=z);let ne;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,X.jsx)(`span`,{"aria-hidden":!0,children:`·`}),t[33]=ne):ne=t[33];let re=a.details.duration,ie;t[34]!==a||t[35]!==r.durationMs?(ie=yt(r.durationMs,a),t[34]=a,t[35]=r.durationMs,t[36]=ie):ie=t[36];let ae;t[37]!==a.details.duration||t[38]!==ie?(ae=(0,X.jsxs)(`span`,{children:[re,` `,ie]}),t[37]=a.details.duration,t[38]=ie,t[39]=ae):ae=t[39];let oe;t[40]!==z||t[41]!==ae?(oe=(0,X.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-fg-muted`,children:[z,ne,ae]}),t[40]=z,t[41]=ae,t[42]=oe):oe=t[42];let se;t[43]!==a.repair||t[44]!==x||t[45]!==p||t[46]!==r?(se=r.status===`failed`||r.status===`timeout`||r.status===`cancelled`?(0,X.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,X.jsxs)(I,{variant:`secondary`,onClick:()=>x(r),disabled:p,children:[(0,X.jsx)(te,{className:`size-4`}),p?a.repair.generating:a.repair.suggest]})}):null,t[43]=a.repair,t[44]=x,t[45]=p,t[46]=r,t[47]=se):se=t[47];let V;t[48]!==oe||t[49]!==se||t[50]!==L?(V=(0,X.jsxs)(`div`,{className:`border-b border-edge px-4 py-3`,children:[L,oe,se]}),t[48]=oe,t[49]=se,t[50]=L,t[51]=V):V=t[51];let ce;t[52]===r?ce=t[53]:(ce=bt(r)?`text-blue-500`:xt(r)?`text-red-500`:r.status===`succeeded`?`text-emerald-500`:`text-fg-muted`,t[52]=r,t[53]=ce);let H;t[54]===ce?H=t[55]:(H=D(`size-4`,ce),t[54]=ce,t[55]=H);let le;t[56]!==E||t[57]!==H?(le=(0,X.jsx)(E,{className:H}),t[56]=E,t[57]=H,t[58]=le):le=t[58];let de;t[59]!==a.runDetail.resultTitle||t[60]!==le?(de=(0,X.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[le,a.runDetail.resultTitle]}),t[59]=a.runDetail.resultTitle,t[60]=le,t[61]=de):de=t[61];let U;t[62]!==T||t[63]!==w||t[64]!==C?(U=C?(0,X.jsx)(I,{asChild:!0,variant:`secondary`,className:`h-8 rounded-md px-2.5 text-xs`,children:(0,X.jsxs)(o,{to:C,children:[(0,X.jsx)(T,{className:`size-3.5`}),w,(0,X.jsx)(l,{className:`size-3.5`})]})}):null,t[62]=T,t[63]=w,t[64]=C,t[65]=U):U=t[65];let W;t[66]!==de||t[67]!==U?(W=(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[de,U]}),t[66]=de,t[67]=U,t[68]=W):W=t[68];let G=r.error&&`border-red-500/25 bg-red-500/5`,fe;t[69]===G?fe=t[70]:(fe=D(`mt-3 max-h-80 overflow-y-auto rounded-lg border border-edge/70 bg-surface-inset/25 p-3`,G),t[69]=G,t[70]=fe);let me;t[71]!==a.runDetail.noResult||t[72]!==a.runDetail.resultPending||t[73]!==ee||t[74]!==r?(me=ee?r.error?(0,X.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-sm leading-relaxed text-red-700 dark:text-red-300`,children:ee}):(0,X.jsx)(y,{content:ee,compact:!0,className:`text-sm`}):(0,X.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:bt(r)?a.runDetail.resultPending:a.runDetail.noResult}),t[71]=a.runDetail.noResult,t[72]=a.runDetail.resultPending,t[73]=ee,t[74]=r,t[75]=me):me=t[75];let K;t[76]!==fe||t[77]!==me?(K=(0,X.jsx)(`div`,{className:fe,children:me}),t[76]=fe,t[77]=me,t[78]=K):K=t[78];let he;t[79]!==W||t[80]!==K?(he=(0,X.jsxs)(`section`,{className:`border-b border-edge p-4`,children:[W,K]}),t[79]=W,t[80]=K,t[81]=he):he=t[81];let ge;t[82]===a.runDetail.runInfo?ge=t[83]:(ge=(0,X.jsx)(`div`,{className:`text-xs font-semibold uppercase text-fg-muted`,children:a.runDetail.runInfo}),t[82]=a.runDetail.runInfo,t[83]=ge);let _e;t[84]!==c||t[85]!==a||t[86]!==u||t[87]!==r.manual||t[88]!==r.triggerSnapshot?(_e=r.manual?a.trigger.manual:xe(r.triggerSnapshot,a,c,u),t[84]=c,t[85]=a,t[86]=u,t[87]=r.manual,t[88]=r.triggerSnapshot,t[89]=_e):_e=t[89];let ve;t[90]!==a.explain.whyRan||t[91]!==_e?(ve=(0,X.jsx)(Yt,{label:a.explain.whyRan,value:_e}),t[90]=a.explain.whyRan,t[91]=_e,t[92]=ve):ve=t[92];let q=a.details.started,be;t[93]!==a||t[94]!==u||t[95]!==r.startedAtMs?(be=dt(r.startedAtMs,a,u),t[93]=a,t[94]=u,t[95]=r.startedAtMs,t[96]=be):be=t[96];let Se;t[97]!==a.details.started||t[98]!==be?(Se=(0,X.jsx)(Yt,{label:q,value:be}),t[97]=a.details.started,t[98]=be,t[99]=Se):Se=t[99];let Ce;t[100]!==a.details.model||t[101]!==r.model?(Ce=r.model?(0,X.jsx)(Yt,{label:a.details.model,value:r.model}):null,t[100]=a.details.model,t[101]=r.model,t[102]=Ce):Ce=t[102];let we;t[103]!==ve||t[104]!==Se||t[105]!==Ce?(we=(0,X.jsxs)(`div`,{className:`mt-3 grid gap-2 text-xs text-fg-muted`,children:[ve,Se,Ce]}),t[103]=ve,t[104]=Se,t[105]=Ce,t[106]=we):we=t[106];let Te;t[107]!==ge||t[108]!==we?(Te=(0,X.jsxs)(`section`,{className:`border-b border-edge p-4`,children:[ge,we]}),t[107]=ge,t[108]=we,t[109]=Te):Te=t[109];let Ee;t[110]!==_||t[111]!==a||t[112]!==S||t[113]!==v||t[114]!==m||t[115]!==f||t[116]!==r?(Ee=f?(0,X.jsxs)(`div`,{className:`border-b border-edge px-4 py-3`,children:[(0,X.jsx)(`div`,{className:`text-xs font-semibold uppercase text-fg-muted`,children:a.repair.title}),(0,X.jsx)(`div`,{className:`mt-2 text-sm text-fg`,children:f.explanation}),f.expectedEffect?(0,X.jsx)(`div`,{className:`mt-2 text-sm text-fg-muted`,children:f.expectedEffect}):null,(0,X.jsx)(Pt,{title:a.repair.risks,items:f.risks,empty:a.none}),(0,X.jsx)(Vt,{value:f.patch,labels:a,title:a.details.repairPatch}),f.requiresApproval?(0,X.jsxs)(`label`,{className:`mt-3 flex items-start gap-2 text-sm text-fg`,children:[(0,X.jsx)(`input`,{className:`mt-1`,type:`checkbox`,checked:m,onChange:e=>v(e.target.checked)}),(0,X.jsx)(`span`,{children:a.repair.approval})]}):null,(0,X.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,X.jsx)(I,{variant:`primary`,onClick:()=>S(r),disabled:_===`run:${r.id}:repair`||f.requiresApproval&&!m,children:_===`run:${r.id}:repair`?a.feedback.working:a.repair.apply})})]}):null,t[110]=_,t[111]=a,t[112]=S,t[113]=v,t[114]=m,t[115]=f,t[116]=r,t[117]=Ee):Ee=t[117];let De;t[118]===Symbol.for(`react.memo_cache_sentinel`)?(De=(0,X.jsx)(ye,{className:`size-4 shrink-0`}),t[118]=De):De=t[118];let Oe;t[119]===a.runDetail.technicalEvents?Oe=t[120]:(Oe=(0,X.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2 text-sm font-medium text-fg-muted`,children:[De,a.runDetail.technicalEvents]}),t[119]=a.runDetail.technicalEvents,t[120]=Oe);let ke;t[121]!==i.length||t[122]!==a.runDetail.eventCount?(ke=a.runDetail.eventCount.replace(`{count}`,String(i.length)),t[121]=i.length,t[122]=a.runDetail.eventCount,t[123]=ke):ke=t[123];let Ae;t[124]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=(0,X.jsx)(ue,{className:`size-4 transition-transform group-open:rotate-180`}),t[124]=Ae):Ae=t[124];let J;t[125]===ke?J=t[126]:(J=(0,X.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1 text-xs text-fg-muted`,children:[ke,Ae]}),t[125]=ke,t[126]=J);let je;t[127]!==Oe||t[128]!==J?(je=(0,X.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center justify-between gap-3 rounded-md outline-none hover:text-fg focus-visible:ring-2 focus-visible:ring-accent`,children:[Oe,J]}),t[127]=Oe,t[128]=J,t[129]=je):je=t[129];let Me;t[130]===a.runDetail.technicalEventsDescription?Me=t[131]:(Me=(0,X.jsx)(`p`,{className:`mt-2 text-xs leading-relaxed text-fg-muted`,children:a.runDetail.technicalEventsDescription}),t[130]=a.runDetail.technicalEventsDescription,t[131]=Me);let Ne;t[132]!==i||t[133]!==a||t[134]!==u||t[135]!==d?(Ne=(0,X.jsx)(`div`,{className:`mt-4`,children:d?(0,X.jsxs)(`div`,{className:`space-y-3`,"aria-label":a.loading,children:[(0,X.jsx)(B,{className:`h-10 w-full`}),(0,X.jsx)(B,{className:`h-10 w-4/5`}),(0,X.jsx)(B,{className:`h-10 w-11/12`})]}):i.length===0?(0,X.jsx)(`div`,{className:`text-sm text-fg-muted`,children:a.empty.events}):(0,X.jsx)(`ol`,{className:`space-y-3`,children:i.map(e=>(0,X.jsxs)(`li`,{className:`grid grid-cols-[0.75rem_1fr] gap-3`,children:[(0,X.jsx)(`span`,{className:D(`mt-1 size-2 rounded-full`,Xt(e.type))}),(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`div`,{className:`text-sm text-fg`,children:Bt(e,a)}),(0,X.jsxs)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:[dt(e.createdAtMs,a,u),` · `,e.type]}),e.data&&typeof e.data==`object`?(0,X.jsxs)(`details`,{className:`group/event mt-2 rounded-md border border-edge/70 bg-surface-inset/35`,children:[(0,X.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center justify-between gap-2 px-2.5 py-2 text-xs font-medium text-fg-muted outline-none hover:text-fg`,children:[a.details.eventData,(0,X.jsx)(ue,{className:`size-3.5 transition-transform group-open/event:rotate-180`})]}),(0,X.jsx)(`pre`,{className:`max-h-72 overflow-auto whitespace-pre-wrap break-all border-t border-edge/70 px-2.5 py-2 text-xs leading-relaxed text-fg-muted`,children:JSON.stringify(e.data,null,2)})]}):null]})]},e.id))})}),t[132]=i,t[133]=a,t[134]=u,t[135]=d,t[136]=Ne):Ne=t[136];let Pe;t[137]!==je||t[138]!==Me||t[139]!==Ne?(Pe=(0,X.jsxs)(`details`,{className:`group px-4 py-3`,children:[je,Me,Ne]}),t[137]=je,t[138]=Me,t[139]=Ne,t[140]=Pe):Pe=t[140];let Fe;return t[141]!==O||t[142]!==V||t[143]!==he||t[144]!==Te||t[145]!==Ee||t[146]!==Pe?(Fe=(0,X.jsxs)(`aside`,{className:O,children:[V,he,Te,Ee,Pe]}),t[141]=O,t[142]=V,t[143]=he,t[144]=Te,t[145]=Ee,t[146]=Pe,t[147]=Fe):Fe=t[147],Fe}function Wt(e){let t=(0,Ie.c)(146),{automation:n,runs:r,runsLoading:i,runsError:a,labels:o,cronLabels:c,language:l,projects:u,busyAction:d,onEdit:f,onSelectRun:p,onAction:m}=e,h=d===`automation:${n.id}:run`,_=d===`automation:${n.id}:toggle`,C=d===`automation:${n.id}:delete`,w;t[0]===n.management?w=t[1]:(w=!n.management||n.management.editable.includes(`enabled`),t[0]=n.management,t[1]=w);let te=w,T=!n.management||n.management.runnable,E;t[2]===n.management?E=t[3]:(E=!n.management||n.management.editable.includes(`trigger`),t[2]=n.management,t[3]=E);let O=E,k=!n.management||n.management.deletable,A;t[4]===n.name?A=t[5]:(A=(0,X.jsx)(`h2`,{className:`truncate text-lg font-semibold text-fg`,children:n.name}),t[4]=n.name,t[5]=A);let j=n.enabled?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-surface-hover text-fg-muted`,M;t[6]===j?M=t[7]:(M=D(`shrink-0 rounded-full px-2 py-0.5 text-xs`,j),t[6]=j,t[7]=M);let N=n.enabled?o.enabled:o.paused,P;t[8]!==M||t[9]!==N?(P=(0,X.jsx)(`span`,{className:M,children:N}),t[8]=M,t[9]=N,t[10]=P):P=t[10];let F;t[11]!==A||t[12]!==P?(F=(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[A,P]}),t[11]=A,t[12]=P,t[13]=F):F=t[13];let L;t[14]===n?L=t[15]:(L=Ct(n)?(0,X.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:Ct(n)}):null,t[14]=n,t[15]=L);let R;t[16]===n.action.kind?R=t[17]:(R=(0,X.jsx)(gt,{kind:n.action.kind,className:`size-3.5`}),t[16]=n.action.kind,t[17]=R);let z;t[18]!==n.action||t[19]!==o?(z=pt(n.action,o),t[18]=n.action,t[19]=o,t[20]=z):z=t[20];let ne;t[21]!==R||t[22]!==z?(ne=(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-md border border-edge-subtle bg-surface-base px-2 py-1`,children:[R,z]}),t[21]=R,t[22]=z,t[23]=ne):ne=t[23];let re;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,X.jsx)(ae,{className:`size-3.5`,"aria-hidden":!0}),t[24]=re):re=t[24];let V;t[25]!==n.trigger||t[26]!==c||t[27]!==o||t[28]!==l?(V=xe(n.trigger,o,c,l),t[25]=n.trigger,t[26]=c,t[27]=o,t[28]=l,t[29]=V):V=t[29];let H;t[30]===V?H=t[31]:(H=(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-md border border-edge-subtle bg-surface-base px-2 py-1`,children:[re,V]}),t[30]=V,t[31]=H);let ue;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(ue=(0,X.jsx)(b,{className:`size-3.5`,"aria-hidden":!0}),t[32]=ue):ue=t[32];let U;t[33]!==n.projectId||t[34]!==o.info||t[35]!==u?(U=u.find(e=>e.id===n.projectId)?.name??o.info.noProject,t[33]=n.projectId,t[34]=o.info,t[35]=u,t[36]=U):U=t[36];let G;t[37]===U?G=t[38]:(G=(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-md border border-edge-subtle bg-surface-base px-2 py-1`,children:[ue,U]}),t[37]=U,t[38]=G);let fe;t[39]!==ne||t[40]!==H||t[41]!==G?(fe=(0,X.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:[ne,H,G]}),t[39]=ne,t[40]=H,t[41]=G,t[42]=fe):fe=t[42];let pe;t[43]!==fe||t[44]!==F||t[45]!==L?(pe=(0,X.jsxs)(`div`,{className:`min-w-0`,children:[F,L,fe]}),t[43]=fe,t[44]=F,t[45]=L,t[46]=pe):pe=t[46];let me;t[47]!==n||t[48]!==d||t[49]!==k||t[50]!==O||t[51]!==T||t[52]!==te||t[53]!==C||t[54]!==o.dashboard.delete||t[55]!==o.dashboard.deleted||t[56]!==o.dashboard.pause||t[57]!==o.dashboard.resume||t[58]!==o.dashboard.resumed||t[59]!==o.dashboard.runNow||t[60]!==o.details||t[61]!==o.edit||t[62]!==o.experience.deleteConfirm||t[63]!==o.feedback||t[64]!==m||t[65]!==f||t[66]!==h||t[67]!==_?(me=te||T||O||k?(0,X.jsxs)(`div`,{className:`flex w-full flex-wrap items-center gap-2`,children:[te?(0,X.jsxs)(I,{variant:`secondary`,disabled:d!==null,onClick:()=>void m(`automation:${n.id}:toggle`,()=>n.enabled?K.pause(n.id):K.resume(n.id),n.enabled?o.feedback.paused:o.dashboard.resumed),children:[_?(0,X.jsx)(de,{className:`size-4 animate-spin`}):n.enabled?(0,X.jsx)(x,{className:`size-4`}):(0,X.jsx)(ee,{className:`size-4`}),n.enabled?o.dashboard.pause:o.dashboard.resume]}):null,T?(0,X.jsxs)(I,{variant:`primary`,disabled:d!==null,onClick:()=>void m(`automation:${n.id}:run`,()=>K.runNow(n.id),o.feedback.rerunQueued),children:[h?(0,X.jsx)(de,{className:`size-4 animate-spin`}):(0,X.jsx)(ee,{className:`size-4`}),o.dashboard.runNow]}):null,O||k?(0,X.jsxs)(le,{children:[(0,X.jsx)(ie,{asChild:!0,children:(0,X.jsx)(I,{variant:`ghost`,className:`size-9 p-0`,"aria-label":o.details.moreActions,children:(0,X.jsx)(v,{className:`size-4`})})}),(0,X.jsx)(ce,{children:(0,X.jsxs)(oe,{align:`end`,className:`z-70 min-w-40 rounded-lg border border-edge bg-surface-panel p-1 shadow-popover`,children:[O?(0,X.jsxs)(se,{className:`flex cursor-pointer items-center gap-2 rounded-md px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover`,onSelect:()=>f(n),children:[(0,X.jsx)(S,{className:`size-4`}),o.edit]}):null,k?(0,X.jsxs)(se,{className:`flex cursor-pointer items-center gap-2 rounded-md px-3 py-2 text-sm text-red-700 outline-none hover:bg-red-500/10 dark:text-red-300`,disabled:d!==null,onSelect:()=>{window.confirm(o.experience.deleteConfirm)&&m(`automation:${n.id}:delete`,()=>K.remove(n.id),o.dashboard.deleted)},children:[C?(0,X.jsx)(de,{className:`size-4 animate-spin`}):(0,X.jsx)(W,{className:`size-4`}),o.dashboard.delete]}):null]})})]}):null]}):null,t[47]=n,t[48]=d,t[49]=k,t[50]=O,t[51]=T,t[52]=te,t[53]=C,t[54]=o.dashboard.delete,t[55]=o.dashboard.deleted,t[56]=o.dashboard.pause,t[57]=o.dashboard.resume,t[58]=o.dashboard.resumed,t[59]=o.dashboard.runNow,t[60]=o.details,t[61]=o.edit,t[62]=o.experience.deleteConfirm,t[63]=o.feedback,t[64]=m,t[65]=f,t[66]=h,t[67]=_,t[68]=me):me=t[68];let he;t[69]!==pe||t[70]!==me?(he=(0,X.jsxs)(`header`,{className:`flex flex-col items-start gap-3 border-b border-edge px-5 py-4`,children:[pe,me]}),t[69]=pe,t[70]=me,t[71]=he):he=t[71];let ge;t[72]===o.dashboard.latestResult?ge=t[73]:(ge=(0,X.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:o.dashboard.latestResult}),t[72]=o.dashboard.latestResult,t[73]=ge);let _e;t[74]!==o.experience.viewResult||t[75]!==p||t[76]!==r[0]?(_e=r[0]?(0,X.jsx)(I,{variant:`secondary`,onClick:()=>p(r[0].id),children:o.experience.viewResult}):null,t[74]=o.experience.viewResult,t[75]=p,t[76]=r[0],t[77]=_e):_e=t[77];let ve;t[78]!==ge||t[79]!==_e?(ve=(0,X.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center justify-between gap-2`,children:[ge,_e]}),t[78]=ge,t[79]=_e,t[80]=ve):ve=t[80];let ye;t[81]!==o||t[82]!==l||t[83]!==r[0]||t[84]!==a||t[85]!==i?(ye=a?(0,X.jsx)(`p`,{role:`alert`,className:`text-sm text-red-700 dark:text-red-300`,children:a}):i?(0,X.jsx)(B,{className:`h-28 w-full`}):r[0]?(0,X.jsxs)(`div`,{className:`space-y-3 rounded-lg border border-edge-subtle bg-surface-base p-4`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:[(0,X.jsx)(`span`,{className:D(`rounded-full px-2 py-0.5`,vt(r[0].status)),children:o.status[r[0].status]}),dt(r[0].createdAtMs,o,l)]}),(0,X.jsx)(y,{content:r[0].error||r[0].summary||(bt(r[0])?o.runDetail.resultPending:o.runDetail.noResult),compact:!0})]}):(0,X.jsx)(`p`,{className:`text-sm text-fg-muted`,children:o.experience.noRuns}),t[81]=o,t[82]=l,t[83]=r[0],t[84]=a,t[85]=i,t[86]=ye):ye=t[86];let q;t[87]!==n||t[88]!==o||t[89]!==l?(q=n.enabled?`${o.next}: ${Te(n,o,l)}`:o.paused,t[87]=n,t[88]=o,t[89]=l,t[90]=q):q=t[90];let be;t[91]===q?be=t[92]:(be=(0,X.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:q}),t[91]=q,t[92]=be);let Se;t[93]!==ve||t[94]!==ye||t[95]!==be?(Se=(0,X.jsxs)(`section`,{children:[ve,ye,be]}),t[93]=ve,t[94]=ye,t[95]=be,t[96]=Se):Se=t[96];let Ce;t[97]===o.dashboard.runHistory?Ce=t[98]:(Ce=(0,X.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:o.dashboard.runHistory}),t[97]=o.dashboard.runHistory,t[98]=Ce);let we;t[99]===o.dashboard.runHistoryDescription?we=t[100]:(we=(0,X.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:o.dashboard.runHistoryDescription}),t[99]=o.dashboard.runHistoryDescription,t[100]=we);let Ee;t[101]!==Ce||t[102]!==we?(Ee=(0,X.jsxs)(`div`,{children:[Ce,we]}),t[101]=Ce,t[102]=we,t[103]=Ee):Ee=t[103];let De;t[104]===r.length?De=t[105]:(De=(0,X.jsx)(`span`,{className:`rounded-full bg-surface-base px-2.5 py-1 text-xs text-fg-muted`,children:r.length}),t[104]=r.length,t[105]=De);let Oe;t[106]!==Ee||t[107]!==De?(Oe=(0,X.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[Ee,De]}),t[106]=Ee,t[107]=De,t[108]=Oe):Oe=t[108];let ke;t[109]!==o||t[110]!==l||t[111]!==p||t[112]!==r||t[113]!==i?(ke=i?(0,X.jsx)(B,{className:`h-24 w-full`}):r.length===0?(0,X.jsx)(Qt,{className:`min-h-24 py-6`,icon:(0,X.jsx)(s,{className:`size-5`}),title:o.empty.runs}):(0,X.jsx)(`div`,{className:`divide-y divide-edge-subtle overflow-hidden rounded-xl border border-edge-subtle bg-surface-base`,children:r.slice(0,8).map(e=>(0,X.jsxs)(`button`,{type:`button`,className:`block w-full p-3 text-left hover:bg-surface-hover`,onClick:()=>p(e.id),children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[e.status===`succeeded`?(0,X.jsx)(g,{className:`size-4 shrink-0 text-emerald-600 dark:text-emerald-300`}):(0,X.jsx)(s,{className:`size-4 shrink-0 text-fg-muted`}),(0,X.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:dt(e.createdAtMs,o,l)})]}),(0,X.jsx)(`span`,{className:D(`shrink-0 rounded-full px-2 py-0.5 text-xs`,vt(e.status)),children:o.status[e.status]})]}),(0,X.jsx)(`p`,{className:D(`mt-1 line-clamp-2 pl-6 text-sm text-fg-muted`,e.error&&`text-red-700 dark:text-red-300`),children:e.error||e.summary||ft(e.actionSnapshot,o)})]},e.id))}),t[109]=o,t[110]=l,t[111]=p,t[112]=r,t[113]=i,t[114]=ke):ke=t[114];let Ae;t[115]!==Oe||t[116]!==ke?(Ae=(0,X.jsxs)(`section`,{className:`min-w-0`,children:[Oe,ke]}),t[115]=Oe,t[116]=ke,t[117]=Ae):Ae=t[117];let J;t[118]===o.experience.settings?J=t[119]:(J=(0,X.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:o.experience.settings}),t[118]=o.experience.settings,t[119]=J);let je;t[120]!==n||t[121]!==o?(je=St(n,o),t[120]=n,t[121]=o,t[122]=je):je=t[122];let Me;t[123]===je?Me=t[124]:(Me=(0,X.jsx)(y,{content:je,compact:!0}),t[123]=je,t[124]=Me);let Ne;t[125]!==n||t[126]!==c||t[127]!==o||t[128]!==l||t[129]!==u?(Ne=(0,X.jsx)(Kt,{automation:n,labels:o,cronLabels:c,language:l,projects:u}),t[125]=n,t[126]=c,t[127]=o,t[128]=l,t[129]=u,t[130]=Ne):Ne=t[130];let Pe;t[131]!==Me||t[132]!==Ne?(Pe=(0,X.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[Me,Ne]}),t[131]=Me,t[132]=Ne,t[133]=Pe):Pe=t[133];let Fe;t[134]!==J||t[135]!==Pe?(Fe=(0,X.jsxs)(`details`,{className:`rounded-lg border border-edge-subtle p-4`,children:[J,Pe]}),t[134]=J,t[135]=Pe,t[136]=Fe):Fe=t[136];let Y;t[137]!==Ae||t[138]!==Fe?(Y=(0,X.jsxs)(`div`,{className:`grid gap-5`,children:[Ae,Fe]}),t[137]=Ae,t[138]=Fe,t[139]=Y):Y=t[139];let Le;t[140]!==Se||t[141]!==Y?(Le=(0,X.jsxs)(`div`,{className:`grid gap-5 p-5`,children:[Se,Y]}),t[140]=Se,t[141]=Y,t[142]=Le):Le=t[142];let Re;return t[143]!==he||t[144]!==Le?(Re=(0,X.jsxs)(`article`,{className:`min-w-0 overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel shadow-surface`,children:[he,Le]}),t[143]=he,t[144]=Le,t[145]=Re):Re=t[145],Re}function Gt(e,t){return e===`suggest_only`?t.safety.suggestOnlyDescription:e===`ask_before_apply`?t.safety.askBeforeApplyDescription:t.safety.autoApplyDescription}function Kt(e){let t=(0,Ie.c)(146),{automation:n,labels:r,cronLabels:i,language:a,projects:o}=e,c,l,u,d,f,p,m,_,v,y,x;if(t[0]!==n||t[1]!==i||t[2]!==r||t[3]!==a){let e=_t(n),o;t[15]!==n||t[16]!==r||t[17]!==a?(o=Te(n,r,a),t[15]=n,t[16]=r,t[17]=a,t[18]=o):o=t[18];let s=o,h;t[19]!==n.state.nextRunAtMs||t[20]!==a?(h=n.state.nextRunAtMs?we(n.state.nextRunAtMs,a):void 0,t[19]=n.state.nextRunAtMs,t[20]=a,t[21]=h):h=t[21];let S=h;if(t[22]!==n.trigger.eventType||t[23]!==n.trigger.kind||t[24]!==n.trigger.schedule||t[25]!==n.trigger.secretId||t[26]!==n.trigger.source||t[27]!==r.info.anchor||t[28]!==r.info.calendarSchedule||t[29]!==r.info.eventSource||t[30]!==r.info.eventType||t[31]!==r.info.expression||t[32]!==r.info.fixedInterval||t[33]!==r.info.oneTimeSchedule||t[34]!==r.info.rawInterval||t[35]!==r.info.scheduleType||t[36]!==r.info.timezone||t[37]!==r.info.webhookSecret||t[38]!==a){if(x=[],n.trigger.kind===`schedule`){let e=n.trigger.schedule,i=e.kind===`interval`?r.info.fixedInterval:e.kind===`cron`?r.info.calendarSchedule:r.info.oneTimeSchedule,o;if(t[40]!==r.info.scheduleType||t[41]!==i?(o={label:r.info.scheduleType,value:i},t[40]=r.info.scheduleType,t[41]=i,t[42]=o):o=t[42],x.push(o),e.kind===`interval`){let n=`${e.everyMs} ms`,i;if(t[43]!==r.info.rawInterval||t[44]!==n?(i={label:r.info.rawInterval,value:n},t[43]=r.info.rawInterval,t[44]=n,t[45]=i):i=t[45],x.push(i),e.anchorMs){let n=r.info.anchor,i;t[46]!==a||t[47]!==e.anchorMs?(i=we(e.anchorMs,a),t[46]=a,t[47]=e.anchorMs,t[48]=i):i=t[48];let o;t[49]!==r.info.anchor||t[50]!==i?(o={label:n,value:i},t[49]=r.info.anchor,t[50]=i,t[51]=o):o=t[51],x.push(o)}}else if(e.kind===`cron`){let n;if(t[52]!==r.info.expression||t[53]!==e.expr?(n={label:r.info.expression,value:e.expr},t[52]=r.info.expression,t[53]=e.expr,t[54]=n):n=t[54],x.push(n),e.tz){let n;t[55]!==r.info.timezone||t[56]!==e.tz?(n={label:r.info.timezone,value:e.tz},t[55]=r.info.timezone,t[56]=e.tz,t[57]=n):n=t[57],x.push(n)}}else{let n;t[58]!==r.info.oneTimeSchedule||t[59]!==e.at?(n={label:r.info.oneTimeSchedule,value:e.at},t[58]=r.info.oneTimeSchedule,t[59]=e.at,t[60]=n):n=t[60],x.push(n)}}else if(n.trigger.kind===`event`){let e;if(t[61]!==n.trigger.eventType||t[62]!==r.info.eventType?(e={label:r.info.eventType,value:n.trigger.eventType},t[61]=n.trigger.eventType,t[62]=r.info.eventType,t[63]=e):e=t[63],x.push(e),n.trigger.source){let e;t[64]!==n.trigger.source||t[65]!==r.info.eventSource?(e={label:r.info.eventSource,value:n.trigger.source},t[64]=n.trigger.source,t[65]=r.info.eventSource,t[66]=e):e=t[66],x.push(e)}}else if(n.trigger.kind===`webhook`&&n.trigger.secretId){let e;t[67]!==n.trigger.secretId||t[68]!==r.info.webhookSecret?(e={label:r.info.webhookSecret,value:n.trigger.secretId},t[67]=n.trigger.secretId,t[68]=r.info.webhookSecret,t[69]=e):e=t[69],x.push(e)}t[22]=n.trigger.eventType,t[23]=n.trigger.kind,t[24]=n.trigger.schedule,t[25]=n.trigger.secretId,t[26]=n.trigger.source,t[27]=r.info.anchor,t[28]=r.info.calendarSchedule,t[29]=r.info.eventSource,t[30]=r.info.eventType,t[31]=r.info.expression,t[32]=r.info.fixedInterval,t[33]=r.info.oneTimeSchedule,t[34]=r.info.rawInterval,t[35]=r.info.scheduleType,t[36]=r.info.timezone,t[37]=r.info.webhookSecret,t[38]=a,t[39]=x}else x=t[39];v=`h-fit overflow-hidden rounded-xl border border-edge-subtle bg-surface-base shadow-surface`,t[70]===r.info.overview?y=t[71]:(y=(0,X.jsx)(`div`,{className:`border-b border-edge-subtle px-4 py-3`,children:(0,X.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:r.info.overview})}),t[70]=r.info.overview,t[71]=y),p=`grid gap-4 p-4`;let ee;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,X.jsx)(ae,{className:`size-4`,"aria-hidden":!0}),t[72]=ee):ee=t[72];let C=r.info.schedule,w;t[73]!==n.trigger||t[74]!==i||t[75]!==r||t[76]!==a?(w=xe(n.trigger,r,i,a),t[73]=n.trigger,t[74]=i,t[75]=r,t[76]=a,t[77]=w):w=t[77];let te=n.enabled?`${r.info.nextRun}:${s}`:s;t[78]!==r.info.schedule||t[79]!==S||t[80]!==w||t[81]!==te?(m=(0,X.jsx)(Jt,{icon:ee,label:C,value:w,description:te,descriptionTitle:S}),t[78]=r.info.schedule,t[79]=S,t[80]=w,t[81]=te,t[82]=m):m=t[82];let T;t[83]===n.action.kind?T=t[84]:(T=n.action.kind===`workflow`?(0,X.jsx)(b,{className:`size-4`,"aria-hidden":!0}):n.action.kind===`browser_automation`?(0,X.jsx)(ye,{className:`size-4`,"aria-hidden":!0}):n.action.kind===`task_command`?(0,X.jsx)(g,{className:`size-4`,"aria-hidden":!0}):(0,X.jsx)(G,{className:`size-4`,"aria-hidden":!0}),t[83]=n.action.kind,t[84]=T);let E=r.info.action,D;t[85]!==n.action||t[86]!==r?(D=ft(n.action,r),t[85]=n.action,t[86]=r,t[87]=D):D=t[87],t[88]!==r.info.action||t[89]!==T||t[90]!==D?(_=(0,X.jsx)(Jt,{icon:T,label:E,value:D}),t[88]=r.info.action,t[89]=T,t[90]=D,t[91]=_):_=t[91],c=Jt,t[92]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,X.jsx)(V,{className:`size-4`,"aria-hidden":!0}),t[92]=l):l=t[92],u=r.info.permission,d=r.safety[e],f=Gt(e,r),t[0]=n,t[1]=i,t[2]=r,t[3]=a,t[4]=c,t[5]=l,t[6]=u,t[7]=d,t[8]=f,t[9]=p,t[10]=m,t[11]=_,t[12]=v,t[13]=y,t[14]=x}else c=t[4],l=t[5],u=t[6],d=t[7],f=t[8],p=t[9],m=t[10],_=t[11],v=t[12],y=t[13],x=t[14];let S;t[93]!==c||t[94]!==l||t[95]!==u||t[96]!==d||t[97]!==f?(S=(0,X.jsx)(c,{icon:l,label:u,value:d,description:f}),t[93]=c,t[94]=l,t[95]=u,t[96]=d,t[97]=f,t[98]=S):S=t[98];let ee;t[99]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,X.jsx)(b,{className:`size-4`,"aria-hidden":!0}),t[99]=ee):ee=t[99];let C;t[100]!==n.projectId||t[101]!==r.info.noProject||t[102]!==o?(C=o.find(e=>e.id===n.projectId)?.name??r.info.noProject,t[100]=n.projectId,t[101]=r.info.noProject,t[102]=o,t[103]=C):C=t[103];let w;t[104]!==r.info.project||t[105]!==C?(w=(0,X.jsx)(Jt,{icon:ee,label:r.info.project,value:C}),t[104]=r.info.project,t[105]=C,t[106]=w):w=t[106];let te;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,X.jsx)(pe,{className:`size-4`,"aria-hidden":!0}),t[107]=te):te=t[107];let T=n.conversationMode===`continuous`?r.info.continuousConversation:r.info.newConversation,E;t[108]!==r.info.conversation||t[109]!==T?(E=(0,X.jsx)(Jt,{icon:te,label:r.info.conversation,value:T}),t[108]=r.info.conversation,t[109]=T,t[110]=E):E=t[110];let D;t[111]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,X.jsx)(h,{className:`size-4`,"aria-hidden":!0}),t[111]=D):D=t[111];let O=n.delivery.notificationPolicy===`all`?r.info.notifyAll:n.delivery.notificationPolicy===`none`?r.info.notifyNone:r.info.notifyAttention,k;t[112]!==r.info.notifications||t[113]!==O?(k=(0,X.jsx)(Jt,{icon:D,label:r.info.notifications,value:O}),t[112]=r.info.notifications,t[113]=O,t[114]=k):k=t[114];let A;t[115]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,X.jsx)(s,{className:`size-4`,"aria-hidden":!0}),t[115]=A):A=t[115];let j=r.info.lastRun,M;t[116]!==n||t[117]!==r||t[118]!==a?(M=Ce(n,r,a),t[116]=n,t[117]=r,t[118]=a,t[119]=M):M=t[119];let N=n.state.lastRunStatus===`failed`||n.state.lastRunStatus===`timeout`?`danger`:`default`,P;t[120]!==r.info.lastRun||t[121]!==M||t[122]!==N?(P=(0,X.jsx)(Jt,{icon:A,label:j,value:M,valueTone:N}),t[120]=r.info.lastRun,t[121]=M,t[122]=N,t[123]=P):P=t[123];let F;t[124]!==n.state.consecutiveFailures||t[125]!==n.state.lastError||t[126]!==r.dashboard?(F=n.state.consecutiveFailures?(0,X.jsxs)(`div`,{className:`rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:[r.dashboard.failures,`:`,n.state.consecutiveFailures,n.state.lastError?(0,X.jsx)(`p`,{className:`mt-1 break-words text-xs`,children:n.state.lastError}):null]}):n.state.lastError?(0,X.jsx)(`p`,{className:`break-words text-sm text-red-700 dark:text-red-300`,children:n.state.lastError}):null,t[124]=n.state.consecutiveFailures,t[125]=n.state.lastError,t[126]=r.dashboard,t[127]=F):F=t[127];let I;t[128]!==r.info.technicalDetails||t[129]!==x?(I=x.length>0?(0,X.jsxs)(`details`,{className:`group border-t border-edge-subtle pt-3`,children:[(0,X.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center justify-between gap-2 text-sm text-fg-muted outline-none hover:text-fg focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,X.jsx)(`span`,{children:r.info.technicalDetails}),(0,X.jsx)(ue,{className:`size-4 transition-transform group-open:rotate-180`,"aria-hidden":!0})]}),(0,X.jsx)(`div`,{className:`mt-3 grid gap-2`,children:x.map(qt)})]}):null,t[128]=r.info.technicalDetails,t[129]=x,t[130]=I):I=t[130];let L;t[131]!==S||t[132]!==w||t[133]!==E||t[134]!==k||t[135]!==P||t[136]!==F||t[137]!==I||t[138]!==p||t[139]!==m||t[140]!==_?(L=(0,X.jsxs)(`div`,{className:p,children:[m,_,S,w,E,k,P,F,I]}),t[131]=S,t[132]=w,t[133]=E,t[134]=k,t[135]=P,t[136]=F,t[137]=I,t[138]=p,t[139]=m,t[140]=_,t[141]=L):L=t[141];let R;return t[142]!==L||t[143]!==v||t[144]!==y?(R=(0,X.jsxs)(`aside`,{className:v,children:[y,L]}),t[142]=L,t[143]=v,t[144]=y,t[145]=R):R=t[145],R}function qt(e){return(0,X.jsxs)(`div`,{className:`grid gap-0.5`,children:[(0,X.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:e.label}),(0,X.jsx)(`span`,{className:`break-all font-mono text-xs text-fg-muted`,children:e.value})]},`${e.label}:${e.value}`)}function Jt(e){let t=(0,Ie.c)(19),{icon:n,label:r,value:i,description:a,descriptionTitle:o,valueTone:s}=e,c=s===void 0?`default`:s,l;t[0]===n?l=t[1]:(l=(0,X.jsx)(`span`,{className:`mt-0.5 text-fg-subtle`,children:n}),t[0]=n,t[1]=l);let u;t[2]===r?u=t[3]:(u=(0,X.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:r}),t[2]=r,t[3]=u);let d=c===`danger`?`text-red-700 dark:text-red-300`:`text-fg`,f;t[4]===d?f=t[5]:(f=D(`mt-1 text-sm font-medium leading-5`,d),t[4]=d,t[5]=f);let p;t[6]!==f||t[7]!==i?(p=(0,X.jsx)(`div`,{className:f,children:i}),t[6]=f,t[7]=i,t[8]=p):p=t[8];let m;t[9]!==a||t[10]!==o?(m=a?(0,X.jsx)(`div`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,title:o,children:a}):null,t[9]=a,t[10]=o,t[11]=m):m=t[11];let h;t[12]!==u||t[13]!==p||t[14]!==m?(h=(0,X.jsxs)(`div`,{className:`min-w-0`,children:[u,p,m]}),t[12]=u,t[13]=p,t[14]=m,t[15]=h):h=t[15];let g;return t[16]!==l||t[17]!==h?(g=(0,X.jsxs)(`div`,{className:`grid grid-cols-[1.25rem_1fr] gap-2.5`,children:[l,h]}),t[16]=l,t[17]=h,t[18]=g):g=t[18],g}function Yt(e){let t=(0,Ie.c)(7),{label:n,value:r}=e,i;t[0]===n?i=t[1]:(i=(0,X.jsx)(`span`,{children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=(0,X.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:r}),t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,X.jsxs)(`div`,{className:`grid grid-cols-[5rem_1fr] gap-2`,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function Xt(e){return e.endsWith(`.failed`)?`bg-red-500`:e.endsWith(`.completed`)?`bg-emerald-500`:e.endsWith(`.started`)?`bg-blue-500`:`bg-fg-muted`}function Zt(e){let t=(0,Ie.c)(7),{label:n,value:r}=e,i;t[0]===n?i=t[1]:(i=(0,X.jsx)(`div`,{className:`text-xs font-medium uppercase text-fg-muted`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=(0,X.jsx)(`div`,{className:`mt-1 truncate text-sm text-fg`,children:r}),t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,X.jsxs)(`div`,{className:`min-w-0`,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function Qt(e){let t=(0,Ie.c)(8),{className:n,icon:r,title:i}=e,a;t[0]===n?a=t[1]:(a=D(`flex min-h-48 flex-col items-center justify-center text-fg-muted`,n),t[0]=n,t[1]=a);let o;t[2]===i?o=t[3]:(o=(0,X.jsx)(`div`,{className:`mt-2 text-sm`,children:i}),t[2]=i,t[3]=o);let s;return t[4]!==r||t[5]!==a||t[6]!==o?(s=(0,X.jsxs)(`div`,{className:a,children:[r,o]}),t[4]=r,t[5]=a,t[6]=o,t[7]=s):s=t[7],s}function $t(e){let t=(0,Ie.c)(349),{form:n,labels:r,setForm:i,projects:a,workflowDefinitions:o,selectedWorkflow:s,workflowsLoading:c,browserAutomations:u,selectedBrowserAutomation:d,browserAutomationsLoading:m,agentOptions:h,agentsLoading:g,defaultAgentId:_,taskOptions:v,tasksLoading:y,language:b,projectLocked:x}=e,S=x===void 0?!1:x,ee=E(b).agentsSettings,C;t[0]===i?C=t[1]:(C=e=>i(t=>({...t,...e})),t[0]=i,t[1]=C);let w=C,te=De(n.intervalValue,n.intervalUnit),T=Date.now(),O;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(O=[1,2,3],t[2]=O):O=t[2];let k;t[3]!==te||t[4]!==T||t[5]!==b?(k=O.map(e=>Se(T+te*e,b,T)),t[3]=te,t[4]=T,t[5]=b,t[6]=k):k=t[6];let A=k,j;if(t[7]!==n.projectId||t[8]!==n.taskId||t[9]!==v){let e;t[11]!==n.projectId||t[12]!==n.taskId?(e=e=>e.id===n.taskId||e.phase!==`closed`&&(!n.projectId||e.projectId===n.projectId),t[11]=n.projectId,t[12]=n.taskId,t[13]=e):e=t[13],j=v.filter(e),t[7]=n.projectId,t[8]=n.taskId,t[9]=v,t[10]=j}else j=t[10];let M=j,N,P;t[14]!==_||t[15]!==n.actionMode||t[16]!==n.agentId||t[17]!==i?(N=()=>{n.actionMode!==`task_command`||n.agentId.trim()||!_||i(e=>({...e,agentId:_}))},P=[_,n.actionMode,n.agentId,i],t[14]=_,t[15]=n.actionMode,t[16]=n.agentId,t[17]=i,t[18]=N,t[19]=P):(N=t[18],P=t[19]),(0,Y.useEffect)(N,P);let F,I;t[20]!==n.actionMode||t[21]!==n.workflowId||t[22]!==i||t[23]!==o?(F=()=>{if(n.actionMode!==`workflow`||n.workflowId.trim())return;let e=o[0]?.id;e&&i(t=>({...t,workflowId:e,workflowGoal:``,workflowInput:{goal:``,argValues:{},schemaInput:{},concurrency:``,maxSubagents:``},workflowInputValid:!0}))},I=[n.actionMode,n.workflowId,i,o],t[20]=n.actionMode,t[21]=n.workflowId,t[22]=i,t[23]=o,t[24]=F,t[25]=I):(F=t[24],I=t[25]),(0,Y.useEffect)(F,I);let L,R;t[26]!==u||t[27]!==n.actionMode||t[28]!==n.browserAutomationId||t[29]!==i?(L=()=>{if(n.actionMode!==`browser_automation`||n.browserAutomationId.trim())return;let e=u[0];e&&i(t=>({...t,browserAutomationId:e.id,browserAutomationInputs:Pe(e)}))},R=[u,n.actionMode,n.browserAutomationId,i],t[26]=u,t[27]=n.actionMode,t[28]=n.browserAutomationId,t[29]=i,t[30]=L,t[31]=R):(L=t[30],R=t[31]),(0,Y.useEffect)(L,R);let z;t[32]===w?z=t[33]:(z=e=>w({name:e.target.value}),t[32]=w,t[33]=z);let ne;t[34]!==n.name||t[35]!==z?(ne=(0,X.jsx)(`input`,{className:Q,value:n.name,onChange:z}),t[34]=n.name,t[35]=z,t[36]=ne):ne=t[36];let re;t[37]!==r.form.name||t[38]!==ne?(re=(0,X.jsx)($,{label:r.form.name,children:ne}),t[37]=r.form.name,t[38]=ne,t[39]=re):re=t[39];let B;t[40]===w?B=t[41]:(B=e=>w({description:e.target.value}),t[40]=w,t[41]=B);let ie;t[42]!==n.description||t[43]!==B?(ie=(0,X.jsx)(`input`,{className:Q,value:n.description,onChange:B}),t[42]=n.description,t[43]=B,t[44]=ie):ie=t[44];let ae;t[45]!==r.form.description||t[46]!==ie?(ae=(0,X.jsx)($,{label:r.form.description,children:ie}),t[45]=r.form.description,t[46]=ie,t[47]=ae):ae=t[47];let oe;t[48]!==n.projectId||t[49]!==r.form.noProject||t[50]!==r.form.project||t[51]!==S||t[52]!==a||t[53]!==w?(oe=S?null:(0,X.jsx)($,{label:r.form.project,children:(0,X.jsxs)(f,{className:Q,value:n.projectId,onChange:e=>w({projectId:e.target.value}),children:[(0,X.jsx)(p,{value:``,children:r.form.noProject}),a.map(nn)]})}),t[48]=n.projectId,t[49]=r.form.noProject,t[50]=r.form.project,t[51]=S,t[52]=a,t[53]=w,t[54]=oe):oe=t[54];let se=r.form.rulePreview,V;t[55]===r.form.rulePreview?V=t[56]:(V=(0,X.jsx)(`div`,{className:`text-xs font-medium text-accent-fg`,children:r.form.rulePreview}),t[55]=r.form.rulePreview,t[56]=V);let ce;t[57]!==n.triggerMode||t[58]!==r?(ce=ht(n.triggerMode,r),t[57]=n.triggerMode,t[58]=r,t[59]=ce):ce=t[59];let H;t[60]===ce?H=t[61]:(H=(0,X.jsx)(`span`,{children:ce}),t[60]=ce,t[61]=H);let le;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,X.jsx)(l,{className:`size-4 text-fg-subtle`,"aria-hidden":!0}),t[62]=le):le=t[62];let de;t[63]!==n.actionMode||t[64]!==r?(de=mt(n.actionMode,r),t[63]=n.actionMode,t[64]=r,t[65]=de):de=t[65];let W;t[66]===de?W=t[67]:(W=(0,X.jsx)(`span`,{children:de}),t[66]=de,t[67]=W);let G;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,X.jsx)(l,{className:`size-4 text-fg-subtle`,"aria-hidden":!0}),t[68]=G):G=t[68];let pe;t[69]!==n.projectId||t[70]!==r.form.noProject||t[71]!==r.form.project||t[72]!==a?(pe=n.projectId?a.find(e=>e.id===n.projectId)?.name??r.form.project:r.form.noProject,t[69]=n.projectId,t[70]=r.form.noProject,t[71]=r.form.project,t[72]=a,t[73]=pe):pe=t[73];let me;t[74]===pe?me=t[75]:(me=(0,X.jsx)(`span`,{children:pe}),t[74]=pe,t[75]=me);let K;t[76]!==H||t[77]!==W||t[78]!==me?(K=(0,X.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-2 text-sm text-fg`,children:[H,le,W,G,me]}),t[76]=H,t[77]=W,t[78]=me,t[79]=K):K=t[79];let he;t[80]!==r.form.rulePreview||t[81]!==V||t[82]!==K?(he=(0,X.jsxs)(`div`,{className:`rounded-xl border border-accent/20 bg-accent/5 px-4 py-3`,"aria-label":se,children:[V,K]}),t[80]=r.form.rulePreview,t[81]=V,t[82]=K,t[83]=he):he=t[83];let ge;t[84]!==r.form.trigger||t[85]!==r.form.triggerStepDescription?(ge=(0,X.jsx)(rn,{step:`1`,title:r.form.trigger,description:r.form.triggerStepDescription}),t[84]=r.form.trigger,t[85]=r.form.triggerStepDescription,t[86]=ge):ge=t[86];let _e;t[87]===w?_e=t[88]:(_e=e=>w({triggerMode:e.target.value}),t[87]=w,t[88]=_e);let ve;t[89]===r.trigger.manual?ve=t[90]:(ve=(0,X.jsx)(p,{value:`manual`,children:r.trigger.manual}),t[89]=r.trigger.manual,t[90]=ve);let ye;t[91]===r.trigger.once?ye=t[92]:(ye=(0,X.jsx)(p,{value:`once`,children:r.trigger.once}),t[91]=r.trigger.once,t[92]=ye);let xe;t[93]===r.trigger.daily?xe=t[94]:(xe=(0,X.jsx)(p,{value:`daily`,children:r.trigger.daily}),t[93]=r.trigger.daily,t[94]=xe);let Ce;t[95]===r.trigger.weekly?Ce=t[96]:(Ce=(0,X.jsx)(p,{value:`weekly`,children:r.trigger.weekly}),t[95]=r.trigger.weekly,t[96]=Ce);let we;t[97]===r.trigger.interval?we=t[98]:(we=(0,X.jsx)(p,{value:`interval`,children:r.trigger.interval}),t[97]=r.trigger.interval,t[98]=we);let Te;t[99]===r.trigger.customCron?Te=t[100]:(Te=(0,X.jsx)(p,{value:`cron`,children:r.trigger.customCron}),t[99]=r.trigger.customCron,t[100]=Te);let ke;t[101]===r.trigger.webhook?ke=t[102]:(ke=(0,X.jsx)(p,{value:`webhook`,children:r.trigger.webhook}),t[101]=r.trigger.webhook,t[102]=ke);let Ae;t[103]===r.trigger.taskBlocked?Ae=t[104]:(Ae=(0,X.jsx)(p,{value:`taskBlocked`,children:r.trigger.taskBlocked}),t[103]=r.trigger.taskBlocked,t[104]=Ae);let J;t[105]===r.trigger.noteCreated?J=t[106]:(J=(0,X.jsx)(p,{value:`noteCreated`,children:r.trigger.noteCreated}),t[105]=r.trigger.noteCreated,t[106]=J);let Me;t[107]===r.trigger.workflowFailed?Me=t[108]:(Me=(0,X.jsx)(p,{value:`workflowFailed`,children:r.trigger.workflowFailed}),t[107]=r.trigger.workflowFailed,t[108]=Me);let Ne;t[109]===r.trigger.sessionUpdated?Ne=t[110]:(Ne=(0,X.jsx)(p,{value:`sessionUpdated`,children:r.trigger.sessionUpdated}),t[109]=r.trigger.sessionUpdated,t[110]=Ne);let Le;t[111]===r.trigger.customEvent?Le=t[112]:(Le=(0,X.jsx)(p,{value:`event`,children:r.trigger.customEvent}),t[111]=r.trigger.customEvent,t[112]=Le);let Re;t[113]!==n.triggerMode||t[114]!==_e||t[115]!==ve||t[116]!==ye||t[117]!==xe||t[118]!==Ce||t[119]!==we||t[120]!==Te||t[121]!==ke||t[122]!==Ae||t[123]!==J||t[124]!==Me||t[125]!==Ne||t[126]!==Le?(Re=(0,X.jsxs)(f,{className:Q,value:n.triggerMode,onChange:_e,children:[ve,ye,xe,Ce,we,Te,ke,Ae,J,Me,Ne,Le]}),t[113]=n.triggerMode,t[114]=_e,t[115]=ve,t[116]=ye,t[117]=xe,t[118]=Ce,t[119]=we,t[120]=Te,t[121]=ke,t[122]=Ae,t[123]=J,t[124]=Me,t[125]=Ne,t[126]=Le,t[127]=Re):Re=t[127];let ze;t[128]!==n.onceAt||t[129]!==n.triggerMode||t[130]!==r.form.onceAt||t[131]!==w?(ze=n.triggerMode===`once`?(0,X.jsx)($,{label:r.form.onceAt,children:(0,X.jsx)(`input`,{className:Q,type:`datetime-local`,value:n.onceAt,onChange:e=>w({onceAt:e.target.value})})}):null,t[128]=n.onceAt,t[129]=n.triggerMode,t[130]=r.form.onceAt,t[131]=w,t[132]=ze):ze=t[132];let Be;t[133]!==n.time||t[134]!==n.triggerMode||t[135]!==n.weekday||t[136]!==r.form.day||t[137]!==r.form.time||t[138]!==r.weekdays||t[139]!==w?(Be=n.triggerMode===`daily`||n.triggerMode===`weekly`?(0,X.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,X.jsx)($,{label:r.form.time,children:(0,X.jsx)(Ve,{value:n.time,onChange:e=>w({time:e}),ariaLabel:r.form.time})}),n.triggerMode===`weekly`?(0,X.jsx)($,{label:r.form.day,children:(0,X.jsxs)(f,{className:Q,value:n.weekday,onChange:e=>w({weekday:e.target.value}),children:[(0,X.jsx)(p,{value:`1`,children:r.weekdays.monday}),(0,X.jsx)(p,{value:`2`,children:r.weekdays.tuesday}),(0,X.jsx)(p,{value:`3`,children:r.weekdays.wednesday}),(0,X.jsx)(p,{value:`4`,children:r.weekdays.thursday}),(0,X.jsx)(p,{value:`5`,children:r.weekdays.friday}),(0,X.jsx)(p,{value:`6`,children:r.weekdays.saturday}),(0,X.jsx)(p,{value:`0`,children:r.weekdays.sunday})]})}):null]}):null,t[133]=n.time,t[134]=n.triggerMode,t[135]=n.weekday,t[136]=r.form.day,t[137]=r.form.time,t[138]=r.weekdays,t[139]=w,t[140]=Be):Be=t[140];let He=n.triggerMode===`interval`?(0,X.jsxs)(`div`,{className:`grid gap-3 rounded-lg border border-edge-subtle bg-surface-base p-3`,children:[(0,X.jsx)($,{label:r.form.intervalEvery,children:(0,X.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-[minmax(0,1fr)_10rem]`,children:[(0,X.jsx)(`input`,{className:Q,type:`number`,min:6e4/De(1,n.intervalUnit),step:`any`,inputMode:`decimal`,value:n.intervalValue,onChange:e=>w({intervalValue:e.target.value})}),(0,X.jsxs)(f,{className:Q,value:n.intervalUnit,onChange:e=>{let t=e.target.value;w({intervalValue:q(n.intervalValue,n.intervalUnit,t),intervalUnit:t})},children:[(0,X.jsx)(p,{value:`minute`,children:r.form.intervalUnits.minute}),(0,X.jsx)(p,{value:`hour`,children:r.form.intervalUnits.hour}),(0,X.jsx)(p,{value:`day`,children:r.form.intervalUnits.day}),(0,X.jsx)(p,{value:`week`,children:r.form.intervalUnits.week})]})]})}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:r.form.commonIntervals}),(0,X.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:Ke.map(e=>{let t=De(e.value,e.unit),n=t===te;return(0,X.jsx)(`button`,{type:`button`,"aria-pressed":n,className:D(`rounded-full border px-2.5 py-1 text-xs transition-colors`,n?`border-accent bg-accent/10 text-accent`:`border-edge-subtle text-fg-muted hover:border-edge hover:bg-surface-hover hover:text-fg`),onClick:()=>w({intervalValue:e.value,intervalUnit:e.unit}),children:Ee(t,b)},`${e.value}:${e.unit}`)})})]}),(0,X.jsxs)(`div`,{className:`rounded-lg bg-surface-panel px-3 py-2.5`,children:[(0,X.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:be(te,b)}),(0,X.jsxs)(`div`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:[r.form.nextThreeRuns,`:`,A.join(b===`zh`?`、`:`, `)]}),(0,X.jsx)(`div`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:r.form.fixedIntervalHint})]})]}):null,Ue;t[141]!==n.cronExpr||t[142]!==n.triggerMode||t[143]!==r.form.expression||t[144]!==w?(Ue=n.triggerMode===`cron`?(0,X.jsx)($,{label:r.form.expression,children:(0,X.jsx)(`input`,{className:Q,value:n.cronExpr,onChange:e=>w({cronExpr:e.target.value})})}):null,t[141]=n.cronExpr,t[142]=n.triggerMode,t[143]=r.form.expression,t[144]=w,t[145]=Ue):Ue=t[145];let We;t[146]!==n.triggerMode||t[147]!==n.webhookSecretId||t[148]!==r.form.secretId||t[149]!==w?(We=n.triggerMode===`webhook`?(0,X.jsx)($,{label:r.form.secretId,children:(0,X.jsx)(`input`,{className:Q,value:n.webhookSecretId,onChange:e=>w({webhookSecretId:e.target.value})})}):null,t[146]=n.triggerMode,t[147]=n.webhookSecretId,t[148]=r.form.secretId,t[149]=w,t[150]=We):We=t[150];let Ge;t[151]!==n.eventPayloadMatch||t[152]!==n.eventSource||t[153]!==n.eventType||t[154]!==n.triggerMode||t[155]!==r.form.eventPayloadMatch||t[156]!==r.form.eventSource||t[157]!==r.form.eventType||t[158]!==r.form.invalidJsonObject||t[159]!==w?(Ge=n.triggerMode===`event`?(0,X.jsxs)(`div`,{className:`grid gap-3 rounded-lg border border-edge-subtle bg-surface-base p-3`,children:[(0,X.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,X.jsx)($,{label:r.form.eventType,children:(0,X.jsx)(`input`,{className:Q,value:n.eventType,onChange:e=>w({eventType:e.target.value})})}),(0,X.jsx)($,{label:r.form.eventSource,children:(0,X.jsx)(`input`,{className:Q,value:n.eventSource,onChange:e=>w({eventSource:e.target.value})})})]}),(0,X.jsxs)($,{label:r.form.eventPayloadMatch,children:[(0,X.jsx)(`textarea`,{className:D(Q,`min-h-24 resize-y font-mono text-xs`),value:n.eventPayloadMatch,onChange:e=>w({eventPayloadMatch:e.target.value}),placeholder:`{
5
- "status": "blocked"
6
- }`}),Qe(n.eventPayloadMatch)?null:(0,X.jsx)(`span`,{className:`text-xs text-red-700 dark:text-red-300`,children:r.form.invalidJsonObject})]})]}):null,t[151]=n.eventPayloadMatch,t[152]=n.eventSource,t[153]=n.eventType,t[154]=n.triggerMode,t[155]=r.form.eventPayloadMatch,t[156]=r.form.eventSource,t[157]=r.form.eventType,t[158]=r.form.invalidJsonObject,t[159]=w,t[160]=Ge):Ge=t[160];let qe;t[161]!==r.form.action||t[162]!==r.form.actionStepDescription?(qe=(0,X.jsx)(rn,{step:`2`,title:r.form.action,description:r.form.actionStepDescription}),t[161]=r.form.action,t[162]=r.form.actionStepDescription,t[163]=qe):qe=t[163];let Je;t[164]!==n.timeoutSeconds||t[165]!==n.workflowId||t[166]!==w||t[167]!==o?(Je=e=>{let t=e.target.value,r=Number.parseInt(n.timeoutSeconds,10);w({actionMode:t,...r===600||r===1800?{timeoutSeconds:t===`browser_automation`?`600`:`1800`}:{},...t===`browser_automation`||t===`task_command`?{safetyMode:`auto_apply`}:{},...t===`workflow`&&!n.workflowId.trim()&&o[0]?{workflowId:o[0].id,workflowGoal:``,workflowInput:{goal:``,argValues:{},schemaInput:{},concurrency:``,maxSubagents:``},workflowInputValid:!0}:{}})},t[164]=n.timeoutSeconds,t[165]=n.workflowId,t[166]=w,t[167]=o,t[168]=Je):Je=t[168];let Ye;t[169]===r.action.runAgent?Ye=t[170]:(Ye=(0,X.jsx)(p,{value:`agent`,children:r.action.runAgent}),t[169]=r.action.runAgent,t[170]=Ye);let Xe;t[171]===r.action.runWorkflow?Xe=t[172]:(Xe=(0,X.jsx)(p,{value:`workflow`,children:r.action.runWorkflow}),t[171]=r.action.runWorkflow,t[172]=Xe);let Ze;t[173]===r.action.runTask?Ze=t[174]:(Ze=(0,X.jsx)(p,{value:`task_command`,children:r.action.runTask}),t[173]=r.action.runTask,t[174]=Ze);let Z=b===`zh`?`浏览器自动化`:`Browser automation`,$e;t[175]===Z?$e=t[176]:($e=(0,X.jsx)(p,{value:`browser_automation`,children:Z}),t[175]=Z,t[176]=$e);let et;t[177]!==n.actionMode||t[178]!==Je||t[179]!==Ye||t[180]!==Xe||t[181]!==Ze||t[182]!==$e?(et=(0,X.jsxs)(f,{className:Q,value:n.actionMode,onChange:Je,children:[Ye,Xe,Ze,$e]}),t[177]=n.actionMode,t[178]=Je,t[179]=Ye,t[180]=Xe,t[181]=Ze,t[182]=$e,t[183]=et):et=t[183];let tt=n.actionMode===`browser_automation`?null:(0,X.jsx)($,{label:r.form.agent,children:(0,X.jsxs)(f,{className:Q,value:n.agentId,onChange:e=>w({agentId:e.target.value}),children:[(0,X.jsx)(p,{value:``,children:g?r.form.loadingAgents:r.form.defaultAgent}),h.map(e=>(0,X.jsx)(p,{value:e.id,children:fe(e,ee)},e.id))]})}),nt;t[184]!==M||t[185]!==u||t[186]!==m||t[187]!==n.actionMode||t[188]!==n.agentId||t[189]!==n.browserAutomationId||t[190]!==n.browserAutomationInputs||t[191]!==n.description||t[192]!==n.instruction||t[193]!==n.model||t[194]!==n.name||t[195]!==n.taskId||t[196]!==n.triggerMode||t[197]!==n.workflowId||t[198]!==n.workflowInput||t[199]!==r.form.defaultModel||t[200]!==r.form.instruction||t[201]!==r.form.loadingTasks||t[202]!==r.form.loadingWorkflows||t[203]!==r.form.model||t[204]!==r.form.modelHint||t[205]!==r.form.noModels||t[206]!==r.form.noTasks||t[207]!==r.form.noWorkflows||t[208]!==r.form.searchModels||t[209]!==r.form.task||t[210]!==r.form.taskClosed||t[211]!==r.form.taskContextHint||t[212]!==r.form.triggeredRun||t[213]!==r.form.workflow||t[214]!==b||t[215]!==d||t[216]!==s||t[217]!==y||t[218]!==w||t[219]!==o||t[220]!==c?(nt=n.actionMode===`agent`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)($,{label:r.form.model,children:[(0,X.jsx)(U,{value:n.model,onChange:e=>w({model:e}),placeholder:r.form.defaultModel,emptyLabel:r.form.defaultModel,searchPlaceholder:r.form.searchModels,noMatches:r.form.noModels,allowEmpty:!0,showProviderSettingsFooter:!0,contentAlign:`start`,className:`w-full`,ariaLabel:r.form.model}),(0,X.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:r.form.modelHint})]}),(0,X.jsxs)($,{label:r.form.instruction,children:[(0,X.jsx)(`div`,{className:`flex justify-end`,children:(0,X.jsx)(Oe,{value:n.instruction,onApply:e=>w({instruction:e}),fieldId:`automation.instruction`,fieldLabel:r.form.instruction,scenario:`automation.instruction`,locale:b,context:{automationName:n.name,automationDescription:n.description,triggerMode:n.triggerMode,agentId:n.agentId,model:n.model},showLabel:!1})}),(0,X.jsx)(`textarea`,{className:D(Q,`min-h-32 resize-y`),value:n.instruction,onChange:e=>w({instruction:e.target.value})})]})]}):n.actionMode===`workflow`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)($,{label:r.form.workflow,children:(0,X.jsxs)(f,{className:Q,value:n.workflowId,onChange:e=>w({workflowId:e.target.value,workflowGoal:``,workflowInput:{goal:``,argValues:{},schemaInput:{},concurrency:``,maxSubagents:``},workflowInputValid:!0}),disabled:c||o.length===0,children:[c?(0,X.jsx)(p,{value:``,children:r.form.loadingWorkflows}):null,!c&&o.length===0?(0,X.jsx)(p,{value:``,children:r.form.noWorkflows}):null,o.map(tn)]})}),s?(0,X.jsx)(je,{definition:s,language:b,value:n.workflowInput,onChange:e=>w({workflowInput:e,workflowGoal:e.goal,workflowInputValid:!0}),mode:`automation`,badgeLabel:r.form.triggeredRun,onValidityChange:e=>w({workflowInputValid:e.valid}),aiAssist:{inputScenario:`automation.workflowInput`,goalScenario:`automation.workflowGoal`,context:{automationName:n.name,automationDescription:n.description,triggerMode:n.triggerMode,workflowId:s.id,workflowTitle:s.title,workflowDescription:s.description}},inputClassName:`rounded-lg`}):null]}):n.actionMode===`task_command`?(0,X.jsx)(X.Fragment,{children:(0,X.jsxs)($,{label:r.form.task,children:[(0,X.jsxs)(f,{className:Q,value:n.taskId,onChange:e=>w({taskId:e.target.value}),disabled:y||M.length===0,children:[y?(0,X.jsx)(p,{value:``,children:r.form.loadingTasks}):null,!y&&M.length===0?(0,X.jsx)(p,{value:``,children:r.form.noTasks}):null,M.map(e=>(0,X.jsxs)(p,{value:e.id,disabled:e.phase===`closed`,children:[e.title,e.phase===`closed`?` · ${r.form.taskClosed}`:``]},e.id))]}),(0,X.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:r.form.taskContextHint})]})}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)($,{label:b===`zh`?`浏览器自动化`:`Browser automation`,children:(0,X.jsxs)(f,{className:Q,value:n.browserAutomationId,onChange:e=>{let t=u.find(t=>t.id===e.target.value);w({browserAutomationId:e.target.value,browserAutomationInputs:t?Pe(t):{}})},disabled:m||u.length===0,children:[u.length===0?(0,X.jsx)(p,{value:``,children:b===`zh`?`没有已启用的浏览器自动化`:`No enabled browser automations`}):null,u.map(en)]})}),d&&Object.keys(d.inputs).length>0?(0,X.jsx)($,{label:b===`zh`?`运行时填写`:`Run inputs`,children:(0,X.jsx)(Fe,{automation:d,values:n.browserAutomationInputs,language:b,onChange:e=>w({browserAutomationInputs:e})})}):null]}),t[184]=M,t[185]=u,t[186]=m,t[187]=n.actionMode,t[188]=n.agentId,t[189]=n.browserAutomationId,t[190]=n.browserAutomationInputs,t[191]=n.description,t[192]=n.instruction,t[193]=n.model,t[194]=n.name,t[195]=n.taskId,t[196]=n.triggerMode,t[197]=n.workflowId,t[198]=n.workflowInput,t[199]=r.form.defaultModel,t[200]=r.form.instruction,t[201]=r.form.loadingTasks,t[202]=r.form.loadingWorkflows,t[203]=r.form.model,t[204]=r.form.modelHint,t[205]=r.form.noModels,t[206]=r.form.noTasks,t[207]=r.form.noWorkflows,t[208]=r.form.searchModels,t[209]=r.form.task,t[210]=r.form.taskClosed,t[211]=r.form.taskContextHint,t[212]=r.form.triggeredRun,t[213]=r.form.workflow,t[214]=b,t[215]=d,t[216]=s,t[217]=y,t[218]=w,t[219]=o,t[220]=c,t[221]=nt):nt=t[221];let rt;t[222]===Symbol.for(`react.memo_cache_sentinel`)?(rt=(0,X.jsx)(`span`,{className:`flex size-6 shrink-0 items-center justify-center rounded-full bg-surface-hover text-xs text-fg-muted`,children:`3`}),t[222]=rt):rt=t[222];let it;t[223]===r.form.advancedDescription?it=t[224]:(it=(0,X.jsx)(`span`,{className:`ml-2 text-xs font-normal text-fg-muted`,children:r.form.advancedDescription}),t[223]=r.form.advancedDescription,t[224]=it);let at;t[225]!==r.form.advanced||t[226]!==it?(at=(0,X.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[rt,(0,X.jsxs)(`span`,{children:[r.form.advanced,it]})]}),t[225]=r.form.advanced,t[226]=it,t[227]=at):at=t[227];let ot;t[228]===Symbol.for(`react.memo_cache_sentinel`)?(ot=(0,X.jsx)(ue,{className:`size-4 transition-transform group-open:rotate-180`}),t[228]=ot):ot=t[228];let st;t[229]===at?st=t[230]:(st=(0,X.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center justify-between gap-3 px-4 py-3 text-sm font-semibold text-fg outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[at,ot]}),t[229]=at,t[230]=st);let ct;t[231]!==n.actionMode||t[232]!==n.safetyMode||t[233]!==r.form.safety||t[234]!==r.safety||t[235]!==w?(ct=n.actionMode!==`browser_automation`&&n.actionMode!==`task_command`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(rn,{title:r.form.safety}),(0,X.jsxs)($,{label:r.form.safety,children:[(0,X.jsxs)(f,{className:Q,value:n.safetyMode,onChange:e=>{let t=e.target.value;w({safetyMode:t})},children:[(0,X.jsx)(p,{value:`suggest_only`,children:r.safety.suggest_only}),(0,X.jsx)(p,{value:`ask_before_apply`,children:r.safety.ask_before_apply}),(0,X.jsx)(p,{value:`auto_apply`,children:r.safety.auto_apply})]}),(0,X.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n.safetyMode===`suggest_only`?r.safety.suggestOnlyDescription:n.safetyMode===`ask_before_apply`?r.safety.askBeforeApplyDescription:r.safety.autoApplyDescription})]})]}):null,t[231]=n.actionMode,t[232]=n.safetyMode,t[233]=r.form.safety,t[234]=r.safety,t[235]=w,t[236]=ct):ct=t[236];let lt;t[237]===r.form.results?lt=t[238]:(lt=(0,X.jsx)(rn,{title:r.form.results}),t[237]=r.form.results,t[238]=lt);let ut;t[239]===w?ut=t[240]:(ut=e=>w({conversationMode:e.target.value}),t[239]=w,t[240]=ut);let dt;t[241]===r.form.newConversation?dt=t[242]:(dt=(0,X.jsx)(p,{value:`new_session`,children:r.form.newConversation}),t[241]=r.form.newConversation,t[242]=dt);let ft;t[243]===r.form.continuousConversation?ft=t[244]:(ft=(0,X.jsx)(p,{value:`continuous`,children:r.form.continuousConversation}),t[243]=r.form.continuousConversation,t[244]=ft);let pt;t[245]!==n.conversationMode||t[246]!==ut||t[247]!==dt||t[248]!==ft?(pt=(0,X.jsxs)(f,{className:Q,value:n.conversationMode,onChange:ut,children:[dt,ft]}),t[245]=n.conversationMode,t[246]=ut,t[247]=dt,t[248]=ft,t[249]=pt):pt=t[249];let gt;t[250]!==r.form.conversation||t[251]!==pt?(gt=(0,X.jsx)($,{label:r.form.conversation,children:pt}),t[250]=r.form.conversation,t[251]=pt,t[252]=gt):gt=t[252];let _t;t[253]===w?_t=t[254]:(_t=e=>w({notificationPolicy:e.target.value}),t[253]=w,t[254]=_t);let vt;t[255]===r.form.notifyAttention?vt=t[256]:(vt=(0,X.jsx)(p,{value:`attention`,children:r.form.notifyAttention}),t[255]=r.form.notifyAttention,t[256]=vt);let yt;t[257]===r.form.notifyAll?yt=t[258]:(yt=(0,X.jsx)(p,{value:`all`,children:r.form.notifyAll}),t[257]=r.form.notifyAll,t[258]=yt);let bt;t[259]===r.form.notifyNone?bt=t[260]:(bt=(0,X.jsx)(p,{value:`none`,children:r.form.notifyNone}),t[259]=r.form.notifyNone,t[260]=bt);let xt;t[261]!==n.notificationPolicy||t[262]!==_t||t[263]!==vt||t[264]!==yt||t[265]!==bt?(xt=(0,X.jsxs)(f,{className:Q,value:n.notificationPolicy,onChange:_t,children:[vt,yt,bt]}),t[261]=n.notificationPolicy,t[262]=_t,t[263]=vt,t[264]=yt,t[265]=bt,t[266]=xt):xt=t[266];let St;t[267]!==r.form.notifications||t[268]!==xt?(St=(0,X.jsx)($,{label:r.form.notifications,children:xt}),t[267]=r.form.notifications,t[268]=xt,t[269]=St):St=t[269];let Ct;t[270]===w?Ct=t[271]:(Ct=e=>w({resultWebhookEndpoint:e.target.value}),t[270]=w,t[271]=Ct);let wt;t[272]!==n.resultWebhookEndpoint||t[273]!==Ct?(wt=(0,X.jsx)(`input`,{className:Q,value:n.resultWebhookEndpoint,onChange:Ct}),t[272]=n.resultWebhookEndpoint,t[273]=Ct,t[274]=wt):wt=t[274];let Tt;t[275]===w?Tt=t[276]:(Tt=e=>w({resultWebhookSecretId:e.target.value}),t[275]=w,t[276]=Tt);let Et;t[277]!==n.resultWebhookSecretId||t[278]!==r.form.resultWebhookSecretId||t[279]!==Tt?(Et=(0,X.jsx)(`input`,{className:Q,value:n.resultWebhookSecretId,onChange:Tt,placeholder:r.form.resultWebhookSecretId}),t[277]=n.resultWebhookSecretId,t[278]=r.form.resultWebhookSecretId,t[279]=Tt,t[280]=Et):Et=t[280];let Dt;t[281]!==wt||t[282]!==Et?(Dt=(0,X.jsxs)(`div`,{className:`grid gap-2`,children:[wt,Et]}),t[281]=wt,t[282]=Et,t[283]=Dt):Dt=t[283];let Ot;t[284]!==r.form.resultWebhookEndpoint||t[285]!==Dt?(Ot=(0,X.jsx)($,{label:r.form.resultWebhookEndpoint,children:Dt}),t[284]=r.form.resultWebhookEndpoint,t[285]=Dt,t[286]=Ot):Ot=t[286];let kt;t[287]===r.form.reliability?kt=t[288]:(kt=(0,X.jsx)(rn,{title:r.form.reliability}),t[287]=r.form.reliability,t[288]=kt);let At;t[289]===w?At=t[290]:(At=e=>w({timeoutSeconds:e.target.value}),t[289]=w,t[290]=At);let jt;t[291]!==n.timeoutSeconds||t[292]!==At?(jt=(0,X.jsx)(`input`,{className:Q,inputMode:`numeric`,value:n.timeoutSeconds,onChange:At}),t[291]=n.timeoutSeconds,t[292]=At,t[293]=jt):jt=t[293];let Mt;t[294]!==r.form.timeoutSeconds||t[295]!==jt?(Mt=(0,X.jsx)($,{label:r.form.timeoutSeconds,children:jt}),t[294]=r.form.timeoutSeconds,t[295]=jt,t[296]=Mt):Mt=t[296];let Nt;t[297]===w?Nt=t[298]:(Nt=e=>w({disableAfterFailures:e.target.value}),t[297]=w,t[298]=Nt);let Pt;t[299]!==n.disableAfterFailures||t[300]!==Nt?(Pt=(0,X.jsx)(`input`,{className:Q,inputMode:`numeric`,value:n.disableAfterFailures,onChange:Nt}),t[299]=n.disableAfterFailures,t[300]=Nt,t[301]=Pt):Pt=t[301];let Ft;t[302]!==r.form.disableAfterFailures||t[303]!==Pt?(Ft=(0,X.jsx)($,{label:r.form.disableAfterFailures,children:Pt}),t[302]=r.form.disableAfterFailures,t[303]=Pt,t[304]=Ft):Ft=t[304];let It;t[305]!==Mt||t[306]!==Ft?(It=(0,X.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[Mt,Ft]}),t[305]=Mt,t[306]=Ft,t[307]=It):It=t[307];let Lt;t[308]===r.form.effectivePolicy?Lt=t[309]:(Lt=(0,X.jsx)(`p`,{className:`text-xs font-medium text-fg`,children:r.form.effectivePolicy}),t[308]=r.form.effectivePolicy,t[309]=Lt);let Rt=n.timeoutSeconds||`—`,zt;t[310]!==r.form.executionDeadline||t[311]!==Rt?(zt=(0,X.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[r.form.executionDeadline,`: `,Rt,`s`]}),t[310]=r.form.executionDeadline,t[311]=Rt,t[312]=zt):zt=t[312];let Bt;t[313]===r.form.downstreamTimeoutHint?Bt=t[314]:(Bt=(0,X.jsx)(`p`,{className:`mt-0.5 text-xs leading-relaxed text-fg-subtle`,children:r.form.downstreamTimeoutHint}),t[313]=r.form.downstreamTimeoutHint,t[314]=Bt);let Vt;t[315]!==Lt||t[316]!==zt||t[317]!==Bt?(Vt=(0,X.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-inset/40 px-3 py-2.5`,children:[Lt,zt,Bt]}),t[315]=Lt,t[316]=zt,t[317]=Bt,t[318]=Vt):Vt=t[318];let Ht;t[319]!==Vt||t[320]!==ct||t[321]!==lt||t[322]!==gt||t[323]!==St||t[324]!==Ot||t[325]!==kt||t[326]!==It?(Ht=(0,X.jsxs)(`div`,{className:`grid gap-4 border-t border-edge-subtle p-4`,children:[ct,lt,gt,St,Ot,kt,It,Vt]}),t[319]=Vt,t[320]=ct,t[321]=lt,t[322]=gt,t[323]=St,t[324]=Ot,t[325]=kt,t[326]=It,t[327]=Ht):Ht=t[327];let Ut;t[328]!==Ht||t[329]!==st?(Ut=(0,X.jsxs)(`details`,{className:`group rounded-xl border border-edge-subtle bg-surface-base`,children:[st,Ht]}),t[328]=Ht,t[329]=st,t[330]=Ut):Ut=t[330];let Wt;return t[331]!==Ut||t[332]!==re||t[333]!==ae||t[334]!==oe||t[335]!==he||t[336]!==ge||t[337]!==Re||t[338]!==ze||t[339]!==Be||t[340]!==He||t[341]!==Ue||t[342]!==We||t[343]!==Ge||t[344]!==qe||t[345]!==et||t[346]!==tt||t[347]!==nt?(Wt=(0,X.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-4`,children:(0,X.jsxs)(`div`,{className:`grid gap-4`,children:[re,ae,oe,he,ge,Re,ze,Be,He,Ue,We,Ge,qe,et,tt,nt,Ut]})}),t[331]=Ut,t[332]=re,t[333]=ae,t[334]=oe,t[335]=he,t[336]=ge,t[337]=Re,t[338]=ze,t[339]=Be,t[340]=He,t[341]=Ue,t[342]=We,t[343]=Ge,t[344]=qe,t[345]=et,t[346]=tt,t[347]=nt,t[348]=Wt):Wt=t[348],Wt}function en(e){return(0,X.jsx)(p,{value:e.id,children:e.name},e.id)}function tn(e){return(0,X.jsx)(p,{value:e.id,children:e.title||e.name},e.id)}function nn(e){return(0,X.jsx)(p,{value:e.id,children:e.name},e.id)}var Q=`min-h-11 w-full rounded-lg border border-edge bg-surface-base px-3 py-2 text-base sm:min-h-0 sm:text-sm text-fg outline-none focus:border-accent`;function $(e){let t=(0,Ie.c)(5),{label:n,children:r}=e,i;t[0]===n?i=t[1]:(i=(0,X.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:n}),t[0]=n,t[1]=i);let a;return t[2]!==r||t[3]!==i?(a=(0,X.jsxs)(`div`,{className:`grid gap-1.5`,children:[i,r]}),t[2]=r,t[3]=i,t[4]=a):a=t[4],a}function rn(e){let t=(0,Ie.c)(12),{title:n,step:r,description:i}=e,a;t[0]===r?a=t[1]:(a=r?(0,X.jsx)(`span`,{className:`flex size-6 shrink-0 items-center justify-center rounded-full bg-accent/10 text-xs font-semibold text-accent-fg`,children:r}):(0,X.jsx)(b,{className:`mt-0.5 size-4 text-fg-muted`}),t[0]=r,t[1]=a);let o;t[2]===n?o=t[3]:(o=(0,X.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n}),t[2]=n,t[3]=o);let s;t[4]===i?s=t[5]:(s=i?(0,X.jsx)(`p`,{className:`mt-0.5 text-xs leading-5 text-fg-muted`,children:i}):null,t[4]=i,t[5]=s);let c;t[6]!==o||t[7]!==s?(c=(0,X.jsxs)(`div`,{children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8];let l;return t[9]!==a||t[10]!==c?(l=(0,X.jsxs)(`div`,{className:`flex items-start gap-2 pt-2`,children:[a,c]}),t[9]=a,t[10]=c,t[11]=l):l=t[11],l}export{kt as t};