@xopcai/xopc 0.0.179 → 0.0.180

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 (221) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/xopc.extension.json +1 -1
  3. package/dist/gateway/static/root/assets/{activity-store-A5FUMjeV.js → activity-store-DFKtQDgE.js} +1 -1
  4. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-NghNiDWx.js → agent-avatar-dicebear-CcTvB_4W.js} +1 -1
  5. package/dist/gateway/static/root/assets/{agents-Baq8Shzy.js → agents-DgGj9bu6.js} +1 -1
  6. package/dist/gateway/static/root/assets/{api-Bmzslx0Z.js → api-CUClAvuL.js} +1 -1
  7. package/dist/gateway/static/root/assets/{app-management-settings-panel-DDWS_BBJ.js → app-management-settings-panel-Ib-cWKHM.js} +1 -1
  8. package/dist/gateway/static/root/assets/{appearance-settings-C6znvVtX.js → appearance-settings-CRSN8WuA.js} +1 -1
  9. package/dist/gateway/static/root/assets/{apps-page-d-Y0Jbe1.js → apps-page-B5xahuT-.js} +1 -1
  10. package/dist/gateway/static/root/assets/{archive-plugin-fvTZhPUr.js → archive-plugin-BBF9zspN.js} +1 -1
  11. package/dist/gateway/static/root/assets/{attachment-load-BFEgvg-Q.js → attachment-load-D3QQfA7w.js} +1 -1
  12. package/dist/gateway/static/root/assets/automations-page-BUYrvMmD.js +6 -0
  13. package/dist/gateway/static/root/assets/{binary-plugins-CuI2bOc7.js → binary-plugins-D78XOjJ3.js} +1 -1
  14. package/dist/gateway/static/root/assets/{block-editor-Z_k8W0al.js → block-editor-D_VVXlYX.js} +1 -1
  15. package/dist/gateway/static/root/assets/{browser-settings-page-CGApoYPr.js → browser-settings-page-Cjw07q9h.js} +1 -1
  16. package/dist/gateway/static/root/assets/{browser-workflow-inputs-gs6b5e9-.js → browser-workflow-inputs-_gu08MA4.js} +1 -1
  17. package/dist/gateway/static/root/assets/{browser-workflows-page-Cq5qXStp.js → browser-workflows-page-58DBMXgG.js} +1 -1
  18. package/dist/gateway/static/root/assets/{capabilities-settings-panel-BC-8n4Hl.js → capabilities-settings-panel-D_dfVxHY.js} +1 -1
  19. package/dist/gateway/static/root/assets/{capability-presets-api-BTKhPoDC.js → capability-presets-api-DhCn9rPv.js} +1 -1
  20. package/dist/gateway/static/root/assets/{capability-presets-settings-panel-D7WQ0oBN.js → capability-presets-settings-panel-LWWIYUT7.js} +1 -1
  21. package/dist/gateway/static/root/assets/{channel-recipient-api-TwMak0SE.js → channel-recipient-api-DYtoNV5A.js} +1 -1
  22. package/dist/gateway/static/root/assets/{channels-settings-DysELlO_.js → channels-settings-Cyj5OunL.js} +1 -1
  23. package/dist/gateway/static/root/assets/channels-status-swr-TEFnV0IG.js +1 -0
  24. package/dist/gateway/static/root/assets/{connector-logo-DBKotvNr.js → connector-logo-CxIXnifA.js} +1 -1
  25. package/dist/gateway/static/root/assets/{connectors-page-QH-0WnOo.js → connectors-page-0TobCpBB.js} +2 -2
  26. package/dist/gateway/static/root/assets/{desktop-pet-Dwml8znf.js → desktop-pet-CwVSLL6N.js} +1 -1
  27. package/dist/gateway/static/root/assets/{desktop-pet-settings-CyIg2jJp.js → desktop-pet-settings-BOIp4q0Z.js} +1 -1
  28. package/dist/gateway/static/root/assets/{directory-picker-path-field-B6fc_7SL.js → directory-picker-path-field-C8_lsW6S.js} +1 -1
  29. package/dist/gateway/static/root/assets/{dreaming-settings-CUQxGnDf.js → dreaming-settings-Da9FeWQl.js} +1 -1
  30. package/dist/gateway/static/root/assets/{extension-debug-page-AbRNi2ON.js → extension-debug-page-CMNnSJP6.js} +1 -1
  31. package/dist/gateway/static/root/assets/{extension-page-ClYfiLXC.js → extension-page-t0pJqLvM.js} +1 -1
  32. package/dist/gateway/static/root/assets/{extension-settings-page-BGVP2hw1.js → extension-settings-page-aiR-tKnW.js} +1 -1
  33. package/dist/gateway/static/root/assets/{gateway-config-api-B7GqtklK.js → gateway-config-api-CkyQBD6r.js} +1 -1
  34. package/dist/gateway/static/root/assets/{gateway-settings-BMeK8igT.js → gateway-settings-BIZfAgfB.js} +1 -1
  35. package/dist/gateway/static/root/assets/{gateway-startup-retry-CKKL96r_.js → gateway-startup-retry-CSU7UvzG.js} +1 -1
  36. package/dist/gateway/static/root/assets/{goals-settings-Dj0ao2qA.js → goals-settings-Dx9uTyWF.js} +1 -1
  37. package/dist/gateway/static/root/assets/{heartbeat-settings-CTI2nPKa.js → heartbeat-settings-Cnr5ORXL.js} +1 -1
  38. package/dist/gateway/static/root/assets/{image-generation-api-BY3VQ5Mv.js → image-generation-api-BR6Kb77X.js} +1 -1
  39. package/dist/gateway/static/root/assets/{index-BDzspHrg.js → index-BA56bQ68.js} +8 -8
  40. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-CELtDFz3.js → keyboard-shortcuts-settings-D76uYKeQ.js} +1 -1
  41. package/dist/gateway/static/root/assets/{local-app-workbench-page-m8CTSGix.js → local-app-workbench-page-DSUNtLHg.js} +1 -1
  42. package/dist/gateway/static/root/assets/{local-apps-page-CF5uUd1n.js → local-apps-page-BsLnojTh.js} +1 -1
  43. package/dist/gateway/static/root/assets/{locale-store-DIVc0AQs.js → locale-store-BNC8HUCI.js} +1 -1
  44. package/dist/gateway/static/root/assets/{logs-page-DmH7Tk4k.js → logs-page-yI8kpQtO.js} +1 -1
  45. package/dist/gateway/static/root/assets/{markdown-split-CN85EdB8.js → markdown-split-D6smTQWD.js} +1 -1
  46. package/dist/gateway/static/root/assets/{media-plugins-CxYEc-b8.js → media-plugins-D1TmMF0A.js} +1 -1
  47. package/dist/gateway/static/root/assets/{messages-DYqBwJAK.js → messages-H_iJjnEM.js} +3 -3
  48. package/dist/gateway/static/root/assets/{notes-page-Goab4781.js → notes-page-Vt-diFf0.js} +1 -1
  49. package/dist/gateway/static/root/assets/{notes-workbench-C4jDBVBN.js → notes-workbench-BD297EZt.js} +2 -2
  50. package/dist/gateway/static/root/assets/{outcome-detail-page-DNRfeLZp.js → outcome-detail-page-C5i_ZR9a.js} +1 -1
  51. package/dist/gateway/static/root/assets/{page-tabs-tQNQcAts.js → page-tabs-BnSzIjH0.js} +1 -1
  52. package/dist/gateway/static/root/assets/{preview-open-alternatives-BSTlgsDB.js → preview-open-alternatives-CF12Eqi4.js} +1 -1
  53. package/dist/gateway/static/root/assets/{product-open-page-iQ5gTCip.js → product-open-page-Du0TE_CU.js} +1 -1
  54. package/dist/gateway/static/root/assets/{project-detail-page-D7anK-eu.js → project-detail-page-D1HGz7Dy.js} +1 -1
  55. package/dist/gateway/static/root/assets/{projects-page-BePESKWy.js → projects-page-CqP2TnW-.js} +1 -1
  56. package/dist/gateway/static/root/assets/{remote-access-hub-CHrzBKIs.js → remote-access-hub-BXdVJLS3.js} +1 -1
  57. package/dist/gateway/static/root/assets/{save-bar-controls-BsPf5Gkk.js → save-bar-controls-B53UNtDM.js} +1 -1
  58. package/dist/gateway/static/root/assets/{schedule-field-kAytH7mq.js → schedule-field-C3dIMN5q.js} +1 -1
  59. package/dist/gateway/static/root/assets/{schema-form-Bbw8l2ri.js → schema-form-BKvpxqof.js} +1 -1
  60. package/dist/gateway/static/root/assets/{sessions-page-He5YAczL.js → sessions-page-CPAwDdl5.js} +1 -1
  61. package/dist/gateway/static/root/assets/settings-advanced-gate-C-jGsoft.js +1 -0
  62. package/dist/gateway/static/root/assets/{settings-form-section-BqbibcnJ.js → settings-form-section-kt6GIS32.js} +1 -1
  63. package/dist/gateway/static/root/assets/{settings-loading-skeleton-DNLNCEGT.js → settings-loading-skeleton-85eUPcKz.js} +1 -1
  64. package/dist/gateway/static/root/assets/{settings-page-BR6Ss0bK.js → settings-page-Di5x6Xrc.js} +1 -1
  65. package/dist/gateway/static/root/assets/{settings-page-layout-Cdb1e2Cz.js → settings-page-layout-CkkCee_x.js} +1 -1
  66. package/dist/gateway/static/root/assets/{setup-status-panel-moT-D-ia.js → setup-status-panel-uxEE6gAB.js} +1 -1
  67. package/dist/gateway/static/root/assets/{share-preview-page-CkrASny2.js → share-preview-page-BtLEstaI.js} +1 -1
  68. package/dist/gateway/static/root/assets/{shares-settings-X49zY21H.js → shares-settings-2mcsMWgn.js} +1 -1
  69. package/dist/gateway/static/root/assets/skill-reload-api-ocDwsrEt.js +1 -0
  70. package/dist/gateway/static/root/assets/skills-page-9_jfsFU5.js +2 -0
  71. package/dist/gateway/static/root/assets/{skills-page.utils-BG5dGkyA.js → skills-page.utils-C2SHvq8V.js} +1 -1
  72. package/dist/gateway/static/root/assets/{system-settings-panel-XdY8eyYf.js → system-settings-panel-CIJ66cUy.js} +1 -1
  73. package/dist/gateway/static/root/assets/{theme-store-DtwI_VLT.js → theme-store-ClDa_Bci.js} +1 -1
  74. package/dist/gateway/static/root/assets/{time-picker-UghsQu_I.js → time-picker-D0zAsHOo.js} +1 -1
  75. package/dist/gateway/static/root/assets/{typed-models-lib-DOnpwsrE.js → typed-models-lib-GsmwmB40.js} +1 -1
  76. package/dist/gateway/static/root/assets/{use-channel-catalog-BWDtfNvQ.js → use-channel-catalog-BQz3K7xj.js} +1 -1
  77. package/dist/gateway/static/root/assets/{user-context-page-BtNBEtKj.js → user-context-page-Bn4BLg4W.js} +1 -1
  78. package/dist/gateway/static/root/assets/{voice-api-key-field-DP80jW-W.js → voice-api-key-field-Blaxsbb3.js} +1 -1
  79. package/dist/gateway/static/root/assets/{work-copy-hQmivDgT.js → work-copy-Cwyan9Sn.js} +1 -1
  80. package/dist/gateway/static/root/assets/{work-discovery-page-CkDOVZBr.js → work-discovery-page-iJ9RBSpu.js} +1 -1
  81. package/dist/gateway/static/root/assets/{work-item-detail-page-CqvkcFcR.js → work-item-detail-page-CqTH7PQX.js} +1 -1
  82. package/dist/gateway/static/root/assets/{work-page-BL8TZW4Z.js → work-page-H3m99ccS.js} +1 -1
  83. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-BLlVqKdA.js → workflow-run-setup-panel-CTG4RpRE.js} +1 -1
  84. package/dist/gateway/static/root/assets/{workflows-page-BgsdRu3_.js → workflows-page-BxZSKMfv.js} +1 -1
  85. package/dist/gateway/static/root/index.html +6 -6
  86. package/dist/package.js +1 -1
  87. package/dist/src/agent/agent-manager.d.ts +4 -1
  88. package/dist/src/agent/agent-manager.js +21 -7
  89. package/dist/src/agent/bootstrap/filter-bootstrap-files.js +1 -1
  90. package/dist/src/agent/embedded/model-runtime.js +1 -1
  91. package/dist/src/agent/embedded/run-for-session.d.ts +2 -0
  92. package/dist/src/agent/embedded/run-for-session.js +3 -1
  93. package/dist/src/agent/goals/post-turn.js +1 -1
  94. package/dist/src/agent/image/tool-model-config.js +1 -1
  95. package/dist/src/agent/inbound/turn-dispatcher.d.ts +6 -1
  96. package/dist/src/agent/inbound/turn-dispatcher.js +5 -2
  97. package/dist/src/agent/ipc/inbox.js +1 -1
  98. package/dist/src/agent/lifecycle/timeout-wrapper.d.ts +2 -0
  99. package/dist/src/agent/lifecycle/timeout-wrapper.js +39 -9
  100. package/dist/src/agent/mcp/bundle-mcp-materialize.js +2 -2
  101. package/dist/src/agent/mcp/bundle-mcp-runtime.js +6 -1
  102. package/dist/src/agent/mcp/bundle-mcp-types.d.ts +1 -1
  103. package/dist/src/agent/mcp/mcp-transport-config.d.ts +2 -0
  104. package/dist/src/agent/mcp/mcp-transport-config.js +10 -3
  105. package/dist/src/agent/mcp/mcp-transport.d.ts +1 -0
  106. package/dist/src/agent/mcp/mcp-transport.js +5 -2
  107. package/dist/src/agent/memory/dreaming/config.js +1 -1
  108. package/dist/src/agent/orchestration/run-agent-turn-with-timeout.d.ts +1 -1
  109. package/dist/src/agent/orchestration/run-agent-turn-with-timeout.js +6 -2
  110. package/dist/src/agent/service/direct-turn-helpers.d.ts +1 -0
  111. package/dist/src/agent/service/direct-turn-helpers.js +1 -0
  112. package/dist/src/agent/service/process-direct-one-shot.d.ts +3 -0
  113. package/dist/src/agent/service/process-direct-one-shot.js +4 -1
  114. package/dist/src/agent/service.d.ts +1 -0
  115. package/dist/src/agent/service.js +5 -2
  116. package/dist/src/agent/session/session-inspector.js +1 -1
  117. package/dist/src/agent/skills/config.js +6 -0
  118. package/dist/src/agent/skills/filesystem-watcher.d.ts +4 -0
  119. package/dist/src/agent/skills/filesystem-watcher.js +16 -7
  120. package/dist/src/agent/skills/hub-lock.js +1 -1
  121. package/dist/src/agent/skills/index.d.ts +10 -7
  122. package/dist/src/agent/skills/index.js +56 -47
  123. package/dist/src/agent/skills/skill-manage-ops.js +1 -1
  124. package/dist/src/agent/skills/skill-manager.d.ts +5 -2
  125. package/dist/src/agent/skills/skill-manager.js +10 -5
  126. package/dist/src/agent/skills/skill-sources.d.ts +18 -0
  127. package/dist/src/agent/skills/skill-sources.js +143 -0
  128. package/dist/src/agent/skills/types.d.ts +25 -2
  129. package/dist/src/agent/tools/delegate-tool.js +2 -1
  130. package/dist/src/agent/tools/executor.d.ts +2 -0
  131. package/dist/src/agent/tools/executor.js +18 -11
  132. package/dist/src/agent/tools/factory.js +2 -0
  133. package/dist/src/agent/tools/index.d.ts +1 -0
  134. package/dist/src/agent/tools/index.js +2 -1
  135. package/dist/src/agent/tools/managed-job-tool.d.ts +2 -0
  136. package/dist/src/agent/tools/managed-job-tool.js +160 -0
  137. package/dist/src/agent/workspace-runtime/registry.d.ts +3 -0
  138. package/dist/src/agent/workspace-runtime/registry.js +3 -1
  139. package/dist/src/agent-runtime/index.js +1 -1
  140. package/dist/src/agent-runtime/runtime-profile.js +1 -1
  141. package/dist/src/auth/credentials.d.ts +9 -1
  142. package/dist/src/auth/credentials.js +112 -56
  143. package/dist/src/auth/model-credential-store.js +7 -22
  144. package/dist/src/auth/oauth-provider-lock.d.ts +5 -0
  145. package/dist/src/auth/oauth-provider-lock.js +91 -0
  146. package/dist/src/auth/profiles/store.js +1 -1
  147. package/dist/src/auth/sync-provider-auth.js +2 -2
  148. package/dist/src/automations/domain/defaults.d.ts +8 -1
  149. package/dist/src/automations/domain/defaults.js +9 -2
  150. package/dist/src/automations/domain/index.js +2 -2
  151. package/dist/src/automations/domain/types.d.ts +33 -7
  152. package/dist/src/automations/domain/validation.d.ts +8 -0
  153. package/dist/src/automations/domain/validation.js +2 -0
  154. package/dist/src/automations/draft/automation-draft-validator.d.ts +2 -1
  155. package/dist/src/automations/index.js +2 -2
  156. package/dist/src/automations/service/action-executor.d.ts +2 -2
  157. package/dist/src/automations/service/action-executor.js +144 -34
  158. package/dist/src/automations/service/automation-service.d.ts +4 -0
  159. package/dist/src/automations/service/automation-service.js +197 -18
  160. package/dist/src/automations/storage/automation-run-repository.d.ts +1 -0
  161. package/dist/src/automations/storage/automation-run-repository.js +37 -7
  162. package/dist/src/automations/storage/index.js +2 -2
  163. package/dist/src/browser/providers/browser-ext-install.js +1 -1
  164. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  165. package/dist/src/cli/commands/doctor/checks/provider-auth.js +1 -1
  166. package/dist/src/cli/commands/models.js +1 -1
  167. package/dist/src/cli/utils/oauth-login.js +1 -7
  168. package/dist/src/config/agent-profile.js +1 -1
  169. package/dist/src/config/index.js +4 -4
  170. package/dist/src/config/loader.js +1 -1
  171. package/dist/src/config/models-json.js +1 -1
  172. package/dist/src/config/schema.d.ts +3 -0
  173. package/dist/src/config/schema.js +2 -1
  174. package/dist/src/extensions/lockfile.js +1 -1
  175. package/dist/src/gateway/agents-admin.js +2 -2
  176. package/dist/src/gateway/file-path-classifier.js +1 -1
  177. package/dist/src/gateway/heartbeat/service.js +1 -1
  178. package/dist/src/gateway/hono/lib/config-payload.js +1 -1
  179. package/dist/src/gateway/hono/oauth-async.js +1 -7
  180. package/dist/src/gateway/hono/oauth.js +1 -7
  181. package/dist/src/gateway/hono/routes/models.js +1 -1
  182. package/dist/src/gateway/hono/routes/you.js +1 -1
  183. package/dist/src/gateway/service/config-coordinator.js +1 -1
  184. package/dist/src/gateway/service.js +3 -3
  185. package/dist/src/goals/goal-workflow-judge.js +1 -1
  186. package/dist/src/heartbeat/index.js +1 -1
  187. package/dist/src/notes/service.js +1 -1
  188. package/dist/src/projects/project-loop.js +3 -3
  189. package/dist/src/providers/auth-runtime/oauth.js +12 -0
  190. package/dist/src/providers/auth-runtime/resolve-auth.js +1 -1
  191. package/dist/src/providers/index.js +2 -2
  192. package/dist/src/providers/model-registry.js +1 -1
  193. package/dist/src/providers/register-runtime-providers.js +1 -1
  194. package/dist/src/storage/sqlite/migrations/088_automation_execution_deadlines.sql +5 -0
  195. package/dist/src/storage/sqlite/migrations/089_automation_run_leases.sql +8 -0
  196. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  197. package/dist/src/storage/sqlite/migrations/runner.js +3 -3
  198. package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
  199. package/dist/src/storage/sqlite/schema.js +1 -1
  200. package/dist/src/tui/backends/embedded-backend.d.ts +2 -0
  201. package/dist/src/tui/backends/embedded-backend.js +11 -7
  202. package/dist/src/tui/tui-backend.d.ts +2 -0
  203. package/dist/src/tui/tui-oauth-login.js +1 -7
  204. package/dist/src/tui/tui-picker-overlay.js +1 -0
  205. package/dist/src/tui/tui-picker-services.d.ts +1 -0
  206. package/dist/src/tui/tui-skills-autocomplete.d.ts +6 -2
  207. package/dist/src/tui/tui-skills-autocomplete.js +10 -6
  208. package/dist/src/tui/tui-startup-resources.d.ts +3 -1
  209. package/dist/src/tui/tui-startup-resources.js +4 -3
  210. package/dist/src/tui/tui.js +4 -1
  211. package/dist/src/work/home-query-service.d.ts +31 -2
  212. package/dist/src/work/home-query-service.js +4 -4
  213. package/dist/src/work/index.js +2 -2
  214. package/dist/src/workflows/service/workflow-run-service.js +1 -1
  215. package/dist/src/workflows/service/workflow-run-service.types.d.ts +3 -1
  216. package/package.json +1 -1
  217. package/dist/gateway/static/root/assets/automations-page-CFYOCBlQ.js +0 -6
  218. package/dist/gateway/static/root/assets/channels-status-swr-BAC-R8IK.js +0 -1
  219. package/dist/gateway/static/root/assets/settings-advanced-gate-2eAC9GCP.js +0 -1
  220. package/dist/gateway/static/root/assets/skill-reload-api-CjpnFfOH.js +0 -1
  221. package/dist/gateway/static/root/assets/skills-page-DEwfSOUE.js +0 -2
