@xopcai/xopc 0.0.390 → 0.0.391

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 (192) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/src/plugin.js +1 -1
  3. package/dist/extensions/telegram/xopc.extension.json +1 -1
  4. package/dist/gateway/static/root/assets/{activity-store-DGMAYkw8.js → activity-store-DWQCDi8M.js} +1 -1
  5. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-B4AsZzJR.js → agent-avatar-dicebear-CzS0TUv9.js} +1 -1
  6. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-DE910MyU.js +1 -0
  7. package/dist/gateway/static/root/assets/agent-plugin-dialog-0SlvsYl7.js +1 -0
  8. package/dist/gateway/static/root/assets/agents-BZh28Qn1.js +77 -0
  9. package/dist/gateway/static/root/assets/{agents-admin-api-DxdaiFWn.js → agents-admin-api-Bb3Kvz3X.js} +1 -1
  10. package/dist/gateway/static/root/assets/{app-management-settings-panel-DHRfLkYD.js → app-management-settings-panel-9A7JN5V5.js} +1 -1
  11. package/dist/gateway/static/root/assets/{appearance-settings-DtKSapgb.js → appearance-settings-BPdLEo6L.js} +1 -1
  12. package/dist/gateway/static/root/assets/{apps-page-B9kuRt_z.js → apps-page-Cz7LypV9.js} +1 -1
  13. package/dist/gateway/static/root/assets/{archive-plugin-AgySTXp_.js → archive-plugin-DFnHPNie.js} +1 -1
  14. package/dist/gateway/static/root/assets/{automations-page-D1o7ZtUW.js → automations-page-CnBLPVNh.js} +1 -1
  15. package/dist/gateway/static/root/assets/automations-workspace-BBjS-sk-.js +6 -0
  16. package/dist/gateway/static/root/assets/{binary-plugins-A1AXOsO6.js → binary-plugins-BQC0Tzoi.js} +1 -1
  17. package/dist/gateway/static/root/assets/{block-editor-DUNLkLKF.js → block-editor-DSh5019z.js} +4 -4
  18. package/dist/gateway/static/root/assets/{browser-automation-inputs-BvUC6OiW.js → browser-automation-inputs-C5tIrIRL.js} +1 -1
  19. package/dist/gateway/static/root/assets/browser-automations-page-CFCMNfJN.js +3 -0
  20. package/dist/gateway/static/root/assets/browser-settings-page-C__tyPwu.js +3 -0
  21. package/dist/gateway/static/root/assets/{capabilities-D61uSJPy.js → capabilities-D6RJG4QY.js} +1 -1
  22. package/dist/gateway/static/root/assets/{capabilities-BkCutK0V.js → capabilities-DGEmBQnF.js} +1 -1
  23. package/dist/gateway/static/root/assets/capabilities-page-B5AZa7ir.js +2 -0
  24. package/dist/gateway/static/root/assets/capabilities-settings-panel-Dskz2_bh.js +8 -0
  25. package/dist/gateway/static/root/assets/{capability-header-actions-D9uGs4Pw.js → capability-header-actions-xzjWZVbg.js} +1 -1
  26. package/dist/gateway/static/root/assets/{channels-xb7n8rwF.js → channels-DRse_dD3.js} +1 -1
  27. package/dist/gateway/static/root/assets/{chat-terminal-dock-Dgn09YDs.js → chat-terminal-dock-CQF0M4kE.js} +1 -1
  28. package/dist/gateway/static/root/assets/{computer-settings-page-C66P4ifT.js → computer-settings-page-ZfzCTS0N.js} +1 -1
  29. package/dist/gateway/static/root/assets/{connector-service-page-Dp35XdYf.js → connector-service-page-CwAeWVLK.js} +1 -1
  30. package/dist/gateway/static/root/assets/connectors-page-CanakKaj.js +1 -0
  31. package/dist/gateway/static/root/assets/{date-picker-CddHY982.js → date-picker-hmJlEAQZ.js} +1 -1
  32. package/dist/gateway/static/root/assets/{dependency-picker-Ob6BZTqv.js → dependency-picker-Us_Juz6I.js} +1 -1
  33. package/dist/gateway/static/root/assets/{desktop-pet-dmwCV-I4.js → desktop-pet-CvOTI4uw.js} +1 -1
  34. package/dist/gateway/static/root/assets/{desktop-pet-settings-B-TBkZAZ.js → desktop-pet-settings-DYg-Gb8t.js} +1 -1
  35. package/dist/gateway/static/root/assets/device-pairing-wizard-B1FbZ8C1.js +1 -0
  36. package/dist/gateway/static/root/assets/{directory-picker-path-field-6VZa4fT1.js → directory-picker-path-field-DZN9EDvM.js} +1 -1
  37. package/dist/gateway/static/root/assets/{extension-debug-page-C0_njMva.js → extension-debug-page-YIibp6Kk.js} +1 -1
  38. package/dist/gateway/static/root/assets/{extension-page-BeBLMFmW.js → extension-page-DkcGyb28.js} +1 -1
  39. package/dist/gateway/static/root/assets/{extension-provider-DWI0KAKT.js → extension-provider-B1PQGTtY.js} +1 -1
  40. package/dist/gateway/static/root/assets/extension-settings-page-C_rJiSKo.js +1 -0
  41. package/dist/gateway/static/root/assets/{gateway-config-swr-CmYcOqhb.js → gateway-config-swr-Dv_A5FMu.js} +1 -1
  42. package/dist/gateway/static/root/assets/{gateway-realtime-Ci1Jst5g.js → gateway-realtime-DghCGfY_.js} +1 -1
  43. package/dist/gateway/static/root/assets/gateway-realtime-store-CMJVSnvi.js +1 -0
  44. package/dist/gateway/static/root/assets/gateway-settings-CjCWPHNJ.js +1 -0
  45. package/dist/gateway/static/root/assets/{gateway-startup-retry-C-BG5M7H.js → gateway-startup-retry-CkTVSESs.js} +1 -1
  46. package/dist/gateway/static/root/assets/{highlighted-body-KQOG7T2V-CsA7lCVc.js → highlighted-body-KQOG7T2V-DV2wNqBn.js} +1 -1
  47. package/dist/gateway/static/root/assets/home-page-fAYsd7kG.js +2 -0
  48. package/dist/gateway/static/root/assets/{image-generation-api-B_DqCwtV.js → image-generation-api-B98iXt6A.js} +1 -1
  49. package/dist/gateway/static/root/assets/{imports-page-oAvAF9QS.js → imports-page-DoBCBN8G.js} +1 -1
  50. package/dist/gateway/static/root/assets/index-DFgXwLsv.js +260 -0
  51. package/dist/gateway/static/root/assets/index-a6ZvhclR.css +1 -0
  52. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings--MjYe-Pb.js → keyboard-shortcuts-settings-DXVu4lqV.js} +1 -1
  53. package/dist/gateway/static/root/assets/local-app-workbench-page-B3fz6uRi.js +1 -0
  54. package/dist/gateway/static/root/assets/{local-apps-page-DOa7mxjB.js → local-apps-page-BC6xhmUh.js} +1 -1
  55. package/dist/gateway/static/root/assets/{local-session-drafts-DAtLkTPg.js → local-session-drafts-DFnZQu9A.js} +1 -1
  56. package/dist/gateway/static/root/assets/{locale-store-DMy9W6IG.js → locale-store-BpK9AiDq.js} +1 -1
  57. package/dist/gateway/static/root/assets/logs-page-CSqSFDRU.js +2 -0
  58. package/dist/gateway/static/root/assets/{management-settings-C0TzuD3-.js → management-settings-gq5L0THs.js} +1 -1
  59. package/dist/gateway/static/root/assets/{markdown-view-wyOHdXEg.js → markdown-view-IsYTotu6.js} +18 -18
  60. package/dist/gateway/static/root/assets/{media-plugins-Pb2zr_-L.js → media-plugins-oSChWbcP.js} +1 -1
  61. package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-C_QKwqDN.js +1 -0
  62. package/dist/gateway/static/root/assets/{messages-O0BEUKnx.js → messages-CKTo_sIF.js} +2 -2
  63. package/dist/gateway/static/root/assets/{models-hub-cache-DdH1MODX.js → models-hub-cache-TjpL7hZ5.js} +1 -1
  64. package/dist/gateway/static/root/assets/note-detail-panel-CdpNXre-.js +5 -0
  65. package/dist/gateway/static/root/assets/{notes-api-CYt2pGsm.js → notes-api-CBb944yw.js} +1 -1
  66. package/dist/gateway/static/root/assets/notes-page-EGvGw8MN.js +8 -0
  67. package/dist/gateway/static/root/assets/{page-context-capture-button-3uj5EcQC.js → page-context-capture-button-CoWb7BYP.js} +1 -1
  68. package/dist/gateway/static/root/assets/personal-page-DYzbNTyN.js +1 -0
  69. package/dist/gateway/static/root/assets/{product-open-page-hI13tPS1.js → product-open-page-CTyy7H7-.js} +1 -1
  70. package/dist/gateway/static/root/assets/{product-preview-content-lT_in0-Q.js → product-preview-content-D4xqTaEy.js} +1 -1
  71. package/dist/gateway/static/root/assets/project-detail-page-DIVCw0QQ.js +1 -0
  72. package/dist/gateway/static/root/assets/projects-page-B4L9VnBN.js +1 -0
  73. package/dist/gateway/static/root/assets/{registry-api-CgQrCqL6.js → registry-api-Dsa2LvRt.js} +1 -1
  74. package/dist/gateway/static/root/assets/remote-access-hub-B8PvgLVz.js +1 -0
  75. package/dist/gateway/static/root/assets/{runtime-tools-api-D12qVKeC.js → runtime-tools-api-C2Uw89eY.js} +1 -1
  76. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-DOSPOfCU.js → runtime-tools-settings-panel-Bqnp3tyt.js} +1 -1
  77. package/dist/gateway/static/root/assets/scenes-page-D50g4GM2.js +2 -0
  78. package/dist/gateway/static/root/assets/{schema-form-CwOFgsyh.js → schema-form-h_RCNfiO.js} +1 -1
  79. package/dist/gateway/static/root/assets/{send-session-input-nH8Cw0US.js → send-session-input-DypbVTT7.js} +1 -1
  80. package/dist/gateway/static/root/assets/{session-api-B9HrwF-c.js → session-api-ga-SUOq_.js} +1 -1
  81. package/dist/gateway/static/root/assets/{session-manager-aXqXuqDX.js → session-manager-C_OiKblh.js} +8 -8
  82. package/dist/gateway/static/root/assets/sessions-page-BsqDIbIr.js +1 -0
  83. package/dist/gateway/static/root/assets/settings-advanced-gate-D3zJAW4p.js +1 -0
  84. package/dist/gateway/static/root/assets/{settings-page-BN70wE6R.js → settings-page-DPCgrICd.js} +1 -1
  85. package/dist/gateway/static/root/assets/{setup-status-panel-CHzcVRi-.js → setup-status-panel-jjSYJpDd.js} +1 -1
  86. package/dist/gateway/static/root/assets/{share-link-dialog-B1TDyhPt.js → share-link-dialog-BGicglAS.js} +1 -1
  87. package/dist/gateway/static/root/assets/{share-preview-page-Br-eAZaP.js → share-preview-page-BORe9rLB.js} +1 -1
  88. package/dist/gateway/static/root/assets/{shares-api-Bl1ZBh5S.js → shares-api-Dbx3z6-1.js} +1 -1
  89. package/dist/gateway/static/root/assets/shares-settings-C13FgfWk.js +1 -0
  90. package/dist/gateway/static/root/assets/{skill-api-ClUw3SRC.js → skill-api-Cq6O1DZK.js} +1 -1
  91. package/dist/gateway/static/root/assets/{skill-reload-api--1BfIPzb.js → skill-reload-api-Cq7QDjMA.js} +1 -1
  92. package/dist/gateway/static/root/assets/skills-page-BM1ShEjx.js +2 -0
  93. package/dist/gateway/static/root/assets/{system-settings-panel-tWrqu7ai.js → system-settings-panel-BNCGFO1e.js} +1 -1
  94. package/dist/gateway/static/root/assets/task-detail-page-4VG82wcF.js +2 -0
  95. package/dist/gateway/static/root/assets/{task-expandable-content-D2t4ahzR.js → task-expandable-content-DAZGz5YC.js} +1 -1
  96. package/dist/gateway/static/root/assets/{theme-store-BBLjE0fi.js → theme-store-Db7hDESt.js} +1 -1
  97. package/dist/gateway/static/root/assets/{tracing-settings-page-5ATxQH5c.js → tracing-settings-page-C6p2Mu92.js} +1 -1
  98. package/dist/gateway/static/root/assets/{tunnel-api-CF1Qh4wU.js → tunnel-api-Dw15EJp0.js} +1 -1
  99. package/dist/gateway/static/root/assets/usage-page-DDrIqgGe.js +1 -0
  100. package/dist/gateway/static/root/assets/{use-autosave-tY3keIbm.js → use-autosave-DDjIdW4U.js} +1 -1
  101. package/dist/gateway/static/root/assets/{use-composer-attachments-CXsocZjt.js → use-composer-attachments-DNl7O3Vb.js} +1 -1
  102. package/dist/gateway/static/root/assets/{use-file-preview-expanded-CEsxnDnQ.js → use-file-preview-expanded-DMHehhwG.js} +2 -2
  103. package/dist/gateway/static/root/assets/user-model-page-CaS9dOIr.js +2 -0
  104. package/dist/gateway/static/root/assets/{voice-api-key-field-COTNLUU3.js → voice-api-key-field-ByAxHE4P.js} +1 -1
  105. package/dist/gateway/static/root/assets/{voice-config-api-DrxBjSja.js → voice-config-api-Dl39b27p.js} +1 -1
  106. package/dist/gateway/static/root/assets/{voice-transcribe-api-B47j0_xA.js → voice-transcribe-api-CVaU83Jc.js} +1 -1
  107. package/dist/gateway/static/root/assets/{work-discovery-overlay-PByMJrhV.js → work-discovery-overlay-BvVvPA1T.js} +1 -1
  108. package/dist/gateway/static/root/assets/workflow-run-setup-panel-BcFm9QcC.js +3 -0
  109. package/dist/gateway/static/root/assets/workflows-page-DMec_XZB.js +6 -0
  110. package/dist/gateway/static/root/assets/{workspace-api-Bmx1O449.js → workspace-api-BpfKsrtP.js} +2 -2
  111. package/dist/gateway/static/root/assets/{xopc-cloud-account-card-DVsAbvwP.js → xopc-cloud-account-card-CU5lzzE9.js} +1 -1
  112. package/dist/gateway/static/root/index.html +28 -36
  113. package/dist/package.js +1 -1
  114. package/dist/src/agent/agent-manager.d.ts +1 -0
  115. package/dist/src/agent/agent-manager.js +4 -1
  116. package/dist/src/agent/context/execution-scope.js +1 -1
  117. package/dist/src/agent/embedded/execution-tool-policy.d.ts +2 -0
  118. package/dist/src/agent/embedded/execution-tool-policy.js +8 -3
  119. package/dist/src/agent/embedded/run-turn.js +2 -1
  120. package/dist/src/agent/embedded/session-runner.js +1 -1
  121. package/dist/src/agent/tools/factory.js +14 -12
  122. package/dist/src/agent/tools/personal-read-tool.js +4 -0
  123. package/dist/src/agent/tools/task-collaboration-tool.js +1 -1
  124. package/dist/src/channels/index.js +1 -1
  125. package/dist/src/channels/manager.js +1 -1
  126. package/dist/src/cli/commands/channels.js +1 -1
  127. package/dist/src/cli/commands/connectors.js +1 -1
  128. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  129. package/dist/src/cli/commands/extension-marketplace.js +1 -1
  130. package/dist/src/cli/commands/models.js +1 -1
  131. package/dist/src/cli/commands/onboard.js +1 -1
  132. package/dist/src/extensions/sdk/index.js +1 -1
  133. package/dist/src/gateway/hono/lib/voice-settings-revisions.js +2 -1
  134. package/dist/src/gateway/hono/routes/commands-skills.js +15 -0
  135. package/dist/src/gateway/service.js +9 -7
  136. package/dist/src/home-intelligence/host.js +2 -2
  137. package/dist/src/providers/setup/profiles.d.ts +2 -2
  138. package/dist/src/providers/setup/profiles.js +6 -22
  139. package/dist/src/storage/sqlite/migrations/256_task_main_update_retries.sql +21 -0
  140. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  141. package/dist/src/storage/sqlite/migrations/runner.js +3 -3
  142. package/dist/src/storage/sqlite/schema.js +1 -1
  143. package/dist/src/tasks/task-collaboration-repository.d.ts +2 -0
  144. package/dist/src/tasks/task-collaboration-repository.js +7 -1
  145. package/dist/src/tasks/task-main-update-delivery.js +11 -4
  146. package/dist/src/tasks/task-main-update-input.js +2 -1
  147. package/dist/src/tasks/task-main-update-retry.d.ts +5 -0
  148. package/dist/src/tasks/task-main-update-retry.js +15 -0
  149. package/package.json +3 -3
  150. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-9NUY1sO3.js +0 -1
  151. package/dist/gateway/static/root/assets/agent-plugin-dialog-CNc6ntzP.js +0 -1
  152. package/dist/gateway/static/root/assets/agents-QNY9Vkrf.js +0 -77
  153. package/dist/gateway/static/root/assets/automations-workspace-BJenz0P1.js +0 -6
  154. package/dist/gateway/static/root/assets/bot-DjLkhyZL.js +0 -1
  155. package/dist/gateway/static/root/assets/browser-automations-page-Dq2LlVMh.js +0 -3
  156. package/dist/gateway/static/root/assets/browser-settings-page-BOZ-1g51.js +0 -3
  157. package/dist/gateway/static/root/assets/capabilities-page-BDP6gzlv.js +0 -2
  158. package/dist/gateway/static/root/assets/capabilities-settings-panel-D6PL3Mfl.js +0 -8
  159. package/dist/gateway/static/root/assets/circle-pause-CN9jYH2s.js +0 -1
  160. package/dist/gateway/static/root/assets/clock-3-DnrAnuyZ.js +0 -1
  161. package/dist/gateway/static/root/assets/connectors-page-BHcRxYib.js +0 -1
  162. package/dist/gateway/static/root/assets/device-pairing-wizard-SWHwRgG3.js +0 -1
  163. package/dist/gateway/static/root/assets/extension-settings-page-BiLUwoKx.js +0 -1
  164. package/dist/gateway/static/root/assets/gateway-realtime-store-BMUiUQMk.js +0 -1
  165. package/dist/gateway/static/root/assets/gateway-settings-CzWT_v09.js +0 -1
  166. package/dist/gateway/static/root/assets/git-branch-Dh9uxTot.js +0 -1
  167. package/dist/gateway/static/root/assets/home-page-BeXJfxsg.js +0 -2
  168. package/dist/gateway/static/root/assets/index-W9ls-0Yd.css +0 -1
  169. package/dist/gateway/static/root/assets/index-xTL-vb51.js +0 -260
  170. package/dist/gateway/static/root/assets/local-app-workbench-page-DL33dtd7.js +0 -1
  171. package/dist/gateway/static/root/assets/logs-page-C-GbTYsM.js +0 -2
  172. package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-BxyGGa4D.js +0 -1
  173. package/dist/gateway/static/root/assets/message-square-fVE7Ghj1.js +0 -1
  174. package/dist/gateway/static/root/assets/note-detail-panel-BFpEqskQ.js +0 -5
  175. package/dist/gateway/static/root/assets/notes-page-h-qqFJ6Z.js +0 -8
  176. package/dist/gateway/static/root/assets/pause-DuPxgSxk.js +0 -1
  177. package/dist/gateway/static/root/assets/personal-page-BGyW6cdt.js +0 -1
  178. package/dist/gateway/static/root/assets/play-kxZvpBg8.js +0 -1
  179. package/dist/gateway/static/root/assets/project-detail-page-Baj7fQ7N.js +0 -1
  180. package/dist/gateway/static/root/assets/projects-page-D7DyQFU3.js +0 -1
  181. package/dist/gateway/static/root/assets/remote-access-hub-DU_d93Tm.js +0 -1
  182. package/dist/gateway/static/root/assets/scenes-page-swyUIF5A.js +0 -2
  183. package/dist/gateway/static/root/assets/sessions-page-CI_PJmlX.js +0 -1
  184. package/dist/gateway/static/root/assets/settings-advanced-gate-DCVaeBLW.js +0 -1
  185. package/dist/gateway/static/root/assets/shares-settings-jgCC_E4Y.js +0 -1
  186. package/dist/gateway/static/root/assets/skills-page-C9oRZSuL.js +0 -2
  187. package/dist/gateway/static/root/assets/sparkles-DHlfQFAF.js +0 -1
  188. package/dist/gateway/static/root/assets/task-detail-page-BYRW7Rrr.js +0 -2
  189. package/dist/gateway/static/root/assets/usage-page-CuEHzXil.js +0 -1
  190. package/dist/gateway/static/root/assets/user-model-page-Dvt5TIZ6.js +0 -2
  191. package/dist/gateway/static/root/assets/workflow-run-setup-panel-CSUkMo63.js +0 -3
  192. package/dist/gateway/static/root/assets/workflows-page-BUDvFo3R.js +0 -6
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{_ as i,t as a}from"./chunk-KS7C4IRE--EKdQGRF.js";import{t as o}from"./check-DUBLcKHA.js";import{t as s}from"./ellipsis-0k4rZLoy.js";import{t as c}from"./external-link-DjqjBmc3.js";import{t as l}from"./markdown-view-wyOHdXEg.js";import{t as u}from"./loader-circle-CifKLtgG.js";import{t as d}from"./plus-Q2yW6OE7.js";import{t as f}from"./x-B_N4OPjy.js";import{t as p}from"./messages-O0BEUKnx.js";import{t as m}from"./cn-0WouolD0.js";import{c as h,i as g,n as _,r as v}from"./locale-store-DMy9W6IG.js";import{a as y,i as b,o as x,r as S,s as C,t as w}from"./dist-BGTk37IG.js";import{i as T,o as E,r as D,s as O}from"./extension-provider-DWI0KAKT.js";import{a as k,i as A}from"./vendor-swr-BIWyz7Rc.js";import{t as j}from"./button-aIC072nz.js";import{n as M}from"./interaction-BdhHBbYa.js";import{o as N}from"./gateway-realtime-Ci1Jst5g.js";import{t as P}from"./skeleton-BI5TyibZ.js";import{r as F}from"./settings-form-draft-Dy10ldo8.js";import{Ca as I,Fo as ee,Hc as L,Io as te,Ts as R,Yc as z,al as ne,ar as B,ha as V,ir as H,nr as U,rr as W,rs as G,sr as K,ts as re}from"./index-xTL-vb51.js";import{n as q,t as J}from"./capability-header-actions-D9uGs4Pw.js";import{t as Y}from"./page-tabs-HLrKIjXH.js";import{t as ie}from"./agent-plugin-dialog-CNc6ntzP.js";import{t as X}from"./capability-icon-DVoZxEgW.js";var Z=e(t(),1),ae=n();function Q(e){return e===`builtin`||e===`user`?e:`marketplace`}async function oe(e=``){let t=await g(v(`/api/marketplace${e.trim()?`?q=${encodeURIComponent(e.trim())}`:``}`),{cache:`no-store`});if(!t.ok)throw Error(await se(t));let n=await t.json();if(!n.ok||!Array.isArray(n.extensions))throw Error(n.error??`Invalid response`);return n.extensions}async function se(e){try{let t=await e.json();if(typeof t.error==`string`)return t.error;if(t.error&&typeof t.error==`object`&&typeof t.error.message==`string`)return t.error.message;if(typeof t.message==`string`)return t.message}catch{}return e.statusText||`HTTP ${e.status}`}async function ce(e){let t=await g(v(`/api/marketplace/packages/${encodeURIComponent(e.trim())}`),{cache:`no-store`});if(!t.ok)throw Error(await se(t));let n=await t.json();if(!n.ok||!n.payload?.id)throw Error(n.error??`Invalid response`);return n.payload}async function le(e){let t=await g(v(`/api/marketplace/install`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await se(t));let n=await t.json();if(!n.ok||!n.payload?.extensionId)throw Error(n.error??`Invalid response`);return n.payload}async function ue(e){let t=await g(v(`/api/extensions/${encodeURIComponent(e.extensionId.trim())}/activation`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({enabled:e.enabled})});if(!t.ok)throw Error(await se(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error?.message??`Invalid response`);return n.payload}async function de(e){let t=await g(v(`/api/marketplace/uninstall`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({extensionId:e})});if(!t.ok)throw Error(await se(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error??`Invalid response`);return n.payload}var $=r();function fe(e,t){let n=e.find(e=>e.id===t||e.pluginId===t);return n?n.source===`bundled`?`bundled`:`user`:`absent`}var pe={debounced:``,detailPkg:null,quickInstallPkg:null,rowBusy:null,actionError:null,restartHint:null};function me({className:e,query:t}){let n=_(e=>e.language),r=p(n).extensionsPage,i=h(e=>!!e.conversationId),a=D(),{mutate:o}=k(),[s,c]=(0,Z.useReducer)(F,pe),{debounced:l,detailPkg:d,quickInstallPkg:f,rowBusy:g,actionError:v,restartHint:y}=s,b=i?`marketplace-${l}`:null;(0,Z.useEffect)(()=>{let e=window.setTimeout(()=>c({type:`patch`,patch:{debounced:t.trim()}}),300);return()=>window.clearTimeout(e)},[t]);let{data:x,isLoading:S,error:C}=A(b,()=>oe(l),{revalidateOnFocus:!1}),w=(0,Z.useCallback)(()=>{o(`gateway-extensions-list`),N()},[o]),T=(0,Z.useCallback)(async(e,t)=>{c({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let n=await le({name:e,overwrite:t});w(),n.requiresGatewayRestart&&c({type:`patch`,patch:{restartHint:r.marketplaceRestartHint}})}catch(e){throw c({type:`patch`,patch:{actionError:e instanceof Error?e.message:r.marketplaceInstallFailed}}),e}finally{c({type:`patch`,patch:{rowBusy:null}})}},[r.marketplaceInstallFailed,r.marketplaceRestartHint,w]),E=(0,Z.useCallback)(async e=>{c({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let t=await de(e);w(),t.requiresGatewayRestart&&c({type:`patch`,patch:{restartHint:r.marketplaceRestartHint}})}catch(e){throw c({type:`patch`,patch:{actionError:e instanceof Error?e.message:r.marketplaceUninstallFailed}}),e}finally{c({type:`patch`,patch:{rowBusy:null}})}},[r.marketplaceRestartHint,r.marketplaceUninstallFailed,w]),O=x??[];return(0,$.jsxs)(`div`,{className:m(`flex flex-col gap-4`,e),children:[C?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:C instanceof Error?C.message:r.marketplaceLoadFailed}):null,v?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:v}):null,y?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:y}):null,S&&!x?(0,$.jsx)(`ul`,{className:`flex flex-col gap-3`,"aria-label":r.marketplaceLoading,children:[0,1,2].map(e=>(0,$.jsx)(`li`,{className:`rounded-xl bg-surface-panel p-4 shadow-surface`,children:(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2.5`,children:[(0,$.jsx)(P,{className:`h-5 w-40`}),(0,$.jsx)(P,{className:`h-4 w-full max-w-xl`}),(0,$.jsx)(P,{className:`h-4 w-2/3 max-w-md`})]}),(0,$.jsx)(P,{className:`h-8 w-20`})]})},e))}):(0,$.jsx)(`ul`,{className:`flex flex-col gap-3`,children:O.length===0?(0,$.jsx)(`li`,{className:`text-sm text-fg-muted`,children:r.marketplaceEmpty}):O.map(e=>{let t=fe(a,e.id),i=g===e.id,o=e.localizations?.[n.startsWith(`zh`)?`zh-CN`:`en`],s=o?.displayName??e.name,l=o?.description??e.description;return(0,$.jsx)(`li`,{className:`list-none`,children:(0,$.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-label":`${s}, ${r.marketplaceDetailTitle}`,onClick:()=>c({type:`patch`,patch:{detailPkg:e.id}}),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),c({type:`patch`,patch:{detailPkg:e.id}}))},className:m(`flex w-full cursor-pointer flex-wrap items-start gap-3 rounded-xl bg-surface-panel p-4 text-left shadow-surface`,`transition-[transform,background-color,box-shadow] duration-150 ease-out`,`hover:bg-surface-hover/40`,`active:scale-[0.992] active:bg-surface-hover/55`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`dark:hover:bg-surface-hover/25 dark:active:bg-surface-hover/35`),children:[(0,$.jsx)(X,{iconUrl:e.branding?.iconUrl,fallback:R}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`h3`,{className:`truncate font-semibold text-fg`,children:s}),s===e.id?null:(0,$.jsx)(`p`,{className:`truncate font-mono text-[10px] text-fg-subtle`,children:e.id})]}),e.verified?(0,$.jsx)(L,{className:`size-4 shrink-0 text-emerald-600 dark:text-emerald-400`,strokeWidth:1.75,"aria-label":`Verified`}):null,e.version?(0,$.jsx)(`span`,{className:`text-xs text-fg-muted`,children:e.version}):null]}),l?(0,$.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm text-fg-muted`,children:l}):null,(0,$.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:(e.categories??[]).map(e=>(0,$.jsx)(`span`,{className:`rounded-md border border-edge bg-surface-panel px-2 py-0.5 text-[11px] text-fg-muted`,children:e},e))}),(0,$.jsxs)(`p`,{className:`mt-2 flex items-center gap-1.5 text-xs text-fg-muted`,children:[(0,$.jsx)(R,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),(0,$.jsx)(`code`,{className:`rounded bg-surface-panel px-1 py-0.5`,children:e.npmPackage})]})]}),(0,$.jsx)(`div`,{role:`group`,className:`flex shrink-0 flex-col items-end gap-2 sm:min-w-[9rem]`,onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),children:t===`bundled`?(0,$.jsx)(`span`,{className:`rounded-md bg-surface-hover px-2 py-1 text-[11px] font-medium text-fg-muted`,children:r.marketplaceBuiltin}):t===`user`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`text-[11px] font-medium text-fg-muted`,children:r.marketplaceInstalled}),e.packageType===`plugin`?(0,$.jsx)(`button`,{type:`button`,onClick:()=>c({type:`patch`,patch:{detailPkg:e.id,quickInstallPkg:null}}),className:m(`inline-flex items-center justify-center rounded-lg border border-edge px-3 py-2 text-xs font-medium text-fg`,`transition-colors active:scale-[0.98] active:bg-surface-hover/80`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:n.startsWith(`zh`)?`管理`:`Manage`}):(0,$.jsxs)(`button`,{type:`button`,disabled:i,onClick:()=>{window.confirm(r.marketplaceUninstallConfirm)&&E(e.id).catch(()=>{})},className:m(`inline-flex items-center justify-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-xs font-medium text-fg`,`transition-colors active:scale-[0.98] active:bg-surface-hover/80`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`disabled:pointer-events-none disabled:opacity-50`),children:[i?(0,$.jsx)(u,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,$.jsx)(te,{className:`size-3.5`,strokeWidth:2,"aria-hidden":!0}),r.marketplaceUninstall]})]}):(0,$.jsx)(`button`,{type:`button`,onClick:()=>c({type:`patch`,patch:e.packageType===`plugin`?{detailPkg:e.id,quickInstallPkg:e.id}:{detailPkg:e.id,quickInstallPkg:null}}),className:m(`inline-flex w-full items-center justify-center rounded-lg border border-edge px-3 py-2 text-xs font-medium text-fg`,`transition-[transform,background-color] active:scale-[0.98]`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:e.packageType===`plugin`?n.startsWith(`zh`)?`安装`:`Install`:r.marketplaceReview})})]})},e.id)})}),d?(0,$.jsx)(he,{packageName:d,autoInstall:f===d,copy:r,extensions:a,onClose:()=>c({type:`patch`,patch:{detailPkg:null,quickInstallPkg:null}}),onInstall:T,onUninstall:E}):null]})}function he(e){let t=(0,ae.c)(96),{packageName:n,autoInstall:r,copy:i,extensions:o,onClose:s,onInstall:c,onUninstall:d}=e,[p,g]=(0,Z.useState)(!1),[_,v]=(0,Z.useState)(!1),b=h(be)?`ext-mp-detail-${n}`:null,T;t[0]===n?T=t[1]:(T=async()=>ce(n),t[0]=n,t[1]=T);let E;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(E={revalidateOnFocus:!1},t[2]=E):E=t[2];let{data:D,error:O,isLoading:k}=A(b,T,E),j;t[3]!==o||t[4]!==n?(j=fe(o,n),t[3]=o,t[4]=n,t[5]=j):j=t[5];let M=j,N=M===`user`,F=D?.manifest?.permissions,I,L,R,z,B,V,H,U,W,G,K,q;if(t[6]!==r||t[7]!==i||t[8]!==D||t[9]!==O||t[10]!==o||t[11]!==M||t[12]!==k||t[13]!==s||t[14]!==n||t[15]!==F||t[16]!==_){V=Symbol.for(`react.early_return_sentinel`);bb0:{let e=F&&typeof F==`object`&&!Array.isArray(F)?Object.entries(F):[],a;t[29]!==i||t[30]!==D?(a=D?.readme?.trim()||(D?.description?.trim()?`### ${D.name}\n\n${D.description}`:`*${i.marketplaceNoReadme}*`),t[29]=i,t[30]=D,t[31]=a):a=t[31];let c=a;if(D?.format===`agent-plugin`){let e;if(t[32]!==D||t[33]!==o){let n;t[35]===D?n=t[36]:(n=e=>e.pluginId===D.manifest?.name,t[35]=D,t[36]=n),e=o.find(n),t[32]=D,t[33]=o,t[34]=e}else e=t[34];let i=`store:${n}`,a;t[37]!==r||t[38]!==D||t[39]!==s||t[40]!==e||t[41]!==i?(a=(0,$.jsx)(ie,{extension:e,initialSource:i,marketplace:D,autoInstall:r,onClose:s}),t[37]=r,t[38]=D,t[39]=s,t[40]=e,t[41]=i,t[42]=a):a=t[42],V=a;break bb0}R=w,z=!0,t[43]===s?B=t[44]:(B=e=>!e&&s(),t[43]=s,t[44]=B),L=x,t[45]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,$.jsx)(y,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),t[45]=q):q=t[45],I=S,W=`xopc-dialog-content fixed left-1/2 top-1/2 z-[131] flex h-[min(44rem,calc(100vh-1.5rem))] w-[min(42rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay`,G=ye;let u;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,$.jsx)(ne,{className:`size-5`}),t[46]=u):u=t[46];let d;t[47]!==i.detailBack||t[48]!==s?(d=(0,$.jsx)(`button`,{type:`button`,onClick:s,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":i.detailBack,children:u}),t[47]=i.detailBack,t[48]=s,t[49]=d):d=t[49];let p;t[50]===i.marketplaceDetailTitle?p=t[51]:(p=(0,$.jsx)(C,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:i.marketplaceDetailTitle}),t[50]=i.marketplaceDetailTitle,t[51]=p);let m;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(f,{className:`size-5`}),t[52]=m):m=t[52];let h;t[53]!==i.detailClose||t[54]!==s?(h=(0,$.jsx)(`button`,{type:`button`,onClick:s,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":i.detailClose,children:m}),t[53]=i.detailClose,t[54]=s,t[55]=h):h=t[55],t[56]!==d||t[57]!==p||t[58]!==h?(K=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[d,p,h]}),t[56]=d,t[57]=p,t[58]=h,t[59]=K):K=t[59],H=`min-h-0 flex-1 overflow-y-auto p-5`,U=k&&!D?(0,$.jsxs)(`div`,{className:`space-y-4`,"aria-label":i.marketplaceLoading,children:[(0,$.jsx)(P,{className:`h-6 w-48`}),(0,$.jsx)(P,{className:`h-4 w-28`}),(0,$.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,$.jsx)(P,{className:`h-12`}),(0,$.jsx)(P,{className:`h-12`})]}),(0,$.jsx)(P,{className:`h-28 w-full`}),(0,$.jsx)(P,{className:`h-36 w-full`})]}):O?(0,$.jsxs)(`div`,{className:`rounded-lg border border-red-300/70 bg-red-50 p-4 text-sm dark:border-red-900 dark:bg-red-950/30`,children:[(0,$.jsx)(`p`,{className:`font-medium text-red-700 dark:text-red-300`,children:i.marketplaceDetailLoadFailed}),(0,$.jsx)(`p`,{className:`mt-1 break-words text-red-600 dark:text-red-400`,children:O instanceof Error?O.message:i.marketplaceLoadFailed})]}):D?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:D.name}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:(0,$.jsx)(`code`,{className:`rounded bg-surface-panel px-1 py-0.5`,children:D.id})}),(0,$.jsxs)(`dl`,{className:`mt-3 grid gap-2 text-xs text-fg-muted sm:grid-cols-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`font-medium text-fg`,children:i.marketplaceAuthor}),(0,$.jsx)(`dd`,{children:D.author.username})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`font-medium text-fg`,children:i.marketplaceVersion}),(0,$.jsx)(`dd`,{children:D.latestVersion.version})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`font-medium text-fg`,children:i.marketplaceDownloads}),(0,$.jsx)(`dd`,{children:D.downloads})]})]}),M===`bundled`?null:(0,$.jsxs)(`section`,{className:`mt-5 space-y-3 rounded-lg border border-edge bg-surface-base p-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[D.installability.available?(0,$.jsx)(re,{className:`mt-0.5 size-5 shrink-0 text-emerald-600 dark:text-emerald-400`,"aria-hidden":!0}):(0,$.jsx)(ee,{className:`mt-0.5 size-5 shrink-0 text-amber-600 dark:text-amber-400`,"aria-hidden":!0}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:D.installability.available?i.marketplaceRiskTitle:i.marketplaceUnavailableTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:D.installability.available?i.marketplaceCodeRisk:D.installability.reason??i.marketplaceUnavailableBody})]})]}),D.installability.available?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`dl`,{className:`grid gap-2 text-xs text-fg-muted sm:grid-cols-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`font-medium text-fg`,children:i.marketplaceIntegrity}),(0,$.jsx)(`dd`,{children:i.marketplaceIntegrityVerified})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`font-medium text-fg`,children:i.marketplaceDependencies}),(0,$.jsx)(`dd`,{children:D.packageSummary?.dependencyCount??0})]})]}),(0,$.jsxs)(`div`,{className:`text-xs text-fg-muted`,children:[(0,$.jsx)(`p`,{className:`font-medium text-fg`,children:i.marketplacePermissions}),e.length>0?(0,$.jsx)(`ul`,{className:`mt-1 space-y-1`,children:e.map(ve)}):(0,$.jsx)(`p`,{className:`mt-1`,children:i.marketplacePermissionsNone})]}),(D.packageSummary?.lifecycleScripts.length??0)>0?(0,$.jsxs)(`p`,{className:`text-xs leading-relaxed text-amber-700 dark:text-amber-300`,children:[i.marketplaceLifecycleScripts,`: `,D.packageSummary?.lifecycleScripts.join(`, `)]}):null,(0,$.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:_,onChange:e=>v(e.target.checked),className:`mt-0.5 size-4 rounded border-edge accent-[var(--color-accent)]`}),(0,$.jsx)(`span`,{children:i.marketplaceRiskConfirm})]})]}):null]}),D.readme?.trim()?(0,$.jsx)(`h4`,{className:`mb-2 mt-6 text-sm font-semibold text-fg`,children:i.marketplaceDetailReadmeHeading}):null,(0,$.jsx)(`div`,{className:`markdown-content min-w-0 break-words text-sm`,children:(0,$.jsx)(l,{content:c})})]}):null}t[6]=r,t[7]=i,t[8]=D,t[9]=O,t[10]=o,t[11]=M,t[12]=k,t[13]=s,t[14]=n,t[15]=F,t[16]=_,t[17]=I,t[18]=L,t[19]=R,t[20]=z,t[21]=B,t[22]=V,t[23]=H,t[24]=U,t[25]=W,t[26]=G,t[27]=K,t[28]=q}else I=t[17],L=t[18],R=t[19],z=t[20],B=t[21],V=t[22],H=t[23],U=t[24],W=t[25],G=t[26],K=t[27],q=t[28];if(V!==Symbol.for(`react.early_return_sentinel`))return V;let J;t[60]!==H||t[61]!==U?(J=(0,$.jsx)(`div`,{className:H,children:U}),t[60]=H,t[61]=U,t[62]=J):J=t[62];let Y;t[63]!==p||t[64]!==i.marketplaceBuiltinGoBuiltin||t[65]!==i.marketplaceBuiltinManageHint||t[66]!==i.marketplaceInstall||t[67]!==i.marketplaceReinstall||t[68]!==i.marketplaceReinstallConfirm||t[69]!==i.marketplaceUninstall||t[70]!==i.marketplaceUninstallConfirm||t[71]!==D||t[72]!==M||t[73]!==s||t[74]!==c||t[75]!==d||t[76]!==n||t[77]!==_||t[78]!==N?(Y=D?(0,$.jsx)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-2 border-t border-edge-subtle px-5 py-4`,children:M===`bundled`?(0,$.jsxs)(`div`,{className:`flex w-full flex-col items-stretch gap-2`,children:[(0,$.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:i.marketplaceBuiltinManageHint}),(0,$.jsx)(a,{to:`/capabilities/extensions?tab=builtin`,onClick:s,className:`inline-flex w-fit items-center justify-center rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:i.marketplaceBuiltinGoBuiltin})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`button`,{type:`button`,disabled:p||!D.installability.available||!_,onClick:()=>{N&&!window.confirm(i.marketplaceReinstallConfirm)||(g(!0),c(n,N).catch(_e).finally(()=>g(!1)))},className:m(`inline-flex items-center justify-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium`,`bg-accent text-on-accent shadow-surface hover:bg-accent-hover`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`disabled:pointer-events-none disabled:opacity-50`),children:[p?(0,$.jsx)(u,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,N?i.marketplaceReinstall:i.marketplaceInstall]}),N?(0,$.jsxs)(`button`,{type:`button`,disabled:p,onClick:()=>{window.confirm(i.marketplaceUninstallConfirm)&&(g(!0),d(n).then(()=>s()).catch(ge).finally(()=>g(!1)))},className:m(`inline-flex items-center justify-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`disabled:pointer-events-none disabled:opacity-50`),children:[(0,$.jsx)(te,{className:`size-4 shrink-0`,"aria-hidden":!0}),i.marketplaceUninstall]}):null]})}):null,t[63]=p,t[64]=i.marketplaceBuiltinGoBuiltin,t[65]=i.marketplaceBuiltinManageHint,t[66]=i.marketplaceInstall,t[67]=i.marketplaceReinstall,t[68]=i.marketplaceReinstallConfirm,t[69]=i.marketplaceUninstall,t[70]=i.marketplaceUninstallConfirm,t[71]=D,t[72]=M,t[73]=s,t[74]=c,t[75]=d,t[76]=n,t[77]=_,t[78]=N,t[79]=Y):Y=t[79];let X;t[80]!==I||t[81]!==J||t[82]!==Y||t[83]!==W||t[84]!==G||t[85]!==K?(X=(0,$.jsxs)(I,{className:W,onOpenAutoFocus:G,children:[K,J,Y]}),t[80]=I,t[81]=J,t[82]=Y,t[83]=W,t[84]=G,t[85]=K,t[86]=X):X=t[86];let Q;t[87]!==L||t[88]!==X||t[89]!==q?(Q=(0,$.jsxs)(L,{children:[q,X]}),t[87]=L,t[88]=X,t[89]=q,t[90]=Q):Q=t[90];let oe;return t[91]!==R||t[92]!==z||t[93]!==B||t[94]!==Q?(oe=(0,$.jsx)(R,{defaultOpen:z,onOpenChange:B,children:Q}),t[91]=R,t[92]=z,t[93]=B,t[94]=Q,t[95]=oe):oe=t[95],oe}function ge(){}function _e(){}function ve(e){let[t,n]=e;return(0,$.jsxs)(`li`,{className:`break-words`,children:[(0,$.jsx)(`code`,{children:t}),`: `,Array.isArray(n)?n.join(`, `):String(n)]},t)}function ye(e){return e.preventDefault()}function be(e){return!!e.conversationId}function xe({embedded:e=!1,onHeaderActionChange:t}){let n=_(e=>e.language),r=p(n),o=I(e=>e.setPageHeader),c=I(e=>e.clearPageHeader),l=D(),u=T(),[f,h]=i(),g=Q(f.get(`tab`)),v=f.get(`q`)??``,[y,b]=(0,Z.useState)(g),[x,S]=(0,Z.useState)(v),[C,w]=(0,Z.useState)(null),[E,O]=(0,Z.useState)(!1),k=f.toString(),A=(0,Z.useRef)(k);if(A.current!==k){A.current=k;let e=Q(f.get(`tab`)),t=f.get(`q`)??``;b(t=>t===e?t:e),S(e=>e===t?e:t)}(0,Z.useEffect)(()=>{h(e=>{let t=new URLSearchParams(e),n=x.trim();return n?t.set(`q`,n):t.delete(`q`),y===`marketplace`?t.delete(`tab`):t.set(`tab`,y),t.toString()===e.toString()?e:t},{replace:!0})},[y,x,h]);let N=(0,Z.useMemo)(()=>l.filter(e=>e.source===`bundled`),[l]),P=(0,Z.useMemo)(()=>l.filter(e=>e.source!==`bundled`),[l]),F=y===`builtin`?N:P,ee=(0,Z.useMemo)(()=>{let e=x.trim().toLowerCase(),t=F;return e&&(t=t.filter(t=>(t.name??``).toLowerCase().includes(e)||t.id.toLowerCase().includes(e)||(t.description??``).toLowerCase().includes(e))),t.toSorted((e,t)=>e.hasUi===t.hasUi?(e.name||e.id).localeCompare(t.name||t.id,n):e.hasUi?-1:1)},[F,x,n]);(0,Z.useEffect)(()=>{w(e=>{if(!e)return e;let t=l.find(t=>t.id===e.id);return t?Se(e)===Se(t)&&e.active===t.active&&JSON.stringify(e)===JSON.stringify(t)?e:t:null})},[l]);let L=(0,Z.useMemo)(()=>({searchLabel:y===`marketplace`?r.extensionsPage.marketplaceSearchPlaceholder:r.extensionsPage.searchPlaceholder,search:(0,$.jsx)(q,{value:x,onChange:S,placeholder:y===`marketplace`?r.extensionsPage.marketplaceSearchPlaceholder:r.extensionsPage.searchPlaceholder}),overflow:(0,$.jsxs)(B,{children:[(0,$.jsx)(K,{asChild:!0,children:(0,$.jsx)(j,{variant:`secondary`,className:`size-9 shrink-0 p-0`,"aria-label":r.capabilitiesHub.moreActions,title:r.capabilitiesHub.moreActions,children:(0,$.jsx)(s,{className:`size-4`,"aria-hidden":!0})})}),(0,$.jsx)(H,{children:(0,$.jsxs)(U,{align:`end`,sideOffset:6,className:`z-50 min-w-48 rounded-xl border border-edge bg-surface-panel p-1 shadow-popover`,children:[(0,$.jsxs)(W,{className:m(`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`,M.transition),onSelect:()=>O(!0),children:[(0,$.jsx)(d,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),n.startsWith(`zh`)?`安装插件`:`Install plugin`]}),(0,$.jsx)(W,{asChild:!0,children:(0,$.jsxs)(a,{to:`/local-apps`,className:m(`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`,M.transition),children:[(0,$.jsx)(z,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),r.extensionsPage.openLocalApps]})})]})})]}),primary:(0,$.jsx)(j,{asChild:!0,variant:`primary`,className:`h-9 shrink-0`,children:(0,$.jsxs)(a,{to:`/local-apps/new`,"aria-label":r.extensionsPage.createLocalApp,children:[(0,$.jsx)(d,{className:`size-4`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:r.extensionsPage.createLocalApp})]})})}),[n,r.capabilitiesHub.moreActions,r.extensionsPage,y,x]);if((0,Z.useLayoutEffect)(()=>e?(t?.(L),()=>t?.(null)):(o({startExtra:null,main:(0,$.jsx)(`div`,{className:`min-w-0`,children:(0,$.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:r.extensionsPage.title})}),end:(0,$.jsx)(J,{contribution:L})}),()=>c()),[c,e,L,r.extensionsPage.title,t,o]),u&&y!==`marketplace`)return(0,$.jsx)(ke,{});let te=[{id:`marketplace`,label:r.extensionsPage.tabMarketplace},{id:`builtin`,label:r.extensionsPage.tabBuiltin,count:N.length},{id:`user`,label:r.extensionsPage.tabUser,count:P.length}];return(0,$.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:[(0,$.jsxs)(`div`,{className:m(`mx-auto w-full max-w-7xl px-4 sm:px-6 lg:px-8`,`pb-7 pt-3 lg:pb-9 lg:pt-4`),children:[(0,$.jsx)(`div`,{className:`mb-6 border-b border-edge-subtle pb-3`,children:(0,$.jsx)(Y,{items:te,activeTab:y,onChange:b,ariaLabel:r.extensionsPage.extensionsNavAria,tabIdPrefix:`extensions-tab`,panelIdPrefix:`extensions-panel`,className:`flex-wrap`})}),y===`marketplace`?(0,$.jsx)(me,{query:x}):y===`builtin`&&N.length===0?(0,$.jsx)(je,{message:r.extensionsPage.emptyBuiltin}):y===`user`&&P.length===0?(0,$.jsx)(je,{message:r.extensionsPage.emptyUser}):ee.length===0?(0,$.jsx)(`p`,{className:`px-3 py-14 text-center text-sm text-fg-muted sm:px-5 xl:px-6`,children:r.extensionsPage.noSearchResults}):(0,$.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:ee.map(e=>(0,$.jsx)(Ee,{extension:e,copy:r.extensionsPage,showSourceBadge:y===`user`,onOpen:()=>w(e)},e.id))})]}),C?C.format===`agent-plugin`?(0,$.jsx)(ie,{extension:C,onClose:()=>w(null)},C.id):(0,$.jsx)(De,{extension:C,copy:r.extensionsPage,onClose:()=>w(null)},C.id):null,E?(0,$.jsx)(ie,{onClose:()=>O(!1)}):null]})}function Se(e){return e.activationEligible??e.active}function Ce(e,t){return e.source===`bundled`?t.providerBundled:e.source===`global`?t.providerGlobal:e.source===`workspace`?t.providerWorkspace:t.providerOther}function we(e,t){return e.source===`global`?t.badgeSourceGlobal:e.source===`workspace`?t.badgeSourceWorkspace:t.badgeSourceOther}function Te(e,t){let n=Se(e);return n&&e.active?t.runStateLive:n&&!e.active?t.runStatePendingOn:!n&&e.active?t.runStatePendingOff:t.runStateOff}function Ee(e){let t=(0,ae.c)(45),{extension:n,copy:r,showSourceBadge:i,onOpen:a}=e,s;t[0]===n?s=t[1]:(s=Se(n),t[0]=n,t[1]=s);let c=s,l=n.hasUi?r.cardTooltipHasUi:r.cardTooltipNoUi,u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=m(`group flex w-full flex-col rounded-xl border border-edge-subtle bg-surface-base p-4 text-left shadow-surface transition-colors`,`hover:bg-surface-hover/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`dark:hover:bg-surface-hover/25`),t[2]=u):u=t[2];let f=n.name||n.id,p;t[3]===f?p=t[4]:(p=f.charAt(0).toUpperCase(),t[3]=f,t[4]=p);let h;t[5]===p?h=t[6]:(h=(0,$.jsx)(`div`,{className:`flex size-12 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-base font-semibold text-accent-fg`,"aria-hidden":!0,children:p}),t[5]=p,t[6]=h);let g;t[7]===n.name?g=t[8]:(g=(0,$.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:n.name}),t[7]=n.name,t[8]=g);let _;t[9]===n.version?_=t[10]:(_=n.version?(0,$.jsxs)(`span`,{className:`text-[11px] text-fg-muted`,children:[`v`,n.version]}):null,t[9]=n.version,t[10]=_);let v;t[11]!==g||t[12]!==_?(v=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[g,_]}),t[11]=g,t[12]=_,t[13]=v):v=t[13];let y;t[14]!==r.statusEnabled||t[15]!==c?(y=c?(0,$.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 rounded-full bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:[(0,$.jsx)(o,{className:`size-3`,strokeWidth:2.5,"aria-hidden":!0}),r.statusEnabled]}):(0,$.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center rounded-full border-2 border-accent text-accent`,"aria-hidden":!0,children:(0,$.jsx)(d,{className:`size-4`,strokeWidth:2.5})}),t[14]=r.statusEnabled,t[15]=c,t[16]=y):y=t[16];let b;t[17]!==v||t[18]!==y?(b=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[v,y]}),t[17]=v,t[18]=y,t[19]=b):b=t[19];let x;t[20]!==r.cardNoDescription||t[21]!==n.description?(x=n.description?.trim()||r.cardNoDescription,t[20]=r.cardNoDescription,t[21]=n.description,t[22]=x):x=t[22];let S;t[23]===x?S=t[24]:(S=(0,$.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-relaxed text-fg-muted`,children:x}),t[23]=x,t[24]=S);let C=n.format===`agent-plugin`?`Agent Plugin`:n.hasUi?r.badgeKindUi:r.badgeKindBackend,w;t[25]!==C||t[26]!==l?(w=(0,$.jsx)(`span`,{title:l,className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:C}),t[25]=C,t[26]=l,t[27]=w):w=t[27];let T;t[28]!==r||t[29]!==n||t[30]!==i?(T=n.source===`bundled`?(0,$.jsx)(`span`,{className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:r.badgeBundled}):i?(0,$.jsx)(`span`,{title:Ce(n,r),className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:we(n,r)}):null,t[28]=r,t[29]=n,t[30]=i,t[31]=T):T=t[31];let E;t[32]!==w||t[33]!==T?(E=(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:[w,T]}),t[32]=w,t[33]=T,t[34]=E):E=t[34];let D;t[35]!==b||t[36]!==S||t[37]!==E?(D=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[b,S,E]}),t[35]=b,t[36]=S,t[37]=E,t[38]=D):D=t[38];let O;t[39]!==D||t[40]!==h?(O=(0,$.jsxs)(`div`,{className:`flex gap-3`,children:[h,D]}),t[39]=D,t[40]=h,t[41]=O):O=t[41];let k;return t[42]!==a||t[43]!==O?(k=(0,$.jsx)(`button`,{type:`button`,onClick:a,className:u,children:O}),t[42]=a,t[43]=O,t[44]=k):k=t[44],k}function De({extension:e,copy:t,onClose:n}){let{mutate:r}=k(),[i,o]=(0,Z.useState)(null),[s,l]=(0,Z.useState)(null),[d,p]=(0,Z.useState)(!1),h=e.activationEligible===!0,g=(0,Z.useCallback)(async()=>{l(null),p(!1),o(`toggle`);try{let{requiresGatewayRestart:t}=await ue({extensionId:e.id,enabled:!h});await r(`gateway-extensions-list`),N(),p(t)}catch(e){l(e instanceof Error?e.message:t.extensionToggleFailed)}finally{o(null)}},[h,t.extensionToggleFailed,e.id,r]),_=(0,Z.useCallback)(async()=>{if(!(e.source===`bundled`||!window.confirm(t.extensionUninstallConfirm))){l(null),p(!1),o(`uninstall`);try{await de(e.id),await r(`gateway-extensions-list`),N(),n()}catch(e){l(e instanceof Error?e.message:t.marketplaceUninstallFailed),o(null)}}},[t.extensionUninstallConfirm,t.marketplaceUninstallFailed,e.id,e.source,r,n]),v=e.ui?.contributions?.pages??[],T=e.ui?.contributions?.settingsPanels??[],D=e.ui?.contributions?.chatWidgets??[],A=v.find(e=>e.showInNav)??v[0],M=T[0],P=A?V(e.id,A):null,F=M?`/settings/ext/${e.id}/${M.id}`:e.hasConfigSchema||E(e)?`/settings/ext/${e.id}`:null;return(0,$.jsx)(w,{defaultOpen:!0,onOpenChange:e=>!e&&n(),children:(0,$.jsxs)(x,{children:[(0,$.jsx)(y,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),(0,$.jsxs)(S,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[131] flex max-h-[min(90vh,44rem)] w-[min(42rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:n,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":t.detailBack,children:(0,$.jsx)(ne,{className:`size-5`})}),(0,$.jsx)(C,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:t.detailTitle}),(0,$.jsxs)(b,{className:`sr-only`,children:[e.name,` (`,e.id,`)`]}),(0,$.jsx)(`button`,{type:`button`,onClick:n,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":t.detailClose,children:(0,$.jsx)(f,{className:`size-5`})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start gap-4`,children:[(0,$.jsx)(`div`,{className:`flex size-16 shrink-0 items-center justify-center rounded-2xl bg-accent-soft text-xl font-semibold text-accent-fg`,"aria-hidden":!0,children:(e.name||e.id).charAt(0).toUpperCase()}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:e.name}),(0,$.jsxs)(`p`,{className:`mt-0.5 text-sm text-fg-muted`,children:[t.detailProviderPrefix,` `,Ce(e,t)]}),e.version?(0,$.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[`v`,e.version]}):null]})]}),(0,$.jsx)(`p`,{className:`mt-5 text-sm leading-relaxed text-fg`,children:e.description?.trim()||t.detailNoDescription}),e.hasUi?null:(0,$.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:t.backendOnlyHint}),(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:Te(e,t)}),e.source===`bundled`?(0,$.jsx)(`p`,{className:`mt-4 rounded-lg bg-surface-hover/40 px-3 py-2 text-xs text-fg-muted shadow-surface dark:bg-surface-hover/20`,children:t.builtinConfigHint}):null,(0,$.jsxs)(`div`,{className:`mt-3 rounded-lg bg-surface-hover/40 p-3 shadow-surface dark:bg-surface-hover/20`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:t.builtinRuntimeToggle}),(0,$.jsx)(j,{type:`button`,variant:`secondary`,disabled:i!==null,onClick:()=>void g(),className:`shrink-0 py-1.5 text-xs`,children:i===`toggle`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(u,{className:`mr-1.5 size-3.5 shrink-0 animate-spin`,"aria-hidden":!0}),t.builtinToggleBusy]}):h?t.builtinToggleDisable:t.builtinToggleEnable})]}),s?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-rose-600 dark:text-rose-400`,children:s}):null,d?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.builtinToggleRestartHint}):null,e.source===`bundled`?null:(0,$.jsx)(`div`,{className:`mt-3 flex justify-end border-t border-edge-subtle pt-3`,children:(0,$.jsxs)(j,{type:`button`,variant:`ghost`,disabled:i!==null,onClick:()=>void _(),className:`text-danger hover:bg-danger-soft hover:text-danger`,children:[i===`uninstall`?(0,$.jsx)(u,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,$.jsx)(te,{className:`size-3.5`,"aria-hidden":!0}),t.marketplaceUninstall]})})]}),e.hasUi&&(v.length>0||T.length>0||D.length>0)?(0,$.jsxs)(`section`,{className:`mt-8`,children:[(0,$.jsx)(`h4`,{className:`mb-3 text-sm font-semibold text-fg`,children:t.detailSectionFeatures}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[(0,$.jsx)(Oe,{template:t.badgePages,count:v.length,hidden:v.length===0}),(0,$.jsx)(Oe,{template:t.badgeSettings,count:T.length,hidden:T.length===0}),(0,$.jsx)(Oe,{template:t.badgeWidgets,count:D.length,hidden:D.length===0})]})]}):null,O(e)&&(P||F)?(0,$.jsxs)(`div`,{className:`mt-6 flex flex-wrap gap-2 border-t border-edge-subtle pt-4`,children:[P?(0,$.jsxs)(a,{to:P,onClick:n,className:m(`inline-flex items-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:[(0,$.jsx)(c,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.open]}):null,F?(0,$.jsxs)(a,{to:F,onClick:n,className:m(`inline-flex items-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:[(0,$.jsx)(G,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.openSettings]}):null]}):null,(0,$.jsx)(`p`,{className:`mt-6 text-[11px] leading-relaxed text-fg-muted`,children:t.restartNote})]})]})]})})}function Oe(e){let t=(0,ae.c)(6),{template:n,count:r,hidden:i}=e;if(i||r===0)return null;let a;if(t[0]!==r||t[1]!==n){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=/\{\{count\}\}/g,t[3]=e):e=t[3],a=n.replace(e,String(r)),t[0]=r,t[1]=n,t[2]=a}else a=t[2];let o;return t[4]===a?o=t[5]:(o=(0,$.jsx)(`span`,{className:`inline-flex items-center rounded-md bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:a}),t[4]=a,t[5]=o),o}function ke(){let e=(0,ae.c)(5),t,n,r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(`div`,{className:`mb-6 h-8 w-40 max-w-full animate-pulse rounded-md bg-surface-hover`}),n=(0,$.jsx)(`div`,{className:`mb-2 h-4 w-full max-w-md animate-pulse rounded bg-surface-hover`}),r=(0,$.jsx)(`div`,{className:`mb-5 h-9 w-full max-w-lg animate-pulse rounded-full bg-surface-hover`}),e[0]=t,e[1]=n,e[2]=r):(t=e[0],n=e[1],r=e[2]);let i;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=[`ap0`,`ap1`,`ap2`,`ap3`,`ap4`,`ap5`],e[3]=i):i=e[3];let a;return e[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:(0,$.jsxs)(`div`,{className:`w-full px-3 pb-8 pt-3 sm:px-5 lg:pt-4 xl:px-6`,children:[t,n,r,(0,$.jsx)(`div`,{className:`mt-6 grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:i.map(Ae)})]})}),e[4]=a):a=e[4],a}function Ae(e){return(0,$.jsx)(`div`,{className:`h-36 animate-pulse rounded-xl border border-edge-subtle bg-surface-base shadow-surface`},e)}function je(e){let t=(0,ae.c)(2),{message:n}=e,r;return t[0]===n?r=t[1]:(r=(0,$.jsx)(`div`,{className:`flex min-h-[min(40vh,16rem)] flex-col items-center justify-center rounded-xl border border-edge-subtle bg-surface-base px-4 py-12 text-center shadow-surface`,children:(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n})}),t[0]=n,t[1]=r),r}export{xe as ExtensionsPage};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{_ as i,t as a}from"./chunk-KS7C4IRE--EKdQGRF.js";import{t as o}from"./check-DUBLcKHA.js";import{t as s}from"./ellipsis-0k4rZLoy.js";import{t as c}from"./external-link-DjqjBmc3.js";import{t as l}from"./markdown-view-IsYTotu6.js";import{t as u}from"./loader-circle-CifKLtgG.js";import{t as d}from"./plus-Q2yW6OE7.js";import{t as f}from"./x-B_N4OPjy.js";import{t as p}from"./messages-CKTo_sIF.js";import{t as m}from"./cn-0WouolD0.js";import{c as h,i as g,n as _,r as v}from"./locale-store-BpK9AiDq.js";import{a as y,i as b,o as x,r as S,s as C,t as w}from"./dist-BGTk37IG.js";import{i as T,o as E,r as D,s as O}from"./extension-provider-B1PQGTtY.js";import{a as k,i as A}from"./vendor-swr-BIWyz7Rc.js";import{t as j}from"./button-aIC072nz.js";import{n as M}from"./interaction-BdhHBbYa.js";import{o as N}from"./gateway-realtime-DghCGfY_.js";import{t as P}from"./skeleton-BI5TyibZ.js";import{r as F}from"./settings-form-draft-Dy10ldo8.js";import{Ca as I,Es as L,No as ee,Po as te,ar as R,dl as ne,el as z,es as re,ha as B,ir as V,nr as H,ns as U,qc as W,rr as G,sr as K}from"./index-DFgXwLsv.js";import{n as q,t as J}from"./capability-header-actions-xzjWZVbg.js";import{t as Y}from"./page-tabs-HLrKIjXH.js";import{t as ie}from"./agent-plugin-dialog-0SlvsYl7.js";import{t as X}from"./capability-icon-DVoZxEgW.js";var Z=e(t(),1),ae=n();function Q(e){return e===`builtin`||e===`user`?e:`marketplace`}async function oe(e=``){let t=await g(v(`/api/marketplace${e.trim()?`?q=${encodeURIComponent(e.trim())}`:``}`),{cache:`no-store`});if(!t.ok)throw Error(await se(t));let n=await t.json();if(!n.ok||!Array.isArray(n.extensions))throw Error(n.error??`Invalid response`);return n.extensions}async function se(e){try{let t=await e.json();if(typeof t.error==`string`)return t.error;if(t.error&&typeof t.error==`object`&&typeof t.error.message==`string`)return t.error.message;if(typeof t.message==`string`)return t.message}catch{}return e.statusText||`HTTP ${e.status}`}async function ce(e){let t=await g(v(`/api/marketplace/packages/${encodeURIComponent(e.trim())}`),{cache:`no-store`});if(!t.ok)throw Error(await se(t));let n=await t.json();if(!n.ok||!n.payload?.id)throw Error(n.error??`Invalid response`);return n.payload}async function le(e){let t=await g(v(`/api/marketplace/install`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await se(t));let n=await t.json();if(!n.ok||!n.payload?.extensionId)throw Error(n.error??`Invalid response`);return n.payload}async function ue(e){let t=await g(v(`/api/extensions/${encodeURIComponent(e.extensionId.trim())}/activation`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({enabled:e.enabled})});if(!t.ok)throw Error(await se(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error?.message??`Invalid response`);return n.payload}async function de(e){let t=await g(v(`/api/marketplace/uninstall`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({extensionId:e})});if(!t.ok)throw Error(await se(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error??`Invalid response`);return n.payload}var $=r();function fe(e,t){let n=e.find(e=>e.id===t||e.pluginId===t);return n?n.source===`bundled`?`bundled`:`user`:`absent`}var pe={debounced:``,detailPkg:null,quickInstallPkg:null,rowBusy:null,actionError:null,restartHint:null};function me({className:e,query:t}){let n=_(e=>e.language),r=p(n).extensionsPage,i=h(e=>!!e.conversationId),a=D(),{mutate:o}=k(),[s,c]=(0,Z.useReducer)(F,pe),{debounced:l,detailPkg:d,quickInstallPkg:f,rowBusy:g,actionError:v,restartHint:y}=s,b=i?`marketplace-${l}`:null;(0,Z.useEffect)(()=>{let e=window.setTimeout(()=>c({type:`patch`,patch:{debounced:t.trim()}}),300);return()=>window.clearTimeout(e)},[t]);let{data:x,isLoading:S,error:C}=A(b,()=>oe(l),{revalidateOnFocus:!1}),w=(0,Z.useCallback)(()=>{o(`gateway-extensions-list`),N()},[o]),T=(0,Z.useCallback)(async(e,t)=>{c({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let n=await le({name:e,overwrite:t});w(),n.requiresGatewayRestart&&c({type:`patch`,patch:{restartHint:r.marketplaceRestartHint}})}catch(e){throw c({type:`patch`,patch:{actionError:e instanceof Error?e.message:r.marketplaceInstallFailed}}),e}finally{c({type:`patch`,patch:{rowBusy:null}})}},[r.marketplaceInstallFailed,r.marketplaceRestartHint,w]),E=(0,Z.useCallback)(async e=>{c({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let t=await de(e);w(),t.requiresGatewayRestart&&c({type:`patch`,patch:{restartHint:r.marketplaceRestartHint}})}catch(e){throw c({type:`patch`,patch:{actionError:e instanceof Error?e.message:r.marketplaceUninstallFailed}}),e}finally{c({type:`patch`,patch:{rowBusy:null}})}},[r.marketplaceRestartHint,r.marketplaceUninstallFailed,w]),O=x??[];return(0,$.jsxs)(`div`,{className:m(`flex flex-col gap-4`,e),children:[C?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:C instanceof Error?C.message:r.marketplaceLoadFailed}):null,v?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:v}):null,y?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:y}):null,S&&!x?(0,$.jsx)(`ul`,{className:`flex flex-col gap-3`,"aria-label":r.marketplaceLoading,children:[0,1,2].map(e=>(0,$.jsx)(`li`,{className:`rounded-xl bg-surface-panel p-4 shadow-surface`,children:(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2.5`,children:[(0,$.jsx)(P,{className:`h-5 w-40`}),(0,$.jsx)(P,{className:`h-4 w-full max-w-xl`}),(0,$.jsx)(P,{className:`h-4 w-2/3 max-w-md`})]}),(0,$.jsx)(P,{className:`h-8 w-20`})]})},e))}):(0,$.jsx)(`ul`,{className:`flex flex-col gap-3`,children:O.length===0?(0,$.jsx)(`li`,{className:`text-sm text-fg-muted`,children:r.marketplaceEmpty}):O.map(e=>{let t=fe(a,e.id),i=g===e.id,o=e.localizations?.[n.startsWith(`zh`)?`zh-CN`:`en`],s=o?.displayName??e.name,l=o?.description??e.description;return(0,$.jsx)(`li`,{className:`list-none`,children:(0,$.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-label":`${s}, ${r.marketplaceDetailTitle}`,onClick:()=>c({type:`patch`,patch:{detailPkg:e.id}}),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),c({type:`patch`,patch:{detailPkg:e.id}}))},className:m(`flex w-full cursor-pointer flex-wrap items-start gap-3 rounded-xl bg-surface-panel p-4 text-left shadow-surface`,`transition-[transform,background-color,box-shadow] duration-150 ease-out`,`hover:bg-surface-hover/40`,`active:scale-[0.992] active:bg-surface-hover/55`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`dark:hover:bg-surface-hover/25 dark:active:bg-surface-hover/35`),children:[(0,$.jsx)(X,{iconUrl:e.branding?.iconUrl,fallback:L}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`h3`,{className:`truncate font-semibold text-fg`,children:s}),s===e.id?null:(0,$.jsx)(`p`,{className:`truncate font-mono text-[10px] text-fg-subtle`,children:e.id})]}),e.verified?(0,$.jsx)(W,{className:`size-4 shrink-0 text-emerald-600 dark:text-emerald-400`,strokeWidth:1.75,"aria-label":`Verified`}):null,e.version?(0,$.jsx)(`span`,{className:`text-xs text-fg-muted`,children:e.version}):null]}),l?(0,$.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm text-fg-muted`,children:l}):null,(0,$.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:(e.categories??[]).map(e=>(0,$.jsx)(`span`,{className:`rounded-md border border-edge bg-surface-panel px-2 py-0.5 text-[11px] text-fg-muted`,children:e},e))}),(0,$.jsxs)(`p`,{className:`mt-2 flex items-center gap-1.5 text-xs text-fg-muted`,children:[(0,$.jsx)(L,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),(0,$.jsx)(`code`,{className:`rounded bg-surface-panel px-1 py-0.5`,children:e.npmPackage})]})]}),(0,$.jsx)(`div`,{role:`group`,className:`flex shrink-0 flex-col items-end gap-2 sm:min-w-[9rem]`,onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),children:t===`bundled`?(0,$.jsx)(`span`,{className:`rounded-md bg-surface-hover px-2 py-1 text-[11px] font-medium text-fg-muted`,children:r.marketplaceBuiltin}):t===`user`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`text-[11px] font-medium text-fg-muted`,children:r.marketplaceInstalled}),e.packageType===`plugin`?(0,$.jsx)(`button`,{type:`button`,onClick:()=>c({type:`patch`,patch:{detailPkg:e.id,quickInstallPkg:null}}),className:m(`inline-flex items-center justify-center rounded-lg border border-edge px-3 py-2 text-xs font-medium text-fg`,`transition-colors active:scale-[0.98] active:bg-surface-hover/80`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:n.startsWith(`zh`)?`管理`:`Manage`}):(0,$.jsxs)(`button`,{type:`button`,disabled:i,onClick:()=>{window.confirm(r.marketplaceUninstallConfirm)&&E(e.id).catch(()=>{})},className:m(`inline-flex items-center justify-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-xs font-medium text-fg`,`transition-colors active:scale-[0.98] active:bg-surface-hover/80`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`disabled:pointer-events-none disabled:opacity-50`),children:[i?(0,$.jsx)(u,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,$.jsx)(te,{className:`size-3.5`,strokeWidth:2,"aria-hidden":!0}),r.marketplaceUninstall]})]}):(0,$.jsx)(`button`,{type:`button`,onClick:()=>c({type:`patch`,patch:e.packageType===`plugin`?{detailPkg:e.id,quickInstallPkg:e.id}:{detailPkg:e.id,quickInstallPkg:null}}),className:m(`inline-flex w-full items-center justify-center rounded-lg border border-edge px-3 py-2 text-xs font-medium text-fg`,`transition-[transform,background-color] active:scale-[0.98]`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:e.packageType===`plugin`?n.startsWith(`zh`)?`安装`:`Install`:r.marketplaceReview})})]})},e.id)})}),d?(0,$.jsx)(he,{packageName:d,autoInstall:f===d,copy:r,extensions:a,onClose:()=>c({type:`patch`,patch:{detailPkg:null,quickInstallPkg:null}}),onInstall:T,onUninstall:E}):null]})}function he(e){let t=(0,ae.c)(96),{packageName:n,autoInstall:r,copy:i,extensions:o,onClose:s,onInstall:c,onUninstall:d}=e,[p,g]=(0,Z.useState)(!1),[_,v]=(0,Z.useState)(!1),b=h(be)?`ext-mp-detail-${n}`:null,T;t[0]===n?T=t[1]:(T=async()=>ce(n),t[0]=n,t[1]=T);let E;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(E={revalidateOnFocus:!1},t[2]=E):E=t[2];let{data:D,error:O,isLoading:k}=A(b,T,E),j;t[3]!==o||t[4]!==n?(j=fe(o,n),t[3]=o,t[4]=n,t[5]=j):j=t[5];let M=j,N=M===`user`,F=D?.manifest?.permissions,I,L,R,z,B,V,H,U,W,G,K,q;if(t[6]!==r||t[7]!==i||t[8]!==D||t[9]!==O||t[10]!==o||t[11]!==M||t[12]!==k||t[13]!==s||t[14]!==n||t[15]!==F||t[16]!==_){V=Symbol.for(`react.early_return_sentinel`);bb0:{let e=F&&typeof F==`object`&&!Array.isArray(F)?Object.entries(F):[],a;t[29]!==i||t[30]!==D?(a=D?.readme?.trim()||(D?.description?.trim()?`### ${D.name}\n\n${D.description}`:`*${i.marketplaceNoReadme}*`),t[29]=i,t[30]=D,t[31]=a):a=t[31];let c=a;if(D?.format===`agent-plugin`){let e;if(t[32]!==D||t[33]!==o){let n;t[35]===D?n=t[36]:(n=e=>e.pluginId===D.manifest?.name,t[35]=D,t[36]=n),e=o.find(n),t[32]=D,t[33]=o,t[34]=e}else e=t[34];let i=`store:${n}`,a;t[37]!==r||t[38]!==D||t[39]!==s||t[40]!==e||t[41]!==i?(a=(0,$.jsx)(ie,{extension:e,initialSource:i,marketplace:D,autoInstall:r,onClose:s}),t[37]=r,t[38]=D,t[39]=s,t[40]=e,t[41]=i,t[42]=a):a=t[42],V=a;break bb0}R=w,z=!0,t[43]===s?B=t[44]:(B=e=>!e&&s(),t[43]=s,t[44]=B),L=x,t[45]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,$.jsx)(y,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),t[45]=q):q=t[45],I=S,W=`xopc-dialog-content fixed left-1/2 top-1/2 z-[131] flex h-[min(44rem,calc(100vh-1.5rem))] w-[min(42rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay`,G=ye;let u;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,$.jsx)(ne,{className:`size-5`}),t[46]=u):u=t[46];let d;t[47]!==i.detailBack||t[48]!==s?(d=(0,$.jsx)(`button`,{type:`button`,onClick:s,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":i.detailBack,children:u}),t[47]=i.detailBack,t[48]=s,t[49]=d):d=t[49];let p;t[50]===i.marketplaceDetailTitle?p=t[51]:(p=(0,$.jsx)(C,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:i.marketplaceDetailTitle}),t[50]=i.marketplaceDetailTitle,t[51]=p);let m;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(f,{className:`size-5`}),t[52]=m):m=t[52];let h;t[53]!==i.detailClose||t[54]!==s?(h=(0,$.jsx)(`button`,{type:`button`,onClick:s,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":i.detailClose,children:m}),t[53]=i.detailClose,t[54]=s,t[55]=h):h=t[55],t[56]!==d||t[57]!==p||t[58]!==h?(K=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[d,p,h]}),t[56]=d,t[57]=p,t[58]=h,t[59]=K):K=t[59],H=`min-h-0 flex-1 overflow-y-auto p-5`,U=k&&!D?(0,$.jsxs)(`div`,{className:`space-y-4`,"aria-label":i.marketplaceLoading,children:[(0,$.jsx)(P,{className:`h-6 w-48`}),(0,$.jsx)(P,{className:`h-4 w-28`}),(0,$.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,$.jsx)(P,{className:`h-12`}),(0,$.jsx)(P,{className:`h-12`})]}),(0,$.jsx)(P,{className:`h-28 w-full`}),(0,$.jsx)(P,{className:`h-36 w-full`})]}):O?(0,$.jsxs)(`div`,{className:`rounded-lg border border-red-300/70 bg-red-50 p-4 text-sm dark:border-red-900 dark:bg-red-950/30`,children:[(0,$.jsx)(`p`,{className:`font-medium text-red-700 dark:text-red-300`,children:i.marketplaceDetailLoadFailed}),(0,$.jsx)(`p`,{className:`mt-1 break-words text-red-600 dark:text-red-400`,children:O instanceof Error?O.message:i.marketplaceLoadFailed})]}):D?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:D.name}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:(0,$.jsx)(`code`,{className:`rounded bg-surface-panel px-1 py-0.5`,children:D.id})}),(0,$.jsxs)(`dl`,{className:`mt-3 grid gap-2 text-xs text-fg-muted sm:grid-cols-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`font-medium text-fg`,children:i.marketplaceAuthor}),(0,$.jsx)(`dd`,{children:D.author.username})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`font-medium text-fg`,children:i.marketplaceVersion}),(0,$.jsx)(`dd`,{children:D.latestVersion.version})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`font-medium text-fg`,children:i.marketplaceDownloads}),(0,$.jsx)(`dd`,{children:D.downloads})]})]}),M===`bundled`?null:(0,$.jsxs)(`section`,{className:`mt-5 space-y-3 rounded-lg border border-edge bg-surface-base p-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[D.installability.available?(0,$.jsx)(re,{className:`mt-0.5 size-5 shrink-0 text-emerald-600 dark:text-emerald-400`,"aria-hidden":!0}):(0,$.jsx)(ee,{className:`mt-0.5 size-5 shrink-0 text-amber-600 dark:text-amber-400`,"aria-hidden":!0}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:D.installability.available?i.marketplaceRiskTitle:i.marketplaceUnavailableTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:D.installability.available?i.marketplaceCodeRisk:D.installability.reason??i.marketplaceUnavailableBody})]})]}),D.installability.available?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`dl`,{className:`grid gap-2 text-xs text-fg-muted sm:grid-cols-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`font-medium text-fg`,children:i.marketplaceIntegrity}),(0,$.jsx)(`dd`,{children:i.marketplaceIntegrityVerified})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`font-medium text-fg`,children:i.marketplaceDependencies}),(0,$.jsx)(`dd`,{children:D.packageSummary?.dependencyCount??0})]})]}),(0,$.jsxs)(`div`,{className:`text-xs text-fg-muted`,children:[(0,$.jsx)(`p`,{className:`font-medium text-fg`,children:i.marketplacePermissions}),e.length>0?(0,$.jsx)(`ul`,{className:`mt-1 space-y-1`,children:e.map(ve)}):(0,$.jsx)(`p`,{className:`mt-1`,children:i.marketplacePermissionsNone})]}),(D.packageSummary?.lifecycleScripts.length??0)>0?(0,$.jsxs)(`p`,{className:`text-xs leading-relaxed text-amber-700 dark:text-amber-300`,children:[i.marketplaceLifecycleScripts,`: `,D.packageSummary?.lifecycleScripts.join(`, `)]}):null,(0,$.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:_,onChange:e=>v(e.target.checked),className:`mt-0.5 size-4 rounded border-edge accent-[var(--color-accent)]`}),(0,$.jsx)(`span`,{children:i.marketplaceRiskConfirm})]})]}):null]}),D.readme?.trim()?(0,$.jsx)(`h4`,{className:`mb-2 mt-6 text-sm font-semibold text-fg`,children:i.marketplaceDetailReadmeHeading}):null,(0,$.jsx)(`div`,{className:`markdown-content min-w-0 break-words text-sm`,children:(0,$.jsx)(l,{content:c})})]}):null}t[6]=r,t[7]=i,t[8]=D,t[9]=O,t[10]=o,t[11]=M,t[12]=k,t[13]=s,t[14]=n,t[15]=F,t[16]=_,t[17]=I,t[18]=L,t[19]=R,t[20]=z,t[21]=B,t[22]=V,t[23]=H,t[24]=U,t[25]=W,t[26]=G,t[27]=K,t[28]=q}else I=t[17],L=t[18],R=t[19],z=t[20],B=t[21],V=t[22],H=t[23],U=t[24],W=t[25],G=t[26],K=t[27],q=t[28];if(V!==Symbol.for(`react.early_return_sentinel`))return V;let J;t[60]!==H||t[61]!==U?(J=(0,$.jsx)(`div`,{className:H,children:U}),t[60]=H,t[61]=U,t[62]=J):J=t[62];let Y;t[63]!==p||t[64]!==i.marketplaceBuiltinGoBuiltin||t[65]!==i.marketplaceBuiltinManageHint||t[66]!==i.marketplaceInstall||t[67]!==i.marketplaceReinstall||t[68]!==i.marketplaceReinstallConfirm||t[69]!==i.marketplaceUninstall||t[70]!==i.marketplaceUninstallConfirm||t[71]!==D||t[72]!==M||t[73]!==s||t[74]!==c||t[75]!==d||t[76]!==n||t[77]!==_||t[78]!==N?(Y=D?(0,$.jsx)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-2 border-t border-edge-subtle px-5 py-4`,children:M===`bundled`?(0,$.jsxs)(`div`,{className:`flex w-full flex-col items-stretch gap-2`,children:[(0,$.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:i.marketplaceBuiltinManageHint}),(0,$.jsx)(a,{to:`/capabilities/extensions?tab=builtin`,onClick:s,className:`inline-flex w-fit items-center justify-center rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:i.marketplaceBuiltinGoBuiltin})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`button`,{type:`button`,disabled:p||!D.installability.available||!_,onClick:()=>{N&&!window.confirm(i.marketplaceReinstallConfirm)||(g(!0),c(n,N).catch(_e).finally(()=>g(!1)))},className:m(`inline-flex items-center justify-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium`,`bg-accent text-on-accent shadow-surface hover:bg-accent-hover`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`disabled:pointer-events-none disabled:opacity-50`),children:[p?(0,$.jsx)(u,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,N?i.marketplaceReinstall:i.marketplaceInstall]}),N?(0,$.jsxs)(`button`,{type:`button`,disabled:p,onClick:()=>{window.confirm(i.marketplaceUninstallConfirm)&&(g(!0),d(n).then(()=>s()).catch(ge).finally(()=>g(!1)))},className:m(`inline-flex items-center justify-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`disabled:pointer-events-none disabled:opacity-50`),children:[(0,$.jsx)(te,{className:`size-4 shrink-0`,"aria-hidden":!0}),i.marketplaceUninstall]}):null]})}):null,t[63]=p,t[64]=i.marketplaceBuiltinGoBuiltin,t[65]=i.marketplaceBuiltinManageHint,t[66]=i.marketplaceInstall,t[67]=i.marketplaceReinstall,t[68]=i.marketplaceReinstallConfirm,t[69]=i.marketplaceUninstall,t[70]=i.marketplaceUninstallConfirm,t[71]=D,t[72]=M,t[73]=s,t[74]=c,t[75]=d,t[76]=n,t[77]=_,t[78]=N,t[79]=Y):Y=t[79];let X;t[80]!==I||t[81]!==J||t[82]!==Y||t[83]!==W||t[84]!==G||t[85]!==K?(X=(0,$.jsxs)(I,{className:W,onOpenAutoFocus:G,children:[K,J,Y]}),t[80]=I,t[81]=J,t[82]=Y,t[83]=W,t[84]=G,t[85]=K,t[86]=X):X=t[86];let Q;t[87]!==L||t[88]!==X||t[89]!==q?(Q=(0,$.jsxs)(L,{children:[q,X]}),t[87]=L,t[88]=X,t[89]=q,t[90]=Q):Q=t[90];let oe;return t[91]!==R||t[92]!==z||t[93]!==B||t[94]!==Q?(oe=(0,$.jsx)(R,{defaultOpen:z,onOpenChange:B,children:Q}),t[91]=R,t[92]=z,t[93]=B,t[94]=Q,t[95]=oe):oe=t[95],oe}function ge(){}function _e(){}function ve(e){let[t,n]=e;return(0,$.jsxs)(`li`,{className:`break-words`,children:[(0,$.jsx)(`code`,{children:t}),`: `,Array.isArray(n)?n.join(`, `):String(n)]},t)}function ye(e){return e.preventDefault()}function be(e){return!!e.conversationId}function xe({embedded:e=!1,onHeaderActionChange:t}){let n=_(e=>e.language),r=p(n),o=I(e=>e.setPageHeader),c=I(e=>e.clearPageHeader),l=D(),u=T(),[f,h]=i(),g=Q(f.get(`tab`)),v=f.get(`q`)??``,[y,b]=(0,Z.useState)(g),[x,S]=(0,Z.useState)(v),[C,w]=(0,Z.useState)(null),[E,O]=(0,Z.useState)(!1),k=f.toString(),A=(0,Z.useRef)(k);if(A.current!==k){A.current=k;let e=Q(f.get(`tab`)),t=f.get(`q`)??``;b(t=>t===e?t:e),S(e=>e===t?e:t)}(0,Z.useEffect)(()=>{h(e=>{let t=new URLSearchParams(e),n=x.trim();return n?t.set(`q`,n):t.delete(`q`),y===`marketplace`?t.delete(`tab`):t.set(`tab`,y),t.toString()===e.toString()?e:t},{replace:!0})},[y,x,h]);let N=(0,Z.useMemo)(()=>l.filter(e=>e.source===`bundled`),[l]),P=(0,Z.useMemo)(()=>l.filter(e=>e.source!==`bundled`),[l]),F=y===`builtin`?N:P,L=(0,Z.useMemo)(()=>{let e=x.trim().toLowerCase(),t=F;return e&&(t=t.filter(t=>(t.name??``).toLowerCase().includes(e)||t.id.toLowerCase().includes(e)||(t.description??``).toLowerCase().includes(e))),t.toSorted((e,t)=>e.hasUi===t.hasUi?(e.name||e.id).localeCompare(t.name||t.id,n):e.hasUi?-1:1)},[F,x,n]);(0,Z.useEffect)(()=>{w(e=>{if(!e)return e;let t=l.find(t=>t.id===e.id);return t?Se(e)===Se(t)&&e.active===t.active&&JSON.stringify(e)===JSON.stringify(t)?e:t:null})},[l]);let ee=(0,Z.useMemo)(()=>({searchLabel:y===`marketplace`?r.extensionsPage.marketplaceSearchPlaceholder:r.extensionsPage.searchPlaceholder,search:(0,$.jsx)(q,{value:x,onChange:S,placeholder:y===`marketplace`?r.extensionsPage.marketplaceSearchPlaceholder:r.extensionsPage.searchPlaceholder}),overflow:(0,$.jsxs)(R,{children:[(0,$.jsx)(K,{asChild:!0,children:(0,$.jsx)(j,{variant:`secondary`,className:`size-9 shrink-0 p-0`,"aria-label":r.capabilitiesHub.moreActions,title:r.capabilitiesHub.moreActions,children:(0,$.jsx)(s,{className:`size-4`,"aria-hidden":!0})})}),(0,$.jsx)(V,{children:(0,$.jsxs)(H,{align:`end`,sideOffset:6,className:`z-50 min-w-48 rounded-xl border border-edge bg-surface-panel p-1 shadow-popover`,children:[(0,$.jsxs)(G,{className:m(`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`,M.transition),onSelect:()=>O(!0),children:[(0,$.jsx)(d,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),n.startsWith(`zh`)?`安装插件`:`Install plugin`]}),(0,$.jsx)(G,{asChild:!0,children:(0,$.jsxs)(a,{to:`/local-apps`,className:m(`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`,M.transition),children:[(0,$.jsx)(z,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),r.extensionsPage.openLocalApps]})})]})})]}),primary:(0,$.jsx)(j,{asChild:!0,variant:`primary`,className:`h-9 shrink-0`,children:(0,$.jsxs)(a,{to:`/local-apps/new`,"aria-label":r.extensionsPage.createLocalApp,children:[(0,$.jsx)(d,{className:`size-4`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:r.extensionsPage.createLocalApp})]})})}),[n,r.capabilitiesHub.moreActions,r.extensionsPage,y,x]);if((0,Z.useLayoutEffect)(()=>e?(t?.(ee),()=>t?.(null)):(o({startExtra:null,main:(0,$.jsx)(`div`,{className:`min-w-0`,children:(0,$.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:r.extensionsPage.title})}),end:(0,$.jsx)(J,{contribution:ee})}),()=>c()),[c,e,ee,r.extensionsPage.title,t,o]),u&&y!==`marketplace`)return(0,$.jsx)(ke,{});let te=[{id:`marketplace`,label:r.extensionsPage.tabMarketplace},{id:`builtin`,label:r.extensionsPage.tabBuiltin,count:N.length},{id:`user`,label:r.extensionsPage.tabUser,count:P.length}];return(0,$.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:[(0,$.jsxs)(`div`,{className:m(`mx-auto w-full max-w-7xl px-4 sm:px-6 lg:px-8`,`pb-7 pt-3 lg:pb-9 lg:pt-4`),children:[(0,$.jsx)(`div`,{className:`mb-6 border-b border-edge-subtle pb-3`,children:(0,$.jsx)(Y,{items:te,activeTab:y,onChange:b,ariaLabel:r.extensionsPage.extensionsNavAria,tabIdPrefix:`extensions-tab`,panelIdPrefix:`extensions-panel`,className:`flex-wrap`})}),y===`marketplace`?(0,$.jsx)(me,{query:x}):y===`builtin`&&N.length===0?(0,$.jsx)(je,{message:r.extensionsPage.emptyBuiltin}):y===`user`&&P.length===0?(0,$.jsx)(je,{message:r.extensionsPage.emptyUser}):L.length===0?(0,$.jsx)(`p`,{className:`px-3 py-14 text-center text-sm text-fg-muted sm:px-5 xl:px-6`,children:r.extensionsPage.noSearchResults}):(0,$.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:L.map(e=>(0,$.jsx)(Ee,{extension:e,copy:r.extensionsPage,showSourceBadge:y===`user`,onOpen:()=>w(e)},e.id))})]}),C?C.format===`agent-plugin`?(0,$.jsx)(ie,{extension:C,onClose:()=>w(null)},C.id):(0,$.jsx)(De,{extension:C,copy:r.extensionsPage,onClose:()=>w(null)},C.id):null,E?(0,$.jsx)(ie,{onClose:()=>O(!1)}):null]})}function Se(e){return e.activationEligible??e.active}function Ce(e,t){return e.source===`bundled`?t.providerBundled:e.source===`global`?t.providerGlobal:e.source===`workspace`?t.providerWorkspace:t.providerOther}function we(e,t){return e.source===`global`?t.badgeSourceGlobal:e.source===`workspace`?t.badgeSourceWorkspace:t.badgeSourceOther}function Te(e,t){let n=Se(e);return n&&e.active?t.runStateLive:n&&!e.active?t.runStatePendingOn:!n&&e.active?t.runStatePendingOff:t.runStateOff}function Ee(e){let t=(0,ae.c)(45),{extension:n,copy:r,showSourceBadge:i,onOpen:a}=e,s;t[0]===n?s=t[1]:(s=Se(n),t[0]=n,t[1]=s);let c=s,l=n.hasUi?r.cardTooltipHasUi:r.cardTooltipNoUi,u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=m(`group flex w-full flex-col rounded-xl border border-edge-subtle bg-surface-base p-4 text-left shadow-surface transition-colors`,`hover:bg-surface-hover/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`dark:hover:bg-surface-hover/25`),t[2]=u):u=t[2];let f=n.name||n.id,p;t[3]===f?p=t[4]:(p=f.charAt(0).toUpperCase(),t[3]=f,t[4]=p);let h;t[5]===p?h=t[6]:(h=(0,$.jsx)(`div`,{className:`flex size-12 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-base font-semibold text-accent-fg`,"aria-hidden":!0,children:p}),t[5]=p,t[6]=h);let g;t[7]===n.name?g=t[8]:(g=(0,$.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:n.name}),t[7]=n.name,t[8]=g);let _;t[9]===n.version?_=t[10]:(_=n.version?(0,$.jsxs)(`span`,{className:`text-[11px] text-fg-muted`,children:[`v`,n.version]}):null,t[9]=n.version,t[10]=_);let v;t[11]!==g||t[12]!==_?(v=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[g,_]}),t[11]=g,t[12]=_,t[13]=v):v=t[13];let y;t[14]!==r.statusEnabled||t[15]!==c?(y=c?(0,$.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 rounded-full bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:[(0,$.jsx)(o,{className:`size-3`,strokeWidth:2.5,"aria-hidden":!0}),r.statusEnabled]}):(0,$.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center rounded-full border-2 border-accent text-accent`,"aria-hidden":!0,children:(0,$.jsx)(d,{className:`size-4`,strokeWidth:2.5})}),t[14]=r.statusEnabled,t[15]=c,t[16]=y):y=t[16];let b;t[17]!==v||t[18]!==y?(b=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[v,y]}),t[17]=v,t[18]=y,t[19]=b):b=t[19];let x;t[20]!==r.cardNoDescription||t[21]!==n.description?(x=n.description?.trim()||r.cardNoDescription,t[20]=r.cardNoDescription,t[21]=n.description,t[22]=x):x=t[22];let S;t[23]===x?S=t[24]:(S=(0,$.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-relaxed text-fg-muted`,children:x}),t[23]=x,t[24]=S);let C=n.format===`agent-plugin`?`Agent Plugin`:n.hasUi?r.badgeKindUi:r.badgeKindBackend,w;t[25]!==C||t[26]!==l?(w=(0,$.jsx)(`span`,{title:l,className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:C}),t[25]=C,t[26]=l,t[27]=w):w=t[27];let T;t[28]!==r||t[29]!==n||t[30]!==i?(T=n.source===`bundled`?(0,$.jsx)(`span`,{className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:r.badgeBundled}):i?(0,$.jsx)(`span`,{title:Ce(n,r),className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:we(n,r)}):null,t[28]=r,t[29]=n,t[30]=i,t[31]=T):T=t[31];let E;t[32]!==w||t[33]!==T?(E=(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:[w,T]}),t[32]=w,t[33]=T,t[34]=E):E=t[34];let D;t[35]!==b||t[36]!==S||t[37]!==E?(D=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[b,S,E]}),t[35]=b,t[36]=S,t[37]=E,t[38]=D):D=t[38];let O;t[39]!==D||t[40]!==h?(O=(0,$.jsxs)(`div`,{className:`flex gap-3`,children:[h,D]}),t[39]=D,t[40]=h,t[41]=O):O=t[41];let k;return t[42]!==a||t[43]!==O?(k=(0,$.jsx)(`button`,{type:`button`,onClick:a,className:u,children:O}),t[42]=a,t[43]=O,t[44]=k):k=t[44],k}function De({extension:e,copy:t,onClose:n}){let{mutate:r}=k(),[i,o]=(0,Z.useState)(null),[s,l]=(0,Z.useState)(null),[d,p]=(0,Z.useState)(!1),h=e.activationEligible===!0,g=(0,Z.useCallback)(async()=>{l(null),p(!1),o(`toggle`);try{let{requiresGatewayRestart:t}=await ue({extensionId:e.id,enabled:!h});await r(`gateway-extensions-list`),N(),p(t)}catch(e){l(e instanceof Error?e.message:t.extensionToggleFailed)}finally{o(null)}},[h,t.extensionToggleFailed,e.id,r]),_=(0,Z.useCallback)(async()=>{if(!(e.source===`bundled`||!window.confirm(t.extensionUninstallConfirm))){l(null),p(!1),o(`uninstall`);try{await de(e.id),await r(`gateway-extensions-list`),N(),n()}catch(e){l(e instanceof Error?e.message:t.marketplaceUninstallFailed),o(null)}}},[t.extensionUninstallConfirm,t.marketplaceUninstallFailed,e.id,e.source,r,n]),v=e.ui?.contributions?.pages??[],T=e.ui?.contributions?.settingsPanels??[],D=e.ui?.contributions?.chatWidgets??[],A=v.find(e=>e.showInNav)??v[0],M=T[0],P=A?B(e.id,A):null,F=M?`/settings/ext/${e.id}/${M.id}`:e.hasConfigSchema||E(e)?`/settings/ext/${e.id}`:null;return(0,$.jsx)(w,{defaultOpen:!0,onOpenChange:e=>!e&&n(),children:(0,$.jsxs)(x,{children:[(0,$.jsx)(y,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),(0,$.jsxs)(S,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[131] flex max-h-[min(90vh,44rem)] w-[min(42rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:n,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":t.detailBack,children:(0,$.jsx)(ne,{className:`size-5`})}),(0,$.jsx)(C,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:t.detailTitle}),(0,$.jsxs)(b,{className:`sr-only`,children:[e.name,` (`,e.id,`)`]}),(0,$.jsx)(`button`,{type:`button`,onClick:n,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":t.detailClose,children:(0,$.jsx)(f,{className:`size-5`})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start gap-4`,children:[(0,$.jsx)(`div`,{className:`flex size-16 shrink-0 items-center justify-center rounded-2xl bg-accent-soft text-xl font-semibold text-accent-fg`,"aria-hidden":!0,children:(e.name||e.id).charAt(0).toUpperCase()}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:e.name}),(0,$.jsxs)(`p`,{className:`mt-0.5 text-sm text-fg-muted`,children:[t.detailProviderPrefix,` `,Ce(e,t)]}),e.version?(0,$.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[`v`,e.version]}):null]})]}),(0,$.jsx)(`p`,{className:`mt-5 text-sm leading-relaxed text-fg`,children:e.description?.trim()||t.detailNoDescription}),e.hasUi?null:(0,$.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:t.backendOnlyHint}),(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:Te(e,t)}),e.source===`bundled`?(0,$.jsx)(`p`,{className:`mt-4 rounded-lg bg-surface-hover/40 px-3 py-2 text-xs text-fg-muted shadow-surface dark:bg-surface-hover/20`,children:t.builtinConfigHint}):null,(0,$.jsxs)(`div`,{className:`mt-3 rounded-lg bg-surface-hover/40 p-3 shadow-surface dark:bg-surface-hover/20`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:t.builtinRuntimeToggle}),(0,$.jsx)(j,{type:`button`,variant:`secondary`,disabled:i!==null,onClick:()=>void g(),className:`shrink-0 py-1.5 text-xs`,children:i===`toggle`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(u,{className:`mr-1.5 size-3.5 shrink-0 animate-spin`,"aria-hidden":!0}),t.builtinToggleBusy]}):h?t.builtinToggleDisable:t.builtinToggleEnable})]}),s?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-rose-600 dark:text-rose-400`,children:s}):null,d?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.builtinToggleRestartHint}):null,e.source===`bundled`?null:(0,$.jsx)(`div`,{className:`mt-3 flex justify-end border-t border-edge-subtle pt-3`,children:(0,$.jsxs)(j,{type:`button`,variant:`ghost`,disabled:i!==null,onClick:()=>void _(),className:`text-danger hover:bg-danger-soft hover:text-danger`,children:[i===`uninstall`?(0,$.jsx)(u,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,$.jsx)(te,{className:`size-3.5`,"aria-hidden":!0}),t.marketplaceUninstall]})})]}),e.hasUi&&(v.length>0||T.length>0||D.length>0)?(0,$.jsxs)(`section`,{className:`mt-8`,children:[(0,$.jsx)(`h4`,{className:`mb-3 text-sm font-semibold text-fg`,children:t.detailSectionFeatures}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[(0,$.jsx)(Oe,{template:t.badgePages,count:v.length,hidden:v.length===0}),(0,$.jsx)(Oe,{template:t.badgeSettings,count:T.length,hidden:T.length===0}),(0,$.jsx)(Oe,{template:t.badgeWidgets,count:D.length,hidden:D.length===0})]})]}):null,O(e)&&(P||F)?(0,$.jsxs)(`div`,{className:`mt-6 flex flex-wrap gap-2 border-t border-edge-subtle pt-4`,children:[P?(0,$.jsxs)(a,{to:P,onClick:n,className:m(`inline-flex items-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:[(0,$.jsx)(c,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.open]}):null,F?(0,$.jsxs)(a,{to:F,onClick:n,className:m(`inline-flex items-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:[(0,$.jsx)(U,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.openSettings]}):null]}):null,(0,$.jsx)(`p`,{className:`mt-6 text-[11px] leading-relaxed text-fg-muted`,children:t.restartNote})]})]})]})})}function Oe(e){let t=(0,ae.c)(6),{template:n,count:r,hidden:i}=e;if(i||r===0)return null;let a;if(t[0]!==r||t[1]!==n){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=/\{\{count\}\}/g,t[3]=e):e=t[3],a=n.replace(e,String(r)),t[0]=r,t[1]=n,t[2]=a}else a=t[2];let o;return t[4]===a?o=t[5]:(o=(0,$.jsx)(`span`,{className:`inline-flex items-center rounded-md bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:a}),t[4]=a,t[5]=o),o}function ke(){let e=(0,ae.c)(5),t,n,r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(`div`,{className:`mb-6 h-8 w-40 max-w-full animate-pulse rounded-md bg-surface-hover`}),n=(0,$.jsx)(`div`,{className:`mb-2 h-4 w-full max-w-md animate-pulse rounded bg-surface-hover`}),r=(0,$.jsx)(`div`,{className:`mb-5 h-9 w-full max-w-lg animate-pulse rounded-full bg-surface-hover`}),e[0]=t,e[1]=n,e[2]=r):(t=e[0],n=e[1],r=e[2]);let i;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=[`ap0`,`ap1`,`ap2`,`ap3`,`ap4`,`ap5`],e[3]=i):i=e[3];let a;return e[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:(0,$.jsxs)(`div`,{className:`w-full px-3 pb-8 pt-3 sm:px-5 lg:pt-4 xl:px-6`,children:[t,n,r,(0,$.jsx)(`div`,{className:`mt-6 grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:i.map(Ae)})]})}),e[4]=a):a=e[4],a}function Ae(e){return(0,$.jsx)(`div`,{className:`h-36 animate-pulse rounded-xl border border-edge-subtle bg-surface-base shadow-surface`},e)}function je(e){let t=(0,ae.c)(2),{message:n}=e,r;return t[0]===n?r=t[1]:(r=(0,$.jsx)(`div`,{className:`flex min-h-[min(40vh,16rem)] flex-col items-center justify-center rounded-xl border border-edge-subtle bg-surface-base px-4 py-12 text-center shadow-surface`,children:(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n})}),t[0]=n,t[1]=r),r}export{xe as ExtensionsPage};
@@ -1 +1 @@
1
- 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"./messages-O0BEUKnx.js";import{t as a}from"./jszip.min-DT31yWkU.js";import{t as o}from"./preview-open-alternatives-BJU2fmPn.js";var s=n(),c=e(a(),1),l=e(t(),1),u=r();function d(e){let t=(0,s.c)(17),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=[],t[0]=n):n=t[0];let[r,a]=(0,l.useState)(n),[d,m]=(0,l.useState)(null),h,g;if(t[1]===e.binaryBuffer?(h=t[2],g=t[3]):(h=()=>{if(!e.binaryBuffer)return;let t=!1;return c.default.loadAsync(e.binaryBuffer).then(e=>{t||a(Object.values(e.files).slice(0,500).map(p))}).catch(e=>{t||m(e instanceof Error?e.message:String(e))}),()=>{t=!0}},g=[e.binaryBuffer],t[1]=e.binaryBuffer,t[2]=h,t[3]=g),(0,l.useEffect)(h,g),d){let n;t[4]===e.language?n=t[5]:(n=i(e.language),t[4]=e.language,t[5]=n);let r=n,a;t[6]!==r.chat.attachmentPreviewDownloadFull||t[7]!==r.chat.attachmentPreviewOpenElsewhereHint||t[8]!==e.actions.onDownload?(a=(0,u.jsx)(o,{message:r.chat.attachmentPreviewOpenElsewhereHint,downloadLabel:r.chat.attachmentPreviewDownloadFull,onDownload:e.actions.onDownload}),t[6]=r.chat.attachmentPreviewDownloadFull,t[7]=r.chat.attachmentPreviewOpenElsewhereHint,t[8]=e.actions.onDownload,t[9]=a):a=t[9];let s;t[10]===d?s=t[11]:(s=(0,u.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:d}),t[10]=d,t[11]=s);let c;return t[12]!==a||t[13]!==s?(c=(0,u.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-auto p-4`,children:[a,s]}),t[12]=a,t[13]=s,t[14]=c):c=t[14],c}let _;return t[15]===r?_=t[16]:(_=(0,u.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-4`,children:(0,u.jsx)(`div`,{className:`overflow-hidden rounded-lg border border-edge bg-surface-panel`,children:r.length===0?(0,u.jsx)(`p`,{className:`p-4 text-sm text-fg-muted`,children:`Loading archive...`}):(0,u.jsx)(`table`,{className:`w-full text-left text-xs`,children:(0,u.jsx)(`tbody`,{children:r.map(f)})})})}),t[15]=r,t[16]=_),_}function f(e){return(0,u.jsxs)(`tr`,{className:`border-b border-edge-subtle last:border-b-0 dark:border-edge`,children:[(0,u.jsx)(`td`,{className:`max-w-0 truncate px-3 py-2 font-mono text-fg`,title:e.name,children:e.dir?`${e.name}/`:e.name}),(0,u.jsx)(`td`,{className:`w-24 px-3 py-2 text-right text-fg-muted`,children:e.dir?``:m(e.size)})]},e.name)}function p(e){return{name:e.name,dir:e.dir,size:e.dir?0:e._data?.uncompressedSize??0}}function m(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}export{d as ArchivePreviewPluginView};
1
+ 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"./messages-CKTo_sIF.js";import{t as a}from"./jszip.min-DT31yWkU.js";import{t as o}from"./preview-open-alternatives-BJU2fmPn.js";var s=n(),c=e(a(),1),l=e(t(),1),u=r();function d(e){let t=(0,s.c)(17),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=[],t[0]=n):n=t[0];let[r,a]=(0,l.useState)(n),[d,m]=(0,l.useState)(null),h,g;if(t[1]===e.binaryBuffer?(h=t[2],g=t[3]):(h=()=>{if(!e.binaryBuffer)return;let t=!1;return c.default.loadAsync(e.binaryBuffer).then(e=>{t||a(Object.values(e.files).slice(0,500).map(p))}).catch(e=>{t||m(e instanceof Error?e.message:String(e))}),()=>{t=!0}},g=[e.binaryBuffer],t[1]=e.binaryBuffer,t[2]=h,t[3]=g),(0,l.useEffect)(h,g),d){let n;t[4]===e.language?n=t[5]:(n=i(e.language),t[4]=e.language,t[5]=n);let r=n,a;t[6]!==r.chat.attachmentPreviewDownloadFull||t[7]!==r.chat.attachmentPreviewOpenElsewhereHint||t[8]!==e.actions.onDownload?(a=(0,u.jsx)(o,{message:r.chat.attachmentPreviewOpenElsewhereHint,downloadLabel:r.chat.attachmentPreviewDownloadFull,onDownload:e.actions.onDownload}),t[6]=r.chat.attachmentPreviewDownloadFull,t[7]=r.chat.attachmentPreviewOpenElsewhereHint,t[8]=e.actions.onDownload,t[9]=a):a=t[9];let s;t[10]===d?s=t[11]:(s=(0,u.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:d}),t[10]=d,t[11]=s);let c;return t[12]!==a||t[13]!==s?(c=(0,u.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-auto p-4`,children:[a,s]}),t[12]=a,t[13]=s,t[14]=c):c=t[14],c}let _;return t[15]===r?_=t[16]:(_=(0,u.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-4`,children:(0,u.jsx)(`div`,{className:`overflow-hidden rounded-lg border border-edge bg-surface-panel`,children:r.length===0?(0,u.jsx)(`p`,{className:`p-4 text-sm text-fg-muted`,children:`Loading archive...`}):(0,u.jsx)(`table`,{className:`w-full text-left text-xs`,children:(0,u.jsx)(`tbody`,{children:r.map(f)})})})}),t[15]=r,t[16]=_),_}function f(e){return(0,u.jsxs)(`tr`,{className:`border-b border-edge-subtle last:border-b-0 dark:border-edge`,children:[(0,u.jsx)(`td`,{className:`max-w-0 truncate px-3 py-2 font-mono text-fg`,title:e.name,children:e.dir?`${e.name}/`:e.name}),(0,u.jsx)(`td`,{className:`w-24 px-3 py-2 text-right text-fg-muted`,children:e.dir?``:m(e.size)})]},e.name)}function p(e){return{name:e.name,dir:e.dir,size:e.dir?0:e._data?.uncompressedSize??0}}function m(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}export{d as ArchivePreviewPluginView};
@@ -1 +1 @@
1
- import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./automations-workspace-BJenz0P1.js";var r=e(),i=t();function a(){let e=(0,r.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,i.jsx)(n,{}),e[0]=t):t=e[0],t}export{a as AutomationsPage};
1
+ import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./automations-workspace-BBjS-sk-.js";var r=e(),i=t();function a(){let e=(0,r.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,i.jsx)(n,{}),e[0]=t):t=e[0],t}export{a as AutomationsPage};
@@ -0,0 +1,6 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{_ as i,p as a,t as o}from"./chunk-KS7C4IRE--EKdQGRF.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-DHC7J4lG.js";import{t as h}from"./circle-alert-BEjgurr2.js";import{t as g}from"./circle-check-C23XjkUj.js";import{t as _}from"./ellipsis-0k4rZLoy.js";import{t as v}from"./markdown-view-IsYTotu6.js";import{t as y}from"./pencil-DmIY3Oa-.js";import{t as b}from"./plus-Q2yW6OE7.js";import{t as x}from"./search-DA7gz22f.js";import{t as S}from"./x-B_N4OPjy.js";import{t as C}from"./messages-CKTo_sIF.js";import{t as w}from"./cn-0WouolD0.js";import{n as T}from"./locale-store-BpK9AiDq.js";import{a as E,n as D,o as O,r as k,s as A,t as j}from"./dist-BGTk37IG.js";import{i as M}from"./vendor-swr-BIWyz7Rc.js";import{t as N}from"./button-aIC072nz.js";import{a as P,c as F,i as I,o as L,s as R}from"./dist-C3DSFZCi.js";import{t as z}from"./skeleton-BI5TyibZ.js";import{Ai as ee,Ca as B,Fi as te,Hs as ne,Is as re,Jc as ie,Po as ae,Rc as oe,So as V,Ss as se,Vn as H,Xc as ce,Xi as le,Yo as ue,Zo as U,_i as W,ar as G,cs as de,es as fe,gs as pe,hc as me,ir as he,l as K,nr as ge,rr as _e,sr as ve,v as ye}from"./index-DFgXwLsv.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 J,i as Oe,n as ke,r as Ae,t as je}from"./workflow-run-setup-panel-BcFm9QcC.js";import{i as Me,n as Ne,r as Pe,t as Fe}from"./browser-automation-inputs-C5tIrIRL.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:_}=e,v=a===void 0?!1:a,y=_===void 0?1:_,b=Re(n),x=b??ze(),[C,T]=(0,Y.useState)(!1),[E,D]=(0,Y.useState)(null),[O,k]=(0,Y.useState)(x.hour),[A,j]=(0,Y.useState)(x.minute),M=(0,Y.useRef)([]),N=(0,Y.useRef)([]),P=d(),I=u(E),L=m(P,I!==null),z=Math.max(1,Math.min(60,Math.round(y))),ee=Array.from({length:Math.ceil(60/z)},(e,t)=>t*z).filter(Ue),B;t[0]===r?B=t[1]:(B=(e,t,n)=>{let i=n===void 0?!1:n;k(e),j(t),r(Be(e,t)),i&&T(!1)},t[0]=r,t[1]=B);let te=B,ne=He,re;t[2]===f?re=t[3]:(re=w(`relative min-w-0`,f),t[2]=f,t[3]=re);let ie=F,ae;t[4]===n?ae=t[5]:(ae=e=>{if(e){let e=Re(n)??ze();k(e.hour),j(e.minute)}T(e)},t[4]=n,t[5]=ae);let V=v&&n&&`pr-9`,se=i&&`cursor-not-allowed opacity-50 hover:border-edge`,H;t[6]!==V||t[7]!==se||t[8]!==p?(H=w(`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`,V,se,p),t[6]=V,t[7]=se,t[8]=p,t[9]=H):H=t[9];let ce;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(ce=(0,X.jsx)(oe,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":`true`}),t[10]=ce):ce=t[10];let le=!b&&`text-fg-subtle`,ue;t[11]===le?ue=t[12]:(ue=w(`tabular-nums`,le),t[11]=le,t[12]=ue);let U=b?Be(b.hour,b.minute):`--:--`,W;t[13]!==ue||t[14]!==U?(W=(0,X.jsx)(`span`,{className:ue,children:U}),t[13]=ue,t[14]=U,t[15]=W):W=t[15];let G;t[16]!==s||t[17]!==l||t[18]!==i||t[19]!==h||t[20]!==W||t[21]!==H?(G=(0,X.jsx)(R,{asChild:!0,children:(0,X.jsxs)(`button`,{ref:D,id:h,type:`button`,disabled:i,"aria-label":s,"aria-labelledby":l,"aria-haspopup":`listbox`,className:H,children:[ce,W]})}),t[16]=s,t[17]=l,t[18]=i,t[19]=h,t[20]=W,t[21]=H,t[22]=G):G=t[22];let de=F,fe=I??void 0,pe=F,me=w(L,`w-[18rem] overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-popover outline-none`),he=e=>{e.preventDefault(),requestAnimationFrame(()=>M.current[O]?.focus())},K;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,X.jsx)(oe,{className:`size-3.5`,"aria-hidden":`true`}),t[23]=K):K=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:[K,ge]}),t[24]=ge,t[25]=_e);let ve;t[26]!==O||t[27]!==A?(ve=Be(O,A),t[26]=O,t[27]=A,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=>{M.current[t]=e},type:`button`,role:`option`,"aria-selected":O===e,tabIndex:O===e?0:-1,className:w(`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`,O===e&&`bg-accent-soft font-semibold text-accent-fg`),onClick:()=>te(e,A),onKeyDown:e=>ne(e,Le,O,e=>te(e,A),M),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=ee.map((e,t)=>(0,X.jsxs)(`button`,{ref:e=>{N.current[t]=e},type:`button`,role:`option`,"aria-selected":A===e,tabIndex:A===e?0:-1,className:w(`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`,A===e&&`bg-accent-soft font-semibold text-accent-fg`),onClick:()=>te(O,e,!0),onKeyDown:e=>ne(e,ee,A,e=>te(O,e),N),children:[(0,X.jsx)(c,{className:w(`absolute left-0.5 size-3`,A!==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 J;t[42]!==we||t[43]!==De?(J=(0,X.jsxs)(`div`,{className:`pl-2`,children:[we,De]}),t[42]=we,t[43]=De,t[44]=J):J=t[44];let Oe;t[45]!==Ce||t[46]!==J?(Oe=(0,X.jsxs)(`div`,{className:`grid grid-cols-2 divide-x divide-edge-subtle p-2`,children:[Ce,J]}),t[45]=Ce,t[46]=J,t[47]=Oe):Oe=t[47];let ke;t[48]!==pe.Content||t[49]!==me||t[50]!==he||t[51]!==q||t[52]!==Oe?(ke=(0,X.jsxs)(pe.Content,{side:`bottom`,align:`start`,sideOffset:6,collisionPadding:12,className:me,onOpenAutoFocus:he,children:[q,Oe]}),t[48]=pe.Content,t[49]=me,t[50]=he,t[51]=q,t[52]=Oe,t[53]=ke):ke=t[53];let Ae;t[54]!==de.Portal||t[55]!==fe||t[56]!==ke?(Ae=(0,X.jsx)(de.Portal,{container:fe,children:ke}),t[54]=de.Portal,t[55]=fe,t[56]=ke,t[57]=Ae):Ae=t[57];let je;t[58]!==C||t[59]!==G||t[60]!==Ae||t[61]!==ie.Root||t[62]!==ae?(je=(0,X.jsxs)(ie.Root,{open:C,onOpenChange:ae,children:[G,Ae]}),t[58]=C,t[59]=G,t[60]=Ae,t[61]=ie.Root,t[62]=ae,t[63]=je):je=t[63];let Me;t[64]!==v||t[65]!==s||t[66]!==o||t[67]!==i||t[68]!==r||t[69]!==n?(Me=v&&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)(S,{className:`size-3.5`,"aria-hidden":`true`})}):null,t[64]=v,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]!==re||t[76]!==je||t[77]!==Me||t[78]!==Ne?(Pe=(0,X.jsxs)(`div`,{className:re,children:[je,Me,Ne]}),t[75]=re,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=Ae(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?ke(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 C;t[34]===i.trigger.once?C=t[35]:(C=(0,X.jsx)(p,{value:`once`,children:i.trigger.once}),t[34]=i.trigger.once,t[35]=C);let w;t[36]===i.trigger.daily?w=t[37]:(w=(0,X.jsx)(p,{value:`daily`,children:i.trigger.daily}),t[36]=i.trigger.daily,t[37]=w);let T;t[38]===i.trigger.weekly?T=t[39]:(T=(0,X.jsx)(p,{value:`weekly`,children:i.trigger.weekly}),t[38]=i.trigger.weekly,t[39]=T);let E;t[40]!==n.triggerMode||t[41]!==S||t[42]!==C||t[43]!==w||t[44]!==T?(E=(0,X.jsxs)(f,{className:nt,value:n.triggerMode,onChange:S,children:[C,w,T]}),t[40]=n.triggerMode,t[41]=S,t[42]=C,t[43]=w,t[44]=T,t[45]=E):E=t[45];let D;t[46]!==i.form.trigger||t[47]!==E?(D=(0,X.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[i.form.trigger,E]}),t[46]=i.form.trigger,t[47]=E,t[48]=D):D=t[48];let O;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?(O=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]=O):O=t[55];let k;t[56]!==n.triggerMode||t[57]!==n.weekday||t[58]!==i.form.day||t[59]!==i.weekdays||t[60]!==u?(k=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]=k):k=t[61];let A;t[62]!==D||t[63]!==O||t[64]!==k?(A=(0,X.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[D,O,k]}),t[62]=D,t[63]=O,t[64]=k,t[65]=A):A=t[65];let j;t[66]!==n.onceAt||t[67]!==n.triggerMode||t[68]!==i.experience.futureTime?(j=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]=j):j=t[69];let M;t[70]===i.experience.scheduleNote?M=t[71]:(M=(0,X.jsx)(`p`,{className:`text-xs text-fg-muted`,children:i.experience.scheduleNote}),t[70]=i.experience.scheduleNote,t[71]=M);let N;t[72]===u?N=t[73]:(N=e=>u({notificationPolicy:e.target.value}),t[72]=u,t[73]=N);let P;t[74]===i.draft.notifyAll?P=t[75]:(P=(0,X.jsx)(p,{value:`all`,children:i.draft.notifyAll}),t[74]=i.draft.notifyAll,t[75]=P);let F;t[76]===i.draft.notifyAttention?F=t[77]:(F=(0,X.jsx)(p,{value:`attention`,children:i.draft.notifyAttention}),t[76]=i.draft.notifyAttention,t[77]=F);let I;t[78]===i.draft.notifyNone?I=t[79]:(I=(0,X.jsx)(p,{value:`none`,children:i.draft.notifyNone}),t[78]=i.draft.notifyNone,t[79]=I);let L;t[80]!==n.notificationPolicy||t[81]!==N||t[82]!==P||t[83]!==F||t[84]!==I?(L=(0,X.jsxs)(f,{className:nt,value:n.notificationPolicy,onChange:N,children:[P,F,I]}),t[80]=n.notificationPolicy,t[81]=N,t[82]=P,t[83]=F,t[84]=I,t[85]=L):L=t[85];let R;t[86]!==i.draft.notifications||t[87]!==L?(R=(0,X.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[i.draft.notifications,L]}),t[86]=i.draft.notifications,t[87]=L,t[88]=R):R=t[88];let z;return t[89]!==x||t[90]!==A||t[91]!==d||t[92]!==j||t[93]!==M||t[94]!==R||t[95]!==g||t[96]!==y||t[97]!==b?(z=(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,A,j,M,R]}),t[89]=x,t[90]=A,t[91]=d,t[92]=j,t[93]=M,t[94]=R,t[95]=g,t[96]=y,t[97]=b,t[98]=z):z=t[98],z}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)(V,{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)(me,{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)(ne,{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)(ue,{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)(z,{className:`h-4 w-36`}),(0,X.jsx)(z,{className:`h-3 w-56 max-w-full`})]}),(0,X.jsx)(z,{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)(z,{className:`h-4 w-32`}),a=(0,X.jsx)(z,{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)(z,{className:`h-12 rounded-lg`}),(0,X.jsx)(z,{className:`h-12 rounded-lg`}),(0,X.jsx)(z,{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)(z,{className:`size-4 rounded-full`}),(0,X.jsx)(z,{className:`h-4 w-32`}),(0,X.jsx)(z,{className:`h-5 w-20 rounded-full`})]}),(0,X.jsx)(z,{className:`mt-3 h-4 w-full`}),(0,X.jsx)(z,{className:`mt-2 h-4 w-3/5`})]}),(0,X.jsx)(z,{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)(z,{className:`size-4 rounded-full`}),(0,X.jsx)(z,{className:`h-3 w-14`}),(0,X.jsx)(z,{className:`ml-auto h-4 w-10`})]},t)}function kt({projectId:e,embedded:t=!1,title:n,subtitle:r}){let o=T(e=>e.language),c=C(o),l=c.automations,u=c.productNavigation.sections[`automation-triggers`],d=c.cron,m=B(e=>e.setPageHeader),_=B(e=>e.clearPageHeader),v=a(),[F,z]=i(),ae=!t&&F.get(`view`)===`activity`,oe=F.get(`run`)?.trim()??``,se=F.get(`automation`)?.trim()??``,H=F.get(`draft`)?.trim()??``,W=F.get(`action`)?.trim()??``,fe=F.get(`taskId`)?.trim()??``,pe=F.get(`projectId`)?.trim()??``,q=e?.trim()||pe,be=!!e?.trim(),Ce=F.get(`autogenerate`)===`1`,we=(0,Y.useRef)(``),Te=F.get(`status`),Ee=Te===`active`||Te===`paused`||Te===`running`||Te===`attention`?Te:`all`,J=F.get(`ownership`)===`system`?`system`:`user`,ke=F.get(`source`),Ae=ke===`agent`||ke===`workflow`||ke===`task_command`||ke===`browser_automation`?ke:`all`,je=F.get(`q`)??``,Pe=e=>z(t=>{let n=new URLSearchParams(t);return e===`all`?n.delete(`status`):n.set(`status`,e),n.delete(`automation`),n}),Fe=e=>z(t=>{let n=new URLSearchParams(t);return e===`user`?n.delete(`ownership`):n.set(`ownership`,e),n.delete(`automation`),n}),Ie=e=>z(t=>{let n=new URLSearchParams(t);return e?n.set(`q`,e):n.delete(`q`),n.delete(`automation`),n},{replace:!0}),Le=e=>z(t=>{let n=new URLSearchParams(t);return e===`all`?n.delete(`source`):n.set(`source`,e),n.delete(`automation`),n}),Re=()=>z(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=M([`automations`,q],()=>K.list(q?{projectId:q}:void 0),{keepPreviousData:!0,refreshInterval:15e3}),on=M([`automation-runs`,q],()=>K.runs(50,void 0,q?{projectId:q}:void 0),{keepPreviousData:!0,refreshInterval:1e4}),sn=M(q?`automations-global-system-source`:null,()=>K.list(),{keepPreviousData:!0,refreshInterval:15e3}),cn=M(q?`automation-runs-global-system-source`:null,()=>K.runs(50),{keepPreviousData:!0,refreshInterval:1e4}),ln=M(gt?[`automation-history`,gt,q]:null,()=>K.runs(50,gt,q?{projectId:q}:void 0),{refreshInterval:1e4}),un=M(ft?`automation-run-events:${ft}`:null,()=>K.runEvents(ft),{refreshInterval:5e3}),dn=M(`automation-workflow-definitions`,ye),fn=M(`automation-browser-automations`,()=>Me.list()),pn=M(`automation-chat-agents`,te),mn=M(`automation-tasks`,K.tasks),hn=M(`automation-projects`,()=>le({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=J===`system`?Cn:Sn,Ln=J===`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||Ae!==`all`&&e.action.kind!==Ae?!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,Ae]),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?!Oe(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(Ae!==`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(se&&zn.some(e=>e.id===se)){_t(se);return}gt&&zn.some(e=>e.id===gt)||_t(zn[0].id)}},[se,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}z(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,z]);(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===se);!e||!We(e)||J===`system`||z(e=>{let t=new URLSearchParams(e);return t.set(`ownership`,`system`),t},{replace:!0})},[se,wn,J,z]),(0,Y.useEffect)(()=>{W===`create`&&(lr(`blank`),fe&&nt(e=>({...e,actionMode:`task_command`,taskId:fe,safetyMode:`auto_apply`})),z(e=>{let t=new URLSearchParams(e);return t.delete(`action`),t.delete(`taskId`),t},{replace:!0}))},[W,lr,z,fe]),(0,Y.useEffect)(()=>{if(!H)return;let e=`${o}:${Ce?`auto`:`seed`}:${H}`;we.current!==e&&(we.current=e,yt(H),wt(null),Nt(!1),Ft(q),Ke(`draft`),He(!0),z(e=>{let t=new URLSearchParams(e);return t.delete(`draft`),t.delete(`autogenerate`),t},{replace:!0}),Ce&&(dt(null),Ot(!0),K.draft({prompt:H,language:o}).then(e=>{wt(e.draft),Nt(!1)}).catch(e=>{dt(e instanceof Error?e.message:String(e))}).finally(()=>{Ot(!1)})))},[Ce,H,o,q,z]);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),z(t=>{let n=new URLSearchParams(t);return n.set(`run`,e),n},{replace:!0})},[hr,z]),_r=(0,Y.useCallback)(e=>{_t(e);let t=ot(e,On);z(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,z]),vr=(0,Y.useCallback)(()=>{if(!rr)return;_t(rr.id);let e=ot(rr.id,On);z(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,z]);(0,Y.useEffect)(()=>{oe&&(hr(oe),pt(oe),ht(!0))},[hr,oe]),(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),z(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)(ee,{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)(N,{variant:`primary`,className:`h-9 rounded-r-none pr-2.5`,onClick:ur,children:[(0,X.jsx)(b,{className:`size-4`,"aria-hidden":!0}),l.create]}),(0,X.jsxs)(G,{children:[(0,X.jsx)(ve,{asChild:!0,children:(0,X.jsx)(N,{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)(ie,{className:`size-4`,"aria-hidden":!0})})}),(0,X.jsx)(he,{children:(0,X.jsxs)(ge,{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)(_e,{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)(re,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),l.createWithAssistant]}),(0,X.jsxs)(_e,{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)(y,{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:w(`flex min-h-0 min-w-0 flex-1 flex-col`,t?`bg-transparent`:`bg-surface-panel`),children:[(0,X.jsxs)(`div`,{className:w(`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)(V,{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,ae?gn?(0,X.jsx)(Et,{}):(0,X.jsx)(Lt,{runs:Ln,ownership:J,labels:l,language:o,unreadCount:J===`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)(V,{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)(ce,{className:`size-4`,"aria-hidden":!0}),label:l.metrics.next,value:rr?Se(rr.state.nextRunAtMs,o):`—`,onClick:rr?vr:void 0})]})]}),!gn&&tr&&J===`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)(S,{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:w(`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)(x,{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)(L,{children:[(0,X.jsx)(R,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,className:w(`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)(U,{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)(P,{children:(0,X.jsxs)(I,{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:w(`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:V},{id:`agent`,label:l.sources.agent,icon:ue},{id:`workflow`,label:l.sources.workflow,icon:me},{id:`task_command`,label:l.sources.task,icon:g},{id:`browser_automation`,label:l.sources.browser,icon:ne}].map(e=>(0,X.jsxs)(`button`,{type:`button`,className:w(`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`,Ae===e.id&&`border-edge bg-surface-active text-fg`),onClick:()=>Le(e.id),"aria-pressed":Ae===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:w(`rounded-md px-2.5 py-1.5 text-xs font-medium text-fg-muted hover:text-fg`,J===`user`&&`bg-surface-base text-fg shadow-sm`),onClick:()=>Fe(`user`),"aria-pressed":J===`user`,children:[l.filters.userManaged,` · `,Sn.length]}),(0,X.jsxs)(`button`,{type:`button`,className:w(`rounded-md px-2.5 py-1.5 text-xs font-medium text-fg-muted hover:text-fg`,J===`system`&&`bg-surface-base text-fg shadow-sm`),onClick:()=>Fe(`system`),"aria-pressed":J===`system`,children:[l.system.title,` · `,Cn.length]})]})]}),Pn.length>0&&J===`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`||Ae!==`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:J===`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)(N,{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)(V,{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)(N,{variant:`ghost`,onClick:Re,children:l.filters.clear})}):null]})})]}),!gn&&Sn.length>0?(0,X.jsx)(`div`,{children:(0,X.jsxs)(N,{variant:`ghost`,onClick:()=>lr(`draft`),children:[(0,X.jsx)(b,{className:`size-4`,"aria-hidden":!0}),l.experience.discover]})}):null]})]}),(0,X.jsx)(j,{open:Ve,onOpenChange:e=>{He(e),e||(Ye(null),Ze(!1))},children:(0,X.jsxs)(O,{children:[(0,X.jsx)(E,{className:`xopc-dialog-overlay fixed inset-0 z-65 bg-scrim backdrop-blur-[1px]`}),(0,X.jsxs)(k,{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)(A,{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)(D,{asChild:!0,children:(0,X.jsx)(N,{variant:`ghost`,"aria-label":l.close,children:(0,X.jsx)(S,{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)(N,{variant:`ghost`,onClick:()=>Ke(`blank`),children:l.draft.advancedCreate}):null,Xe?(0,X.jsx)(N,{variant:`ghost`,onClick:()=>{Ze(!1),Ke(`draft`)},children:l.cancel}):(0,X.jsx)(D,{asChild:!0,children:(0,X.jsx)(N,{variant:`ghost`,children:l.cancel})}),(0,X.jsx)(N,{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)(j,{open:mt&&!!kn,onOpenChange:e=>{ht(e),!e&&z(e=>{let t=new URLSearchParams(e);return t.delete(`run`),t},{replace:!0})},children:(0,X.jsxs)(O,{children:[(0,X.jsx)(E,{className:`xopc-dialog-overlay fixed inset-0 z-65 bg-scrim backdrop-blur-[1px]`}),(0,X.jsxs)(k,{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)(A,{className:`truncate text-base font-semibold text-fg`,children:kn?.automationName??l.dashboard.result}),(0,X.jsx)(D,{asChild:!0,children:(0,X.jsx)(N,{variant:`ghost`,"aria-label":l.close,children:(0,X.jsx)(S,{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)(ce,{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:b,onTest:x,onProjectChange:S,onConversationModeChange:C,onNotificationPolicyChange:T,onApprovedChange:E,onDiscard:D,onTemplateSelect:O,onOpenAdvanced:k,projectLocked:A}=e,j=s===void 0?!1:s,M=c===void 0?!1:c,P=A===void 0?!1:A,F=!!(i&&i.simulation.requiredConfirmations.length>0),I;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?(I=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)(N,{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]=I):I=t[8];let L;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,X.jsx)(ue,{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 ee;t[14]!==R||t[15]!==z?(ee=(0,X.jsxs)(`div`,{className:`min-w-0`,children:[R,z]}),t[14]=R,t[15]=z,t[16]=ee):ee=t[16];let B;t[17]!==a||t[18]!==r?(B=a||!r.trim(),t[17]=a,t[18]=r,t[19]=B):B=t[19];let te;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,X.jsx)(ue,{className:`size-4`}),t[20]=te):te=t[20];let ne=a?n.draft.generating:n.draft.generate,re;t[21]!==_||t[22]!==ne||t[23]!==B?(re=(0,X.jsxs)(N,{variant:`primary`,onClick:_,disabled:B,children:[te,ne]}),t[21]=_,t[22]=ne,t[23]=B,t[24]=re):re=t[24];let ie;t[25]!==re||t[26]!==ee?(ie=(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[ee,re]}),t[25]=re,t[26]=ee,t[27]=ie):ie=t[27];let ae;t[28]===g?ae=t[29]:(ae=e=>g(e.target.value),t[28]=g,t[29]=ae);let oe;t[30]!==n.draft.placeholder||t[31]!==n.draft.title||t[32]!==r||t[33]!==ae?(oe=(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:ae,placeholder:n.draft.placeholder}),t[30]=n.draft.placeholder,t[31]=n.draft.title,t[32]=r,t[33]=ae,t[34]=oe):oe=t[34];let V=P?`sm:grid-cols-2`:`sm:grid-cols-3`,se;t[35]===V?se=t[36]:(se=w(`mt-3 grid gap-3`,V),t[35]=V,t[36]=se);let H;t[37]!==n.draft.noProject||t[38]!==n.draft.project||t[39]!==S||t[40]!==d||t[41]!==P||t[42]!==u?(H=P?null:(0,X.jsx)($,{label:n.draft.project,children:(0,X.jsxs)(f,{className:Q,value:d,onChange:e=>S(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]=S,t[40]=d,t[41]=P,t[42]=u,t[43]=H):H=t[43];let ce;t[44]===C?ce=t[45]:(ce=e=>C(e.target.value),t[44]=C,t[45]=ce);let le;t[46]===n.draft.newConversation?le=t[47]:(le=(0,X.jsx)(p,{value:`new_session`,children:n.draft.newConversation}),t[46]=n.draft.newConversation,t[47]=le);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]!==ce||t[52]!==le||t[53]!==U?(W=(0,X.jsxs)(f,{className:Q,value:m,onChange:ce,children:[le,U]}),t[50]=m,t[51]=ce,t[52]=le,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 de;t[58]===T?de=t[59]:(de=e=>T(e.target.value),t[58]=T,t[59]=de);let fe;t[60]===n.draft.notifyAttention?fe=t[61]:(fe=(0,X.jsx)(p,{value:`attention`,children:n.draft.notifyAttention}),t[60]=n.draft.notifyAttention,t[61]=fe);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 he;t[64]===n.draft.notifyNone?he=t[65]:(he=(0,X.jsx)(p,{value:`none`,children:n.draft.notifyNone}),t[64]=n.draft.notifyNone,t[65]=he);let K;t[66]!==h||t[67]!==de||t[68]!==fe||t[69]!==me||t[70]!==he?(K=(0,X.jsxs)(f,{className:Q,value:h,onChange:de,children:[fe,me,he]}),t[66]=h,t[67]=de,t[68]=fe,t[69]=me,t[70]=he,t[71]=K):K=t[71];let ge;t[72]!==n.draft.notifications||t[73]!==K?(ge=(0,X.jsx)($,{label:n.draft.notifications,children:K}),t[72]=n.draft.notifications,t[73]=K,t[74]=ge):ge=t[74];let _e;t[75]!==se||t[76]!==H||t[77]!==G||t[78]!==ge?(_e=(0,X.jsxs)(`div`,{className:se,children:[H,G,ge]}),t[75]=se,t[76]=H,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]!==E||t[96]!==D||t[97]!==v||t[98]!==b||t[99]!==x||t[100]!==j||t[101]!==F||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}),F?(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=>E(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)(N,{variant:`ghost`,onClick:D,children:n.draft.discard}),(0,X.jsxs)(N,{variant:`secondary`,onClick:v,children:[(0,X.jsx)(y,{className:`size-4`}),n.draft.edit]}),(0,X.jsxs)(N,{variant:`secondary`,onClick:x,disabled:M||j||F&&!o,children:[(0,X.jsx)(pe,{className:`size-4`}),M?n.draft.testing:n.draft.testOnce]}),(0,X.jsx)(N,{variant:`primary`,onClick:b,disabled:j||F&&!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]=E,t[96]=D,t[97]=v,t[98]=b,t[99]=x,t[100]=j,t[101]=F,t[102]=M,t[103]=ve):ve=t[103];let ye;return t[104]!==ie||t[105]!==oe||t[106]!==_e||t[107]!==ve||t[108]!==I?(ye=(0,X.jsxs)(`section`,{className:`rounded-lg border border-edge-subtle bg-surface-base p-4 shadow-surface`,children:[I,ie,oe,_e,ve]}),t[104]=ie,t[105]=oe,t[106]=_e,t[107]=ve,t[108]=I,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=w(`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=w(`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=w(`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}`,C;return t[19]!==S||t[20]!==o||t[21]!==x||t[22]!==_||t[23]!==s?(C=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]=C):C=t[24],C}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=w(`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 T;t[13]===l?T=t[14]:(T=()=>l(`user`),t[13]=l,t[14]=T);let E=r===`user`,D;t[15]!==i.filters.userManaged||t[16]!==E||t[17]!==C||t[18]!==T?(D=(0,X.jsx)(`button`,{type:`button`,className:C,onClick:T,"aria-pressed":E,children:i.filters.userManaged}),t[15]=i.filters.userManaged,t[16]=E,t[17]=C,t[18]=T,t[19]=D):D=t[19];let O=r===`system`&&`bg-surface-base text-fg shadow-sm`,k;t[20]===O?k=t[21]:(k=w(`rounded-md px-2.5 py-1.5 text-xs font-medium text-fg-muted hover:text-fg`,O),t[20]=O,t[21]=k);let A;t[22]===l?A=t[23]:(A=()=>l(`system`),t[22]=l,t[23]=A);let j=r===`system`,M;t[24]!==i.system.title||t[25]!==k||t[26]!==A||t[27]!==j?(M=(0,X.jsx)(`button`,{type:`button`,className:k,onClick:A,"aria-pressed":j,children:i.system.title}),t[24]=i.system.title,t[25]=k,t[26]=A,t[27]=j,t[28]=M):M=t[28];let N;t[29]!==i.filters.ownership||t[30]!==D||t[31]!==M?(N=(0,X.jsxs)(`div`,{className:`flex rounded-lg bg-surface-panel p-0.5`,role:`group`,"aria-label":x,children:[D,M]}),t[29]=i.filters.ownership,t[30]=D,t[31]=M,t[32]=N):N=t[32];let P;t[33]!==i.refresh||t[34]!==c||t[35]!==u?(P=(0,X.jsx)(ee,{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]=P):P=t[36];let F;t[37]!==N||t[38]!==P?(F=(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[N,P]}),t[37]=N,t[38]=P,t[39]=F):F=t[39];let I;t[40]!==F||t[41]!==b?(I=(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,F]}),t[40]=F,t[41]=b,t[42]=I):I=t[42];let L;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,X.jsx)(s,{className:`size-4`,"aria-hidden":!0}),t[43]=L):L=t[43];let R=i.metrics.total,z=String(n.length),B;t[44]!==i.metrics.total||t[45]!==z?(B=(0,X.jsx)(It,{icon:L,label:R,value:z}),t[44]=i.metrics.total,t[45]=z,t[46]=B):B=t[46];let te;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,X.jsx)(pe,{className:`size-4`,"aria-hidden":!0}),t[47]=te):te=t[47];let ne=i.metrics.running,re=String(p),ie;t[48]!==i.metrics.running||t[49]!==re?(ie=(0,X.jsx)(It,{icon:te,label:ne,value:re}),t[48]=i.metrics.running,t[49]=re,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,V=String(_),se=_>0?`danger`:`default`,H;t[52]!==i.dashboard.needsAttention||t[53]!==V||t[54]!==se?(H=(0,X.jsx)(It,{icon:ae,label:oe,value:V,tone:se}),t[52]=i.dashboard.needsAttention,t[53]=V,t[54]=se,t[55]=H):H=t[55];let ce;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(ce=(0,X.jsx)(g,{className:`size-4`,"aria-hidden":!0}),t[56]=ce):ce=t[56];let le=i.filters.unread,ue=String(o),U;t[57]!==i.filters.unread||t[58]!==ue?(U=(0,X.jsx)(It,{icon:ce,label:le,value:ue}),t[57]=i.filters.unread,t[58]=ue,t[59]=U):U=t[59];let W;t[60]!==B||t[61]!==ie||t[62]!==H||t[63]!==U?(W=(0,X.jsxs)(`div`,{className:`grid grid-cols-2 gap-px border-b border-edge-subtle bg-edge-subtle lg:grid-cols-4`,children:[B,ie,H,U]}),t[60]=B,t[61]=ie,t[62]=H,t[63]=U,t[64]=W):W=t[64];let G;t[65]!==i||t[66]!==a||t[67]!==d||t[68]!==n?(G=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:w(`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:w(`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:w(`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]=G):G=t[69];let de;return t[70]!==I||t[71]!==W||t[72]!==G?(de=(0,X.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge-subtle bg-surface-base shadow-surface`,"aria-labelledby":`automation-activity-title`,children:[I,W,G]}),t[70]=I,t[71]=W,t[72]=G,t[73]=de):de=t[73],de}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)(V,{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:w(`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:w(`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)(ce,{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:w(`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:w(`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)(ie,{className:w(`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:y,onSuggestRepair:b,onApplyRepair:x}=e;if(!r){let e;t[0]===n?e=t[1]:(e=w(`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 S=r.error||r.summary,C=r.conversationId?`/chat/${encodeURIComponent(r.conversationId)}`:r.workflowRunId?`/workflows?run=${encodeURIComponent(r.workflowRunId)}`:null,T=r.conversationId?a.runDetail.openConversation:a.runDetail.openWorkflow,E=r.conversationId?re:me,D=bt(r)?s:r.status===`succeeded`?g:h,O;t[8]===n?O=t[9]:(O=w(`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 P;t[19]===r.status?P=t[20]:(P=w(`shrink-0 rounded-full px-2 py-0.5 text-xs`,vt(r.status)),t[19]=r.status,t[20]=P);let F=a.status[r.status],I;t[21]!==P||t[22]!==F?(I=(0,X.jsx)(`span`,{className:P,children:F}),t[21]=P,t[22]=F,t[23]=I):I=t[23];let L;t[24]!==M||t[25]!==I?(L=(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[M,I]}),t[24]=M,t[25]=I,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 ee;t[31]===R?ee=t[32]:(ee=(0,X.jsx)(`span`,{children:R}),t[31]=R,t[32]=ee);let B;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,X.jsx)(`span`,{"aria-hidden":!0,children:`·`}),t[33]=B):B=t[33];let te=a.details.duration,ae;t[34]!==a||t[35]!==r.durationMs?(ae=yt(r.durationMs,a),t[34]=a,t[35]=r.durationMs,t[36]=ae):ae=t[36];let oe;t[37]!==a.details.duration||t[38]!==ae?(oe=(0,X.jsxs)(`span`,{children:[te,` `,ae]}),t[37]=a.details.duration,t[38]=ae,t[39]=oe):oe=t[39];let V;t[40]!==ee||t[41]!==oe?(V=(0,X.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-fg-muted`,children:[ee,B,oe]}),t[40]=ee,t[41]=oe,t[42]=V):V=t[42];let se;t[43]!==a.repair||t[44]!==b||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)(N,{variant:`secondary`,onClick:()=>b(r),disabled:p,children:[(0,X.jsx)(ue,{className:`size-4`}),p?a.repair.generating:a.repair.suggest]})}):null,t[43]=a.repair,t[44]=b,t[45]=p,t[46]=r,t[47]=se):se=t[47];let H;t[48]!==V||t[49]!==se||t[50]!==L?(H=(0,X.jsxs)(`div`,{className:`border-b border-edge px-4 py-3`,children:[L,V,se]}),t[48]=V,t[49]=se,t[50]=L,t[51]=H):H=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 le;t[54]===ce?le=t[55]:(le=w(`size-4`,ce),t[54]=ce,t[55]=le);let U;t[56]!==D||t[57]!==le?(U=(0,X.jsx)(D,{className:le}),t[56]=D,t[57]=le,t[58]=U):U=t[58];let W;t[59]!==a.runDetail.resultTitle||t[60]!==U?(W=(0,X.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[U,a.runDetail.resultTitle]}),t[59]=a.runDetail.resultTitle,t[60]=U,t[61]=W):W=t[61];let G;t[62]!==E||t[63]!==T||t[64]!==C?(G=C?(0,X.jsx)(N,{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)(E,{className:`size-3.5`}),T,(0,X.jsx)(l,{className:`size-3.5`})]})}):null,t[62]=E,t[63]=T,t[64]=C,t[65]=G):G=t[65];let de;t[66]!==W||t[67]!==G?(de=(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[W,G]}),t[66]=W,t[67]=G,t[68]=de):de=t[68];let fe=r.error&&`border-red-500/25 bg-red-500/5`,pe;t[69]===fe?pe=t[70]:(pe=w(`mt-3 max-h-80 overflow-y-auto rounded-lg border border-edge/70 bg-surface-inset/25 p-3`,fe),t[69]=fe,t[70]=pe);let he;t[71]!==a.runDetail.noResult||t[72]!==a.runDetail.resultPending||t[73]!==S||t[74]!==r?(he=S?r.error?(0,X.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-sm leading-relaxed text-red-700 dark:text-red-300`,children:S}):(0,X.jsx)(v,{content:S,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]=S,t[74]=r,t[75]=he):he=t[75];let K;t[76]!==pe||t[77]!==he?(K=(0,X.jsx)(`div`,{className:pe,children:he}),t[76]=pe,t[77]=he,t[78]=K):K=t[78];let ge;t[79]!==de||t[80]!==K?(ge=(0,X.jsxs)(`section`,{className:`border-b border-edge p-4`,children:[de,K]}),t[79]=de,t[80]=K,t[81]=ge):ge=t[81];let _e;t[82]===a.runDetail.runInfo?_e=t[83]:(_e=(0,X.jsx)(`div`,{className:`text-xs font-semibold uppercase text-fg-muted`,children:a.runDetail.runInfo}),t[82]=a.runDetail.runInfo,t[83]=_e);let ve;t[84]!==c||t[85]!==a||t[86]!==u||t[87]!==r.manual||t[88]!==r.triggerSnapshot?(ve=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]=ve):ve=t[89];let ye;t[90]!==a.explain.whyRan||t[91]!==ve?(ye=(0,X.jsx)(Yt,{label:a.explain.whyRan,value:ve}),t[90]=a.explain.whyRan,t[91]=ve,t[92]=ye):ye=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]!==ye||t[104]!==Se||t[105]!==Ce?(we=(0,X.jsxs)(`div`,{className:`mt-3 grid gap-2 text-xs text-fg-muted`,children:[ye,Se,Ce]}),t[103]=ye,t[104]=Se,t[105]=Ce,t[106]=we):we=t[106];let Te;t[107]!==_e||t[108]!==we?(Te=(0,X.jsxs)(`section`,{className:`border-b border-edge p-4`,children:[_e,we]}),t[107]=_e,t[108]=we,t[109]=Te):Te=t[109];let Ee;t[110]!==_||t[111]!==a||t[112]!==x||t[113]!==y||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=>y(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)(N,{variant:`primary`,onClick:()=>x(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]=x,t[113]=y,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)(ne,{className:`size-4 shrink-0`}),t[118]=De):De=t[118];let J;t[119]===a.runDetail.technicalEvents?J=t[120]:(J=(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]=J);let Oe;t[121]!==i.length||t[122]!==a.runDetail.eventCount?(Oe=a.runDetail.eventCount.replace(`{count}`,String(i.length)),t[121]=i.length,t[122]=a.runDetail.eventCount,t[123]=Oe):Oe=t[123];let ke;t[124]===Symbol.for(`react.memo_cache_sentinel`)?(ke=(0,X.jsx)(ie,{className:`size-4 transition-transform group-open:rotate-180`}),t[124]=ke):ke=t[124];let Ae;t[125]===Oe?Ae=t[126]:(Ae=(0,X.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1 text-xs text-fg-muted`,children:[Oe,ke]}),t[125]=Oe,t[126]=Ae);let je;t[127]!==J||t[128]!==Ae?(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:[J,Ae]}),t[127]=J,t[128]=Ae,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)(z,{className:`h-10 w-full`}),(0,X.jsx)(z,{className:`h-10 w-4/5`}),(0,X.jsx)(z,{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:w(`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)(ie,{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]!==H||t[143]!==ge||t[144]!==Te||t[145]!==Ee||t[146]!==Pe?(Fe=(0,X.jsxs)(`aside`,{className:O,children:[H,ge,Te,Ee,Pe]}),t[141]=O,t[142]=H,t[143]=ge,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`,b=d===`automation:${n.id}:toggle`,x=d===`automation:${n.id}:delete`,S;t[0]===n.management?S=t[1]:(S=!n.management||n.management.editable.includes(`enabled`),t[0]=n.management,t[1]=S);let C=S,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 D=E,O=!n.management||n.management.deletable,k;t[4]===n.name?k=t[5]:(k=(0,X.jsx)(`h2`,{className:`truncate text-lg font-semibold text-fg`,children:n.name}),t[4]=n.name,t[5]=k);let A=n.enabled?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-surface-hover text-fg-muted`,j;t[6]===A?j=t[7]:(j=w(`shrink-0 rounded-full px-2 py-0.5 text-xs`,A),t[6]=A,t[7]=j);let M=n.enabled?o.enabled:o.paused,P;t[8]!==j||t[9]!==M?(P=(0,X.jsx)(`span`,{className:j,children:M}),t[8]=j,t[9]=M,t[10]=P):P=t[10];let F;t[11]!==k||t[12]!==P?(F=(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[k,P]}),t[11]=k,t[12]=P,t[13]=F):F=t[13];let I;t[14]===n?I=t[15]:(I=Ct(n)?(0,X.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:Ct(n)}):null,t[14]=n,t[15]=I);let L;t[16]===n.action.kind?L=t[17]:(L=(0,X.jsx)(gt,{kind:n.action.kind,className:`size-3.5`}),t[16]=n.action.kind,t[17]=L);let R;t[18]!==n.action||t[19]!==o?(R=pt(n.action,o),t[18]=n.action,t[19]=o,t[20]=R):R=t[20];let ee;t[21]!==L||t[22]!==R?(ee=(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:[L,R]}),t[21]=L,t[22]=R,t[23]=ee):ee=t[23];let B;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,X.jsx)(ce,{className:`size-3.5`,"aria-hidden":!0}),t[24]=B):B=t[24];let te;t[25]!==n.trigger||t[26]!==c||t[27]!==o||t[28]!==l?(te=xe(n.trigger,o,c,l),t[25]=n.trigger,t[26]=c,t[27]=o,t[28]=l,t[29]=te):te=t[29];let ne;t[30]===te?ne=t[31]:(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:[B,te]}),t[30]=te,t[31]=ne);let re;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,X.jsx)(me,{className:`size-3.5`,"aria-hidden":!0}),t[32]=re):re=t[32];let ie;t[33]!==n.projectId||t[34]!==o.info||t[35]!==u?(ie=u.find(e=>e.id===n.projectId)?.name??o.info.noProject,t[33]=n.projectId,t[34]=o.info,t[35]=u,t[36]=ie):ie=t[36];let oe;t[37]===ie?oe=t[38]:(oe=(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,ie]}),t[37]=ie,t[38]=oe);let V;t[39]!==ee||t[40]!==ne||t[41]!==oe?(V=(0,X.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:[ee,ne,oe]}),t[39]=ee,t[40]=ne,t[41]=oe,t[42]=V):V=t[42];let H;t[43]!==V||t[44]!==F||t[45]!==I?(H=(0,X.jsxs)(`div`,{className:`min-w-0`,children:[F,I,V]}),t[43]=V,t[44]=F,t[45]=I,t[46]=H):H=t[46];let le;t[47]!==n||t[48]!==d||t[49]!==O||t[50]!==D||t[51]!==T||t[52]!==C||t[53]!==x||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]!==b?(le=C||T||D||O?(0,X.jsxs)(`div`,{className:`flex w-full flex-wrap items-center gap-2`,children:[C?(0,X.jsxs)(N,{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:[b?(0,X.jsx)(de,{className:`size-4 animate-spin`}):n.enabled?(0,X.jsx)(se,{className:`size-4`}):(0,X.jsx)(pe,{className:`size-4`}),n.enabled?o.dashboard.pause:o.dashboard.resume]}):null,T?(0,X.jsxs)(N,{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)(pe,{className:`size-4`}),o.dashboard.runNow]}):null,D||O?(0,X.jsxs)(G,{children:[(0,X.jsx)(ve,{asChild:!0,children:(0,X.jsx)(N,{variant:`ghost`,className:`size-9 p-0`,"aria-label":o.details.moreActions,children:(0,X.jsx)(_,{className:`size-4`})})}),(0,X.jsx)(he,{children:(0,X.jsxs)(ge,{align:`end`,className:`z-70 min-w-40 rounded-lg border border-edge bg-surface-panel p-1 shadow-popover`,children:[D?(0,X.jsxs)(_e,{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)(y,{className:`size-4`}),o.edit]}):null,O?(0,X.jsxs)(_e,{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:[x?(0,X.jsx)(de,{className:`size-4 animate-spin`}):(0,X.jsx)(ae,{className:`size-4`}),o.dashboard.delete]}):null]})})]}):null]}):null,t[47]=n,t[48]=d,t[49]=O,t[50]=D,t[51]=T,t[52]=C,t[53]=x,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]=b,t[68]=le):le=t[68];let ue;t[69]!==H||t[70]!==le?(ue=(0,X.jsxs)(`header`,{className:`flex flex-col items-start gap-3 border-b border-edge px-5 py-4`,children:[H,le]}),t[69]=H,t[70]=le,t[71]=ue):ue=t[71];let U;t[72]===o.dashboard.latestResult?U=t[73]:(U=(0,X.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:o.dashboard.latestResult}),t[72]=o.dashboard.latestResult,t[73]=U);let W;t[74]!==o.experience.viewResult||t[75]!==p||t[76]!==r[0]?(W=r[0]?(0,X.jsx)(N,{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]=W):W=t[77];let fe;t[78]!==U||t[79]!==W?(fe=(0,X.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center justify-between gap-2`,children:[U,W]}),t[78]=U,t[79]=W,t[80]=fe):fe=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)(z,{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:w(`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)(v,{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]!==fe||t[94]!==ye||t[95]!==be?(Se=(0,X.jsxs)(`section`,{children:[fe,ye,be]}),t[93]=fe,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 J;t[106]!==Ee||t[107]!==De?(J=(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]=J):J=t[108];let Oe;t[109]!==o||t[110]!==l||t[111]!==p||t[112]!==r||t[113]!==i?(Oe=i?(0,X.jsx)(z,{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:w(`shrink-0 rounded-full px-2 py-0.5 text-xs`,vt(e.status)),children:o.status[e.status]})]}),(0,X.jsx)(`p`,{className:w(`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]=Oe):Oe=t[114];let ke;t[115]!==J||t[116]!==Oe?(ke=(0,X.jsxs)(`section`,{className:`min-w-0`,children:[J,Oe]}),t[115]=J,t[116]=Oe,t[117]=ke):ke=t[117];let Ae;t[118]===o.experience.settings?Ae=t[119]:(Ae=(0,X.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:o.experience.settings}),t[118]=o.experience.settings,t[119]=Ae);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)(v,{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]!==Ae||t[135]!==Pe?(Fe=(0,X.jsxs)(`details`,{className:`rounded-lg border border-edge-subtle p-4`,children:[Ae,Pe]}),t[134]=Ae,t[135]=Pe,t[136]=Fe):Fe=t[136];let Y;t[137]!==ke||t[138]!==Fe?(Y=(0,X.jsxs)(`div`,{className:`grid gap-5`,children:[ke,Fe]}),t[137]=ke,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]!==ue||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:[ue,Le]}),t[143]=ue,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,b;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 x=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(b=[],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],b.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],b.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],b.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],b.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],b.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],b.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],b.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],b.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],b.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]=b}else b=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 S;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,X.jsx)(ce,{className:`size-4`,"aria-hidden":!0}),t[72]=S):S=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 T=n.enabled?`${r.info.nextRun}:${s}`:s;t[78]!==r.info.schedule||t[79]!==x||t[80]!==w||t[81]!==T?(m=(0,X.jsx)(Jt,{icon:S,label:C,value:w,description:T,descriptionTitle:x}),t[78]=r.info.schedule,t[79]=x,t[80]=w,t[81]=T,t[82]=m):m=t[82];let E;t[83]===n.action.kind?E=t[84]:(E=n.action.kind===`workflow`?(0,X.jsx)(me,{className:`size-4`,"aria-hidden":!0}):n.action.kind===`browser_automation`?(0,X.jsx)(ne,{className:`size-4`,"aria-hidden":!0}):n.action.kind===`task_command`?(0,X.jsx)(g,{className:`size-4`,"aria-hidden":!0}):(0,X.jsx)(V,{className:`size-4`,"aria-hidden":!0}),t[83]=n.action.kind,t[84]=E);let D=r.info.action,O;t[85]!==n.action||t[86]!==r?(O=ft(n.action,r),t[85]=n.action,t[86]=r,t[87]=O):O=t[87],t[88]!==r.info.action||t[89]!==E||t[90]!==O?(_=(0,X.jsx)(Jt,{icon:E,label:D,value:O}),t[88]=r.info.action,t[89]=E,t[90]=O,t[91]=_):_=t[91],c=Jt,t[92]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,X.jsx)(fe,{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]=b}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],b=t[14];let x;t[93]!==c||t[94]!==l||t[95]!==u||t[96]!==d||t[97]!==f?(x=(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]=x):x=t[98];let S;t[99]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,X.jsx)(me,{className:`size-4`,"aria-hidden":!0}),t[99]=S):S=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:S,label:r.info.project,value:C}),t[104]=r.info.project,t[105]=C,t[106]=w):w=t[106];let T;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,X.jsx)(re,{className:`size-4`,"aria-hidden":!0}),t[107]=T):T=t[107];let E=n.conversationMode===`continuous`?r.info.continuousConversation:r.info.newConversation,D;t[108]!==r.info.conversation||t[109]!==E?(D=(0,X.jsx)(Jt,{icon:T,label:r.info.conversation,value:E}),t[108]=r.info.conversation,t[109]=E,t[110]=D):D=t[110];let O;t[111]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,X.jsx)(h,{className:`size-4`,"aria-hidden":!0}),t[111]=O):O=t[111];let k=n.delivery.notificationPolicy===`all`?r.info.notifyAll:n.delivery.notificationPolicy===`none`?r.info.notifyNone:r.info.notifyAttention,A;t[112]!==r.info.notifications||t[113]!==k?(A=(0,X.jsx)(Jt,{icon:O,label:r.info.notifications,value:k}),t[112]=r.info.notifications,t[113]=k,t[114]=A):A=t[114];let j;t[115]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,X.jsx)(s,{className:`size-4`,"aria-hidden":!0}),t[115]=j):j=t[115];let M=r.info.lastRun,N;t[116]!==n||t[117]!==r||t[118]!==a?(N=Ce(n,r,a),t[116]=n,t[117]=r,t[118]=a,t[119]=N):N=t[119];let P=n.state.lastRunStatus===`failed`||n.state.lastRunStatus===`timeout`?`danger`:`default`,F;t[120]!==r.info.lastRun||t[121]!==N||t[122]!==P?(F=(0,X.jsx)(Jt,{icon:j,label:M,value:N,valueTone:P}),t[120]=r.info.lastRun,t[121]=N,t[122]=P,t[123]=F):F=t[123];let I;t[124]!==n.state.consecutiveFailures||t[125]!==n.state.lastError||t[126]!==r.dashboard?(I=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]=I):I=t[127];let L;t[128]!==r.info.technicalDetails||t[129]!==b?(L=b.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)(ie,{className:`size-4 transition-transform group-open:rotate-180`,"aria-hidden":!0})]}),(0,X.jsx)(`div`,{className:`mt-3 grid gap-2`,children:b.map(qt)})]}):null,t[128]=r.info.technicalDetails,t[129]=b,t[130]=L):L=t[130];let R;t[131]!==x||t[132]!==w||t[133]!==D||t[134]!==A||t[135]!==F||t[136]!==I||t[137]!==L||t[138]!==p||t[139]!==m||t[140]!==_?(R=(0,X.jsxs)(`div`,{className:p,children:[m,_,x,w,D,A,F,I,L]}),t[131]=x,t[132]=w,t[133]=D,t[134]=A,t[135]=F,t[136]=I,t[137]=L,t[138]=p,t[139]=m,t[140]=_,t[141]=R):R=t[141];let z;return t[142]!==R||t[143]!==v||t[144]!==y?(z=(0,X.jsxs)(`aside`,{className:v,children:[y,R]}),t[142]=R,t[143]=v,t[144]=y,t[145]=z):z=t[145],z}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=w(`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=w(`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,T=C(b).agentsSettings,E;t[0]===i?E=t[1]:(E=e=>i(t=>({...t,...e})),t[0]=i,t[1]=E);let D=E,O=De(n.intervalValue,n.intervalUnit),k=Date.now(),A;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(A=[1,2,3],t[2]=A):A=t[2];let j;t[3]!==O||t[4]!==k||t[5]!==b?(j=A.map(e=>Se(k+O*e,b,k)),t[3]=O,t[4]=k,t[5]=b,t[6]=j):j=t[6];let M=j,N;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],N=v.filter(e),t[7]=n.projectId,t[8]=n.taskId,t[9]=v,t[10]=N}else N=t[10];let P=N,F,I;t[14]!==_||t[15]!==n.actionMode||t[16]!==n.agentId||t[17]!==i?(F=()=>{n.actionMode!==`task_command`||n.agentId.trim()||!_||i(e=>({...e,agentId:_}))},I=[_,n.actionMode,n.agentId,i],t[14]=_,t[15]=n.actionMode,t[16]=n.agentId,t[17]=i,t[18]=F,t[19]=I):(F=t[18],I=t[19]),(0,Y.useEffect)(F,I);let L,R;t[20]!==n.actionMode||t[21]!==n.workflowId||t[22]!==i||t[23]!==o?(L=()=>{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}))},R=[n.actionMode,n.workflowId,i,o],t[20]=n.actionMode,t[21]=n.workflowId,t[22]=i,t[23]=o,t[24]=L,t[25]=R):(L=t[24],R=t[25]),(0,Y.useEffect)(L,R);let z,ee;t[26]!==u||t[27]!==n.actionMode||t[28]!==n.browserAutomationId||t[29]!==i?(z=()=>{if(n.actionMode!==`browser_automation`||n.browserAutomationId.trim())return;let e=u[0];e&&i(t=>({...t,browserAutomationId:e.id,browserAutomationInputs:Pe(e)}))},ee=[u,n.actionMode,n.browserAutomationId,i],t[26]=u,t[27]=n.actionMode,t[28]=n.browserAutomationId,t[29]=i,t[30]=z,t[31]=ee):(z=t[30],ee=t[31]),(0,Y.useEffect)(z,ee);let B;t[32]===D?B=t[33]:(B=e=>D({name:e.target.value}),t[32]=D,t[33]=B);let te;t[34]!==n.name||t[35]!==B?(te=(0,X.jsx)(`input`,{className:Q,value:n.name,onChange:B}),t[34]=n.name,t[35]=B,t[36]=te):te=t[36];let ne;t[37]!==r.form.name||t[38]!==te?(ne=(0,X.jsx)($,{label:r.form.name,children:te}),t[37]=r.form.name,t[38]=te,t[39]=ne):ne=t[39];let re;t[40]===D?re=t[41]:(re=e=>D({description:e.target.value}),t[40]=D,t[41]=re);let ae;t[42]!==n.description||t[43]!==re?(ae=(0,X.jsx)(`input`,{className:Q,value:n.description,onChange:re}),t[42]=n.description,t[43]=re,t[44]=ae):ae=t[44];let oe;t[45]!==r.form.description||t[46]!==ae?(oe=(0,X.jsx)($,{label:r.form.description,children:ae}),t[45]=r.form.description,t[46]=ae,t[47]=oe):oe=t[47];let V;t[48]!==n.projectId||t[49]!==r.form.noProject||t[50]!==r.form.project||t[51]!==S||t[52]!==a||t[53]!==D?(V=S?null:(0,X.jsx)($,{label:r.form.project,children:(0,X.jsxs)(f,{className:Q,value:n.projectId,onChange:e=>D({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]=D,t[54]=V):V=t[54];let se=r.form.rulePreview,ce;t[55]===r.form.rulePreview?ce=t[56]:(ce=(0,X.jsx)(`div`,{className:`text-xs font-medium text-accent-fg`,children:r.form.rulePreview}),t[55]=r.form.rulePreview,t[56]=ce);let le;t[57]!==n.triggerMode||t[58]!==r?(le=ht(n.triggerMode,r),t[57]=n.triggerMode,t[58]=r,t[59]=le):le=t[59];let ue;t[60]===le?ue=t[61]:(ue=(0,X.jsx)(`span`,{children:le}),t[60]=le,t[61]=ue);let U;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,X.jsx)(l,{className:`size-4 text-fg-subtle`,"aria-hidden":!0}),t[62]=U):U=t[62];let G;t[63]!==n.actionMode||t[64]!==r?(G=mt(n.actionMode,r),t[63]=n.actionMode,t[64]=r,t[65]=G):G=t[65];let de;t[66]===G?de=t[67]:(de=(0,X.jsx)(`span`,{children:G}),t[66]=G,t[67]=de);let fe;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(fe=(0,X.jsx)(l,{className:`size-4 text-fg-subtle`,"aria-hidden":!0}),t[68]=fe):fe=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 he;t[76]!==ue||t[77]!==de||t[78]!==me?(he=(0,X.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-2 text-sm text-fg`,children:[ue,U,de,fe,me]}),t[76]=ue,t[77]=de,t[78]=me,t[79]=he):he=t[79];let K;t[80]!==r.form.rulePreview||t[81]!==ce||t[82]!==he?(K=(0,X.jsxs)(`div`,{className:`rounded-xl border border-accent/20 bg-accent/5 px-4 py-3`,"aria-label":se,children:[ce,he]}),t[80]=r.form.rulePreview,t[81]=ce,t[82]=he,t[83]=K):K=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]===D?_e=t[88]:(_e=e=>D({triggerMode:e.target.value}),t[87]=D,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 Oe;t[101]===r.trigger.webhook?Oe=t[102]:(Oe=(0,X.jsx)(p,{value:`webhook`,children:r.trigger.webhook}),t[101]=r.trigger.webhook,t[102]=Oe);let ke;t[103]===r.trigger.taskBlocked?ke=t[104]:(ke=(0,X.jsx)(p,{value:`taskBlocked`,children:r.trigger.taskBlocked}),t[103]=r.trigger.taskBlocked,t[104]=ke);let Ae;t[105]===r.trigger.noteCreated?Ae=t[106]:(Ae=(0,X.jsx)(p,{value:`noteCreated`,children:r.trigger.noteCreated}),t[105]=r.trigger.noteCreated,t[106]=Ae);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]!==Oe||t[122]!==ke||t[123]!==Ae||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,Oe,ke,Ae,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]=Oe,t[122]=ke,t[123]=Ae,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]!==D?(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=>D({onceAt:e.target.value})})}):null,t[128]=n.onceAt,t[129]=n.triggerMode,t[130]=r.form.onceAt,t[131]=D,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]!==D?(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=>D({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=>D({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]=D,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=>D({intervalValue:e.target.value})}),(0,X.jsxs)(f,{className:Q,value:n.intervalUnit,onChange:e=>{let t=e.target.value;D({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===O;return(0,X.jsx)(`button`,{type:`button`,"aria-pressed":n,className:w(`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:()=>D({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(O,b)}),(0,X.jsxs)(`div`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:[r.form.nextThreeRuns,`:`,M.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]!==D?(Ue=n.triggerMode===`cron`?(0,X.jsx)($,{label:r.form.expression,children:(0,X.jsx)(`input`,{className:Q,value:n.cronExpr,onChange:e=>D({cronExpr:e.target.value})})}):null,t[141]=n.cronExpr,t[142]=n.triggerMode,t[143]=r.form.expression,t[144]=D,t[145]=Ue):Ue=t[145];let We;t[146]!==n.triggerMode||t[147]!==n.webhookSecretId||t[148]!==r.form.secretId||t[149]!==D?(We=n.triggerMode===`webhook`?(0,X.jsx)($,{label:r.form.secretId,children:(0,X.jsx)(`input`,{className:Q,value:n.webhookSecretId,onChange:e=>D({webhookSecretId:e.target.value})})}):null,t[146]=n.triggerMode,t[147]=n.webhookSecretId,t[148]=r.form.secretId,t[149]=D,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]!==D?(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=>D({eventType:e.target.value})})}),(0,X.jsx)($,{label:r.form.eventSource,children:(0,X.jsx)(`input`,{className:Q,value:n.eventSource,onChange:e=>D({eventSource:e.target.value})})})]}),(0,X.jsxs)($,{label:r.form.eventPayloadMatch,children:[(0,X.jsx)(`textarea`,{className:w(Q,`min-h-24 resize-y font-mono text-xs`),value:n.eventPayloadMatch,onChange:e=>D({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]=D,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]!==D||t[167]!==o?(Je=e=>{let t=e.target.value,r=Number.parseInt(n.timeoutSeconds,10);D({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]=D,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=>D({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:H(e,T)},e.id))]})}),nt;t[184]!==P||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]!==D||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)(W,{value:n.model,onChange:e=>D({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)(J,{value:n.instruction,onApply:e=>D({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:w(Q,`min-h-32 resize-y`),value:n.instruction,onChange:e=>D({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=>D({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=>D({workflowInput:e,workflowGoal:e.goal,workflowInputValid:!0}),mode:`automation`,badgeLabel:r.form.triggeredRun,onValidityChange:e=>D({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=>D({taskId:e.target.value}),disabled:y||P.length===0,children:[y?(0,X.jsx)(p,{value:``,children:r.form.loadingTasks}):null,!y&&P.length===0?(0,X.jsx)(p,{value:``,children:r.form.noTasks}):null,P.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);D({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=>D({browserAutomationInputs:e})})}):null]}),t[184]=P,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]=D,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)(ie,{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]!==D?(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;D({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]=D,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]===D?ut=t[240]:(ut=e=>D({conversationMode:e.target.value}),t[239]=D,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]===D?_t=t[254]:(_t=e=>D({notificationPolicy:e.target.value}),t[253]=D,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]===D?Ct=t[271]:(Ct=e=>D({resultWebhookEndpoint:e.target.value}),t[270]=D,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]===D?Tt=t[276]:(Tt=e=>D({resultWebhookSecretId:e.target.value}),t[275]=D,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]===D?At=t[290]:(At=e=>D({timeoutSeconds:e.target.value}),t[289]=D,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]===D?Nt=t[298]:(Nt=e=>D({disableAfterFailures:e.target.value}),t[297]=D,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]!==ne||t[333]!==oe||t[334]!==V||t[335]!==K||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:[ne,oe,V,K,ge,Re,ze,Be,He,Ue,We,Ge,qe,et,tt,nt,Ut]})}),t[331]=Ut,t[332]=ne,t[333]=oe,t[334]=V,t[335]=K,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)(me,{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};