@@ -1 +1 @@
1
- import{r as e,s as t}from"./locale-store-DIVc0AQs.js";async function n(){return(await t(e(`/api/local-apps`))).apps}async function r(n){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}`))).app}async function i(n){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/validate`),{method:`POST`})).validation}async function a(n,r,i){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/acceptance-runs`),{method:`POST`,body:JSON.stringify({sourceHash:r,...i})})).acceptance}async function o(n){return(await t(e(`/api/local-apps`),{method:`POST`,body:JSON.stringify(n)})).app}async function s(n){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/install`),{method:`POST`})).app}async function c(n,r){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/releases/${encodeURIComponent(r)}/rollback`),{method:`POST`})).app}async function l(n,r){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/${r?`enable`:`disable`}`),{method:`POST`})).app}async function u(n){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/install`),{method:`DELETE`})).app}export{a,u as c,n as i,i as l,r as n,c as o,s as r,l as s,o as t};
1
+ import{r as e,s as t}from"./locale-store-BNC8HUCI.js";async function n(){return(await t(e(`/api/local-apps`))).apps}async function r(n){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}`))).app}async function i(n){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/validate`),{method:`POST`})).validation}async function a(n,r,i){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/acceptance-runs`),{method:`POST`,body:JSON.stringify({sourceHash:r,...i})})).acceptance}async function o(n){return(await t(e(`/api/local-apps`),{method:`POST`,body:JSON.stringify(n)})).app}async function s(n){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/install`),{method:`POST`})).app}async function c(n,r){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/releases/${encodeURIComponent(r)}/rollback`),{method:`POST`})).app}async function l(n,r){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/${r?`enable`:`disable`}`),{method:`POST`})).app}async function u(n){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/install`),{method:`DELETE`})).app}export{a,u as c,n as i,i as l,r as n,c as o,s as r,l as s,o as t};
@@ -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"./cn-JdwAhgNB.js";import{t as a}from"./copy-to-clipboard-HOJ79TWv.js";import{t as o}from"./messages-DYqBwJAK.js";import{n as s,r as c,s as l}from"./locale-store-DIVc0AQs.js";import{i as u}from"./vendor-swr-BIWyz7Rc.js";import{Go as d,Hc as f,Jo as p,Ko as m,Ql as h,Ts as g,Uo as _,Vo as v,Wo as y,ds as b,eo as x,js as S,jt as C,qo as w,us as T}from"./index-BDzspHrg.js";import{n as E,r as D}from"./settings-page-layout-Cdb1e2Cz.js";import{t as O}from"./settings-loading-skeleton-DNLNCEGT.js";import{r as k,t as A}from"./settings-form-section-BqbibcnJ.js";var j=n(),M=e(t(),1),N=r();function P(e,t){return e==null?t:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function F(e,t){return e===`PENDING_UPDATE`?t.pendingUpdate??t.generic:e===`UNINSTALLER_NOT_FOUND`?t.uninstallerNotFound??t.generic:e===`NOT_PACKAGED`?t.notPackaged??t.generic:t.generic}function I(e,t){if(e.platform===`darwin`)return t.uninstallDescDarwin;if(e.platform===`win32`)return t.uninstallDescWin;if(e.platform===`linux`){if(e.linuxPackageKind===`appimage`)return t.uninstallDescLinuxAppImage;if(e.linuxPackageKind===`deb`){let n=e.linuxDebPackageName??`xopc`;return t.uninstallDescLinuxDeb.replace(/\{\{package\}\}/g,n)}return t.uninstallDescLinuxUnknown}return t.uninstallDescLinuxUnknown}var L={info:null,loadError:null,actionError:null,copiedField:null,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``,uninstallDialogOpen:!1,removeUserDataOnUninstall:!1,busy:!1};function R({api:e,messages:t,embedded:n=!0}){let[r,o]=(0,M.useReducer)(C,L),{info:s,loadError:c,actionError:l,copiedField:u,clearDialogOpen:p,clearConfirmChecked:x,clearConfirmText:E,uninstallDialogOpen:D,removeUserDataOnUninstall:k,busy:j}=r,R=(0,M.useCallback)(async()=>{if(e?.getUninstallInfo){o({type:`patch`,patch:{loadError:null}});try{o({type:`patch`,patch:{info:await e.getUninstallInfo()}})}catch(e){o({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}}},[e]);(0,M.useEffect)(()=>{R()},[R]);let z=async(e,n)=>{if(await a(e)){o({type:`patch`,patch:{actionError:null,copiedField:n}}),window.setTimeout(()=>o({type:`patch`,patch:{copiedField:null}}),2e3);return}o({type:`patch`,patch:{actionError:t.copyFailed}})},B=async()=>{if(e?.clearUserData){o({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.clearUserData();n.ok||o({type:`patch`,patch:{actionError:F(n.error,t.errors)}})}catch(e){o({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{o({type:`patch`,patch:{busy:!1,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})}}},V=async()=>{if(e?.uninstallApp){o({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.uninstallApp({removeUserData:k});n.ok||o({type:`patch`,patch:{actionError:F(n.error,t.errors)}})}catch(e){o({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{o({type:`patch`,patch:{busy:!1,uninstallDialogOpen:!1}})}}};if(c)return(0,N.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:c});if(!s)return(0,N.jsx)(O,{rows:2});let H=!s.packaged,U=j||s.pendingUpdate||H,W=!H&&s.uninstallMode!==`unsupported`,G=I(s,t),K=x&&E.trim()===t.clearDataConfirmPhrase;return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(A,{children:[n?(0,N.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,N.jsx)(f,{className:`size-4 text-accent`,strokeWidth:1.75}),t.title]}):null,l?(0,N.jsx)(`p`,{className:`mb-3 text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:l}):null,H?(0,N.jsxs)(`div`,{className:`mb-4 rounded-xl bg-surface-panel/70 px-3 py-2.5 shadow-surface`,children:[(0,N.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.devOnlyTitle}),(0,N.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.devOnlyBody})]}):null,s.pendingUpdate?(0,N.jsx)(`p`,{className:`mb-3 rounded-xl border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-xs text-amber-800 dark:text-amber-200`,children:t.pendingUpdateBlocked}):null,(0,N.jsxs)(`dl`,{className:`space-y-3 text-sm`,children:[(0,N.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,children:[(0,N.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:t.appPath}),(0,N.jsxs)(`dd`,{className:`mt-1 flex items-start justify-between gap-2`,children:[(0,N.jsx)(`code`,{className:`break-all text-xs text-fg`,children:s.appPath}),(0,N.jsxs)(`button`,{type:`button`,className:i(`inline-flex shrink-0 items-center gap-1 rounded-lg border border-edge px-2 py-1 text-xs text-fg hover:bg-surface-hover`,g.press),onClick:()=>void z(s.appPath,`app`),children:[(0,N.jsx)(h,{className:`size-3`,"aria-hidden":!0}),u===`app`?t.copied:t.copyPath]})]})]}),(0,N.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,children:[(0,N.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:t.dataPath}),(0,N.jsxs)(`dd`,{className:`mt-1 flex items-start justify-between gap-2`,children:[(0,N.jsx)(`code`,{className:`break-all text-xs text-fg`,children:s.dataPath}),(0,N.jsxs)(`button`,{type:`button`,className:i(`inline-flex shrink-0 items-center gap-1 rounded-lg border border-edge px-2 py-1 text-xs text-fg hover:bg-surface-hover`,g.press),onClick:()=>void z(s.dataPath,`data`),children:[(0,N.jsx)(h,{className:`size-3`,"aria-hidden":!0}),u===`data`?t.copied:t.copyPath]})]}),(0,N.jsxs)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:[t.dataSize,`: `,P(s.dataSizeBytes,t.dataSizeUnknown)]}),(0,N.jsx)(`p`,{className:`mt-2 text-xs leading-relaxed text-amber-800 dark:text-amber-200`,children:t.sharedDataWarning})]})]}),(0,N.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,N.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.clearData}),(0,N.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:t.clearDataDesc})]}),(0,N.jsx)(`button`,{type:`button`,disabled:U,className:i(`inline-flex shrink-0 items-center justify-center rounded-lg border border-danger/40 bg-danger px-3 py-1.5 text-sm font-medium text-white hover:bg-danger/90 disabled:opacity-50`,g.press),onClick:()=>{o({type:`patch`,patch:{clearConfirmChecked:!1,clearConfirmText:``,clearDialogOpen:!0}})},children:t.clearData})]}),W?(0,N.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.uninstall}),(0,N.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:G})]}),(0,N.jsx)(`button`,{type:`button`,disabled:U,className:i(`inline-flex shrink-0 items-center justify-center rounded-lg border border-edge bg-surface-base px-3 py-1.5 text-sm font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,g.press),onClick:()=>{o({type:`patch`,patch:{removeUserDataOnUninstall:!1,uninstallDialogOpen:!0}})},children:t.uninstall})]}):null]})]}),(0,N.jsx)(v,{open:p,onOpenChange:e=>{e||o({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:(0,N.jsxs)(m,{children:[(0,N.jsx)(d,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,b)}),(0,N.jsxs)(_,{className:i(`fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,T,`rounded-2xl border border-edge bg-surface-panel p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,N.jsx)(w,{className:`text-base font-semibold text-fg`,children:t.clearDataConfirmTitle}),(0,N.jsx)(y,{className:`mt-2 text-sm text-fg-muted`,children:t.clearDataConfirmDesc}),(0,N.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,N.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:x,onChange:e=>o({type:`patch`,patch:{clearConfirmChecked:e.target.checked}})}),(0,N.jsx)(`span`,{children:t.clearDataConfirmCheckbox})]}),(0,N.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[(0,N.jsx)(`label`,{className:`block text-sm font-medium text-fg`,htmlFor:`clear-data-confirm`,children:t.clearDataConfirmLabel}),(0,N.jsx)(`input`,{id:`clear-data-confirm`,type:`text`,autoComplete:`off`,spellCheck:!1,className:i(`w-full rounded-md border border-edge bg-surface-panel px-3 py-1.5 font-mono text-xs text-fg`,`placeholder:text-fg-subtle`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`dark:border-edge`),placeholder:t.clearDataConfirmPhrase,value:E,onChange:e=>o({type:`patch`,patch:{clearConfirmText:e.target.value}})}),(0,N.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.clearDataConfirmHint})]}),(0,N.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,N.jsx)(S,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>{o({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:t.cancel}),(0,N.jsx)(S,{type:`button`,variant:`secondary`,className:`border-danger/40 bg-danger text-white hover:bg-danger/90 dark:border-danger/40`,disabled:j||!K,onClick:()=>void B(),children:t.confirmClear})]})]})]})}),W?(0,N.jsx)(v,{open:D,onOpenChange:e=>{e||o({type:`patch`,patch:{uninstallDialogOpen:!1}})},children:(0,N.jsxs)(m,{children:[(0,N.jsx)(d,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,b)}),(0,N.jsxs)(_,{className:i(`fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,T,`rounded-2xl border border-edge bg-surface-panel p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,N.jsx)(w,{className:`text-base font-semibold text-fg`,children:t.uninstallConfirmTitle}),(0,N.jsx)(y,{className:`mt-2 text-sm text-fg-muted`,children:G}),(0,N.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,N.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:k,onChange:e=>o({type:`patch`,patch:{removeUserDataOnUninstall:e.target.checked}})}),(0,N.jsx)(`span`,{children:t.removeUserDataCheckbox})]}),k?(0,N.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.clearDataConfirmDesc}):null,(0,N.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,N.jsx)(S,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>o({type:`patch`,patch:{uninstallDialogOpen:!1}}),children:t.cancel}),(0,N.jsx)(S,{type:`button`,variant:`secondary`,className:`border-danger/40 bg-danger text-white hover:bg-danger/90 dark:border-danger/40`,disabled:j,onClick:()=>void V(),children:t.confirmUninstall})]})]})]})}):null]})}async function z(){return(await l(c(`/api/migrations/status`))).payload}async function B(){await l(c(`/api/migrations/apply`),{method:`POST`,body:`{}`})}function V({messages:e}){let{data:t,error:n,isLoading:r,mutate:i}=u(`settings-migration-status`,z,{refreshInterval:0,revalidateOnFocus:!1}),[a,o]=(0,M.useState)(!1),[s,c]=(0,M.useState)(null);async function l(){o(!0),c(null);try{await B(),await i(),window.dispatchEvent(new CustomEvent(`config-reload`))}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(!1)}}if(r)return(0,N.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,"aria-busy":`true`,children:[(0,N.jsx)(x,{className:`h-5 w-40 max-w-full`}),(0,N.jsx)(x,{className:`mt-2 h-4 w-64 max-w-full`})]});if(n)return(0,N.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,children:[(0,N.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,N.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:e.checkFailed})]});let d=t?.items??[],f=d.filter(e=>e.status===`conflict`||e.status===`error`),p=d.filter(e=>e.safety===`auto`&&e.status===`planned`),m=f.length>0||d.some(e=>e.safety!==`auto`);return(0,N.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,children:[(0,N.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,N.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:d.length===0?e.upToDate:m?e.manualAttention:e.safeRepairs.replace(`{{count}}`,String(p.length))})]}),p.length>0&&!m?(0,N.jsx)(S,{type:`button`,variant:`primary`,className:`px-3 py-1.5 text-xs`,onClick:()=>void l(),disabled:a,children:a?e.applying:e.apply}):null]}),d.length>0?(0,N.jsx)(`div`,{className:`mt-3 space-y-2`,children:d.map(e=>(0,N.jsxs)(`div`,{className:`rounded-xl bg-surface-base px-3 py-2`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,N.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.title}),(0,N.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[11px] uppercase tracking-wide text-fg-muted`,children:e.status})]}),(0,N.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.message})]},e.id))}):null,s?(0,N.jsx)(`p`,{className:`mt-3 text-sm text-red-500`,children:s}):null]})}function H(){let e=(0,j.c)(28),t=s(U),n;e[0]===t?n=e[1]:(n=o(t),e[0]=t,e[1]=n);let r=n.systemSettings,i=r.desktopApp,a=typeof window<`u`?window.electronAPI?.system:void 0;if(!p()||!a){let t;e[2]===i.title?t=e[3]:(t=(0,N.jsx)(E,{title:i.title}),e[2]=i.title,e[3]=t);let n;e[4]===i.migrations?n=e[5]:(n=(0,N.jsx)(V,{messages:i.migrations}),e[4]=i.migrations,e[5]=n);let a;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(a=k(),e[6]=a):a=e[6];let o;e[7]===r.desktopOnlyTitle?o=e[8]:(o=(0,N.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:r.desktopOnlyTitle}),e[7]=r.desktopOnlyTitle,e[8]=o);let s;e[9]===r.desktopOnlyBody?s=e[10]:(s=(0,N.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:r.desktopOnlyBody}),e[9]=r.desktopOnlyBody,e[10]=s);let c;e[11]!==o||e[12]!==s?(c=(0,N.jsxs)(`div`,{className:a,children:[o,s]}),e[11]=o,e[12]=s,e[13]=c):c=e[13];let l;return e[14]!==t||e[15]!==n||e[16]!==c?(l=(0,N.jsxs)(D,{gap:`gap-3`,children:[t,n,c]}),e[14]=t,e[15]=n,e[16]=c,e[17]=l):l=e[17],l}let c;e[18]===i.title?c=e[19]:(c=(0,N.jsx)(E,{title:i.title}),e[18]=i.title,e[19]=c);let l;e[20]===i.migrations?l=e[21]:(l=(0,N.jsx)(V,{messages:i.migrations}),e[20]=i.migrations,e[21]=l);let u;e[22]===i?u=e[23]:(u=(0,N.jsx)(R,{api:a,messages:i,embedded:!1}),e[22]=i,e[23]=u);let d;return e[24]!==c||e[25]!==l||e[26]!==u?(d=(0,N.jsxs)(D,{gap:`gap-6`,children:[c,l,u]}),e[24]=c,e[25]=l,e[26]=u,e[27]=d):d=e[27],d}function U(e){return e.language}export{H as AppManagementSettingsPanel};
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"./cn-JdwAhgNB.js";import{t as a}from"./copy-to-clipboard-HOJ79TWv.js";import{t as o}from"./messages-H_iJjnEM.js";import{n as s,r as c,s as l}from"./locale-store-BNC8HUCI.js";import{i as u}from"./vendor-swr-BIWyz7Rc.js";import{Go as d,Hc as f,Jo as p,Ko as m,Ql as h,Ts as g,Uo as _,Vo as v,Wo as y,ds as b,eo as x,js as S,jt as C,qo as w,us as T}from"./index-BA56bQ68.js";import{n as E,r as D}from"./settings-page-layout-CkkCee_x.js";import{t as O}from"./settings-loading-skeleton-85eUPcKz.js";import{r as k,t as A}from"./settings-form-section-kt6GIS32.js";var j=n(),M=e(t(),1),N=r();function P(e,t){return e==null?t:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function F(e,t){return e===`PENDING_UPDATE`?t.pendingUpdate??t.generic:e===`UNINSTALLER_NOT_FOUND`?t.uninstallerNotFound??t.generic:e===`NOT_PACKAGED`?t.notPackaged??t.generic:t.generic}function I(e,t){if(e.platform===`darwin`)return t.uninstallDescDarwin;if(e.platform===`win32`)return t.uninstallDescWin;if(e.platform===`linux`){if(e.linuxPackageKind===`appimage`)return t.uninstallDescLinuxAppImage;if(e.linuxPackageKind===`deb`){let n=e.linuxDebPackageName??`xopc`;return t.uninstallDescLinuxDeb.replace(/\{\{package\}\}/g,n)}return t.uninstallDescLinuxUnknown}return t.uninstallDescLinuxUnknown}var L={info:null,loadError:null,actionError:null,copiedField:null,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``,uninstallDialogOpen:!1,removeUserDataOnUninstall:!1,busy:!1};function R({api:e,messages:t,embedded:n=!0}){let[r,o]=(0,M.useReducer)(C,L),{info:s,loadError:c,actionError:l,copiedField:u,clearDialogOpen:p,clearConfirmChecked:x,clearConfirmText:E,uninstallDialogOpen:D,removeUserDataOnUninstall:k,busy:j}=r,R=(0,M.useCallback)(async()=>{if(e?.getUninstallInfo){o({type:`patch`,patch:{loadError:null}});try{o({type:`patch`,patch:{info:await e.getUninstallInfo()}})}catch(e){o({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}}},[e]);(0,M.useEffect)(()=>{R()},[R]);let z=async(e,n)=>{if(await a(e)){o({type:`patch`,patch:{actionError:null,copiedField:n}}),window.setTimeout(()=>o({type:`patch`,patch:{copiedField:null}}),2e3);return}o({type:`patch`,patch:{actionError:t.copyFailed}})},B=async()=>{if(e?.clearUserData){o({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.clearUserData();n.ok||o({type:`patch`,patch:{actionError:F(n.error,t.errors)}})}catch(e){o({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{o({type:`patch`,patch:{busy:!1,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})}}},V=async()=>{if(e?.uninstallApp){o({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.uninstallApp({removeUserData:k});n.ok||o({type:`patch`,patch:{actionError:F(n.error,t.errors)}})}catch(e){o({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{o({type:`patch`,patch:{busy:!1,uninstallDialogOpen:!1}})}}};if(c)return(0,N.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:c});if(!s)return(0,N.jsx)(O,{rows:2});let H=!s.packaged,U=j||s.pendingUpdate||H,W=!H&&s.uninstallMode!==`unsupported`,G=I(s,t),K=x&&E.trim()===t.clearDataConfirmPhrase;return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(A,{children:[n?(0,N.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,N.jsx)(f,{className:`size-4 text-accent`,strokeWidth:1.75}),t.title]}):null,l?(0,N.jsx)(`p`,{className:`mb-3 text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:l}):null,H?(0,N.jsxs)(`div`,{className:`mb-4 rounded-xl bg-surface-panel/70 px-3 py-2.5 shadow-surface`,children:[(0,N.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.devOnlyTitle}),(0,N.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.devOnlyBody})]}):null,s.pendingUpdate?(0,N.jsx)(`p`,{className:`mb-3 rounded-xl border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-xs text-amber-800 dark:text-amber-200`,children:t.pendingUpdateBlocked}):null,(0,N.jsxs)(`dl`,{className:`space-y-3 text-sm`,children:[(0,N.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,children:[(0,N.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:t.appPath}),(0,N.jsxs)(`dd`,{className:`mt-1 flex items-start justify-between gap-2`,children:[(0,N.jsx)(`code`,{className:`break-all text-xs text-fg`,children:s.appPath}),(0,N.jsxs)(`button`,{type:`button`,className:i(`inline-flex shrink-0 items-center gap-1 rounded-lg border border-edge px-2 py-1 text-xs text-fg hover:bg-surface-hover`,g.press),onClick:()=>void z(s.appPath,`app`),children:[(0,N.jsx)(h,{className:`size-3`,"aria-hidden":!0}),u===`app`?t.copied:t.copyPath]})]})]}),(0,N.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,children:[(0,N.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:t.dataPath}),(0,N.jsxs)(`dd`,{className:`mt-1 flex items-start justify-between gap-2`,children:[(0,N.jsx)(`code`,{className:`break-all text-xs text-fg`,children:s.dataPath}),(0,N.jsxs)(`button`,{type:`button`,className:i(`inline-flex shrink-0 items-center gap-1 rounded-lg border border-edge px-2 py-1 text-xs text-fg hover:bg-surface-hover`,g.press),onClick:()=>void z(s.dataPath,`data`),children:[(0,N.jsx)(h,{className:`size-3`,"aria-hidden":!0}),u===`data`?t.copied:t.copyPath]})]}),(0,N.jsxs)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:[t.dataSize,`: `,P(s.dataSizeBytes,t.dataSizeUnknown)]}),(0,N.jsx)(`p`,{className:`mt-2 text-xs leading-relaxed text-amber-800 dark:text-amber-200`,children:t.sharedDataWarning})]})]}),(0,N.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,N.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.clearData}),(0,N.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:t.clearDataDesc})]}),(0,N.jsx)(`button`,{type:`button`,disabled:U,className:i(`inline-flex shrink-0 items-center justify-center rounded-lg border border-danger/40 bg-danger px-3 py-1.5 text-sm font-medium text-white hover:bg-danger/90 disabled:opacity-50`,g.press),onClick:()=>{o({type:`patch`,patch:{clearConfirmChecked:!1,clearConfirmText:``,clearDialogOpen:!0}})},children:t.clearData})]}),W?(0,N.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.uninstall}),(0,N.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:G})]}),(0,N.jsx)(`button`,{type:`button`,disabled:U,className:i(`inline-flex shrink-0 items-center justify-center rounded-lg border border-edge bg-surface-base px-3 py-1.5 text-sm font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,g.press),onClick:()=>{o({type:`patch`,patch:{removeUserDataOnUninstall:!1,uninstallDialogOpen:!0}})},children:t.uninstall})]}):null]})]}),(0,N.jsx)(v,{open:p,onOpenChange:e=>{e||o({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:(0,N.jsxs)(m,{children:[(0,N.jsx)(d,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,b)}),(0,N.jsxs)(_,{className:i(`fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,T,`rounded-2xl border border-edge bg-surface-panel p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,N.jsx)(w,{className:`text-base font-semibold text-fg`,children:t.clearDataConfirmTitle}),(0,N.jsx)(y,{className:`mt-2 text-sm text-fg-muted`,children:t.clearDataConfirmDesc}),(0,N.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,N.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:x,onChange:e=>o({type:`patch`,patch:{clearConfirmChecked:e.target.checked}})}),(0,N.jsx)(`span`,{children:t.clearDataConfirmCheckbox})]}),(0,N.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[(0,N.jsx)(`label`,{className:`block text-sm font-medium text-fg`,htmlFor:`clear-data-confirm`,children:t.clearDataConfirmLabel}),(0,N.jsx)(`input`,{id:`clear-data-confirm`,type:`text`,autoComplete:`off`,spellCheck:!1,className:i(`w-full rounded-md border border-edge bg-surface-panel px-3 py-1.5 font-mono text-xs text-fg`,`placeholder:text-fg-subtle`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`dark:border-edge`),placeholder:t.clearDataConfirmPhrase,value:E,onChange:e=>o({type:`patch`,patch:{clearConfirmText:e.target.value}})}),(0,N.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.clearDataConfirmHint})]}),(0,N.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,N.jsx)(S,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>{o({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:t.cancel}),(0,N.jsx)(S,{type:`button`,variant:`secondary`,className:`border-danger/40 bg-danger text-white hover:bg-danger/90 dark:border-danger/40`,disabled:j||!K,onClick:()=>void B(),children:t.confirmClear})]})]})]})}),W?(0,N.jsx)(v,{open:D,onOpenChange:e=>{e||o({type:`patch`,patch:{uninstallDialogOpen:!1}})},children:(0,N.jsxs)(m,{children:[(0,N.jsx)(d,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,b)}),(0,N.jsxs)(_,{className:i(`fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,T,`rounded-2xl border border-edge bg-surface-panel p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,N.jsx)(w,{className:`text-base font-semibold text-fg`,children:t.uninstallConfirmTitle}),(0,N.jsx)(y,{className:`mt-2 text-sm text-fg-muted`,children:G}),(0,N.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,N.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:k,onChange:e=>o({type:`patch`,patch:{removeUserDataOnUninstall:e.target.checked}})}),(0,N.jsx)(`span`,{children:t.removeUserDataCheckbox})]}),k?(0,N.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.clearDataConfirmDesc}):null,(0,N.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,N.jsx)(S,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>o({type:`patch`,patch:{uninstallDialogOpen:!1}}),children:t.cancel}),(0,N.jsx)(S,{type:`button`,variant:`secondary`,className:`border-danger/40 bg-danger text-white hover:bg-danger/90 dark:border-danger/40`,disabled:j,onClick:()=>void V(),children:t.confirmUninstall})]})]})]})}):null]})}async function z(){return(await l(c(`/api/migrations/status`))).payload}async function B(){await l(c(`/api/migrations/apply`),{method:`POST`,body:`{}`})}function V({messages:e}){let{data:t,error:n,isLoading:r,mutate:i}=u(`settings-migration-status`,z,{refreshInterval:0,revalidateOnFocus:!1}),[a,o]=(0,M.useState)(!1),[s,c]=(0,M.useState)(null);async function l(){o(!0),c(null);try{await B(),await i(),window.dispatchEvent(new CustomEvent(`config-reload`))}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(!1)}}if(r)return(0,N.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,"aria-busy":`true`,children:[(0,N.jsx)(x,{className:`h-5 w-40 max-w-full`}),(0,N.jsx)(x,{className:`mt-2 h-4 w-64 max-w-full`})]});if(n)return(0,N.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,children:[(0,N.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,N.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:e.checkFailed})]});let d=t?.items??[],f=d.filter(e=>e.status===`conflict`||e.status===`error`),p=d.filter(e=>e.safety===`auto`&&e.status===`planned`),m=f.length>0||d.some(e=>e.safety!==`auto`);return(0,N.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,children:[(0,N.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,N.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:d.length===0?e.upToDate:m?e.manualAttention:e.safeRepairs.replace(`{{count}}`,String(p.length))})]}),p.length>0&&!m?(0,N.jsx)(S,{type:`button`,variant:`primary`,className:`px-3 py-1.5 text-xs`,onClick:()=>void l(),disabled:a,children:a?e.applying:e.apply}):null]}),d.length>0?(0,N.jsx)(`div`,{className:`mt-3 space-y-2`,children:d.map(e=>(0,N.jsxs)(`div`,{className:`rounded-xl bg-surface-base px-3 py-2`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,N.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.title}),(0,N.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[11px] uppercase tracking-wide text-fg-muted`,children:e.status})]}),(0,N.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.message})]},e.id))}):null,s?(0,N.jsx)(`p`,{className:`mt-3 text-sm text-red-500`,children:s}):null]})}function H(){let e=(0,j.c)(28),t=s(U),n;e[0]===t?n=e[1]:(n=o(t),e[0]=t,e[1]=n);let r=n.systemSettings,i=r.desktopApp,a=typeof window<`u`?window.electronAPI?.system:void 0;if(!p()||!a){let t;e[2]===i.title?t=e[3]:(t=(0,N.jsx)(E,{title:i.title}),e[2]=i.title,e[3]=t);let n;e[4]===i.migrations?n=e[5]:(n=(0,N.jsx)(V,{messages:i.migrations}),e[4]=i.migrations,e[5]=n);let a;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(a=k(),e[6]=a):a=e[6];let o;e[7]===r.desktopOnlyTitle?o=e[8]:(o=(0,N.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:r.desktopOnlyTitle}),e[7]=r.desktopOnlyTitle,e[8]=o);let s;e[9]===r.desktopOnlyBody?s=e[10]:(s=(0,N.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:r.desktopOnlyBody}),e[9]=r.desktopOnlyBody,e[10]=s);let c;e[11]!==o||e[12]!==s?(c=(0,N.jsxs)(`div`,{className:a,children:[o,s]}),e[11]=o,e[12]=s,e[13]=c):c=e[13];let l;return e[14]!==t||e[15]!==n||e[16]!==c?(l=(0,N.jsxs)(D,{gap:`gap-3`,children:[t,n,c]}),e[14]=t,e[15]=n,e[16]=c,e[17]=l):l=e[17],l}let c;e[18]===i.title?c=e[19]:(c=(0,N.jsx)(E,{title:i.title}),e[18]=i.title,e[19]=c);let l;e[20]===i.migrations?l=e[21]:(l=(0,N.jsx)(V,{messages:i.migrations}),e[20]=i.migrations,e[21]=l);let u;e[22]===i?u=e[23]:(u=(0,N.jsx)(R,{api:a,messages:i,embedded:!1}),e[22]=i,e[23]=u);let d;return e[24]!==c||e[25]!==l||e[26]!==u?(d=(0,N.jsxs)(D,{gap:`gap-6`,children:[c,l,u]}),e[24]=c,e[25]=l,e[26]=u,e[27]=d):d=e[27],d}function U(e){return e.language}export{H as AppManagementSettingsPanel};
@@ -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"./cn-JdwAhgNB.js";import{t as a}from"./messages-DYqBwJAK.js";import{n as o,r as s,s as c}from"./locale-store-DIVc0AQs.js";import{i as l}from"./theme-store-DtwI_VLT.js";import{$a as u,Qa as d,Ts as f,as as p,eo as m,is as h,ns as g,wt as _}from"./index-BDzspHrg.js";import{n as v,r as y}from"./settings-page-layout-Cdb1e2Cz.js";import{t as b}from"./settings-advanced-gate-2eAC9GCP.js";var x=e(t(),1),S=n();function C(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function w(e){let t=C(e)?e:{},n=C(t.gateway)?t.gateway:{},r=(C(n.webchat)?n.webchat:{}).activityDetailDefault;return r===`off`||r===`stream`||r===`on`?r:`on`}async function T(e){await c(s(`/api/config`),{method:`PATCH`,body:JSON.stringify({gateway:{webchat:{activityDetailDefault:e}}})}),await d()}var E=r();function D(){return i(`rounded-xl bg-surface-base px-4 py-1 sm:px-5`)}var O={default:{light:{canvas:`#ffffff`,panel:`#fafafa`,accent:`#3a6bff`,fg:`#111111`,muted:`#ececec`},dark:{canvas:`#0a0a0a`,panel:`#121212`,accent:`#3a6bff`,fg:`#f5f5f5`,muted:`#222222`}},emerald:{light:{canvas:`#f0fdf4`,panel:`#ffffff`,accent:`#059669`,fg:`#052e16`,muted:`#86efac`},dark:{canvas:`#000000`,panel:`#0a0a0a`,accent:`#10b981`,fg:`#d1fae5`,muted:`#134e2a`}},mono:{light:{canvas:`#ffffff`,panel:`#f5f5f5`,accent:`#111111`,fg:`#111111`,muted:`#e5e7eb`},dark:{canvas:`#101010`,panel:`#1a1a1a`,accent:`#737373`,fg:`#fafafa`,muted:`#333333`}},clay:{light:{canvas:`#fffaf0`,panel:`#ffffff`,accent:`#1a3a3a`,fg:`#0a0a0a`,muted:`#e5e5e5`},dark:{canvas:`#0a1a1a`,panel:`#1a2a2a`,accent:`#ffb084`,fg:`#fffaf0`,muted:`#2a3a3a`}}};function k(e){let t=(0,S.c)(24),{canvas:n,panel:r,accent:i,fg:a,muted:o}=e,s;t[0]===n?s=t[1]:(s={backgroundColor:n},t[0]=n,t[1]=s);let c;t[2]!==o||t[3]!==r?(c={backgroundColor:r,borderColor:o},t[2]=o,t[3]=r,t[4]=c):c=t[4];let l;t[5]===i?l=t[6]:(l=(0,E.jsx)(`div`,{className:`size-1 shrink-0 rounded-full`,style:{backgroundColor:i}}),t[5]=i,t[6]=l);let u;t[7]===a?u=t[8]:(u=(0,E.jsx)(`div`,{className:`h-1 min-w-0 flex-1 rounded-full`,style:{backgroundColor:a,opacity:.85}}),t[7]=a,t[8]=u);let d;t[9]!==l||t[10]!==u?(d=(0,E.jsxs)(`div`,{className:`flex items-center gap-1`,children:[l,u]}),t[9]=l,t[10]=u,t[11]=d):d=t[11];let f;t[12]===o?f=t[13]:(f=(0,E.jsx)(`div`,{className:`h-1 w-2/3 max-w-[70%] rounded-full`,style:{backgroundColor:o}}),t[12]=o,t[13]=f);let p;t[14]===o?p=t[15]:(p=(0,E.jsx)(`div`,{className:`size-1/2 max-w-[55%] rounded-full`,style:{backgroundColor:o}}),t[14]=o,t[15]=p);let m;t[16]!==c||t[17]!==d||t[18]!==f||t[19]!==p?(m=(0,E.jsxs)(`div`,{className:`flex flex-col gap-0.5 rounded-sm border p-1`,style:c,children:[d,f,p]}),t[16]=c,t[17]=d,t[18]=f,t[19]=p,t[20]=m):m=t[20];let h;return t[21]!==s||t[22]!==m?(h=(0,E.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col justify-center gap-1 p-1.5`,style:s,children:m}),t[21]=s,t[22]=m,t[23]=h):h=t[23],h}function A(e){let t=(0,S.c)(8),{scheme:n}=e,{light:r,dark:i}=O[n],a;t[0]===r?a=t[1]:(a=(0,E.jsx)(k,{...r}),t[0]=r,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,E.jsx)(`div`,{className:`w-px shrink-0 bg-black/12 dark:bg-white/12`,"aria-hidden":!0}),t[2]=o):o=t[2];let s;t[3]===i?s=t[4]:(s=(0,E.jsx)(k,{...i}),t[3]=i,t[4]=s);let c;return t[5]!==a||t[6]!==s?(c=(0,E.jsxs)(`div`,{className:`flex h-11 w-full overflow-hidden rounded-md border border-edge-subtle`,children:[a,o,s]}),t[5]=a,t[6]=s,t[7]=c):c=t[7],c}var j=[{value:`default`,labelKey:`colorSchemeDefault`},{value:`emerald`,labelKey:`colorSchemeLightGreen`},{value:`mono`,labelKey:`colorSchemeModernMono`},{value:`clay`,labelKey:`colorSchemeClay`}];function M(){let e=(0,S.c)(18),t=o(F),n;e[0]===t?n=e[1]:(n=a(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,s=l(P),c=l(N),u;e[2]===r.colorSchemeTitle?u=e[3]:(u=(0,E.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:r.colorSchemeTitle}),e[2]=r.colorSchemeTitle,e[3]=u);let d;e[4]===r.colorSchemeDescription?d=e[5]:(d=(0,E.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:r.colorSchemeDescription}),e[4]=r.colorSchemeDescription,e[5]=d);let p;e[6]!==u||e[7]!==d?(p=(0,E.jsxs)(`div`,{className:`min-w-0`,children:[u,d]}),e[6]=u,e[7]=d,e[8]=p):p=e[8];let m;e[9]!==r||e[10]!==s||e[11]!==c?(m=j.map(e=>{let{value:t,labelKey:n}=e,a=s===t;return(0,E.jsxs)(`button`,{type:`button`,"aria-pressed":a,onClick:()=>c(t),className:i(`flex flex-col gap-2 rounded-xl border-2 p-2.5 text-left transition-[border-color,box-shadow,transform] duration-150`,f.pressCard,a?`border-accent shadow-[0_0_0_1px_var(--color-accent)]`:`border-edge-subtle hover:border-edge`),children:[(0,E.jsx)(A,{scheme:t}),(0,E.jsx)(`span`,{className:i(`text-xs font-medium leading-none`,a?`text-accent-fg`:`text-fg-muted`),children:r[n]})]},t)}),e[9]=r,e[10]=s,e[11]=c,e[12]=m):m=e[12];let h;e[13]===m?h=e[14]:(h=(0,E.jsx)(`div`,{className:`grid grid-cols-2 gap-3 lg:grid-cols-4`,children:m}),e[13]=m,e[14]=h);let g;return e[15]!==p||e[16]!==h?(g=(0,E.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg bg-surface-panel/50 p-3.5 sm:py-4`,children:[p,h]}),e[15]=p,e[16]=h,e[17]=g):g=e[17],g}function N(e){return e.setColorScheme}function P(e){return e.colorScheme}function F(e){return e.language}function I(){let e=(0,S.c)(31),t=o(L),n;e[0]===t?n=e[1]:(n=a(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,{data:s,isLoading:c}=u(!0),l=s?.payload?.config,d;e[2]===l?d=e[3]:(d=w(l),e[2]=l,e[3]=d);let f=d,[g,_]=(0,x.useState)(f),[v,y]=(0,x.useState)(!1),[b,C]=(0,x.useState)(!1),D,O;e[4]===f?(D=e[5],O=e[6]):(D=()=>_(f),O=[f],e[4]=f,e[5]=D,e[6]=O),(0,x.useEffect)(D,O);let k;e[7]===g?k=e[8]:(k=e=>{let t=g;_(e),y(!0),C(!1),T(e).catch(()=>{_(t),C(!0)}).finally(()=>y(!1))},e[7]=g,e[8]=k);let A=k,j;e[9]===r.activityDetailDefaultTitle?j=e[10]:(j=(0,E.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:r.activityDetailDefaultTitle}),e[9]=r.activityDetailDefaultTitle,e[10]=j);let M;e[11]===r.activityDetailDefaultDescription?M=e[12]:(M=(0,E.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:r.activityDetailDefaultDescription}),e[11]=r.activityDetailDefaultDescription,e[12]=M);let N;e[13]!==j||e[14]!==M?(N=(0,E.jsxs)(`div`,{className:`min-w-0`,children:[j,M]}),e[13]=j,e[14]=M,e[15]=N):N=e[15];let P;e[16]!==r.activityDetailLevels||e[17]!==A||e[18]!==c||e[19]!==g||e[20]!==v?(P=c?(0,E.jsx)(m,{className:`h-10 w-full rounded-lg sm:max-w-sm`}):(0,E.jsxs)(h,{value:g,disabled:v,onChange:e=>A(e.target.value),triggerClassName:`sm:max-w-sm`,children:[(0,E.jsx)(p,{value:`off`,children:r.activityDetailLevels.off}),(0,E.jsx)(p,{value:`on`,children:r.activityDetailLevels.on}),(0,E.jsx)(p,{value:`stream`,children:r.activityDetailLevels.stream})]}),e[16]=r.activityDetailLevels,e[17]=A,e[18]=c,e[19]=g,e[20]=v,e[21]=P):P=e[21];let F=b?`text-red-600 dark:text-red-400`:`text-fg-subtle`,I;e[22]===F?I=e[23]:(I=i(`min-h-4 text-xs`,F),e[22]=F,e[23]=I);let R=b?r.activityDetailSaveError:v?r.activityDetailSaving:r.activityDetailDefaultHint,z;e[24]!==I||e[25]!==R?(z=(0,E.jsx)(`p`,{className:I,children:R}),e[24]=I,e[25]=R,e[26]=z):z=e[26];let B;return e[27]!==z||e[28]!==N||e[29]!==P?(B=(0,E.jsxs)(`div`,{className:`flex flex-col gap-2 py-3.5 sm:py-4`,children:[N,P,z]}),e[27]=z,e[28]=N,e[29]=P,e[30]=B):B=e[30],B}function L(e){return e.language}function R(){let e=(0,S.c)(27),t=o(V),n;e[0]===t?n=e[1]:(n=a(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,i=_(B),s=_(z),c;e[2]===r.developerGroupTitle?c=e[3]:(c=(0,E.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:r.developerGroupTitle}),e[2]=r.developerGroupTitle,e[3]=c);let l;e[4]===r.developerGroupDescription?l=e[5]:(l=(0,E.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:r.developerGroupDescription}),e[4]=r.developerGroupDescription,e[5]=l);let u;e[6]!==c||e[7]!==l?(u=(0,E.jsxs)(`div`,{className:`min-w-0`,children:[c,l]}),e[6]=c,e[7]=l,e[8]=u):u=e[8];let d;e[9]===r.showRawToolDataTitle?d=e[10]:(d=(0,E.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:r.showRawToolDataTitle}),e[9]=r.showRawToolDataTitle,e[10]=d);let f;e[11]===r.showRawToolDataDescription?f=e[12]:(f=(0,E.jsx)(`p`,{className:`text-xs text-fg-muted`,children:r.showRawToolDataDescription}),e[11]=r.showRawToolDataDescription,e[12]=f);let p;e[13]!==d||e[14]!==f?(p=(0,E.jsxs)(`div`,{className:`min-w-0`,children:[d,f]}),e[13]=d,e[14]=f,e[15]=p):p=e[15];let m;e[16]===s?m=e[17]:(m=e=>s(e.target.checked),e[16]=s,e[17]=m);let h;e[18]!==i||e[19]!==m?(h=(0,E.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:i,onChange:m}),e[18]=i,e[19]=m,e[20]=h):h=e[20];let g;e[21]!==p||e[22]!==h?(g=(0,E.jsxs)(`label`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[p,h]}),e[21]=p,e[22]=h,e[23]=g):g=e[23];let v;return e[24]!==u||e[25]!==g?(v=(0,E.jsxs)(`div`,{className:`flex flex-col gap-2 py-3.5 sm:py-4`,children:[u,g]}),e[24]=u,e[25]=g,e[26]=v):v=e[26],v}function z(e){return e.setShowRawToolData}function B(e){return e.showRawToolData}function V(e){return e.language}function H(){let e=(0,S.c)(30),t=o(U),n;e[0]===t?n=e[1]:(n=a(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,i;e[2]!==r.pageTitle||e[3]!==r.subtitle?(i=(0,E.jsx)(v,{title:r.pageTitle,subtitle:r.subtitle}),e[2]=r.pageTitle,e[3]=r.subtitle,e[4]=i):i=e[4];let s;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=D(),e[5]=s):s=e[5];let c;e[6]===r.languageTitle?c=e[7]:(c=(0,E.jsx)(`h2`,{id:`pref-language-heading`,className:`sr-only`,children:r.languageTitle}),e[6]=r.languageTitle,e[7]=c);let l;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,E.jsx)(g,{variant:`page`,sections:[`language`]}),e[8]=l):l=e[8];let u;e[9]===c?u=e[10]:(u=(0,E.jsxs)(`section`,{className:s,"aria-labelledby":`pref-language-heading`,children:[c,l]}),e[9]=c,e[10]=u);let d;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(d=D(),e[11]=d):d=e[11];let f;e[12]===r.themeTitle?f=e[13]:(f=(0,E.jsx)(`h2`,{id:`pref-appearance-heading`,className:`sr-only`,children:r.themeTitle}),e[12]=r.themeTitle,e[13]=f);let p,m,h;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,E.jsx)(g,{variant:`page`,sections:[`theme`,`font`]}),h=(0,E.jsx)(M,{}),p=(0,E.jsx)(I,{}),e[14]=p,e[15]=m,e[16]=h):(p=e[14],m=e[15],h=e[16]);let _;e[17]===f?_=e[18]:(_=(0,E.jsxs)(`section`,{className:d,"aria-labelledby":`pref-appearance-heading`,children:[f,m,h,p]}),e[17]=f,e[18]=_);let x;e[19]===Symbol.for(`react.memo_cache_sentinel`)?(x=D(),e[19]=x):x=e[19];let C;e[20]===r.developerGroupTitle?C=e[21]:(C=(0,E.jsx)(`h2`,{id:`pref-developer-heading`,className:`sr-only`,children:r.developerGroupTitle}),e[20]=r.developerGroupTitle,e[21]=C);let w;e[22]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,E.jsx)(R,{}),e[22]=w):w=e[22];let T;e[23]===C?T=e[24]:(T=(0,E.jsx)(b,{children:(0,E.jsxs)(`section`,{className:x,"aria-labelledby":`pref-developer-heading`,children:[C,w]})}),e[23]=C,e[24]=T);let O;return e[25]!==i||e[26]!==_||e[27]!==T||e[28]!==u?(O=(0,E.jsxs)(y,{gap:`gap-6`,children:[i,u,_,T]}),e[25]=i,e[26]=_,e[27]=T,e[28]=u,e[29]=O):O=e[29],O}function U(e){return e.language}export{H as AppearanceSettingsPanel};
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"./cn-JdwAhgNB.js";import{t as a}from"./messages-H_iJjnEM.js";import{n as o,r as s,s as c}from"./locale-store-BNC8HUCI.js";import{i as l}from"./theme-store-ClDa_Bci.js";import{$a as u,Qa as d,Ts as f,as as p,eo as m,is as h,ns as g,wt as _}from"./index-BA56bQ68.js";import{n as v,r as y}from"./settings-page-layout-CkkCee_x.js";import{t as b}from"./settings-advanced-gate-C-jGsoft.js";var x=e(t(),1),S=n();function C(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function w(e){let t=C(e)?e:{},n=C(t.gateway)?t.gateway:{},r=(C(n.webchat)?n.webchat:{}).activityDetailDefault;return r===`off`||r===`stream`||r===`on`?r:`on`}async function T(e){await c(s(`/api/config`),{method:`PATCH`,body:JSON.stringify({gateway:{webchat:{activityDetailDefault:e}}})}),await d()}var E=r();function D(){return i(`rounded-xl bg-surface-base px-4 py-1 sm:px-5`)}var O={default:{light:{canvas:`#ffffff`,panel:`#fafafa`,accent:`#3a6bff`,fg:`#111111`,muted:`#ececec`},dark:{canvas:`#0a0a0a`,panel:`#121212`,accent:`#3a6bff`,fg:`#f5f5f5`,muted:`#222222`}},emerald:{light:{canvas:`#f0fdf4`,panel:`#ffffff`,accent:`#059669`,fg:`#052e16`,muted:`#86efac`},dark:{canvas:`#000000`,panel:`#0a0a0a`,accent:`#10b981`,fg:`#d1fae5`,muted:`#134e2a`}},mono:{light:{canvas:`#ffffff`,panel:`#f5f5f5`,accent:`#111111`,fg:`#111111`,muted:`#e5e7eb`},dark:{canvas:`#101010`,panel:`#1a1a1a`,accent:`#737373`,fg:`#fafafa`,muted:`#333333`}},clay:{light:{canvas:`#fffaf0`,panel:`#ffffff`,accent:`#1a3a3a`,fg:`#0a0a0a`,muted:`#e5e5e5`},dark:{canvas:`#0a1a1a`,panel:`#1a2a2a`,accent:`#ffb084`,fg:`#fffaf0`,muted:`#2a3a3a`}}};function k(e){let t=(0,S.c)(24),{canvas:n,panel:r,accent:i,fg:a,muted:o}=e,s;t[0]===n?s=t[1]:(s={backgroundColor:n},t[0]=n,t[1]=s);let c;t[2]!==o||t[3]!==r?(c={backgroundColor:r,borderColor:o},t[2]=o,t[3]=r,t[4]=c):c=t[4];let l;t[5]===i?l=t[6]:(l=(0,E.jsx)(`div`,{className:`size-1 shrink-0 rounded-full`,style:{backgroundColor:i}}),t[5]=i,t[6]=l);let u;t[7]===a?u=t[8]:(u=(0,E.jsx)(`div`,{className:`h-1 min-w-0 flex-1 rounded-full`,style:{backgroundColor:a,opacity:.85}}),t[7]=a,t[8]=u);let d;t[9]!==l||t[10]!==u?(d=(0,E.jsxs)(`div`,{className:`flex items-center gap-1`,children:[l,u]}),t[9]=l,t[10]=u,t[11]=d):d=t[11];let f;t[12]===o?f=t[13]:(f=(0,E.jsx)(`div`,{className:`h-1 w-2/3 max-w-[70%] rounded-full`,style:{backgroundColor:o}}),t[12]=o,t[13]=f);let p;t[14]===o?p=t[15]:(p=(0,E.jsx)(`div`,{className:`size-1/2 max-w-[55%] rounded-full`,style:{backgroundColor:o}}),t[14]=o,t[15]=p);let m;t[16]!==c||t[17]!==d||t[18]!==f||t[19]!==p?(m=(0,E.jsxs)(`div`,{className:`flex flex-col gap-0.5 rounded-sm border p-1`,style:c,children:[d,f,p]}),t[16]=c,t[17]=d,t[18]=f,t[19]=p,t[20]=m):m=t[20];let h;return t[21]!==s||t[22]!==m?(h=(0,E.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col justify-center gap-1 p-1.5`,style:s,children:m}),t[21]=s,t[22]=m,t[23]=h):h=t[23],h}function A(e){let t=(0,S.c)(8),{scheme:n}=e,{light:r,dark:i}=O[n],a;t[0]===r?a=t[1]:(a=(0,E.jsx)(k,{...r}),t[0]=r,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,E.jsx)(`div`,{className:`w-px shrink-0 bg-black/12 dark:bg-white/12`,"aria-hidden":!0}),t[2]=o):o=t[2];let s;t[3]===i?s=t[4]:(s=(0,E.jsx)(k,{...i}),t[3]=i,t[4]=s);let c;return t[5]!==a||t[6]!==s?(c=(0,E.jsxs)(`div`,{className:`flex h-11 w-full overflow-hidden rounded-md border border-edge-subtle`,children:[a,o,s]}),t[5]=a,t[6]=s,t[7]=c):c=t[7],c}var j=[{value:`default`,labelKey:`colorSchemeDefault`},{value:`emerald`,labelKey:`colorSchemeLightGreen`},{value:`mono`,labelKey:`colorSchemeModernMono`},{value:`clay`,labelKey:`colorSchemeClay`}];function M(){let e=(0,S.c)(18),t=o(F),n;e[0]===t?n=e[1]:(n=a(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,s=l(P),c=l(N),u;e[2]===r.colorSchemeTitle?u=e[3]:(u=(0,E.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:r.colorSchemeTitle}),e[2]=r.colorSchemeTitle,e[3]=u);let d;e[4]===r.colorSchemeDescription?d=e[5]:(d=(0,E.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:r.colorSchemeDescription}),e[4]=r.colorSchemeDescription,e[5]=d);let p;e[6]!==u||e[7]!==d?(p=(0,E.jsxs)(`div`,{className:`min-w-0`,children:[u,d]}),e[6]=u,e[7]=d,e[8]=p):p=e[8];let m;e[9]!==r||e[10]!==s||e[11]!==c?(m=j.map(e=>{let{value:t,labelKey:n}=e,a=s===t;return(0,E.jsxs)(`button`,{type:`button`,"aria-pressed":a,onClick:()=>c(t),className:i(`flex flex-col gap-2 rounded-xl border-2 p-2.5 text-left transition-[border-color,box-shadow,transform] duration-150`,f.pressCard,a?`border-accent shadow-[0_0_0_1px_var(--color-accent)]`:`border-edge-subtle hover:border-edge`),children:[(0,E.jsx)(A,{scheme:t}),(0,E.jsx)(`span`,{className:i(`text-xs font-medium leading-none`,a?`text-accent-fg`:`text-fg-muted`),children:r[n]})]},t)}),e[9]=r,e[10]=s,e[11]=c,e[12]=m):m=e[12];let h;e[13]===m?h=e[14]:(h=(0,E.jsx)(`div`,{className:`grid grid-cols-2 gap-3 lg:grid-cols-4`,children:m}),e[13]=m,e[14]=h);let g;return e[15]!==p||e[16]!==h?(g=(0,E.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg bg-surface-panel/50 p-3.5 sm:py-4`,children:[p,h]}),e[15]=p,e[16]=h,e[17]=g):g=e[17],g}function N(e){return e.setColorScheme}function P(e){return e.colorScheme}function F(e){return e.language}function I(){let e=(0,S.c)(31),t=o(L),n;e[0]===t?n=e[1]:(n=a(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,{data:s,isLoading:c}=u(!0),l=s?.payload?.config,d;e[2]===l?d=e[3]:(d=w(l),e[2]=l,e[3]=d);let f=d,[g,_]=(0,x.useState)(f),[v,y]=(0,x.useState)(!1),[b,C]=(0,x.useState)(!1),D,O;e[4]===f?(D=e[5],O=e[6]):(D=()=>_(f),O=[f],e[4]=f,e[5]=D,e[6]=O),(0,x.useEffect)(D,O);let k;e[7]===g?k=e[8]:(k=e=>{let t=g;_(e),y(!0),C(!1),T(e).catch(()=>{_(t),C(!0)}).finally(()=>y(!1))},e[7]=g,e[8]=k);let A=k,j;e[9]===r.activityDetailDefaultTitle?j=e[10]:(j=(0,E.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:r.activityDetailDefaultTitle}),e[9]=r.activityDetailDefaultTitle,e[10]=j);let M;e[11]===r.activityDetailDefaultDescription?M=e[12]:(M=(0,E.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:r.activityDetailDefaultDescription}),e[11]=r.activityDetailDefaultDescription,e[12]=M);let N;e[13]!==j||e[14]!==M?(N=(0,E.jsxs)(`div`,{className:`min-w-0`,children:[j,M]}),e[13]=j,e[14]=M,e[15]=N):N=e[15];let P;e[16]!==r.activityDetailLevels||e[17]!==A||e[18]!==c||e[19]!==g||e[20]!==v?(P=c?(0,E.jsx)(m,{className:`h-10 w-full rounded-lg sm:max-w-sm`}):(0,E.jsxs)(h,{value:g,disabled:v,onChange:e=>A(e.target.value),triggerClassName:`sm:max-w-sm`,children:[(0,E.jsx)(p,{value:`off`,children:r.activityDetailLevels.off}),(0,E.jsx)(p,{value:`on`,children:r.activityDetailLevels.on}),(0,E.jsx)(p,{value:`stream`,children:r.activityDetailLevels.stream})]}),e[16]=r.activityDetailLevels,e[17]=A,e[18]=c,e[19]=g,e[20]=v,e[21]=P):P=e[21];let F=b?`text-red-600 dark:text-red-400`:`text-fg-subtle`,I;e[22]===F?I=e[23]:(I=i(`min-h-4 text-xs`,F),e[22]=F,e[23]=I);let R=b?r.activityDetailSaveError:v?r.activityDetailSaving:r.activityDetailDefaultHint,z;e[24]!==I||e[25]!==R?(z=(0,E.jsx)(`p`,{className:I,children:R}),e[24]=I,e[25]=R,e[26]=z):z=e[26];let B;return e[27]!==z||e[28]!==N||e[29]!==P?(B=(0,E.jsxs)(`div`,{className:`flex flex-col gap-2 py-3.5 sm:py-4`,children:[N,P,z]}),e[27]=z,e[28]=N,e[29]=P,e[30]=B):B=e[30],B}function L(e){return e.language}function R(){let e=(0,S.c)(27),t=o(V),n;e[0]===t?n=e[1]:(n=a(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,i=_(B),s=_(z),c;e[2]===r.developerGroupTitle?c=e[3]:(c=(0,E.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:r.developerGroupTitle}),e[2]=r.developerGroupTitle,e[3]=c);let l;e[4]===r.developerGroupDescription?l=e[5]:(l=(0,E.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:r.developerGroupDescription}),e[4]=r.developerGroupDescription,e[5]=l);let u;e[6]!==c||e[7]!==l?(u=(0,E.jsxs)(`div`,{className:`min-w-0`,children:[c,l]}),e[6]=c,e[7]=l,e[8]=u):u=e[8];let d;e[9]===r.showRawToolDataTitle?d=e[10]:(d=(0,E.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:r.showRawToolDataTitle}),e[9]=r.showRawToolDataTitle,e[10]=d);let f;e[11]===r.showRawToolDataDescription?f=e[12]:(f=(0,E.jsx)(`p`,{className:`text-xs text-fg-muted`,children:r.showRawToolDataDescription}),e[11]=r.showRawToolDataDescription,e[12]=f);let p;e[13]!==d||e[14]!==f?(p=(0,E.jsxs)(`div`,{className:`min-w-0`,children:[d,f]}),e[13]=d,e[14]=f,e[15]=p):p=e[15];let m;e[16]===s?m=e[17]:(m=e=>s(e.target.checked),e[16]=s,e[17]=m);let h;e[18]!==i||e[19]!==m?(h=(0,E.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:i,onChange:m}),e[18]=i,e[19]=m,e[20]=h):h=e[20];let g;e[21]!==p||e[22]!==h?(g=(0,E.jsxs)(`label`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[p,h]}),e[21]=p,e[22]=h,e[23]=g):g=e[23];let v;return e[24]!==u||e[25]!==g?(v=(0,E.jsxs)(`div`,{className:`flex flex-col gap-2 py-3.5 sm:py-4`,children:[u,g]}),e[24]=u,e[25]=g,e[26]=v):v=e[26],v}function z(e){return e.setShowRawToolData}function B(e){return e.showRawToolData}function V(e){return e.language}function H(){let e=(0,S.c)(30),t=o(U),n;e[0]===t?n=e[1]:(n=a(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,i;e[2]!==r.pageTitle||e[3]!==r.subtitle?(i=(0,E.jsx)(v,{title:r.pageTitle,subtitle:r.subtitle}),e[2]=r.pageTitle,e[3]=r.subtitle,e[4]=i):i=e[4];let s;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=D(),e[5]=s):s=e[5];let c;e[6]===r.languageTitle?c=e[7]:(c=(0,E.jsx)(`h2`,{id:`pref-language-heading`,className:`sr-only`,children:r.languageTitle}),e[6]=r.languageTitle,e[7]=c);let l;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,E.jsx)(g,{variant:`page`,sections:[`language`]}),e[8]=l):l=e[8];let u;e[9]===c?u=e[10]:(u=(0,E.jsxs)(`section`,{className:s,"aria-labelledby":`pref-language-heading`,children:[c,l]}),e[9]=c,e[10]=u);let d;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(d=D(),e[11]=d):d=e[11];let f;e[12]===r.themeTitle?f=e[13]:(f=(0,E.jsx)(`h2`,{id:`pref-appearance-heading`,className:`sr-only`,children:r.themeTitle}),e[12]=r.themeTitle,e[13]=f);let p,m,h;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,E.jsx)(g,{variant:`page`,sections:[`theme`,`font`]}),h=(0,E.jsx)(M,{}),p=(0,E.jsx)(I,{}),e[14]=p,e[15]=m,e[16]=h):(p=e[14],m=e[15],h=e[16]);let _;e[17]===f?_=e[18]:(_=(0,E.jsxs)(`section`,{className:d,"aria-labelledby":`pref-appearance-heading`,children:[f,m,h,p]}),e[17]=f,e[18]=_);let x;e[19]===Symbol.for(`react.memo_cache_sentinel`)?(x=D(),e[19]=x):x=e[19];let C;e[20]===r.developerGroupTitle?C=e[21]:(C=(0,E.jsx)(`h2`,{id:`pref-developer-heading`,className:`sr-only`,children:r.developerGroupTitle}),e[20]=r.developerGroupTitle,e[21]=C);let w;e[22]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,E.jsx)(R,{}),e[22]=w):w=e[22];let T;e[23]===C?T=e[24]:(T=(0,E.jsx)(b,{children:(0,E.jsxs)(`section`,{className:x,"aria-labelledby":`pref-developer-heading`,children:[C,w]})}),e[23]=C,e[24]=T);let O;return e[25]!==i||e[26]!==_||e[27]!==T||e[28]!==u?(O=(0,E.jsxs)(y,{gap:`gap-6`,children:[i,u,_,T]}),e[25]=i,e[26]=_,e[27]=T,e[28]=u,e[29]=O):O=e[29],O}function U(e){return e.language}export{H as AppearanceSettingsPanel};
@@ -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{f as i,t as a}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as o}from"./check-DUBLcKHA.js";import{t as s}from"./cn-JdwAhgNB.js";import{t as c}from"./messages-DYqBwJAK.js";import{l,n as u,o as d,r as f,s as p}from"./locale-store-DIVc0AQs.js";import{a as m,i as h}from"./vendor-swr-BIWyz7Rc.js";import{Do as g,Gl as _,Go as v,Hc as y,Ir as b,Iu as x,Ji as S,Js as C,Ko as w,Ps as T,Tu as E,Uo as D,Vo as O,Wo as k,ao as A,eo as j,fc as ee,hu as M,io as N,jc as P,js as F,jt as I,mc as L,nl as te,no as R,oo as z,qo as ne,qs as re,so as B,vc as V}from"./index-BDzspHrg.js";import{t as H}from"./page-tabs-tQNQcAts.js";var U=e(t(),1),W=n();function G(e){return e===`builtin`||e===`user`?e:`marketplace`}async function K(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 ie(e){let t=await d(f(`/api/marketplace/packages/${encodeURIComponent(e.trim())}`),{cache:`no-store`});if(!t.ok)throw Error(await K(t));let n=await t.json();if(!n.ok||!n.payload?.id)throw Error(n.error??`Invalid response`);return n.payload}async function q(e){let t=await d(f(`/api/marketplace/install`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await K(t));let n=await t.json();if(!n.ok||!n.payload?.extensionId)throw Error(n.error??`Invalid response`);return n.payload}async function J(e){let t=await d(f(`/api/extensions/bundled/activation`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({extensionId:e.extensionId.trim(),enabled:e.enabled})});if(!t.ok)throw Error(await K(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error?.message??`Invalid response`);return n.payload}async function Y(e){let t=await d(f(`/api/marketplace/uninstall`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({extensionId:e})});if(!t.ok)throw Error(await K(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error??`Invalid response`);return n.payload}var X=r();function ae(e,t){let n=e.find(e=>e.id===t);return n?n.source===`bundled`?`bundled`:`user`:`absent`}var Z={q:``,debounced:``,detailPkg:null,rowBusy:null,actionError:null,restartHint:null};function Q({className:e}){let t=c(u(e=>e.language)).extensionsPage,n=l(e=>!!e.token),r=N(),{mutate:i}=m(),[a,o]=(0,U.useReducer)(I,Z),{q:d,debounced:g,detailPkg:_,rowBusy:v,actionError:x,restartHint:S}=a,w=n?`marketplace-${g}`:null;(0,U.useEffect)(()=>{let e=window.setTimeout(()=>o({type:`patch`,patch:{debounced:d.trim()}}),300);return()=>window.clearTimeout(e)},[d]);let{data:T,isLoading:E,error:D}=h(w,async()=>p(g.length>0?f(`/api/marketplace?q=${encodeURIComponent(g)}`):f(`/api/marketplace`)),{revalidateOnFocus:!1}),O=(0,U.useCallback)(()=>{i(`gateway-extensions-list`),b()},[i]),k=(0,U.useCallback)(async(e,n)=>{o({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let r=await q({name:e,overwrite:n});O(),r.requiresGatewayRestart&&o({type:`patch`,patch:{restartHint:t.marketplaceRestartHint}})}catch(e){throw o({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.marketplaceInstallFailed}}),e}finally{o({type:`patch`,patch:{rowBusy:null}})}},[t.marketplaceInstallFailed,t.marketplaceRestartHint,O]),A=(0,U.useCallback)(async e=>{o({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let n=await Y(e);O(),n.requiresGatewayRestart&&o({type:`patch`,patch:{restartHint:t.marketplaceRestartHint}})}catch(e){throw o({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.marketplaceUninstallFailed}}),e}finally{o({type:`patch`,patch:{rowBusy:null}})}},[t.marketplaceRestartHint,t.marketplaceUninstallFailed,O]),ee=T?.extensions??[];return(0,X.jsxs)(`div`,{className:s(`flex flex-col gap-4`,e),children:[(0,X.jsxs)(`div`,{className:`relative`,children:[(0,X.jsx)(V,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),(0,X.jsx)(`input`,{type:`search`,value:d,onChange:e=>o({type:`patch`,patch:{q:e.target.value}}),placeholder:t.marketplaceSearchPlaceholder,className:`ui-input h-10 w-full rounded-lg border border-edge bg-surface-base pl-9 pr-3 text-sm text-fg placeholder:text-fg-muted`})]}),D?(0,X.jsx)(`p`,{className:`text-sm text-fg-muted`,children:D instanceof Error?D.message:t.marketplaceLoadFailed}):null,x?(0,X.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:x}):null,S?(0,X.jsx)(`p`,{className:`text-sm text-fg-muted`,children:S}):null,E&&!T?(0,X.jsx)(`ul`,{className:`flex flex-col gap-3`,"aria-label":t.marketplaceLoading,children:[0,1,2].map(e=>(0,X.jsx)(`li`,{className:`rounded-xl bg-surface-panel p-4 shadow-surface`,children:(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2.5`,children:[(0,X.jsx)(j,{className:`h-5 w-40`}),(0,X.jsx)(j,{className:`h-4 w-full max-w-xl`}),(0,X.jsx)(j,{className:`h-4 w-2/3 max-w-md`})]}),(0,X.jsx)(j,{className:`h-8 w-20`})]})},e))}):(0,X.jsx)(`ul`,{className:`flex flex-col gap-3`,children:ee.length===0?(0,X.jsx)(`li`,{className:`text-sm text-fg-muted`,children:t.marketplaceEmpty}):ee.map(e=>{let n=ae(r,e.id),i=v===e.id;return(0,X.jsx)(`li`,{className:`list-none`,children:(0,X.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-label":`${e.name}, ${t.marketplaceDetailTitle}`,onClick:()=>o({type:`patch`,patch:{detailPkg:e.id}}),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),o({type:`patch`,patch:{detailPkg:e.id}}))},className:s(`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,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(`h3`,{className:`font-semibold text-fg`,children:e.name}),e.verified?(0,X.jsx)(M,{className:`size-4 shrink-0 text-emerald-600 dark:text-emerald-400`,strokeWidth:1.75,"aria-label":`Verified`}):null,e.version?(0,X.jsx)(`span`,{className:`text-xs text-fg-muted`,children:e.version}):null]}),e.description?(0,X.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm text-fg-muted`,children:e.description}):null,(0,X.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:(e.categories??[]).map(e=>(0,X.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,X.jsxs)(`p`,{className:`mt-2 flex items-center gap-1.5 text-xs text-fg-muted`,children:[(0,X.jsx)(y,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),(0,X.jsx)(`code`,{className:`rounded bg-surface-panel px-1 py-0.5`,children:e.npmPackage})]})]}),(0,X.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:n===`bundled`?(0,X.jsx)(`span`,{className:`rounded-md bg-surface-hover px-2 py-1 text-[11px] font-medium text-fg-muted`,children:t.marketplaceBuiltin}):n===`user`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`text-[11px] font-medium text-fg-muted`,children:t.marketplaceInstalled}),(0,X.jsxs)(`button`,{type:`button`,disabled:i,onClick:()=>{window.confirm(t.marketplaceUninstallConfirm)&&A(e.id).catch(()=>{})},className:s(`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,X.jsx)(te,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,X.jsx)(C,{className:`size-3.5`,strokeWidth:2,"aria-hidden":!0}),t.marketplaceUninstall]})]}):(0,X.jsx)(`button`,{type:`button`,onClick:()=>o({type:`patch`,patch:{detailPkg:e.id}}),className:s(`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:t.marketplaceReview})})]})},e.id)})}),_?(0,X.jsx)($,{packageName:_,copy:t,extensions:r,onClose:()=>o({type:`patch`,patch:{detailPkg:null}}),onInstall:k,onUninstall:A}):null]})}function $(e){let t=(0,W.c)(102),{packageName:n,copy:r,extensions:i,onClose:o,onInstall:c,onUninstall:u}=e,[d,f]=(0,U.useState)(!1),[p,m]=(0,U.useState)(!1),g=l(ue)?`ext-mp-detail-${n}`:null,_;t[0]===n?_=t[1]:(_=async()=>ie(n),t[0]=n,t[1]=_);let y;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(y={revalidateOnFocus:!1},t[2]=y):y=t[2];let{data:b,error:E,isLoading:k}=h(g,_,y),A;t[3]!==i||t[4]!==n?(A=ae(i,n),t[3]=i,t[4]=n,t[5]=A):A=t[5];let M=A,N=M===`user`,P=b?.manifest?.permissions,F,I,L,R,z,B,V,H,G,K,q;if(t[6]!==r.detailBack||t[7]!==r.detailClose||t[8]!==r.marketplaceAuthor||t[9]!==r.marketplaceCodeRisk||t[10]!==r.marketplaceDependencies||t[11]!==r.marketplaceDetailLoadFailed||t[12]!==r.marketplaceDetailReadmeHeading||t[13]!==r.marketplaceDetailTitle||t[14]!==r.marketplaceDownloads||t[15]!==r.marketplaceIntegrity||t[16]!==r.marketplaceIntegrityVerified||t[17]!==r.marketplaceLifecycleScripts||t[18]!==r.marketplaceLoadFailed||t[19]!==r.marketplaceLoading||t[20]!==r.marketplaceNoReadme||t[21]!==r.marketplacePermissions||t[22]!==r.marketplacePermissionsNone||t[23]!==r.marketplaceRiskConfirm||t[24]!==r.marketplaceRiskTitle||t[25]!==r.marketplaceUnavailableBody||t[26]!==r.marketplaceUnavailableTitle||t[27]!==r.marketplaceVersion||t[28]!==b||t[29]!==E||t[30]!==M||t[31]!==k||t[32]!==o||t[33]!==P||t[34]!==p){let e=P&&typeof P==`object`&&!Array.isArray(P)?Object.entries(P):[],n;t[46]!==r.marketplaceNoReadme||t[47]!==b?(n=b?.readme?.trim()||(b?.description?.trim()?`### ${b.name}\n\n${b.description}`:`*${r.marketplaceNoReadme}*`),t[46]=r.marketplaceNoReadme,t[47]=b,t[48]=n):n=t[48];let i=n;L=O,R=!0,t[49]===o?z=t[50]:(z=e=>!e&&o(),t[49]=o,t[50]=z),I=w,t[51]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,X.jsx)(v,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),t[51]=q):q=t[51],F=D,H=`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-panel shadow-elevated`,G=le;let a;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(x,{className:`size-5`}),t[52]=a):a=t[52];let s;t[53]!==r.detailBack||t[54]!==o?(s=(0,X.jsx)(`button`,{type:`button`,onClick:o,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":r.detailBack,children:a}),t[53]=r.detailBack,t[54]=o,t[55]=s):s=t[55];let c;t[56]===r.marketplaceDetailTitle?c=t[57]:(c=(0,X.jsx)(ne,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:r.marketplaceDetailTitle}),t[56]=r.marketplaceDetailTitle,t[57]=c);let l;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,X.jsx)(T,{className:`size-5`}),t[58]=l):l=t[58];let u;t[59]!==r.detailClose||t[60]!==o?(u=(0,X.jsx)(`button`,{type:`button`,onClick:o,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":r.detailClose,children:l}),t[59]=r.detailClose,t[60]=o,t[61]=u):u=t[61],t[62]!==s||t[63]!==c||t[64]!==u?(K=(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[s,c,u]}),t[62]=s,t[63]=c,t[64]=u,t[65]=K):K=t[65],B=`min-h-0 flex-1 overflow-y-auto p-5`,V=k&&!b?(0,X.jsxs)(`div`,{className:`space-y-4`,"aria-label":r.marketplaceLoading,children:[(0,X.jsx)(j,{className:`h-6 w-48`}),(0,X.jsx)(j,{className:`h-4 w-28`}),(0,X.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,X.jsx)(j,{className:`h-12`}),(0,X.jsx)(j,{className:`h-12`})]}),(0,X.jsx)(j,{className:`h-28 w-full`}),(0,X.jsx)(j,{className:`h-36 w-full`})]}):E?(0,X.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,X.jsx)(`p`,{className:`font-medium text-red-700 dark:text-red-300`,children:r.marketplaceDetailLoadFailed}),(0,X.jsx)(`p`,{className:`mt-1 break-words text-red-600 dark:text-red-400`,children:E instanceof Error?E.message:r.marketplaceLoadFailed})]}):b?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:b.name}),(0,X.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:(0,X.jsx)(`code`,{className:`rounded bg-surface-panel px-1 py-0.5`,children:b.id})}),(0,X.jsxs)(`dl`,{className:`mt-3 grid gap-2 text-xs text-fg-muted sm:grid-cols-2`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceAuthor}),(0,X.jsx)(`dd`,{children:b.author.username})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceVersion}),(0,X.jsx)(`dd`,{children:b.latestVersion.version})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceDownloads}),(0,X.jsx)(`dd`,{children:b.downloads})]})]}),M===`bundled`?null:(0,X.jsxs)(`section`,{className:`mt-5 space-y-3 rounded-lg border border-edge bg-surface-base p-4`,children:[(0,X.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[b.installability.available?(0,X.jsx)(ee,{className:`mt-0.5 size-5 shrink-0 text-emerald-600 dark:text-emerald-400`,"aria-hidden":!0}):(0,X.jsx)(re,{className:`mt-0.5 size-5 shrink-0 text-amber-600 dark:text-amber-400`,"aria-hidden":!0}),(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:b.installability.available?r.marketplaceRiskTitle:r.marketplaceUnavailableTitle}),(0,X.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:b.installability.available?r.marketplaceCodeRisk:b.installability.reason??r.marketplaceUnavailableBody})]})]}),b.installability.available?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`dl`,{className:`grid gap-2 text-xs text-fg-muted sm:grid-cols-2`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceIntegrity}),(0,X.jsx)(`dd`,{children:r.marketplaceIntegrityVerified})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceDependencies}),(0,X.jsx)(`dd`,{children:b.packageSummary?.dependencyCount??0})]})]}),(0,X.jsxs)(`div`,{className:`text-xs text-fg-muted`,children:[(0,X.jsx)(`p`,{className:`font-medium text-fg`,children:r.marketplacePermissions}),e.length>0?(0,X.jsx)(`ul`,{className:`mt-1 space-y-1`,children:e.map(ce)}):(0,X.jsx)(`p`,{className:`mt-1`,children:r.marketplacePermissionsNone})]}),(b.packageSummary?.lifecycleScripts.length??0)>0?(0,X.jsxs)(`p`,{className:`text-xs leading-relaxed text-amber-700 dark:text-amber-300`,children:[r.marketplaceLifecycleScripts,`: `,b.packageSummary?.lifecycleScripts.join(`, `)]}):null,(0,X.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,X.jsx)(`input`,{type:`checkbox`,checked:p,onChange:e=>m(e.target.checked),className:`mt-0.5 size-4 rounded border-edge accent-[var(--color-accent)]`}),(0,X.jsx)(`span`,{children:r.marketplaceRiskConfirm})]})]}):null]}),b.readme?.trim()?(0,X.jsx)(`h4`,{className:`mb-2 mt-6 text-sm font-semibold text-fg`,children:r.marketplaceDetailReadmeHeading}):null,(0,X.jsx)(`div`,{className:`markdown-content min-w-0 break-words text-sm`,children:(0,X.jsx)(S,{content:i})})]}):null,t[6]=r.detailBack,t[7]=r.detailClose,t[8]=r.marketplaceAuthor,t[9]=r.marketplaceCodeRisk,t[10]=r.marketplaceDependencies,t[11]=r.marketplaceDetailLoadFailed,t[12]=r.marketplaceDetailReadmeHeading,t[13]=r.marketplaceDetailTitle,t[14]=r.marketplaceDownloads,t[15]=r.marketplaceIntegrity,t[16]=r.marketplaceIntegrityVerified,t[17]=r.marketplaceLifecycleScripts,t[18]=r.marketplaceLoadFailed,t[19]=r.marketplaceLoading,t[20]=r.marketplaceNoReadme,t[21]=r.marketplacePermissions,t[22]=r.marketplacePermissionsNone,t[23]=r.marketplaceRiskConfirm,t[24]=r.marketplaceRiskTitle,t[25]=r.marketplaceUnavailableBody,t[26]=r.marketplaceUnavailableTitle,t[27]=r.marketplaceVersion,t[28]=b,t[29]=E,t[30]=M,t[31]=k,t[32]=o,t[33]=P,t[34]=p,t[35]=F,t[36]=I,t[37]=L,t[38]=R,t[39]=z,t[40]=B,t[41]=V,t[42]=H,t[43]=G,t[44]=K,t[45]=q}else F=t[35],I=t[36],L=t[37],R=t[38],z=t[39],B=t[40],V=t[41],H=t[42],G=t[43],K=t[44],q=t[45];let J;t[66]!==B||t[67]!==V?(J=(0,X.jsx)(`div`,{className:B,children:V}),t[66]=B,t[67]=V,t[68]=J):J=t[68];let Y;t[69]!==d||t[70]!==r.marketplaceBuiltinGoBuiltin||t[71]!==r.marketplaceBuiltinManageHint||t[72]!==r.marketplaceInstall||t[73]!==r.marketplaceReinstall||t[74]!==r.marketplaceReinstallConfirm||t[75]!==r.marketplaceUninstall||t[76]!==r.marketplaceUninstallConfirm||t[77]!==b||t[78]!==M||t[79]!==o||t[80]!==c||t[81]!==u||t[82]!==n||t[83]!==p||t[84]!==N?(Y=b?(0,X.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,X.jsxs)(`div`,{className:`flex w-full flex-col items-stretch gap-2`,children:[(0,X.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:r.marketplaceBuiltinManageHint}),(0,X.jsx)(a,{to:`/extensions?tab=builtin`,onClick:o,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:r.marketplaceBuiltinGoBuiltin})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`button`,{type:`button`,disabled:d||!b.installability.available||!p,onClick:()=>{N&&!window.confirm(r.marketplaceReinstallConfirm)||(f(!0),c(n,N).catch(se).finally(()=>f(!1)))},className:s(`inline-flex items-center justify-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium`,`bg-accent text-white 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:[d?(0,X.jsx)(te,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,N?r.marketplaceReinstall:r.marketplaceInstall]}),N?(0,X.jsxs)(`button`,{type:`button`,disabled:d,onClick:()=>{window.confirm(r.marketplaceUninstallConfirm)&&(f(!0),u(n).then(()=>o()).catch(oe).finally(()=>f(!1)))},className:s(`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,X.jsx)(C,{className:`size-4 shrink-0`,"aria-hidden":!0}),r.marketplaceUninstall]}):null]})}):null,t[69]=d,t[70]=r.marketplaceBuiltinGoBuiltin,t[71]=r.marketplaceBuiltinManageHint,t[72]=r.marketplaceInstall,t[73]=r.marketplaceReinstall,t[74]=r.marketplaceReinstallConfirm,t[75]=r.marketplaceUninstall,t[76]=r.marketplaceUninstallConfirm,t[77]=b,t[78]=M,t[79]=o,t[80]=c,t[81]=u,t[82]=n,t[83]=p,t[84]=N,t[85]=Y):Y=t[85];let Z;t[86]!==F||t[87]!==J||t[88]!==Y||t[89]!==H||t[90]!==G||t[91]!==K?(Z=(0,X.jsxs)(F,{className:H,onOpenAutoFocus:G,children:[K,J,Y]}),t[86]=F,t[87]=J,t[88]=Y,t[89]=H,t[90]=G,t[91]=K,t[92]=Z):Z=t[92];let Q;t[93]!==I||t[94]!==Z||t[95]!==q?(Q=(0,X.jsxs)(I,{children:[q,Z]}),t[93]=I,t[94]=Z,t[95]=q,t[96]=Q):Q=t[96];let $;return t[97]!==L||t[98]!==R||t[99]!==z||t[100]!==Q?($=(0,X.jsx)(L,{defaultOpen:R,onOpenChange:z,children:Q}),t[97]=L,t[98]=R,t[99]=z,t[100]=Q,t[101]=$):$=t[101],$}function oe(){}function se(){}function ce(e){let[t,n]=e;return(0,X.jsxs)(`li`,{className:`break-words`,children:[(0,X.jsx)(`code`,{children:t}),`: `,Array.isArray(n)?n.join(`, `):String(n)]},t)}function le(e){return e.preventDefault()}function ue(e){return!!e.token}function de(){let e=u(e=>e.language),t=c(e),n=g(e=>e.setPageHeader),r=g(e=>e.clearPageHeader),o=N(),s=A(),[l,d]=i(),f=G(l.get(`tab`)),p=l.get(`q`)??``,[m,h]=(0,U.useState)(f),[_,v]=(0,U.useState)(p),[y,b]=(0,U.useState)(null),x=l.toString(),S=(0,U.useRef)(x);if(S.current!==x){S.current=x;let e=G(l.get(`tab`)),t=l.get(`q`)??``;h(t=>t===e?t:e),v(e=>e===t?e:t)}(0,U.useEffect)(()=>{d(e=>{let t=new URLSearchParams(e),n=_.trim();return n?t.set(`q`,n):t.delete(`q`),m===`marketplace`?t.delete(`tab`):t.set(`tab`,m),t.toString()===e.toString()?e:t},{replace:!0})},[m,_,d]);let C=(0,U.useMemo)(()=>o.filter(e=>e.source===`bundled`),[o]),w=(0,U.useMemo)(()=>o.filter(e=>e.source!==`bundled`),[o]),T=m===`builtin`?C:w,D=(0,U.useMemo)(()=>{let t=_.trim().toLowerCase(),n=T;return t&&(n=n.filter(e=>(e.name??``).toLowerCase().includes(t)||e.id.toLowerCase().includes(t)||(e.description??``).toLowerCase().includes(t))),n.toSorted((t,n)=>t.hasUi===n.hasUi?(t.name||t.id).localeCompare(n.name||n.id,e):t.hasUi?-1:1)},[T,_,e]);if((0,U.useEffect)(()=>{b(e=>{if(!e)return e;let t=o.find(t=>t.id===e.id);return t?fe(e)===fe(t)&&e.active===t.active?e:t:null})},[o]),(0,U.useLayoutEffect)(()=>(n({startExtra:null,main:(0,X.jsx)(`div`,{className:`min-w-0`,children:(0,X.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:t.extensionsPage.title})}),end:(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(F,{asChild:!0,variant:`secondary`,className:`h-9`,children:(0,X.jsxs)(a,{to:`/local-apps`,"aria-label":t.extensionsPage.openLocalApps,title:t.extensionsPage.openLocalApps,children:[(0,X.jsx)(E,{className:`size-4`}),(0,X.jsx)(`span`,{className:`hidden sm:inline`,children:t.extensionsPage.openLocalApps})]})}),(0,X.jsx)(F,{asChild:!0,variant:`primary`,className:`h-9`,children:(0,X.jsxs)(a,{to:`/local-apps/new`,children:[(0,X.jsx)(P,{className:`size-4`}),t.extensionsPage.createLocalApp]})})]})}),()=>r()),[r,t.extensionsPage.createLocalApp,t.extensionsPage.openLocalApps,t.extensionsPage.title,n]),s&&m!==`marketplace`)return(0,X.jsx)(ye,{});let O=m!==`marketplace`&&T.length>0;return(0,X.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:[(0,X.jsxs)(`div`,{className:`w-full px-3 py-8 sm:px-5 xl:px-6`,children:[(0,X.jsxs)(`div`,{className:`mb-5 flex flex-col gap-3 rounded-xl border border-edge-subtle bg-surface-base p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,X.jsx)(H,{items:[{id:`marketplace`,label:t.extensionsPage.tabMarketplace},{id:`builtin`,label:t.extensionsPage.tabBuiltin,count:C.length},{id:`user`,label:t.extensionsPage.tabUser,count:w.length}],activeTab:m,onChange:h,ariaLabel:t.extensionsPage.extensionsNavAria,tabIdPrefix:`extensions-tab`,panelIdPrefix:`extensions-panel`,className:`flex-wrap`}),O?(0,X.jsxs)(`div`,{className:`relative w-full min-w-0 sm:max-w-xs`,children:[(0,X.jsx)(V,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,"aria-hidden":!0}),(0,X.jsx)(`input`,{type:`search`,value:_,onChange:e=>v(e.target.value),placeholder:t.extensionsPage.searchPlaceholder,className:`w-full rounded-lg border border-edge bg-surface-base py-2 pl-9 pr-3 text-sm text-fg placeholder:text-fg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,autoComplete:`off`})]}):null]}),m===`marketplace`?(0,X.jsx)(Q,{}):m===`builtin`&&C.length===0?(0,X.jsx)(xe,{message:t.extensionsPage.emptyBuiltin}):m===`user`&&w.length===0?(0,X.jsx)(xe,{message:t.extensionsPage.emptyUser}):D.length===0?(0,X.jsx)(`p`,{className:`rounded-xl border border-edge-subtle bg-surface-base px-3 py-8 text-center text-sm text-fg-muted shadow-surface sm:px-5 xl:px-6`,children:t.extensionsPage.noSearchResults}):(0,X.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:D.map(e=>(0,X.jsx)(ge,{extension:e,copy:t.extensionsPage,showSourceBadge:m===`user`,onOpen:()=>b(e)},e.id))})]}),y?(0,X.jsx)(_e,{extension:y,copy:t.extensionsPage,onClose:()=>b(null)},y.id):null]})}function fe(e){return e.activationEligible??e.active}function pe(e,t){return e.source===`bundled`?t.providerBundled:e.source===`global`?t.providerGlobal:e.source===`workspace`?t.providerWorkspace:t.providerOther}function me(e,t){return e.source===`global`?t.badgeSourceGlobal:e.source===`workspace`?t.badgeSourceWorkspace:t.badgeSourceOther}function he(e,t){let n=fe(e);return n&&e.active?t.runStateLive:n&&!e.active?t.runStatePendingOn:!n&&e.active?t.runStatePendingOff:t.runStateOff}function ge(e){let t=(0,W.c)(45),{extension:n,copy:r,showSourceBadge:i,onOpen:a}=e,c;t[0]===n?c=t[1]:(c=fe(n),t[0]=n,t[1]=c);let l=c,u=n.hasUi?r.cardTooltipHasUi:r.cardTooltipNoUi,d;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=s(`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]=d):d=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 m;t[5]===p?m=t[6]:(m=(0,X.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]=m);let h;t[7]===n.name?h=t[8]:(h=(0,X.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:n.name}),t[7]=n.name,t[8]=h);let g;t[9]===n.version?g=t[10]:(g=n.version?(0,X.jsxs)(`span`,{className:`text-[11px] text-fg-muted`,children:[`v`,n.version]}):null,t[9]=n.version,t[10]=g);let _;t[11]!==h||t[12]!==g?(_=(0,X.jsxs)(`div`,{className:`min-w-0`,children:[h,g]}),t[11]=h,t[12]=g,t[13]=_):_=t[13];let v;t[14]!==r.statusEnabled||t[15]!==l?(v=l?(0,X.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,X.jsx)(o,{className:`size-3`,strokeWidth:2.5,"aria-hidden":!0}),r.statusEnabled]}):(0,X.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,X.jsx)(P,{className:`size-4`,strokeWidth:2.5})}),t[14]=r.statusEnabled,t[15]=l,t[16]=v):v=t[16];let y;t[17]!==_||t[18]!==v?(y=(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[_,v]}),t[17]=_,t[18]=v,t[19]=y):y=t[19];let b;t[20]!==r.cardNoDescription||t[21]!==n.description?(b=n.description?.trim()||r.cardNoDescription,t[20]=r.cardNoDescription,t[21]=n.description,t[22]=b):b=t[22];let x;t[23]===b?x=t[24]:(x=(0,X.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-relaxed text-fg-muted`,children:b}),t[23]=b,t[24]=x);let S=n.hasUi?r.badgeKindUi:r.badgeKindBackend,C;t[25]!==S||t[26]!==u?(C=(0,X.jsx)(`span`,{title:u,className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:S}),t[25]=S,t[26]=u,t[27]=C):C=t[27];let w;t[28]!==r||t[29]!==n||t[30]!==i?(w=n.source===`bundled`?(0,X.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,X.jsx)(`span`,{title:pe(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:me(n,r)}):null,t[28]=r,t[29]=n,t[30]=i,t[31]=w):w=t[31];let T;t[32]!==C||t[33]!==w?(T=(0,X.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:[C,w]}),t[32]=C,t[33]=w,t[34]=T):T=t[34];let E;t[35]!==y||t[36]!==x||t[37]!==T?(E=(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[y,x,T]}),t[35]=y,t[36]=x,t[37]=T,t[38]=E):E=t[38];let D;t[39]!==E||t[40]!==m?(D=(0,X.jsxs)(`div`,{className:`flex gap-3`,children:[m,E]}),t[39]=E,t[40]=m,t[41]=D):D=t[41];let O;return t[42]!==a||t[43]!==D?(O=(0,X.jsx)(`button`,{type:`button`,onClick:a,className:d,children:D}),t[42]=a,t[43]=D,t[44]=O):O=t[44],O}function _e({extension:e,copy:t,onClose:n}){let{mutate:r}=m(),[i,o]=(0,U.useState)(!1),[c,l]=(0,U.useState)(null),[u,d]=(0,U.useState)(!1),f=e.activationEligible===!0,p=(0,U.useCallback)(async()=>{if(e.source===`bundled`){l(null),d(!1),o(!0);try{let{requiresGatewayRestart:t}=await J({extensionId:e.id,enabled:!f});await r(`gateway-extensions-list`),b(),d(t)}catch(e){l(e instanceof Error?e.message:t.builtinToggleFailed)}finally{o(!1)}}},[f,t.builtinToggleFailed,e.id,e.source,r]),h=e.ui?.contributions?.pages??[],g=e.ui?.contributions?.settingsPanels??[],y=e.ui?.contributions?.chatWidgets??[],S=e.ui?.contributions?.sidebarPanels??[],C=h.find(e=>e.showInNav)??h[0],E=g[0],A=C?R(e.id,C):null,j=E?`/settings/ext/${e.id}/${E.id}`:e.hasConfigSchema||z(e)?`/settings/ext/${e.id}`:null;return(0,X.jsx)(O,{defaultOpen:!0,onOpenChange:e=>!e&&n(),children:(0,X.jsxs)(w,{children:[(0,X.jsx)(v,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),(0,X.jsxs)(D,{className:`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-panel shadow-elevated`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[(0,X.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,X.jsx)(x,{className:`size-5`})}),(0,X.jsx)(ne,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:t.detailTitle}),(0,X.jsxs)(k,{className:`sr-only`,children:[e.name,` (`,e.id,`)`]}),(0,X.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,X.jsx)(T,{className:`size-5`})})]}),(0,X.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-start gap-4`,children:[(0,X.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,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:e.name}),(0,X.jsxs)(`p`,{className:`mt-0.5 text-sm text-fg-muted`,children:[t.detailProviderPrefix,` `,pe(e,t)]}),e.version?(0,X.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[`v`,e.version]}):null]})]}),(0,X.jsx)(`p`,{className:`mt-5 text-sm leading-relaxed text-fg`,children:e.description?.trim()||t.detailNoDescription}),e.hasUi?null:(0,X.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:t.backendOnlyHint}),(0,X.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:he(e,t)}),e.source===`bundled`?(0,X.jsxs)(X.Fragment,{children:[(0,X.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}),(0,X.jsxs)(`div`,{className:`mt-3 rounded-lg bg-surface-hover/40 p-3 shadow-surface dark:bg-surface-hover/20`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,X.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:t.builtinRuntimeToggle}),(0,X.jsx)(F,{type:`button`,variant:`secondary`,disabled:i,onClick:()=>void p(),className:`shrink-0 py-1.5 text-xs`,children:i?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(te,{className:`mr-1.5 size-3.5 shrink-0 animate-spin`,"aria-hidden":!0}),t.builtinToggleBusy]}):f?t.builtinToggleDisable:t.builtinToggleEnable})]}),c?(0,X.jsx)(`p`,{className:`mt-2 text-xs text-rose-600 dark:text-rose-400`,children:c}):null,u?(0,X.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.builtinToggleRestartHint}):null]})]}):(0,X.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.cliManageHint}),e.hasUi&&(h.length>0||g.length>0||y.length>0)?(0,X.jsxs)(`section`,{className:`mt-8`,children:[(0,X.jsx)(`h4`,{className:`mb-3 text-sm font-semibold text-fg`,children:t.detailSectionFeatures}),(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[(0,X.jsx)(ve,{template:t.badgePages,count:h.length,hidden:h.length===0}),(0,X.jsx)(ve,{template:t.badgeSettings,count:g.length,hidden:g.length===0}),(0,X.jsx)(ve,{template:t.badgeWidgets,count:y.length,hidden:y.length===0}),(0,X.jsx)(ve,{template:t.badgeSidebar,count:S.length,hidden:S.length===0})]})]}):null,B(e)&&(A||j)?(0,X.jsxs)(`div`,{className:`mt-6 flex flex-wrap gap-2 border-t border-edge-subtle pt-4`,children:[A?(0,X.jsxs)(a,{to:A,onClick:n,className:s(`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,X.jsx)(_,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.open]}):null,j?(0,X.jsxs)(a,{to:j,onClick:n,className:s(`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,X.jsx)(L,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.openSettings]}):null]}):null,(0,X.jsx)(`p`,{className:`mt-6 text-[11px] leading-relaxed text-fg-muted`,children:t.restartNote})]})]})]})})}function ve(e){let t=(0,W.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,X.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 ye(){let e=(0,W.c)(5),t,n,r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,X.jsx)(`div`,{className:`mb-6 h-8 w-40 max-w-full animate-pulse rounded-md bg-surface-hover`}),n=(0,X.jsx)(`div`,{className:`mb-2 h-4 w-full max-w-md animate-pulse rounded bg-surface-hover`}),r=(0,X.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,X.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:(0,X.jsxs)(`div`,{className:`w-full px-3 py-8 sm:px-5 xl:px-6`,children:[t,n,r,(0,X.jsx)(`div`,{className:`mt-6 grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:i.map(be)})]})}),e[4]=a):a=e[4],a}function be(e){return(0,X.jsx)(`div`,{className:`h-36 animate-pulse rounded-xl border border-edge-subtle bg-surface-base shadow-surface`},e)}function xe(e){let t=(0,W.c)(2),{message:n}=e,r;return t[0]===n?r=t[1]:(r=(0,X.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,X.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n})}),t[0]=n,t[1]=r),r}export{de 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{f as i,t as a}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as o}from"./check-DUBLcKHA.js";import{t as s}from"./cn-JdwAhgNB.js";import{t as c}from"./messages-H_iJjnEM.js";import{l,n as u,o as d,r as f,s as p}from"./locale-store-BNC8HUCI.js";import{a as m,i as h}from"./vendor-swr-BIWyz7Rc.js";import{Do as g,Gl as _,Go as v,Hc as y,Ir as b,Iu as x,Ji as S,Js as C,Ko as w,Ps as T,Tu as E,Uo as D,Vo as O,Wo as k,ao as A,eo as j,fc as ee,hu as M,io as N,jc as P,js as F,jt as I,mc as L,nl as te,no as R,oo as z,qo as ne,qs as re,so as B,vc as V}from"./index-BA56bQ68.js";import{t as H}from"./page-tabs-BnSzIjH0.js";var U=e(t(),1),W=n();function G(e){return e===`builtin`||e===`user`?e:`marketplace`}async function K(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 ie(e){let t=await d(f(`/api/marketplace/packages/${encodeURIComponent(e.trim())}`),{cache:`no-store`});if(!t.ok)throw Error(await K(t));let n=await t.json();if(!n.ok||!n.payload?.id)throw Error(n.error??`Invalid response`);return n.payload}async function q(e){let t=await d(f(`/api/marketplace/install`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await K(t));let n=await t.json();if(!n.ok||!n.payload?.extensionId)throw Error(n.error??`Invalid response`);return n.payload}async function J(e){let t=await d(f(`/api/extensions/bundled/activation`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({extensionId:e.extensionId.trim(),enabled:e.enabled})});if(!t.ok)throw Error(await K(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error?.message??`Invalid response`);return n.payload}async function Y(e){let t=await d(f(`/api/marketplace/uninstall`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({extensionId:e})});if(!t.ok)throw Error(await K(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error??`Invalid response`);return n.payload}var X=r();function ae(e,t){let n=e.find(e=>e.id===t);return n?n.source===`bundled`?`bundled`:`user`:`absent`}var Z={q:``,debounced:``,detailPkg:null,rowBusy:null,actionError:null,restartHint:null};function Q({className:e}){let t=c(u(e=>e.language)).extensionsPage,n=l(e=>!!e.token),r=N(),{mutate:i}=m(),[a,o]=(0,U.useReducer)(I,Z),{q:d,debounced:g,detailPkg:_,rowBusy:v,actionError:x,restartHint:S}=a,w=n?`marketplace-${g}`:null;(0,U.useEffect)(()=>{let e=window.setTimeout(()=>o({type:`patch`,patch:{debounced:d.trim()}}),300);return()=>window.clearTimeout(e)},[d]);let{data:T,isLoading:E,error:D}=h(w,async()=>p(g.length>0?f(`/api/marketplace?q=${encodeURIComponent(g)}`):f(`/api/marketplace`)),{revalidateOnFocus:!1}),O=(0,U.useCallback)(()=>{i(`gateway-extensions-list`),b()},[i]),k=(0,U.useCallback)(async(e,n)=>{o({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let r=await q({name:e,overwrite:n});O(),r.requiresGatewayRestart&&o({type:`patch`,patch:{restartHint:t.marketplaceRestartHint}})}catch(e){throw o({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.marketplaceInstallFailed}}),e}finally{o({type:`patch`,patch:{rowBusy:null}})}},[t.marketplaceInstallFailed,t.marketplaceRestartHint,O]),A=(0,U.useCallback)(async e=>{o({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let n=await Y(e);O(),n.requiresGatewayRestart&&o({type:`patch`,patch:{restartHint:t.marketplaceRestartHint}})}catch(e){throw o({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.marketplaceUninstallFailed}}),e}finally{o({type:`patch`,patch:{rowBusy:null}})}},[t.marketplaceRestartHint,t.marketplaceUninstallFailed,O]),ee=T?.extensions??[];return(0,X.jsxs)(`div`,{className:s(`flex flex-col gap-4`,e),children:[(0,X.jsxs)(`div`,{className:`relative`,children:[(0,X.jsx)(V,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),(0,X.jsx)(`input`,{type:`search`,value:d,onChange:e=>o({type:`patch`,patch:{q:e.target.value}}),placeholder:t.marketplaceSearchPlaceholder,className:`ui-input h-10 w-full rounded-lg border border-edge bg-surface-base pl-9 pr-3 text-sm text-fg placeholder:text-fg-muted`})]}),D?(0,X.jsx)(`p`,{className:`text-sm text-fg-muted`,children:D instanceof Error?D.message:t.marketplaceLoadFailed}):null,x?(0,X.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:x}):null,S?(0,X.jsx)(`p`,{className:`text-sm text-fg-muted`,children:S}):null,E&&!T?(0,X.jsx)(`ul`,{className:`flex flex-col gap-3`,"aria-label":t.marketplaceLoading,children:[0,1,2].map(e=>(0,X.jsx)(`li`,{className:`rounded-xl bg-surface-panel p-4 shadow-surface`,children:(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2.5`,children:[(0,X.jsx)(j,{className:`h-5 w-40`}),(0,X.jsx)(j,{className:`h-4 w-full max-w-xl`}),(0,X.jsx)(j,{className:`h-4 w-2/3 max-w-md`})]}),(0,X.jsx)(j,{className:`h-8 w-20`})]})},e))}):(0,X.jsx)(`ul`,{className:`flex flex-col gap-3`,children:ee.length===0?(0,X.jsx)(`li`,{className:`text-sm text-fg-muted`,children:t.marketplaceEmpty}):ee.map(e=>{let n=ae(r,e.id),i=v===e.id;return(0,X.jsx)(`li`,{className:`list-none`,children:(0,X.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-label":`${e.name}, ${t.marketplaceDetailTitle}`,onClick:()=>o({type:`patch`,patch:{detailPkg:e.id}}),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),o({type:`patch`,patch:{detailPkg:e.id}}))},className:s(`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,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(`h3`,{className:`font-semibold text-fg`,children:e.name}),e.verified?(0,X.jsx)(M,{className:`size-4 shrink-0 text-emerald-600 dark:text-emerald-400`,strokeWidth:1.75,"aria-label":`Verified`}):null,e.version?(0,X.jsx)(`span`,{className:`text-xs text-fg-muted`,children:e.version}):null]}),e.description?(0,X.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm text-fg-muted`,children:e.description}):null,(0,X.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:(e.categories??[]).map(e=>(0,X.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,X.jsxs)(`p`,{className:`mt-2 flex items-center gap-1.5 text-xs text-fg-muted`,children:[(0,X.jsx)(y,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),(0,X.jsx)(`code`,{className:`rounded bg-surface-panel px-1 py-0.5`,children:e.npmPackage})]})]}),(0,X.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:n===`bundled`?(0,X.jsx)(`span`,{className:`rounded-md bg-surface-hover px-2 py-1 text-[11px] font-medium text-fg-muted`,children:t.marketplaceBuiltin}):n===`user`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`text-[11px] font-medium text-fg-muted`,children:t.marketplaceInstalled}),(0,X.jsxs)(`button`,{type:`button`,disabled:i,onClick:()=>{window.confirm(t.marketplaceUninstallConfirm)&&A(e.id).catch(()=>{})},className:s(`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,X.jsx)(te,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,X.jsx)(C,{className:`size-3.5`,strokeWidth:2,"aria-hidden":!0}),t.marketplaceUninstall]})]}):(0,X.jsx)(`button`,{type:`button`,onClick:()=>o({type:`patch`,patch:{detailPkg:e.id}}),className:s(`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:t.marketplaceReview})})]})},e.id)})}),_?(0,X.jsx)($,{packageName:_,copy:t,extensions:r,onClose:()=>o({type:`patch`,patch:{detailPkg:null}}),onInstall:k,onUninstall:A}):null]})}function $(e){let t=(0,W.c)(102),{packageName:n,copy:r,extensions:i,onClose:o,onInstall:c,onUninstall:u}=e,[d,f]=(0,U.useState)(!1),[p,m]=(0,U.useState)(!1),g=l(ue)?`ext-mp-detail-${n}`:null,_;t[0]===n?_=t[1]:(_=async()=>ie(n),t[0]=n,t[1]=_);let y;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(y={revalidateOnFocus:!1},t[2]=y):y=t[2];let{data:b,error:E,isLoading:k}=h(g,_,y),A;t[3]!==i||t[4]!==n?(A=ae(i,n),t[3]=i,t[4]=n,t[5]=A):A=t[5];let M=A,N=M===`user`,P=b?.manifest?.permissions,F,I,L,R,z,B,V,H,G,K,q;if(t[6]!==r.detailBack||t[7]!==r.detailClose||t[8]!==r.marketplaceAuthor||t[9]!==r.marketplaceCodeRisk||t[10]!==r.marketplaceDependencies||t[11]!==r.marketplaceDetailLoadFailed||t[12]!==r.marketplaceDetailReadmeHeading||t[13]!==r.marketplaceDetailTitle||t[14]!==r.marketplaceDownloads||t[15]!==r.marketplaceIntegrity||t[16]!==r.marketplaceIntegrityVerified||t[17]!==r.marketplaceLifecycleScripts||t[18]!==r.marketplaceLoadFailed||t[19]!==r.marketplaceLoading||t[20]!==r.marketplaceNoReadme||t[21]!==r.marketplacePermissions||t[22]!==r.marketplacePermissionsNone||t[23]!==r.marketplaceRiskConfirm||t[24]!==r.marketplaceRiskTitle||t[25]!==r.marketplaceUnavailableBody||t[26]!==r.marketplaceUnavailableTitle||t[27]!==r.marketplaceVersion||t[28]!==b||t[29]!==E||t[30]!==M||t[31]!==k||t[32]!==o||t[33]!==P||t[34]!==p){let e=P&&typeof P==`object`&&!Array.isArray(P)?Object.entries(P):[],n;t[46]!==r.marketplaceNoReadme||t[47]!==b?(n=b?.readme?.trim()||(b?.description?.trim()?`### ${b.name}\n\n${b.description}`:`*${r.marketplaceNoReadme}*`),t[46]=r.marketplaceNoReadme,t[47]=b,t[48]=n):n=t[48];let i=n;L=O,R=!0,t[49]===o?z=t[50]:(z=e=>!e&&o(),t[49]=o,t[50]=z),I=w,t[51]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,X.jsx)(v,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),t[51]=q):q=t[51],F=D,H=`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-panel shadow-elevated`,G=le;let a;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(x,{className:`size-5`}),t[52]=a):a=t[52];let s;t[53]!==r.detailBack||t[54]!==o?(s=(0,X.jsx)(`button`,{type:`button`,onClick:o,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":r.detailBack,children:a}),t[53]=r.detailBack,t[54]=o,t[55]=s):s=t[55];let c;t[56]===r.marketplaceDetailTitle?c=t[57]:(c=(0,X.jsx)(ne,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:r.marketplaceDetailTitle}),t[56]=r.marketplaceDetailTitle,t[57]=c);let l;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,X.jsx)(T,{className:`size-5`}),t[58]=l):l=t[58];let u;t[59]!==r.detailClose||t[60]!==o?(u=(0,X.jsx)(`button`,{type:`button`,onClick:o,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":r.detailClose,children:l}),t[59]=r.detailClose,t[60]=o,t[61]=u):u=t[61],t[62]!==s||t[63]!==c||t[64]!==u?(K=(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[s,c,u]}),t[62]=s,t[63]=c,t[64]=u,t[65]=K):K=t[65],B=`min-h-0 flex-1 overflow-y-auto p-5`,V=k&&!b?(0,X.jsxs)(`div`,{className:`space-y-4`,"aria-label":r.marketplaceLoading,children:[(0,X.jsx)(j,{className:`h-6 w-48`}),(0,X.jsx)(j,{className:`h-4 w-28`}),(0,X.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,X.jsx)(j,{className:`h-12`}),(0,X.jsx)(j,{className:`h-12`})]}),(0,X.jsx)(j,{className:`h-28 w-full`}),(0,X.jsx)(j,{className:`h-36 w-full`})]}):E?(0,X.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,X.jsx)(`p`,{className:`font-medium text-red-700 dark:text-red-300`,children:r.marketplaceDetailLoadFailed}),(0,X.jsx)(`p`,{className:`mt-1 break-words text-red-600 dark:text-red-400`,children:E instanceof Error?E.message:r.marketplaceLoadFailed})]}):b?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:b.name}),(0,X.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:(0,X.jsx)(`code`,{className:`rounded bg-surface-panel px-1 py-0.5`,children:b.id})}),(0,X.jsxs)(`dl`,{className:`mt-3 grid gap-2 text-xs text-fg-muted sm:grid-cols-2`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceAuthor}),(0,X.jsx)(`dd`,{children:b.author.username})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceVersion}),(0,X.jsx)(`dd`,{children:b.latestVersion.version})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceDownloads}),(0,X.jsx)(`dd`,{children:b.downloads})]})]}),M===`bundled`?null:(0,X.jsxs)(`section`,{className:`mt-5 space-y-3 rounded-lg border border-edge bg-surface-base p-4`,children:[(0,X.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[b.installability.available?(0,X.jsx)(ee,{className:`mt-0.5 size-5 shrink-0 text-emerald-600 dark:text-emerald-400`,"aria-hidden":!0}):(0,X.jsx)(re,{className:`mt-0.5 size-5 shrink-0 text-amber-600 dark:text-amber-400`,"aria-hidden":!0}),(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:b.installability.available?r.marketplaceRiskTitle:r.marketplaceUnavailableTitle}),(0,X.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:b.installability.available?r.marketplaceCodeRisk:b.installability.reason??r.marketplaceUnavailableBody})]})]}),b.installability.available?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`dl`,{className:`grid gap-2 text-xs text-fg-muted sm:grid-cols-2`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceIntegrity}),(0,X.jsx)(`dd`,{children:r.marketplaceIntegrityVerified})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceDependencies}),(0,X.jsx)(`dd`,{children:b.packageSummary?.dependencyCount??0})]})]}),(0,X.jsxs)(`div`,{className:`text-xs text-fg-muted`,children:[(0,X.jsx)(`p`,{className:`font-medium text-fg`,children:r.marketplacePermissions}),e.length>0?(0,X.jsx)(`ul`,{className:`mt-1 space-y-1`,children:e.map(ce)}):(0,X.jsx)(`p`,{className:`mt-1`,children:r.marketplacePermissionsNone})]}),(b.packageSummary?.lifecycleScripts.length??0)>0?(0,X.jsxs)(`p`,{className:`text-xs leading-relaxed text-amber-700 dark:text-amber-300`,children:[r.marketplaceLifecycleScripts,`: `,b.packageSummary?.lifecycleScripts.join(`, `)]}):null,(0,X.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,X.jsx)(`input`,{type:`checkbox`,checked:p,onChange:e=>m(e.target.checked),className:`mt-0.5 size-4 rounded border-edge accent-[var(--color-accent)]`}),(0,X.jsx)(`span`,{children:r.marketplaceRiskConfirm})]})]}):null]}),b.readme?.trim()?(0,X.jsx)(`h4`,{className:`mb-2 mt-6 text-sm font-semibold text-fg`,children:r.marketplaceDetailReadmeHeading}):null,(0,X.jsx)(`div`,{className:`markdown-content min-w-0 break-words text-sm`,children:(0,X.jsx)(S,{content:i})})]}):null,t[6]=r.detailBack,t[7]=r.detailClose,t[8]=r.marketplaceAuthor,t[9]=r.marketplaceCodeRisk,t[10]=r.marketplaceDependencies,t[11]=r.marketplaceDetailLoadFailed,t[12]=r.marketplaceDetailReadmeHeading,t[13]=r.marketplaceDetailTitle,t[14]=r.marketplaceDownloads,t[15]=r.marketplaceIntegrity,t[16]=r.marketplaceIntegrityVerified,t[17]=r.marketplaceLifecycleScripts,t[18]=r.marketplaceLoadFailed,t[19]=r.marketplaceLoading,t[20]=r.marketplaceNoReadme,t[21]=r.marketplacePermissions,t[22]=r.marketplacePermissionsNone,t[23]=r.marketplaceRiskConfirm,t[24]=r.marketplaceRiskTitle,t[25]=r.marketplaceUnavailableBody,t[26]=r.marketplaceUnavailableTitle,t[27]=r.marketplaceVersion,t[28]=b,t[29]=E,t[30]=M,t[31]=k,t[32]=o,t[33]=P,t[34]=p,t[35]=F,t[36]=I,t[37]=L,t[38]=R,t[39]=z,t[40]=B,t[41]=V,t[42]=H,t[43]=G,t[44]=K,t[45]=q}else F=t[35],I=t[36],L=t[37],R=t[38],z=t[39],B=t[40],V=t[41],H=t[42],G=t[43],K=t[44],q=t[45];let J;t[66]!==B||t[67]!==V?(J=(0,X.jsx)(`div`,{className:B,children:V}),t[66]=B,t[67]=V,t[68]=J):J=t[68];let Y;t[69]!==d||t[70]!==r.marketplaceBuiltinGoBuiltin||t[71]!==r.marketplaceBuiltinManageHint||t[72]!==r.marketplaceInstall||t[73]!==r.marketplaceReinstall||t[74]!==r.marketplaceReinstallConfirm||t[75]!==r.marketplaceUninstall||t[76]!==r.marketplaceUninstallConfirm||t[77]!==b||t[78]!==M||t[79]!==o||t[80]!==c||t[81]!==u||t[82]!==n||t[83]!==p||t[84]!==N?(Y=b?(0,X.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,X.jsxs)(`div`,{className:`flex w-full flex-col items-stretch gap-2`,children:[(0,X.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:r.marketplaceBuiltinManageHint}),(0,X.jsx)(a,{to:`/extensions?tab=builtin`,onClick:o,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:r.marketplaceBuiltinGoBuiltin})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`button`,{type:`button`,disabled:d||!b.installability.available||!p,onClick:()=>{N&&!window.confirm(r.marketplaceReinstallConfirm)||(f(!0),c(n,N).catch(se).finally(()=>f(!1)))},className:s(`inline-flex items-center justify-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium`,`bg-accent text-white 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:[d?(0,X.jsx)(te,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,N?r.marketplaceReinstall:r.marketplaceInstall]}),N?(0,X.jsxs)(`button`,{type:`button`,disabled:d,onClick:()=>{window.confirm(r.marketplaceUninstallConfirm)&&(f(!0),u(n).then(()=>o()).catch(oe).finally(()=>f(!1)))},className:s(`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,X.jsx)(C,{className:`size-4 shrink-0`,"aria-hidden":!0}),r.marketplaceUninstall]}):null]})}):null,t[69]=d,t[70]=r.marketplaceBuiltinGoBuiltin,t[71]=r.marketplaceBuiltinManageHint,t[72]=r.marketplaceInstall,t[73]=r.marketplaceReinstall,t[74]=r.marketplaceReinstallConfirm,t[75]=r.marketplaceUninstall,t[76]=r.marketplaceUninstallConfirm,t[77]=b,t[78]=M,t[79]=o,t[80]=c,t[81]=u,t[82]=n,t[83]=p,t[84]=N,t[85]=Y):Y=t[85];let Z;t[86]!==F||t[87]!==J||t[88]!==Y||t[89]!==H||t[90]!==G||t[91]!==K?(Z=(0,X.jsxs)(F,{className:H,onOpenAutoFocus:G,children:[K,J,Y]}),t[86]=F,t[87]=J,t[88]=Y,t[89]=H,t[90]=G,t[91]=K,t[92]=Z):Z=t[92];let Q;t[93]!==I||t[94]!==Z||t[95]!==q?(Q=(0,X.jsxs)(I,{children:[q,Z]}),t[93]=I,t[94]=Z,t[95]=q,t[96]=Q):Q=t[96];let $;return t[97]!==L||t[98]!==R||t[99]!==z||t[100]!==Q?($=(0,X.jsx)(L,{defaultOpen:R,onOpenChange:z,children:Q}),t[97]=L,t[98]=R,t[99]=z,t[100]=Q,t[101]=$):$=t[101],$}function oe(){}function se(){}function ce(e){let[t,n]=e;return(0,X.jsxs)(`li`,{className:`break-words`,children:[(0,X.jsx)(`code`,{children:t}),`: `,Array.isArray(n)?n.join(`, `):String(n)]},t)}function le(e){return e.preventDefault()}function ue(e){return!!e.token}function de(){let e=u(e=>e.language),t=c(e),n=g(e=>e.setPageHeader),r=g(e=>e.clearPageHeader),o=N(),s=A(),[l,d]=i(),f=G(l.get(`tab`)),p=l.get(`q`)??``,[m,h]=(0,U.useState)(f),[_,v]=(0,U.useState)(p),[y,b]=(0,U.useState)(null),x=l.toString(),S=(0,U.useRef)(x);if(S.current!==x){S.current=x;let e=G(l.get(`tab`)),t=l.get(`q`)??``;h(t=>t===e?t:e),v(e=>e===t?e:t)}(0,U.useEffect)(()=>{d(e=>{let t=new URLSearchParams(e),n=_.trim();return n?t.set(`q`,n):t.delete(`q`),m===`marketplace`?t.delete(`tab`):t.set(`tab`,m),t.toString()===e.toString()?e:t},{replace:!0})},[m,_,d]);let C=(0,U.useMemo)(()=>o.filter(e=>e.source===`bundled`),[o]),w=(0,U.useMemo)(()=>o.filter(e=>e.source!==`bundled`),[o]),T=m===`builtin`?C:w,D=(0,U.useMemo)(()=>{let t=_.trim().toLowerCase(),n=T;return t&&(n=n.filter(e=>(e.name??``).toLowerCase().includes(t)||e.id.toLowerCase().includes(t)||(e.description??``).toLowerCase().includes(t))),n.toSorted((t,n)=>t.hasUi===n.hasUi?(t.name||t.id).localeCompare(n.name||n.id,e):t.hasUi?-1:1)},[T,_,e]);if((0,U.useEffect)(()=>{b(e=>{if(!e)return e;let t=o.find(t=>t.id===e.id);return t?fe(e)===fe(t)&&e.active===t.active?e:t:null})},[o]),(0,U.useLayoutEffect)(()=>(n({startExtra:null,main:(0,X.jsx)(`div`,{className:`min-w-0`,children:(0,X.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:t.extensionsPage.title})}),end:(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(F,{asChild:!0,variant:`secondary`,className:`h-9`,children:(0,X.jsxs)(a,{to:`/local-apps`,"aria-label":t.extensionsPage.openLocalApps,title:t.extensionsPage.openLocalApps,children:[(0,X.jsx)(E,{className:`size-4`}),(0,X.jsx)(`span`,{className:`hidden sm:inline`,children:t.extensionsPage.openLocalApps})]})}),(0,X.jsx)(F,{asChild:!0,variant:`primary`,className:`h-9`,children:(0,X.jsxs)(a,{to:`/local-apps/new`,children:[(0,X.jsx)(P,{className:`size-4`}),t.extensionsPage.createLocalApp]})})]})}),()=>r()),[r,t.extensionsPage.createLocalApp,t.extensionsPage.openLocalApps,t.extensionsPage.title,n]),s&&m!==`marketplace`)return(0,X.jsx)(ye,{});let O=m!==`marketplace`&&T.length>0;return(0,X.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:[(0,X.jsxs)(`div`,{className:`w-full px-3 py-8 sm:px-5 xl:px-6`,children:[(0,X.jsxs)(`div`,{className:`mb-5 flex flex-col gap-3 rounded-xl border border-edge-subtle bg-surface-base p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,X.jsx)(H,{items:[{id:`marketplace`,label:t.extensionsPage.tabMarketplace},{id:`builtin`,label:t.extensionsPage.tabBuiltin,count:C.length},{id:`user`,label:t.extensionsPage.tabUser,count:w.length}],activeTab:m,onChange:h,ariaLabel:t.extensionsPage.extensionsNavAria,tabIdPrefix:`extensions-tab`,panelIdPrefix:`extensions-panel`,className:`flex-wrap`}),O?(0,X.jsxs)(`div`,{className:`relative w-full min-w-0 sm:max-w-xs`,children:[(0,X.jsx)(V,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,"aria-hidden":!0}),(0,X.jsx)(`input`,{type:`search`,value:_,onChange:e=>v(e.target.value),placeholder:t.extensionsPage.searchPlaceholder,className:`w-full rounded-lg border border-edge bg-surface-base py-2 pl-9 pr-3 text-sm text-fg placeholder:text-fg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,autoComplete:`off`})]}):null]}),m===`marketplace`?(0,X.jsx)(Q,{}):m===`builtin`&&C.length===0?(0,X.jsx)(xe,{message:t.extensionsPage.emptyBuiltin}):m===`user`&&w.length===0?(0,X.jsx)(xe,{message:t.extensionsPage.emptyUser}):D.length===0?(0,X.jsx)(`p`,{className:`rounded-xl border border-edge-subtle bg-surface-base px-3 py-8 text-center text-sm text-fg-muted shadow-surface sm:px-5 xl:px-6`,children:t.extensionsPage.noSearchResults}):(0,X.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:D.map(e=>(0,X.jsx)(ge,{extension:e,copy:t.extensionsPage,showSourceBadge:m===`user`,onOpen:()=>b(e)},e.id))})]}),y?(0,X.jsx)(_e,{extension:y,copy:t.extensionsPage,onClose:()=>b(null)},y.id):null]})}function fe(e){return e.activationEligible??e.active}function pe(e,t){return e.source===`bundled`?t.providerBundled:e.source===`global`?t.providerGlobal:e.source===`workspace`?t.providerWorkspace:t.providerOther}function me(e,t){return e.source===`global`?t.badgeSourceGlobal:e.source===`workspace`?t.badgeSourceWorkspace:t.badgeSourceOther}function he(e,t){let n=fe(e);return n&&e.active?t.runStateLive:n&&!e.active?t.runStatePendingOn:!n&&e.active?t.runStatePendingOff:t.runStateOff}function ge(e){let t=(0,W.c)(45),{extension:n,copy:r,showSourceBadge:i,onOpen:a}=e,c;t[0]===n?c=t[1]:(c=fe(n),t[0]=n,t[1]=c);let l=c,u=n.hasUi?r.cardTooltipHasUi:r.cardTooltipNoUi,d;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=s(`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]=d):d=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 m;t[5]===p?m=t[6]:(m=(0,X.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]=m);let h;t[7]===n.name?h=t[8]:(h=(0,X.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:n.name}),t[7]=n.name,t[8]=h);let g;t[9]===n.version?g=t[10]:(g=n.version?(0,X.jsxs)(`span`,{className:`text-[11px] text-fg-muted`,children:[`v`,n.version]}):null,t[9]=n.version,t[10]=g);let _;t[11]!==h||t[12]!==g?(_=(0,X.jsxs)(`div`,{className:`min-w-0`,children:[h,g]}),t[11]=h,t[12]=g,t[13]=_):_=t[13];let v;t[14]!==r.statusEnabled||t[15]!==l?(v=l?(0,X.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,X.jsx)(o,{className:`size-3`,strokeWidth:2.5,"aria-hidden":!0}),r.statusEnabled]}):(0,X.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,X.jsx)(P,{className:`size-4`,strokeWidth:2.5})}),t[14]=r.statusEnabled,t[15]=l,t[16]=v):v=t[16];let y;t[17]!==_||t[18]!==v?(y=(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[_,v]}),t[17]=_,t[18]=v,t[19]=y):y=t[19];let b;t[20]!==r.cardNoDescription||t[21]!==n.description?(b=n.description?.trim()||r.cardNoDescription,t[20]=r.cardNoDescription,t[21]=n.description,t[22]=b):b=t[22];let x;t[23]===b?x=t[24]:(x=(0,X.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-relaxed text-fg-muted`,children:b}),t[23]=b,t[24]=x);let S=n.hasUi?r.badgeKindUi:r.badgeKindBackend,C;t[25]!==S||t[26]!==u?(C=(0,X.jsx)(`span`,{title:u,className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:S}),t[25]=S,t[26]=u,t[27]=C):C=t[27];let w;t[28]!==r||t[29]!==n||t[30]!==i?(w=n.source===`bundled`?(0,X.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,X.jsx)(`span`,{title:pe(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:me(n,r)}):null,t[28]=r,t[29]=n,t[30]=i,t[31]=w):w=t[31];let T;t[32]!==C||t[33]!==w?(T=(0,X.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:[C,w]}),t[32]=C,t[33]=w,t[34]=T):T=t[34];let E;t[35]!==y||t[36]!==x||t[37]!==T?(E=(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[y,x,T]}),t[35]=y,t[36]=x,t[37]=T,t[38]=E):E=t[38];let D;t[39]!==E||t[40]!==m?(D=(0,X.jsxs)(`div`,{className:`flex gap-3`,children:[m,E]}),t[39]=E,t[40]=m,t[41]=D):D=t[41];let O;return t[42]!==a||t[43]!==D?(O=(0,X.jsx)(`button`,{type:`button`,onClick:a,className:d,children:D}),t[42]=a,t[43]=D,t[44]=O):O=t[44],O}function _e({extension:e,copy:t,onClose:n}){let{mutate:r}=m(),[i,o]=(0,U.useState)(!1),[c,l]=(0,U.useState)(null),[u,d]=(0,U.useState)(!1),f=e.activationEligible===!0,p=(0,U.useCallback)(async()=>{if(e.source===`bundled`){l(null),d(!1),o(!0);try{let{requiresGatewayRestart:t}=await J({extensionId:e.id,enabled:!f});await r(`gateway-extensions-list`),b(),d(t)}catch(e){l(e instanceof Error?e.message:t.builtinToggleFailed)}finally{o(!1)}}},[f,t.builtinToggleFailed,e.id,e.source,r]),h=e.ui?.contributions?.pages??[],g=e.ui?.contributions?.settingsPanels??[],y=e.ui?.contributions?.chatWidgets??[],S=e.ui?.contributions?.sidebarPanels??[],C=h.find(e=>e.showInNav)??h[0],E=g[0],A=C?R(e.id,C):null,j=E?`/settings/ext/${e.id}/${E.id}`:e.hasConfigSchema||z(e)?`/settings/ext/${e.id}`:null;return(0,X.jsx)(O,{defaultOpen:!0,onOpenChange:e=>!e&&n(),children:(0,X.jsxs)(w,{children:[(0,X.jsx)(v,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),(0,X.jsxs)(D,{className:`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-panel shadow-elevated`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[(0,X.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,X.jsx)(x,{className:`size-5`})}),(0,X.jsx)(ne,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:t.detailTitle}),(0,X.jsxs)(k,{className:`sr-only`,children:[e.name,` (`,e.id,`)`]}),(0,X.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,X.jsx)(T,{className:`size-5`})})]}),(0,X.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-start gap-4`,children:[(0,X.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,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:e.name}),(0,X.jsxs)(`p`,{className:`mt-0.5 text-sm text-fg-muted`,children:[t.detailProviderPrefix,` `,pe(e,t)]}),e.version?(0,X.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[`v`,e.version]}):null]})]}),(0,X.jsx)(`p`,{className:`mt-5 text-sm leading-relaxed text-fg`,children:e.description?.trim()||t.detailNoDescription}),e.hasUi?null:(0,X.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:t.backendOnlyHint}),(0,X.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:he(e,t)}),e.source===`bundled`?(0,X.jsxs)(X.Fragment,{children:[(0,X.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}),(0,X.jsxs)(`div`,{className:`mt-3 rounded-lg bg-surface-hover/40 p-3 shadow-surface dark:bg-surface-hover/20`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,X.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:t.builtinRuntimeToggle}),(0,X.jsx)(F,{type:`button`,variant:`secondary`,disabled:i,onClick:()=>void p(),className:`shrink-0 py-1.5 text-xs`,children:i?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(te,{className:`mr-1.5 size-3.5 shrink-0 animate-spin`,"aria-hidden":!0}),t.builtinToggleBusy]}):f?t.builtinToggleDisable:t.builtinToggleEnable})]}),c?(0,X.jsx)(`p`,{className:`mt-2 text-xs text-rose-600 dark:text-rose-400`,children:c}):null,u?(0,X.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.builtinToggleRestartHint}):null]})]}):(0,X.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.cliManageHint}),e.hasUi&&(h.length>0||g.length>0||y.length>0)?(0,X.jsxs)(`section`,{className:`mt-8`,children:[(0,X.jsx)(`h4`,{className:`mb-3 text-sm font-semibold text-fg`,children:t.detailSectionFeatures}),(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[(0,X.jsx)(ve,{template:t.badgePages,count:h.length,hidden:h.length===0}),(0,X.jsx)(ve,{template:t.badgeSettings,count:g.length,hidden:g.length===0}),(0,X.jsx)(ve,{template:t.badgeWidgets,count:y.length,hidden:y.length===0}),(0,X.jsx)(ve,{template:t.badgeSidebar,count:S.length,hidden:S.length===0})]})]}):null,B(e)&&(A||j)?(0,X.jsxs)(`div`,{className:`mt-6 flex flex-wrap gap-2 border-t border-edge-subtle pt-4`,children:[A?(0,X.jsxs)(a,{to:A,onClick:n,className:s(`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,X.jsx)(_,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.open]}):null,j?(0,X.jsxs)(a,{to:j,onClick:n,className:s(`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,X.jsx)(L,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.openSettings]}):null]}):null,(0,X.jsx)(`p`,{className:`mt-6 text-[11px] leading-relaxed text-fg-muted`,children:t.restartNote})]})]})]})})}function ve(e){let t=(0,W.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,X.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 ye(){let e=(0,W.c)(5),t,n,r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,X.jsx)(`div`,{className:`mb-6 h-8 w-40 max-w-full animate-pulse rounded-md bg-surface-hover`}),n=(0,X.jsx)(`div`,{className:`mb-2 h-4 w-full max-w-md animate-pulse rounded bg-surface-hover`}),r=(0,X.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,X.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:(0,X.jsxs)(`div`,{className:`w-full px-3 py-8 sm:px-5 xl:px-6`,children:[t,n,r,(0,X.jsx)(`div`,{className:`mt-6 grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:i.map(be)})]})}),e[4]=a):a=e[4],a}function be(e){return(0,X.jsx)(`div`,{className:`h-36 animate-pulse rounded-xl border border-edge-subtle bg-surface-base shadow-surface`},e)}function xe(e){let t=(0,W.c)(2),{message:n}=e,r;return t[0]===n?r=t[1]:(r=(0,X.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,X.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n})}),t[0]=n,t[1]=r),r}export{de 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-DYqBwJAK.js";import{t as a}from"./jszip.min-DT31yWkU.js";import{t as o}from"./preview-open-alternatives-BSTlgsDB.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-H_iJjnEM.js";import{t as a}from"./jszip.min-DT31yWkU.js";import{t as o}from"./preview-open-alternatives-CF12Eqi4.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,2 +1,2 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/attachment-process-heavy-B2_kr5EA.js","assets/rolldown-runtime-aKtaBQYM.js","assets/preload-helper-zJ_50EbN.js","assets/excel-worksheet-utils-EyvwNT4X.js"])))=>i.map(i=>d[i]);
2
- import{t as e}from"./preload-helper-zJ_50EbN.js";import{Xa as t}from"./index-BDzspHrg.js";async function n(n,r){let i,a=r||`unnamed`,o=`application/octet-stream`,s=0;if(typeof n==`string`){let e=await fetch(n);if(!e.ok)throw Error(`Failed to fetch file`);if(i=await e.arrayBuffer(),s=i.byteLength,o=e.headers.get(`content-type`)||o,!r){let e=n.split(`/`);a=e[e.length-1]||`document`}}else if(n instanceof File)i=await n.arrayBuffer(),s=n.size,o=n.type||o,a=r||n.name;else if(n instanceof Blob)i=await n.arrayBuffer(),s=n.size,o=n.type||o;else if(n instanceof ArrayBuffer)i=n,s=n.byteLength;else throw Error(`Invalid source type`);let c=new Uint8Array(i),l=``,u=32768;for(let e=0;e<c.length;e+=u){let t=c.slice(e,e+u);l+=String.fromCharCode(...t)}let d=btoa(l),f=`${a}_${Date.now()}_${Math.random()}`;if(o===`application/pdf`||a.toLowerCase().endsWith(`.pdf`)){let{processPdf:t}=await e(async()=>{let{processPdf:e}=await import(`./attachment-process-heavy-B2_kr5EA.js`);return{processPdf:e}},__vite__mapDeps([0,1,2,3])),{extractedText:n,preview:r}=await t(i,a);return{id:f,type:`document`,name:a,mimeType:`application/pdf`,size:s,content:d,extractedText:n,preview:r}}if(o===`application/vnd.openxmlformats-officedocument.wordprocessingml.document`||a.toLowerCase().endsWith(`.docx`)){let{processDocx:t}=await e(async()=>{let{processDocx:e}=await import(`./attachment-process-heavy-B2_kr5EA.js`);return{processDocx:e}},__vite__mapDeps([0,1,2,3])),{extractedText:n}=await t(i,a);return{id:f,type:`document`,name:a,mimeType:`application/vnd.openxmlformats-officedocument.wordprocessingml.document`,size:s,content:d,extractedText:n}}if(o===`application/vnd.openxmlformats-officedocument.presentationml.presentation`||a.toLowerCase().endsWith(`.pptx`)){let{processPptx:t}=await e(async()=>{let{processPptx:e}=await import(`./attachment-process-heavy-B2_kr5EA.js`);return{processPptx:e}},__vite__mapDeps([0,1,2,3])),{extractedText:n}=await t(i,a);return{id:f,type:`document`,name:a,mimeType:`application/vnd.openxmlformats-officedocument.presentationml.presentation`,size:s,content:d,extractedText:n}}if([`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`,`application/vnd.ms-excel`].includes(o)||a.toLowerCase().endsWith(`.xlsx`)||a.toLowerCase().endsWith(`.xls`)){let{processExcel:t}=await e(async()=>{let{processExcel:e}=await import(`./attachment-process-heavy-B2_kr5EA.js`);return{processExcel:e}},__vite__mapDeps([0,1,2,3])),{extractedText:n}=await t(i,a);return{id:f,type:`document`,name:a,mimeType:o&&o.startsWith(`application/vnd`)?o:`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`,size:s,content:d,extractedText:n}}if(o?.startsWith(`image/`))return{id:f,type:`image`,name:a,mimeType:o,size:s,content:d,preview:d};if(o?.startsWith(`audio/`))return{id:f,type:`voice`,name:a,mimeType:o,size:s,content:d};if(t(a,o??``)){let e=new TextDecoder().decode(i);return{id:f,type:`document`,name:a,mimeType:o?.startsWith(`text/`)?o:`text/plain`,size:s,content:d,extractedText:e}}throw Error(`Unsupported file type: ${o}`)}export{n as loadAttachment};
2
+ import{t as e}from"./preload-helper-zJ_50EbN.js";import{Xa as t}from"./index-BA56bQ68.js";async function n(n,r){let i,a=r||`unnamed`,o=`application/octet-stream`,s=0;if(typeof n==`string`){let e=await fetch(n);if(!e.ok)throw Error(`Failed to fetch file`);if(i=await e.arrayBuffer(),s=i.byteLength,o=e.headers.get(`content-type`)||o,!r){let e=n.split(`/`);a=e[e.length-1]||`document`}}else if(n instanceof File)i=await n.arrayBuffer(),s=n.size,o=n.type||o,a=r||n.name;else if(n instanceof Blob)i=await n.arrayBuffer(),s=n.size,o=n.type||o;else if(n instanceof ArrayBuffer)i=n,s=n.byteLength;else throw Error(`Invalid source type`);let c=new Uint8Array(i),l=``,u=32768;for(let e=0;e<c.length;e+=u){let t=c.slice(e,e+u);l+=String.fromCharCode(...t)}let d=btoa(l),f=`${a}_${Date.now()}_${Math.random()}`;if(o===`application/pdf`||a.toLowerCase().endsWith(`.pdf`)){let{processPdf:t}=await e(async()=>{let{processPdf:e}=await import(`./attachment-process-heavy-B2_kr5EA.js`);return{processPdf:e}},__vite__mapDeps([0,1,2,3])),{extractedText:n,preview:r}=await t(i,a);return{id:f,type:`document`,name:a,mimeType:`application/pdf`,size:s,content:d,extractedText:n,preview:r}}if(o===`application/vnd.openxmlformats-officedocument.wordprocessingml.document`||a.toLowerCase().endsWith(`.docx`)){let{processDocx:t}=await e(async()=>{let{processDocx:e}=await import(`./attachment-process-heavy-B2_kr5EA.js`);return{processDocx:e}},__vite__mapDeps([0,1,2,3])),{extractedText:n}=await t(i,a);return{id:f,type:`document`,name:a,mimeType:`application/vnd.openxmlformats-officedocument.wordprocessingml.document`,size:s,content:d,extractedText:n}}if(o===`application/vnd.openxmlformats-officedocument.presentationml.presentation`||a.toLowerCase().endsWith(`.pptx`)){let{processPptx:t}=await e(async()=>{let{processPptx:e}=await import(`./attachment-process-heavy-B2_kr5EA.js`);return{processPptx:e}},__vite__mapDeps([0,1,2,3])),{extractedText:n}=await t(i,a);return{id:f,type:`document`,name:a,mimeType:`application/vnd.openxmlformats-officedocument.presentationml.presentation`,size:s,content:d,extractedText:n}}if([`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`,`application/vnd.ms-excel`].includes(o)||a.toLowerCase().endsWith(`.xlsx`)||a.toLowerCase().endsWith(`.xls`)){let{processExcel:t}=await e(async()=>{let{processExcel:e}=await import(`./attachment-process-heavy-B2_kr5EA.js`);return{processExcel:e}},__vite__mapDeps([0,1,2,3])),{extractedText:n}=await t(i,a);return{id:f,type:`document`,name:a,mimeType:o&&o.startsWith(`application/vnd`)?o:`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`,size:s,content:d,extractedText:n}}if(o?.startsWith(`image/`))return{id:f,type:`image`,name:a,mimeType:o,size:s,content:d,preview:d};if(o?.startsWith(`audio/`))return{id:f,type:`voice`,name:a,mimeType:o,size:s,content:d};if(t(a,o??``)){let e=new TextDecoder().decode(i);return{id:f,type:`document`,name:a,mimeType:o?.startsWith(`text/`)?o:`text/plain`,size:s,content:d,extractedText:e}}throw Error(`Unsupported file type: ${o}`)}export{n as loadAttachment};
@@ -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{f as i,t as a}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as o}from"./cn-JdwAhgNB.js";import{t as s}from"./messages-H_iJjnEM.js";import{n as c}from"./locale-store-BNC8HUCI.js";import{i as l}from"./vendor-swr-BIWyz7Rc.js";import{$c as u,Ci as d,Do as f,Ei as p,Gl as m,Go as h,Ho as g,Ji as _,Js as v,Ko as y,Lc as b,Nc as x,Ns as S,O as C,Ps as w,Rr as T,Si as E,Uo as D,Vo as O,Vu as k,Yo as A,Za as j,_u as ee,as as M,b as N,bu as P,cc as te,eo as F,fc as ne,gu as re,il as ie,is as I,jc as ae,jl as oe,js as L,mu as se,oa as ce,qo as le,wc as R,wi as ue,xi as de,yu as fe,zc as z}from"./index-BA56bQ68.js";import{t as pe}from"./time-picker-D0zAsHOo.js";import{t as me}from"./format-cron-label-arqgGlVV.js";import{a as B,i as he,n as V,r as ge,t as _e}from"./workflow-run-setup-panel-CTG4RpRE.js";import{i as ve,n as ye,r as be,t as xe}from"./browser-workflow-inputs-_gu08MA4.js";var H=e(t(),1),U=n(),W=1e3,G=60*W,K=60*G,q=24*K,Se=7*q,Ce=new Intl.ListFormat(`en-US`,{type:`conjunction`}),we=Object.fromEntries([`second`,`minute`,`hour`,`day`,`week`].map(e=>[e,new Intl.NumberFormat(`en-US`,{style:`unit`,unit:e,unitDisplay:`long`})])),J={en:new Intl.DateTimeFormat(`en-US`,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}),zh:new Intl.DateTimeFormat(`zh-CN`,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})},Te={en:new Intl.DateTimeFormat(`en-US`,{hour:`2-digit`,minute:`2-digit`}),zh:new Intl.DateTimeFormat(`zh-CN`,{hour:`2-digit`,minute:`2-digit`})},Y={minute:G,hour:K,day:q,week:Se};function Ee(e){return e===`zh`?`zh-CN`:`en-US`}function De(e,t,n){return n===`zh`?`${e} ${t===`week`?`周`:t===`day`?`天`:t===`hour`?`小时`:t===`minute`?`分钟`:`秒`}`:we[String(t)].format(e)}function Oe(e,t){return t===`zh`?e.join(` `):Ce.format(e)}function ke(e,t){let n=typeof e==`number`?e:Number.parseFloat(e);return Math.max(G,Math.round((Number.isFinite(n)&&n>0?n:1)*Y[t]))}function Ae(e,t,n){let r=typeof e==`number`?e:Number.parseFloat(e),i=Number.isFinite(r)&&r>0?r:1;return String(Number.parseFloat((i*Y[t]/Y[n]).toFixed(6)))}function je(e,t){let n=Math.max(W,Math.round(e)),r=n===q?[{unit:`hour`,ms:K}]:n>=Se&&n%Se===0?[{unit:`week`,ms:Se}]:n>=q?[{unit:`day`,ms:q},{unit:`hour`,ms:K},{unit:`minute`,ms:G},{unit:`second`,ms:W}]:n>=K?[{unit:`hour`,ms:K},{unit:`minute`,ms:G},{unit:`second`,ms:W}]:n>=G?[{unit:`minute`,ms:G},{unit:`second`,ms:W}]:[{unit:`second`,ms:W}],i=n,a=[];for(let{unit:e,ms:n}of r){let r=Math.floor(i/n);r<=0||(a.push(De(r,e,t)),i%=n)}return Oe(a,t)}function X(e,t){let n=je(e,t);return t===`zh`?`每 ${n}运行一次`:`Runs every ${n}`}function Me(e,t){return J[t].format(new Date(e))}function Ne(e){return Date.UTC(e.getFullYear(),e.getMonth(),e.getDate())}function Pe(e,t,n=Date.now()){let r=new Date(e),i=Math.round((Ne(r)-Ne(new Date(n)))/q),a=Te[t].format(r);return i===0?t===`zh`?`今天 ${a}`:`today at ${a}`:i===1?t===`zh`?`明天 ${a}`:`tomorrow at ${a}`:i===-1?t===`zh`?`昨天 ${a}`:`yesterday at ${a}`:Me(e,t)}function Fe(e,t){return e.eventType===`goal.status_changed`&&e.payloadMatch?.status===`blocked`?t.trigger.goalBlockedWhen:e.eventType===`note.created`?t.trigger.noteCreatedWhen:e.eventType===`workflow.run.completed`&&e.payloadMatch?.status===`failed`?t.trigger.workflowFailedWhen:e.eventType===`session.transcript.updated`?t.trigger.sessionUpdatedWhen:t.trigger.eventWithType.replace(`{type}`,e.eventType)}function Ie(e,t,n,r){if(e.kind===`manual`)return t.trigger.manualWhen;if(e.kind===`webhook`)return t.trigger.webhookWhen;if(e.kind===`event`)return Fe(e,t);let i=e.schedule;return i.kind===`once`?t.trigger.onceAt.replace(`{time}`,Pe(Date.parse(i.at),r)):i.kind===`interval`?X(i.everyMs,r):me(i.expr,Ee(r),n.scheduleBadge,{timezone:i.tz})}function Le(e,t,n,r=Date.now()){return e.enabled?e.state.nextRunAtMs?Pe(e.state.nextRunAtMs,n,r):e.trigger.kind===`manual`?t.info.noAutomaticTrigger:e.trigger.kind===`event`||e.trigger.kind===`webhook`?t.info.waitingForTrigger:t.info.noUpcomingRun:t.info.pausedNoAutomaticRuns}function Re(e,t,n,r=Date.now()){if(!e.state.lastRunAtMs)return t.info.notRunYet;let i=Pe(e.state.lastRunAtMs,n,r),a=e.state.lastRunStatus;return a?`${i} · ${t.status[a]}`:i}var ze={name:``,description:``,triggerMode:`daily`,time:`09:00`,weekday:`1`,intervalValue:`1`,intervalUnit:`hour`,cronExpr:`0 9 * * *`,webhookSecretId:``,onceAt:``,eventType:``,eventSource:``,eventPayloadMatch:``,actionMode:`agent`,agentId:``,instruction:``,workflowId:``,workflowGoal:``,workflowInput:{goal:``,argValues:{},schemaInput:{},concurrency:``,maxSubagents:``},workflowInputValid:!0,browserWorkflowId:``,browserWorkflowInputs:{},safetyMode:`suggest_only`,timeoutSeconds:`1800`,afterRunMode:`none`,webhookUrl:``,disableAfterFailures:`3`},Be=[{value:`15`,unit:`minute`},{value:`30`,unit:`minute`},{value:`1`,unit:`hour`},{value:`6`,unit:`hour`},{value:`24`,unit:`hour`}];function Ve(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===`goalBlocked`)o={kind:`event`,eventType:`goal.status_changed`,source:`goals`,payloadMatch:{status:`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:ke(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=ge(t,e.workflowInput),c=e.workflowInput.goal.trim()||e.workflowGoal.trim(),l=e.actionMode===`browser_recipe`?`auto_apply`:e.safetyMode,u=l===`auto_apply`?e.afterRunMode:`none`,d;return d=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_recipe`?{kind:`browser_recipe`,recipeId:e.browserWorkflowId.trim(),args:e.browserWorkflowInputs}:{kind:`agent`,instruction:e.instruction.trim(),...e.agentId.trim()?{agentId:e.agentId.trim()}:{}},{name:e.name.trim(),...e.description.trim()?{description:e.description.trim()}:{},trigger:o,action:d,safety:{mode:l},afterRun:u===`webhook`?{kind:`webhook`,url:e.webhookUrl.trim()}:{kind:u},reliability:{executionTimeoutSeconds:Math.max(1,Number.parseInt(e.timeoutSeconds,10)||1800),disableAfterConsecutiveFailures:Math.max(1,Number.parseInt(e.disableAfterFailures,10)||3)}}}function He(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:ze.time,weekday:ze.weekday,cronExpr:e}}function Ue(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 We(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 Ge(e){let t=e.payloadMatch;return e.eventType===`goal.status_changed`&&e.source===`goals`&&t?.status===`blocked`?{triggerMode:`goalBlocked`}: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 Ke(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 Je(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=Ge(e.trigger);else if(e.trigger.kind===`schedule`){let t=e.trigger.schedule;t.kind===`cron`&&(n=He(t.expr)),t.kind===`interval`&&(n={triggerMode:`interval`,...Ue(t.everyMs)}),t.kind===`once`&&(n={triggerMode:`once`,onceAt:We(t.at)})}let r=e.action,i=r.kind===`workflow`?t.find(e=>e.id===r.workflowId)??null:null,a=r.kind===`workflow`?Ke(r.input):{},o=e.afterRun??{kind:`none`},s=e.reliability?.executionTimeoutSeconds??r.timeoutSeconds??e.reliability?.timeoutSeconds??(r.kind===`browser_recipe`?600:1800);return{...ze,...n,name:e.name,description:e.description??``,actionMode:r.kind,agentId:r.kind===`browser_recipe`?``:r.agentId??``,instruction:r.kind===`agent`?r.instruction:``,workflowId:r.kind===`workflow`?r.workflowId:``,workflowGoal:r.kind===`workflow`?r.goal??``:``,browserWorkflowId:r.kind===`browser_recipe`?r.recipeId:``,browserWorkflowInputs:r.kind===`browser_recipe`?r.args??{}:{},workflowInput:{goal:r.kind===`workflow`?r.goal??``:``,argValues:i?V(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(s),afterRunMode:o.kind,webhookUrl:o.kind===`webhook`?o.url:``,disableAfterFailures:String(e.reliability?.disableAfterConsecutiveFailures??3)}}function Ye(e,t,n){let r=Ve(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;return e.action.kind===`agent`&&r.action.kind===`agent`?a={...e.action,...r.action,agentId:r.action.agentId}: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_recipe`&&r.action.kind===`browser_recipe`&&(a={...e.action,...r.action}),{...r,description:t.description.trim(),trigger:i,action:a,reliability:{...e.reliability,...r.reliability}}}var Z=r();function Xe(e,t,n){return e?Me(e,n):t.never}function Ze(e,t){return e.kind===`workflow`?t.action.workflowWithId.replace(`{id}`,e.workflowId):e.kind===`browser_recipe`?`Browser automation: ${e.recipeId}`:e.agentId?t.action.agentWithId.replace(`{id}`,e.agentId):t.action.agent}function Qe(e){return e.safety?.mode??`auto_apply`}function $e(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 et(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 tt(e){return e.status===`running`||e.status===`queued`||e.status===`cancelling`}function nt(e){return e.status===`failed`||e.status===`timeout`||e.status===`cancelled`}function rt(e){return(e.description?.match(/\[managed-by=([^\]]+)\]/))?.[1]?.trim()||null}function it(e){return!!rt(e)}function at(e){return e.description?.replace(/\s*\[managed-by=[^\]]+\]\s*/g,` `).trim()??``}function ot(e){return tt(e)?0:nt(e)?1:e.status===`succeeded`?2:3}function st(e){return[...e].sort((e,t)=>{let n=ot(e)-ot(t);return n===0?t.createdAtMs-e.createdAtMs:n})}function ct(e){let t=(0,U.c)(5),n;t[0]===e?n=t[1]:(n=()=>typeof window>`u`?!1:window.matchMedia(e).matches,t[0]=e,t[1]=n);let[r,i]=(0,H.useState)(n),a,o;return t[2]===e?(a=t[3],o=t[4]):(a=()=>{if(typeof window>`u`)return;let t=window.matchMedia(e),n=()=>i(t.matches);return n(),t.addEventListener(`change`,n),()=>t.removeEventListener(`change`,n)},o=[e],t[2]=e,t[3]=a,t[4]=o),(0,H.useEffect)(a,o),r}function lt(){let e=(0,U.c)(5),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 space-y-2`,children:[(0,Z.jsx)(F,{className:`h-4 w-36`}),(0,Z.jsx)(F,{className:`h-3 w-56 max-w-full`})]}),(0,Z.jsx)(F,{className:`h-7 w-20 rounded-full`})]}),e[0]=t):t=e[0];let n;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(`section`,{className:`rounded-xl bg-surface-panel p-4 shadow-surface`,children:[t,(0,Z.jsx)(`div`,{className:`mt-4 grid gap-2`,children:Array.from({length:6}).map(ut)})]}),e[1]=n):n=e[1];let r,i;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(F,{className:`h-4 w-32`}),i=(0,Z.jsx)(F,{className:`mt-4 h-24 rounded-lg`}),e[2]=r,e[3]=i):(r=e[2],i=e[3]);let a;return e[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(`div`,{className:`grid gap-4`,"aria-hidden":`true`,children:(0,Z.jsxs)(`div`,{className:`grid gap-3 xl:grid-cols-[minmax(0,1fr)_26rem]`,children:[n,(0,Z.jsxs)(`section`,{className:`hidden rounded-xl bg-surface-panel p-4 shadow-surface xl:block`,children:[r,i,(0,Z.jsxs)(`div`,{className:`mt-4 grid gap-2`,children:[(0,Z.jsx)(F,{className:`h-12 rounded-lg`}),(0,Z.jsx)(F,{className:`h-12 rounded-lg`}),(0,Z.jsx)(F,{className:`h-12 rounded-lg`})]})]})]})}),e[4]=a):a=e[4],a}function ut(e,t){return(0,Z.jsx)(`div`,{className:`rounded-lg bg-surface-base p-3`,children:(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(F,{className:`size-4 rounded-full`}),(0,Z.jsx)(F,{className:`h-4 w-32`}),(0,Z.jsx)(F,{className:`h-5 w-20 rounded-full`})]}),(0,Z.jsx)(F,{className:`mt-3 h-4 w-full`}),(0,Z.jsx)(F,{className:`mt-2 h-4 w-3/5`})]}),(0,Z.jsx)(F,{className:`h-8 w-24 rounded-md`})]})},t)}function dt(){let e=c(e=>e.language),t=s(e),n=t.automations,r=t.cron,a=f(e=>e.setPageHeader),u=f(e=>e.clearPageHeader),[m,_]=i(),v=m.get(`run`)?.trim()??``,b=m.get(`automation`)?.trim()??``,x=m.get(`draft`)?.trim()??``,S=m.get(`action`)?.trim()??``,T=m.get(`projectId`)?.trim()??``,k=m.get(`autogenerate`)===`1`,ee=m.get(`insight`)?.trim()??``,M=(0,H.useRef)(``),P=ct(`(min-width: 1280px)`),[te,F]=(0,H.useState)(`activity`),[ne,re]=(0,H.useState)(!1),[ie,I]=(0,H.useState)(`blank`),[oe,se]=(0,H.useState)(null),[R,fe]=(0,H.useState)(!1),[z,pe]=(0,H.useState)(ze),[me,B]=(0,H.useState)(null),[V,ge]=(0,H.useState)(null),[_e,be]=(0,H.useState)(!1),[xe,U]=(0,H.useState)(null),[W,G]=(0,H.useState)(``),[K,q]=(0,H.useState)(null),[Se,Ce]=(0,H.useState)(!1),[we,J]=(0,H.useState)(!1),[Te,Y]=(0,H.useState)(null),[Ee,De]=(0,H.useState)(!1),[Oe,ke]=(0,H.useState)(!1),[Ae,je]=(0,H.useState)(!1),[X,Me]=(0,H.useState)(null),Ne=l([`automations`,T],()=>N.list(T?{projectId:T}:void 0),{refreshInterval:15e3}),Pe=l([`automation-runs`,T],()=>N.runs(50,void 0,T?{projectId:T}:void 0),{refreshInterval:1e4}),Fe=l(`automation-metrics`,()=>N.metrics(),{refreshInterval:15e3}),Ie=l(V?`automation-run-events:${V}`:null,()=>N.runEvents(V),{refreshInterval:5e3}),Le=l(`automation-workflow-definitions`,C),Re=l(`automation-browser-workflows`,()=>ve.list()),Be=l(`automation-chat-agents`,j),He=Ne.isLoading&&!Ne.data||Pe.isLoading&&!Pe.data||Fe.isLoading&&!Fe.data,Ue=Ne.data?.automations??[],We=(0,H.useMemo)(()=>st(Pe.data?.runs??[]),[Pe.data?.runs]),Ge=(0,H.useMemo)(()=>Ue.filter(e=>!it(e)),[Ue]),Ke=(0,H.useMemo)(()=>Ue.filter(it),[Ue]),Ze=(0,H.useMemo)(()=>new Set(Ke.map(e=>e.id)),[Ke]),Qe=(0,H.useMemo)(()=>We.filter(e=>!Ze.has(e.automationId)),[We,Ze]),$e=(0,H.useMemo)(()=>{let e;for(let t of Ge){let n=t.state.nextRunAtMs;n&&(e==null||n<e)&&(e=n)}return e},[Ge]),et=(0,H.useMemo)(()=>We.find(e=>e.id===V)??null,[We,V]),tt=(0,H.useMemo)(()=>Ue.find(e=>e.id===xe)??null,[Ue,xe]),rt=(0,H.useMemo)(()=>Ue.find(e=>e.id===oe)??null,[Ue,oe]),at=(0,H.useMemo)(()=>We.filter(e=>e.automationId===xe),[We,xe]),ot=Ie.data?.events??[],ut=(0,H.useMemo)(()=>Qe.filter(nt),[Qe]),dt=Qe[0]??null,mt=(0,H.useMemo)(()=>Le.data??[],[Le.data]),ht=(0,H.useMemo)(()=>(Re.data?.workflows??[]).filter(e=>e.enabled),[Re.data]),vt=Be.data?.items??[],yt=(0,H.useMemo)(()=>mt.find(e=>e.id===z.workflowId.trim())??null,[z.workflowId,mt]),bt=(0,H.useMemo)(()=>ht.find(e=>e.id===z.browserWorkflowId.trim())??null,[ht,z.browserWorkflowId]),Ct=z.actionMode===`workflow`&&(!z.workflowId.trim()||mt.length>0&&!mt.some(e=>e.id===z.workflowId)),wt=z.actionMode===`workflow`&&yt?!he(yt,z.workflowInput,z.workflowInputValid).valid:!1,Tt=!!z.name.trim()&&(z.triggerMode!==`once`||Number.isFinite(new Date(z.onceAt).getTime()))&&(z.triggerMode!==`event`||!!z.eventType.trim()&&qe(z.eventPayloadMatch))&&(z.actionMode===`workflow`?!Ct&&!wt:z.actionMode===`browser_recipe`?bt!==null&&ye(bt,z.browserWorkflowInputs):!!z.instruction.trim())&&(z.afterRunMode!==`webhook`||!!z.webhookUrl.trim()),Et=(0,H.useMemo)(()=>[{name:n.templates.dailyAgent.name,description:n.templates.dailyAgent.description,form:{...ze,name:n.templates.dailyAgent.name,instruction:n.templates.dailyAgent.instruction,triggerMode:`daily`}},{name:n.templates.morningWorkflow.name,description:n.templates.morningWorkflow.description,form:{...ze,name:n.templates.morningWorkflow.formName,actionMode:`workflow`,workflowId:mt[0]?.id??``}},{name:n.templates.webhookAgent.name,description:n.templates.webhookAgent.description,form:{...ze,name:n.templates.webhookAgent.formName,triggerMode:`webhook`}},{name:n.templates.blockedGoal.name,description:n.templates.blockedGoal.description,form:{...ze,name:n.templates.blockedGoal.formName,triggerMode:`goalBlocked`,instruction:n.templates.blockedGoal.instruction}},{name:n.templates.noteCreated.name,description:n.templates.noteCreated.description,form:{...ze,name:n.templates.noteCreated.formName,triggerMode:`noteCreated`,instruction:n.templates.noteCreated.instruction}}],[n,mt]);(0,H.useEffect)(()=>{te!==`activity`||Qe.length===0||V&&Qe.some(e=>e.id===V)||ge(Qe[0].id)},[V,Qe,te]);let Dt=(0,H.useCallback)(async()=>{await Promise.all([Ne.mutate(),Pe.mutate(),Fe.mutate(),Ie.mutate()])},[Ne.mutate,Fe.mutate,Ie.mutate,Pe.mutate]),Ot=(0,H.useCallback)(e=>{se(null),fe(!1),I(e),re(!0),e===`blank`&&pe(ze)},[]),kt=(0,H.useCallback)(e=>{pe(Je(e,mt)),se(e.id),fe(!1),U(null),I(`blank`),re(!0)},[mt]),At=(0,H.useCallback)(()=>{K&&(pe(Je(K.automation,mt)),se(null),fe(!0),I(`blank`))},[K,mt]),Mt=(0,H.useCallback)(async()=>{je(!0),B(null);try{await Dt()}catch(e){let t=e instanceof Error?e.message:String(e);B(t),A({type:`error`,title:n.feedback.actionFailed,message:t})}finally{je(!1)}},[n.feedback.actionFailed,Dt]);(0,H.useEffect)(()=>{v&&(F(`activity`),ge(v),P||be(!0))},[v,P]),(0,H.useEffect)(()=>{if(!b)return;let e=Ue.find(e=>e.id===b);e&&(F(it(e)?`system`:`automations`),U(e.id),_(e=>{let t=new URLSearchParams(e);return t.delete(`automation`),t},{replace:!0}))},[b,Ue,_]),(0,H.useEffect)(()=>{P&&be(!1)},[P]),(0,H.useEffect)(()=>{S===`create`&&(Ot(`blank`),_(e=>{let t=new URLSearchParams(e);return t.delete(`action`),t},{replace:!0}))},[S,Ot,_]),(0,H.useEffect)(()=>{if(!x)return;let t=`${e}:${k?`auto`:`seed`}:${x}`;M.current!==t&&(M.current=t,G(x),q(null),J(!1),I(`draft`),re(!0),_(e=>{let t=new URLSearchParams(e);return t.delete(`draft`),t.delete(`autogenerate`),t.delete(`insight`),t},{replace:!0}),k&&(B(null),Ce(!0),N.draft({prompt:x,language:e}).then(e=>{q(e.draft),J(!1),ee&&N.completeInsightDraft(ee)}).catch(e=>{B(e instanceof Error?e.message:String(e))}).finally(()=>{Ce(!1)})))},[k,x,ee,e,_]);let Nt=(0,H.useCallback)(e=>{ge(e),P||be(!0),_(t=>{let n=new URLSearchParams(t);return n.set(`run`,e),n},{replace:!0})},[_,P]);(0,H.useEffect)(()=>{Y(null),ke(!1)},[V]);async function Q(){if(B(null),Tt){if(R&&K){Me(`draft:edit`);try{let e=Ve(z,yt),{simulation:t}=await N.simulate(e);q({...K,automation:e,simulation:t}),J(!1),fe(!1),I(`draft`)}catch(e){let t=e instanceof Error?e.message:String(e);B(t),A({type:`error`,title:n.feedback.actionFailed,message:t})}finally{Me(null)}return}if(rt){let e=rt.id;await $(`automation:${e}:edit`,()=>N.update(e,Ye(rt,z,yt)))&&(re(!1),se(null),U(e));return}try{await N.create({...Ve(z,yt),...T?{projectId:T}:{}}),pe(ze),re(!1),await Dt()}catch(e){let t=e instanceof Error?e.message:String(e);B(t),A({type:`error`,title:n.feedback.actionFailed,message:t})}}}async function $(e,t){B(null),Me(e);try{return await t(),await Dt(),!0}catch(e){let t=e instanceof Error?e.message:String(e);return B(t),A({type:`error`,title:n.feedback.actionFailed,message:t}),!1}finally{Me(null)}}async function Pt(){let t=W.trim();if(t){B(null),Ce(!0);try{q((await N.draft({prompt:t,language:e})).draft),J(!1)}catch(e){B(e instanceof Error?e.message:String(e))}finally{Ce(!1)}}}async function Ft(){K&&await $(`draft:publish`,async()=>{await N.create({...K.automation,...T?{projectId:T}:{}}),q(null),G(``),J(!1),re(!1)})}async function It(t){B(null),De(!0),Y(null),ke(!1);try{Y((await N.repairDraft(t.id,{language:e})).repair)}catch(e){B(e instanceof Error?e.message:String(e))}finally{De(!1)}}async function Lt(e){Te&&await $(`run:${e.id}:repair`,async()=>{await N.update(e.automationId,Te.patch),Y(null),ke(!1)})}let Rt=(0,H.useMemo)(()=>(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(ce,{className:`size-9 shrink-0 p-0`,loading:Ae,label:n.refresh,onClick:Mt}),(0,Z.jsxs)(ue,{children:[(0,Z.jsx)(p,{asChild:!0,children:(0,Z.jsxs)(L,{variant:`primary`,children:[(0,Z.jsx)(ae,{className:`size-4`}),n.new]})}),(0,Z.jsx)(d,{children:(0,Z.jsxs)(de,{align:`end`,className:`z-70 min-w-52 rounded-lg border border-edge bg-surface-panel p-1 shadow-popover`,children:[(0,Z.jsx)(E,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover`,onSelect:()=>Ot(`draft`),children:n.createMenu.draft}),(0,Z.jsx)(E,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover`,onSelect:()=>Ot(`template`),children:n.createMenu.template}),(0,Z.jsx)(E,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover`,onSelect:()=>Ot(`blank`),children:n.createMenu.blank})]})})]})]}),[n.createMenu.blank,n.createMenu.draft,n.createMenu.template,n.new,n.refresh,Ot,Ae,Mt]);return(0,H.useLayoutEffect)(()=>(a({startExtra:null,main:(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n.title}),(0,Z.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:n.subtitle})]}),end:Rt}),()=>u()),[u,Rt,n.subtitle,n.title,a]),(0,Z.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:[(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-5 px-3 py-6 sm:px-5 xl:px-6`,children:[(0,Z.jsxs)(`section`,{className:`grid gap-3 sm:grid-cols-4`,children:[(0,Z.jsx)(ft,{label:n.dashboard.needsAttention,value:ut.length,tone:ut.length>0?`danger`:`neutral`}),(0,Z.jsx)(ft,{label:n.metrics.running,value:Qe.filter(e=>e.status===`running`).length}),(0,Z.jsx)(ft,{label:n.dashboard.latestResult,value:dt?n.status[dt.status]:n.none,tone:dt&&nt(dt)?`danger`:`neutral`}),(0,Z.jsx)(ft,{label:n.metrics.next,value:$e?Xe($e,n,e):n.none})]}),(0,Z.jsx)(`nav`,{className:`inline-flex w-fit rounded-lg border border-edge bg-surface-panel p-1`,children:[{id:`activity`,label:n.dashboard.activity,count:Qe.length},{id:`automations`,label:n.dashboard.manage,count:Ge.length},{id:`system`,label:n.system.title,count:Ke.length}].map(e=>(0,Z.jsxs)(`button`,{type:`button`,className:o(`inline-flex items-center gap-2 rounded-md px-3 py-1.5 text-sm font-medium text-fg-muted`,te===e.id&&`bg-surface-hover text-fg`),onClick:()=>{F(e.id),e.id!==`activity`&&be(!1)},children:[(0,Z.jsx)(`span`,{children:e.label}),(0,Z.jsx)(`span`,{className:`rounded-full border border-edge/70 px-1.5 py-0.5 text-[0.6875rem] leading-none text-fg-muted`,children:e.count})]},e.id))}),me?(0,Z.jsx)(`div`,{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:me}):null,He?(0,Z.jsx)(lt,{}):te===`activity`?(0,Z.jsxs)(`section`,{className:`grid items-start gap-4 xl:grid-cols-[minmax(18rem,22rem)_minmax(0,1fr)]`,children:[(0,Z.jsx)(`div`,{className:`min-w-0`,children:(0,Z.jsx)(_t,{runs:Qe.slice(0,12),labels:n,cronLabels:r,language:e,selectedRunId:V,busyAction:X,className:`h-auto`,onSelectRun:Nt,onAction:$})}),(0,Z.jsx)(xt,{className:`hidden xl:sticky xl:top-4 xl:block`,run:et,events:ot,labels:n,cronLabels:r,language:e,loading:Ie.isLoading,repairDraft:Te,repairLoading:Ee,repairApproved:Oe,busyAction:X,onRepairApprovedChange:ke,onSuggestRepair:It,onApplyRepair:Lt})]}):te===`automations`?(0,Z.jsx)(`section`,{children:(0,Z.jsx)(gt,{automations:Ge,runs:Qe,labels:n,cronLabels:r,language:e,busyAction:X,onOpenDetails:U,onAction:$})}):(0,Z.jsx)(`section`,{children:(0,Z.jsx)(gt,{automations:Ke,runs:We,labels:n,cronLabels:r,language:e,busyAction:X,readOnly:!0,onOpenDetails:U,onAction:$})})]}),(0,Z.jsx)(O,{open:ne,onOpenChange:e=>{re(e),e||(se(null),fe(!1))},children:(0,Z.jsxs)(y,{children:[(0,Z.jsx)(h,{className:`xopc-dialog-overlay fixed inset-0 z-65 bg-scrim backdrop-blur-[1px]`}),(0,Z.jsxs)(D,{className:`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-panel shadow-popover outline-none`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-5 py-4`,children:[(0,Z.jsx)(le,{className:`text-base font-semibold text-fg`,children:ie===`draft`?n.draft.title:ie===`template`?n.createMenu.templatesTitle:rt?n.editTitle:R?n.draft.editTitle:n.createTitle}),(0,Z.jsx)(g,{asChild:!0,children:(0,Z.jsx)(L,{variant:`ghost`,"aria-label":n.close,children:(0,Z.jsx)(w,{className:`size-4`})})})]}),ie===`draft`?(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:(0,Z.jsx)(pt,{labels:n,prompt:W,draft:K,loading:Se,approved:we,publishBusy:X===`draft:publish`,onPromptChange:G,onGenerate:Pt,onEdit:At,onPublish:Ft,onApprovedChange:J,onDiscard:()=>{q(null),J(!1)}})}):ie===`template`?(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:(0,Z.jsx)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:Et.map(e=>(0,Z.jsxs)(`button`,{type:`button`,className:`rounded-lg bg-surface-base p-4 text-left hover:bg-surface-hover`,onClick:()=>{pe(e.form),I(`blank`)},children:[(0,Z.jsx)(`div`,{className:`font-medium text-fg`,children:e.name}),(0,Z.jsx)(`div`,{className:`mt-2 text-sm text-fg-muted`,children:e.description})]},e.name))})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(jt,{form:z,labels:n,setForm:pe,workflowDefinitions:mt,selectedWorkflow:yt,workflowsLoading:Le.isLoading,browserWorkflows:ht,selectedBrowserWorkflow:bt,browserWorkflowsLoading:Re.isLoading,agentOptions:vt,agentsLoading:Be.isLoading,language:e}),(0,Z.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[R?(0,Z.jsx)(L,{variant:`ghost`,onClick:()=>{fe(!1),I(`draft`)},children:n.cancel}):(0,Z.jsx)(g,{asChild:!0,children:(0,Z.jsx)(L,{variant:`ghost`,children:n.cancel})}),(0,Z.jsx)(L,{variant:`primary`,onClick:Q,disabled:!Tt||X===`draft:edit`||!!(rt&&X),children:X===`draft:edit`||rt&&X===`automation:${rt.id}:edit`?n.feedback.working:rt||R?n.save:n.create})]})]})]})]})}),(0,Z.jsx)(St,{automation:tt,runs:at,labels:n,cronLabels:r,language:e,busyAction:X,onClose:()=>U(null),onSelectRun:e=>{Nt(e),U(null)},onEdit:kt,onAction:$}),(0,Z.jsx)(O,{open:!P&&_e&&!!et,onOpenChange:be,children:(0,Z.jsxs)(y,{children:[(0,Z.jsx)(h,{className:`xopc-dialog-overlay fixed inset-0 z-65 bg-scrim backdrop-blur-[1px]`}),(0,Z.jsxs)(D,{className:`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-panel shadow-popover outline-none`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,Z.jsx)(le,{className:`truncate text-base font-semibold text-fg`,children:et?.automationName??n.dashboard.result}),(0,Z.jsx)(g,{asChild:!0,children:(0,Z.jsx)(L,{variant:`ghost`,"aria-label":n.close,children:(0,Z.jsx)(w,{className:`size-4`})})})]}),(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:(0,Z.jsx)(xt,{className:`rounded-none border-0`,run:et,events:ot,labels:n,cronLabels:r,language:e,loading:Ie.isLoading,repairDraft:Te,repairLoading:Ee,repairApproved:Oe,busyAction:X,onRepairApprovedChange:ke,onSuggestRepair:It,onApplyRepair:Lt})})]})]})})]})}function ft(e){let t=(0,U.c)(13),{label:n,value:r,tone:i}=e,a=i===void 0?`neutral`:i,s=a===`danger`&&`bg-red-500/10`,c;t[0]===s?c=t[1]:(c=o(`rounded-lg border border-edge-subtle bg-surface-base px-4 py-3 shadow-surface`,s),t[0]=s,t[1]=c);let l;t[2]===n?l=t[3]:(l=(0,Z.jsx)(`div`,{className:`text-xs font-medium uppercase text-fg-muted`,children:n}),t[2]=n,t[3]=l);let u=a===`danger`?`text-red-700 dark:text-red-300`:`text-fg`,d;t[4]===u?d=t[5]:(d=o(`mt-1 truncate text-lg font-semibold`,u),t[4]=u,t[5]=d);let f;t[6]!==d||t[7]!==r?(f=(0,Z.jsx)(`div`,{className:d,children:r}),t[6]=d,t[7]=r,t[8]=f):f=t[8];let p;return t[9]!==c||t[10]!==l||t[11]!==f?(p=(0,Z.jsxs)(`div`,{className:c,children:[l,f]}),t[9]=c,t[10]=l,t[11]=f,t[12]=p):p=t[12],p}function pt(e){let t=(0,U.c)(49),{labels:n,prompt:r,draft:i,loading:a,approved:o,publishBusy:s,onPromptChange:c,onGenerate:l,onEdit:u,onPublish:d,onApprovedChange:f,onDiscard:p}=e,m=s===void 0?!1:s,h=!!(i&&i.simulation.requiredConfirmations.length>0),g;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(te,{className:`size-4 text-accent`}),t[0]=g):g=t[0];let _;t[1]===n.draft.title?_=t[2]:(_=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[g,n.draft.title]}),t[1]=n.draft.title,t[2]=_);let v;t[3]===n.draft.subtitle?v=t[4]:(v=(0,Z.jsx)(`div`,{className:`mt-1 text-sm text-fg-muted`,children:n.draft.subtitle}),t[3]=n.draft.subtitle,t[4]=v);let y;t[5]!==_||t[6]!==v?(y=(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[_,v]}),t[5]=_,t[6]=v,t[7]=y):y=t[7];let x;t[8]!==a||t[9]!==r?(x=a||!r.trim(),t[8]=a,t[9]=r,t[10]=x):x=t[10];let S;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(te,{className:`size-4`}),t[11]=S):S=t[11];let C=a?n.draft.generating:n.draft.generate,w;t[12]!==l||t[13]!==x||t[14]!==C?(w=(0,Z.jsxs)(L,{variant:`primary`,onClick:l,disabled:x,children:[S,C]}),t[12]=l,t[13]=x,t[14]=C,t[15]=w):w=t[15];let T;t[16]!==y||t[17]!==w?(T=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[y,w]}),t[16]=y,t[17]=w,t[18]=T):T=t[18];let E;t[19]===c?E=t[20]:(E=e=>c(e.target.value),t[19]=c,t[20]=E);let D;t[21]!==n.draft.placeholder||t[22]!==r||t[23]!==E?(D=(0,Z.jsx)(`textarea`,{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:E,placeholder:n.draft.placeholder}),t[21]=n.draft.placeholder,t[22]=r,t[23]=E,t[24]=D):D=t[24];let O;t[25]!==o||t[26]!==i||t[27]!==n.draft.approval||t[28]!==n.draft.assumptions||t[29]!==n.draft.discard||t[30]!==n.draft.edit||t[31]!==n.draft.publish||t[32]!==n.draft.review||t[33]!==n.draft.risks||t[34]!==n.draft.safety||t[35]!==n.feedback||t[36]!==n.info||t[37]!==n.none||t[38]!==f||t[39]!==p||t[40]!==u||t[41]!==d||t[42]!==m||t[43]!==h?(O=i?(0,Z.jsxs)(`div`,{className:`mt-4 grid gap-3 rounded-lg bg-surface-base p-4 lg:grid-cols-[1fr_1fr]`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:i.automation.name}),i.automation.description?(0,Z.jsx)(`div`,{className:`mt-1 text-sm text-fg-muted`,children:i.automation.description}):null,(0,Z.jsxs)(`div`,{className:`mt-3 grid gap-2 text-sm`,children:[(0,Z.jsx)(kt,{label:n.info.when,value:i.simulation.triggerSummary}),(0,Z.jsx)(kt,{label:n.info.run,value:i.simulation.actionSummary})]})]}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`div`,{className:`text-xs font-semibold uppercase text-fg-muted`,children:n.draft.review}),(0,Z.jsx)(mt,{title:n.draft.safety,items:[...i.simulation.safetyNotes,...i.simulation.requiredConfirmations],empty:n.none}),(0,Z.jsx)(mt,{title:n.draft.assumptions,items:i.assumptions,empty:n.none}),(0,Z.jsx)(mt,{title:n.draft.risks,items:i.risks,empty:n.none}),h?(0,Z.jsxs)(`label`,{className:`mt-4 flex items-start gap-2 text-sm text-fg`,children:[(0,Z.jsx)(`input`,{className:`mt-1`,type:`checkbox`,checked:o,onChange:e=>f(e.target.checked)}),(0,Z.jsx)(`span`,{children:n.draft.approval})]}):null,(0,Z.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,Z.jsx)(L,{variant:`ghost`,onClick:p,children:n.draft.discard}),(0,Z.jsxs)(L,{variant:`secondary`,onClick:u,children:[(0,Z.jsx)(b,{className:`size-4`}),n.draft.edit]}),(0,Z.jsx)(L,{variant:`primary`,onClick:d,disabled:m||h&&!o,children:m?n.feedback.working:n.draft.publish})]})]})]}):null,t[25]=o,t[26]=i,t[27]=n.draft.approval,t[28]=n.draft.assumptions,t[29]=n.draft.discard,t[30]=n.draft.edit,t[31]=n.draft.publish,t[32]=n.draft.review,t[33]=n.draft.risks,t[34]=n.draft.safety,t[35]=n.feedback,t[36]=n.info,t[37]=n.none,t[38]=f,t[39]=p,t[40]=u,t[41]=d,t[42]=m,t[43]=h,t[44]=O):O=t[44];let k;return t[45]!==T||t[46]!==D||t[47]!==O?(k=(0,Z.jsxs)(`section`,{className:`rounded-lg border border-edge-subtle bg-surface-base p-4 shadow-surface`,children:[T,D,O]}),t[45]=T,t[46]=D,t[47]=O,t[48]=k):k=t[48],k}function mt(e){let t=(0,U.c)(10),{title:n,items:r,empty:i}=e,a;t[0]===n?a=t[1]:(a=(0,Z.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(ht):(0,Z.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,Z.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,Z.jsxs)(`div`,{className:`mt-3`,children:[a,s]}),t[7]=a,t[8]=s,t[9]=c):c=t[9],c}function ht(e){return(0,Z.jsxs)(`li`,{children:[`- `,e]},e)}function gt(e){let t=(0,U.c)(24),{automations:n,runs:r,labels:i,cronLabels:a,language:s,busyAction:c,readOnly:l,onOpenDetails:u,onAction:d}=e,f=l===void 0?!1:l;if(n.length===0){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(S,{className:`size-5`}),t[0]=e):e=t[0];let n;return t[1]===i.empty.automations?n=t[2]:(n=(0,Z.jsx)(At,{icon:e,title:i.empty.automations}),t[1]=i.empty.automations,t[2]=n),n}let p;if(t[3]!==n||t[4]!==c||t[5]!==a||t[6]!==i||t[7]!==s||t[8]!==d||t[9]!==u||t[10]!==f||t[11]!==r){let e;t[13]!==c||t[14]!==a||t[15]!==i||t[16]!==s||t[17]!==d||t[18]!==u||t[19]!==f||t[20]!==r?(e=e=>{let t=at(e),n=r.filter(t=>t.automationId===e.id),l=n.find(tt),p=n[0],m=c===`automation:${e.id}:run`,h=c===`automation:${e.id}:toggle`,g=c===`automation:${e.id}:delete`;return(0,Z.jsxs)(`article`,{className:`flex min-h-44 cursor-pointer flex-col rounded-lg border border-edge-subtle bg-surface-base p-3.5 shadow-surface outline-none transition-colors hover:bg-surface-hover`,role:`button`,tabIndex:0,onClick:()=>u(e.id),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&u(e.id)},children:[(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`truncate font-medium text-fg`,children:e.name}),l?(0,Z.jsx)(`span`,{className:`size-2 shrink-0 rounded-full bg-blue-500`}):null]}),t?(0,Z.jsx)(`div`,{className:`mt-1 line-clamp-2 text-sm text-fg-muted`,children:t}):null]}),(0,Z.jsx)(`span`,{className:o(`shrink-0 rounded-full px-2 py-0.5 text-xs`,e.enabled?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-surface-hover text-fg-muted`),children:e.enabled?i.enabled:i.paused})]}),(0,Z.jsxs)(`div`,{className:`mt-3 space-y-2 text-sm`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-fg`,children:[(0,Z.jsx)(`span`,{className:`shrink-0 text-xs font-medium uppercase text-fg-muted`,children:i.info.when}),(0,Z.jsx)(`span`,{className:`truncate`,children:Ie(e.trigger,i,a,s)})]}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-fg-muted`,children:[(0,Z.jsx)(`span`,{className:`shrink-0 text-xs font-medium uppercase`,children:i.info.run}),(0,Z.jsx)(`span`,{className:`truncate`,children:Ze(e.action,i)})]})]}),(0,Z.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-fg-muted`,children:[(0,Z.jsxs)(`span`,{children:[i.last,`: `,Xe(e.state.lastRunAtMs,i,s)]}),(0,Z.jsxs)(`span`,{children:[i.next,`: `,Xe(e.state.nextRunAtMs,i,s)]}),(0,Z.jsx)(`span`,{className:o(`rounded-full px-2 py-0.5`,$e(e.state.lastRunStatus)),children:e.state.lastRunStatus?i.status[e.state.lastRunStatus]:i.status.notRun}),p?.error?(0,Z.jsx)(`p`,{className:`basis-full line-clamp-1 text-red-700 dark:text-red-300`,children:p.error}):null]}),f?null:(0,Z.jsx)(`div`,{className:`mt-auto flex justify-end pt-3`,children:(0,Z.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Z.jsx)(L,{variant:`ghost`,className:`size-8 rounded-md p-0`,"aria-label":i.dashboard.runNow,disabled:c!==null,onClick:t=>{t.stopPropagation(),d(`automation:${e.id}:run`,()=>N.runNow(e.id),i.feedback.rerunQueued)},children:(0,Z.jsx)(x,{className:o(`size-4`,m&&`animate-pulse`)})}),(0,Z.jsx)(L,{variant:`ghost`,className:`size-8 rounded-md p-0`,"aria-label":e.enabled?i.dashboard.pause:i.dashboard.resume,disabled:c!==null,onClick:t=>{t.stopPropagation(),d(`automation:${e.id}:toggle`,()=>e.enabled?N.pause(e.id):N.resume(e.id),e.enabled?i.feedback.paused:i.dashboard.resumed)},children:h?(0,Z.jsx)(R,{className:`size-4 animate-spin`}):e.enabled?(0,Z.jsx)(z,{className:`size-4`}):(0,Z.jsx)(x,{className:`size-4`})}),(0,Z.jsx)(L,{variant:`ghost`,className:`size-8 rounded-md p-0`,"aria-label":i.dashboard.delete,disabled:c!==null,onClick:t=>{t.stopPropagation(),d(`automation:${e.id}:delete`,()=>N.remove(e.id),i.dashboard.deleted)},children:g?(0,Z.jsx)(R,{className:`size-4 animate-spin`}):(0,Z.jsx)(v,{className:`size-4`})})]})})]},e.id)},t[13]=c,t[14]=a,t[15]=i,t[16]=s,t[17]=d,t[18]=u,t[19]=f,t[20]=r,t[21]=e):e=t[21],p=n.map(e),t[3]=n,t[4]=c,t[5]=a,t[6]=i,t[7]=s,t[8]=d,t[9]=u,t[10]=f,t[11]=r,t[12]=p}else p=t[12];let m;return t[22]===p?m=t[23]:(m=(0,Z.jsx)(`div`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-3`,children:p}),t[22]=p,t[23]=m),m}function _t(e){let t=(0,U.c)(25),{runs:n,labels:r,cronLabels:i,language:a,selectedRunId:s,busyAction:c,className:l,onSelectRun:u,onAction:d}=e;if(n.length===0){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(k,{className:`size-5`}),t[0]=e):e=t[0];let n;return t[1]===r.empty.runs?n=t[2]:(n=(0,Z.jsx)(At,{icon:e,title:r.empty.runs}),t[1]=r.empty.runs,t[2]=n),n}let f;t[3]===l?f=t[4]:(f=o(`overflow-hidden rounded-lg border border-edge-subtle bg-surface-base shadow-surface`,l),t[3]=l,t[4]=f);let p;if(t[5]!==c||t[6]!==i||t[7]!==r||t[8]!==a||t[9]!==d||t[10]!==u||t[11]!==n||t[12]!==s){let e;t[14]!==c||t[15]!==i||t[16]!==r||t[17]!==a||t[18]!==d||t[19]!==u||t[20]!==s?(e=e=>(0,Z.jsxs)(`div`,{className:o(`grid cursor-pointer gap-3 border-b border-edge p-4 outline-none last:border-b-0 hover:bg-surface-hover md:grid-cols-[1fr_auto]`,s===e.id&&`bg-surface-hover`),role:`button`,tabIndex:0,onClick:()=>u(e.id),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&u(e.id)},children:[(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`font-medium text-fg`,children:e.automationName}),(0,Z.jsx)(`span`,{className:o(`rounded-full px-2 py-0.5 text-xs`,$e(e.status)),children:r.status[e.status]}),e.workflowRunId?(0,Z.jsxs)(`span`,{className:`text-xs text-fg-muted`,children:[r.workflowPrefix,` `,e.workflowRunId.slice(0,8)]}):null]}),(0,Z.jsx)(`div`,{className:o(`mt-1 line-clamp-2 whitespace-pre-line text-sm text-fg-muted`,e.error&&`text-red-700 dark:text-red-300`),children:e.error||e.summary||(tt(e)?r.runDetail.resultPending:r.runDetail.noResult)}),(0,Z.jsxs)(`div`,{className:`mt-2 text-xs text-fg-muted`,children:[Xe(e.createdAtMs,r,a),` · `,e.manual?r.trigger.manual:Ie(e.triggerSnapshot,r,i,a)]})]}),e.status===`running`||e.status===`queued`||e.status===`cancelling`?(0,Z.jsx)(L,{variant:`ghost`,disabled:c!==null,onClick:t=>{t.stopPropagation(),d(`run:${e.id}:cancel`,()=>N.cancelRun(e.id),r.dashboard.cancelled)},children:c===`run:${e.id}:cancel`?r.feedback.working:r.cancel}):null]},e.id),t[14]=c,t[15]=i,t[16]=r,t[17]=a,t[18]=d,t[19]=u,t[20]=s,t[21]=e):e=t[21],p=n.map(e),t[5]=c,t[6]=i,t[7]=r,t[8]=a,t[9]=d,t[10]=u,t[11]=n,t[12]=s,t[13]=p}else p=t[13];let m;return t[22]!==f||t[23]!==p?(m=(0,Z.jsx)(`div`,{className:f,children:p}),t[22]=f,t[23]=p,t[24]=m):m=t[24],m}function vt(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`after_run.started`:return n.afterRunStarted;case`after_run.completed`:return n.afterRunCompleted;case`after_run.failed`:return n.afterRunFailed;case`run.completed`:return a?n.runCompleted.replace(`{status}`,a):n.runCompletedFallback;default:return e.message}}function yt(e){let t=(0,U.c)(17),{value:n,labels:r,title:i,defaultExpanded:a}=e,[s,c]=(0,H.useState)(a===void 0?!1:a),l;t[0]===n?l=t[1]:(l=JSON.stringify(n,null,2),t[0]=n,t[1]=l);let u=l,d;t[2]===u?d=t[3]:(d=u.split(`
2
+ `),t[2]=u,t[3]=d);let f=d.length,p=u.length>720||f>18,m;t[4]!==p||t[5]!==u?(m=p?`${u.split(`
3
+ `).slice(0,10).join(`
4
+ `).trimEnd()}...`:u,t[4]=p,t[5]=u,t[6]=m):m=t[6];let h=m,g;t[7]!==s||t[8]!==p||t[9]!==r||t[10]!==i?(g=p?(0,Z.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:()=>c(bt),"aria-expanded":s,children:[(0,Z.jsx)(`span`,{children:i}),(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-accent-fg`,children:[s?r.details.hideDetails:r.details.showDetails,(0,Z.jsx)(fe,{className:o(`size-3.5 transition-transform`,s&&`rotate-180`),"aria-hidden":!0})]})]}):(0,Z.jsx)(`div`,{className:`px-2.5 py-2 text-xs font-medium text-fg-muted`,children:i}),t[7]=s,t[8]=p,t[9]=r,t[10]=i,t[11]=g):g=t[11];let _=s||!p?u:h,v;t[12]===_?v=t[13]:(v=(0,Z.jsx)(`pre`,{className:`whitespace-pre-wrap break-all px-2.5 pb-2 text-xs leading-relaxed text-fg-muted`,children:_}),t[12]=_,t[13]=v);let y;return t[14]!==g||t[15]!==v?(y=(0,Z.jsxs)(`div`,{className:`mt-2 rounded-md border border-edge/70 bg-surface-muted/35`,children:[g,v]}),t[14]=g,t[15]=v,t[16]=y):y=t[16],y}function bt(e){return!e}function xt(e){let t=(0,U.c)(148),{className:n,run:r,events:i,labels:s,cronLabels:c,language:l,loading:d,repairDraft:f,repairLoading:p,repairApproved:m,busyAction:h,onRepairApprovedChange:g,onSuggestRepair:v,onApplyRepair:y}=e;if(!r){let e;t[0]===n?e=t[1]:(e=o(`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,Z.jsx)(k,{className:`mx-auto size-5`}),t[2]=r):r=t[2];let i;t[3]===s.selectRun?i=t[4]:(i=(0,Z.jsx)(`div`,{className:`mt-2`,children:s.selectRun}),t[3]=s.selectRun,t[4]=i);let a;return t[5]!==e||t[6]!==i?(a=(0,Z.jsxs)(`aside`,{className:e,children:[r,i]}),t[5]=e,t[6]=i,t[7]=a):a=t[7],a}let b=r.error||r.summary,x=r.sessionKey?`/chat/${encodeURIComponent(r.sessionKey)}`:r.workflowRunId?`/workflows?run=${encodeURIComponent(r.workflowRunId)}`:null,S=r.sessionKey?s.runDetail.openConversation:s.runDetail.openWorkflow,C=r.sessionKey?u:oe,w=tt(r)?k:nt(r)?re:se,T;t[8]===n?T=t[9]:(T=o(`rounded-lg border border-edge-subtle bg-surface-base shadow-surface`,n),t[8]=n,t[9]=T);let E;t[10]===r.automationName?E=t[11]:(E=(0,Z.jsx)(`div`,{className:`truncate text-sm font-semibold text-fg`,children:r.automationName}),t[10]=r.automationName,t[11]=E);let D;t[12]===r.id?D=t[13]:(D=r.id.slice(0,8),t[12]=r.id,t[13]=D);let O;t[14]===D?O=t[15]:(O=(0,Z.jsx)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:D}),t[14]=D,t[15]=O);let A;t[16]!==E||t[17]!==O?(A=(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[E,O]}),t[16]=E,t[17]=O,t[18]=A):A=t[18];let j;t[19]===r.status?j=t[20]:(j=o(`shrink-0 rounded-full px-2 py-0.5 text-xs`,$e(r.status)),t[19]=r.status,t[20]=j);let M=s.status[r.status],N;t[21]!==j||t[22]!==M?(N=(0,Z.jsx)(`span`,{className:j,children:M}),t[21]=j,t[22]=M,t[23]=N):N=t[23];let P;t[24]!==A||t[25]!==N?(P=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[A,N]}),t[24]=A,t[25]=N,t[26]=P):P=t[26];let ne;t[27]!==s||t[28]!==l||t[29]!==r.createdAtMs?(ne=Xe(r.createdAtMs,s,l),t[27]=s,t[28]=l,t[29]=r.createdAtMs,t[30]=ne):ne=t[30];let I;t[31]===ne?I=t[32]:(I=(0,Z.jsx)(`span`,{children:ne}),t[31]=ne,t[32]=I);let ae;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,Z.jsx)(`span`,{"aria-hidden":!0,children:`·`}),t[33]=ae):ae=t[33];let ce=s.details.duration,le;t[34]!==s||t[35]!==r.durationMs?(le=et(r.durationMs,s),t[34]=s,t[35]=r.durationMs,t[36]=le):le=t[36];let R;t[37]!==s.details.duration||t[38]!==le?(R=(0,Z.jsxs)(`span`,{children:[ce,` `,le]}),t[37]=s.details.duration,t[38]=le,t[39]=R):R=t[39];let ue;t[40]!==I||t[41]!==R?(ue=(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-fg-muted`,children:[I,ae,R]}),t[40]=I,t[41]=R,t[42]=ue):ue=t[42];let de;t[43]!==s.repair||t[44]!==v||t[45]!==p||t[46]!==r?(de=r.status===`failed`||r.status===`timeout`||r.status===`cancelled`?(0,Z.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,Z.jsxs)(L,{variant:`secondary`,onClick:()=>v(r),disabled:p,children:[(0,Z.jsx)(te,{className:`size-4`}),p?s.repair.generating:s.repair.suggest]})}):null,t[43]=s.repair,t[44]=v,t[45]=p,t[46]=r,t[47]=de):de=t[47];let z;t[48]!==ue||t[49]!==de||t[50]!==P?(z=(0,Z.jsxs)(`div`,{className:`border-b border-edge px-4 py-3`,children:[P,ue,de]}),t[48]=ue,t[49]=de,t[50]=P,t[51]=z):z=t[51];let pe;t[52]===r?pe=t[53]:(pe=tt(r)?`text-blue-500`:nt(r)?`text-red-500`:`text-emerald-500`,t[52]=r,t[53]=pe);let me;t[54]===pe?me=t[55]:(me=o(`size-4`,pe),t[54]=pe,t[55]=me);let B;t[56]!==w||t[57]!==me?(B=(0,Z.jsx)(w,{className:me}),t[56]=w,t[57]=me,t[58]=B):B=t[58];let he;t[59]!==s.runDetail.resultTitle||t[60]!==B?(he=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[B,s.runDetail.resultTitle]}),t[59]=s.runDetail.resultTitle,t[60]=B,t[61]=he):he=t[61];let V;t[62]!==C||t[63]!==S||t[64]!==x?(V=x?(0,Z.jsx)(L,{asChild:!0,variant:`secondary`,className:`h-8 rounded-md px-2.5 text-xs`,children:(0,Z.jsxs)(a,{to:x,children:[(0,Z.jsx)(C,{className:`size-3.5`}),S,(0,Z.jsx)(ee,{className:`size-3.5`})]})}):null,t[62]=C,t[63]=S,t[64]=x,t[65]=V):V=t[65];let ge;t[66]!==he||t[67]!==V?(ge=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[he,V]}),t[66]=he,t[67]=V,t[68]=ge):ge=t[68];let _e=r.error&&`border-red-500/25 bg-red-500/5`,ve;t[69]===_e?ve=t[70]:(ve=o(`mt-3 max-h-80 overflow-y-auto rounded-lg border border-edge/70 bg-surface-muted/25 p-3`,_e),t[69]=_e,t[70]=ve);let ye;t[71]!==s.runDetail.noResult||t[72]!==s.runDetail.resultPending||t[73]!==b||t[74]!==r?(ye=b?r.error?(0,Z.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-sm leading-relaxed text-red-700 dark:text-red-300`,children:b}):(0,Z.jsx)(_,{content:b,compact:!0,className:`text-sm`,openHttpLinksInNewTab:!0}):(0,Z.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:tt(r)?s.runDetail.resultPending:s.runDetail.noResult}),t[71]=s.runDetail.noResult,t[72]=s.runDetail.resultPending,t[73]=b,t[74]=r,t[75]=ye):ye=t[75];let be;t[76]!==ve||t[77]!==ye?(be=(0,Z.jsx)(`div`,{className:ve,children:ye}),t[76]=ve,t[77]=ye,t[78]=be):be=t[78];let xe;t[79]!==ge||t[80]!==be?(xe=(0,Z.jsxs)(`section`,{className:`border-b border-edge p-4`,children:[ge,be]}),t[79]=ge,t[80]=be,t[81]=xe):xe=t[81];let H;t[82]===s.runDetail.runInfo?H=t[83]:(H=(0,Z.jsx)(`div`,{className:`text-xs font-semibold uppercase text-fg-muted`,children:s.runDetail.runInfo}),t[82]=s.runDetail.runInfo,t[83]=H);let W;t[84]!==c||t[85]!==s||t[86]!==l||t[87]!==r.manual||t[88]!==r.triggerSnapshot?(W=r.manual?s.trigger.manual:Ie(r.triggerSnapshot,s,c,l),t[84]=c,t[85]=s,t[86]=l,t[87]=r.manual,t[88]=r.triggerSnapshot,t[89]=W):W=t[89];let G;t[90]!==s.explain.whyRan||t[91]!==W?(G=(0,Z.jsx)(Dt,{label:s.explain.whyRan,value:W}),t[90]=s.explain.whyRan,t[91]=W,t[92]=G):G=t[92];let K=s.details.started,q;t[93]!==s||t[94]!==l||t[95]!==r.startedAtMs?(q=Xe(r.startedAtMs,s,l),t[93]=s,t[94]=l,t[95]=r.startedAtMs,t[96]=q):q=t[96];let Se;t[97]!==s.details.started||t[98]!==q?(Se=(0,Z.jsx)(Dt,{label:K,value:q}),t[97]=s.details.started,t[98]=q,t[99]=Se):Se=t[99];let Ce;t[100]!==s.details.model||t[101]!==r.model?(Ce=r.model?(0,Z.jsx)(Dt,{label:s.details.model,value:r.model}):null,t[100]=s.details.model,t[101]=r.model,t[102]=Ce):Ce=t[102];let we;t[103]!==G||t[104]!==Se||t[105]!==Ce?(we=(0,Z.jsxs)(`div`,{className:`mt-3 grid gap-2 text-xs text-fg-muted`,children:[G,Se,Ce]}),t[103]=G,t[104]=Se,t[105]=Ce,t[106]=we):we=t[106];let J;t[107]!==H||t[108]!==we?(J=(0,Z.jsxs)(`section`,{className:`border-b border-edge p-4`,children:[H,we]}),t[107]=H,t[108]=we,t[109]=J):J=t[109];let Te;t[110]!==h||t[111]!==s||t[112]!==y||t[113]!==g||t[114]!==m||t[115]!==f||t[116]!==r?(Te=f?(0,Z.jsxs)(`div`,{className:`border-b border-edge px-4 py-3`,children:[(0,Z.jsx)(`div`,{className:`text-xs font-semibold uppercase text-fg-muted`,children:s.repair.title}),(0,Z.jsx)(`div`,{className:`mt-2 text-sm text-fg`,children:f.explanation}),f.expectedEffect?(0,Z.jsx)(`div`,{className:`mt-2 text-sm text-fg-muted`,children:f.expectedEffect}):null,(0,Z.jsx)(mt,{title:s.repair.risks,items:f.risks,empty:s.none}),(0,Z.jsx)(yt,{value:f.patch,labels:s,title:s.details.repairPatch}),f.requiresApproval?(0,Z.jsxs)(`label`,{className:`mt-3 flex items-start gap-2 text-sm text-fg`,children:[(0,Z.jsx)(`input`,{className:`mt-1`,type:`checkbox`,checked:m,onChange:e=>g(e.target.checked)}),(0,Z.jsx)(`span`,{children:s.repair.approval})]}):null,(0,Z.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,Z.jsx)(L,{variant:`primary`,onClick:()=>y(r),disabled:h===`run:${r.id}:repair`||f.requiresApproval&&!m,children:h===`run:${r.id}:repair`?s.feedback.working:s.repair.apply})})]}):null,t[110]=h,t[111]=s,t[112]=y,t[113]=g,t[114]=m,t[115]=f,t[116]=r,t[117]=Te):Te=t[117];let Y;t[118]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,Z.jsx)(ie,{className:`size-4 shrink-0`}),t[118]=Y):Y=t[118];let Ee;t[119]===s.runDetail.technicalEvents?Ee=t[120]:(Ee=(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2 text-sm font-medium text-fg-muted`,children:[Y,s.runDetail.technicalEvents]}),t[119]=s.runDetail.technicalEvents,t[120]=Ee);let De;t[121]!==i.length||t[122]!==s.runDetail.eventCount?(De=s.runDetail.eventCount.replace(`{count}`,String(i.length)),t[121]=i.length,t[122]=s.runDetail.eventCount,t[123]=De):De=t[123];let Oe;t[124]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=(0,Z.jsx)(fe,{className:`size-4 transition-transform group-open:rotate-180`}),t[124]=Oe):Oe=t[124];let ke;t[125]===De?ke=t[126]:(ke=(0,Z.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1 text-xs text-fg-muted`,children:[De,Oe]}),t[125]=De,t[126]=ke);let Ae;t[127]!==Ee||t[128]!==ke?(Ae=(0,Z.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:[Ee,ke]}),t[127]=Ee,t[128]=ke,t[129]=Ae):Ae=t[129];let je;t[130]===s.runDetail.technicalEventsDescription?je=t[131]:(je=(0,Z.jsx)(`p`,{className:`mt-2 text-xs leading-relaxed text-fg-muted`,children:s.runDetail.technicalEventsDescription}),t[130]=s.runDetail.technicalEventsDescription,t[131]=je);let X;t[132]!==i||t[133]!==s||t[134]!==l||t[135]!==d?(X=(0,Z.jsx)(`div`,{className:`mt-4`,children:d?(0,Z.jsxs)(`div`,{className:`space-y-3`,"aria-label":s.loading,children:[(0,Z.jsx)(F,{className:`h-10 w-full`}),(0,Z.jsx)(F,{className:`h-10 w-4/5`}),(0,Z.jsx)(F,{className:`h-10 w-11/12`})]}):i.length===0?(0,Z.jsx)(`div`,{className:`text-sm text-fg-muted`,children:s.empty.events}):(0,Z.jsx)(`ol`,{className:`space-y-3`,children:i.map(e=>(0,Z.jsxs)(`li`,{className:`grid grid-cols-[0.75rem_1fr] gap-3`,children:[(0,Z.jsx)(`span`,{className:o(`mt-1 size-2 rounded-full`,Ot(e.type))}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`div`,{className:`text-sm text-fg`,children:vt(e,s)}),(0,Z.jsxs)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:[Xe(e.createdAtMs,s,l),` · `,e.type]}),e.data&&typeof e.data==`object`?(0,Z.jsxs)(`details`,{className:`group/event mt-2 rounded-md border border-edge/70 bg-surface-muted/35`,children:[(0,Z.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:[s.details.eventData,(0,Z.jsx)(fe,{className:`size-3.5 transition-transform group-open/event:rotate-180`})]}),(0,Z.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]=s,t[134]=l,t[135]=d,t[136]=X):X=t[136];let Me;t[137]!==Ae||t[138]!==je||t[139]!==X?(Me=(0,Z.jsxs)(`details`,{className:`group px-4 py-3`,children:[Ae,je,X]}),t[137]=Ae,t[138]=je,t[139]=X,t[140]=Me):Me=t[140];let Ne;return t[141]!==T||t[142]!==z||t[143]!==xe||t[144]!==J||t[145]!==Te||t[146]!==Me?(Ne=(0,Z.jsxs)(`aside`,{className:T,children:[z,xe,J,Te,Me]}),t[141]=T,t[142]=z,t[143]=xe,t[144]=J,t[145]=Te,t[146]=Me,t[147]=Ne):Ne=t[147],Ne}function St(e){let t=(0,U.c)(23),{automation:n,runs:r,labels:i,cronLabels:s,language:c,busyAction:l,onClose:u,onEdit:d,onSelectRun:f,onAction:p}=e,_=n?l===`automation:${n.id}:run`:!1,S=n?l===`automation:${n.id}:toggle`:!1,C=n?l===`automation:${n.id}:delete`:!1,T=!!n,E;t[0]===u?E=t[1]:(E=e=>!e&&u(),t[0]=u,t[1]=E);let A;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(h,{className:`xopc-dialog-overlay fixed inset-0 z-65 bg-scrim backdrop-blur-[1px]`}),t[2]=A):A=t[2];let j;t[3]!==n||t[4]!==l||t[5]!==s||t[6]!==C||t[7]!==i||t[8]!==c||t[9]!==p||t[10]!==u||t[11]!==d||t[12]!==f||t[13]!==_||t[14]!==r||t[15]!==S?(j=n?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-3 border-b border-edge px-5 py-4`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(le,{className:`truncate text-base font-semibold text-fg`,children:n.name}),n.description?(0,Z.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm text-fg-muted`,children:n.description}):null]}),(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:o(`rounded-full px-2 py-0.5 text-xs`,n.enabled?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-surface-hover text-fg-muted`),children:n.enabled?i.enabled:i.paused}),(0,Z.jsx)(g,{asChild:!0,children:(0,Z.jsx)(L,{variant:`ghost`,"aria-label":i.close,children:(0,Z.jsx)(w,{className:`size-4`})})})]})]}),(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-4`,children:(0,Z.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-[20rem_1fr]`,children:[(0,Z.jsx)(wt,{automation:n,labels:i,cronLabels:s,language:c}),(0,Z.jsxs)(`section`,{className:`min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:i.dashboard.runHistory}),(0,Z.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:i.dashboard.runHistoryDescription})]}),(0,Z.jsx)(`span`,{className:`rounded-full bg-surface-base px-2.5 py-1 text-xs text-fg-muted`,children:r.length})]}),r.length===0?(0,Z.jsx)(At,{icon:(0,Z.jsx)(k,{className:`size-5`}),title:i.empty.runs}):(0,Z.jsx)(`div`,{className:`grid gap-2`,children:r.map(e=>(0,Z.jsx)(`div`,{className:`rounded-lg bg-surface-base p-3`,children:(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[(0,Z.jsxs)(`button`,{type:`button`,className:`min-w-0 text-left outline-none`,onClick:()=>f(e.id),children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[e.status===`succeeded`?(0,Z.jsx)(se,{className:`size-4 shrink-0 text-emerald-600 dark:text-emerald-300`}):(0,Z.jsx)(k,{className:`size-4 shrink-0 text-fg-muted`}),(0,Z.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:Xe(e.createdAtMs,i,c)}),(0,Z.jsx)(`span`,{className:o(`rounded-full px-2 py-0.5 text-xs`,$e(e.status)),children:i.status[e.status]})]}),(0,Z.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm text-fg-muted`,children:e.error||e.summary||Ze(e.actionSnapshot,i)})]}),(0,Z.jsxs)(`div`,{className:`flex shrink-0 flex-wrap justify-end gap-1`,children:[e.sessionKey?(0,Z.jsx)(L,{asChild:!0,variant:`ghost`,className:`h-8 rounded-md px-2 text-xs`,children:(0,Z.jsxs)(a,{to:`/chat/${encodeURIComponent(e.sessionKey)}`,children:[(0,Z.jsx)(m,{className:`size-3.5`}),i.dashboard.openSession]})}):null,e.workflowRunId?(0,Z.jsx)(L,{asChild:!0,variant:`ghost`,className:`h-8 rounded-md px-2 text-xs`,children:(0,Z.jsxs)(a,{to:`/workflows?run=${encodeURIComponent(e.workflowRunId)}`,children:[(0,Z.jsx)(oe,{className:`size-3.5`}),i.feedback.workflow]})}):null]})]})},e.id))})]})]})}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap justify-between gap-2 border-t border-edge px-5 py-4`,children:[(0,Z.jsxs)(L,{variant:`ghost`,disabled:l!==null,onClick:()=>void p(`automation:${n.id}:delete`,()=>N.remove(n.id),i.dashboard.deleted).then(e=>{e&&u()}),children:[C?(0,Z.jsx)(R,{className:`size-4 animate-spin`}):(0,Z.jsx)(v,{className:`size-4`}),i.dashboard.delete]}),(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[it(n)?null:(0,Z.jsxs)(L,{variant:`secondary`,disabled:l!==null,onClick:()=>d(n),children:[(0,Z.jsx)(b,{className:`size-4`}),i.edit]}),(0,Z.jsxs)(L,{variant:`secondary`,disabled:l!==null,onClick:()=>void p(`automation:${n.id}:toggle`,()=>n.enabled?N.pause(n.id):N.resume(n.id),n.enabled?i.feedback.paused:i.dashboard.resumed),children:[S?(0,Z.jsx)(R,{className:`size-4 animate-spin`}):n.enabled?(0,Z.jsx)(z,{className:`size-4`}):(0,Z.jsx)(x,{className:`size-4`}),n.enabled?i.dashboard.pause:i.dashboard.resume]}),(0,Z.jsxs)(L,{variant:`primary`,disabled:l!==null,onClick:()=>void p(`automation:${n.id}:run`,()=>N.runNow(n.id),i.feedback.rerunQueued),children:[_?(0,Z.jsx)(R,{className:`size-4 animate-spin`}):(0,Z.jsx)(x,{className:`size-4`}),i.dashboard.runNow]})]})]})]}):null,t[3]=n,t[4]=l,t[5]=s,t[6]=C,t[7]=i,t[8]=c,t[9]=p,t[10]=u,t[11]=d,t[12]=f,t[13]=_,t[14]=r,t[15]=S,t[16]=j):j=t[16];let ee;t[17]===j?ee=t[18]:(ee=(0,Z.jsxs)(y,{children:[A,(0,Z.jsx)(D,{className:`fixed left-1/2 top-1/2 z-66 flex h-[min(760px,calc(100vh-2rem))] w-[min(100%-2rem,56rem)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`,children:j})]}),t[17]=j,t[18]=ee);let M;return t[19]!==T||t[20]!==E||t[21]!==ee?(M=(0,Z.jsx)(O,{open:T,onOpenChange:E,children:ee}),t[19]=T,t[20]=E,t[21]=ee,t[22]=M):M=t[22],M}function Ct(e,t){return e===`suggest_only`?t.safety.suggestOnlyDescription:e===`ask_before_apply`?t.safety.askBeforeApplyDescription:t.safety.autoApplyDescription}function wt(e){let t=(0,U.c)(127),{automation:n,labels:r,cronLabels:i,language:a}=e,o,s,c,l,u,d,f,p,m,h,g;if(t[0]!==n||t[1]!==i||t[2]!==r||t[3]!==a){let e=Qe(n),_;t[15]!==n||t[16]!==r||t[17]!==a?(_=Le(n,r,a),t[15]=n,t[16]=r,t[17]=a,t[18]=_):_=t[18];let v=_,y;t[19]!==n.state.nextRunAtMs||t[20]!==a?(y=n.state.nextRunAtMs?Me(n.state.nextRunAtMs,a):void 0,t[19]=n.state.nextRunAtMs,t[20]=a,t[21]=y):y=t[21];let b=y;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(g=[],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],g.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],g.push(i),e.anchorMs){let n=r.info.anchor,i;t[46]!==a||t[47]!==e.anchorMs?(i=Me(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],g.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],g.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],g.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],g.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],g.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],g.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],g.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]=g}else g=t[39];m=`h-fit overflow-hidden rounded-xl border border-edge-subtle bg-surface-base shadow-surface`,t[70]===r.info.overview?h=t[71]:(h=(0,Z.jsx)(`div`,{className:`border-b border-edge-subtle px-4 py-3`,children:(0,Z.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:r.info.overview})}),t[70]=r.info.overview,t[71]=h),d=`grid gap-4 p-4`;let x;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(P,{className:`size-4`,"aria-hidden":!0}),t[72]=x):x=t[72];let C=r.info.schedule,w;t[73]!==n.trigger||t[74]!==i||t[75]!==r||t[76]!==a?(w=Ie(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}:${v}`:v;t[78]!==r.info.schedule||t[79]!==b||t[80]!==w||t[81]!==T?(f=(0,Z.jsx)(Et,{icon:x,label:C,value:w,description:T,descriptionTitle:b}),t[78]=r.info.schedule,t[79]=b,t[80]=w,t[81]=T,t[82]=f):f=t[82];let E;t[83]===n.action.kind?E=t[84]:(E=n.action.kind===`workflow`?(0,Z.jsx)(oe,{className:`size-4`,"aria-hidden":!0}):n.action.kind===`browser_recipe`?(0,Z.jsx)(ie,{className:`size-4`,"aria-hidden":!0}):(0,Z.jsx)(S,{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=Ze(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?(p=(0,Z.jsx)(Et,{icon:E,label:D,value:O}),t[88]=r.info.action,t[89]=E,t[90]=O,t[91]=p):p=t[91],o=Et,t[92]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(ne,{className:`size-4`,"aria-hidden":!0}),t[92]=s):s=t[92],c=r.info.permission,l=r.safety[e],u=Ct(e,r),t[0]=n,t[1]=i,t[2]=r,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=d,t[10]=f,t[11]=p,t[12]=m,t[13]=h,t[14]=g}else o=t[4],s=t[5],c=t[6],l=t[7],u=t[8],d=t[9],f=t[10],p=t[11],m=t[12],h=t[13],g=t[14];let _;t[93]!==o||t[94]!==s||t[95]!==c||t[96]!==l||t[97]!==u?(_=(0,Z.jsx)(o,{icon:s,label:c,value:l,description:u}),t[93]=o,t[94]=s,t[95]=c,t[96]=l,t[97]=u,t[98]=_):_=t[98];let v;t[99]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(k,{className:`size-4`,"aria-hidden":!0}),t[99]=v):v=t[99];let y=r.info.lastRun,b;t[100]!==n||t[101]!==r||t[102]!==a?(b=Re(n,r,a),t[100]=n,t[101]=r,t[102]=a,t[103]=b):b=t[103];let x=n.state.lastRunStatus===`failed`||n.state.lastRunStatus===`timeout`?`danger`:`default`,C;t[104]!==r.info.lastRun||t[105]!==b||t[106]!==x?(C=(0,Z.jsx)(Et,{icon:v,label:y,value:b,valueTone:x}),t[104]=r.info.lastRun,t[105]=b,t[106]=x,t[107]=C):C=t[107];let w;t[108]!==n.state.consecutiveFailures||t[109]!==n.state.lastError||t[110]!==r.dashboard?(w=n.state.consecutiveFailures?(0,Z.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,Z.jsx)(`p`,{className:`mt-1 break-words text-xs`,children:n.state.lastError}):null]}):n.state.lastError?(0,Z.jsx)(`p`,{className:`break-words text-sm text-red-700 dark:text-red-300`,children:n.state.lastError}):null,t[108]=n.state.consecutiveFailures,t[109]=n.state.lastError,t[110]=r.dashboard,t[111]=w):w=t[111];let T;t[112]!==r.info.technicalDetails||t[113]!==g?(T=g.length>0?(0,Z.jsxs)(`details`,{className:`group border-t border-edge-subtle pt-3`,children:[(0,Z.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,Z.jsx)(`span`,{children:r.info.technicalDetails}),(0,Z.jsx)(fe,{className:`size-4 transition-transform group-open:rotate-180`,"aria-hidden":!0})]}),(0,Z.jsx)(`div`,{className:`mt-3 grid gap-2`,children:g.map(Tt)})]}):null,t[112]=r.info.technicalDetails,t[113]=g,t[114]=T):T=t[114];let E;t[115]!==_||t[116]!==C||t[117]!==w||t[118]!==T||t[119]!==d||t[120]!==f||t[121]!==p?(E=(0,Z.jsxs)(`div`,{className:d,children:[f,p,_,C,w,T]}),t[115]=_,t[116]=C,t[117]=w,t[118]=T,t[119]=d,t[120]=f,t[121]=p,t[122]=E):E=t[122];let D;return t[123]!==E||t[124]!==m||t[125]!==h?(D=(0,Z.jsxs)(`aside`,{className:m,children:[h,E]}),t[123]=E,t[124]=m,t[125]=h,t[126]=D):D=t[126],D}function Tt(e){return(0,Z.jsxs)(`div`,{className:`grid gap-0.5`,children:[(0,Z.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:e.label}),(0,Z.jsx)(`span`,{className:`break-all font-mono text-xs text-fg-muted`,children:e.value})]},`${e.label}:${e.value}`)}function Et(e){let t=(0,U.c)(19),{icon:n,label:r,value:i,description:a,descriptionTitle:s,valueTone:c}=e,l=c===void 0?`default`:c,u;t[0]===n?u=t[1]:(u=(0,Z.jsx)(`span`,{className:`mt-0.5 text-fg-subtle`,children:n}),t[0]=n,t[1]=u);let d;t[2]===r?d=t[3]:(d=(0,Z.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:r}),t[2]=r,t[3]=d);let f=l===`danger`?`text-red-700 dark:text-red-300`:`text-fg`,p;t[4]===f?p=t[5]:(p=o(`mt-1 text-sm font-medium leading-5`,f),t[4]=f,t[5]=p);let m;t[6]!==p||t[7]!==i?(m=(0,Z.jsx)(`div`,{className:p,children:i}),t[6]=p,t[7]=i,t[8]=m):m=t[8];let h;t[9]!==a||t[10]!==s?(h=a?(0,Z.jsx)(`div`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,title:s,children:a}):null,t[9]=a,t[10]=s,t[11]=h):h=t[11];let g;t[12]!==d||t[13]!==m||t[14]!==h?(g=(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[d,m,h]}),t[12]=d,t[13]=m,t[14]=h,t[15]=g):g=t[15];let _;return t[16]!==u||t[17]!==g?(_=(0,Z.jsxs)(`div`,{className:`grid grid-cols-[1.25rem_1fr] gap-2.5`,children:[u,g]}),t[16]=u,t[17]=g,t[18]=_):_=t[18],_}function Dt(e){let t=(0,U.c)(7),{label:n,value:r}=e,i;t[0]===n?i=t[1]:(i=(0,Z.jsx)(`span`,{children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=(0,Z.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,Z.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 Ot(e){return e.endsWith(`.failed`)?`bg-red-500`:e.endsWith(`.completed`)?`bg-emerald-500`:e.endsWith(`.started`)?`bg-blue-500`:`bg-fg-muted`}function kt(e){let t=(0,U.c)(7),{label:n,value:r}=e,i;t[0]===n?i=t[1]:(i=(0,Z.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,Z.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,Z.jsxs)(`div`,{className:`min-w-0`,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function At(e){let t=(0,U.c)(5),{icon:n,title:r}=e,i;t[0]===r?i=t[1]:(i=(0,Z.jsx)(`div`,{className:`mt-2 text-sm`,children:r}),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,Z.jsxs)(`div`,{className:`flex min-h-48 flex-col items-center justify-center rounded-lg border border-edge-subtle bg-surface-base text-fg-muted shadow-surface`,children:[n,i]}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function jt(e){let t=(0,U.c)(237),{form:n,labels:r,setForm:i,workflowDefinitions:a,selectedWorkflow:c,workflowsLoading:l,browserWorkflows:u,selectedBrowserWorkflow:d,browserWorkflowsLoading:f,agentOptions:p,agentsLoading:m,language:h}=e,g=s(h).agentsSettings,_;t[0]===i?_=t[1]:(_=e=>i(t=>({...t,...e})),t[0]=i,t[1]=_);let v=_,y=ke(n.intervalValue,n.intervalUnit),b=Date.now(),x;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(x=[1,2,3],t[2]=x):x=t[2];let S;t[3]!==y||t[4]!==b||t[5]!==h?(S=x.map(e=>Pe(b+y*e,h,b)),t[3]=y,t[4]=b,t[5]=h,t[6]=S):S=t[6];let C=S,w,E;t[7]!==n.actionMode||t[8]!==n.workflowId||t[9]!==i||t[10]!==a?(w=()=>{if(n.actionMode!==`workflow`||n.workflowId.trim())return;let e=a[0]?.id;e&&i(t=>({...t,workflowId:e,workflowGoal:``,workflowInput:{goal:``,argValues:{},schemaInput:{},concurrency:``,maxSubagents:``},workflowInputValid:!0}))},E=[n.actionMode,n.workflowId,i,a],t[7]=n.actionMode,t[8]=n.workflowId,t[9]=i,t[10]=a,t[11]=w,t[12]=E):(w=t[11],E=t[12]),(0,H.useEffect)(w,E);let D,O;t[13]!==u||t[14]!==n.actionMode||t[15]!==n.browserWorkflowId||t[16]!==i?(D=()=>{if(n.actionMode!==`browser_recipe`||n.browserWorkflowId.trim())return;let e=u[0];e&&i(t=>({...t,browserWorkflowId:e.id,browserWorkflowInputs:be(e)}))},O=[u,n.actionMode,n.browserWorkflowId,i],t[13]=u,t[14]=n.actionMode,t[15]=n.browserWorkflowId,t[16]=i,t[17]=D,t[18]=O):(D=t[17],O=t[18]),(0,H.useEffect)(D,O);let k;t[19]===v?k=t[20]:(k=e=>v({name:e.target.value}),t[19]=v,t[20]=k);let A;t[21]!==n.name||t[22]!==k?(A=(0,Z.jsx)(`input`,{className:Q,value:n.name,onChange:k}),t[21]=n.name,t[22]=k,t[23]=A):A=t[23];let j;t[24]!==r.form.name||t[25]!==A?(j=(0,Z.jsx)($,{label:r.form.name,children:A}),t[24]=r.form.name,t[25]=A,t[26]=j):j=t[26];let ee;t[27]===v?ee=t[28]:(ee=e=>v({description:e.target.value}),t[27]=v,t[28]=ee);let N;t[29]!==n.description||t[30]!==ee?(N=(0,Z.jsx)(`input`,{className:Q,value:n.description,onChange:ee}),t[29]=n.description,t[30]=ee,t[31]=N):N=t[31];let P;t[32]!==r.form.description||t[33]!==N?(P=(0,Z.jsx)($,{label:r.form.description,children:N}),t[32]=r.form.description,t[33]=N,t[34]=P):P=t[34];let te;t[35]===r.form.trigger?te=t[36]:(te=(0,Z.jsx)(Pt,{title:r.form.trigger}),t[35]=r.form.trigger,t[36]=te);let F;t[37]===v?F=t[38]:(F=e=>v({triggerMode:e.target.value}),t[37]=v,t[38]=F);let ne;t[39]===r.trigger.manual?ne=t[40]:(ne=(0,Z.jsx)(M,{value:`manual`,children:r.trigger.manual}),t[39]=r.trigger.manual,t[40]=ne);let re;t[41]===r.trigger.once?re=t[42]:(re=(0,Z.jsx)(M,{value:`once`,children:r.trigger.once}),t[41]=r.trigger.once,t[42]=re);let ie;t[43]===r.trigger.daily?ie=t[44]:(ie=(0,Z.jsx)(M,{value:`daily`,children:r.trigger.daily}),t[43]=r.trigger.daily,t[44]=ie);let ae;t[45]===r.trigger.weekly?ae=t[46]:(ae=(0,Z.jsx)(M,{value:`weekly`,children:r.trigger.weekly}),t[45]=r.trigger.weekly,t[46]=ae);let oe;t[47]===r.trigger.interval?oe=t[48]:(oe=(0,Z.jsx)(M,{value:`interval`,children:r.trigger.interval}),t[47]=r.trigger.interval,t[48]=oe);let L;t[49]===r.trigger.customCron?L=t[50]:(L=(0,Z.jsx)(M,{value:`cron`,children:r.trigger.customCron}),t[49]=r.trigger.customCron,t[50]=L);let se;t[51]===r.trigger.webhook?se=t[52]:(se=(0,Z.jsx)(M,{value:`webhook`,children:r.trigger.webhook}),t[51]=r.trigger.webhook,t[52]=se);let ce;t[53]===r.trigger.goalBlocked?ce=t[54]:(ce=(0,Z.jsx)(M,{value:`goalBlocked`,children:r.trigger.goalBlocked}),t[53]=r.trigger.goalBlocked,t[54]=ce);let le;t[55]===r.trigger.noteCreated?le=t[56]:(le=(0,Z.jsx)(M,{value:`noteCreated`,children:r.trigger.noteCreated}),t[55]=r.trigger.noteCreated,t[56]=le);let R;t[57]===r.trigger.workflowFailed?R=t[58]:(R=(0,Z.jsx)(M,{value:`workflowFailed`,children:r.trigger.workflowFailed}),t[57]=r.trigger.workflowFailed,t[58]=R);let ue;t[59]===r.trigger.sessionUpdated?ue=t[60]:(ue=(0,Z.jsx)(M,{value:`sessionUpdated`,children:r.trigger.sessionUpdated}),t[59]=r.trigger.sessionUpdated,t[60]=ue);let de;t[61]===r.trigger.customEvent?de=t[62]:(de=(0,Z.jsx)(M,{value:`event`,children:r.trigger.customEvent}),t[61]=r.trigger.customEvent,t[62]=de);let fe;t[63]!==n.triggerMode||t[64]!==F||t[65]!==ne||t[66]!==re||t[67]!==ie||t[68]!==ae||t[69]!==oe||t[70]!==L||t[71]!==se||t[72]!==ce||t[73]!==le||t[74]!==R||t[75]!==ue||t[76]!==de?(fe=(0,Z.jsxs)(I,{className:Q,value:n.triggerMode,onChange:F,children:[ne,re,ie,ae,oe,L,se,ce,le,R,ue,de]}),t[63]=n.triggerMode,t[64]=F,t[65]=ne,t[66]=re,t[67]=ie,t[68]=ae,t[69]=oe,t[70]=L,t[71]=se,t[72]=ce,t[73]=le,t[74]=R,t[75]=ue,t[76]=de,t[77]=fe):fe=t[77];let z;t[78]!==n.onceAt||t[79]!==n.triggerMode||t[80]!==r.form.onceAt||t[81]!==v?(z=n.triggerMode===`once`?(0,Z.jsx)($,{label:r.form.onceAt,children:(0,Z.jsx)(`input`,{className:Q,type:`datetime-local`,value:n.onceAt,onChange:e=>v({onceAt:e.target.value})})}):null,t[78]=n.onceAt,t[79]=n.triggerMode,t[80]=r.form.onceAt,t[81]=v,t[82]=z):z=t[82];let me;t[83]!==n.time||t[84]!==n.triggerMode||t[85]!==n.weekday||t[86]!==r.form.day||t[87]!==r.form.time||t[88]!==r.weekdays||t[89]!==v?(me=n.triggerMode===`daily`||n.triggerMode===`weekly`?(0,Z.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,Z.jsx)($,{label:r.form.time,children:(0,Z.jsx)(pe,{value:n.time,onChange:e=>v({time:e}),ariaLabel:r.form.time})}),n.triggerMode===`weekly`?(0,Z.jsx)($,{label:r.form.day,children:(0,Z.jsxs)(I,{className:Q,value:n.weekday,onChange:e=>v({weekday:e.target.value}),children:[(0,Z.jsx)(M,{value:`1`,children:r.weekdays.monday}),(0,Z.jsx)(M,{value:`2`,children:r.weekdays.tuesday}),(0,Z.jsx)(M,{value:`3`,children:r.weekdays.wednesday}),(0,Z.jsx)(M,{value:`4`,children:r.weekdays.thursday}),(0,Z.jsx)(M,{value:`5`,children:r.weekdays.friday}),(0,Z.jsx)(M,{value:`6`,children:r.weekdays.saturday}),(0,Z.jsx)(M,{value:`0`,children:r.weekdays.sunday})]})}):null]}):null,t[83]=n.time,t[84]=n.triggerMode,t[85]=n.weekday,t[86]=r.form.day,t[87]=r.form.time,t[88]=r.weekdays,t[89]=v,t[90]=me):me=t[90];let he=n.triggerMode===`interval`?(0,Z.jsxs)(`div`,{className:`grid gap-3 rounded-lg border border-edge-subtle bg-surface-base p-3`,children:[(0,Z.jsx)($,{label:r.form.intervalEvery,children:(0,Z.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-[minmax(0,1fr)_10rem]`,children:[(0,Z.jsx)(`input`,{className:Q,type:`number`,min:6e4/ke(1,n.intervalUnit),step:`any`,inputMode:`decimal`,value:n.intervalValue,onChange:e=>v({intervalValue:e.target.value})}),(0,Z.jsxs)(I,{className:Q,value:n.intervalUnit,onChange:e=>{let t=e.target.value;v({intervalValue:Ae(n.intervalValue,n.intervalUnit,t),intervalUnit:t})},children:[(0,Z.jsx)(M,{value:`minute`,children:r.form.intervalUnits.minute}),(0,Z.jsx)(M,{value:`hour`,children:r.form.intervalUnits.hour}),(0,Z.jsx)(M,{value:`day`,children:r.form.intervalUnits.day}),(0,Z.jsx)(M,{value:`week`,children:r.form.intervalUnits.week})]})]})}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:r.form.commonIntervals}),(0,Z.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:Be.map(e=>{let t=ke(e.value,e.unit),n=t===y;return(0,Z.jsx)(`button`,{type:`button`,"aria-pressed":n,className:o(`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:()=>v({intervalValue:e.value,intervalUnit:e.unit}),children:je(t,h)},`${e.value}:${e.unit}`)})})]}),(0,Z.jsxs)(`div`,{className:`rounded-lg bg-surface-panel px-3 py-2.5`,children:[(0,Z.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:X(y,h)}),(0,Z.jsxs)(`div`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:[r.form.nextThreeRuns,`:`,C.join(h===`zh`?`、`:`, `)]}),(0,Z.jsx)(`div`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:r.form.fixedIntervalHint})]})]}):null,V;t[91]!==n.cronExpr||t[92]!==n.triggerMode||t[93]!==r.form.expression||t[94]!==v?(V=n.triggerMode===`cron`?(0,Z.jsx)($,{label:r.form.expression,children:(0,Z.jsx)(`input`,{className:Q,value:n.cronExpr,onChange:e=>v({cronExpr:e.target.value})})}):null,t[91]=n.cronExpr,t[92]=n.triggerMode,t[93]=r.form.expression,t[94]=v,t[95]=V):V=t[95];let ge;t[96]!==n.triggerMode||t[97]!==n.webhookSecretId||t[98]!==r.form.secretId||t[99]!==v?(ge=n.triggerMode===`webhook`?(0,Z.jsx)($,{label:r.form.secretId,children:(0,Z.jsx)(`input`,{className:Q,value:n.webhookSecretId,onChange:e=>v({webhookSecretId:e.target.value})})}):null,t[96]=n.triggerMode,t[97]=n.webhookSecretId,t[98]=r.form.secretId,t[99]=v,t[100]=ge):ge=t[100];let ve;t[101]!==n.eventPayloadMatch||t[102]!==n.eventSource||t[103]!==n.eventType||t[104]!==n.triggerMode||t[105]!==r.form.eventPayloadMatch||t[106]!==r.form.eventSource||t[107]!==r.form.eventType||t[108]!==r.form.invalidJsonObject||t[109]!==v?(ve=n.triggerMode===`event`?(0,Z.jsxs)(`div`,{className:`grid gap-3 rounded-lg border border-edge-subtle bg-surface-base p-3`,children:[(0,Z.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,Z.jsx)($,{label:r.form.eventType,children:(0,Z.jsx)(`input`,{className:Q,value:n.eventType,onChange:e=>v({eventType:e.target.value})})}),(0,Z.jsx)($,{label:r.form.eventSource,children:(0,Z.jsx)(`input`,{className:Q,value:n.eventSource,onChange:e=>v({eventSource:e.target.value})})})]}),(0,Z.jsxs)($,{label:r.form.eventPayloadMatch,children:[(0,Z.jsx)(`textarea`,{className:o(Q,`min-h-24 resize-y font-mono text-xs`),value:n.eventPayloadMatch,onChange:e=>v({eventPayloadMatch:e.target.value}),placeholder:`{
5
+ "status": "blocked"
6
+ }`}),qe(n.eventPayloadMatch)?null:(0,Z.jsx)(`span`,{className:`text-xs text-red-700 dark:text-red-300`,children:r.form.invalidJsonObject})]})]}):null,t[101]=n.eventPayloadMatch,t[102]=n.eventSource,t[103]=n.eventType,t[104]=n.triggerMode,t[105]=r.form.eventPayloadMatch,t[106]=r.form.eventSource,t[107]=r.form.eventType,t[108]=r.form.invalidJsonObject,t[109]=v,t[110]=ve):ve=t[110];let ye;t[111]===r.form.action?ye=t[112]:(ye=(0,Z.jsx)(Pt,{title:r.form.action}),t[111]=r.form.action,t[112]=ye);let W;t[113]!==n.timeoutSeconds||t[114]!==n.workflowId||t[115]!==v||t[116]!==a?(W=e=>{let t=e.target.value,r=Number.parseInt(n.timeoutSeconds,10);v({actionMode:t,...r===600||r===1800?{timeoutSeconds:t===`browser_recipe`?`600`:`1800`}:{},...t===`browser_recipe`?{safetyMode:`auto_apply`}:{},...t===`workflow`&&!n.workflowId.trim()&&a[0]?{workflowId:a[0].id,workflowGoal:``,workflowInput:{goal:``,argValues:{},schemaInput:{},concurrency:``,maxSubagents:``},workflowInputValid:!0}:{}})},t[113]=n.timeoutSeconds,t[114]=n.workflowId,t[115]=v,t[116]=a,t[117]=W):W=t[117];let G;t[118]===r.action.runAgent?G=t[119]:(G=(0,Z.jsx)(M,{value:`agent`,children:r.action.runAgent}),t[118]=r.action.runAgent,t[119]=G);let K;t[120]===r.action.runWorkflow?K=t[121]:(K=(0,Z.jsx)(M,{value:`workflow`,children:r.action.runWorkflow}),t[120]=r.action.runWorkflow,t[121]=K);let q=h===`zh`?`浏览器自动化`:`Browser automation`,Se;t[122]===q?Se=t[123]:(Se=(0,Z.jsx)(M,{value:`browser_recipe`,children:q}),t[122]=q,t[123]=Se);let Ce;t[124]!==n.actionMode||t[125]!==W||t[126]!==G||t[127]!==K||t[128]!==Se?(Ce=(0,Z.jsxs)(I,{className:Q,value:n.actionMode,onChange:W,children:[G,K,Se]}),t[124]=n.actionMode,t[125]=W,t[126]=G,t[127]=K,t[128]=Se,t[129]=Ce):Ce=t[129];let we=n.actionMode===`browser_recipe`?null:(0,Z.jsx)($,{label:r.form.agent,children:(0,Z.jsxs)(I,{className:Q,value:n.agentId,onChange:e=>v({agentId:e.target.value}),children:[(0,Z.jsx)(M,{value:``,children:m?r.form.loadingAgents:r.form.defaultAgent}),p.map(e=>(0,Z.jsx)(M,{value:e.id,children:T(e,g)},e.id))]})}),J;t[130]!==u||t[131]!==f||t[132]!==n.actionMode||t[133]!==n.agentId||t[134]!==n.browserWorkflowId||t[135]!==n.browserWorkflowInputs||t[136]!==n.description||t[137]!==n.instruction||t[138]!==n.name||t[139]!==n.triggerMode||t[140]!==n.workflowId||t[141]!==n.workflowInput||t[142]!==r.form.instruction||t[143]!==r.form.loadingWorkflows||t[144]!==r.form.noWorkflows||t[145]!==r.form.triggeredRun||t[146]!==r.form.workflow||t[147]!==h||t[148]!==d||t[149]!==c||t[150]!==v||t[151]!==a||t[152]!==l?(J=n.actionMode===`agent`?(0,Z.jsxs)($,{label:r.form.instruction,children:[(0,Z.jsx)(`div`,{className:`flex justify-end`,children:(0,Z.jsx)(B,{value:n.instruction,onApply:e=>v({instruction:e}),fieldId:`automation.instruction`,fieldLabel:r.form.instruction,scenario:`automation.instruction`,locale:h,context:{automationName:n.name,automationDescription:n.description,triggerMode:n.triggerMode,agentId:n.agentId},showLabel:!1})}),(0,Z.jsx)(`textarea`,{className:o(Q,`min-h-32 resize-y`),value:n.instruction,onChange:e=>v({instruction:e.target.value})})]}):n.actionMode===`workflow`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{label:r.form.workflow,children:(0,Z.jsxs)(I,{className:Q,value:n.workflowId,onChange:e=>v({workflowId:e.target.value,workflowGoal:``,workflowInput:{goal:``,argValues:{},schemaInput:{},concurrency:``,maxSubagents:``},workflowInputValid:!0}),disabled:l||a.length===0,children:[l?(0,Z.jsx)(M,{value:``,children:r.form.loadingWorkflows}):null,!l&&a.length===0?(0,Z.jsx)(M,{value:``,children:r.form.noWorkflows}):null,a.map(Nt)]})}),c?(0,Z.jsx)(_e,{definition:c,language:h,value:n.workflowInput,onChange:e=>v({workflowInput:e,workflowGoal:e.goal,workflowInputValid:!0}),mode:`automation`,badgeLabel:r.form.triggeredRun,onValidityChange:e=>v({workflowInputValid:e.valid}),aiAssist:{inputScenario:`automation.workflowInput`,goalScenario:`automation.workflowGoal`,context:{automationName:n.name,automationDescription:n.description,triggerMode:n.triggerMode,workflowId:c.id,workflowTitle:c.title,workflowDescription:c.description}},inputClassName:`rounded-lg`}):null]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{label:h===`zh`?`浏览器自动化`:`Browser automation`,children:(0,Z.jsxs)(I,{className:Q,value:n.browserWorkflowId,onChange:e=>{let t=u.find(t=>t.id===e.target.value);v({browserWorkflowId:e.target.value,browserWorkflowInputs:t?be(t):{}})},disabled:f||u.length===0,children:[u.length===0?(0,Z.jsx)(M,{value:``,children:h===`zh`?`没有已启用的浏览器自动化`:`No enabled browser automations`}):null,u.map(Mt)]})}),d&&Object.keys(d.inputs).length>0?(0,Z.jsx)($,{label:h===`zh`?`运行时填写`:`Run inputs`,children:(0,Z.jsx)(xe,{workflow:d,values:n.browserWorkflowInputs,language:h,onChange:e=>v({browserWorkflowInputs:e})})}):null]}),t[130]=u,t[131]=f,t[132]=n.actionMode,t[133]=n.agentId,t[134]=n.browserWorkflowId,t[135]=n.browserWorkflowInputs,t[136]=n.description,t[137]=n.instruction,t[138]=n.name,t[139]=n.triggerMode,t[140]=n.workflowId,t[141]=n.workflowInput,t[142]=r.form.instruction,t[143]=r.form.loadingWorkflows,t[144]=r.form.noWorkflows,t[145]=r.form.triggeredRun,t[146]=r.form.workflow,t[147]=h,t[148]=d,t[149]=c,t[150]=v,t[151]=a,t[152]=l,t[153]=J):J=t[153];let Te;t[154]!==n.actionMode||t[155]!==n.afterRunMode||t[156]!==n.safetyMode||t[157]!==r.form.safety||t[158]!==r.safety||t[159]!==v?(Te=n.actionMode===`browser_recipe`?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Pt,{title:r.form.safety}),(0,Z.jsxs)($,{label:r.form.safety,children:[(0,Z.jsxs)(I,{className:Q,value:n.safetyMode,onChange:e=>{let t=e.target.value;v({safetyMode:t,...t!==`auto_apply`&&n.afterRunMode===`webhook`?{afterRunMode:`none`,webhookUrl:``}:{}})},children:[(0,Z.jsx)(M,{value:`suggest_only`,children:r.safety.suggest_only}),(0,Z.jsx)(M,{value:`ask_before_apply`,children:r.safety.ask_before_apply}),(0,Z.jsx)(M,{value:`auto_apply`,children:r.safety.auto_apply})]}),(0,Z.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})]})]}),t[154]=n.actionMode,t[155]=n.afterRunMode,t[156]=n.safetyMode,t[157]=r.form.safety,t[158]=r.safety,t[159]=v,t[160]=Te):Te=t[160];let Y;t[161]===r.form.afterRun?Y=t[162]:(Y=(0,Z.jsx)(Pt,{title:r.form.afterRun}),t[161]=r.form.afterRun,t[162]=Y);let Ee;t[163]===v?Ee=t[164]:(Ee=e=>v({afterRunMode:e.target.value}),t[163]=v,t[164]=Ee);let De;t[165]===r.afterRun.none?De=t[166]:(De=(0,Z.jsx)(M,{value:`none`,children:r.afterRun.none}),t[165]=r.afterRun.none,t[166]=De);let Oe;t[167]===r.afterRun.saveToSession?Oe=t[168]:(Oe=(0,Z.jsx)(M,{value:`saveToSession`,children:r.afterRun.saveToSession}),t[167]=r.afterRun.saveToSession,t[168]=Oe);let Me=n.safetyMode!==`auto_apply`,Ne;t[169]!==r.afterRun.webhook||t[170]!==Me?(Ne=(0,Z.jsx)(M,{value:`webhook`,disabled:Me,children:r.afterRun.webhook}),t[169]=r.afterRun.webhook,t[170]=Me,t[171]=Ne):Ne=t[171];let Fe;t[172]!==n.afterRunMode||t[173]!==Ee||t[174]!==De||t[175]!==Oe||t[176]!==Ne?(Fe=(0,Z.jsxs)(I,{className:Q,value:n.afterRunMode,onChange:Ee,children:[De,Oe,Ne]}),t[172]=n.afterRunMode,t[173]=Ee,t[174]=De,t[175]=Oe,t[176]=Ne,t[177]=Fe):Fe=t[177];let Ie;t[178]!==n.afterRunMode||t[179]!==n.webhookUrl||t[180]!==r.form.webhookUrl||t[181]!==v?(Ie=n.afterRunMode===`webhook`?(0,Z.jsx)($,{label:r.form.webhookUrl,children:(0,Z.jsx)(`input`,{className:Q,value:n.webhookUrl,onChange:e=>v({webhookUrl:e.target.value})})}):null,t[178]=n.afterRunMode,t[179]=n.webhookUrl,t[180]=r.form.webhookUrl,t[181]=v,t[182]=Ie):Ie=t[182];let Le;t[183]===r.form.reliability?Le=t[184]:(Le=(0,Z.jsx)(Pt,{title:r.form.reliability}),t[183]=r.form.reliability,t[184]=Le);let Re;t[185]===v?Re=t[186]:(Re=e=>v({timeoutSeconds:e.target.value}),t[185]=v,t[186]=Re);let ze;t[187]!==n.timeoutSeconds||t[188]!==Re?(ze=(0,Z.jsx)(`input`,{className:Q,inputMode:`numeric`,value:n.timeoutSeconds,onChange:Re}),t[187]=n.timeoutSeconds,t[188]=Re,t[189]=ze):ze=t[189];let Ve;t[190]!==r.form.timeoutSeconds||t[191]!==ze?(Ve=(0,Z.jsx)($,{label:r.form.timeoutSeconds,children:ze}),t[190]=r.form.timeoutSeconds,t[191]=ze,t[192]=Ve):Ve=t[192];let He;t[193]===v?He=t[194]:(He=e=>v({disableAfterFailures:e.target.value}),t[193]=v,t[194]=He);let Ue;t[195]!==n.disableAfterFailures||t[196]!==He?(Ue=(0,Z.jsx)(`input`,{className:Q,inputMode:`numeric`,value:n.disableAfterFailures,onChange:He}),t[195]=n.disableAfterFailures,t[196]=He,t[197]=Ue):Ue=t[197];let We;t[198]!==r.form.disableAfterFailures||t[199]!==Ue?(We=(0,Z.jsx)($,{label:r.form.disableAfterFailures,children:Ue}),t[198]=r.form.disableAfterFailures,t[199]=Ue,t[200]=We):We=t[200];let Ge;t[201]!==Ve||t[202]!==We?(Ge=(0,Z.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[Ve,We]}),t[201]=Ve,t[202]=We,t[203]=Ge):Ge=t[203];let Ke;t[204]===r.form.effectivePolicy?Ke=t[205]:(Ke=(0,Z.jsx)(`p`,{className:`text-xs font-medium text-fg`,children:r.form.effectivePolicy}),t[204]=r.form.effectivePolicy,t[205]=Ke);let Je=n.timeoutSeconds||`—`,Ye;t[206]!==r.form.executionDeadline||t[207]!==Je?(Ye=(0,Z.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[r.form.executionDeadline,`: `,Je,`s`]}),t[206]=r.form.executionDeadline,t[207]=Je,t[208]=Ye):Ye=t[208];let Xe;t[209]===r.form.downstreamTimeoutHint?Xe=t[210]:(Xe=(0,Z.jsx)(`p`,{className:`mt-0.5 text-xs leading-relaxed text-fg-subtle`,children:r.form.downstreamTimeoutHint}),t[209]=r.form.downstreamTimeoutHint,t[210]=Xe);let Ze;t[211]!==Ke||t[212]!==Ye||t[213]!==Xe?(Ze=(0,Z.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-muted/40 px-3 py-2.5`,children:[Ke,Ye,Xe]}),t[211]=Ke,t[212]=Ye,t[213]=Xe,t[214]=Ze):Ze=t[214];let Qe;return t[215]!==j||t[216]!==P||t[217]!==te||t[218]!==fe||t[219]!==z||t[220]!==me||t[221]!==he||t[222]!==V||t[223]!==ge||t[224]!==ve||t[225]!==ye||t[226]!==Ce||t[227]!==we||t[228]!==J||t[229]!==Te||t[230]!==Y||t[231]!==Fe||t[232]!==Ie||t[233]!==Le||t[234]!==Ge||t[235]!==Ze?(Qe=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-4`,children:(0,Z.jsxs)(`div`,{className:`grid gap-4`,children:[j,P,te,fe,z,me,he,V,ge,ve,ye,Ce,we,J,Te,Y,Fe,Ie,Le,Ge,Ze]})}),t[215]=j,t[216]=P,t[217]=te,t[218]=fe,t[219]=z,t[220]=me,t[221]=he,t[222]=V,t[223]=ge,t[224]=ve,t[225]=ye,t[226]=Ce,t[227]=we,t[228]=J,t[229]=Te,t[230]=Y,t[231]=Fe,t[232]=Ie,t[233]=Le,t[234]=Ge,t[235]=Ze,t[236]=Qe):Qe=t[236],Qe}function Mt(e){return(0,Z.jsx)(M,{value:e.id,children:e.name},e.id)}function Nt(e){return(0,Z.jsx)(M,{value:e.id,children:e.title||e.name},e.id)}var Q=`w-full rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none focus:border-accent`;function $(e){let t=(0,U.c)(5),{label:n,children:r}=e,i;t[0]===n?i=t[1]:(i=(0,Z.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,Z.jsxs)(`div`,{className:`grid gap-1.5`,children:[i,r]}),t[2]=r,t[3]=i,t[4]=a):a=t[4],a}function Pt(e){let t=(0,U.c)(3),{title:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(oe,{className:`size-4 text-fg-muted`}),t[0]=r):r=t[0];let i;return t[1]===n?i=t[2]:(i=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 pt-2 text-sm font-semibold text-fg`,children:[r,n]}),t[1]=n,t[2]=i),i}export{dt as AutomationsPage};