@xopcai/xopc 0.0.483 → 0.0.484

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 (359) hide show
  1. package/dist/browser-ext/dist/assets/{auth-tm02ZZB8.js → auth-8EjgHa-n.js} +28 -6
  2. package/dist/browser-ext/dist/background.js +7 -3
  3. package/dist/browser-ext/dist/sidepanel.html +1 -1
  4. package/dist/browser-ext/dist/sidepanel.js +1 -1
  5. package/dist/browser-ext/manifest.json +1 -1
  6. package/dist/extensions/telegram/src/plugin.js +1 -1
  7. package/dist/extensions/telegram/xopc.extension.json +1 -1
  8. package/dist/extensions/weixin/src/messaging/process-message.js +1 -1
  9. package/dist/gateway/server/chunks.bin +794 -785
  10. package/dist/gateway/server/chunks.json +1 -1
  11. package/dist/gateway/static/root/assets/{apps-page-DO5uTFRI.js → apps-page-CH9wENBj.js} +1 -1
  12. package/dist/gateway/static/root/assets/{automations-page-C5rp_vOE.js → automations-page-B1Ri4sh8.js} +1 -1
  13. package/dist/gateway/static/root/assets/{automations-workspace-BxN47gkP.js → automations-workspace-CNSza6ir.js} +2 -2
  14. package/dist/gateway/static/root/assets/bell-BlYch9Vg.js +1 -0
  15. package/dist/gateway/static/root/assets/browser-notification-delivery-DjK3F0oR.js +1 -0
  16. package/dist/gateway/static/root/assets/capabilities-page-EENl65YY.js +2 -0
  17. package/dist/gateway/static/root/assets/{capabilities-settings-panel-B1o8BKxy.js → capabilities-settings-panel-BOwbZn9X.js} +1 -1
  18. package/dist/gateway/static/root/assets/{channels-_m_FjvAY.js → channels-DlnXbcOj.js} +1 -1
  19. package/dist/gateway/static/root/assets/{chat-page-D7l_0kTV.js → chat-page-LOR5JxDh.js} +15 -15
  20. package/dist/gateway/static/root/assets/{chat-terminal-dock-BKnlzlXT.js → chat-terminal-dock-DE8j-K9d.js} +1 -1
  21. package/dist/gateway/static/root/assets/{connectors-page-CXNy8Y5R.js → connectors-page-BJm1jjct.js} +1 -1
  22. package/dist/gateway/static/root/assets/device-connections-panel-DE01vyK_.js +1 -0
  23. package/dist/gateway/static/root/assets/{extension-debug-page-BcjkhaY9.js → extension-debug-page-D3X7SlzG.js} +1 -1
  24. package/dist/gateway/static/root/assets/{extension-iframe-host-RWjaucjJ.js → extension-iframe-host-CIAq7PSn.js} +1 -1
  25. package/dist/gateway/static/root/assets/{extension-message-router-CzVgJn5c.js → extension-message-router-B2wbucV7.js} +1 -1
  26. package/dist/gateway/static/root/assets/{extension-page-DC58VBdj.js → extension-page-qwY7r1_p.js} +1 -1
  27. package/dist/gateway/static/root/assets/{extension-provider-BGrqW0_n.js → extension-provider-DFcRbTHI.js} +1 -1
  28. package/dist/gateway/static/root/assets/{extension-settings-page-DYbal3Iq.js → extension-settings-page-Cpnh9lcZ.js} +1 -1
  29. package/dist/gateway/static/root/assets/file-preview-surface-Da1xZiG6.js +1 -0
  30. package/dist/gateway/static/root/assets/gateway-realtime-CoIFB3im.js +1 -0
  31. package/dist/gateway/static/root/assets/{home-page-DnjsusRG.js → home-page-BusNFHe-.js} +3 -3
  32. package/dist/gateway/static/root/assets/index-B_TGvH_k.css +1 -0
  33. package/dist/gateway/static/root/assets/index-DE6GguFZ.js +11 -0
  34. package/dist/gateway/static/root/assets/{local-app-workbench-page-DH5c5Zhv.js → local-app-workbench-page-B9uSL1Mi.js} +1 -1
  35. package/dist/gateway/static/root/assets/{logs-page-D2olKpTB.js → logs-page-0hkRbcUR.js} +1 -1
  36. package/dist/gateway/static/root/assets/map-pin-BFRLhzQ9.js +1 -0
  37. package/dist/gateway/static/root/assets/note-detail-panel-DXzfoiyk.js +7 -0
  38. package/dist/gateway/static/root/assets/{notes-page-YQAAdasN.js → notes-page-BNTgiHSk.js} +1 -1
  39. package/dist/gateway/static/root/assets/{page-context-capture-button-CDSH76wA.js → page-context-capture-button-BXSBeGms.js} +1 -1
  40. package/dist/gateway/static/root/assets/{personal-page-Bfgb5oQI.js → personal-page-D7zTHQ0K.js} +1 -1
  41. package/dist/gateway/static/root/assets/{personal-profile-settings-BvjLssF9.js → personal-profile-settings-TcI0Zfwr.js} +1 -1
  42. package/dist/gateway/static/root/assets/{personal-settings-panel-Ffr7gcx4.js → personal-settings-panel-BJ46T7ZO.js} +1 -1
  43. package/dist/gateway/static/root/assets/{preview-runtime-pNF_b2oD.js → preview-runtime-C1U57WSM.js} +1 -1
  44. package/dist/gateway/static/root/assets/product-automation-feedback-GA_YPLkr.js +1 -0
  45. package/dist/gateway/static/root/assets/{project-detail-page-DDaG-n-H.js → project-detail-page-Dgs8ImMC.js} +1 -1
  46. package/dist/gateway/static/root/assets/route-preload-7WVrzJca.js +2 -0
  47. package/dist/gateway/static/root/assets/routine-panel-Bfbiz0IN.js +2 -0
  48. package/dist/gateway/static/root/assets/{session-manager-CVNlrzFB.js → session-manager-DUWeBdeG.js} +1 -1
  49. package/dist/gateway/static/root/assets/{settings-page-DzISa84O.js → settings-page-BOzzOS6k.js} +1 -1
  50. package/dist/gateway/static/root/assets/share-2-CnIB9PsV.js +1 -0
  51. package/dist/gateway/static/root/assets/{share-link-dialog-D31jDQN9.js → share-link-dialog-2JjvWs0q.js} +1 -1
  52. package/dist/gateway/static/root/assets/{share-preview-page-Co6GUYV5.js → share-preview-page-Di5_ukH8.js} +1 -1
  53. package/dist/gateway/static/root/assets/{shares-settings-C-czUl49.js → shares-settings-CirGM67m.js} +1 -1
  54. package/dist/gateway/static/root/assets/space-page-CKVuhV2i.js +2 -0
  55. package/dist/gateway/static/root/assets/system-settings-panel-0e2zfQLt.js +1 -0
  56. package/dist/gateway/static/root/assets/{task-detail-page-DWoXIgp2.js → task-detail-page-DEpYIaok.js} +1 -1
  57. package/dist/gateway/static/root/assets/{task-header-title-DfyaQ58P.js → task-header-title-Cdgp2rCs.js} +1 -1
  58. package/dist/gateway/static/root/assets/{task-run-issue-notice-CljFUd21.js → task-run-issue-notice-CGrUMy0s.js} +1 -1
  59. package/dist/gateway/static/root/assets/use-composer-attachments-DJsIzJ1c.js +2 -0
  60. package/dist/gateway/static/root/assets/{use-file-preview-expanded-U5rH80Jf.js → use-file-preview-expanded-BFF2vXm5.js} +1 -1
  61. package/dist/gateway/static/root/assets/{use-personal-work-FI9Cgyq5.js → use-personal-work-Dd2jRUpz.js} +1 -1
  62. package/dist/gateway/static/root/assets/{use-realtime-voice-BARxeNLd.js → use-realtime-voice-9OvLwHzk.js} +1 -1
  63. package/dist/gateway/static/root/assets/use-share-link-WKZLlEqr.js +1 -0
  64. package/dist/gateway/static/root/assets/{use-workspace-tree-NEeru2fw.js → use-workspace-tree-LCIT1H-D.js} +1 -1
  65. package/dist/gateway/static/root/assets/{voice-settings-bAmN4bUq.js → voice-settings-j8o-hGTm.js} +1 -1
  66. package/dist/gateway/static/root/assets/{workspace-api-C8-p66T-.js → workspace-api-BuNWyNvA.js} +2 -2
  67. package/dist/gateway/static/root/assets/workspace-file-preview-dialog-DwVWTehC.js +1 -0
  68. package/dist/gateway/static/root/index.html +26 -23
  69. package/dist/package.js +1 -1
  70. package/dist/packages/endpoint-tools-client/src/index.js +6 -3
  71. package/dist/packages/endpoint-tools-protocol/src/folders.js +5 -10
  72. package/dist/packages/endpoint-tools-protocol/src/index.js +50 -10
  73. package/dist/packages/endpoint-tools-protocol/src/location.js +1 -1
  74. package/dist/packages/endpoint-tools-protocol/src/personal.js +2 -2
  75. package/dist/src/agent/agent-manager.js +14 -14
  76. package/dist/src/agent/background-review/prompts.js +1 -1
  77. package/dist/src/agent/background-review/run-background-review.js +8 -8
  78. package/dist/src/agent/context/coordinator.js +1 -1
  79. package/dist/src/agent/context/deep-recall.js +4 -4
  80. package/dist/src/agent/context/execution-context.js +3 -3
  81. package/dist/src/agent/context/project-context.js +4 -4
  82. package/dist/src/agent/embedded/execution-tool-policy.js +1 -1
  83. package/dist/src/agent/embedded/run-for-session.js +4 -4
  84. package/dist/src/agent/embedded/run-turn.js +1 -1
  85. package/dist/src/agent/embedded/session-runner.js +3 -3
  86. package/dist/src/agent/external-tools/cliProvider.js +4 -4
  87. package/dist/src/agent/external-tools/composio-provider.js +3 -3
  88. package/dist/src/agent/external-tools/endpoint-provider.js +24 -14
  89. package/dist/src/agent/image/tool-model-config.js +1 -1
  90. package/dist/src/agent/inbound/attachment-pipeline.js +1 -1
  91. package/dist/src/agent/mcp/connection-drafts.js +1 -1
  92. package/dist/src/agent/mcp/connection-setup.js +2 -2
  93. package/dist/src/agent/mcp/managed-discovery.js +1 -1
  94. package/dist/src/agent/mcp/tool-catalog.js +1 -1
  95. package/dist/src/agent/mcp/transport.js +1 -1
  96. package/dist/src/agent/orchestration/agent-orchestrator.js +1 -1
  97. package/dist/src/agent/orchestration/child-run-resume.js +1 -1
  98. package/dist/src/agent/prompt/response-language.js +1 -1
  99. package/dist/src/agent/prompt/service-prompt-builder.js +1 -1
  100. package/dist/src/agent/prompt/system-prompt-params.js +1 -1
  101. package/dist/src/agent/sandbox/exec-policy.js +1 -1
  102. package/dist/src/agent/service/process-direct-streaming.js +2 -2
  103. package/dist/src/agent/service.js +10 -10
  104. package/dist/src/agent/session/session-config-service.js +1 -1
  105. package/dist/src/agent/session/session-inspector.js +1 -1
  106. package/dist/src/agent/skills/index.js +1 -1
  107. package/dist/src/agent/skills/managed-store.js +1 -1
  108. package/dist/src/agent/skills/skill-manage-ops.js +1 -1
  109. package/dist/src/agent/skills/skill-manager.js +1 -1
  110. package/dist/src/agent/skills/skill-sources.js +1 -1
  111. package/dist/src/agent/tasks/task-judge-service.js +6 -6
  112. package/dist/src/agent/tool-manuals/computer.d.ts +1 -1
  113. package/dist/src/agent/tool-manuals/computer.js +2 -2
  114. package/dist/src/agent/tools/factory.js +10 -10
  115. package/dist/src/agent/tools/fetch-text.js +1 -1
  116. package/dist/src/agent/tools/index.js +3 -3
  117. package/dist/src/agent/tools/knowledge-memory-tool.js +1 -1
  118. package/dist/src/agent/tools/personal-attention-tool.js +1 -1
  119. package/dist/src/agent/tools/personal-memory-tool.js +5 -5
  120. package/dist/src/agent/tools/personal-read-tool.js +1 -1
  121. package/dist/src/agent/tools/personal-request-result-tool.js +1 -1
  122. package/dist/src/agent/tools/personal-request-tool.js +2 -2
  123. package/dist/src/agent/tools/personal-task-tool.js +4 -4
  124. package/dist/src/agent/tools/session-search-tool.js +2 -2
  125. package/dist/src/agent/tools/user-context-tool.js +2 -2
  126. package/dist/src/agent/tools/xopc-use-tool.js +5 -5
  127. package/dist/src/ai-assist/text-assist.js +1 -1
  128. package/dist/src/auth/oauth/xopc-cloud.js +1 -1
  129. package/dist/src/auth/sync-provider-auth.js +1 -1
  130. package/dist/src/automations/api/routes.js +2 -2
  131. package/dist/src/automations/capabilities/write.js +3 -3
  132. package/dist/src/automations/configuration-conversation.js +1 -1
  133. package/dist/src/automations/domain/index.js +1 -1
  134. package/dist/src/automations/draft/automation-draft-service.js +1 -1
  135. package/dist/src/automations/index.js +2 -2
  136. package/dist/src/automations/service/action-executor.js +2 -2
  137. package/dist/src/automations/service/automation-service.js +2 -2
  138. package/dist/src/browser/native-messaging-host.js +1 -1
  139. package/dist/src/capabilities/capability-catalog.js +3 -3
  140. package/dist/src/capabilities/runtime/dispatcher.js +1 -1
  141. package/dist/src/capabilities/runtime/product.js +2 -2
  142. package/dist/src/capabilities/store-connector.js +1 -1
  143. package/dist/src/chat-commands/agent-edit.js +1 -1
  144. package/dist/src/chat-commands/builtins/config.js +1 -1
  145. package/dist/src/cli/commands/agent.js +1 -1
  146. package/dist/src/cli/commands/agents.js +1 -1
  147. package/dist/src/cli/commands/connectors.js +1 -1
  148. package/dist/src/cli/commands/doctor/checks/gateway-health.js +1 -1
  149. package/dist/src/cli/commands/doctor/checks/provider-auth.js +1 -1
  150. package/dist/src/cli/commands/extension-agent-plugin.js +1 -1
  151. package/dist/src/cli/commands/init.js +1 -1
  152. package/dist/src/cli/commands/models.js +2 -2
  153. package/dist/src/cli/commands/onboard/model.js +2 -2
  154. package/dist/src/cli/commands/onboard.js +1 -1
  155. package/dist/src/cli/commands/project.js +1 -1
  156. package/dist/src/cli/commands/tunnel.js +1 -1
  157. package/dist/src/cli/extension-cli-register.js +1 -1
  158. package/dist/src/cli/utils/gateway-client.js +1 -1
  159. package/dist/src/cli/utils/init-workspace-core.js +2 -2
  160. package/dist/src/computer/endpoint-transport.d.ts +1 -1
  161. package/dist/src/computer/endpoint-transport.js +3 -2
  162. package/dist/src/computer/errors.js +2 -1
  163. package/dist/src/computer/model-adapter.js +1 -0
  164. package/dist/src/computer/runtime.d.ts +1 -0
  165. package/dist/src/computer/runtime.js +15 -3
  166. package/dist/src/config/config-file.js +1 -1
  167. package/dist/src/config/index.js +4 -4
  168. package/dist/src/config/loader.js +1 -1
  169. package/dist/src/config/models-json.js +2 -2
  170. package/dist/src/connectors/connected-source-ingestion.js +2 -2
  171. package/dist/src/connectors/connected-source-understanding.js +2 -2
  172. package/dist/src/connectors/content-enrichment.js +1 -1
  173. package/dist/src/connectors/health.js +1 -1
  174. package/dist/src/endpoint-tools/device-capability-grants.d.ts +13 -0
  175. package/dist/src/endpoint-tools/device-capability-grants.js +71 -0
  176. package/dist/src/endpoint-tools/folder-connections.d.ts +3 -1
  177. package/dist/src/endpoint-tools/folder-connections.js +12 -8
  178. package/dist/src/endpoint-tools/invocation-service.d.ts +3 -0
  179. package/dist/src/endpoint-tools/invocation-service.js +8 -1
  180. package/dist/src/endpoint-tools/policy.js +1 -1
  181. package/dist/src/endpoint-tools/target-resolver.js +12 -7
  182. package/dist/src/endpoint-tools/task-targets.d.ts +3 -2
  183. package/dist/src/endpoint-tools/task-targets.js +9 -4
  184. package/dist/src/extensions/agent-plugins/auth.js +1 -1
  185. package/dist/src/extensions/agent-plugins/cli-authorization.js +1 -1
  186. package/dist/src/extensions/agent-plugins/credentials.js +1 -1
  187. package/dist/src/extensions/agent-plugins/setup.js +1 -1
  188. package/dist/src/extensions/agent-plugins/skill-catalog.js +3 -3
  189. package/dist/src/extensions/agent-plugins/source-http-fetch.js +1 -1
  190. package/dist/src/extensions/agent-plugins/user-config.js +1 -1
  191. package/dist/src/extensions/agent-plugins/validation.js +2 -2
  192. package/dist/src/extensions/install.js +1 -1
  193. package/dist/src/gateway/agent-reactions/reaction.js +3 -3
  194. package/dist/src/gateway/agents-admin.js +2 -2
  195. package/dist/src/gateway/file-path-classifier.js +1 -1
  196. package/dist/src/gateway/global-defaults-admin.js +1 -1
  197. package/dist/src/gateway/hono/app.js +1 -1
  198. package/dist/src/gateway/hono/lib/config-payload.js +2 -2
  199. package/dist/src/gateway/hono/middleware/auth.js +10 -0
  200. package/dist/src/gateway/hono/oauth-async.js +1 -1
  201. package/dist/src/gateway/hono/routes/agent-plugins.js +1 -1
  202. package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
  203. package/dist/src/gateway/hono/routes/commands-skills.js +3 -3
  204. package/dist/src/gateway/hono/routes/config-patch/misc.js +1 -1
  205. package/dist/src/gateway/hono/routes/device-connections.js +105 -14
  206. package/dist/src/gateway/hono/routes/endpoint-compatibility.js +6 -0
  207. package/dist/src/gateway/hono/routes/home.js +1 -1
  208. package/dist/src/gateway/hono/routes/lazy-bundles.js +1 -1
  209. package/dist/src/gateway/hono/routes/local-app-run-streams.js +1 -1
  210. package/dist/src/gateway/hono/routes/mcp.js +1 -1
  211. package/dist/src/gateway/hono/routes/media.js +18 -32
  212. package/dist/src/gateway/hono/routes/memory-learning.js +2 -2
  213. package/dist/src/gateway/hono/routes/mobile-capability-actions.js +4 -4
  214. package/dist/src/gateway/hono/routes/mobile-capability-panels.js +9 -9
  215. package/dist/src/gateway/hono/routes/models.js +2 -2
  216. package/dist/src/gateway/hono/routes/music-generation.js +1 -1
  217. package/dist/src/gateway/hono/routes/notes.js +2 -2
  218. package/dist/src/gateway/hono/routes/phone-setup.js +3 -3
  219. package/dist/src/gateway/hono/routes/phone.js +2 -2
  220. package/dist/src/gateway/hono/routes/projects.js +5 -5
  221. package/dist/src/gateway/hono/routes/session-input-handler.js +1 -1
  222. package/dist/src/gateway/hono/routes/sessions.js +1 -1
  223. package/dist/src/gateway/hono/routes/shares.js +96 -12
  224. package/dist/src/gateway/hono/routes/space.js +6 -3
  225. package/dist/src/gateway/hono/routes/tasks.js +2 -2
  226. package/dist/src/gateway/hono/routes/tui.js +1 -1
  227. package/dist/src/gateway/hono/routes/user-model.js +5 -5
  228. package/dist/src/gateway/hono/routes/video-generation.js +1 -1
  229. package/dist/src/gateway/image-generation-setup.js +1 -1
  230. package/dist/src/gateway/media-access.js +1 -1
  231. package/dist/src/gateway/security/gateway-scopes.d.ts +1 -0
  232. package/dist/src/gateway/security/gateway-scopes.js +9 -1
  233. package/dist/src/gateway/security/media-playback-ticket.d.ts +3 -0
  234. package/dist/src/gateway/security/media-playback-ticket.js +41 -0
  235. package/dist/src/gateway/service/agent-runner.js +2 -2
  236. package/dist/src/gateway/service/config-coordinator.js +1 -1
  237. package/dist/src/gateway/service/marketplace-service.js +2 -2
  238. package/dist/src/gateway/service/run-gateway-agent.js +1 -1
  239. package/dist/src/gateway/service/session-command-service.js +2 -2
  240. package/dist/src/gateway/service/session-input-coordinator.js +1 -1
  241. package/dist/src/gateway/service.js +29 -29
  242. package/dist/src/gateway/session-context-summary.js +1 -1
  243. package/dist/src/gateway/xopc-cloud-capability-setup.js +1 -1
  244. package/dist/src/home-intelligence/follow-ups.js +1 -1
  245. package/dist/src/home-intelligence/generator.js +2 -2
  246. package/dist/src/home-intelligence/host.js +5 -5
  247. package/dist/src/home-intelligence/observation.js +1 -1
  248. package/dist/src/home-intelligence/routines.js +2 -2
  249. package/dist/src/imports/importService.js +1 -1
  250. package/dist/src/imports/inventory.js +2 -2
  251. package/dist/src/imports/productImport.js +1 -1
  252. package/dist/src/knowledge-memory/repository.js +1 -1
  253. package/dist/src/knowledge-memory/usage-policy.js +1 -1
  254. package/dist/src/local-apps/automation-proposals.js +2 -2
  255. package/dist/src/local-apps/capabilities/automation-policy.js +1 -1
  256. package/dist/src/local-apps/capabilities/delegate.js +4 -4
  257. package/dist/src/local-apps/execution-authority.js +2 -2
  258. package/dist/src/local-apps/p1-services.js +3 -3
  259. package/dist/src/local-apps/preview-worker.js +1 -1
  260. package/dist/src/local-apps/service.js +2 -2
  261. package/dist/src/mcp/gateway-http-client.js +1 -1
  262. package/dist/src/media-shared/http/file-response.d.ts +3 -0
  263. package/dist/src/media-shared/http/file-response.js +31 -0
  264. package/dist/src/memory-learning/choice-observations.js +6 -6
  265. package/dist/src/memory-learning/source-learning.js +4 -4
  266. package/dist/src/memory-learning/task-receipts.js +1 -1
  267. package/dist/src/memory-learning/work-capture.js +1 -1
  268. package/dist/src/memory-learning/work-review.js +2 -2
  269. package/dist/src/music-generation/artifact.d.ts +1 -1
  270. package/dist/src/music-generation/artifact.js +4 -18
  271. package/dist/src/notes/service.js +1 -1
  272. package/dist/src/personal-agent/capability-service.js +1 -1
  273. package/dist/src/personal-agent/proactivity/routes.js +1 -1
  274. package/dist/src/personal-agent/proactivity/service.js +4 -4
  275. package/dist/src/personal-agent/prompt-context.js +4 -4
  276. package/dist/src/personal-agent/reply-composer.js +4 -4
  277. package/dist/src/personal-agent/request-delivery.js +1 -1
  278. package/dist/src/personal-agent/request-service.js +4 -4
  279. package/dist/src/personal-agent/result-reader.js +1 -1
  280. package/dist/src/personal-agent/service.js +1 -1
  281. package/dist/src/personal-agent/task-cancel.js +1 -1
  282. package/dist/src/phone/cloud-adb-connection.js +1 -1
  283. package/dist/src/projects/capabilities/write.js +2 -2
  284. package/dist/src/projects/index.js +2 -2
  285. package/dist/src/projects/project-service.js +2 -2
  286. package/dist/src/projects/workspace.js +1 -1
  287. package/dist/src/providers/model-catalog-persistence.js +1 -1
  288. package/dist/src/providers/model-registry.js +1 -1
  289. package/dist/src/realtime/compact-run-event.js +5 -1
  290. package/dist/src/session/compact-history.js +6 -3
  291. package/dist/src/session/history-recall-policy.js +2 -2
  292. package/dist/src/session/index.js +1 -1
  293. package/dist/src/session/session-title.js +1 -1
  294. package/dist/src/session/store.js +1 -1
  295. package/dist/src/share/share-landing.d.ts +2 -0
  296. package/dist/src/share/share-landing.js +4 -0
  297. package/dist/src/share/share-store.js +3 -2
  298. package/dist/src/share/share-thumbnail.js +1 -1
  299. package/dist/src/share/share-types.d.ts +4 -0
  300. package/dist/src/share/site-proxy.js +1 -1
  301. package/dist/src/space/repository.d.ts +9 -1
  302. package/dist/src/space/repository.js +75 -30
  303. package/dist/src/storage/sqlite/device-pairing-approval.js +1 -0
  304. package/dist/src/tasks/capabilities/read.js +4 -4
  305. package/dist/src/tasks/capabilities/relations.js +1 -1
  306. package/dist/src/tasks/capabilities/write.js +4 -4
  307. package/dist/src/tasks/home-query-service.js +1 -1
  308. package/dist/src/tasks/index.js +2 -2
  309. package/dist/src/tasks/task-allocation-service.js +4 -4
  310. package/dist/src/tasks/task-application-service.js +2 -2
  311. package/dist/src/tasks/task-contract-planner.js +1 -1
  312. package/dist/src/tasks/task-execution-capabilities.js +1 -1
  313. package/dist/src/tasks/task-handoff-service.js +1 -1
  314. package/dist/src/tasks/task-handoff.js +6 -6
  315. package/dist/src/tasks/task-json-acceptance.js +1 -1
  316. package/dist/src/tasks/task-main-update-decision-service.js +2 -2
  317. package/dist/src/tasks/task-main-update-delivery.js +1 -1
  318. package/dist/src/tasks/task-model-call.js +1 -1
  319. package/dist/src/tasks/task-research-result.js +2 -2
  320. package/dist/src/tasks/task-result-delivery-service.js +1 -1
  321. package/dist/src/tasks/task-retry-service.js +1 -1
  322. package/dist/src/tasks/task-run-coordinator.js +4 -4
  323. package/dist/src/tasks/task-run-dispatcher.js +1 -1
  324. package/dist/src/tui/backends/embedded-backend.js +6 -6
  325. package/dist/src/tui/tui-capabilities.js +2 -2
  326. package/dist/src/tui/tui-commands.js +2 -2
  327. package/dist/src/tui/tui-management.js +6 -6
  328. package/dist/src/tui/tui-skills-autocomplete.js +1 -1
  329. package/dist/src/tui/tui-startup-resources.js +2 -2
  330. package/dist/src/tui/tui.js +4 -4
  331. package/dist/src/user-context/access-policy.js +2 -2
  332. package/dist/src/user-model/bootstrap.js +1 -1
  333. package/dist/src/user-model/capture/executor.js +2 -2
  334. package/dist/src/user-model/index.js +2 -2
  335. package/dist/src/user-model/usage-policy.js +1 -1
  336. package/dist/src/video-generation/artifact.d.ts +1 -1
  337. package/dist/src/video-generation/artifact.js +4 -28
  338. package/dist/src/voice/realtime/conversation-context.js +1 -1
  339. package/dist/src/voice/realtime/memory-context.js +4 -4
  340. package/dist/src/voice/realtime/persona-context.js +1 -1
  341. package/dist/src/voice/realtime/user-context.js +1 -1
  342. package/dist/src/work-discovery/service.js +6 -6
  343. package/package.json +1 -1
  344. package/dist/gateway/static/root/assets/browser-notification-delivery-DmE2FgGc.js +0 -1
  345. package/dist/gateway/static/root/assets/capabilities-page-BFYx0xu5.js +0 -2
  346. package/dist/gateway/static/root/assets/device-connections-panel-XtEX1NcJ.js +0 -1
  347. package/dist/gateway/static/root/assets/file-preview-surface-BOfJPMux.js +0 -1
  348. package/dist/gateway/static/root/assets/gateway-realtime-jIH8iEGO.js +0 -1
  349. package/dist/gateway/static/root/assets/index-Cl5ueYDl.css +0 -1
  350. package/dist/gateway/static/root/assets/index-DYRzuQl_.js +0 -11
  351. package/dist/gateway/static/root/assets/map-pin-DNclV497.js +0 -1
  352. package/dist/gateway/static/root/assets/note-detail-panel-lU1-3mBw.js +0 -7
  353. package/dist/gateway/static/root/assets/product-automation-feedback-BxA2Ype-.js +0 -1
  354. package/dist/gateway/static/root/assets/route-preload-B-OXsVjy.js +0 -2
  355. package/dist/gateway/static/root/assets/routine-panel-BWLC11Ou.js +0 -2
  356. package/dist/gateway/static/root/assets/space-page-DhhqkNGh.js +0 -2
  357. package/dist/gateway/static/root/assets/system-settings-panel-Gu0rWNOv.js +0 -1
  358. package/dist/gateway/static/root/assets/use-composer-attachments-Dnrs5cP1.js +0 -2
  359. package/dist/gateway/static/root/assets/workspace-file-preview-dialog-BlNfLhnV.js +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/chat-page-D7l_0kTV.js","assets/rolldown-runtime-aKtaBQYM.js","assets/marked.esm-8VXEA2AD.js","assets/vendor-react-BOUWij0V.js","assets/preload-helper-Czpn1I53.js","assets/chunk-KS7C4IRE-DIIvxCDx.js","assets/locale-store-CHjsq5NR.js","assets/messages-C7QSnTdg.js","assets/dist-DlirbHVs.js","assets/es2015-CFqg57eW.js","assets/dist-CDSvxjOh.js","assets/createLucideIcon-DPHK1VkS.js","assets/app-window-DXFNqt_0.js","assets/archive-Dz0hferG.js","assets/arrow-left-D880xG-P.js","assets/video-generation-Cec49Jwg.js","assets/arrow-up-D5ZtR1QT.js","assets/product-automation-feedback-BxA2Ype-.js","assets/activity-YogQEteU.js","assets/bot-DjLkhyZL.js","assets/circle-check-C23XjkUj.js","assets/circle-pause-CN9jYH2s.js","assets/clock-3-DnrAnuyZ.js","assets/external-link-DjqjBmc3.js","assets/loader-circle-CifKLtgG.js","assets/message-square-fVE7Ghj1.js","assets/pause-DuPxgSxk.js","assets/play-kxZvpBg8.js","assets/rotate-ccw-JM1TBLpp.js","assets/rotate-cw-LIg3Am9S.js","assets/sparkles-DHlfQFAF.js","assets/triangle-alert-2JXFNNKU.js","assets/volume-2-BSJhAY97.js","assets/zap-dximCGjy.js","assets/cn-0WouolD0.js","assets/bundle-mjs-rHxsej31.js","assets/session-manager-CVNlrzFB.js","assets/schemas-CCWMleym.js","assets/turn-outcome-BSbEJx8h.js","assets/product-delivery-4gEqUIsK.js","assets/session-api-CR3NLqvs.js","assets/gateway-startup-retry-DgmvR-hb.js","assets/local-session-drafts-CGSV1RQg.js","assets/tool-activity-BtJkgjFf.js","assets/attachment-utils-core-BPYdUI6y.js","assets/gateway-realtime-jIH8iEGO.js","assets/gateway-realtime-store-CTWm23Qi.js","assets/playback-coordinator-CWHIf0wr.js","assets/registry-api-CDpUAb2R.js","assets/agents-admin-api-DSr-PWuW.js","assets/gateway-config-swr-BD-ams0X.js","assets/vendor-swr-CdRzEUwF.js","assets/button-C5tRaJxt.js","assets/automation-api-D-gn6x5E.js","assets/earth-C9Z4bTTG.js","assets/check-DUBLcKHA.js","assets/chevron-down-ccbiQQz_.js","assets/chevron-right-BweFrslA.js","assets/working-directory-picker-modal-DgM21YVT.js","assets/file-archive-DanfQJNe.js","assets/interaction-BdhHBbYa.js","assets/form-field-width-DJw_jULe.js","assets/settings-form-draft-Dy10ldo8.js","assets/popover-select-hRG1EzAY.js","assets/skeleton-DzdOeGYz.js","assets/dist-BSVQC3i_.js","assets/dist-DSRLZhL9.js","assets/floating-ui.dom-CiMnRY5O.js","assets/floating-ui.react-dom-Gx6CM22l.js","assets/settings-shell-dialog-layer-BU3UuiJr.js","assets/circle-alert-BEjgurr2.js","assets/send-1f1Ntw6E.js","assets/circle-x-DFsCKeya.js","assets/circle-BoO4YvTx.js","assets/file-tree-utils-DJs1faGv.js","assets/copy-Dv6d4Dvw.js","assets/database-CjjeZfRG.js","assets/download-Dk-ZjtO6.js","assets/ellipsis-0k4rZLoy.js","assets/file-code-corner-byQA1VfD.js","assets/file-image-CDUPkZvG.js","assets/file-text-D12HbeVy.js","assets/file-CStvVK2S.js","assets/folder-kanban-CpLlFI1o.js","assets/folder-open-CyzJ19I9.js","assets/folder-CN-pC3XL.js","assets/git-branch-Dh9uxTot.js","assets/globe-DSSGFWFn.js","assets/history-DXH_9jsE.js","assets/notes-api-D5SvfybU.js","assets/markdown-view-ihzUc4ud.js","assets/plus-Q2yW6OE7.js","assets/x-B_N4OPjy.js","assets/app-link-Ji4uewEG.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/xml-_d7dTN2Q.js","assets/mermaid-render-oOellPHt.js","assets/markdown-view-Czi3_WHu.css","assets/chat-chart-block-B83s8HE9.js","assets/key-round-DWbpyU2U.js","assets/laptop-CI3hBVrl.js","assets/link-2-D_ZKYUW7.js","assets/list-checks-BbsExAoq.js","assets/list-todo-CTVRto8O.js","assets/messages-square-BckAJrEW.js","assets/mic-CuUb7zc-.js","assets/monitor-Af5eAvF7.js","assets/use-generated-media-CzRbgtcv.js","assets/install-connector-dialog-CntHi8Rh.js","assets/secret-input-DsjfQmDn.js","assets/eye-CABVeTq0.js","assets/is-masked-secret-DOkL5b_X.js","assets/connectors-api-CRGq-TSw.js","assets/electron-env-DHOGevH3.js","assets/oauth-provider-connect-DGYky6ut.js","assets/cloud-C4-yfnnk.js","assets/models-hub-cache-BrD6r5Qs.js","assets/oauth-api-DnMpUoyx.js","assets/connection-usage-guide-B9hoSOnN.js","assets/connection-usage-BhdQRWgQ.js","assets/paperclip-f1HujQY1.js","assets/pencil-DmIY3Oa-.js","assets/pin-off-BMRv-Kxr.js","assets/refresh-cw-BRlGaq2w.js","assets/save-DRDABU--.js","assets/search-DA7gz22f.js","assets/settings-2-D-csvaET.js","assets/settings-uiTATseT.js","assets/shield-check-BU58siTV.js","assets/smartphone-DSSsQFqA.js","assets/square-DMK_fB-3.js","assets/preview-runtime-pNF_b2oD.js","assets/use-async-resource-BHFGZCY2.js","assets/workspace-api-C8-p66T-.js","assets/files-GdwDamkp.js","assets/index.module-Cd9ENXfk.js","assets/trash-2-DusmjVPV.js","assets/user-round-C9jxPhMR.js","assets/wifi-off-C35sMFUl.js","assets/share-link-dialog-D31jDQN9.js","assets/copy-text-row-gqdh0Bg1.js","assets/wrench-DFb4r8bH.js","assets/tasks-CwyNaa-j.js","assets/specialists-xbB3xL9e.js","assets/api-CGs641OT.js","assets/session-identity-DRFdxntH.js","assets/new-session-preferences-gb411vZP.js","assets/composer-model-config-control-C2Bku39S.js","assets/model-selector-QFZY5XNN.js","assets/open-capability-settings-DQsmJxI7.js","assets/model-sort-_Tz8s_4N.js","assets/cloud-credits-B-nbtkqv.js","assets/space-api-_uKFiASp.js","assets/home-task-actions-C8Fi6GBq.js","assets/capabilities-BaKHutgZ.js","assets/capabilities-abgigXV1.js","assets/right-workspace-store-Cehybf-G.js","assets/phone-workspace-store-DGaibcsi.js","assets/workspace-editor-agent-store-CX8zX9eZ.js","assets/chat-agents-api-CyvBfBbp.js","assets/middleware-Pd0e8Igk.js","assets/composer-payload-handoff-ClWsunJ2.js","assets/voice-input-shortcut-events-DN-_rY5a.js","assets/chunk-D32TOXHM-DQIy-Baq.js","assets/linkify-it-BkqEorO0.js","assets/tool-friendly-title-CJVFJ2Ud.js","assets/use-realtime-voice-BARxeNLd.js","assets/voice-CUfqdnlR.js","assets/composer-notifications-MGKffwC7.js","assets/activity-store-hSe5Nbgk.js","assets/voice-call-context-BM2A4bLz.js","assets/app-chrome-BeB4KgOf.js","assets/page-header-store-NP7MCIaP.js","assets/new-chat-navigation-spnin196.js","assets/loopi-CNtmi9FU.js","assets/loopi-C09I2mNj.css","assets/extension-provider-BGrqW0_n.js","assets/theme-store-CvG266p8.js","assets/extension-message-router-CzVgJn5c.js","assets/agent-avatar-display-D_UDgOr9.js","assets/skill-wire-pattern-BPpeIcCi.js","assets/composer-handoff-params-DBpzHuNo.js","assets/agent-display-names-Bje7vfSn.js","assets/use-directory-picker-C4p7AgWY.js","assets/confirm-dialog-MHCmEEUZ.js","assets/shares-api-BhWvN3LS.js","assets/dist-DaFr5KMw.js","assets/use-composer-attachments-Dnrs5cP1.js","assets/chevron-left-DqFhpbvK.js","assets/use-file-preview-expanded-U5rH80Jf.js","assets/message-square-plus-XP0tGdlV.js","assets/minimize-2-DtOGrlpo.js","assets/constants-D5Z-mUto.js","assets/sliding-tab-list-CmcrqRzN.js","assets/sliding-indicator-hwz0sx3h.js","assets/file-preview-surface-BOfJPMux.js","assets/command-palette-api-YP0zV_Ol.js","assets/skill-list-api-B26hHnXq.js","assets/skill-api-utils-C7V4JVXM.js","assets/automation-task-card-C453Q-Wa.js","assets/automation-display-DaVDNZz8.js","assets/message-circle-Badhj-4D.js","assets/date-picker-DwITf4I2.js","assets/calendar-days-hw_Y-g-s.js","assets/time-picker-otHjbob1.js","assets/dev-view-store-DsjH8x76.js","assets/extension-iframe-host-RWjaucjJ.js","assets/extension-authoritative-grants-DYp2nNol.js","assets/runtime-health-zDkHcOZO.js","assets/api-B3T06TLl.js","assets/terminal-panel-store-Cy90Ix5U.js","assets/agents-app-path-ciChvpCS.js","assets/use-media-query-ady-FgjK.js","assets/oauth-authorization-window-o6URRos4.js","assets/page-context-draft-Bk7jVvAG.js","assets/management-api-FVu7eYXD.js","assets/side-chat-shortcut-BIw-1TTD.js","assets/chat-page-zQeUaawJ.css"])))=>i.map(i=>d[i]);
2
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-Czpn1I53.js";import{_ as a,f as o,t as s}from"./chunk-KS7C4IRE-DIIvxCDx.js";import{a as c,i as l,l as u,n as d}from"./locale-store-CHjsq5NR.js";import{t as f}from"./messages-C7QSnTdg.js";import{a as p,n as m,o as h,r as g,s as _,t as v}from"./dist-DlirbHVs.js";import{t as y}from"./activity-YogQEteU.js";import{t as b}from"./arrow-left-D880xG-P.js";import{a as x,c as S,f as C,i as ee,l as w,n as T,o as E,r as D,s as O,t as k,u as A}from"./automation-display-DaVDNZz8.js";import{i as j,n as M,r as N,t as P}from"./automation-run-list-CM59-qm5.js";import{t as F}from"./check-DUBLcKHA.js";import{t as te}from"./chevron-down-ccbiQQz_.js";import{t as ne}from"./chevron-right-BweFrslA.js";import{n as I,r as L}from"./popover-select-hRG1EzAY.js";import{t as re}from"./circle-alert-BEjgurr2.js";import{t as ie}from"./circle-check-C23XjkUj.js";import{t as R}from"./copy-Dv6d4Dvw.js";import{t as z}from"./ellipsis-0k4rZLoy.js";import{t as ae}from"./eye-CABVeTq0.js";import{t as B}from"./git-branch-Dh9uxTot.js";import{t as V}from"./list-filter-CIPvpfLA.js";import{t as H}from"./loader-circle-CifKLtgG.js";import{t as oe}from"./markdown-view-ihzUc4ud.js";import{t as se}from"./message-circle-Badhj-4D.js";import{t as ce}from"./pause-DuPxgSxk.js";import{t as U}from"./pencil-DmIY3Oa-.js";import{t as le}from"./play-kxZvpBg8.js";import{t as W}from"./plus-Q2yW6OE7.js";import{t as G}from"./refresh-cw-BRlGaq2w.js";import{t as K}from"./search-DA7gz22f.js";import{t as ue}from"./shield-check-BU58siTV.js";import{t as de}from"./sparkles-DHlfQFAF.js";import{t as fe}from"./square-pen-B8FsvqNu.js";import{t as pe}from"./trash-2-DusmjVPV.js";import{t as me}from"./x-B_N4OPjy.js";import{t as he}from"./zap-dximCGjy.js";import{t as q}from"./cn-0WouolD0.js";import{t as J}from"./skeleton-DzdOeGYz.js";import{d as ge}from"./api-CGs641OT.js";import{a as _e}from"./session-api-CR3NLqvs.js";import{N as ve}from"./session-manager-CVNlrzFB.js";import{a as ye,i as be,o as xe}from"./vendor-swr-CdRzEUwF.js";import{t as Se}from"./chat-agents-api-CyvBfBbp.js";import{t as Ce}from"./button-C5tRaJxt.js";import{t as we}from"./page-header-store-NP7MCIaP.js";import{t as Y}from"./automation-api-D-gn6x5E.js";import{n as Te}from"./agent-display-names-Bje7vfSn.js";import{t as X}from"./sliding-tab-list-CmcrqRzN.js";import{t as Ee}from"./refresh-button-DX7bULU5.js";import{a as De,c as Oe,d as ke,f as Ae,i as je,l as Me,m as Ne,o as Pe,p as Fe,r as Ie,s as Le,t as Re,u as ze}from"./dist-DaFr5KMw.js";import{n as Be}from"./model-selector-QFZY5XNN.js";import{a as Ve,c as He,d as Ue,f as We,h as Z,l as Ge,m as Ke,n as qe,o as Je,p as Ye,r as Xe,s as Ze,u as Qe}from"./automation-task-card-C453Q-Wa.js";import{t as $e}from"./time-picker-otHjbob1.js";import{t as et}from"./date-time-picker-ChG1CqR1.js";import{i as tt,n as nt,r as rt,t as it}from"./automation-result-state-B7hq0XOL.js";import{n as at}from"./routine-panel-BWLC11Ou.js";var ot=n(),Q=e(t(),1),$=r(),st=(0,Q.lazy)(()=>i(()=>import(`./chat-page-D7l_0kTV.js`).then(e=>e.n).then(e=>({default:e.ChatPage})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217])));function ct(e){let t=(0,ot.c)(110),{runId:n,automationId:r,projectId:i,language:a,onConfigure:o,onDetails:s,onBack:c}=e,l=a===`zh`,[u,d]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(null),_;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(_=e=>g(e),t[0]=_):_=t[0];let v=_,y;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(y=()=>m(!0),t[1]=y):y=t[1];let x=y,{mutate:S}=ye(),C=(0,Q.useRef)(!1),ee=i??``,w;t[2]!==r||t[3]!==n||t[4]!==ee?(w=[`automation-execution`,r,n,ee],t[2]=r,t[3]=n,t[4]=ee,t[5]=w):w=t[5];let T;t[6]!==r||t[7]!==i||t[8]!==n||t[9]!==l?(T=async()=>{let{run:e}=await Y.getRun(n);if(e.automationId!==r)throw Error(l?`执行记录不属于此自动化`:`Execution does not belong to this automation`);let{automation:t}=await Y.get(r);if(i&&t.projectId!==i)throw Error(l?`执行记录不属于此项目`:`Execution does not belong to this project`);return{run:e,automation:t}},t[6]=r,t[7]=i,t[8]=n,t[9]=l,t[10]=T):T=t[10];let E;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(E={refreshInterval:dt,shouldRetryOnError:!1},t[11]=E):E=t[11];let{data:D,error:O,mutate:k}=be(w,T,E),A=D?.run,j=A?.conversationId,N;t[12]===j?N=t[13]:(N=e=>!!(j&&(e.sessions[j]?.streaming||e.sessions[j]?.sending)),t[12]=j,t[13]=N);let P=ve(N),F;t[14]===j?F=t[15]:(F=j?[`automation-execution-session`,j]:null,t[14]=j,t[15]=F);let te;t[16]===j?te=t[17]:(te=()=>_e(j),t[16]=j,t[17]=te);let ne;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(ne={shouldRetryOnError:!1},t[18]=ne):ne=t[18];let{data:I,error:L,mutate:re}=be(F,te,ne),ie=A?.conversationShared||D?.automation.conversationMode===`continuous`||I?.customData?.latestAutomationRunId!==void 0&&I.customData.latestAutomationRunId!==n,R=!!(I&&(!ie||u)),z=!O&&!!(A&&(!j||ie&&!u&&I&&!L&&(A?.summary||A?.error)||I&&!L&&p)),ae,B;if(t[19]!==z||t[20]!==k||t[21]!==S||t[22]!==A?(ae=()=>{!A||!z||M(A)||A.readAtMs!=null||C.current||(C.current=!0,Y.markRunRead(A.id).then(async()=>{await Promise.all([k(),S(ut)])}).catch(lt).finally(()=>{C.current=!1}))},B=[A,z,k,S],t[19]=z,t[20]=k,t[21]=S,t[22]=A,t[23]=ae,t[24]=B):(ae=t[23],B=t[24]),(0,Q.useEffect)(ae,B),O){let e=O instanceof Error?O.message:l?`执行记录加载失败`:`Could not load execution`,n;t[25]===e?n=t[26]:(n=(0,$.jsx)(`p`,{children:e}),t[25]=e,t[26]=n);let r;t[27]===k?r=t[28]:(r=()=>void k(),t[27]=k,t[28]=r);let i=l?`重试`:`Retry`,a;t[29]!==r||t[30]!==i?(a=(0,$.jsx)(Ce,{onClick:r,children:i}),t[29]=r,t[30]=i,t[31]=a):a=t[31];let o=l?`返回自动化`:`Back to automation`,s;t[32]!==c||t[33]!==o?(s=(0,$.jsx)(Ce,{onClick:c,children:o}),t[32]=c,t[33]=o,t[34]=s):s=t[34];let u;return t[35]!==n||t[36]!==a||t[37]!==s?(u=(0,$.jsxs)(`section`,{role:`alert`,className:`space-y-3 p-5`,children:[n,a,s]}),t[35]=n,t[36]=a,t[37]=s,t[38]=u):u=t[38],u}if(!A){let e;return t[39]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsxs)(`div`,{className:`space-y-4 p-5`,"aria-busy":`true`,children:[(0,$.jsx)(J,{className:`h-6 w-2/3`}),(0,$.jsx)(J,{className:`h-20`})]}),t[39]=e):e=t[39],e}let V;t[40]===A?V=t[41]:(V=M(A),t[40]=A,t[41]=V);let H=V,se=l?`执行会话`:`Execution conversation`,ce=l?`返回自动化`:`Back to automation`,U;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,$.jsx)(b,{className:`size-4`}),t[42]=U):U=t[42];let le;t[43]!==c||t[44]!==ce?(le=(0,$.jsx)(Ce,{variant:`ghost`,className:`shrink-0`,onClick:c,"aria-label":ce,children:U}),t[43]=c,t[44]=ce,t[45]=le):le=t[45];let W;t[46]===A.automationName?W=t[47]:(W=(0,$.jsx)(`h2`,{className:`truncate text-sm font-medium text-fg`,children:A.automationName}),t[46]=A.automationName,t[47]=W);let G;t[48]!==le||t[49]!==W?(G=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[le,W]}),t[48]=le,t[49]=W,t[50]=G):G=t[50];let K;t[51]!==A.createdAtMs||t[52]!==l?(K=new Date(A.createdAtMs).toLocaleString(l?`zh-CN`:`en-US`),t[51]=A.createdAtMs,t[52]=l,t[53]=K):K=t[53];let ue;t[54]===a?ue=t[55]:(ue=f(a),t[54]=a,t[55]=ue);let de=ue.automations.status[A.status],fe;t[56]!==K||t[57]!==de?(fe=(0,$.jsxs)(`span`,{children:[K,` · `,de]}),t[56]=K,t[57]=de,t[58]=fe):fe=t[58];let pe;t[59]!==s||t[60]!==A.id?(pe=()=>s(A.id),t[59]=s,t[60]=A.id,t[61]=pe):pe=t[61];let me=l?`运行详情`:`Run details`,he;t[62]!==pe||t[63]!==me?(he=(0,$.jsx)(`button`,{type:`button`,className:`rounded px-2 py-1.5 text-accent-fg hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,onClick:pe,children:me}),t[62]=pe,t[63]=me,t[64]=he):he=t[64];let q;t[65]!==o||t[66]!==A?(q=()=>o(A),t[65]=o,t[66]=A,t[67]=q):q=t[67];let ge=l?`调整自动化`:`Adjust automation`,xe;t[68]!==q||t[69]!==ge?(xe=(0,$.jsx)(`button`,{type:`button`,className:`rounded px-2 py-1.5 text-accent-fg hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,onClick:q,children:ge}),t[68]=q,t[69]=ge,t[70]=xe):xe=t[70];let Se;t[71]!==fe||t[72]!==he||t[73]!==xe?(Se=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 text-xs text-fg-muted`,children:[fe,he,xe]}),t[71]=fe,t[72]=he,t[73]=xe,t[74]=Se):Se=t[74];let we;t[75]!==D?.automation||t[76]!==ie||t[77]!==l?(we=ie?(0,$.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[l?`多次执行可能共用此会话;下方摘要对应所选执行。`:`Executions may share this conversation. The summary belongs to the selected execution.`,D?.automation.conversationMode===`continuous`?l?`追问会进入后续运行上下文。`:` Follow-ups become context for future runs.`:null]}):null,t[75]=D?.automation,t[76]=ie,t[77]=l,t[78]=we):we=t[78];let Te;t[79]!==h||t[80]!==u||t[81]!==l?(Te=u?(0,$.jsx)(`p`,{role:`status`,className:`text-xs text-fg-muted`,children:h===!0?l?`已定位到所选执行的会话起点。`:`Located the selected execution in this conversation.`:h===!1?l?`旧记录缺少可用的执行定位信息,当前显示完整会话。`:`No matching turn was found in the available history. Showing the full conversation.`:l?`正在定位所选执行…`:`Locating the selected execution…`}):null,t[79]=h,t[80]=u,t[81]=l,t[82]=Te):Te=t[82];let X;t[83]!==H||t[84]!==l?(X=H?(0,$.jsx)(`p`,{role:`status`,className:`text-xs text-fg-muted`,children:l?`执行中,完成后可继续追问。`:`Execution in progress. Follow up after it finishes.`}):null,t[83]=H,t[84]=l,t[85]=X):X=t[85];let Ee;t[86]!==G||t[87]!==Se||t[88]!==we||t[89]!==Te||t[90]!==X?(Ee=(0,$.jsxs)(`header`,{className:`shrink-0 space-y-2 border-b border-edge px-4 py-3`,children:[G,Se,we,Te,X]}),t[86]=G,t[87]=Se,t[88]=we,t[89]=Te,t[90]=X,t[91]=Ee):Ee=t[91];let De;t[92]!==H||t[93]!==j||t[94]!==P||t[95]!==I||t[96]!==a||t[97]!==re||t[98]!==A.error||t[99]!==A.id||t[100]!==A.summary||t[101]!==L||t[102]!==ie||t[103]!==R||t[104]!==l?(De=R?(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(J,{className:`m-5 h-40`}),children:(0,$.jsx)(st,{embedded:!0,automationExecution:!0,conversationId:j,readOnly:H||P,onHistoryReady:x,initialTurnId:ie?A.id:void 0,onInitialTurnLocated:v},j)}):(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-5`,children:[A.summary?(0,$.jsx)(oe,{content:A.summary}):null,A.error?(0,$.jsx)(`p`,{className:`whitespace-pre-wrap text-sm text-danger`,children:A.error}):null,j?null:(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:H?l?`等待执行会话,开始后会自动更新。`:`Waiting for the execution conversation. This view updates automatically.`:l?`本次执行没有关联会话,可查看运行结果和详情。`:`No conversation is associated with this execution. Results and diagnostics remain available.`}),j&&!I&&!L?(0,$.jsx)(J,{className:`h-24`}):null,L?(0,$.jsxs)(`div`,{role:`alert`,className:`space-y-2 text-sm text-fg-muted`,children:[(0,$.jsx)(`p`,{children:L.status===404?l?`执行会话已删除,运行结果仍保留。`:`The execution conversation was deleted. Results are still available.`:l?`执行会话暂时无法读取,运行结果仍保留。`:`The conversation is unavailable. Results are still available.`}),(0,$.jsx)(Ce,{onClick:()=>void re(),children:l?`重试`:`Retry`})]}):null,ie&&I?(0,$.jsx)(Ce,{variant:`secondary`,onClick:()=>d(!0),children:l?`打开共享会话`:`Open shared conversation`}):null,H?null:(0,$.jsx)(tt,{runId:A.id,language:a})]}),t[92]=H,t[93]=j,t[94]=P,t[95]=I,t[96]=a,t[97]=re,t[98]=A.error,t[99]=A.id,t[100]=A.summary,t[101]=L,t[102]=ie,t[103]=R,t[104]=l,t[105]=De):De=t[105];let Oe;return t[106]!==se||t[107]!==Ee||t[108]!==De?(Oe=(0,$.jsxs)(`section`,{className:`flex h-full min-h-0 min-w-0 flex-col overflow-hidden`,"aria-label":se,children:[Ee,De]}),t[106]=se,t[107]=Ee,t[108]=De,t[109]=Oe):Oe=t[109],Oe}function lt(){}function ut(e){return Array.isArray(e)&&[`automations`,`automation-runs`,`automation-history`,`automation-navigation-runs`].includes(String(e[0]))||e===`automations-global-system-source`}function dt(e){return e&&M(e.run)?3e3:15e3}function ft(e){let t=(0,ot.c)(44),{automation:n,language:r,busy:i,onEdit:a,onAction:o}=e,s=r===`zh`,c=n.management,l=s?`${n.name}的更多操作`:`More actions for ${n.name}`,u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,$.jsx)(z,{className:`size-4`}),t[0]=u):u=t[0];let d;t[1]===l?d=t[2]:(d=(0,$.jsx)(Ne,{asChild:!0,children:(0,$.jsx)(Ce,{variant:`ghost`,className:`size-8 p-0`,"aria-label":l,children:u})}),t[1]=l,t[2]=d);let f;t[3]!==n||t[4]!==i||t[5]!==c||t[6]!==o||t[7]!==s?(f=(!c||c.editable.includes(`enabled`))&&!A(n)?(0,$.jsxs)(Ie,{className:`flex cursor-pointer items-center gap-2 rounded-md px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover data-[disabled]:opacity-50`,disabled:i,onSelect:()=>void o(`automation:${n.id}:toggle`,()=>n.enabled?Y.pause(n.id):Y.resume(n.id)),children:[n.enabled?(0,$.jsx)(ce,{className:`size-4`}):(0,$.jsx)(le,{className:`size-4`}),n.enabled?s?`暂停`:`Pause`:s?`恢复`:`Resume`]}):null,t[3]=n,t[4]=i,t[5]=c,t[6]=o,t[7]=s,t[8]=f):f=t[8];let p;t[9]!==n.id||t[10]!==i||t[11]!==c||t[12]!==o||t[13]!==s?(p=!c||c.runnable?(0,$.jsxs)(Ie,{className:`flex cursor-pointer items-center gap-2 rounded-md px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover data-[disabled]:opacity-50`,disabled:i,onSelect:()=>void o(`automation:${n.id}:run`,()=>Y.runNow(n.id)),children:[(0,$.jsx)(le,{className:`size-4`}),s?`立即运行`:`Run now`]}):null,t[9]=n.id,t[10]=i,t[11]=c,t[12]=o,t[13]=s,t[14]=p):p=t[14];let m;t[15]!==n||t[16]!==i||t[17]!==c||t[18]!==a||t[19]!==s?(m=!c||c.editable.includes(`trigger`)?(0,$.jsxs)(Ie,{className:`flex cursor-pointer items-center gap-2 rounded-md px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover data-[disabled]:opacity-50`,disabled:i,onSelect:()=>a(n),children:[(0,$.jsx)(U,{className:`size-4`}),s?`编辑`:`Edit`]}):null,t[15]=n,t[16]=i,t[17]=c,t[18]=a,t[19]=s,t[20]=m):m=t[20];let h;t[21]!==n.id||t[22]!==o||t[23]!==s?(h=()=>void o(`automation:${n.id}:copy-link`,()=>navigator.clipboard.writeText(`${window.location.origin}${window.location.pathname}#/automations?automation=${encodeURIComponent(n.id)}`),s?`任务链接已复制`:`Task link copied`),t[21]=n.id,t[22]=o,t[23]=s,t[24]=h):h=t[24];let g;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsx)(R,{className:`size-4`}),t[25]=g):g=t[25];let _=s?`复制任务链接`:`Copy task link`,v;t[26]!==h||t[27]!==_?(v=(0,$.jsxs)(Ie,{className:`flex cursor-pointer items-center gap-2 rounded-md px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover data-[disabled]:opacity-50`,onSelect:h,children:[g,_]}),t[26]=h,t[27]=_,t[28]=v):v=t[28];let y;t[29]!==n.id||t[30]!==i||t[31]!==c||t[32]!==o||t[33]!==s?(y=!c||c.deletable?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ze,{className:`my-1 h-px bg-edge-subtle`}),(0,$.jsxs)(Ie,{className:`flex cursor-pointer items-center gap-2 rounded-md px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover data-[disabled]:opacity-50 text-danger`,disabled:i,onSelect:()=>{window.confirm(s?`删除这个定时任务?已保存的对话仍可查看。`:`Delete this scheduled task? Saved conversations will remain available.`)&&o(`automation:${n.id}:delete`,()=>Y.remove(n.id))},children:[(0,$.jsx)(pe,{className:`size-4`}),s?`删除`:`Delete`]})]}):null,t[29]=n.id,t[30]=i,t[31]=c,t[32]=o,t[33]=s,t[34]=y):y=t[34];let b;t[35]!==v||t[36]!==y||t[37]!==f||t[38]!==p||t[39]!==m?(b=(0,$.jsx)(Pe,{children:(0,$.jsxs)(Re,{align:`end`,sideOffset:4,className:`z-70 min-w-44 rounded-xl border border-edge bg-surface-overlay p-1 shadow-popover`,children:[f,p,m,v,y]})}),t[35]=v,t[36]=y,t[37]=f,t[38]=p,t[39]=m,t[40]=b):b=t[40];let x;return t[41]!==b||t[42]!==d?(x=(0,$.jsxs)(Me,{children:[d,b]}),t[41]=b,t[42]=d,t[43]=x):x=t[43],x}function pt({automations:e,runs:t,labels:n,cronLabels:r,language:i,selectedAutomationId:a,selectedRunId:o,selectedRun:s,projectId:c,executionSummaries:l,onSelectRun:d,onOpenDetails:f,busy:p,onEdit:m,onAction:h}){let g=`xopc.automation-navigation:${u(e=>e.baseUrl)}:${u(e=>e.conversationId)??`local`}`,[_,v]=(0,Q.useState)(()=>{try{let e=JSON.parse(localStorage.getItem(g)??`{}`);return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}catch{return{}}});(0,Q.useEffect)(()=>{try{let e=JSON.parse(localStorage.getItem(g)??`{}`);v(e&&typeof e==`object`&&!Array.isArray(e)?e:{})}catch{v({})}},[g]);let y=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{!a||y.current===a||(y.current=a,v(e=>({...e,[a]:!0})))},[a]);let b=e=>v(t=>{let n={...t,[e]:!t[e]};try{localStorage.setItem(g,JSON.stringify(n))}catch{}return n});return e.length===0?(0,$.jsx)(`p`,{className:`p-4 text-sm text-fg-muted`,children:n.empty.filtered}):(0,$.jsx)(`div`,{className:`min-h-0 overflow-y-auto divide-y divide-edge-subtle`,children:e.map(e=>{let u=t.filter(t=>t.automationId===e.id).sort((e,t)=>t.createdAtMs-e.createdAtMs),g=u.find(M);return(0,$.jsxs)(`div`,{className:`group relative`,children:[(0,$.jsx)(`button`,{type:`button`,"aria-expanded":!!_[e.id],"aria-controls":`automation-runs-${e.id}`,"aria-label":i===`zh`?`${_[e.id]?`收起`:`展开`} ${e.name} 的执行记录`:`${_[e.id]?`Collapse`:`Expand`} executions for ${e.name}`,className:`absolute left-1 top-2 z-10 rounded-md p-2 text-fg-muted hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,onClick:()=>b(e.id),children:_[e.id]?(0,$.jsx)(te,{className:`size-4`}):(0,$.jsx)(ne,{className:`size-4`})}),(0,$.jsxs)(`button`,{type:`button`,className:q(`block w-full p-3 pl-9 pr-10 text-left outline-none hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,a===e.id&&!o&&`bg-surface-hover`),style:{contentVisibility:`auto`,containIntrinsicSize:`auto 76px`},"aria-current":a===e.id&&!o?`true`:void 0,onClick:()=>f(e.id),children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(`span`,{className:q(`size-2 shrink-0 rounded-full`,g?`bg-blue-500`:nt(e,u)?`bg-red-500`:e.enabled?`bg-emerald-500`:`bg-fg-subtle`)}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm font-medium text-fg`,children:e.name}),(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:A(e)?i===`zh`?`已完成`:`Completed`:e.enabled?n.enabled:n.paused}),(l?.[e.id]?.unreadCount??0)>0?(0,$.jsx)(`span`,{className:`ml-auto size-2 shrink-0 rounded-full bg-blue-500`,children:(0,$.jsx)(`span`,{className:`sr-only`,children:n.filters.unread})}):null]}),(0,$.jsxs)(`p`,{className:`mt-1 truncate pl-4 text-xs leading-5 text-fg-muted`,children:[e.enabled?(0,$.jsxs)($.Fragment,{children:[D(e,n,i),(0,$.jsx)(`span`,{className:`mx-1.5`,children:`·`})]}):null,ee(e.trigger,n,r,i)]}),nt(e,u)?(0,$.jsx)(`p`,{className:`mt-1 pl-4 text-xs text-red-700 dark:text-red-300`,children:n.dashboard.needsAttention}):null]}),(0,$.jsx)(`div`,{id:`automation-runs-${e.id}`,hidden:!_[e.id],children:(0,$.jsx)(P,{automationId:e.id,projectId:c,language:i,selectedRunId:o,selectedRun:s,enabled:!!_[e.id],onSelectRun:d})}),(0,$.jsx)(`div`,{className:`absolute right-1 top-2 opacity-100 sm:opacity-0 sm:group-hover:opacity-100 sm:group-focus-within:opacity-100`,children:(0,$.jsx)(ft,{automation:e,language:i,busy:p,onEdit:m,onAction:h})})]},e.id)})})}var mt=`xopc.automations.listWidth`,ht=272,gt=200,_t=560;function vt({children:e,language:t,busy:n}){let r=(0,Q.useRef)(null),i=(0,Q.useRef)(null),[a,o]=(0,Q.useState)(!1),[s,c]=(0,Q.useState)(()=>{try{let e=Number(window.localStorage.getItem(mt));if(Number.isFinite(e)&&e>=gt&&e<=_t)return e}catch{}return ht});(0,Q.useEffect)(()=>{try{window.localStorage.setItem(mt,String(s))}catch{}},[s]),(0,Q.useEffect)(()=>{if(!a)return;let{cursor:e,userSelect:t}=document.body.style;return document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`,()=>{document.body.style.cursor=e,document.body.style.userSelect=t}},[a]);let l=e=>{let t=r.current?.getBoundingClientRect().width??1e3,n=Math.max(gt,Math.min(_t,t*.6,t-292));return Math.round(Math.max(gt,Math.min(n,e)))},u=t===`zh`?`调整任务列表宽度`:`Resize task list`;return(0,$.jsxs)(`section`,{ref:r,"aria-busy":n,className:`grid min-h-0 min-w-0 flex-1 grid-rows-[auto_minmax(0,1fr)] gap-y-3 md:grid-cols-[minmax(0,min(var(--automation-list-width),60%))_0.75rem_minmax(0,1fr)] md:grid-rows-1 md:gap-y-0`,style:{"--automation-list-width":`${s}px`},children:[e[0],(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":u,"aria-valuemin":gt,"aria-valuemax":_t,"aria-valuenow":s,tabIndex:0,title:t===`zh`?`左右拖动调整宽度,双击恢复默认`:`Drag to resize, double-click to reset`,className:`relative hidden touch-none select-none cursor-col-resize focus-visible:outline-accent md:block`,onPointerDown:e=>{if(e.button!==0)return;e.preventDefault(),e.currentTarget.setPointerCapture(e.pointerId);let t=e.currentTarget.previousElementSibling?.getBoundingClientRect().width??s;i.current={pointerId:e.pointerId,startX:e.clientX,startWidth:t},o(!0)},onPointerMove:e=>{let t=i.current;t?.pointerId===e.pointerId&&c(l(t.startWidth+e.clientX-t.startX))},onPointerUp:e=>{i.current?.pointerId===e.pointerId&&(i.current=null,o(!1),e.currentTarget.releasePointerCapture(e.pointerId))},onPointerCancel:()=>{i.current=null,o(!1)},onLostPointerCapture:()=>{i.current=null,o(!1)},onDoubleClick:()=>c(ht),onKeyDown:e=>{[`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(e.key)&&(e.preventDefault(),c(l(e.key===`Home`?gt:e.key===`End`?_t:s+(e.key===`ArrowLeft`?-16:16))))}}),e[1]]})}var yt=(0,Q.lazy)(()=>i(()=>import(`./chat-page-D7l_0kTV.js`).then(e=>e.n).then(e=>({default:e.ChatPage})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217])));function bt(e){let t=(0,ot.c)(51),{automation:n,conversationId:r,runs:i,language:a,onSelectRun:o,onConfigured:s}=e,c=n?.id,l;t[0]!==c||t[1]!==r?(l=c&&!r?[`automation-workspace-chat`,c]:null,t[0]=c,t[1]=r,t[2]=l):l=t[2];let u;t[3]===c?u=t[4]:(u=()=>Y.openConfiguration({automationId:c}),t[3]=c,t[4]=u);let d;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(d={revalidateOnFocus:!1,revalidateOnReconnect:!1,shouldRetryOnError:!1},t[5]=d):d=t[5];let{data:p,error:m,mutate:h}=be(l,u,d),g;t[6]===r?g=t[7]:(g=r?[`automation-configuration`,r]:null,t[6]=r,t[7]=g);let _;t[8]===r?_=t[9]:(_=()=>Y.configuration(r),t[8]=r,t[9]=_);let v;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(v={refreshInterval:3e3},t[10]=v):v=t[10];let{data:y}=be(g,_,v),b,x;t[11]!==n||t[12]!==s||t[13]!==y?(b=()=>{!n&&y?.automation&&s?.(y.automation.id)},x=[n,y,s],t[11]=n,t[12]=s,t[13]=y,t[14]=b,t[15]=x):(b=t[14],x=t[15]),(0,Q.useEffect)(b,x);let S=r??p?.conversationId,{mutate:C}=ye(),ee;t[16]===S?ee=t[17]:(ee=e=>!!(S&&(e.sessions[S]?.streaming||e.sessions[S]?.sending)),t[16]=S,t[17]=ee);let w=ve(ee),T=(0,Q.useRef)(!1),E,D;t[18]!==C||t[19]!==w?(E=()=>{T.current&&!w&&C(xt),T.current=w},D=[w,C],t[18]=C,t[19]=w,t[20]=E,t[21]=D):(E=t[20],D=t[21]),(0,Q.useEffect)(E,D);let O=a===`zh`,k;t[22]===a?k=t[23]:(k=f(a),t[22]=a,t[23]=k);let A=k,j;if(t[24]!==a||t[25]!==A.automations.status||t[26]!==o||t[27]!==i||t[28]!==O){let e;t[30]!==a||t[31]!==A.automations.status||t[32]!==o||t[33]!==O?(e=e=>({id:`automation-run:${e.id}`,timestamp:e.createdAtMs,content:(0,$.jsxs)(`article`,{className:`mx-auto w-full max-w-[var(--max-width-chat-frame)] space-y-3 py-3`,"aria-label":O?`任务运行结果`:`Task run result`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-xs text-fg-muted`,children:[(0,$.jsxs)(`span`,{children:[new Date(e.createdAtMs).toLocaleString(O?`zh-CN`:`en-US`,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}),` · `,A.automations.status[e.status]]}),(0,$.jsx)(`button`,{type:`button`,className:`rounded-md px-2 py-1.5 hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,onClick:()=>o(e.id),children:O?`查看详情`:`View details`})]}),e.error?(0,$.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-6 text-danger`,children:rt(e,a)}):e.summary?(0,$.jsx)(oe,{content:e.summary}):(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:O?`正在执行,结果会显示在这里。`:`Running. The result will appear here.`}),e.status===`failed`||e.status===`timeout`?(0,$.jsx)(qe,{automationId:e.automationId,runId:e.id,language:a,variant:`secondary`}):null,[`queued`,`running`,`cancelling`].includes(e.status)?null:(0,$.jsx)(tt,{runId:e.id,language:a})]})}),t[30]=a,t[31]=A.automations.status,t[32]=o,t[33]=O,t[34]=e):e=t[34],j=i.map(e),t[24]=a,t[25]=A.automations.status,t[26]=o,t[27]=i,t[28]=O,t[29]=j}else j=t[29];let M=j;if(m){let e=O?`暂时无法打开任务对话。`:`Could not open the task conversation.`,n;t[35]===e?n=t[36]:(n=(0,$.jsx)(`p`,{children:e}),t[35]=e,t[36]=n);let r;t[37]===h?r=t[38]:(r=()=>void h(),t[37]=h,t[38]=r);let i=O?`重试`:`Retry`,a;t[39]!==r||t[40]!==i?(a=(0,$.jsx)(Ce,{variant:`secondary`,onClick:r,children:i}),t[39]=r,t[40]=i,t[41]=a):a=t[41];let o;return t[42]!==n||t[43]!==a?(o=(0,$.jsxs)(`div`,{role:`alert`,className:`p-6 text-sm text-fg-muted`,children:[n,a]}),t[42]=n,t[43]=a,t[44]=o):o=t[44],o}let N=O?`任务对话`:`Task conversation`,P;t[45]!==M||t[46]!==S?(P=S?(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(J,{className:`m-5 h-40`}),children:(0,$.jsx)(yt,{embedded:!0,conversationId:S,automationWorkspace:!0,automationTimelineEntries:M},S)}):(0,$.jsxs)(`div`,{className:`space-y-4 p-6`,children:[(0,$.jsx)(J,{className:`h-20 w-2/3`}),(0,$.jsx)(J,{className:`h-28`})]}),t[45]=M,t[46]=S,t[47]=P):P=t[47];let F;return t[48]!==N||t[49]!==P?(F=(0,$.jsx)(`section`,{className:`flex h-full min-h-0 min-w-0 flex-col overflow-hidden`,"aria-label":N,children:P}),t[48]=N,t[49]=P,t[50]=F):F=t[50],F}function xt(e){return Array.isArray(e)&&[`automations`,`automation-runs`,`automation-history`,`automation-configuration`].includes(String(e[0]))}var St=`relative flex min-h-9 cursor-pointer items-center rounded-md py-2 pl-3 pr-8 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover`,Ct=`z-70 max-h-[min(32rem,calc(100dvh-2rem))] min-w-52 overflow-y-auto rounded-xl border border-edge bg-surface-overlay p-1.5 shadow-popover`;function wt(e){let t=(0,ot.c)(4),{value:n,children:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsx)(je,{className:`absolute right-2.5`,children:(0,$.jsx)(F,{className:`size-3.5`,"aria-hidden":!0})}),t[0]=i):i=t[0];let a;return t[1]!==r||t[2]!==n?(a=(0,$.jsxs)(Oe,{value:n,className:St,children:[i,r]}),t[1]=r,t[2]=n,t[3]=a):a=t[3],a}function Tt(e){let t=(0,ot.c)(131),{language:n,labels:r,filter:i,ownership:a,source:o,projectId:s,projects:c,projectLocked:l,query:u,unreadCount:d,markReadBusy:f,onFilter:p,onOwnership:m,onSource:h,onProject:g,onQuery:_,onClear:v,onMarkAllRead:y}=e,b=n===`zh`,[x,S]=(0,Q.useState)(!1),C=(0,Q.useRef)(null),ee=(0,Q.useRef)(null),w=x||!!u,T=i!==`all`||o!==`all`||a!==`user`||!l&&!!s,E;t[0]===_?E=t[1]:(E=()=>{_(``),S(!1),ee.current?.focus()},t[0]=_,t[1]=E);let D=E,O=b?`定时任务`:`Scheduled tasks`,k;t[2]===O?k=t[3]:(k=(0,$.jsx)(`h2`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:O}),t[2]=O,t[3]=k);let A=b?`筛选任务`:`Filter tasks`,M=b?`筛选任务`:`Filter tasks`,N=T&&`text-accent-fg`,P;t[4]===N?P=t[5]:(P=q(`relative rounded-md p-2 text-fg-muted hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent data-[state=open]:bg-surface-hover`,N),t[4]=N,t[5]=P);let F;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,$.jsx)(V,{className:`size-4`,"aria-hidden":!0}),t[6]=F):F=t[6];let te;t[7]!==T||t[8]!==b?(te=T?(0,$.jsx)(`span`,{className:`absolute right-1.5 top-1.5 size-1 rounded-full bg-accent`,children:(0,$.jsx)(`span`,{className:`sr-only`,children:b?`已应用筛选`:`Filters applied`})}):null,t[7]=T,t[8]=b,t[9]=te):te=t[9];let I;t[10]!==A||t[11]!==M||t[12]!==P||t[13]!==te?(I=(0,$.jsx)(Ne,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,"aria-label":A,title:M,className:P,children:[F,te]})}),t[10]=A,t[11]=M,t[12]=P,t[13]=te,t[14]=I):I=t[14];let L=b?`状态`:`Status`,re;t[15]===L?re=t[16]:(re=(0,$.jsx)(De,{className:`px-3 py-1.5 text-xs text-fg-subtle`,children:L}),t[15]=L,t[16]=re);let ie;t[17]===p?ie=t[18]:(ie=e=>p(e),t[17]=p,t[18]=ie);let R=b?`全部状态`:`All statuses`,z;t[19]===R?z=t[20]:(z=(0,$.jsx)(wt,{value:`all`,children:R}),t[19]=R,t[20]=z);let ae;t[21]===r.filters.active?ae=t[22]:(ae=(0,$.jsx)(wt,{value:`active`,children:r.filters.active}),t[21]=r.filters.active,t[22]=ae);let B;t[23]===r.paused?B=t[24]:(B=(0,$.jsx)(wt,{value:`paused`,children:r.paused}),t[23]=r.paused,t[24]=B);let oe=b?`已完成`:`Completed`,se;t[25]===oe?se=t[26]:(se=(0,$.jsx)(wt,{value:`completed`,children:oe}),t[25]=oe,t[26]=se);let ce;t[27]===r.metrics.running?ce=t[28]:(ce=(0,$.jsx)(wt,{value:`running`,children:r.metrics.running}),t[27]=r.metrics.running,t[28]=ce);let U;t[29]===r.dashboard.needsAttention?U=t[30]:(U=(0,$.jsx)(wt,{value:`attention`,children:r.dashboard.needsAttention}),t[29]=r.dashboard.needsAttention,t[30]=U);let le;t[31]!==i||t[32]!==ie||t[33]!==z||t[34]!==ae||t[35]!==B||t[36]!==se||t[37]!==ce||t[38]!==U?(le=(0,$.jsxs)(Le,{value:i,onValueChange:ie,children:[z,ae,B,se,ce,U]}),t[31]=i,t[32]=ie,t[33]=z,t[34]=ae,t[35]=B,t[36]=se,t[37]=ce,t[38]=U,t[39]=le):le=t[39];let W;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,$.jsx)(ze,{className:`my-1 border-t border-edge`}),t[40]=W):W=t[40];let G=b?`归属`:`Owner`,ue;t[41]===G?ue=t[42]:(ue=(0,$.jsx)(De,{className:`px-3 py-1.5 text-xs text-fg-subtle`,children:G}),t[41]=G,t[42]=ue);let de;t[43]===m?de=t[44]:(de=e=>m(e),t[43]=m,t[44]=de);let fe=b?`我的任务`:`My tasks`,pe;t[45]===fe?pe=t[46]:(pe=(0,$.jsx)(wt,{value:`user`,children:fe}),t[45]=fe,t[46]=pe);let he=b?`系统任务`:`System tasks`,J;t[47]===he?J=t[48]:(J=(0,$.jsx)(wt,{value:`system`,children:he}),t[47]=he,t[48]=J);let ge;t[49]!==a||t[50]!==de||t[51]!==pe||t[52]!==J?(ge=(0,$.jsxs)(Le,{value:a,onValueChange:de,children:[pe,J]}),t[49]=a,t[50]=de,t[51]=pe,t[52]=J,t[53]=ge):ge=t[53];let _e;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(_e=(0,$.jsx)(ze,{className:`my-1 border-t border-edge`}),t[54]=_e):_e=t[54];let ve;t[55]!==r.filters.allProjects||t[56]!==g||t[57]!==s||t[58]!==l||t[59]!==c||t[60]!==b?(ve=l?null:(0,$.jsxs)(ke,{children:[(0,$.jsxs)(Fe,{className:`flex min-h-9 cursor-pointer items-center justify-between gap-4 rounded-md px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover`,children:[b?`项目`:`Project`,(0,$.jsx)(`span`,{className:`ml-auto max-w-28 truncate text-xs text-fg-muted`,children:c.find(e=>e.id===s)?.name??r.filters.allProjects}),(0,$.jsx)(ne,{className:`size-3.5 text-fg-subtle`,"aria-hidden":!0})]}),(0,$.jsx)(Pe,{children:(0,$.jsx)(Ae,{sideOffset:4,className:Ct,children:(0,$.jsxs)(Le,{value:s,onValueChange:g,children:[(0,$.jsx)(wt,{value:``,children:r.filters.allProjects}),c.map(Et)]})})})]}),t[55]=r.filters.allProjects,t[56]=g,t[57]=s,t[58]=l,t[59]=c,t[60]=b,t[61]=ve):ve=t[61];let ye=b?`任务类型`:`Task type`,be;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(be=(0,$.jsx)(ne,{className:`size-3.5 text-fg-subtle`,"aria-hidden":!0}),t[62]=be):be=t[62];let xe;t[63]===ye?xe=t[64]:(xe=(0,$.jsxs)(Fe,{className:`flex min-h-9 cursor-pointer items-center justify-between gap-4 rounded-md px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover`,children:[ye,be]}),t[63]=ye,t[64]=xe);let Se;t[65]===h?Se=t[66]:(Se=e=>h(e),t[65]=h,t[66]=Se);let Ce=b?`全部类型`:`All types`,we;t[67]===Ce?we=t[68]:(we=(0,$.jsx)(wt,{value:`all`,children:Ce}),t[67]=Ce,t[68]=we);let Y;t[69]===r.sources.agent?Y=t[70]:(Y=(0,$.jsx)(wt,{value:`agent`,children:r.sources.agent}),t[69]=r.sources.agent,t[70]=Y);let Te;t[71]===r.sources.task?Te=t[72]:(Te=(0,$.jsx)(wt,{value:`task_command`,children:r.sources.task}),t[71]=r.sources.task,t[72]=Te);let X;t[73]!==o||t[74]!==Se||t[75]!==we||t[76]!==Y||t[77]!==Te?(X=(0,$.jsx)(Pe,{children:(0,$.jsx)(Ae,{sideOffset:4,className:Ct,children:(0,$.jsxs)(Le,{value:o,onValueChange:Se,children:[we,Y,Te]})})}),t[73]=o,t[74]=Se,t[75]=we,t[76]=Y,t[77]=Te,t[78]=X):X=t[78];let Ee;t[79]!==xe||t[80]!==X?(Ee=(0,$.jsxs)(ke,{children:[xe,X]}),t[79]=xe,t[80]=X,t[81]=Ee):Ee=t[81];let Oe;t[82]!==T||t[83]!==v||t[84]!==u||t[85]!==b?(Oe=T||u?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ze,{className:`my-1 border-t border-edge`}),(0,$.jsx)(Ie,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-fg-muted outline-none data-[highlighted]:bg-surface-hover`,onSelect:v,children:b?`重置筛选`:`Reset filters`})]}):null,t[82]=T,t[83]=v,t[84]=u,t[85]=b,t[86]=Oe):Oe=t[86];let je;t[87]!==re||t[88]!==le||t[89]!==ue||t[90]!==ge||t[91]!==ve||t[92]!==Ee||t[93]!==Oe?(je=(0,$.jsx)(Pe,{children:(0,$.jsxs)(Re,{align:`end`,sideOffset:6,className:Ct,children:[re,le,W,ue,ge,_e,ve,Ee,Oe]})}),t[87]=re,t[88]=le,t[89]=ue,t[90]=ge,t[91]=ve,t[92]=Ee,t[93]=Oe,t[94]=je):je=t[94];let Be;t[95]!==I||t[96]!==je?(Be=(0,$.jsxs)(Me,{children:[I,je]}),t[95]=I,t[96]=je,t[97]=Be):Be=t[97];let Ve=b?`搜索任务`:`Search tasks`,He=b?`搜索任务`:`Search tasks`,Ue;t[98]!==D||t[99]!==w?(Ue=()=>{w?D():(S(!0),requestAnimationFrame(()=>C.current?.focus()))},t[98]=D,t[99]=w,t[100]=Ue):Ue=t[100];let We=w&&`bg-surface-hover text-fg`,Z;t[101]===We?Z=t[102]:(Z=q(`rounded-md p-2 text-fg-muted hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,We),t[101]=We,t[102]=Z);let Ge;t[103]===Symbol.for(`react.memo_cache_sentinel`)?(Ge=(0,$.jsx)(K,{className:`size-4`,"aria-hidden":!0}),t[103]=Ge):Ge=t[103];let Ke;t[104]!==w||t[105]!==Ve||t[106]!==He||t[107]!==Ue||t[108]!==Z?(Ke=(0,$.jsx)(`button`,{ref:ee,type:`button`,"aria-label":Ve,title:He,"aria-expanded":w,onClick:Ue,className:Z,children:Ge}),t[104]=w,t[105]=Ve,t[106]=He,t[107]=Ue,t[108]=Z,t[109]=Ke):Ke=t[109];let qe;t[110]!==Be||t[111]!==Ke?(qe=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5`,children:[Be,Ke]}),t[110]=Be,t[111]=Ke,t[112]=qe):qe=t[112];let Je;t[113]!==k||t[114]!==qe?(Je=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-1`,children:[k,qe]}),t[113]=k,t[114]=qe,t[115]=Je):Je=t[115];let Ye;t[116]!==r.filters.markAllRead||t[117]!==f||t[118]!==y||t[119]!==d?(Ye=d>0?(0,$.jsxs)(`button`,{type:`button`,disabled:f,onClick:y,className:`flex min-h-9 w-full items-center gap-2 rounded-md px-2 text-xs text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:ring-2 focus-visible:ring-accent disabled:pointer-events-none disabled:opacity-50`,"aria-busy":f,children:[f?(0,$.jsx)(H,{className:`size-4 shrink-0 animate-spin`,"aria-hidden":!0}):(0,$.jsx)(j,{className:`size-4 shrink-0`,"aria-hidden":!0}),r.filters.markAllRead]}):null,t[116]=r.filters.markAllRead,t[117]=f,t[118]=y,t[119]=d,t[120]=Ye):Ye=t[120];let Xe;t[121]!==D||t[122]!==_||t[123]!==u||t[124]!==w||t[125]!==b?(Xe=w?(0,$.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-edge bg-surface-panel px-2.5 focus-within:border-accent`,children:[(0,$.jsx)(K,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,$.jsx)(`input`,{ref:C,value:u,onChange:e=>_(e.target.value),onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),D())},"aria-label":b?`搜索任务名称或内容`:`Search task names or content`,placeholder:b?`搜索任务…`:`Search tasks…`,className:`min-h-10 min-w-0 flex-1 bg-transparent text-sm text-fg outline-none placeholder:text-fg-subtle`}),(0,$.jsx)(`button`,{type:`button`,"aria-label":b?`关闭搜索`:`Close search`,onClick:D,className:`rounded-md p-1 text-fg-muted hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,children:(0,$.jsx)(me,{className:`size-3.5`,"aria-hidden":!0})})]}):null,t[121]=D,t[122]=_,t[123]=u,t[124]=w,t[125]=b,t[126]=Xe):Xe=t[126];let Ze;return t[127]!==Je||t[128]!==Ye||t[129]!==Xe?(Ze=(0,$.jsxs)(`div`,{className:`space-y-2`,children:[Je,Ye,Xe]}),t[127]=Je,t[128]=Ye,t[129]=Xe,t[130]=Ze):Ze=t[130],Ze}function Et(e){return(0,$.jsx)(wt,{value:e.id,children:(0,$.jsx)(`span`,{className:`max-w-56 truncate`,children:e.name})},e.id)}var Dt=[[`☀️`,`晨间简报`,`每天开始工作前,整理今天值得关注的任务与进展。`,`Morning briefing`,`Start each day with your tasks and project updates.`,`每天早上帮我整理当天到期、逾期的任务和项目进展,给出今天的重点。`,`Each morning, summarize my due and overdue tasks and project progress, and suggest priorities.`],[`📝`,`每周工作回顾`,`回顾一周的成果和问题,为下周留出清晰的方向。`,`Weekly review`,`Review the week and find a clear direction for the next.`,`每周五帮我回顾本周完成的任务和项目进展,整理未解决的问题,建议下周的重点。`,`Every Friday, review completed tasks and project progress, unresolved issues, and priorities for next week.`],[`🌱`,`项目进展跟进`,`定期看看项目进度,找出需要你关注的事情。`,`Project check-in`,`Keep an eye on project progress and what needs attention.`,`定期帮我检查项目进度,整理延期、阻塞和需要我决策的事项。先和我确认关注哪个项目以及运行时间。`,`Regularly review a project for delays, blockers, and decisions I need to make. Ask which project and when to run.`],[`🔔`,`重要事项提醒`,`把容易忘记的事情交给提醒,安心专注眼前。`,`A timely reminder`,`Make room to focus by setting a reminder for later.`,`我想安排一个重要事项提醒。请先问我需要提醒什么、什么时候提醒,以及是否重复。`,`Help me schedule a reminder. Ask what to remember, when, and whether it should repeat.`],[`📚`,`笔记整理`,`回看新收集的想法,整理出值得继续推进的线索。`,`Notes roundup`,`Revisit recent ideas and surface useful next steps.`,`每周帮我回顾最近新增的笔记,按主题整理,找出值得继续推进的想法。请先确认时间和范围。`,`Each week, group my recent notes by topic and suggest ideas worth pursuing. Confirm the schedule and scope.`],[`🧭`,`明日工作计划`,`下班前梳理未完成的事,安排明天最重要的三件事。`,`Plan tomorrow`,`Wrap up loose ends and choose tomorrow’s top three priorities.`,`每个工作日下班前,帮我梳理未完成的任务,建议明天最重要的三件事。请先确认具体时间。`,`Before the end of each workday, review unfinished tasks and suggest tomorrow’s top three priorities. Confirm the time.`],[`🗓️`,`月度复盘`,`拉远一点看进展,发现反复出现的问题和新的机会。`,`Monthly reflection`,`Step back to spot progress, recurring problems, and opportunities.`,`每月月底帮我回顾项目和任务的进展,总结成果、反复出现的问题和下个月的重点。请确认运行时间。`,`At the end of each month, review project and task progress, achievements, recurring problems, and priorities. Confirm the schedule.`],[`🎯`,`逾期任务检查`,`定期发现被搁置的事项,让重要的事重新向前。`,`Overdue task check`,`Find neglected tasks and get important work moving again.`,`定期帮我检查逾期任务,按紧迫程度整理,并建议下一步。请先确认运行频率和时间。`,`Regularly review overdue tasks, prioritize them by urgency, and suggest next steps. Confirm the frequency and time.`]];function Ot(e=Math.random){let t=[...Dt];for(let n=t.length-1;n>0;n--){let r=Math.min(n,Math.max(0,Math.floor(e()*(n+1))));[t[n],t[r]]=[t[r],t[n]]}return t.slice(0,6)}function kt({language:e,projectId:t,onOpenConversation:n}){let r=o(),[i,a]=(0,Q.useState)(!1),[s,c]=(0,Q.useState)(``),l=async e=>{a(!0),c(``);try{let i=await Ke({projectId:t,prompt:e});n?n(i):r(i)}catch(e){c(e instanceof Error?e.message:String(e))}finally{a(!1)}},u=e===`zh`,[d,f]=(0,Q.useState)(Ot),p=(0,$.jsxs)(`div`,{className:`mx-auto w-full max-w-3xl px-2 py-10 sm:px-6 md:py-20`,children:[(0,$.jsxs)(`div`,{className:`text-center`,children:[(0,$.jsx)(C,{className:`mx-auto size-10 text-fg-muted`,strokeWidth:1.3,"aria-hidden":!0}),(0,$.jsx)(`h2`,{className:`mt-4 text-xl font-semibold tracking-tight text-fg`,children:u?`安排任务`:`Schedule a task`}),(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:u?`说说你希望定期完成什么,我们一起安排好。`:`Tell us what you’d like done regularly. We’ll work out the details together.`})]}),(0,$.jsxs)(`div`,{className:`mb-3 mt-10 flex items-center justify-between text-xs text-fg-muted`,children:[(0,$.jsx)(`span`,{children:u?`也可以从这些想法开始`:`Or start with an idea`}),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>f(Ot()),className:`flex items-center gap-1.5 rounded-md px-2 py-1.5 hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,$.jsx)(G,{className:`size-3.5`,"aria-hidden":!0}),u?`换一组`:`More ideas`]})]}),(0,$.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:d.map(e=>(0,$.jsxs)(`button`,{type:`button`,disabled:i,onClick:()=>void l(u?e[5]:e[6]),className:`flex min-h-28 items-center gap-4 rounded-xl border border-dashed border-edge bg-surface-panel px-5 py-4 transition-colors hover:border-edge-strong hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,$.jsx)(`span`,{className:`shrink-0 text-2xl`,"aria-hidden":!0,children:e[0]}),(0,$.jsxs)(`span`,{className:`min-w-0`,children:[(0,$.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:u?e[1]:e[3]}),(0,$.jsx)(`span`,{className:`mt-1 block text-sm leading-5 text-fg-muted`,children:u?e[2]:e[4]})]})]},e[1]))}),(0,$.jsx)(`div`,{className:`mt-6 text-center`,children:(0,$.jsx)(`button`,{type:`button`,disabled:i,onClick:()=>void l(),className:`rounded-md px-3 py-2 text-sm text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:ring-2 focus-visible:ring-accent`,children:u?`说说你想安排的其他任务`:`Describe another task`})}),s?(0,$.jsx)(`p`,{role:`alert`,className:`mt-3 text-center text-sm text-danger`,children:s}):null]});return(0,$.jsx)(`section`,{"aria-label":u?`安排任务`:`Schedule a task`,children:p})}function At(e){if(!e.trim())return null;try{return JSON.parse(e)}catch{return null}}function jt(e){return typeof e.message==`string`&&e.message.trim()?e.message:typeof e.error==`string`&&e.error.trim()?e.error:e.error&&typeof e.error==`object`&&typeof e.error.message==`string`?e.error.message:`AI suggestion failed`}function Mt(e,t={}){let n=At(e.split(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/chat-page-LOR5JxDh.js","assets/rolldown-runtime-aKtaBQYM.js","assets/marked.esm-8VXEA2AD.js","assets/vendor-react-BOUWij0V.js","assets/preload-helper-Czpn1I53.js","assets/chunk-KS7C4IRE-DIIvxCDx.js","assets/locale-store-CHjsq5NR.js","assets/messages-C7QSnTdg.js","assets/dist-DlirbHVs.js","assets/es2015-CFqg57eW.js","assets/dist-CDSvxjOh.js","assets/createLucideIcon-DPHK1VkS.js","assets/app-window-DXFNqt_0.js","assets/archive-Dz0hferG.js","assets/arrow-left-D880xG-P.js","assets/video-generation-Cec49Jwg.js","assets/arrow-up-D5ZtR1QT.js","assets/product-automation-feedback-GA_YPLkr.js","assets/activity-YogQEteU.js","assets/bot-DjLkhyZL.js","assets/circle-check-C23XjkUj.js","assets/circle-pause-CN9jYH2s.js","assets/clock-3-DnrAnuyZ.js","assets/external-link-DjqjBmc3.js","assets/loader-circle-CifKLtgG.js","assets/message-square-fVE7Ghj1.js","assets/pause-DuPxgSxk.js","assets/play-kxZvpBg8.js","assets/rotate-ccw-JM1TBLpp.js","assets/rotate-cw-LIg3Am9S.js","assets/sparkles-DHlfQFAF.js","assets/triangle-alert-2JXFNNKU.js","assets/volume-2-BSJhAY97.js","assets/zap-dximCGjy.js","assets/cn-0WouolD0.js","assets/bundle-mjs-rHxsej31.js","assets/session-manager-DUWeBdeG.js","assets/schemas-CCWMleym.js","assets/turn-outcome-BSbEJx8h.js","assets/product-delivery-4gEqUIsK.js","assets/session-api-CR3NLqvs.js","assets/gateway-startup-retry-DgmvR-hb.js","assets/local-session-drafts-CGSV1RQg.js","assets/tool-activity-BtJkgjFf.js","assets/attachment-utils-core-BPYdUI6y.js","assets/gateway-realtime-CoIFB3im.js","assets/gateway-realtime-store-CTWm23Qi.js","assets/playback-coordinator-CWHIf0wr.js","assets/registry-api-CDpUAb2R.js","assets/agents-admin-api-DSr-PWuW.js","assets/gateway-config-swr-BD-ams0X.js","assets/vendor-swr-CdRzEUwF.js","assets/button-C5tRaJxt.js","assets/automation-api-D-gn6x5E.js","assets/earth-C9Z4bTTG.js","assets/check-DUBLcKHA.js","assets/chevron-down-ccbiQQz_.js","assets/chevron-right-BweFrslA.js","assets/working-directory-picker-modal-DgM21YVT.js","assets/file-archive-DanfQJNe.js","assets/interaction-BdhHBbYa.js","assets/form-field-width-DJw_jULe.js","assets/settings-form-draft-Dy10ldo8.js","assets/popover-select-hRG1EzAY.js","assets/skeleton-DzdOeGYz.js","assets/dist-BSVQC3i_.js","assets/dist-DSRLZhL9.js","assets/floating-ui.dom-CiMnRY5O.js","assets/floating-ui.react-dom-Gx6CM22l.js","assets/settings-shell-dialog-layer-BU3UuiJr.js","assets/circle-alert-BEjgurr2.js","assets/send-1f1Ntw6E.js","assets/circle-x-DFsCKeya.js","assets/circle-BoO4YvTx.js","assets/file-tree-utils-DJs1faGv.js","assets/copy-Dv6d4Dvw.js","assets/database-CjjeZfRG.js","assets/download-Dk-ZjtO6.js","assets/ellipsis-0k4rZLoy.js","assets/file-code-corner-byQA1VfD.js","assets/file-image-CDUPkZvG.js","assets/file-text-D12HbeVy.js","assets/file-CStvVK2S.js","assets/folder-kanban-CpLlFI1o.js","assets/folder-open-CyzJ19I9.js","assets/folder-CN-pC3XL.js","assets/git-branch-Dh9uxTot.js","assets/globe-DSSGFWFn.js","assets/history-DXH_9jsE.js","assets/notes-api-D5SvfybU.js","assets/markdown-view-ihzUc4ud.js","assets/plus-Q2yW6OE7.js","assets/x-B_N4OPjy.js","assets/app-link-Ji4uewEG.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/xml-_d7dTN2Q.js","assets/mermaid-render-oOellPHt.js","assets/markdown-view-Czi3_WHu.css","assets/chat-chart-block-B83s8HE9.js","assets/key-round-DWbpyU2U.js","assets/laptop-CI3hBVrl.js","assets/link-2-D_ZKYUW7.js","assets/list-checks-BbsExAoq.js","assets/list-todo-CTVRto8O.js","assets/messages-square-BckAJrEW.js","assets/mic-CuUb7zc-.js","assets/monitor-Af5eAvF7.js","assets/use-generated-media-CzRbgtcv.js","assets/install-connector-dialog-CntHi8Rh.js","assets/secret-input-DsjfQmDn.js","assets/eye-CABVeTq0.js","assets/is-masked-secret-DOkL5b_X.js","assets/connectors-api-CRGq-TSw.js","assets/electron-env-DHOGevH3.js","assets/oauth-provider-connect-DGYky6ut.js","assets/cloud-C4-yfnnk.js","assets/models-hub-cache-BrD6r5Qs.js","assets/oauth-api-DnMpUoyx.js","assets/connection-usage-guide-B9hoSOnN.js","assets/connection-usage-BhdQRWgQ.js","assets/paperclip-f1HujQY1.js","assets/pencil-DmIY3Oa-.js","assets/pin-off-BMRv-Kxr.js","assets/refresh-cw-BRlGaq2w.js","assets/save-DRDABU--.js","assets/search-DA7gz22f.js","assets/settings-2-D-csvaET.js","assets/settings-uiTATseT.js","assets/share-2-CnIB9PsV.js","assets/shield-check-BU58siTV.js","assets/smartphone-DSSsQFqA.js","assets/square-DMK_fB-3.js","assets/preview-runtime-C1U57WSM.js","assets/use-async-resource-BHFGZCY2.js","assets/workspace-api-BuNWyNvA.js","assets/files-GdwDamkp.js","assets/index.module-Cd9ENXfk.js","assets/trash-2-DusmjVPV.js","assets/user-round-C9jxPhMR.js","assets/wifi-off-C35sMFUl.js","assets/share-link-dialog-2JjvWs0q.js","assets/copy-text-row-gqdh0Bg1.js","assets/wrench-DFb4r8bH.js","assets/tasks-CwyNaa-j.js","assets/specialists-xbB3xL9e.js","assets/api-CGs641OT.js","assets/session-identity-DRFdxntH.js","assets/new-session-preferences-gb411vZP.js","assets/composer-model-config-control-C2Bku39S.js","assets/model-selector-QFZY5XNN.js","assets/open-capability-settings-DQsmJxI7.js","assets/model-sort-_Tz8s_4N.js","assets/cloud-credits-B-nbtkqv.js","assets/space-api-_uKFiASp.js","assets/home-task-actions-C8Fi6GBq.js","assets/capabilities-BaKHutgZ.js","assets/capabilities-abgigXV1.js","assets/right-workspace-store-Cehybf-G.js","assets/phone-workspace-store-DGaibcsi.js","assets/workspace-editor-agent-store-CX8zX9eZ.js","assets/chat-agents-api-CyvBfBbp.js","assets/middleware-Pd0e8Igk.js","assets/composer-payload-handoff-ClWsunJ2.js","assets/voice-input-shortcut-events-DN-_rY5a.js","assets/chunk-D32TOXHM-DQIy-Baq.js","assets/linkify-it-BkqEorO0.js","assets/tool-friendly-title-CJVFJ2Ud.js","assets/use-realtime-voice-9OvLwHzk.js","assets/voice-CUfqdnlR.js","assets/composer-notifications-MGKffwC7.js","assets/activity-store-hSe5Nbgk.js","assets/voice-call-context-BM2A4bLz.js","assets/app-chrome-BeB4KgOf.js","assets/page-header-store-NP7MCIaP.js","assets/new-chat-navigation-spnin196.js","assets/loopi-CNtmi9FU.js","assets/loopi-C09I2mNj.css","assets/extension-provider-DFcRbTHI.js","assets/theme-store-CvG266p8.js","assets/extension-message-router-B2wbucV7.js","assets/agent-avatar-display-D_UDgOr9.js","assets/skill-wire-pattern-BPpeIcCi.js","assets/composer-handoff-params-DBpzHuNo.js","assets/agent-display-names-Bje7vfSn.js","assets/use-directory-picker-C4p7AgWY.js","assets/confirm-dialog-MHCmEEUZ.js","assets/shares-api-BhWvN3LS.js","assets/dist-DaFr5KMw.js","assets/use-composer-attachments-DJsIzJ1c.js","assets/chevron-left-DqFhpbvK.js","assets/use-file-preview-expanded-BFF2vXm5.js","assets/message-square-plus-XP0tGdlV.js","assets/minimize-2-DtOGrlpo.js","assets/constants-D5Z-mUto.js","assets/sliding-tab-list-CmcrqRzN.js","assets/sliding-indicator-hwz0sx3h.js","assets/use-share-link-WKZLlEqr.js","assets/file-preview-surface-Da1xZiG6.js","assets/command-palette-api-YP0zV_Ol.js","assets/skill-list-api-B26hHnXq.js","assets/skill-api-utils-C7V4JVXM.js","assets/automation-task-card-C453Q-Wa.js","assets/automation-display-DaVDNZz8.js","assets/message-circle-Badhj-4D.js","assets/date-picker-DwITf4I2.js","assets/calendar-days-hw_Y-g-s.js","assets/time-picker-otHjbob1.js","assets/dev-view-store-DsjH8x76.js","assets/extension-iframe-host-CIAq7PSn.js","assets/extension-authoritative-grants-DYp2nNol.js","assets/runtime-health-zDkHcOZO.js","assets/api-B3T06TLl.js","assets/terminal-panel-store-Cy90Ix5U.js","assets/agents-app-path-ciChvpCS.js","assets/use-media-query-ady-FgjK.js","assets/oauth-authorization-window-o6URRos4.js","assets/page-context-draft-Bk7jVvAG.js","assets/management-api-FVu7eYXD.js","assets/side-chat-shortcut-BIw-1TTD.js","assets/chat-page-zQeUaawJ.css"])))=>i.map(i=>d[i]);
2
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-Czpn1I53.js";import{_ as a,f as o,t as s}from"./chunk-KS7C4IRE-DIIvxCDx.js";import{a as c,i as l,l as u,n as d}from"./locale-store-CHjsq5NR.js";import{t as f}from"./messages-C7QSnTdg.js";import{a as p,n as m,o as h,r as g,s as _,t as v}from"./dist-DlirbHVs.js";import{t as y}from"./activity-YogQEteU.js";import{t as b}from"./arrow-left-D880xG-P.js";import{a as x,c as S,f as C,i as ee,l as w,n as T,o as E,r as D,s as O,t as k,u as A}from"./automation-display-DaVDNZz8.js";import{i as j,n as M,r as N,t as P}from"./automation-run-list-CM59-qm5.js";import{t as F}from"./check-DUBLcKHA.js";import{t as te}from"./chevron-down-ccbiQQz_.js";import{t as ne}from"./chevron-right-BweFrslA.js";import{n as I,r as L}from"./popover-select-hRG1EzAY.js";import{t as re}from"./circle-alert-BEjgurr2.js";import{t as ie}from"./circle-check-C23XjkUj.js";import{t as R}from"./copy-Dv6d4Dvw.js";import{t as z}from"./ellipsis-0k4rZLoy.js";import{t as ae}from"./eye-CABVeTq0.js";import{t as B}from"./git-branch-Dh9uxTot.js";import{t as V}from"./list-filter-CIPvpfLA.js";import{t as H}from"./loader-circle-CifKLtgG.js";import{t as oe}from"./markdown-view-ihzUc4ud.js";import{t as se}from"./message-circle-Badhj-4D.js";import{t as ce}from"./pause-DuPxgSxk.js";import{t as U}from"./pencil-DmIY3Oa-.js";import{t as le}from"./play-kxZvpBg8.js";import{t as W}from"./plus-Q2yW6OE7.js";import{t as G}from"./refresh-cw-BRlGaq2w.js";import{t as K}from"./search-DA7gz22f.js";import{t as ue}from"./shield-check-BU58siTV.js";import{t as de}from"./sparkles-DHlfQFAF.js";import{t as fe}from"./square-pen-B8FsvqNu.js";import{t as pe}from"./trash-2-DusmjVPV.js";import{t as me}from"./x-B_N4OPjy.js";import{t as he}from"./zap-dximCGjy.js";import{t as q}from"./cn-0WouolD0.js";import{t as J}from"./skeleton-DzdOeGYz.js";import{d as ge}from"./api-CGs641OT.js";import{a as _e}from"./session-api-CR3NLqvs.js";import{N as ve}from"./session-manager-DUWeBdeG.js";import{a as ye,i as be,o as xe}from"./vendor-swr-CdRzEUwF.js";import{t as Se}from"./chat-agents-api-CyvBfBbp.js";import{t as Ce}from"./button-C5tRaJxt.js";import{t as we}from"./page-header-store-NP7MCIaP.js";import{t as Y}from"./automation-api-D-gn6x5E.js";import{n as Te}from"./agent-display-names-Bje7vfSn.js";import{t as X}from"./sliding-tab-list-CmcrqRzN.js";import{t as Ee}from"./refresh-button-DX7bULU5.js";import{a as De,c as Oe,d as ke,f as Ae,i as je,l as Me,m as Ne,o as Pe,p as Fe,r as Ie,s as Le,t as Re,u as ze}from"./dist-DaFr5KMw.js";import{n as Be}from"./model-selector-QFZY5XNN.js";import{a as Ve,c as He,d as Ue,f as We,h as Z,l as Ge,m as Ke,n as qe,o as Je,p as Ye,r as Xe,s as Ze,u as Qe}from"./automation-task-card-C453Q-Wa.js";import{t as $e}from"./time-picker-otHjbob1.js";import{t as et}from"./date-time-picker-ChG1CqR1.js";import{i as tt,n as nt,r as rt,t as it}from"./automation-result-state-B7hq0XOL.js";import{n as at}from"./routine-panel-Bfbiz0IN.js";var ot=n(),Q=e(t(),1),$=r(),st=(0,Q.lazy)(()=>i(()=>import(`./chat-page-LOR5JxDh.js`).then(e=>e.n).then(e=>({default:e.ChatPage})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219])));function ct(e){let t=(0,ot.c)(110),{runId:n,automationId:r,projectId:i,language:a,onConfigure:o,onDetails:s,onBack:c}=e,l=a===`zh`,[u,d]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(null),_;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(_=e=>g(e),t[0]=_):_=t[0];let v=_,y;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(y=()=>m(!0),t[1]=y):y=t[1];let x=y,{mutate:S}=ye(),C=(0,Q.useRef)(!1),ee=i??``,w;t[2]!==r||t[3]!==n||t[4]!==ee?(w=[`automation-execution`,r,n,ee],t[2]=r,t[3]=n,t[4]=ee,t[5]=w):w=t[5];let T;t[6]!==r||t[7]!==i||t[8]!==n||t[9]!==l?(T=async()=>{let{run:e}=await Y.getRun(n);if(e.automationId!==r)throw Error(l?`执行记录不属于此自动化`:`Execution does not belong to this automation`);let{automation:t}=await Y.get(r);if(i&&t.projectId!==i)throw Error(l?`执行记录不属于此项目`:`Execution does not belong to this project`);return{run:e,automation:t}},t[6]=r,t[7]=i,t[8]=n,t[9]=l,t[10]=T):T=t[10];let E;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(E={refreshInterval:dt,shouldRetryOnError:!1},t[11]=E):E=t[11];let{data:D,error:O,mutate:k}=be(w,T,E),A=D?.run,j=A?.conversationId,N;t[12]===j?N=t[13]:(N=e=>!!(j&&(e.sessions[j]?.streaming||e.sessions[j]?.sending)),t[12]=j,t[13]=N);let P=ve(N),F;t[14]===j?F=t[15]:(F=j?[`automation-execution-session`,j]:null,t[14]=j,t[15]=F);let te;t[16]===j?te=t[17]:(te=()=>_e(j),t[16]=j,t[17]=te);let ne;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(ne={shouldRetryOnError:!1},t[18]=ne):ne=t[18];let{data:I,error:L,mutate:re}=be(F,te,ne),ie=A?.conversationShared||D?.automation.conversationMode===`continuous`||I?.customData?.latestAutomationRunId!==void 0&&I.customData.latestAutomationRunId!==n,R=!!(I&&(!ie||u)),z=!O&&!!(A&&(!j||ie&&!u&&I&&!L&&(A?.summary||A?.error)||I&&!L&&p)),ae,B;if(t[19]!==z||t[20]!==k||t[21]!==S||t[22]!==A?(ae=()=>{!A||!z||M(A)||A.readAtMs!=null||C.current||(C.current=!0,Y.markRunRead(A.id).then(async()=>{await Promise.all([k(),S(ut)])}).catch(lt).finally(()=>{C.current=!1}))},B=[A,z,k,S],t[19]=z,t[20]=k,t[21]=S,t[22]=A,t[23]=ae,t[24]=B):(ae=t[23],B=t[24]),(0,Q.useEffect)(ae,B),O){let e=O instanceof Error?O.message:l?`执行记录加载失败`:`Could not load execution`,n;t[25]===e?n=t[26]:(n=(0,$.jsx)(`p`,{children:e}),t[25]=e,t[26]=n);let r;t[27]===k?r=t[28]:(r=()=>void k(),t[27]=k,t[28]=r);let i=l?`重试`:`Retry`,a;t[29]!==r||t[30]!==i?(a=(0,$.jsx)(Ce,{onClick:r,children:i}),t[29]=r,t[30]=i,t[31]=a):a=t[31];let o=l?`返回自动化`:`Back to automation`,s;t[32]!==c||t[33]!==o?(s=(0,$.jsx)(Ce,{onClick:c,children:o}),t[32]=c,t[33]=o,t[34]=s):s=t[34];let u;return t[35]!==n||t[36]!==a||t[37]!==s?(u=(0,$.jsxs)(`section`,{role:`alert`,className:`space-y-3 p-5`,children:[n,a,s]}),t[35]=n,t[36]=a,t[37]=s,t[38]=u):u=t[38],u}if(!A){let e;return t[39]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsxs)(`div`,{className:`space-y-4 p-5`,"aria-busy":`true`,children:[(0,$.jsx)(J,{className:`h-6 w-2/3`}),(0,$.jsx)(J,{className:`h-20`})]}),t[39]=e):e=t[39],e}let V;t[40]===A?V=t[41]:(V=M(A),t[40]=A,t[41]=V);let H=V,se=l?`执行会话`:`Execution conversation`,ce=l?`返回自动化`:`Back to automation`,U;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,$.jsx)(b,{className:`size-4`}),t[42]=U):U=t[42];let le;t[43]!==c||t[44]!==ce?(le=(0,$.jsx)(Ce,{variant:`ghost`,className:`shrink-0`,onClick:c,"aria-label":ce,children:U}),t[43]=c,t[44]=ce,t[45]=le):le=t[45];let W;t[46]===A.automationName?W=t[47]:(W=(0,$.jsx)(`h2`,{className:`truncate text-sm font-medium text-fg`,children:A.automationName}),t[46]=A.automationName,t[47]=W);let G;t[48]!==le||t[49]!==W?(G=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[le,W]}),t[48]=le,t[49]=W,t[50]=G):G=t[50];let K;t[51]!==A.createdAtMs||t[52]!==l?(K=new Date(A.createdAtMs).toLocaleString(l?`zh-CN`:`en-US`),t[51]=A.createdAtMs,t[52]=l,t[53]=K):K=t[53];let ue;t[54]===a?ue=t[55]:(ue=f(a),t[54]=a,t[55]=ue);let de=ue.automations.status[A.status],fe;t[56]!==K||t[57]!==de?(fe=(0,$.jsxs)(`span`,{children:[K,` · `,de]}),t[56]=K,t[57]=de,t[58]=fe):fe=t[58];let pe;t[59]!==s||t[60]!==A.id?(pe=()=>s(A.id),t[59]=s,t[60]=A.id,t[61]=pe):pe=t[61];let me=l?`运行详情`:`Run details`,he;t[62]!==pe||t[63]!==me?(he=(0,$.jsx)(`button`,{type:`button`,className:`rounded px-2 py-1.5 text-accent-fg hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,onClick:pe,children:me}),t[62]=pe,t[63]=me,t[64]=he):he=t[64];let q;t[65]!==o||t[66]!==A?(q=()=>o(A),t[65]=o,t[66]=A,t[67]=q):q=t[67];let ge=l?`调整自动化`:`Adjust automation`,xe;t[68]!==q||t[69]!==ge?(xe=(0,$.jsx)(`button`,{type:`button`,className:`rounded px-2 py-1.5 text-accent-fg hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,onClick:q,children:ge}),t[68]=q,t[69]=ge,t[70]=xe):xe=t[70];let Se;t[71]!==fe||t[72]!==he||t[73]!==xe?(Se=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 text-xs text-fg-muted`,children:[fe,he,xe]}),t[71]=fe,t[72]=he,t[73]=xe,t[74]=Se):Se=t[74];let we;t[75]!==D?.automation||t[76]!==ie||t[77]!==l?(we=ie?(0,$.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[l?`多次执行可能共用此会话;下方摘要对应所选执行。`:`Executions may share this conversation. The summary belongs to the selected execution.`,D?.automation.conversationMode===`continuous`?l?`追问会进入后续运行上下文。`:` Follow-ups become context for future runs.`:null]}):null,t[75]=D?.automation,t[76]=ie,t[77]=l,t[78]=we):we=t[78];let Te;t[79]!==h||t[80]!==u||t[81]!==l?(Te=u?(0,$.jsx)(`p`,{role:`status`,className:`text-xs text-fg-muted`,children:h===!0?l?`已定位到所选执行的会话起点。`:`Located the selected execution in this conversation.`:h===!1?l?`旧记录缺少可用的执行定位信息,当前显示完整会话。`:`No matching turn was found in the available history. Showing the full conversation.`:l?`正在定位所选执行…`:`Locating the selected execution…`}):null,t[79]=h,t[80]=u,t[81]=l,t[82]=Te):Te=t[82];let X;t[83]!==H||t[84]!==l?(X=H?(0,$.jsx)(`p`,{role:`status`,className:`text-xs text-fg-muted`,children:l?`执行中,完成后可继续追问。`:`Execution in progress. Follow up after it finishes.`}):null,t[83]=H,t[84]=l,t[85]=X):X=t[85];let Ee;t[86]!==G||t[87]!==Se||t[88]!==we||t[89]!==Te||t[90]!==X?(Ee=(0,$.jsxs)(`header`,{className:`shrink-0 space-y-2 border-b border-edge px-4 py-3`,children:[G,Se,we,Te,X]}),t[86]=G,t[87]=Se,t[88]=we,t[89]=Te,t[90]=X,t[91]=Ee):Ee=t[91];let De;t[92]!==H||t[93]!==j||t[94]!==P||t[95]!==I||t[96]!==a||t[97]!==re||t[98]!==A.error||t[99]!==A.id||t[100]!==A.summary||t[101]!==L||t[102]!==ie||t[103]!==R||t[104]!==l?(De=R?(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(J,{className:`m-5 h-40`}),children:(0,$.jsx)(st,{embedded:!0,automationExecution:!0,conversationId:j,readOnly:H||P,onHistoryReady:x,initialTurnId:ie?A.id:void 0,onInitialTurnLocated:v},j)}):(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-5`,children:[A.summary?(0,$.jsx)(oe,{content:A.summary}):null,A.error?(0,$.jsx)(`p`,{className:`whitespace-pre-wrap text-sm text-danger`,children:A.error}):null,j?null:(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:H?l?`等待执行会话,开始后会自动更新。`:`Waiting for the execution conversation. This view updates automatically.`:l?`本次执行没有关联会话,可查看运行结果和详情。`:`No conversation is associated with this execution. Results and diagnostics remain available.`}),j&&!I&&!L?(0,$.jsx)(J,{className:`h-24`}):null,L?(0,$.jsxs)(`div`,{role:`alert`,className:`space-y-2 text-sm text-fg-muted`,children:[(0,$.jsx)(`p`,{children:L.status===404?l?`执行会话已删除,运行结果仍保留。`:`The execution conversation was deleted. Results are still available.`:l?`执行会话暂时无法读取,运行结果仍保留。`:`The conversation is unavailable. Results are still available.`}),(0,$.jsx)(Ce,{onClick:()=>void re(),children:l?`重试`:`Retry`})]}):null,ie&&I?(0,$.jsx)(Ce,{variant:`secondary`,onClick:()=>d(!0),children:l?`打开共享会话`:`Open shared conversation`}):null,H?null:(0,$.jsx)(tt,{runId:A.id,language:a})]}),t[92]=H,t[93]=j,t[94]=P,t[95]=I,t[96]=a,t[97]=re,t[98]=A.error,t[99]=A.id,t[100]=A.summary,t[101]=L,t[102]=ie,t[103]=R,t[104]=l,t[105]=De):De=t[105];let Oe;return t[106]!==se||t[107]!==Ee||t[108]!==De?(Oe=(0,$.jsxs)(`section`,{className:`flex h-full min-h-0 min-w-0 flex-col overflow-hidden`,"aria-label":se,children:[Ee,De]}),t[106]=se,t[107]=Ee,t[108]=De,t[109]=Oe):Oe=t[109],Oe}function lt(){}function ut(e){return Array.isArray(e)&&[`automations`,`automation-runs`,`automation-history`,`automation-navigation-runs`].includes(String(e[0]))||e===`automations-global-system-source`}function dt(e){return e&&M(e.run)?3e3:15e3}function ft(e){let t=(0,ot.c)(44),{automation:n,language:r,busy:i,onEdit:a,onAction:o}=e,s=r===`zh`,c=n.management,l=s?`${n.name}的更多操作`:`More actions for ${n.name}`,u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,$.jsx)(z,{className:`size-4`}),t[0]=u):u=t[0];let d;t[1]===l?d=t[2]:(d=(0,$.jsx)(Ne,{asChild:!0,children:(0,$.jsx)(Ce,{variant:`ghost`,className:`size-8 p-0`,"aria-label":l,children:u})}),t[1]=l,t[2]=d);let f;t[3]!==n||t[4]!==i||t[5]!==c||t[6]!==o||t[7]!==s?(f=(!c||c.editable.includes(`enabled`))&&!A(n)?(0,$.jsxs)(Ie,{className:`flex cursor-pointer items-center gap-2 rounded-md px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover data-[disabled]:opacity-50`,disabled:i,onSelect:()=>void o(`automation:${n.id}:toggle`,()=>n.enabled?Y.pause(n.id):Y.resume(n.id)),children:[n.enabled?(0,$.jsx)(ce,{className:`size-4`}):(0,$.jsx)(le,{className:`size-4`}),n.enabled?s?`暂停`:`Pause`:s?`恢复`:`Resume`]}):null,t[3]=n,t[4]=i,t[5]=c,t[6]=o,t[7]=s,t[8]=f):f=t[8];let p;t[9]!==n.id||t[10]!==i||t[11]!==c||t[12]!==o||t[13]!==s?(p=!c||c.runnable?(0,$.jsxs)(Ie,{className:`flex cursor-pointer items-center gap-2 rounded-md px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover data-[disabled]:opacity-50`,disabled:i,onSelect:()=>void o(`automation:${n.id}:run`,()=>Y.runNow(n.id)),children:[(0,$.jsx)(le,{className:`size-4`}),s?`立即运行`:`Run now`]}):null,t[9]=n.id,t[10]=i,t[11]=c,t[12]=o,t[13]=s,t[14]=p):p=t[14];let m;t[15]!==n||t[16]!==i||t[17]!==c||t[18]!==a||t[19]!==s?(m=!c||c.editable.includes(`trigger`)?(0,$.jsxs)(Ie,{className:`flex cursor-pointer items-center gap-2 rounded-md px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover data-[disabled]:opacity-50`,disabled:i,onSelect:()=>a(n),children:[(0,$.jsx)(U,{className:`size-4`}),s?`编辑`:`Edit`]}):null,t[15]=n,t[16]=i,t[17]=c,t[18]=a,t[19]=s,t[20]=m):m=t[20];let h;t[21]!==n.id||t[22]!==o||t[23]!==s?(h=()=>void o(`automation:${n.id}:copy-link`,()=>navigator.clipboard.writeText(`${window.location.origin}${window.location.pathname}#/automations?automation=${encodeURIComponent(n.id)}`),s?`任务链接已复制`:`Task link copied`),t[21]=n.id,t[22]=o,t[23]=s,t[24]=h):h=t[24];let g;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsx)(R,{className:`size-4`}),t[25]=g):g=t[25];let _=s?`复制任务链接`:`Copy task link`,v;t[26]!==h||t[27]!==_?(v=(0,$.jsxs)(Ie,{className:`flex cursor-pointer items-center gap-2 rounded-md px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover data-[disabled]:opacity-50`,onSelect:h,children:[g,_]}),t[26]=h,t[27]=_,t[28]=v):v=t[28];let y;t[29]!==n.id||t[30]!==i||t[31]!==c||t[32]!==o||t[33]!==s?(y=!c||c.deletable?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ze,{className:`my-1 h-px bg-edge-subtle`}),(0,$.jsxs)(Ie,{className:`flex cursor-pointer items-center gap-2 rounded-md px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover data-[disabled]:opacity-50 text-danger`,disabled:i,onSelect:()=>{window.confirm(s?`删除这个定时任务?已保存的对话仍可查看。`:`Delete this scheduled task? Saved conversations will remain available.`)&&o(`automation:${n.id}:delete`,()=>Y.remove(n.id))},children:[(0,$.jsx)(pe,{className:`size-4`}),s?`删除`:`Delete`]})]}):null,t[29]=n.id,t[30]=i,t[31]=c,t[32]=o,t[33]=s,t[34]=y):y=t[34];let b;t[35]!==v||t[36]!==y||t[37]!==f||t[38]!==p||t[39]!==m?(b=(0,$.jsx)(Pe,{children:(0,$.jsxs)(Re,{align:`end`,sideOffset:4,className:`z-70 min-w-44 rounded-xl border border-edge bg-surface-overlay p-1 shadow-popover`,children:[f,p,m,v,y]})}),t[35]=v,t[36]=y,t[37]=f,t[38]=p,t[39]=m,t[40]=b):b=t[40];let x;return t[41]!==b||t[42]!==d?(x=(0,$.jsxs)(Me,{children:[d,b]}),t[41]=b,t[42]=d,t[43]=x):x=t[43],x}function pt({automations:e,runs:t,labels:n,cronLabels:r,language:i,selectedAutomationId:a,selectedRunId:o,selectedRun:s,projectId:c,executionSummaries:l,onSelectRun:d,onOpenDetails:f,busy:p,onEdit:m,onAction:h}){let g=`xopc.automation-navigation:${u(e=>e.baseUrl)}:${u(e=>e.conversationId)??`local`}`,[_,v]=(0,Q.useState)(()=>{try{let e=JSON.parse(localStorage.getItem(g)??`{}`);return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}catch{return{}}});(0,Q.useEffect)(()=>{try{let e=JSON.parse(localStorage.getItem(g)??`{}`);v(e&&typeof e==`object`&&!Array.isArray(e)?e:{})}catch{v({})}},[g]);let y=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{!a||y.current===a||(y.current=a,v(e=>({...e,[a]:!0})))},[a]);let b=e=>v(t=>{let n={...t,[e]:!t[e]};try{localStorage.setItem(g,JSON.stringify(n))}catch{}return n});return e.length===0?(0,$.jsx)(`p`,{className:`p-4 text-sm text-fg-muted`,children:n.empty.filtered}):(0,$.jsx)(`div`,{className:`min-h-0 overflow-y-auto divide-y divide-edge-subtle`,children:e.map(e=>{let u=t.filter(t=>t.automationId===e.id).sort((e,t)=>t.createdAtMs-e.createdAtMs),g=u.find(M);return(0,$.jsxs)(`div`,{className:`group relative`,children:[(0,$.jsx)(`button`,{type:`button`,"aria-expanded":!!_[e.id],"aria-controls":`automation-runs-${e.id}`,"aria-label":i===`zh`?`${_[e.id]?`收起`:`展开`} ${e.name} 的执行记录`:`${_[e.id]?`Collapse`:`Expand`} executions for ${e.name}`,className:`absolute left-1 top-2 z-10 rounded-md p-2 text-fg-muted hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,onClick:()=>b(e.id),children:_[e.id]?(0,$.jsx)(te,{className:`size-4`}):(0,$.jsx)(ne,{className:`size-4`})}),(0,$.jsxs)(`button`,{type:`button`,className:q(`block w-full p-3 pl-9 pr-10 text-left outline-none hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,a===e.id&&!o&&`bg-surface-hover`),style:{contentVisibility:`auto`,containIntrinsicSize:`auto 76px`},"aria-current":a===e.id&&!o?`true`:void 0,onClick:()=>f(e.id),children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(`span`,{className:q(`size-2 shrink-0 rounded-full`,g?`bg-blue-500`:nt(e,u)?`bg-red-500`:e.enabled?`bg-emerald-500`:`bg-fg-subtle`)}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm font-medium text-fg`,children:e.name}),(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:A(e)?i===`zh`?`已完成`:`Completed`:e.enabled?n.enabled:n.paused}),(l?.[e.id]?.unreadCount??0)>0?(0,$.jsx)(`span`,{className:`ml-auto size-2 shrink-0 rounded-full bg-blue-500`,children:(0,$.jsx)(`span`,{className:`sr-only`,children:n.filters.unread})}):null]}),(0,$.jsxs)(`p`,{className:`mt-1 truncate pl-4 text-xs leading-5 text-fg-muted`,children:[e.enabled?(0,$.jsxs)($.Fragment,{children:[D(e,n,i),(0,$.jsx)(`span`,{className:`mx-1.5`,children:`·`})]}):null,ee(e.trigger,n,r,i)]}),nt(e,u)?(0,$.jsx)(`p`,{className:`mt-1 pl-4 text-xs text-red-700 dark:text-red-300`,children:n.dashboard.needsAttention}):null]}),(0,$.jsx)(`div`,{id:`automation-runs-${e.id}`,hidden:!_[e.id],children:(0,$.jsx)(P,{automationId:e.id,projectId:c,language:i,selectedRunId:o,selectedRun:s,enabled:!!_[e.id],onSelectRun:d})}),(0,$.jsx)(`div`,{className:`absolute right-1 top-2 opacity-100 sm:opacity-0 sm:group-hover:opacity-100 sm:group-focus-within:opacity-100`,children:(0,$.jsx)(ft,{automation:e,language:i,busy:p,onEdit:m,onAction:h})})]},e.id)})})}var mt=`xopc.automations.listWidth`,ht=272,gt=200,_t=560;function vt({children:e,language:t,busy:n}){let r=(0,Q.useRef)(null),i=(0,Q.useRef)(null),[a,o]=(0,Q.useState)(!1),[s,c]=(0,Q.useState)(()=>{try{let e=Number(window.localStorage.getItem(mt));if(Number.isFinite(e)&&e>=gt&&e<=_t)return e}catch{}return ht});(0,Q.useEffect)(()=>{try{window.localStorage.setItem(mt,String(s))}catch{}},[s]),(0,Q.useEffect)(()=>{if(!a)return;let{cursor:e,userSelect:t}=document.body.style;return document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`,()=>{document.body.style.cursor=e,document.body.style.userSelect=t}},[a]);let l=e=>{let t=r.current?.getBoundingClientRect().width??1e3,n=Math.max(gt,Math.min(_t,t*.6,t-292));return Math.round(Math.max(gt,Math.min(n,e)))},u=t===`zh`?`调整任务列表宽度`:`Resize task list`;return(0,$.jsxs)(`section`,{ref:r,"aria-busy":n,className:`grid min-h-0 min-w-0 flex-1 grid-rows-[auto_minmax(0,1fr)] gap-y-3 md:grid-cols-[minmax(0,min(var(--automation-list-width),60%))_0.75rem_minmax(0,1fr)] md:grid-rows-1 md:gap-y-0`,style:{"--automation-list-width":`${s}px`},children:[e[0],(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":u,"aria-valuemin":gt,"aria-valuemax":_t,"aria-valuenow":s,tabIndex:0,title:t===`zh`?`左右拖动调整宽度,双击恢复默认`:`Drag to resize, double-click to reset`,className:`relative hidden touch-none select-none cursor-col-resize focus-visible:outline-accent md:block`,onPointerDown:e=>{if(e.button!==0)return;e.preventDefault(),e.currentTarget.setPointerCapture(e.pointerId);let t=e.currentTarget.previousElementSibling?.getBoundingClientRect().width??s;i.current={pointerId:e.pointerId,startX:e.clientX,startWidth:t},o(!0)},onPointerMove:e=>{let t=i.current;t?.pointerId===e.pointerId&&c(l(t.startWidth+e.clientX-t.startX))},onPointerUp:e=>{i.current?.pointerId===e.pointerId&&(i.current=null,o(!1),e.currentTarget.releasePointerCapture(e.pointerId))},onPointerCancel:()=>{i.current=null,o(!1)},onLostPointerCapture:()=>{i.current=null,o(!1)},onDoubleClick:()=>c(ht),onKeyDown:e=>{[`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(e.key)&&(e.preventDefault(),c(l(e.key===`Home`?gt:e.key===`End`?_t:s+(e.key===`ArrowLeft`?-16:16))))}}),e[1]]})}var yt=(0,Q.lazy)(()=>i(()=>import(`./chat-page-LOR5JxDh.js`).then(e=>e.n).then(e=>({default:e.ChatPage})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219])));function bt(e){let t=(0,ot.c)(51),{automation:n,conversationId:r,runs:i,language:a,onSelectRun:o,onConfigured:s}=e,c=n?.id,l;t[0]!==c||t[1]!==r?(l=c&&!r?[`automation-workspace-chat`,c]:null,t[0]=c,t[1]=r,t[2]=l):l=t[2];let u;t[3]===c?u=t[4]:(u=()=>Y.openConfiguration({automationId:c}),t[3]=c,t[4]=u);let d;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(d={revalidateOnFocus:!1,revalidateOnReconnect:!1,shouldRetryOnError:!1},t[5]=d):d=t[5];let{data:p,error:m,mutate:h}=be(l,u,d),g;t[6]===r?g=t[7]:(g=r?[`automation-configuration`,r]:null,t[6]=r,t[7]=g);let _;t[8]===r?_=t[9]:(_=()=>Y.configuration(r),t[8]=r,t[9]=_);let v;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(v={refreshInterval:3e3},t[10]=v):v=t[10];let{data:y}=be(g,_,v),b,x;t[11]!==n||t[12]!==s||t[13]!==y?(b=()=>{!n&&y?.automation&&s?.(y.automation.id)},x=[n,y,s],t[11]=n,t[12]=s,t[13]=y,t[14]=b,t[15]=x):(b=t[14],x=t[15]),(0,Q.useEffect)(b,x);let S=r??p?.conversationId,{mutate:C}=ye(),ee;t[16]===S?ee=t[17]:(ee=e=>!!(S&&(e.sessions[S]?.streaming||e.sessions[S]?.sending)),t[16]=S,t[17]=ee);let w=ve(ee),T=(0,Q.useRef)(!1),E,D;t[18]!==C||t[19]!==w?(E=()=>{T.current&&!w&&C(xt),T.current=w},D=[w,C],t[18]=C,t[19]=w,t[20]=E,t[21]=D):(E=t[20],D=t[21]),(0,Q.useEffect)(E,D);let O=a===`zh`,k;t[22]===a?k=t[23]:(k=f(a),t[22]=a,t[23]=k);let A=k,j;if(t[24]!==a||t[25]!==A.automations.status||t[26]!==o||t[27]!==i||t[28]!==O){let e;t[30]!==a||t[31]!==A.automations.status||t[32]!==o||t[33]!==O?(e=e=>({id:`automation-run:${e.id}`,timestamp:e.createdAtMs,content:(0,$.jsxs)(`article`,{className:`mx-auto w-full max-w-[var(--max-width-chat-frame)] space-y-3 py-3`,"aria-label":O?`任务运行结果`:`Task run result`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-xs text-fg-muted`,children:[(0,$.jsxs)(`span`,{children:[new Date(e.createdAtMs).toLocaleString(O?`zh-CN`:`en-US`,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}),` · `,A.automations.status[e.status]]}),(0,$.jsx)(`button`,{type:`button`,className:`rounded-md px-2 py-1.5 hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,onClick:()=>o(e.id),children:O?`查看详情`:`View details`})]}),e.error?(0,$.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-6 text-danger`,children:rt(e,a)}):e.summary?(0,$.jsx)(oe,{content:e.summary}):(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:O?`正在执行,结果会显示在这里。`:`Running. The result will appear here.`}),e.status===`failed`||e.status===`timeout`?(0,$.jsx)(qe,{automationId:e.automationId,runId:e.id,language:a,variant:`secondary`}):null,[`queued`,`running`,`cancelling`].includes(e.status)?null:(0,$.jsx)(tt,{runId:e.id,language:a})]})}),t[30]=a,t[31]=A.automations.status,t[32]=o,t[33]=O,t[34]=e):e=t[34],j=i.map(e),t[24]=a,t[25]=A.automations.status,t[26]=o,t[27]=i,t[28]=O,t[29]=j}else j=t[29];let M=j;if(m){let e=O?`暂时无法打开任务对话。`:`Could not open the task conversation.`,n;t[35]===e?n=t[36]:(n=(0,$.jsx)(`p`,{children:e}),t[35]=e,t[36]=n);let r;t[37]===h?r=t[38]:(r=()=>void h(),t[37]=h,t[38]=r);let i=O?`重试`:`Retry`,a;t[39]!==r||t[40]!==i?(a=(0,$.jsx)(Ce,{variant:`secondary`,onClick:r,children:i}),t[39]=r,t[40]=i,t[41]=a):a=t[41];let o;return t[42]!==n||t[43]!==a?(o=(0,$.jsxs)(`div`,{role:`alert`,className:`p-6 text-sm text-fg-muted`,children:[n,a]}),t[42]=n,t[43]=a,t[44]=o):o=t[44],o}let N=O?`任务对话`:`Task conversation`,P;t[45]!==M||t[46]!==S?(P=S?(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(J,{className:`m-5 h-40`}),children:(0,$.jsx)(yt,{embedded:!0,conversationId:S,automationWorkspace:!0,automationTimelineEntries:M},S)}):(0,$.jsxs)(`div`,{className:`space-y-4 p-6`,children:[(0,$.jsx)(J,{className:`h-20 w-2/3`}),(0,$.jsx)(J,{className:`h-28`})]}),t[45]=M,t[46]=S,t[47]=P):P=t[47];let F;return t[48]!==N||t[49]!==P?(F=(0,$.jsx)(`section`,{className:`flex h-full min-h-0 min-w-0 flex-col overflow-hidden`,"aria-label":N,children:P}),t[48]=N,t[49]=P,t[50]=F):F=t[50],F}function xt(e){return Array.isArray(e)&&[`automations`,`automation-runs`,`automation-history`,`automation-configuration`].includes(String(e[0]))}var St=`relative flex min-h-9 cursor-pointer items-center rounded-md py-2 pl-3 pr-8 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover`,Ct=`z-70 max-h-[min(32rem,calc(100dvh-2rem))] min-w-52 overflow-y-auto rounded-xl border border-edge bg-surface-overlay p-1.5 shadow-popover`;function wt(e){let t=(0,ot.c)(4),{value:n,children:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsx)(je,{className:`absolute right-2.5`,children:(0,$.jsx)(F,{className:`size-3.5`,"aria-hidden":!0})}),t[0]=i):i=t[0];let a;return t[1]!==r||t[2]!==n?(a=(0,$.jsxs)(Oe,{value:n,className:St,children:[i,r]}),t[1]=r,t[2]=n,t[3]=a):a=t[3],a}function Tt(e){let t=(0,ot.c)(131),{language:n,labels:r,filter:i,ownership:a,source:o,projectId:s,projects:c,projectLocked:l,query:u,unreadCount:d,markReadBusy:f,onFilter:p,onOwnership:m,onSource:h,onProject:g,onQuery:_,onClear:v,onMarkAllRead:y}=e,b=n===`zh`,[x,S]=(0,Q.useState)(!1),C=(0,Q.useRef)(null),ee=(0,Q.useRef)(null),w=x||!!u,T=i!==`all`||o!==`all`||a!==`user`||!l&&!!s,E;t[0]===_?E=t[1]:(E=()=>{_(``),S(!1),ee.current?.focus()},t[0]=_,t[1]=E);let D=E,O=b?`定时任务`:`Scheduled tasks`,k;t[2]===O?k=t[3]:(k=(0,$.jsx)(`h2`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:O}),t[2]=O,t[3]=k);let A=b?`筛选任务`:`Filter tasks`,M=b?`筛选任务`:`Filter tasks`,N=T&&`text-accent-fg`,P;t[4]===N?P=t[5]:(P=q(`relative rounded-md p-2 text-fg-muted hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent data-[state=open]:bg-surface-hover`,N),t[4]=N,t[5]=P);let F;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,$.jsx)(V,{className:`size-4`,"aria-hidden":!0}),t[6]=F):F=t[6];let te;t[7]!==T||t[8]!==b?(te=T?(0,$.jsx)(`span`,{className:`absolute right-1.5 top-1.5 size-1 rounded-full bg-accent`,children:(0,$.jsx)(`span`,{className:`sr-only`,children:b?`已应用筛选`:`Filters applied`})}):null,t[7]=T,t[8]=b,t[9]=te):te=t[9];let I;t[10]!==A||t[11]!==M||t[12]!==P||t[13]!==te?(I=(0,$.jsx)(Ne,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,"aria-label":A,title:M,className:P,children:[F,te]})}),t[10]=A,t[11]=M,t[12]=P,t[13]=te,t[14]=I):I=t[14];let L=b?`状态`:`Status`,re;t[15]===L?re=t[16]:(re=(0,$.jsx)(De,{className:`px-3 py-1.5 text-xs text-fg-subtle`,children:L}),t[15]=L,t[16]=re);let ie;t[17]===p?ie=t[18]:(ie=e=>p(e),t[17]=p,t[18]=ie);let R=b?`全部状态`:`All statuses`,z;t[19]===R?z=t[20]:(z=(0,$.jsx)(wt,{value:`all`,children:R}),t[19]=R,t[20]=z);let ae;t[21]===r.filters.active?ae=t[22]:(ae=(0,$.jsx)(wt,{value:`active`,children:r.filters.active}),t[21]=r.filters.active,t[22]=ae);let B;t[23]===r.paused?B=t[24]:(B=(0,$.jsx)(wt,{value:`paused`,children:r.paused}),t[23]=r.paused,t[24]=B);let oe=b?`已完成`:`Completed`,se;t[25]===oe?se=t[26]:(se=(0,$.jsx)(wt,{value:`completed`,children:oe}),t[25]=oe,t[26]=se);let ce;t[27]===r.metrics.running?ce=t[28]:(ce=(0,$.jsx)(wt,{value:`running`,children:r.metrics.running}),t[27]=r.metrics.running,t[28]=ce);let U;t[29]===r.dashboard.needsAttention?U=t[30]:(U=(0,$.jsx)(wt,{value:`attention`,children:r.dashboard.needsAttention}),t[29]=r.dashboard.needsAttention,t[30]=U);let le;t[31]!==i||t[32]!==ie||t[33]!==z||t[34]!==ae||t[35]!==B||t[36]!==se||t[37]!==ce||t[38]!==U?(le=(0,$.jsxs)(Le,{value:i,onValueChange:ie,children:[z,ae,B,se,ce,U]}),t[31]=i,t[32]=ie,t[33]=z,t[34]=ae,t[35]=B,t[36]=se,t[37]=ce,t[38]=U,t[39]=le):le=t[39];let W;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,$.jsx)(ze,{className:`my-1 border-t border-edge`}),t[40]=W):W=t[40];let G=b?`归属`:`Owner`,ue;t[41]===G?ue=t[42]:(ue=(0,$.jsx)(De,{className:`px-3 py-1.5 text-xs text-fg-subtle`,children:G}),t[41]=G,t[42]=ue);let de;t[43]===m?de=t[44]:(de=e=>m(e),t[43]=m,t[44]=de);let fe=b?`我的任务`:`My tasks`,pe;t[45]===fe?pe=t[46]:(pe=(0,$.jsx)(wt,{value:`user`,children:fe}),t[45]=fe,t[46]=pe);let he=b?`系统任务`:`System tasks`,J;t[47]===he?J=t[48]:(J=(0,$.jsx)(wt,{value:`system`,children:he}),t[47]=he,t[48]=J);let ge;t[49]!==a||t[50]!==de||t[51]!==pe||t[52]!==J?(ge=(0,$.jsxs)(Le,{value:a,onValueChange:de,children:[pe,J]}),t[49]=a,t[50]=de,t[51]=pe,t[52]=J,t[53]=ge):ge=t[53];let _e;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(_e=(0,$.jsx)(ze,{className:`my-1 border-t border-edge`}),t[54]=_e):_e=t[54];let ve;t[55]!==r.filters.allProjects||t[56]!==g||t[57]!==s||t[58]!==l||t[59]!==c||t[60]!==b?(ve=l?null:(0,$.jsxs)(ke,{children:[(0,$.jsxs)(Fe,{className:`flex min-h-9 cursor-pointer items-center justify-between gap-4 rounded-md px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover`,children:[b?`项目`:`Project`,(0,$.jsx)(`span`,{className:`ml-auto max-w-28 truncate text-xs text-fg-muted`,children:c.find(e=>e.id===s)?.name??r.filters.allProjects}),(0,$.jsx)(ne,{className:`size-3.5 text-fg-subtle`,"aria-hidden":!0})]}),(0,$.jsx)(Pe,{children:(0,$.jsx)(Ae,{sideOffset:4,className:Ct,children:(0,$.jsxs)(Le,{value:s,onValueChange:g,children:[(0,$.jsx)(wt,{value:``,children:r.filters.allProjects}),c.map(Et)]})})})]}),t[55]=r.filters.allProjects,t[56]=g,t[57]=s,t[58]=l,t[59]=c,t[60]=b,t[61]=ve):ve=t[61];let ye=b?`任务类型`:`Task type`,be;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(be=(0,$.jsx)(ne,{className:`size-3.5 text-fg-subtle`,"aria-hidden":!0}),t[62]=be):be=t[62];let xe;t[63]===ye?xe=t[64]:(xe=(0,$.jsxs)(Fe,{className:`flex min-h-9 cursor-pointer items-center justify-between gap-4 rounded-md px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover`,children:[ye,be]}),t[63]=ye,t[64]=xe);let Se;t[65]===h?Se=t[66]:(Se=e=>h(e),t[65]=h,t[66]=Se);let Ce=b?`全部类型`:`All types`,we;t[67]===Ce?we=t[68]:(we=(0,$.jsx)(wt,{value:`all`,children:Ce}),t[67]=Ce,t[68]=we);let Y;t[69]===r.sources.agent?Y=t[70]:(Y=(0,$.jsx)(wt,{value:`agent`,children:r.sources.agent}),t[69]=r.sources.agent,t[70]=Y);let Te;t[71]===r.sources.task?Te=t[72]:(Te=(0,$.jsx)(wt,{value:`task_command`,children:r.sources.task}),t[71]=r.sources.task,t[72]=Te);let X;t[73]!==o||t[74]!==Se||t[75]!==we||t[76]!==Y||t[77]!==Te?(X=(0,$.jsx)(Pe,{children:(0,$.jsx)(Ae,{sideOffset:4,className:Ct,children:(0,$.jsxs)(Le,{value:o,onValueChange:Se,children:[we,Y,Te]})})}),t[73]=o,t[74]=Se,t[75]=we,t[76]=Y,t[77]=Te,t[78]=X):X=t[78];let Ee;t[79]!==xe||t[80]!==X?(Ee=(0,$.jsxs)(ke,{children:[xe,X]}),t[79]=xe,t[80]=X,t[81]=Ee):Ee=t[81];let Oe;t[82]!==T||t[83]!==v||t[84]!==u||t[85]!==b?(Oe=T||u?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ze,{className:`my-1 border-t border-edge`}),(0,$.jsx)(Ie,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-fg-muted outline-none data-[highlighted]:bg-surface-hover`,onSelect:v,children:b?`重置筛选`:`Reset filters`})]}):null,t[82]=T,t[83]=v,t[84]=u,t[85]=b,t[86]=Oe):Oe=t[86];let je;t[87]!==re||t[88]!==le||t[89]!==ue||t[90]!==ge||t[91]!==ve||t[92]!==Ee||t[93]!==Oe?(je=(0,$.jsx)(Pe,{children:(0,$.jsxs)(Re,{align:`end`,sideOffset:6,className:Ct,children:[re,le,W,ue,ge,_e,ve,Ee,Oe]})}),t[87]=re,t[88]=le,t[89]=ue,t[90]=ge,t[91]=ve,t[92]=Ee,t[93]=Oe,t[94]=je):je=t[94];let Be;t[95]!==I||t[96]!==je?(Be=(0,$.jsxs)(Me,{children:[I,je]}),t[95]=I,t[96]=je,t[97]=Be):Be=t[97];let Ve=b?`搜索任务`:`Search tasks`,He=b?`搜索任务`:`Search tasks`,Ue;t[98]!==D||t[99]!==w?(Ue=()=>{w?D():(S(!0),requestAnimationFrame(()=>C.current?.focus()))},t[98]=D,t[99]=w,t[100]=Ue):Ue=t[100];let We=w&&`bg-surface-hover text-fg`,Z;t[101]===We?Z=t[102]:(Z=q(`rounded-md p-2 text-fg-muted hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,We),t[101]=We,t[102]=Z);let Ge;t[103]===Symbol.for(`react.memo_cache_sentinel`)?(Ge=(0,$.jsx)(K,{className:`size-4`,"aria-hidden":!0}),t[103]=Ge):Ge=t[103];let Ke;t[104]!==w||t[105]!==Ve||t[106]!==He||t[107]!==Ue||t[108]!==Z?(Ke=(0,$.jsx)(`button`,{ref:ee,type:`button`,"aria-label":Ve,title:He,"aria-expanded":w,onClick:Ue,className:Z,children:Ge}),t[104]=w,t[105]=Ve,t[106]=He,t[107]=Ue,t[108]=Z,t[109]=Ke):Ke=t[109];let qe;t[110]!==Be||t[111]!==Ke?(qe=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5`,children:[Be,Ke]}),t[110]=Be,t[111]=Ke,t[112]=qe):qe=t[112];let Je;t[113]!==k||t[114]!==qe?(Je=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-1`,children:[k,qe]}),t[113]=k,t[114]=qe,t[115]=Je):Je=t[115];let Ye;t[116]!==r.filters.markAllRead||t[117]!==f||t[118]!==y||t[119]!==d?(Ye=d>0?(0,$.jsxs)(`button`,{type:`button`,disabled:f,onClick:y,className:`flex min-h-9 w-full items-center gap-2 rounded-md px-2 text-xs text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:ring-2 focus-visible:ring-accent disabled:pointer-events-none disabled:opacity-50`,"aria-busy":f,children:[f?(0,$.jsx)(H,{className:`size-4 shrink-0 animate-spin`,"aria-hidden":!0}):(0,$.jsx)(j,{className:`size-4 shrink-0`,"aria-hidden":!0}),r.filters.markAllRead]}):null,t[116]=r.filters.markAllRead,t[117]=f,t[118]=y,t[119]=d,t[120]=Ye):Ye=t[120];let Xe;t[121]!==D||t[122]!==_||t[123]!==u||t[124]!==w||t[125]!==b?(Xe=w?(0,$.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-edge bg-surface-panel px-2.5 focus-within:border-accent`,children:[(0,$.jsx)(K,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,$.jsx)(`input`,{ref:C,value:u,onChange:e=>_(e.target.value),onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),D())},"aria-label":b?`搜索任务名称或内容`:`Search task names or content`,placeholder:b?`搜索任务…`:`Search tasks…`,className:`min-h-10 min-w-0 flex-1 bg-transparent text-sm text-fg outline-none placeholder:text-fg-subtle`}),(0,$.jsx)(`button`,{type:`button`,"aria-label":b?`关闭搜索`:`Close search`,onClick:D,className:`rounded-md p-1 text-fg-muted hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,children:(0,$.jsx)(me,{className:`size-3.5`,"aria-hidden":!0})})]}):null,t[121]=D,t[122]=_,t[123]=u,t[124]=w,t[125]=b,t[126]=Xe):Xe=t[126];let Ze;return t[127]!==Je||t[128]!==Ye||t[129]!==Xe?(Ze=(0,$.jsxs)(`div`,{className:`space-y-2`,children:[Je,Ye,Xe]}),t[127]=Je,t[128]=Ye,t[129]=Xe,t[130]=Ze):Ze=t[130],Ze}function Et(e){return(0,$.jsx)(wt,{value:e.id,children:(0,$.jsx)(`span`,{className:`max-w-56 truncate`,children:e.name})},e.id)}var Dt=[[`☀️`,`晨间简报`,`每天开始工作前,整理今天值得关注的任务与进展。`,`Morning briefing`,`Start each day with your tasks and project updates.`,`每天早上帮我整理当天到期、逾期的任务和项目进展,给出今天的重点。`,`Each morning, summarize my due and overdue tasks and project progress, and suggest priorities.`],[`📝`,`每周工作回顾`,`回顾一周的成果和问题,为下周留出清晰的方向。`,`Weekly review`,`Review the week and find a clear direction for the next.`,`每周五帮我回顾本周完成的任务和项目进展,整理未解决的问题,建议下周的重点。`,`Every Friday, review completed tasks and project progress, unresolved issues, and priorities for next week.`],[`🌱`,`项目进展跟进`,`定期看看项目进度,找出需要你关注的事情。`,`Project check-in`,`Keep an eye on project progress and what needs attention.`,`定期帮我检查项目进度,整理延期、阻塞和需要我决策的事项。先和我确认关注哪个项目以及运行时间。`,`Regularly review a project for delays, blockers, and decisions I need to make. Ask which project and when to run.`],[`🔔`,`重要事项提醒`,`把容易忘记的事情交给提醒,安心专注眼前。`,`A timely reminder`,`Make room to focus by setting a reminder for later.`,`我想安排一个重要事项提醒。请先问我需要提醒什么、什么时候提醒,以及是否重复。`,`Help me schedule a reminder. Ask what to remember, when, and whether it should repeat.`],[`📚`,`笔记整理`,`回看新收集的想法,整理出值得继续推进的线索。`,`Notes roundup`,`Revisit recent ideas and surface useful next steps.`,`每周帮我回顾最近新增的笔记,按主题整理,找出值得继续推进的想法。请先确认时间和范围。`,`Each week, group my recent notes by topic and suggest ideas worth pursuing. Confirm the schedule and scope.`],[`🧭`,`明日工作计划`,`下班前梳理未完成的事,安排明天最重要的三件事。`,`Plan tomorrow`,`Wrap up loose ends and choose tomorrow’s top three priorities.`,`每个工作日下班前,帮我梳理未完成的任务,建议明天最重要的三件事。请先确认具体时间。`,`Before the end of each workday, review unfinished tasks and suggest tomorrow’s top three priorities. Confirm the time.`],[`🗓️`,`月度复盘`,`拉远一点看进展,发现反复出现的问题和新的机会。`,`Monthly reflection`,`Step back to spot progress, recurring problems, and opportunities.`,`每月月底帮我回顾项目和任务的进展,总结成果、反复出现的问题和下个月的重点。请确认运行时间。`,`At the end of each month, review project and task progress, achievements, recurring problems, and priorities. Confirm the schedule.`],[`🎯`,`逾期任务检查`,`定期发现被搁置的事项,让重要的事重新向前。`,`Overdue task check`,`Find neglected tasks and get important work moving again.`,`定期帮我检查逾期任务,按紧迫程度整理,并建议下一步。请先确认运行频率和时间。`,`Regularly review overdue tasks, prioritize them by urgency, and suggest next steps. Confirm the frequency and time.`]];function Ot(e=Math.random){let t=[...Dt];for(let n=t.length-1;n>0;n--){let r=Math.min(n,Math.max(0,Math.floor(e()*(n+1))));[t[n],t[r]]=[t[r],t[n]]}return t.slice(0,6)}function kt({language:e,projectId:t,onOpenConversation:n}){let r=o(),[i,a]=(0,Q.useState)(!1),[s,c]=(0,Q.useState)(``),l=async e=>{a(!0),c(``);try{let i=await Ke({projectId:t,prompt:e});n?n(i):r(i)}catch(e){c(e instanceof Error?e.message:String(e))}finally{a(!1)}},u=e===`zh`,[d,f]=(0,Q.useState)(Ot),p=(0,$.jsxs)(`div`,{className:`mx-auto w-full max-w-3xl px-2 py-10 sm:px-6 md:py-20`,children:[(0,$.jsxs)(`div`,{className:`text-center`,children:[(0,$.jsx)(C,{className:`mx-auto size-10 text-fg-muted`,strokeWidth:1.3,"aria-hidden":!0}),(0,$.jsx)(`h2`,{className:`mt-4 text-xl font-semibold tracking-tight text-fg`,children:u?`安排任务`:`Schedule a task`}),(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:u?`说说你希望定期完成什么,我们一起安排好。`:`Tell us what you’d like done regularly. We’ll work out the details together.`})]}),(0,$.jsxs)(`div`,{className:`mb-3 mt-10 flex items-center justify-between text-xs text-fg-muted`,children:[(0,$.jsx)(`span`,{children:u?`也可以从这些想法开始`:`Or start with an idea`}),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>f(Ot()),className:`flex items-center gap-1.5 rounded-md px-2 py-1.5 hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,$.jsx)(G,{className:`size-3.5`,"aria-hidden":!0}),u?`换一组`:`More ideas`]})]}),(0,$.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:d.map(e=>(0,$.jsxs)(`button`,{type:`button`,disabled:i,onClick:()=>void l(u?e[5]:e[6]),className:`flex min-h-28 items-center gap-4 rounded-xl border border-dashed border-edge bg-surface-panel px-5 py-4 transition-colors hover:border-edge-strong hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,$.jsx)(`span`,{className:`shrink-0 text-2xl`,"aria-hidden":!0,children:e[0]}),(0,$.jsxs)(`span`,{className:`min-w-0`,children:[(0,$.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:u?e[1]:e[3]}),(0,$.jsx)(`span`,{className:`mt-1 block text-sm leading-5 text-fg-muted`,children:u?e[2]:e[4]})]})]},e[1]))}),(0,$.jsx)(`div`,{className:`mt-6 text-center`,children:(0,$.jsx)(`button`,{type:`button`,disabled:i,onClick:()=>void l(),className:`rounded-md px-3 py-2 text-sm text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:ring-2 focus-visible:ring-accent`,children:u?`说说你想安排的其他任务`:`Describe another task`})}),s?(0,$.jsx)(`p`,{role:`alert`,className:`mt-3 text-center text-sm text-danger`,children:s}):null]});return(0,$.jsx)(`section`,{"aria-label":u?`安排任务`:`Schedule a task`,children:p})}function At(e){if(!e.trim())return null;try{return JSON.parse(e)}catch{return null}}function jt(e){return typeof e.message==`string`&&e.message.trim()?e.message:typeof e.error==`string`&&e.error.trim()?e.error:e.error&&typeof e.error==`object`&&typeof e.error.message==`string`?e.error.message:`AI suggestion failed`}function Mt(e,t={}){let n=At(e.split(`
3
3
  `).filter(e=>e.startsWith(`data:`)).map(e=>e.slice(5).trimStart()).join(`
4
4
  `));if(!n)return null;if(n.type===`text_delta`&&typeof n.delta==`string`)return t.onDelta?.(n.delta),null;if(n.type===`thinking_delta`&&typeof n.delta==`string`)return t.onThinkingDelta?.(n.delta),null;if(n.type===`done`&&typeof n.text==`string`)return n.text;if(n.type===`error`)throw Error(jt(n));return null}async function Nt(e,t={}){let n=await c(l(`/api/ai/text-assist`),{method:`POST`,headers:{Accept:`text/event-stream`},body:JSON.stringify(e)});if(!n.ok){let e=await n.json().catch(()=>({})),t=typeof e.error==`string`?e.error:e.error?.message;throw Error(t||`AI suggestion failed (${n.status})`)}if(!n.body){let e=await n.json().catch(()=>null);if(e?.text)return e;throw Error(`AI suggestion stream is empty`)}let r=n.body.getReader(),i=new TextDecoder,a=``,o=``,s=``;for(;;){let{done:e,value:n}=await r.read();if(n){a+=i.decode(n,{stream:!e});let r=a.split(/\r?\n\r?\n/);a=r.pop()??``;for(let e of r){let n=Mt(e,{onDelta:e=>{o+=e,t.onDelta?.(e)},onThinkingDelta:e=>{s+=e,t.onThinkingDelta?.(e)}});n!==null&&(o=n)}}if(e)break}if(a.trim()){let e=Mt(a,{onDelta:e=>{o+=e,t.onDelta?.(e)},onThinkingDelta:e=>{s+=e,t.onThinkingDelta?.(e)}});e!==null&&(o=e)}let u=o.trim();if(!u)throw Error(`AI returned an empty suggestion`);return{text:u,thinking:s.trim()||void 0}}function Pt(){let[e,t]=(0,Q.useState)(``),[n,r]=(0,Q.useState)(``),[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(null);return{suggestion:e,thinking:n,loading:i,error:o,generate:(0,Q.useCallback)(async e=>{a(!0),s(null),t(``),r(``);try{let n=await Nt(e,{onDelta:e=>{t(t=>t+e)},onThinkingDelta:e=>{r(t=>t+e)}});return t(n.text),r(n.thinking??``),n.text}catch(e){let t=e instanceof Error?e.message:`AI suggestion failed`;return s(t),null}finally{a(!1)}},[]),reset:(0,Q.useCallback)(()=>{t(``),r(``),s(null),a(!1)},[])}}var Ft=5;function It(e){return e.startsWith(`zh`)?{title:`AI 优化文案`,buttonTitle:`优化文案`,current:`当前内容`,suggestion:`AI 建议`,editedSuggestion:`审核并编辑建议`,thinking:`模型思考`,thinkingLoading:`思考中`,edit:`编辑`,preview:`预览`,loading:`正在生成建议...`,empty:`暂无内容`,generate:`生成建议`,regenerate:`重新生成`,applyCurrent:`应用当前内容`,replace:`替换`,append:`追加`,cancel:`取消`,close:`关闭`}:{title:`AI text assist`,buttonTitle:`Improve text`,current:`Current`,suggestion:`Suggestion`,editedSuggestion:`Review and edit suggestion`,thinking:`Model thinking`,thinkingLoading:`Thinking`,edit:`Edit`,preview:`Preview`,loading:`Generating suggestion...`,empty:`No content`,generate:`Generate suggestion`,regenerate:`Regenerate`,applyCurrent:`Apply current`,replace:`Replace`,append:`Append`,cancel:`Cancel`,close:`Close`}}function Lt(e){let t=(0,ot.c)(245),{value:n,onApply:r,fieldId:i,fieldLabel:a,scenario:o,format:s,intent:c,locale:l,context:u,disabled:d,className:f,showLabel:y}=e,b=o===void 0?`generic.text`:o,x=s===void 0?`plain`:s,S=c===void 0?`improve`:c,C=y===void 0||y,[ee,w]=(0,Q.useState)(!1),[T,E]=(0,Q.useState)(n),[D,O]=(0,Q.useState)(`preview`),[k,A]=(0,Q.useState)(``),[j,M]=(0,Q.useState)(`edit`),[N,P]=(0,Q.useState)(!0),[F,ne]=(0,Q.useState)(!1),[I,L]=(0,Q.useState)(null),re=(0,Q.useRef)(null),ie=(0,Q.useRef)(!0),{suggestion:R,thinking:z,loading:B,error:V,generate:H,reset:se}=Pt(),ce;t[0]===l?ce=t[1]:(ce=It(l),t[0]=l,t[1]=ce);let U=ce,le;t[2]!==B||t[3]!==z?(le=B&&z.trim().length>0,t[2]=B,t[3]=z,t[4]=le):le=t[4];let W=le,K,ue;t[5]!==ee||t[6]!==n?(K=()=>{ee||E(n)},ue=[ee,n],t[5]=ee,t[6]=n,t[7]=K,t[8]=ue):(K=t[7],ue=t[8]),(0,Q.useEffect)(K,ue);let pe,he;t[9]===R?(pe=t[10],he=t[11]):(he=()=>{A(R)},pe=[R],t[9]=R,t[10]=pe,t[11]=he),(0,Q.useEffect)(he,pe);let J,ge;t[12]===z?(J=t[13],ge=t[14]):(J=()=>{z.trim()&&P(!0)},ge=[z],t[12]=z,t[13]=J,t[14]=ge),(0,Q.useEffect)(J,ge);let _e;t[15]!==W||t[16]!==N?(_e=()=>{let e=re.current;!e||!W||!N||ie.current&&(e.scrollTop=e.scrollHeight)},t[15]=W,t[16]=N,t[17]=_e):_e=t[17];let ve;t[18]!==W||t[19]!==z||t[20]!==N?(ve=[W,z,N],t[18]=W,t[19]=z,t[20]=N,t[21]=ve):ve=t[21],(0,Q.useLayoutEffect)(_e,ve);let ye;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(ye=()=>{let e=re.current;if(!e)return;let t=e.scrollHeight-e.scrollTop-e.clientHeight;ie.current=t<=Ft},t[22]=ye):ye=t[22];let be=ye,xe;t[23]!==u||t[24]!==i||t[25]!==a||t[26]!==x||t[27]!==H||t[28]!==S||t[29]!==l||t[30]!==b?(xe=async e=>{M(`edit`),P(!0),ie.current=!0,await H({intent:S,scenario:b,input:e,locale:l,field:{id:i,label:a,format:x},context:u})},t[23]=u,t[24]=i,t[25]=a,t[26]=x,t[27]=H,t[28]=S,t[29]=l,t[30]=b,t[31]=xe):xe=t[31];let Se=xe,we;t[32]!==se||t[33]!==n?(we=e=>{ne(!!e.currentTarget.closest(`[role="dialog"]`)),L(document.querySelector(`.app-main-surface`)),E(n),O(`preview`),A(``),M(`edit`),P(!0),se(),w(!0)},t[32]=se,t[33]=n,t[34]=we):we=t[34];let Y=we,Te;t[35]!==T||t[36]!==Se?(Te=async()=>{await Se(T)},t[35]=T,t[36]=Se,t[37]=Te):Te=t[37];let Ee=Te,De;t[38]!==se||t[39]!==n?(De=()=>{w(!1),E(n),O(`preview`),A(``),M(`edit`),P(!0),se()},t[38]=se,t[39]=n,t[40]=De):De=t[40];let Oe=De,ke;t[41]!==Oe||t[42]!==T||t[43]!==r?(ke=()=>{r(T),Oe()},t[41]=Oe,t[42]=T,t[43]=r,t[44]=ke):ke=t[44];let Ae=ke,je;t[45]!==Oe||t[46]!==k||t[47]!==r?(je=()=>{k.trim()&&(r(k),Oe())},t[45]=Oe,t[46]=k,t[47]=r,t[48]=je):je=t[48];let Me=je,Ne;t[49]!==Oe||t[50]!==T||t[51]!==k||t[52]!==r?(Ne=()=>{if(!k.trim())return;let e=T.trimEnd();r(e?`${e}\n\n${k}`:k),Oe()},t[49]=Oe,t[50]=T,t[51]=k,t[52]=r,t[53]=Ne):Ne=t[53];let Pe=Ne,Fe;t[54]!==k||t[55]!==V||t[56]!==B?(Fe=!B&&!V&&k.trim().length>0,t[54]=k,t[55]=V,t[56]=B,t[57]=Fe):Fe=t[57];let Ie=Fe,Le=T!==n,Re;t[58]!==k||t[59]!==V||t[60]!==z?(Re=k.trim().length>0||z.trim().length>0||!!V,t[58]=k,t[59]=V,t[60]=z,t[61]=Re):Re=t[61];let ze=Re,Be=!C&&`size-7 p-0`,Ve;t[62]!==f||t[63]!==Be?(Ve=q(`h-7 gap-1 px-2 text-xs`,Be,f),t[62]=f,t[63]=Be,t[64]=Ve):Ve=t[64];let He=d||B,Ue;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(Ue=(0,$.jsx)(de,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[65]=Ue):Ue=t[65];let We=C?U.buttonTitle:null,Z;t[66]!==U.buttonTitle||t[67]!==Y||t[68]!==Ve||t[69]!==He||t[70]!==We?(Z=(0,$.jsxs)(Ce,{type:`button`,variant:`ghost`,className:Ve,title:U.buttonTitle,"aria-label":U.buttonTitle,disabled:He,onClick:Y,children:[Ue,We]}),t[66]=U.buttonTitle,t[67]=Y,t[68]=Ve,t[69]=He,t[70]=We,t[71]=Z):Z=t[71];let Ge;t[72]===Oe?Ge=t[73]:(Ge=e=>e?w(!0):Oe(),t[72]=Oe,t[73]=Ge);let Ke=I??void 0,qe=F?`bg-transparent`:`bg-scrim`,Je;t[74]===qe?Je=t[75]:(Je=q(`xopc-dialog-overlay absolute inset-0 z-[80]`,qe),t[74]=qe,t[75]=Je);let Ye;t[76]===Je?Ye=t[77]:(Ye=(0,$.jsx)(p,{className:Je}),t[76]=Je,t[77]=Ye);let Xe;t[78]===U.title?Xe=t[79]:(Xe=(0,$.jsx)(_,{className:`text-base font-semibold text-fg`,children:U.title}),t[78]=U.title,t[79]=Xe);let Ze;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(Ze=(0,$.jsx)(me,{className:`size-5`,strokeWidth:1.75}),t[80]=Ze):Ze=t[80];let Qe;t[81]===U.close?Qe=t[82]:(Qe=(0,$.jsx)(m,{asChild:!0,children:(0,$.jsx)(Ce,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":U.close,children:Ze})}),t[81]=U.close,t[82]=Qe);let $e;t[83]!==Xe||t[84]!==Qe?($e=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[Xe,Qe]}),t[83]=Xe,t[84]=Qe,t[85]=$e):$e=t[85];let et;t[86]===U.current?et=t[87]:(et=(0,$.jsx)(`div`,{className:`min-w-0 text-xs font-medium text-fg-muted`,children:U.current}),t[86]=U.current,t[87]=et);let tt=U.current,nt=D===`edit`,rt=D===`edit`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,it;t[88]===rt?it=t[89]:(it=q(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,rt),t[88]=rt,t[89]=it);let at,st;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(at=()=>O(`edit`),st=(0,$.jsx)(fe,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[90]=at,t[91]=st):(at=t[90],st=t[91]);let ct;t[92]!==U.edit||t[93]!==nt||t[94]!==it?(ct=(0,$.jsxs)(`button`,{"aria-pressed":nt,type:`button`,className:it,onClick:at,children:[st,U.edit]}),t[92]=U.edit,t[93]=nt,t[94]=it,t[95]=ct):ct=t[95];let lt=D===`preview`,ut=D===`preview`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,dt;t[96]===ut?dt=t[97]:(dt=q(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,ut),t[96]=ut,t[97]=dt);let ft,pt;t[98]===Symbol.for(`react.memo_cache_sentinel`)?(ft=()=>O(`preview`),pt=(0,$.jsx)(ae,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[98]=ft,t[99]=pt):(ft=t[98],pt=t[99]);let mt;t[100]!==U.preview||t[101]!==lt||t[102]!==dt?(mt=(0,$.jsxs)(`button`,{"aria-pressed":lt,type:`button`,className:dt,onClick:ft,children:[pt,U.preview]}),t[100]=U.preview,t[101]=lt,t[102]=dt,t[103]=mt):mt=t[103];let ht;t[104]!==U.current||t[105]!==ct||t[106]!==mt?(ht=(0,$.jsxs)(X,{className:`flex shrink-0 items-center gap-1 rounded-lg border border-edge bg-surface-inset p-0.5`,role:`group`,"aria-label":tt,indicatorClassName:`rounded-md bg-surface-panel shadow-surface`,children:[ct,mt]}),t[104]=U.current,t[105]=ct,t[106]=mt,t[107]=ht):ht=t[107];let gt;t[108]!==et||t[109]!==ht?(gt=(0,$.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[et,ht]}),t[108]=et,t[109]=ht,t[110]=gt):gt=t[110];let _t;t[111]!==T||t[112]!==D||t[113]!==x||t[114]!==U.current||t[115]!==U.empty?(_t=D===`preview`?(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg`,children:x===`markdown`?(0,$.jsx)(oe,{content:T||U.empty,compact:!0,className:`text-sm`}):(0,$.jsx)(`pre`,{className:`whitespace-pre-wrap text-sm leading-6 text-fg`,children:T||U.empty})}):(0,$.jsx)(`textarea`,{className:`min-h-0 flex-1 resize-none overflow-auto rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/25`,value:T,onChange:e=>E(e.currentTarget.value),placeholder:U.empty,"aria-label":U.current}),t[111]=T,t[112]=D,t[113]=x,t[114]=U.current,t[115]=U.empty,t[116]=_t):_t=t[116];let vt;t[117]!==gt||t[118]!==_t?(vt=(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-col overflow-hidden`,children:[gt,_t]}),t[117]=gt,t[118]=_t,t[119]=vt):vt=t[119];let yt;t[120]===U.editedSuggestion?yt=t[121]:(yt=(0,$.jsx)(`span`,{children:U.editedSuggestion}),t[120]=U.editedSuggestion,t[121]=yt);let bt;t[122]!==U.loading||t[123]!==B?(bt=B?(0,$.jsx)(`span`,{className:`ml-2 font-normal`,children:U.loading}):null,t[122]=U.loading,t[123]=B,t[124]=bt):bt=t[124];let xt;t[125]!==yt||t[126]!==bt?(xt=(0,$.jsxs)(`div`,{className:`min-w-0 text-xs font-medium text-fg-muted`,children:[yt,bt]}),t[125]=yt,t[126]=bt,t[127]=xt):xt=t[127];let St=U.editedSuggestion,Ct=j===`edit`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,wt;t[128]===Ct?wt=t[129]:(wt=q(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,Ct),t[128]=Ct,t[129]=wt);let Tt=j===`edit`,Et,Dt;t[130]===Symbol.for(`react.memo_cache_sentinel`)?(Et=()=>M(`edit`),Dt=(0,$.jsx)(fe,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[130]=Et,t[131]=Dt):(Et=t[130],Dt=t[131]);let Ot;t[132]!==U.edit||t[133]!==wt||t[134]!==Tt?(Ot=(0,$.jsxs)(`button`,{type:`button`,className:wt,"aria-pressed":Tt,onClick:Et,children:[Dt,U.edit]}),t[132]=U.edit,t[133]=wt,t[134]=Tt,t[135]=Ot):Ot=t[135];let kt=j===`preview`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,At;t[136]===kt?At=t[137]:(At=q(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,kt),t[136]=kt,t[137]=At);let jt=j===`preview`,Mt,Nt;t[138]===Symbol.for(`react.memo_cache_sentinel`)?(Mt=()=>M(`preview`),Nt=(0,$.jsx)(ae,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[138]=Mt,t[139]=Nt):(Mt=t[138],Nt=t[139]);let Lt;t[140]!==U.preview||t[141]!==At||t[142]!==jt?(Lt=(0,$.jsxs)(`button`,{type:`button`,className:At,"aria-pressed":jt,onClick:Mt,children:[Nt,U.preview]}),t[140]=U.preview,t[141]=At,t[142]=jt,t[143]=Lt):Lt=t[143];let Bt;t[144]!==U.editedSuggestion||t[145]!==Ot||t[146]!==Lt?(Bt=(0,$.jsxs)(X,{className:`flex shrink-0 items-center gap-1 rounded-lg border border-edge bg-surface-inset p-0.5`,role:`group`,"aria-label":St,indicatorClassName:`rounded-md bg-surface-panel shadow-surface`,children:[Ot,Lt]}),t[144]=U.editedSuggestion,t[145]=Ot,t[146]=Lt,t[147]=Bt):Bt=t[147];let Vt;t[148]!==xt||t[149]!==Bt?(Vt=(0,$.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[xt,Bt]}),t[148]=xt,t[149]=Bt,t[150]=Vt):Vt=t[150];let Ht=W?`opacity-100`:`pointer-events-none opacity-0`,Ut;t[151]===Ht?Ut=t[152]:(Ut=q(`absolute inset-0 min-h-0 transition-opacity duration-200 ease-out motion-reduce:transition-none`,Ht),t[151]=Ht,t[152]=Ut);let Wt=!W,Gt;t[153]===Symbol.for(`react.memo_cache_sentinel`)?(Gt=()=>P(Rt),t[153]=Gt):Gt=t[153];let Kt;t[154]!==U.thinkingLoading||t[155]!==B?(Kt=B?(0,$.jsxs)(`span`,{className:`ml-1 font-normal`,children:[`· `,U.thinkingLoading]}):null,t[154]=U.thinkingLoading,t[155]=B,t[156]=Kt):Kt=t[156];let qt;t[157]!==U.thinking||t[158]!==Kt?(qt=(0,$.jsxs)(`span`,{className:`min-w-0 truncate`,children:[U.thinking,Kt]}),t[157]=U.thinking,t[158]=Kt,t[159]=qt):qt=t[159];let Jt=N&&`rotate-180`,Yt;t[160]===Jt?Yt=t[161]:(Yt=q(`size-3.5 shrink-0 transition-transform`,Jt),t[160]=Jt,t[161]=Yt);let Xt;t[162]===Yt?Xt=t[163]:(Xt=(0,$.jsx)(te,{className:Yt,strokeWidth:1.75,"aria-hidden":!0}),t[162]=Yt,t[163]=Xt);let Zt;t[164]!==qt||t[165]!==Xt?(Zt=(0,$.jsxs)(`button`,{type:`button`,className:`flex shrink-0 items-center justify-between gap-2 px-2.5 py-2 text-left text-xs font-medium text-fg-muted hover:text-fg`,onClick:Gt,children:[qt,Xt]}),t[164]=qt,t[165]=Xt,t[166]=Zt):Zt=t[166];let Qt;t[167]!==z||t[168]!==N?(Qt=N?(0,$.jsx)(`pre`,{ref:re,className:`min-h-0 flex-1 overflow-auto border-t border-edge px-2.5 py-2 whitespace-pre-wrap text-xs leading-5 text-fg-muted`,onScroll:be,children:z}):null,t[167]=z,t[168]=N,t[169]=Qt):Qt=t[169];let $t;t[170]!==Zt||t[171]!==Qt?($t=(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col rounded-lg border border-edge bg-surface-inset/70`,children:[Zt,Qt]}),t[170]=Zt,t[171]=Qt,t[172]=$t):$t=t[172];let en;t[173]!==Ut||t[174]!==Wt||t[175]!==$t?(en=(0,$.jsx)(`div`,{className:Ut,"aria-hidden":Wt,children:$t}),t[173]=Ut,t[174]=Wt,t[175]=$t,t[176]=en):en=t[176];let tn=W?`pointer-events-none opacity-0`:`opacity-100`,nn;t[177]===tn?nn=t[178]:(nn=q(`absolute inset-0 min-h-0 transition-opacity duration-200 ease-out motion-reduce:transition-none`,tn),t[177]=tn,t[178]=nn);let rn;t[179]!==k||t[180]!==V||t[181]!==x||t[182]!==U.empty||t[183]!==U.loading||t[184]!==U.suggestion||t[185]!==B||t[186]!==j?(rn=V?(0,$.jsx)(`pre`,{className:`h-full min-h-0 overflow-auto whitespace-pre-wrap rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg-muted`,children:V}):j===`preview`?(0,$.jsx)(`div`,{className:`h-full min-h-0 overflow-auto rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg`,children:B&&!k.trim()?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:U.loading}):x===`markdown`?(0,$.jsx)(oe,{content:k||U.empty,compact:!0,className:`text-sm`}):(0,$.jsx)(`pre`,{className:`whitespace-pre-wrap text-sm leading-6 text-fg`,children:k||U.empty})}):(0,$.jsx)(`textarea`,{className:`h-full min-h-0 w-full resize-none overflow-auto rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/25 disabled:text-fg-muted`,value:k,onChange:e=>A(e.currentTarget.value),disabled:B,placeholder:B?U.loading:U.empty,"aria-label":U.suggestion}),t[179]=k,t[180]=V,t[181]=x,t[182]=U.empty,t[183]=U.loading,t[184]=U.suggestion,t[185]=B,t[186]=j,t[187]=rn):rn=t[187];let an;t[188]!==nn||t[189]!==rn?(an=(0,$.jsx)(`div`,{className:nn,children:rn}),t[188]=nn,t[189]=rn,t[190]=an):an=t[190];let on;t[191]!==en||t[192]!==an?(on=(0,$.jsxs)(`div`,{className:`relative min-h-0 flex-1 overflow-hidden`,children:[en,an]}),t[191]=en,t[192]=an,t[193]=on):on=t[193];let sn;t[194]!==Vt||t[195]!==on?(sn=(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-col overflow-hidden`,children:[Vt,on]}),t[194]=Vt,t[195]=on,t[196]=sn):sn=t[196];let cn;t[197]!==vt||t[198]!==sn?(cn=(0,$.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-cols-1 gap-3 overflow-hidden p-4 md:grid-cols-2`,children:[vt,sn]}),t[197]=vt,t[198]=sn,t[199]=cn):cn=t[199];let ln;t[200]!==Oe||t[201]!==U.cancel?(ln=(0,$.jsx)(Ce,{type:`button`,variant:`secondary`,onClick:Oe,children:U.cancel}),t[200]=Oe,t[201]=U.cancel,t[202]=ln):ln=t[202];let un=!Le,dn;t[203]!==Ae||t[204]!==U.applyCurrent||t[205]!==un?(dn=(0,$.jsx)(Ce,{type:`button`,variant:`secondary`,disabled:un,onClick:Ae,children:U.applyCurrent}),t[203]=Ae,t[204]=U.applyCurrent,t[205]=un,t[206]=dn):dn=t[206];let fn;t[207]===Ee?fn=t[208]:(fn=()=>void Ee(),t[207]=Ee,t[208]=fn);let pn;t[209]===ze?pn=t[210]:(pn=ze?(0,$.jsx)(G,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}):(0,$.jsx)(de,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[209]=ze,t[210]=pn);let mn=ze?U.regenerate:U.generate,hn;t[211]!==B||t[212]!==pn||t[213]!==mn||t[214]!==fn?(hn=(0,$.jsxs)(Ce,{type:`button`,variant:`secondary`,disabled:B,onClick:fn,children:[pn,mn]}),t[211]=B,t[212]=pn,t[213]=mn,t[214]=fn,t[215]=hn):hn=t[215];let gn=!Ie,_n;t[216]!==Pe||t[217]!==U.append||t[218]!==gn?(_n=(0,$.jsx)(Ce,{type:`button`,variant:`secondary`,disabled:gn,onClick:Pe,children:U.append}),t[216]=Pe,t[217]=U.append,t[218]=gn,t[219]=_n):_n=t[219];let vn=!Ie,yn;t[220]!==Me||t[221]!==U.replace||t[222]!==vn?(yn=(0,$.jsx)(Ce,{type:`button`,variant:`primary`,disabled:vn,onClick:Me,children:U.replace}),t[220]=Me,t[221]=U.replace,t[222]=vn,t[223]=yn):yn=t[223];let bn;t[224]!==hn||t[225]!==_n||t[226]!==yn||t[227]!==ln||t[228]!==dn?(bn=(0,$.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-4 py-3`,children:[ln,dn,hn,_n,yn]}),t[224]=hn,t[225]=_n,t[226]=yn,t[227]=ln,t[228]=dn,t[229]=bn):bn=t[229];let xn;t[230]!==bn||t[231]!==$e||t[232]!==cn?(xn=(0,$.jsx)(`div`,{className:`absolute inset-0 z-[80] flex items-center justify-center p-4 pointer-events-none`,children:(0,$.jsxs)(g,{className:`xopc-dialog-content-pane pointer-events-auto flex h-[min(78vh,38rem)] w-full max-w-4xl flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-popover outline-none`,onOpenAutoFocus:zt,children:[$e,cn,bn]})}),t[230]=bn,t[231]=$e,t[232]=cn,t[233]=xn):xn=t[233];let Sn;t[234]!==xn||t[235]!==Ke||t[236]!==Ye?(Sn=(0,$.jsxs)(h,{container:Ke,children:[Ye,xn]}),t[234]=xn,t[235]=Ke,t[236]=Ye,t[237]=Sn):Sn=t[237];let Cn;t[238]!==ee||t[239]!==Sn||t[240]!==Ge?(Cn=(0,$.jsx)(v,{open:ee,onOpenChange:Ge,children:Sn}),t[238]=ee,t[239]=Sn,t[240]=Ge,t[241]=Cn):Cn=t[241];let wn;return t[242]!==Cn||t[243]!==Z?(wn=(0,$.jsxs)($.Fragment,{children:[Z,Cn]}),t[242]=Cn,t[243]=Z,t[244]=wn):wn=t[244],wn}function Rt(e){return!e}function zt(e){return e.preventDefault()}function Bt(e){return e.management!==void 0&&e.management.owner!==`observation`}function Vt(e){return[`reminder`,`brief`,`review`,`followUp`].map(t=>{let n=e.scenarios[t];return{...n,requiresProject:t===`followUp`,form:{...We,name:n.name,instruction:t===`reminder`?``:n.instruction,triggerMode:t===`reminder`?`once`:t===`review`?`weekly`:`daily`,time:t===`brief`?`08:30`:t===`review`?`17:00`:`09:00`,weekday:`5`,notificationPolicy:`all`}}})}var Ht=`w-full rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg focus-visible:outline-2 focus-visible:outline-accent`;function Ut(e){let t=(0,ot.c)(99),{form:n,setForm:r,labels:i,projects:a,projectLocked:o,source:s,requiresProject:c}=e,l;t[0]===r?l=t[1]:(l=e=>r(t=>({...t,...e})),t[0]=r,t[1]=l);let u=l,d;t[2]!==i.experience.source||t[3]!==s?(d=(0,$.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[i.experience.source,`: `,s]}),t[2]=i.experience.source,t[3]=s,t[4]=d):d=t[4];let f;t[5]===u?f=t[6]:(f=e=>u({name:e.target.value}),t[5]=u,t[6]=f);let p;t[7]!==n.name||t[8]!==f?(p=(0,$.jsx)(`input`,{className:Ht,value:n.name,onChange:f}),t[7]=n.name,t[8]=f,t[9]=p):p=t[9];let m;t[10]!==i.form.name||t[11]!==p?(m=(0,$.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[i.form.name,p]}),t[10]=i.form.name,t[11]=p,t[12]=m):m=t[12];let h;t[13]===u?h=t[14]:(h=e=>u({instruction:e.target.value}),t[13]=u,t[14]=h);let g;t[15]!==n.instruction||t[16]!==h?(g=(0,$.jsx)(`textarea`,{className:Ht,rows:5,value:n.instruction,onChange:h}),t[15]=n.instruction,t[16]=h,t[17]=g):g=t[17];let _;t[18]!==i.info.task||t[19]!==g?(_=(0,$.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[i.info.task,g]}),t[18]=i.info.task,t[19]=g,t[20]=_):_=t[20];let v;t[21]!==n.projectId||t[22]!==i.form.noProject||t[23]!==i.form.project||t[24]!==o||t[25]!==a||t[26]!==u?(v=!o&&(0,$.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[i.form.project,(0,$.jsxs)(I,{className:Ht,value:n.projectId,onChange:e=>u({projectId:e.target.value}),children:[(0,$.jsx)(L,{value:``,children:i.form.noProject}),a.map(Wt)]})]}),t[21]=n.projectId,t[22]=i.form.noProject,t[23]=i.form.project,t[24]=o,t[25]=a,t[26]=u,t[27]=v):v=t[27];let y;t[28]!==n.projectId||t[29]!==i.experience.projectRequired||t[30]!==c?(y=c&&!n.projectId?(0,$.jsx)(`p`,{role:`status`,className:`text-sm text-fg-muted`,children:i.experience.projectRequired}):null,t[28]=n.projectId,t[29]=i.experience.projectRequired,t[30]=c,t[31]=y):y=t[31];let b;t[32]===u?b=t[33]:(b=e=>u({triggerMode:e.target.value}),t[32]=u,t[33]=b);let x;t[34]===i.trigger.once?x=t[35]:(x=(0,$.jsx)(L,{value:`once`,children:i.trigger.once}),t[34]=i.trigger.once,t[35]=x);let S;t[36]===i.trigger.daily?S=t[37]:(S=(0,$.jsx)(L,{value:`daily`,children:i.trigger.daily}),t[36]=i.trigger.daily,t[37]=S);let C;t[38]===i.trigger.weekly?C=t[39]:(C=(0,$.jsx)(L,{value:`weekly`,children:i.trigger.weekly}),t[38]=i.trigger.weekly,t[39]=C);let ee;t[40]!==n.triggerMode||t[41]!==b||t[42]!==x||t[43]!==S||t[44]!==C?(ee=(0,$.jsxs)(I,{className:Ht,value:n.triggerMode,onChange:b,children:[x,S,C]}),t[40]=n.triggerMode,t[41]=b,t[42]=x,t[43]=S,t[44]=C,t[45]=ee):ee=t[45];let w;t[46]!==i.form.trigger||t[47]!==ee?(w=(0,$.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[i.form.trigger,ee]}),t[46]=i.form.trigger,t[47]=ee,t[48]=w):w=t[48];let T;t[49]!==n.onceAt||t[50]!==n.time||t[51]!==n.triggerMode||t[52]!==i.form.onceAt||t[53]!==i.form.time||t[54]!==u?(T=n.triggerMode===`once`?(0,$.jsx)(et,{label:i.form.onceAt,value:n.onceAt,defaultTime:n.time,onChange:e=>u({onceAt:e})}):(0,$.jsxs)(`div`,{className:`grid gap-2 text-sm text-fg`,children:[(0,$.jsx)(`span`,{children:i.form.time}),(0,$.jsx)($e,{value:n.time,onChange:e=>u({time:e}),ariaLabel:i.form.time})]}),t[49]=n.onceAt,t[50]=n.time,t[51]=n.triggerMode,t[52]=i.form.onceAt,t[53]=i.form.time,t[54]=u,t[55]=T):T=t[55];let E;t[56]!==n.triggerMode||t[57]!==n.weekday||t[58]!==i.form.day||t[59]!==i.weekdays||t[60]!==u?(E=n.triggerMode===`weekly`&&(0,$.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[i.form.day,(0,$.jsx)(I,{className:Ht,value:n.weekday,onChange:e=>u({weekday:e.target.value}),children:[`sunday`,`monday`,`tuesday`,`wednesday`,`thursday`,`friday`,`saturday`].map((e,t)=>(0,$.jsx)(L,{value:String(t),children:i.weekdays[e]},e))})]}),t[56]=n.triggerMode,t[57]=n.weekday,t[58]=i.form.day,t[59]=i.weekdays,t[60]=u,t[61]=E):E=t[61];let D;t[62]!==w||t[63]!==T||t[64]!==E?(D=(0,$.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[w,T,E]}),t[62]=w,t[63]=T,t[64]=E,t[65]=D):D=t[65];let O;t[66]!==n.onceAt||t[67]!==n.triggerMode||t[68]!==i.experience.futureTime?(O=n.triggerMode===`once`&&n.onceAt&&new Date(n.onceAt).getTime()<=Date.now()?(0,$.jsx)(`p`,{role:`status`,className:`text-sm text-red-700 dark:text-red-300`,children:i.experience.futureTime}):null,t[66]=n.onceAt,t[67]=n.triggerMode,t[68]=i.experience.futureTime,t[69]=O):O=t[69];let k;t[70]===i.experience.scheduleNote?k=t[71]:(k=(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:i.experience.scheduleNote}),t[70]=i.experience.scheduleNote,t[71]=k);let A;t[72]===u?A=t[73]:(A=e=>u({notificationPolicy:e.target.value}),t[72]=u,t[73]=A);let j;t[74]===i.draft.notifyAll?j=t[75]:(j=(0,$.jsx)(L,{value:`all`,children:i.draft.notifyAll}),t[74]=i.draft.notifyAll,t[75]=j);let M;t[76]===i.draft.notifyAttention?M=t[77]:(M=(0,$.jsx)(L,{value:`attention`,children:i.draft.notifyAttention}),t[76]=i.draft.notifyAttention,t[77]=M);let N;t[78]===i.draft.notifyNone?N=t[79]:(N=(0,$.jsx)(L,{value:`none`,children:i.draft.notifyNone}),t[78]=i.draft.notifyNone,t[79]=N);let P;t[80]!==n.notificationPolicy||t[81]!==A||t[82]!==j||t[83]!==M||t[84]!==N?(P=(0,$.jsxs)(I,{className:Ht,value:n.notificationPolicy,onChange:A,children:[j,M,N]}),t[80]=n.notificationPolicy,t[81]=A,t[82]=j,t[83]=M,t[84]=N,t[85]=P):P=t[85];let F;t[86]!==i.draft.notifications||t[87]!==P?(F=(0,$.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[i.draft.notifications,P]}),t[86]=i.draft.notifications,t[87]=P,t[88]=F):F=t[88];let te;return t[89]!==y||t[90]!==D||t[91]!==d||t[92]!==O||t[93]!==k||t[94]!==F||t[95]!==m||t[96]!==_||t[97]!==v?(te=(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-5 overflow-y-auto px-5 py-4`,children:[d,m,_,v,y,D,O,k,F]}),t[89]=y,t[90]=D,t[91]=d,t[92]=O,t[93]=k,t[94]=F,t[95]=m,t[96]=_,t[97]=v,t[98]=te):te=t[98],te}function Wt(e){return(0,$.jsx)(L,{value:e.id,children:e.name},e.id)}var Gt=`xopc.automations.dismissedExecutionIssues`;function Kt(){if(typeof window>`u`)return{};try{let e=JSON.parse(window.localStorage.getItem(Gt)??`{}`);return!e||typeof e!=`object`||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(e=>typeof e[1]==`string`))}catch{return{}}}function qt(e,t,n){return e?E(e,n):t.never}function Jt(e,t){return e.kind===`routine`?`Routine · v${e.version}`:e.kind===`system`?e.capability===`home.advisor.refresh`?`Home AI suggestions refresh`:e.capability===`memory.temporal_sweep`?`Memory temporal sweep`:e.capability===`memory.daily_reconciliation`?`Memory daily reconciliation`:`Memory weekly knowledge maintenance`:e.kind===`task_command`?t.action.taskWithId.replace(`{id}`,e.taskId):e.agentId?t.action.agentWithId.replace(`{id}`,e.agentId):t.action.agent}function Yt(e,t){return e===`task_command`?t.action.runTask:t.action.runAgent}function Xt(e){return e.safety?.mode??`auto_apply`}function Zt(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 Qt(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 $t(e){return e.status===`running`||e.status===`queued`||e.status===`cancelling`}function en(e){return e.status===`failed`||e.status===`timeout`}function tn(e,t){return e.action.kind===`system`?Jt(e.action,t):e.action.kind===`agent`?e.action.instruction:(e.action.kind,Jt(e.action,t))}function nn(e){return e.description?.trim()??``}function rn(e){return $t(e)?0:en(e)?1:e.status===`succeeded`?2:3}function an(e){return[...e].sort((e,t)=>{let n=rn(e)-rn(t);return n===0?t.createdAtMs-e.createdAtMs:n})}function on(){let e=(0,ot.c)(6),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(`section`,{className:`grid grid-cols-2 gap-px overflow-hidden rounded-xl border border-edge-subtle bg-edge-subtle xl:grid-cols-4`,children:Array.from({length:4}).map(cn)}),e[0]=t):t=e[0];let n;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 space-y-2`,children:[(0,$.jsx)(J,{className:`h-4 w-36`}),(0,$.jsx)(J,{className:`h-3 w-56 max-w-full`})]}),(0,$.jsx)(J,{className:`h-7 w-20 rounded-full`})]}),e[1]=n):n=e[1];let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsxs)(`section`,{className:`rounded-xl bg-surface-inset p-4`,children:[n,(0,$.jsx)(`div`,{className:`mt-4 grid gap-2`,children:Array.from({length:6}).map(sn)})]}),e[2]=r):r=e[2];let i,a;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsx)(J,{className:`h-4 w-32`}),a=(0,$.jsx)(J,{className:`mt-4 h-24 rounded-lg`}),e[3]=i,e[4]=a):(i=e[3],a=e[4]);let o;return e[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4`,"aria-hidden":`true`,children:[t,(0,$.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-rows-[auto_minmax(0,1fr)] gap-3 md:grid-cols-[15rem_minmax(0,1fr)] md:grid-rows-1 lg:grid-cols-[17rem_minmax(0,1fr)]`,children:[r,(0,$.jsxs)(`section`,{className:`hidden rounded-xl border border-edge-subtle p-4 xl:block`,children:[i,a,(0,$.jsxs)(`div`,{className:`mt-4 grid gap-2`,children:[(0,$.jsx)(J,{className:`h-12 rounded-lg`}),(0,$.jsx)(J,{className:`h-12 rounded-lg`}),(0,$.jsx)(J,{className:`h-12 rounded-lg`})]})]})]})]}),e[5]=o):o=e[5],o}function sn(e,t){return(0,$.jsx)(`div`,{className:`rounded-lg p-3`,children:(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(J,{className:`size-4 rounded-full`}),(0,$.jsx)(J,{className:`h-4 w-32`}),(0,$.jsx)(J,{className:`h-5 w-20 rounded-full`})]}),(0,$.jsx)(J,{className:`mt-3 h-4 w-full`}),(0,$.jsx)(J,{className:`mt-2 h-4 w-3/5`})]}),(0,$.jsx)(J,{className:`h-8 w-24 rounded-md`})]})},t)}function cn(e,t){return(0,$.jsxs)(`div`,{className:`flex min-h-12 items-center gap-2.5 bg-surface-base px-3 py-2.5`,children:[(0,$.jsx)(J,{className:`size-4 rounded-full`}),(0,$.jsx)(J,{className:`h-3 w-14`}),(0,$.jsx)(J,{className:`ml-auto h-4 w-10`})]},t)}function ln({projectId:e,embedded:t=!1,title:n,subtitle:r}){let i=d(e=>e.language),o=f(i),s=o.automations,c=o.productNavigation.sections[`automation-triggers`],l=o.cron,u=we(e=>e.setPageHeader),y=we(e=>e.clearPageHeader),[b,x]=a(),S=!t&&b.get(`view`)===`activity`,C=b.get(`run`)?.trim()??``,w=b.get(`view`)===`execution`&&!!C,T=b.get(`automation`)?.trim()??``,E=b.get(`new`)===`1`,D=b.get(`setupChat`)??void 0,O=b.get(`draft`)?.trim()??``,j=b.get(`action`)?.trim()??``,M=b.get(`taskId`)?.trim()??``,N=b.get(`projectId`)?.trim()??``,P=e?.trim()||N,F=!!e?.trim(),te=b.get(`autogenerate`)===`1`,ne=(0,Q.useRef)(``),I=b.get(`status`),L=I===`active`||I===`paused`||I===`completed`||I===`running`||I===`attention`?I:`all`,ie=b.get(`ownership`)===`system`?`system`:`user`,R=b.get(`source`),z=R===`agent`||R===`task_command`?R:`all`,ae=b.get(`q`)??``,B=e=>x(t=>{let n=new URLSearchParams(t);return e===`all`?n.delete(`status`):n.set(`status`,e),n.delete(`automation`),n}),V=e=>x(t=>{let n=new URLSearchParams(t);return e===`user`?n.delete(`ownership`):n.set(`ownership`,e),n.delete(`automation`),n}),H=e=>x(t=>{let n=new URLSearchParams(t);return e?n.set(`q`,e):n.delete(`q`),n.delete(`automation`),n},{replace:!0}),oe=e=>x(t=>{let n=new URLSearchParams(t);return e===`all`?n.delete(`source`):n.set(`source`,e),n.delete(`automation`),n}),se=()=>x(e=>{let t=new URLSearchParams(e);return t.delete(`status`),t.delete(`source`),t.delete(`q`),t.delete(`automation`),t}),[ce,U]=(0,Q.useState)(null),[le,G]=(0,Q.useState)(!1),[K,ue]=(0,Q.useState)(`blank`),[de,fe]=(0,Q.useState)(!1),[pe,J]=(0,Q.useState)(null),[_e,ve]=(0,Q.useState)(null),[ye,Te]=(0,Q.useState)(!1),[X,De]=(0,Q.useState)(We),[Oe,ke]=(0,Q.useState)(null),[Ae,je]=(0,Q.useState)(null),[Me,Ne]=(0,Q.useState)(!1),[Pe,Fe]=(0,Q.useState)(null),[Ie,Le]=(0,Q.useState)(``),[Re,ze]=(0,Q.useState)(null),[Be,Ve]=(0,Q.useState)(!1),[He,Z]=(0,Q.useState)(!1),[Ke,qe]=(0,Q.useState)(P),[$e,et]=(0,Q.useState)(`new_session`),[tt,rt]=(0,Q.useState)(`attention`),[at,ot]=(0,Q.useState)(null),[st,lt]=(0,Q.useState)(!1),[ut,dt]=(0,Q.useState)(!1),[ft,mt]=(0,Q.useState)(!1),[ht,gt]=(0,Q.useState)(null),[_t,yt]=(0,Q.useState)(Kt),xt=be([`automations`,P],()=>Y.list(P?{projectId:P}:void 0),{keepPreviousData:!0,refreshInterval:15e3}),St=be([`automation-runs`,P],()=>Y.runs(50,void 0,P?{projectId:P}:void 0),{keepPreviousData:!0,refreshInterval:1e4}),Ct=be(P?`automations-global-system-source`:null,()=>Y.list(),{keepPreviousData:!0,refreshInterval:15e3}),wt=be(P?`automation-runs-global-system-source`:null,()=>Y.runs(50),{keepPreviousData:!0,refreshInterval:1e4}),Et=be(Pe?[`automation-history`,Pe,P]:null,()=>Y.runs(50,Pe,P?{projectId:P}:void 0),{refreshInterval:1e4}),Dt=be(Ae?`automation-run-events:${Ae}`:null,()=>Y.runEvents(Ae),{refreshInterval:5e3}),Ot=be(Ae?[`automation-exact-run`,Ae]:null,()=>Y.getRun(Ae),{refreshInterval:3e3}),At=be(`automation-chat-agents`,Se),jt=be(`automation-tasks`,Y.tasks),Mt=be(`automation-projects`,()=>ge({sortBy:`name`,sortOrder:`asc`,limit:200})),Nt=xt.isLoading&&!xt.data||St.isLoading&&!St.data||!!P&&Ct.isLoading&&!Ct.data||!!P&&wt.isLoading&&!wt.data,Pt=!Nt&&(xt.isLoading||St.isLoading||Ct.isLoading||wt.isLoading),Ft=xt.data?.automations??[],It=P?Ct.data?.automations??[]:Ft,Lt=(0,Q.useMemo)(()=>an(St.data?.runs??[]),[St.data?.runs]),Rt=(0,Q.useMemo)(()=>P?an(wt.data?.runs??[]):Lt,[wt.data?.runs,P,Lt]),zt=(0,Q.useMemo)(()=>Ft.filter(e=>!Bt(e)),[Ft]),Ht=(0,Q.useMemo)(()=>It.filter(Bt),[It]),Wt=(0,Q.useMemo)(()=>[...zt,...Ht],[Ht,zt]),qt=(0,Q.useMemo)(()=>new Set(Ht.map(e=>e.id)),[Ht]),Jt=(0,Q.useMemo)(()=>Lt.filter(e=>!qt.has(e.automationId)),[Lt,qt]),Yt=(0,Q.useMemo)(()=>Rt.filter(e=>qt.has(e.automationId)),[Rt,qt]),Xt=(0,Q.useMemo)(()=>P?[...Lt,...Yt]:Lt,[P,Lt,Yt]),Zt=(0,Q.useMemo)(()=>Ot.data?.run?.id===Ae?Ot.data.run:Xt.find(e=>e.id===Ae)??Et.data?.runs.find(e=>e.id===Ae)??null,[Xt,Ae,Et.data,Ot.data]),Qt=(0,Q.useMemo)(()=>Wt.find(e=>e.id===Pe)??null,[Wt,Pe]),en=(0,Q.useMemo)(()=>Wt.find(e=>e.id===_e)??null,[Wt,_e]),rn=(0,Q.useMemo)(()=>[...Et.data?.runs??Xt].filter(e=>e.automationId===Pe).sort((e,t)=>t.createdAtMs-e.createdAtMs),[Xt,Pe,Et.data]),sn=Dt.data?.events??[],cn=(0,Q.useMemo)(()=>Jt.filter(e=>!$t(e)&&e.readAtMs==null),[Jt]),ln=zt.reduce((e,t)=>e+(xt.data?.executionSummaries?.[t.id]?.unreadCount??0),0),fn=ae.trim().toLocaleLowerCase(),pn=ie===`system`?Ht:zt,mn=ie===`system`?Yt:Jt,hn=(0,Q.useMemo)(()=>new Set(mn.filter($t).map(e=>e.automationId)),[mn]),_n=(0,Q.useMemo)(()=>pn.filter(e=>L===`attention`&&!nt(e,mn)||L===`running`&&!hn.has(e.id)||L===`active`&&!e.enabled||L===`paused`&&(e.enabled||A(e))||L===`completed`&&!A(e)||z!==`all`&&e.action.kind!==z?!1:!fn||[e.name,nn(e),tn(e,s),ee(e.trigger,s,l,i)].some(e=>e.toLocaleLowerCase().includes(fn))),[l,L,s,i,fn,pn,mn,hn,z]),vn=At.data?.items??[],yn=(0,Q.useMemo)(()=>(jt.data?.items??[]).map(e=>e.task),[jt.data]),Sn=Mt.data?.items??[],Cn=!!en?.management?.editable.includes(`trigger`),wn=[`daily`,`weekly`,`interval`,`cron`].includes(X.triggerMode)&&(![`daily`,`weekly`].includes(X.triggerMode)||/^(?:[01]\d|2[0-3]):[0-5]\d$/.test(X.time))&&(X.triggerMode!==`interval`||k(X.intervalValue,X.intervalUnit)>=6e4)&&(X.triggerMode!==`cron`||!!X.cronExpr.trim()),Tn=Cn?wn:!!X.name.trim()&&(X.triggerMode!==`once`||Number.isFinite(new Date(X.onceAt).getTime())&&(!!en||new Date(X.onceAt).getTime()>Date.now()))&&(![`daily`,`weekly`].includes(X.triggerMode)||/^(?:[01]\d|2[0-3]):[0-5]\d$/.test(X.time))&&(X.triggerMode!==`event`||!!X.eventType.trim()&&Ye(X.eventPayloadMatch))&&(X.actionMode===`task_command`?!!(X.taskId.trim()&&X.agentId.trim()):!!X.instruction.trim()),En=!0;try{[`daily`,`weekly`,`cron`].includes(X.triggerMode)&&Ze(X)}catch{En=!1}let Dn=Tn&&En,On=(0,Q.useMemo)(()=>Vt(s),[s]),kn=(0,Q.useMemo)(()=>zt.filter(e=>nt(e,Jt)),[zt,Jt]),jn=kn.some(e=>{let t=it(e,Jt);return t!==null&&_t[e.id]!==t}),Mn=(0,Q.useCallback)(()=>{yt(e=>{let t={...e};for(let e of kn){let n=it(e,Jt);n&&(t[e.id]=n)}try{window.localStorage.setItem(Gt,JSON.stringify(t))}catch{}return t})},[kn,Jt]);(0,Q.useEffect)(()=>{if(!Pt){if(E){Fe(null);return}if(T){Fe(T);return}if(_n.length===0){Fe(null);return}Pe&&_n.some(e=>e.id===Pe)||Fe(null)}},[T,_n,E,Pt,Pe]);let Nn=(0,Q.useCallback)(async()=>{await Promise.all([xt.mutate(),St.mutate(),Ct.mutate(),wt.mutate(),Et.mutate(),Dt.mutate(),xe(e=>Array.isArray(e)&&e[0]===`automation-navigation-runs`)])},[xt.mutate,Ct.mutate,wt.mutate,Dt.mutate,St.mutate,Et.mutate]),Pn=(0,Q.useCallback)(e=>{if(F){Fe(null),je(null);return}x(t=>{let n=new URLSearchParams(t);return e?n.set(`projectId`,e):n.delete(`projectId`),n.delete(`automation`),n.delete(`run`),n}),Fe(null),je(null)},[F,x]);(0,Q.useEffect)(()=>{F&&(qe(P),De(e=>e.projectId===P?e:{...e,projectId:P}))},[P,F]);let Fn=(0,Q.useCallback)(e=>{if(e===`blank`&&!M){fe(!0);return}if(ve(null),Te(!1),ke(null),ue(e),G(!0),e===`blank`){De({...We,projectId:P});return}Le(``),ze(null),Z(!1),qe(P),et(`new_session`),rt(`attention`)},[P,M]),In=e=>{U(e),De({...e.form,projectId:P}),ve(null),Te(!1),ke(null),ue(`quick`),G(!0)},Ln=(0,Q.useCallback)(e=>{if(e.action.kind===`agent`&&!e.management){J(e);return}De(Ue(e)),ve(e.id),Te(!1),Fe(null),ue(`blank`),G(!0)},[]),Rn=(0,Q.useCallback)(()=>{Re&&(De({...Ue(Re.automation),projectId:Ke,conversationMode:$e,notificationPolicy:tt}),ve(null),Te(!0),ue(`blank`))},[Re,$e,tt,Ke]),zn=(0,Q.useCallback)(async()=>{mt(!0),ke(null);try{await Nn()}catch(e){let t=e instanceof Error?e.message:String(e);ke(t)}finally{mt(!1)}},[s.feedback.actionFailed,Nn]);(0,Q.useEffect)(()=>{let e=Wt.find(e=>e.id===T);!e||!Bt(e)||ie===`system`||x(e=>{let t=new URLSearchParams(e);return t.set(`ownership`,`system`),t},{replace:!0})},[T,Wt,ie,x]),(0,Q.useEffect)(()=>{j===`create`&&(Fn(`blank`),M&&De(e=>({...e,actionMode:`task_command`,taskId:M,safetyMode:`auto_apply`})),x(e=>{let t=new URLSearchParams(e);return t.delete(`action`),t.delete(`taskId`),t},{replace:!0}))},[j,Fn,x,M]),(0,Q.useEffect)(()=>{if(!O)return;let e=`${i}:${te?`auto`:`seed`}:${O}`;ne.current!==e&&(ne.current=e,Le(O),ze(null),Z(!1),qe(P),ue(`draft`),G(!0),x(e=>{let t=new URLSearchParams(e);return t.delete(`draft`),t.delete(`autogenerate`),t},{replace:!0}),te&&(ke(null),Ve(!0),Y.draft({prompt:O,language:i}).then(e=>{ze(e.draft),Z(!1)}).catch(e=>{ke(e instanceof Error?e.message:String(e))}).finally(()=>{Ve(!1)})))},[te,O,i,P,x]);let Bn=(0,Q.useCallback)(e=>{let t=Lt.find(t=>t.id===e)??Et.data?.runs.find(t=>t.id===e);if(!t||$t(t)||t.readAtMs!=null)return;let n=Date.now();St.mutate(t=>t&&{...t,runs:t.runs.map(t=>t.id===e?{...t,readAtMs:n}:t)},!1),Et.mutate(t=>t&&{...t,runs:t.runs.map(t=>t.id===e?{...t,readAtMs:n}:t)},!1),Y.markRunRead(e).catch(e=>{ke(e instanceof Error?e.message:String(e)),St.mutate(),Et.mutate()})},[Lt,St.mutate,Et.data,Et.mutate]),Vn=(0,Q.useCallback)(e=>{Bn(e),je(e),Ne(!0),x(t=>{let n=new URLSearchParams(t);return n.set(`run`,e),n},{replace:!0})},[Bn,x]),Hn=(0,Q.useCallback)(e=>{Fe(e),je(null),Ne(!1),x(t=>{let n=new URLSearchParams(t);n.set(`automation`,e);for(let e of[`new`,`setupChat`,`chatDraft`,`run`,`view`])n.delete(e);return n})},[x]),Un=(0,Q.useCallback)(e=>{Ne(!1),x(t=>{let n=new URLSearchParams(t);n.set(`automation`,e.automationId),n.set(`run`,e.id),n.set(`view`,`execution`);for(let e of[`new`,`setupChat`,`chatDraft`])n.delete(e);return n})},[x]);(0,Q.useEffect)(()=>{je(C||null),Ne(!!C&&!w)},[w,C]),(0,Q.useEffect)(()=>{C&&!w&&Bn(C)},[w,C,Bn]),(0,Q.useEffect)(()=>{ot(null),dt(!1)},[Ae]);async function Wn(){if(ke(null),X.triggerMode===`once`&&!en&&new Date(X.onceAt).getTime()<=Date.now()){ke(s.experience.futureTime);return}if(!(!Dn||ht)&&!(K===`quick`&&ce?.requiresProject&&!X.projectId)){if(ye&&Re){gt(`draft:edit`);try{let e=Qe(X),{simulation:t}=await Y.simulate(e);ze({...Re,automation:e,simulation:t}),qe(X.projectId),et(X.conversationMode),rt(X.notificationPolicy),Z(!1),Te(!1),ue(`draft`)}catch(e){let t=e instanceof Error?e.message:String(e);ke(t)}finally{gt(null)}return}if(en){let e=en.id;await Gn(`automation:${e}:edit`,()=>Y.update(e,{...Cn?{trigger:Ge(en,{...X,instruction:`managed`}).trigger}:Ge(en,X),expectedRevision:en.updatedAtMs}))&&(G(!1),ve(null),Fe(e));return}gt(`automation:create`);try{let e=Qe(X),{automation:t}=await Y.create(e);De(We),G(!1),x(e=>{let n=new URLSearchParams(e);return n.delete(`status`),n.delete(`q`),n.delete(`run`),n.delete(`new`),n.set(`automation`,t.id),F||(t.projectId?n.set(`projectId`,t.projectId):n.delete(`projectId`)),n}),await Nn(),Fe(t.id)}catch(e){let t=e instanceof Error?e.message:String(e);ke(t)}finally{gt(null)}}}async function Gn(e,t){ke(null),gt(e);try{return await t(),await Nn(),!0}catch(e){let t=e instanceof Error?e.message:String(e);return ke(t),!1}finally{gt(null)}}async function Kn(){await Gn(`runs:read-all`,()=>Y.markAllRunsRead(P||void 0))}async function qn(){let e=Ie.trim();if(e){ke(null),Ve(!0);try{let t=await Y.draft({prompt:e,language:i});ze(t.draft),Z(!1)}catch(e){ke(e instanceof Error?e.message:String(e))}finally{Ve(!1)}}}async function Jn(){if(!Re)return;let e=``,t=``;await Gn(`draft:publish`,async()=>{let{automation:n}=await Y.create({...Re.automation,...Ke?{projectId:Ke}:{projectId:void 0},conversationMode:$e,delivery:{...Re.automation.delivery,notificationPolicy:tt}});ze(null),Le(``),Z(!1),G(!1),B(`all`),H(``),e=n.id,t=n.projectId??``})&&e&&(Pn(t),Hn(e))}async function Yn(){if(!Re)return;let e=``,t=``,n=``;await Gn(`draft:test`,async()=>{let{automation:r}=await Y.create({...Re.automation,...Ke?{projectId:Ke}:{projectId:void 0},conversationMode:$e,delivery:{...Re.automation.delivery,notificationPolicy:tt},enabled:!1}),{run:i}=await Y.runNow(r.id);e=r.id,t=r.projectId??``,n=i.id,ze(null),Le(``),Z(!1),G(!1),B(`all`),H(``)})&&e&&n&&(Pn(t),Hn(e),Vn(n))}async function Xn(e){ke(null),lt(!0),ot(null),dt(!1);try{let t=await Y.repairDraft(e.id,{language:i});ot(t.repair)}catch(e){ke(e instanceof Error?e.message:String(e))}finally{lt(!1)}}async function Zn(e){at&&await Gn(`run:${e.id}:repair`,async()=>{await Y.update(e.automationId,at.patch),ot(null),dt(!1)})}let Qn=(0,Q.useMemo)(()=>(0,$.jsx)(Ee,{className:`size-9 shrink-0 p-0`,loading:ft,label:s.refresh,onClick:zn}),[s.refresh,ft,zn]);return(0,Q.useLayoutEffect)(()=>{if(!t)return u({startExtra:null,main:(0,$.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:c}),end:Qn}),()=>y()},[y,t,Qn,c,u]),(0,$.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,$.jsxs)(`div`,{className:q(`flex min-h-0 w-full flex-1 flex-col gap-4`,t?`py-1`:`px-4 pt-3 sm:px-9 lg:pt-4 xl:px-10`,!t&&(S?`overflow-y-auto`:`overflow-hidden`)),children:[t?(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3 rounded-xl bg-surface-base px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(he,{className:`size-4 text-accent-fg`,"aria-hidden":!0}),(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n||s.title})]}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:r||s.subtitle})]}),Qn]}):null,Oe||xt.error||St.error||Ct.error||wt.error?(0,$.jsx)(`div`,{role:`alert`,className:`rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:Oe||s.feedback.actionFailed}):null,S?Nt?(0,$.jsx)(on,{}):(0,$.jsx)(gn,{runs:mn,ownership:ie,labels:s,language:i,unreadCount:ie===`user`?cn.length:0,loading:Pt||ft,onOwnershipChange:V,onRefresh:zn,onSelectRun:Vn}):(0,$.jsxs)($.Fragment,{children:[!Nt&&jn&&ie===`user`?(0,$.jsxs)(`div`,{className:`flex items-center rounded-lg border border-red-500/20 bg-red-500/5`,children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>B(`attention`),className:`flex min-w-0 flex-1 items-center gap-3 rounded-l-lg px-4 py-3 text-left focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,$.jsx)(re,{className:`size-4 shrink-0 text-red-700 dark:text-red-300`,"aria-hidden":!0}),(0,$.jsxs)(`span`,{className:`min-w-0 text-sm text-fg`,children:[(0,$.jsxs)(`span`,{className:`font-medium`,children:[s.experience.executionIssues,` · `,kn.length]}),(0,$.jsx)(`span`,{className:`ml-2 text-fg-muted`,children:s.experience.issuesDescription})]})]}),(0,$.jsx)(`button`,{type:`button`,onClick:Mn,className:`mr-2 rounded-md p-2 text-fg-muted hover:bg-red-500/10 hover:text-fg focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":s.close,title:s.close,children:(0,$.jsx)(me,{className:`size-4`,"aria-hidden":!0})})]}):null,Nt?(0,$.jsx)(on,{}):(0,$.jsxs)(vt,{language:i,busy:Pt,children:[(0,$.jsxs)(`aside`,{className:q(`max-h-[28vh] min-h-0 min-w-0 flex-col overflow-hidden rounded-xl bg-surface-inset md:flex md:h-full md:max-h-none`,w?`hidden`:`flex`),children:[(0,$.jsxs)(`div`,{className:`shrink-0 p-3`,children:[(0,$.jsx)(Tt,{language:i,labels:s,filter:L,ownership:ie,source:z,projectId:P,projects:Sn,projectLocked:F,query:ae,unreadCount:ie===`user`?ln:0,markReadBusy:ht===`runs:read-all`,onFilter:B,onOwnership:V,onSource:oe,onProject:Pn,onQuery:H,onClear:()=>{se(),V(`user`),F||Pn(``)},onMarkAllRead:()=>void Kn()}),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>fe(!0),className:`mt-2 flex w-full items-center gap-2 rounded-lg px-2 py-2 text-sm text-fg hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,$.jsx)(W,{className:`size-4`,"aria-hidden":!0}),i===`zh`?`新建任务`:`New task`]})]}),T&&!_n.some(e=>e.id===T)?(0,$.jsxs)(`p`,{role:`status`,className:`px-3 pb-2 text-xs text-fg-muted`,children:[i===`zh`?`当前自动化不在筛选结果中。`:`The selected automation is outside these filters.`,(0,$.jsx)(`button`,{type:`button`,className:`ml-1 text-accent-fg underline`,onClick:se,children:i===`zh`?`清除筛选`:`Clear filters`})]}):null,(0,$.jsx)(pt,{automations:_n,runs:mn,labels:s,cronLabels:l,language:i,selectedAutomationId:E?null:Pe,selectedRunId:w?C:void 0,selectedRun:w?Zt:null,projectId:P||void 0,executionSummaries:(ie===`system`&&P?Ct.data:xt.data)?.executionSummaries,onSelectRun:Un,onOpenDetails:Hn,busy:ht!==null,onEdit:Ln,onAction:Gn})]}),w&&T?(0,$.jsx)(ct,{automationId:T,runId:C,projectId:P||void 0,language:i,onBack:()=>Hn(T),onDetails:()=>Ne(!0),onConfigure:e=>{Y.openConfiguration({automationId:e.automationId,runId:e.id}).then(({conversationId:t})=>{Ne(!1),x(n=>{let r=new URLSearchParams(n);return r.set(`automation`,e.automationId),r.set(`setupChat`,t),r.delete(`run`),r.delete(`view`),r})}).catch(e=>ke(e instanceof Error?e.message:String(e)))}},`${T}:${C}`):!E&&Qt&&!Qt.management&&Qt.action.kind!==`system`?(0,$.jsx)(bt,{automation:Qt,conversationId:D,runs:rn,language:i,onSelectRun:Vn},Qt.id):D?(0,$.jsx)(bt,{conversationId:D,runs:[],language:i,onSelectRun:Vn,onConfigured:Hn},D):!E&&Qt?(0,$.jsx)(xn,{automation:Qt,runs:rn,runsLoading:Et.isLoading,runsError:Et.error?s.feedback.actionFailed:void 0,labels:s,cronLabels:l,language:i,projects:Sn,agentOptions:vn,defaultAgentId:At.data?.defaultId,busyAction:ht,onEdit:Ln,onSelectRun:Vn,onAction:Gn},Qt.id):(0,$.jsx)(`div`,{className:`min-h-0 overflow-y-auto`,children:(0,$.jsx)(kt,{language:i,projectId:P,onOpenConversation:e=>{let t=new URL(e,window.location.origin),n=t.searchParams.get(`setupChat`);x(e=>{let r=new URLSearchParams(e);r.set(`new`,`1`),r.delete(`automation`),r.set(`setupChat`,n);let i=t.searchParams.get(`chatDraft`);return i?r.set(`chatDraft`,i):r.delete(`chatDraft`),r})}},P)})]})]})]}),de?(0,$.jsx)(Xe,{language:i,projectId:P,onClose:()=>fe(!1),onCreated:e=>{V(`user`),se(),Hn(e.id)}}):null,pe?(0,$.jsx)(Xe,{automation:pe,language:i,onClose:()=>J(null)}):null,(0,$.jsx)(v,{open:le,onOpenChange:e=>{G(e),e||(ve(null),Te(!1))},children:(0,$.jsxs)(h,{children:[(0,$.jsx)(p,{className:`xopc-dialog-overlay fixed inset-0 z-65 bg-scrim backdrop-blur-[1px]`}),(0,$.jsxs)(g,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-66 flex h-[min(760px,calc(100vh-2rem))] w-[min(100%-2rem,64rem)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-popover outline-none`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-5 py-4`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(_,{className:`text-base font-semibold text-fg`,children:K===`draft`?s.draft.title:en?s.editTitle:ye?s.draft.editTitle:s.createTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:K===`draft`?s.draft.subtitle:s.form.createFlowHint})]}),(0,$.jsx)(m,{asChild:!0,children:(0,$.jsx)(Ce,{variant:`ghost`,"aria-label":s.close,children:(0,$.jsx)(me,{className:`size-4`})})})]}),Oe?(0,$.jsx)(`p`,{role:`alert`,className:`px-5 py-2 text-sm text-red-700 dark:text-red-300`,children:Oe}):null,K===`draft`?(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:(0,$.jsx)(dn,{labels:s,prompt:Ie,draft:Re,loading:Be,approved:He,publishBusy:ht===`draft:publish`,testBusy:ht===`draft:test`,templates:On,projects:Sn,projectId:Ke,conversationMode:$e,notificationPolicy:tt,onPromptChange:Le,onGenerate:qn,onEdit:Rn,onPublish:Jn,onTest:Yn,onProjectChange:qe,onConversationModeChange:et,onNotificationPolicyChange:rt,projectLocked:F,onApprovedChange:Z,onDiscard:()=>{ze(null),Z(!1)},onTemplateSelect:e=>{In(e),De({...e.form,projectId:Ke})},onOpenAdvanced:()=>{De({...We,projectId:Ke,conversationMode:$e,notificationPolicy:tt}),ue(`blank`)}})}):(0,$.jsxs)($.Fragment,{children:[Cn?(0,$.jsx)(un,{form:X,setForm:De,labels:s}):K===`quick`&&ce?(0,$.jsx)(Ut,{form:X,setForm:De,labels:s,projects:Sn,projectLocked:F,source:ce.source,requiresProject:ce.requiresProject}):(0,$.jsx)(An,{form:X,labels:s,setForm:De,projects:Sn,agentOptions:vn,agentsLoading:At.isLoading,defaultAgentId:At.data?.defaultId??``,taskOptions:yn,tasksLoading:jt.isLoading,language:i,projectLocked:F}),Cn||K===`quick`?(0,$.jsx)(`div`,{className:`max-h-40 shrink-0 overflow-y-auto px-5 pb-4`,children:(0,$.jsx)(Je,{form:X,onChange:e=>De(t=>({...t,...e})),language:i})}):null,(0,$.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2 border-t border-edge px-5 py-4`,children:[K===`quick`?(0,$.jsx)(Ce,{variant:`ghost`,onClick:()=>ue(`blank`),children:s.draft.advancedCreate}):null,ye?(0,$.jsx)(Ce,{variant:`ghost`,onClick:()=>{Te(!1),ue(`draft`)},children:s.cancel}):(0,$.jsx)(m,{asChild:!0,children:(0,$.jsx)(Ce,{variant:`ghost`,children:s.cancel})}),(0,$.jsx)(Ce,{variant:`primary`,onClick:Wn,disabled:!Dn||!!ht||K===`quick`&&!!ce?.requiresProject&&!X.projectId,children:ht===`automation:create`||ht===`draft:edit`||en&&ht===`automation:${en.id}:edit`?s.feedback.working:en||ye?s.save:s.experience.createEnabled})]})]})]})]})}),(0,$.jsx)(v,{open:Me&&!!Zt,onOpenChange:e=>{Ne(e),!(e||w)&&x(e=>{let t=new URLSearchParams(e);return t.delete(`run`),t},{replace:!0})},children:(0,$.jsxs)(h,{children:[(0,$.jsx)(p,{className:`xopc-dialog-overlay fixed inset-0 z-65 bg-scrim backdrop-blur-[1px]`}),(0,$.jsxs)(g,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-66 flex h-[min(85vh,40rem)] w-[min(100%-2rem,32rem)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-popover outline-none`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,$.jsx)(_,{className:`truncate text-base font-semibold text-fg`,children:Zt?.automationName??s.dashboard.result}),(0,$.jsx)(m,{asChild:!0,children:(0,$.jsx)(Ce,{variant:`ghost`,"aria-label":s.close,children:(0,$.jsx)(me,{className:`size-4`})})})]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:(0,$.jsx)(bn,{className:`rounded-none border-0`,run:Zt,events:sn,labels:s,cronLabels:l,language:i,loading:Dt.isLoading,repairDraft:at,repairLoading:st,repairApproved:ut,busyAction:ht,onRepairApprovedChange:dt,onSuggestRepair:Xn,onApplyRepair:Zn})})]})]})})]})}function un(e){let t=(0,ot.c)(48),{form:n,setForm:r,labels:i}=e,a;t[0]===r?a=t[1]:(a=e=>r(t=>({...t,...e})),t[0]=r,t[1]=a);let o=a,s;t[2]===i.form.trigger?s=t[3]:(s=(0,$.jsx)(Nn,{title:i.form.trigger}),t[2]=i.form.trigger,t[3]=s);let c;t[4]===o?c=t[5]:(c=e=>o({triggerMode:e.target.value}),t[4]=o,t[5]=c);let l;t[6]===i.trigger.daily?l=t[7]:(l=(0,$.jsx)(L,{value:`daily`,children:i.trigger.daily}),t[6]=i.trigger.daily,t[7]=l);let u;t[8]===i.trigger.weekly?u=t[9]:(u=(0,$.jsx)(L,{value:`weekly`,children:i.trigger.weekly}),t[8]=i.trigger.weekly,t[9]=u);let d;t[10]===i.trigger.interval?d=t[11]:(d=(0,$.jsx)(L,{value:`interval`,children:i.trigger.interval}),t[10]=i.trigger.interval,t[11]=d);let f;t[12]===i.trigger.customCron?f=t[13]:(f=(0,$.jsx)(L,{value:`cron`,children:i.trigger.customCron}),t[12]=i.trigger.customCron,t[13]=f);let p;t[14]!==n.triggerMode||t[15]!==i.form.trigger||t[16]!==c||t[17]!==l||t[18]!==u||t[19]!==d||t[20]!==f?(p=(0,$.jsxs)(I,{"aria-label":i.form.trigger,className:Mn,value:n.triggerMode,onChange:c,children:[l,u,d,f]}),t[14]=n.triggerMode,t[15]=i.form.trigger,t[16]=c,t[17]=l,t[18]=u,t[19]=d,t[20]=f,t[21]=p):p=t[21];let m;t[22]!==n.time||t[23]!==n.triggerMode||t[24]!==n.weekday||t[25]!==i.form.day||t[26]!==i.form.time||t[27]!==i.weekdays||t[28]!==o?(m=n.triggerMode===`daily`||n.triggerMode===`weekly`?(0,$.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[(0,$.jsx)(Z,{label:i.form.time,children:(0,$.jsx)($e,{value:n.time,onChange:e=>o({time:e}),ariaLabel:i.form.time})}),n.triggerMode===`weekly`?(0,$.jsx)(Z,{label:i.form.day,children:(0,$.jsxs)(I,{className:Mn,value:n.weekday,onChange:e=>o({weekday:e.target.value}),children:[(0,$.jsx)(L,{value:`1`,children:i.weekdays.monday}),(0,$.jsx)(L,{value:`2`,children:i.weekdays.tuesday}),(0,$.jsx)(L,{value:`3`,children:i.weekdays.wednesday}),(0,$.jsx)(L,{value:`4`,children:i.weekdays.thursday}),(0,$.jsx)(L,{value:`5`,children:i.weekdays.friday}),(0,$.jsx)(L,{value:`6`,children:i.weekdays.saturday}),(0,$.jsx)(L,{value:`0`,children:i.weekdays.sunday})]})}):null]}):null,t[22]=n.time,t[23]=n.triggerMode,t[24]=n.weekday,t[25]=i.form.day,t[26]=i.form.time,t[27]=i.weekdays,t[28]=o,t[29]=m):m=t[29];let h;t[30]!==n.intervalUnit||t[31]!==n.intervalValue||t[32]!==n.triggerMode||t[33]!==i.form.intervalEvery||t[34]!==i.form.intervalUnits||t[35]!==o?(h=n.triggerMode===`interval`?(0,$.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-[minmax(0,1fr)_10rem]`,children:[(0,$.jsx)(Z,{label:i.form.intervalEvery,children:(0,$.jsx)(`input`,{className:Mn,type:`number`,min:`1`,value:n.intervalValue,onChange:e=>o({intervalValue:e.target.value})})}),(0,$.jsx)(Z,{label:i.form.intervalUnits.minute,children:(0,$.jsxs)(I,{className:Mn,value:n.intervalUnit,onChange:e=>o({intervalUnit:e.target.value}),children:[(0,$.jsx)(L,{value:`minute`,children:i.form.intervalUnits.minute}),(0,$.jsx)(L,{value:`hour`,children:i.form.intervalUnits.hour}),(0,$.jsx)(L,{value:`day`,children:i.form.intervalUnits.day}),(0,$.jsx)(L,{value:`week`,children:i.form.intervalUnits.week})]})})]}):null,t[30]=n.intervalUnit,t[31]=n.intervalValue,t[32]=n.triggerMode,t[33]=i.form.intervalEvery,t[34]=i.form.intervalUnits,t[35]=o,t[36]=h):h=t[36];let g;t[37]!==n.cronExpr||t[38]!==n.triggerMode||t[39]!==i.form.expression||t[40]!==o?(g=n.triggerMode===`cron`?(0,$.jsx)(`div`,{className:`mt-4`,children:(0,$.jsx)(Z,{label:i.form.expression,children:(0,$.jsx)(`input`,{className:Mn,value:n.cronExpr,onChange:e=>o({cronExpr:e.target.value})})})}):null,t[37]=n.cronExpr,t[38]=n.triggerMode,t[39]=i.form.expression,t[40]=o,t[41]=g):g=t[41];let _;return t[42]!==h||t[43]!==g||t[44]!==s||t[45]!==p||t[46]!==m?(_=(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[s,p,m,h,g]}),t[42]=h,t[43]=g,t[44]=s,t[45]=p,t[46]=m,t[47]=_):_=t[47],_}function dn(e){let t=(0,ot.c)(110),{labels:n,prompt:r,draft:i,loading:a,approved:o,publishBusy:s,testBusy:c,templates:l,projects:u,projectId:d,conversationMode:f,notificationPolicy:p,onPromptChange:m,onGenerate:h,onEdit:g,onPublish:_,onTest:v,onProjectChange:y,onConversationModeChange:b,onNotificationPolicyChange:x,onApprovedChange:S,onDiscard:C,onTemplateSelect:ee,onOpenAdvanced:w,projectLocked:T}=e,E=s!==void 0&&s,D=c!==void 0&&c,O=T!==void 0&&T,k=!!(i&&i.simulation.requiredConfirmations.length>0),A;t[0]!==i||t[1]!==n.draft.advancedCreate||t[2]!==n.draft.suggestions||t[3]!==n.draft.suggestionsDescription||t[4]!==n.experience||t[5]!==w||t[6]!==ee||t[7]!==l?(A=i?null:(0,$.jsxs)(`div`,{className:`mb-5 border-b border-edge-subtle pb-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n.draft.suggestions}),(0,$.jsx)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:n.draft.suggestionsDescription})]}),(0,$.jsx)(Ce,{variant:`ghost`,onClick:w,children:n.draft.advancedCreate})]}),(0,$.jsx)(`div`,{className:`mt-3 grid gap-2 sm:grid-cols-2`,children:l.map(e=>(0,$.jsxs)(`button`,{type:`button`,className:`focus-visible:ring-2 focus-visible:ring-accent rounded-lg bg-surface-panel p-3 text-left hover:bg-surface-hover`,onClick:()=>ee(e),children:[(0,$.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:e.name}),(0,$.jsx)(`div`,{className:`mt-1 line-clamp-2 text-xs text-fg-muted`,children:e.description}),(0,$.jsxs)(`div`,{className:`mt-2 text-xs text-fg-muted`,children:[n.experience.source,`: `,e.source]})]},e.name))})]}),t[0]=i,t[1]=n.draft.advancedCreate,t[2]=n.draft.suggestions,t[3]=n.draft.suggestionsDescription,t[4]=n.experience,t[5]=w,t[6]=ee,t[7]=l,t[8]=A):A=t[8];let j;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,$.jsx)(de,{className:`size-4 text-accent`}),t[9]=j):j=t[9];let M;t[10]===n.draft.title?M=t[11]:(M=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[j,n.draft.title]}),t[10]=n.draft.title,t[11]=M);let N;t[12]===n.draft.subtitle?N=t[13]:(N=(0,$.jsx)(`div`,{className:`mt-1 text-sm text-fg-muted`,children:n.draft.subtitle}),t[12]=n.draft.subtitle,t[13]=N);let P;t[14]!==M||t[15]!==N?(P=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[M,N]}),t[14]=M,t[15]=N,t[16]=P):P=t[16];let F;t[17]!==a||t[18]!==r?(F=a||!r.trim(),t[17]=a,t[18]=r,t[19]=F):F=t[19];let te;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,$.jsx)(de,{className:`size-4`}),t[20]=te):te=t[20];let ne=a?n.draft.generating:n.draft.generate,re;t[21]!==h||t[22]!==ne||t[23]!==F?(re=(0,$.jsxs)(Ce,{variant:`primary`,onClick:h,disabled:F,children:[te,ne]}),t[21]=h,t[22]=ne,t[23]=F,t[24]=re):re=t[24];let ie;t[25]!==re||t[26]!==P?(ie=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[P,re]}),t[25]=re,t[26]=P,t[27]=ie):ie=t[27];let R;t[28]===m?R=t[29]:(R=e=>m(e.target.value),t[28]=m,t[29]=R);let z;t[30]!==n.draft.placeholder||t[31]!==n.draft.title||t[32]!==r||t[33]!==R?(z=(0,$.jsx)(`textarea`,{"aria-label":n.draft.title,className:`mt-4 min-h-20 w-full resize-y rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none focus:border-accent`,value:r,onChange:R,placeholder:n.draft.placeholder}),t[30]=n.draft.placeholder,t[31]=n.draft.title,t[32]=r,t[33]=R,t[34]=z):z=t[34];let ae=O?`sm:grid-cols-2`:`sm:grid-cols-3`,B;t[35]===ae?B=t[36]:(B=q(`mt-3 grid gap-3`,ae),t[35]=ae,t[36]=B);let V;t[37]!==n.draft.noProject||t[38]!==n.draft.project||t[39]!==y||t[40]!==d||t[41]!==O||t[42]!==u?(V=O?null:(0,$.jsx)(Z,{label:n.draft.project,children:(0,$.jsxs)(I,{className:Mn,value:d,onChange:e=>y(e.target.value),children:[(0,$.jsx)(L,{value:``,children:n.draft.noProject}),u.map(fn)]})}),t[37]=n.draft.noProject,t[38]=n.draft.project,t[39]=y,t[40]=d,t[41]=O,t[42]=u,t[43]=V):V=t[43];let H;t[44]===b?H=t[45]:(H=e=>b(e.target.value),t[44]=b,t[45]=H);let oe;t[46]===n.draft.newConversation?oe=t[47]:(oe=(0,$.jsx)(L,{value:`new_session`,children:n.draft.newConversation}),t[46]=n.draft.newConversation,t[47]=oe);let se;t[48]===n.draft.continuousConversation?se=t[49]:(se=(0,$.jsx)(L,{value:`continuous`,children:n.draft.continuousConversation}),t[48]=n.draft.continuousConversation,t[49]=se);let ce;t[50]!==f||t[51]!==H||t[52]!==oe||t[53]!==se?(ce=(0,$.jsxs)(I,{className:Mn,value:f,onChange:H,children:[oe,se]}),t[50]=f,t[51]=H,t[52]=oe,t[53]=se,t[54]=ce):ce=t[54];let W;t[55]!==n.draft.conversation||t[56]!==ce?(W=(0,$.jsx)(Z,{label:n.draft.conversation,children:ce}),t[55]=n.draft.conversation,t[56]=ce,t[57]=W):W=t[57];let G;t[58]===x?G=t[59]:(G=e=>x(e.target.value),t[58]=x,t[59]=G);let K;t[60]===n.draft.notifyAttention?K=t[61]:(K=(0,$.jsx)(L,{value:`attention`,children:n.draft.notifyAttention}),t[60]=n.draft.notifyAttention,t[61]=K);let ue;t[62]===n.draft.notifyAll?ue=t[63]:(ue=(0,$.jsx)(L,{value:`all`,children:n.draft.notifyAll}),t[62]=n.draft.notifyAll,t[63]=ue);let fe;t[64]===n.draft.notifyNone?fe=t[65]:(fe=(0,$.jsx)(L,{value:`none`,children:n.draft.notifyNone}),t[64]=n.draft.notifyNone,t[65]=fe);let pe;t[66]!==p||t[67]!==G||t[68]!==K||t[69]!==ue||t[70]!==fe?(pe=(0,$.jsxs)(I,{className:Mn,value:p,onChange:G,children:[K,ue,fe]}),t[66]=p,t[67]=G,t[68]=K,t[69]=ue,t[70]=fe,t[71]=pe):pe=t[71];let me;t[72]!==n.draft.notifications||t[73]!==pe?(me=(0,$.jsx)(Z,{label:n.draft.notifications,children:pe}),t[72]=n.draft.notifications,t[73]=pe,t[74]=me):me=t[74];let he;t[75]!==B||t[76]!==V||t[77]!==W||t[78]!==me?(he=(0,$.jsxs)(`div`,{className:B,children:[V,W,me]}),t[75]=B,t[76]=V,t[77]=W,t[78]=me,t[79]=he):he=t[79];let J;t[80]!==o||t[81]!==i||t[82]!==n.draft.approval||t[83]!==n.draft.assumptions||t[84]!==n.draft.discard||t[85]!==n.draft.edit||t[86]!==n.draft.publish||t[87]!==n.draft.review||t[88]!==n.draft.risks||t[89]!==n.draft.safety||t[90]!==n.draft.testOnce||t[91]!==n.draft.testing||t[92]!==n.feedback||t[93]!==n.info||t[94]!==n.none||t[95]!==S||t[96]!==C||t[97]!==g||t[98]!==_||t[99]!==v||t[100]!==E||t[101]!==k||t[102]!==D?(J=i?(0,$.jsxs)(`div`,{className:`mt-4 grid gap-3 rounded-lg bg-surface-base p-4 lg:grid-cols-[1fr_1fr]`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:i.automation.name}),i.automation.description?(0,$.jsx)(`div`,{className:`mt-1 text-sm text-fg-muted`,children:i.automation.description}):null,(0,$.jsxs)(`div`,{className:`mt-3 grid gap-2 text-sm`,children:[(0,$.jsx)(On,{label:n.info.when,value:i.simulation.triggerSummary}),(0,$.jsx)(On,{label:n.info.run,value:i.simulation.actionSummary})]})]}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:`text-xs font-semibold uppercase text-fg-muted`,children:n.draft.review}),(0,$.jsx)(pn,{title:n.draft.safety,items:[...i.simulation.safetyNotes,...i.simulation.requiredConfirmations],empty:n.none}),(0,$.jsx)(pn,{title:n.draft.assumptions,items:i.assumptions,empty:n.none}),(0,$.jsx)(pn,{title:n.draft.risks,items:i.risks,empty:n.none}),k?(0,$.jsxs)(`label`,{className:`mt-4 flex items-start gap-2 text-sm text-fg`,children:[(0,$.jsx)(`input`,{className:`mt-1`,type:`checkbox`,checked:o,onChange:e=>S(e.target.checked)}),(0,$.jsx)(`span`,{children:n.draft.approval})]}):null,(0,$.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,$.jsx)(Ce,{variant:`ghost`,onClick:C,children:n.draft.discard}),(0,$.jsxs)(Ce,{variant:`secondary`,onClick:g,children:[(0,$.jsx)(U,{className:`size-4`}),n.draft.edit]}),(0,$.jsxs)(Ce,{variant:`secondary`,onClick:v,disabled:D||E||k&&!o,children:[(0,$.jsx)(le,{className:`size-4`}),D?n.draft.testing:n.draft.testOnce]}),(0,$.jsx)(Ce,{variant:`primary`,onClick:_,disabled:E||k&&!o,children:E?n.feedback.working:n.draft.publish})]})]})]}):null,t[80]=o,t[81]=i,t[82]=n.draft.approval,t[83]=n.draft.assumptions,t[84]=n.draft.discard,t[85]=n.draft.edit,t[86]=n.draft.publish,t[87]=n.draft.review,t[88]=n.draft.risks,t[89]=n.draft.safety,t[90]=n.draft.testOnce,t[91]=n.draft.testing,t[92]=n.feedback,t[93]=n.info,t[94]=n.none,t[95]=S,t[96]=C,t[97]=g,t[98]=_,t[99]=v,t[100]=E,t[101]=k,t[102]=D,t[103]=J):J=t[103];let ge;return t[104]!==ie||t[105]!==z||t[106]!==he||t[107]!==J||t[108]!==A?(ge=(0,$.jsxs)(`section`,{className:`rounded-lg bg-surface-base p-4`,children:[A,ie,z,he,J]}),t[104]=ie,t[105]=z,t[106]=he,t[107]=J,t[108]=A,t[109]=ge):ge=t[109],ge}function fn(e){return(0,$.jsx)(L,{value:e.id,children:e.name},e.id)}function pn(e){let t=(0,ot.c)(10),{title:n,items:r,empty:i}=e,a;t[0]===n?a=t[1]:(a=(0,$.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(mn):(0,$.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,$.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,$.jsxs)(`div`,{className:`mt-3`,children:[a,s]}),t[7]=a,t[8]=s,t[9]=c):c=t[9],c}function mn(e){return(0,$.jsxs)(`li`,{children:[`- `,e]},e)}function hn(e){let t=(0,ot.c)(25),{icon:n,label:r,value:i,tone:a,active:o,onClick:s}=e,c=a===void 0?`default`:a,l=c===`danger`?`text-red-600 dark:text-red-300`:`text-fg-subtle`,u;t[0]===l?u=t[1]:(u=q(`shrink-0`,l),t[0]=l,t[1]=u);let d;t[2]!==n||t[3]!==u?(d=(0,$.jsx)(`span`,{className:u,children:n}),t[2]=n,t[3]=u,t[4]=d):d=t[4];let f;t[5]===r?f=t[6]:(f=(0,$.jsx)(`span`,{className:`truncate text-xs font-medium text-fg-muted`,children:r}),t[5]=r,t[6]=f);let p=c===`danger`?`text-red-700 dark:text-red-300`:`text-fg`,m;t[7]===p?m=t[8]:(m=q(`ml-auto truncate text-sm font-semibold tabular-nums`,p),t[7]=p,t[8]=m);let h;t[9]!==m||t[10]!==i?(h=(0,$.jsx)(`span`,{className:m,children:i}),t[9]=m,t[10]=i,t[11]=h):h=t[11];let g;t[12]!==d||t[13]!==f||t[14]!==h?(g=(0,$.jsxs)($.Fragment,{children:[d,f,h]}),t[12]=d,t[13]=f,t[14]=h,t[15]=g):g=t[15];let _=g,v=o&&`bg-accent/8`,y=s&&`cursor-pointer hover:bg-surface-hover focus-visible:z-10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,b;t[16]!==v||t[17]!==y?(b=q(`flex min-h-12 min-w-0 items-center gap-2.5 bg-surface-base px-3 py-2.5 text-left transition-colors`,v,y),t[16]=v,t[17]=y,t[18]=b):b=t[18];let x=b,S=`${r}: ${i}`,C;return t[19]!==S||t[20]!==o||t[21]!==x||t[22]!==_||t[23]!==s?(C=s?(0,$.jsx)(`button`,{type:`button`,className:x,onClick:s,"aria-label":S,"aria-pressed":o,children:_}):(0,$.jsx)(`div`,{className:x,"aria-label":S,children:_}),t[19]=S,t[20]=o,t[21]=x,t[22]=_,t[23]=s,t[24]=C):C=t[24],C}function gn(e){let t=(0,ot.c)(74),{runs:n,ownership:r,labels:i,language:a,unreadCount:o,loading:s,onOwnershipChange:c,onRefresh:l,onSelectRun:u}=e,d;t[0]===n?d=t[1]:(d=n.filter($t),t[0]=n,t[1]=d);let f=d.length,p;t[2]===n?p=t[3]:(p=n.filter(en),t[2]=n,t[3]=p);let m=p.length,h;t[4]===i.dashboard.activity?h=t[5]:(h=(0,$.jsx)(`h2`,{id:`automation-activity-title`,className:`text-sm font-semibold text-fg`,children:i.dashboard.activity}),t[4]=i.dashboard.activity,t[5]=h);let g;t[6]===i.dashboard.activityDescription?g=t[7]:(g=(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:i.dashboard.activityDescription}),t[6]=i.dashboard.activityDescription,t[7]=g);let _;t[8]!==h||t[9]!==g?(_=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[h,g]}),t[8]=h,t[9]=g,t[10]=_):_=t[10];let v=i.filters.ownership,b=r===`user`&&`bg-surface-base text-fg shadow-sm`,x;t[11]===b?x=t[12]:(x=q(`rounded-md px-2.5 py-1.5 text-xs font-medium text-fg-muted hover:text-fg`,b),t[11]=b,t[12]=x);let S;t[13]===c?S=t[14]:(S=()=>c(`user`),t[13]=c,t[14]=S);let C=r===`user`,ee;t[15]!==i.filters.userManaged||t[16]!==C||t[17]!==x||t[18]!==S?(ee=(0,$.jsx)(`button`,{type:`button`,className:x,onClick:S,"aria-pressed":C,children:i.filters.userManaged}),t[15]=i.filters.userManaged,t[16]=C,t[17]=x,t[18]=S,t[19]=ee):ee=t[19];let w=r===`system`&&`bg-surface-base text-fg shadow-sm`,T;t[20]===w?T=t[21]:(T=q(`rounded-md px-2.5 py-1.5 text-xs font-medium text-fg-muted hover:text-fg`,w),t[20]=w,t[21]=T);let E;t[22]===c?E=t[23]:(E=()=>c(`system`),t[22]=c,t[23]=E);let D=r===`system`,O;t[24]!==i.system.title||t[25]!==T||t[26]!==E||t[27]!==D?(O=(0,$.jsx)(`button`,{type:`button`,className:T,onClick:E,"aria-pressed":D,children:i.system.title}),t[24]=i.system.title,t[25]=T,t[26]=E,t[27]=D,t[28]=O):O=t[28];let k;t[29]!==i.filters.ownership||t[30]!==ee||t[31]!==O?(k=(0,$.jsxs)(X,{className:`flex rounded-lg bg-surface-panel p-0.5`,role:`group`,"aria-label":v,indicatorClassName:`rounded-md bg-surface-base shadow-sm`,children:[ee,O]}),t[29]=i.filters.ownership,t[30]=ee,t[31]=O,t[32]=k):k=t[32];let A;t[33]!==i.refresh||t[34]!==s||t[35]!==l?(A=(0,$.jsx)(Ee,{className:`size-9 shrink-0 p-0`,loading:s,label:i.refresh,onClick:l}),t[33]=i.refresh,t[34]=s,t[35]=l,t[36]=A):A=t[36];let j;t[37]!==k||t[38]!==A?(j=(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[k,A]}),t[37]=k,t[38]=A,t[39]=j):j=t[39];let M;t[40]!==j||t[41]!==_?(M=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3 border-b border-edge-subtle px-4 py-3 sm:px-5`,children:[_,j]}),t[40]=j,t[41]=_,t[42]=M):M=t[42];let N;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,$.jsx)(y,{className:`size-4`,"aria-hidden":!0}),t[43]=N):N=t[43];let P=i.metrics.total,F=String(n.length),te;t[44]!==i.metrics.total||t[45]!==F?(te=(0,$.jsx)(hn,{icon:N,label:P,value:F}),t[44]=i.metrics.total,t[45]=F,t[46]=te):te=t[46];let ne;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,$.jsx)(le,{className:`size-4`,"aria-hidden":!0}),t[47]=ne):ne=t[47];let I=i.metrics.running,L=String(f),R;t[48]!==i.metrics.running||t[49]!==L?(R=(0,$.jsx)(hn,{icon:ne,label:I,value:L}),t[48]=i.metrics.running,t[49]=L,t[50]=R):R=t[50];let z;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,$.jsx)(re,{className:`size-4`,"aria-hidden":!0}),t[51]=z):z=t[51];let ae=i.dashboard.needsAttention,B=String(m),V=m>0?`danger`:`default`,H;t[52]!==i.dashboard.needsAttention||t[53]!==B||t[54]!==V?(H=(0,$.jsx)(hn,{icon:z,label:ae,value:B,tone:V}),t[52]=i.dashboard.needsAttention,t[53]=B,t[54]=V,t[55]=H):H=t[55];let oe;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,$.jsx)(ie,{className:`size-4`,"aria-hidden":!0}),t[56]=oe):oe=t[56];let se=i.filters.unread,ce=String(o),U;t[57]!==i.filters.unread||t[58]!==ce?(U=(0,$.jsx)(hn,{icon:oe,label:se,value:ce}),t[57]=i.filters.unread,t[58]=ce,t[59]=U):U=t[59];let W;t[60]!==te||t[61]!==R||t[62]!==H||t[63]!==U?(W=(0,$.jsxs)(`div`,{className:`grid grid-cols-2 gap-px border-b border-edge-subtle bg-edge-subtle lg:grid-cols-4`,children:[te,R,H,U]}),t[60]=te,t[61]=R,t[62]=H,t[63]=U,t[64]=W):W=t[64];let G;t[65]!==i||t[66]!==a||t[67]!==u||t[68]!==n?(G=n.length===0?(0,$.jsx)(kn,{className:`min-h-64 rounded-none border-0 shadow-none`,icon:(0,$.jsx)(y,{className:`size-5`}),title:i.empty.runs}):(0,$.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:n.map(e=>(0,$.jsxs)(`button`,{type:`button`,className:`flex w-full min-w-0 items-start gap-3 px-4 py-3 text-left hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent sm:px-5`,onClick:()=>u(e.id),children:[(0,$.jsx)(`span`,{className:q(`mt-1.5 size-2 shrink-0 rounded-full`,$t(e)?`bg-blue-500`:en(e)?`bg-red-500`:`bg-emerald-500`),"aria-hidden":!0}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.automationName}),e.readAtMs==null&&!$t(e)?(0,$.jsx)(`span`,{className:`size-2 shrink-0 rounded-full bg-blue-500`,children:(0,$.jsx)(`span`,{className:`sr-only`,children:i.filters.unread})}):null]}),(0,$.jsx)(`span`,{className:q(`mt-1 line-clamp-2 block text-sm text-fg-muted`,e.error&&`text-red-700 dark:text-red-300`),children:e.error||e.summary||i.status[e.status]}),(0,$.jsx)(`span`,{className:`mt-1 block text-xs text-fg-subtle`,children:qt(e.createdAtMs,i,a)})]}),(0,$.jsx)(`span`,{className:q(`shrink-0 rounded-full px-2 py-0.5 text-xs`,Zt(e.status)),children:i.status[e.status]})]},e.id))}),t[65]=i,t[66]=a,t[67]=u,t[68]=n,t[69]=G):G=t[69];let K;return t[70]!==M||t[71]!==W||t[72]!==G?(K=(0,$.jsxs)(`section`,{className:`overflow-hidden rounded-xl bg-surface-base`,"aria-labelledby":`automation-activity-title`,children:[M,W,G]}),t[70]=M,t[71]=W,t[72]=G,t[73]=K):K=t[73],K}function _n(e,t){let n=t.events,r=e.data&&typeof e.data==`object`?e.data:{},i=typeof r.actionKind==`string`?r.actionKind:null,a=typeof r.status==`string`&&r.status in t.status?t.status[r.status]:null;switch(e.type){case`run.queued`:return e.message.toLowerCase().includes(`manual`)?n.manualQueued:e.message.toLowerCase().includes(`scheduled`)?n.scheduledQueued:n.eventQueued;case`run.started`:return n.runStarted;case`action.started`:return i?n.actionStarted.replace(`{kind}`,i):n.actionStartedFallback;case`action.completed`:return i?n.actionCompleted.replace(`{kind}`,i):n.actionCompletedFallback;case`action.failed`:return i?n.actionFailed.replace(`{kind}`,i):n.actionFailedFallback;case`run.completed`:return a?n.runCompleted.replace(`{status}`,a):n.runCompletedFallback;default:return e.message}}function vn(e){let t=(0,ot.c)(17),{value:n,labels:r,title:i,defaultExpanded:a}=e,[o,s]=(0,Q.useState)(a!==void 0&&a),c;t[0]===n?c=t[1]:(c=JSON.stringify(n,null,2),t[0]=n,t[1]=c);let l=c,u;t[2]===l?u=t[3]:(u=l.split(`
5
5
  `),t[2]=l,t[3]=u);let d=u.length,f=l.length>720||d>18,p;t[4]!==f||t[5]!==l?(p=f?`${l.split(`
@@ -0,0 +1 @@
1
+ import{t as e}from"./createLucideIcon-DPHK1VkS.js";var t=e(`bell`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]);export{t};
@@ -0,0 +1 @@
1
+ import{n as e}from"./electron-env-DHOGevH3.js";var t=`xopc.browser-notifications.v1`,n={enabled:!1,completed:!0,failed:!0,needsInput:!0};function r(){try{let e=JSON.parse(localStorage.getItem(t)??`{}`);return{enabled:typeof e.enabled==`boolean`?e.enabled:n.enabled,completed:typeof e.completed==`boolean`?e.completed:n.completed,needsInput:typeof e.needsInput!=`boolean`||e.needsInput,failed:typeof e.failed==`boolean`?e.failed:n.failed}}catch{return{...n}}}function i(e){let n={...r(),...e};try{localStorage.setItem(t,JSON.stringify(n))}catch{}return n}var a=`xopc.notification-delivery.v1`,o=200;function s(){try{let e=JSON.parse(localStorage.getItem(a)??`[]`);return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}catch{return[]}}function c(e){return s().includes(e)}function l(e){try{let t=[e,...s().filter(t=>t!==e)].slice(0,o);localStorage.setItem(a,JSON.stringify(t))}catch{}}function u(e){return e.notification.systemAllowed===!1||!e.preferences.enabled?{notify:!1,reason:`disabled`}:e.notification.status===`success`&&!e.preferences.completed||e.notification.status===`error`&&!e.preferences.failed||e.notification.status===`attention`&&e.preferences.needsInput===!1?{notify:!1,reason:`status-disabled`}:e.permissionGranted?e.appFocused?{notify:!1,reason:`focused`}:e.alreadyDelivered?{notify:!1,reason:`duplicate`}:{notify:!0}:{notify:!1,reason:`permission`}}function d(e){return e.target.kind===`chat`&&e.target.personal===!0&&window.location.hash.split(`?`)[0]===`#/personal`&&document.visibilityState===`visible`&&document.hasFocus()}function f(e){if(!e.waitId||e.target.kind!==`chat`||document.visibilityState!==`visible`||!document.hasFocus())return!1;let t=window.location.hash.split(`?`)[0];if(t!==`#/chat`&&t!==`#/chat/${encodeURIComponent(e.target.conversationId)}`&&!(e.target.personal&&t===`#/personal`))return!1;let n=Array.from(document.querySelectorAll(`[data-clarification-id]`)).find(t=>t.dataset.clarificationId===e.waitId);if(!n||n.getClientRects().length===0)return!1;let r=n.getBoundingClientRect();return r.bottom>0&&r.top<window.innerHeight&&r.right>0&&r.left<window.innerWidth}function p(){return!e()&&typeof Notification<`u`&&`serviceWorker`in navigator&&window.isSecureContext}async function m(){let e=await navigator.serviceWorker.register(`/notification-sw.js`);return await navigator.serviceWorker.ready,e}async function h(e){if(!p()||!u({notification:e,preferences:r(),permissionGranted:Notification.permission===`granted`,appFocused:e.waitId?f(e):e.target.kind===`chat`&&e.target.personal?d(e):document.visibilityState===`visible`&&document.hasFocus(),alreadyDelivered:c(e.id)}).notify)return!1;try{return await(await m()).showNotification(e.title,{body:e.body,tag:e.id,icon:`/pwa-192x192.png`,data:{route:e.route}}),l(e.id),!0}catch{return!1}}async function g(){if(!p())return`unsupported`;let e=Notification.permission==="default"?await Notification.requestPermission():Notification.permission;return e===`granted`&&await m(),e}async function _(e,t){if(!p()||Notification.permission!==`granted`)return!1;try{return await(await m()).showNotification(e,{body:t,tag:`xopc-notification-test`,icon:`/pwa-192x192.png`,data:{route:`/chat/new`}}),!0}catch{return!1}}export{f as a,c,u as i,r as l,g as n,d as o,_ as r,l as s,h as t,i as u};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/skills-page-gGU0LZ5e.js","assets/rolldown-runtime-aKtaBQYM.js","assets/vendor-react-BOUWij0V.js","assets/preload-helper-Czpn1I53.js","assets/chunk-KS7C4IRE-DIIvxCDx.js","assets/locale-store-CHjsq5NR.js","assets/messages-C7QSnTdg.js","assets/dist-DlirbHVs.js","assets/es2015-CFqg57eW.js","assets/dist-CDSvxjOh.js","assets/briefcase-business-BsoCaI_t.js","assets/createLucideIcon-DPHK1VkS.js","assets/popover-select-hRG1EzAY.js","assets/check-DUBLcKHA.js","assets/cn-0WouolD0.js","assets/bundle-mjs-rHxsej31.js","assets/skeleton-DzdOeGYz.js","assets/dist-BSVQC3i_.js","assets/dist-DSRLZhL9.js","assets/floating-ui.dom-CiMnRY5O.js","assets/floating-ui.react-dom-Gx6CM22l.js","assets/settings-shell-dialog-layer-BU3UuiJr.js","assets/code-xml-DJtYhZUF.js","assets/download-Dk-ZjtO6.js","assets/ellipsis-0k4rZLoy.js","assets/external-link-DjqjBmc3.js","assets/file-archive-DanfQJNe.js","assets/file-text-D12HbeVy.js","assets/layers-mJW7JJKm.js","assets/loader-circle-CifKLtgG.js","assets/markdown-view-ihzUc4ud.js","assets/marked.esm-8VXEA2AD.js","assets/file-image-CDUPkZvG.js","assets/plus-Q2yW6OE7.js","assets/x-B_N4OPjy.js","assets/app-link-Ji4uewEG.js","assets/product-delivery-4gEqUIsK.js","assets/schemas-CCWMleym.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/xml-_d7dTN2Q.js","assets/mermaid-render-oOellPHt.js","assets/markdown-view-Czi3_WHu.css","assets/palette-CDI0VweW.js","assets/refresh-cw-BRlGaq2w.js","assets/sparkles-DHlfQFAF.js","assets/trash-2-DusmjVPV.js","assets/triangle-alert-2JXFNNKU.js","assets/wrench-DFb4r8bH.js","assets/vendor-swr-CdRzEUwF.js","assets/gateway-config-swr-BD-ams0X.js","assets/chat-agents-api-CyvBfBbp.js","assets/button-C5tRaJxt.js","assets/interaction-BdhHBbYa.js","assets/page-tabs-DoYMKhVO.js","assets/sliding-indicator-hwz0sx3h.js","assets/page-header-store-NP7MCIaP.js","assets/use-async-resource-BHFGZCY2.js","assets/index.module-Cd9ENXfk.js","assets/dist-DaFr5KMw.js","assets/command-palette-api-YP0zV_Ol.js","assets/local-session-drafts-CGSV1RQg.js","assets/skill-wire-pattern-BPpeIcCi.js","assets/skill-list-api-B26hHnXq.js","assets/skill-api-utils-C7V4JVXM.js","assets/capability-links-MZdYfPKx.js","assets/connection-usage-BhdQRWgQ.js","assets/capability-icon-CmvCZOJX.js","assets/capability-header-actions-Ck3ILShB.js","assets/search-DA7gz22f.js","assets/use-media-query-ady-FgjK.js","assets/skill-reload-api-B9Eu5Yk_.js","assets/skill-api-BG9A1WF0.js","assets/connectors-page-BJm1jjct.js","assets/service-recommendation-list-wfd0Mjtu.js","assets/chevron-down-ccbiQQz_.js","assets/working-directory-picker-modal-DgM21YVT.js","assets/form-field-width-DJw_jULe.js","assets/settings-form-draft-Dy10ldo8.js","assets/circle-check-C23XjkUj.js","assets/key-round-DWbpyU2U.js","assets/install-connector-dialog-CntHi8Rh.js","assets/secret-input-DsjfQmDn.js","assets/copy-Dv6d4Dvw.js","assets/eye-CABVeTq0.js","assets/is-masked-secret-DOkL5b_X.js","assets/connectors-api-CRGq-TSw.js","assets/electron-env-DHOGevH3.js","assets/oauth-provider-connect-DGYky6ut.js","assets/cloud-C4-yfnnk.js","assets/models-hub-cache-BrD6r5Qs.js","assets/registry-api-CDpUAb2R.js","assets/gateway-startup-retry-DgmvR-hb.js","assets/oauth-api-DnMpUoyx.js","assets/connection-usage-guide-B9hoSOnN.js","assets/package-wATCyihJ.js","assets/server-BlHCBjiE.js","assets/agent-plugin-dialog-CSJC1yud.js","assets/arrow-left-D880xG-P.js","assets/circle-alert-BEjgurr2.js","assets/circle-BoO4YvTx.js","assets/folder-open-CyzJ19I9.js","assets/shield-check-BU58siTV.js","assets/upload-rrb46c3c.js","assets/browser-BLJWD7WI.js","assets/extension-marketplace-api-DGV5FC-v.js","assets/chevron-right-BweFrslA.js","assets/circle-pause-CN9jYH2s.js","assets/connector-filters-Cfcx9EA2.js","assets/clock-3-DnrAnuyZ.js","assets/database-CjjeZfRG.js","assets/plug-DKYPEgkR.js","assets/save-DRDABU--.js","assets/settings-uiTATseT.js","assets/store-SzD1Jvgm.js","assets/terminal-oKqqZdiG.js","assets/extension-provider-DFcRbTHI.js","assets/gateway-realtime-CoIFB3im.js","assets/gateway-realtime-store-CTWm23Qi.js","assets/theme-store-CvG266p8.js","assets/middleware-Pd0e8Igk.js","assets/extension-message-router-B2wbucV7.js","assets/session-manager-DUWeBdeG.js","assets/turn-outcome-BSbEJx8h.js","assets/session-api-CR3NLqvs.js","assets/tool-activity-BtJkgjFf.js","assets/attachment-utils-core-BPYdUI6y.js","assets/playback-coordinator-CWHIf0wr.js","assets/agents-admin-api-DSr-PWuW.js","assets/capabilities-BaKHutgZ.js","assets/tasks-CwyNaa-j.js","assets/specialists-xbB3xL9e.js","assets/activity-store-hSe5Nbgk.js","assets/sliding-tab-list-CmcrqRzN.js","assets/confirm-dialog-MHCmEEUZ.js","assets/connector-service-page-e67KylnM.js","assets/installed-connector-row-skeleton-BAe_utvG.js","assets/number-input-El7Szeln.js","assets/device-connections-panel-DE01vyK_.js","assets/map-pin-BFRLhzQ9.js","assets/bell-BlYch9Vg.js","assets/calendar-days-hw_Y-g-s.js","assets/folder-CN-pC3XL.js","assets/image-Cwyalflz.js","assets/laptop-CI3hBVrl.js","assets/link-2-D_ZKYUW7.js","assets/monitor-Af5eAvF7.js","assets/mouse-pointer-2-DZ51Onvj.js","assets/smartphone-DSSsQFqA.js","assets/wifi-off-C35sMFUl.js","assets/use-section-navigation-yC9HkVpd.js","assets/device-pairing-action-w1enAo76.js","assets/device-pairing-wizard-Dt737tSq.js","assets/panel-right-CFGrHTsD.js","assets/copy-text-row-gqdh0Bg1.js","assets/oauth-authorization-window-o6URRos4.js","assets/tunnel-api-Cph-ZBBy.js","assets/globe-DSSGFWFn.js","assets/power-ZI-pBczI.js","assets/navigation-ByOzYT0t.js","assets/settings-form-section-num14vSv.js","assets/pencil-DmIY3Oa-.js","assets/mobile-pair-qr-CuIbmw5x.js","assets/plugin-details-dialog-FcOJaeP0.js","assets/plugin-presentation-CO5BFDGW.js","assets/apps-page-CH9wENBj.js","assets/box-DvYoGszj.js","assets/extension-paths-DvuaZJuy.js","assets/agents-DX-t3X7K.js","assets/bot-DjLkhyZL.js","assets/heart-Cp4rgrqn.js","assets/message-square-plus-XP0tGdlV.js","assets/rotate-ccw-JM1TBLpp.js","assets/sliders-horizontal-DqsYor6I.js","assets/new-session-preferences-gb411vZP.js","assets/new-chat-navigation-spnin196.js","assets/use-personal-profile-D4gLM6Wi.js","assets/agent-avatar-display-D_UDgOr9.js","assets/loopi-CNtmi9FU.js","assets/loopi-C09I2mNj.css","assets/composer-handoff-params-DBpzHuNo.js","assets/agent-display-names-Bje7vfSn.js","assets/model-selector-QFZY5XNN.js","assets/settings-2-D-csvaET.js","assets/open-capability-settings-DQsmJxI7.js","assets/model-sort-_Tz8s_4N.js","assets/agents-app-path-ciChvpCS.js","assets/settings-advanced-section-CTLdGPvx.js","assets/settings-mode-store-CCQVvItG.js","assets/settings-page-header-C21Iw2rD.js","assets/settings-page-layout-BXcLlp6p.js","assets/phone-model-picker-CFoxQiws.js","assets/directory-picker-path-field-B-eUnbng.js","assets/use-directory-picker-C4p7AgWY.js","assets/image-generation-api-Baz4xdZ4.js","assets/channels-DlnXbcOj.js","assets/channels-routes-r2g-9DdC.js","assets/stethoscope-DRqTAtjD.js","assets/secret-input-labels-B5Jl5HqK.js","assets/session-channel-icon-CJAPoVO-.js","assets/git-branch-Dh9uxTot.js","assets/message-circle-Badhj-4D.js","assets/message-square-fVE7Ghj1.js","assets/panels-top-left-BKvp2Dag.js","assets/zap-dximCGjy.js","assets/session-identity-DRFdxntH.js","assets/refresh-button-DX7bULU5.js","assets/extension-iframe-host-CIAq7PSn.js","assets/extension-authoritative-grants-DYp2nNol.js","assets/settings-loading-skeleton-CAoOV17i.js","assets/schema-form-DkuIsCBU.js"])))=>i.map(i=>d[i]);
2
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-Czpn1I53.js";import{_ as a,f as o,h as s,r as c}from"./chunk-KS7C4IRE-DIIvxCDx.js";import{l as ee,n as l}from"./locale-store-CHjsq5NR.js";import{t as u}from"./messages-C7QSnTdg.js";import{t as d}from"./skeleton-DzdOeGYz.js";import{r as f,t as p}from"./product-navigation-wFfnI3uw.js";import{t as m}from"./page-header-store-NP7MCIaP.js";import{t as h}from"./capability-links-MZdYfPKx.js";import{t as te}from"./capability-header-actions-Ck3ILShB.js";var g=n(),_=e(t(),1),v=r(),y=(0,_.lazy)(()=>i(()=>import(`./skills-page-gGU0LZ5e.js`).then(e=>({default:e.SkillsPage})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71]))),b=(0,_.lazy)(()=>i(()=>import(`./connectors-page-BJm1jjct.js`).then(e=>({default:e.ConnectorsPage})),__vite__mapDeps([72,1,2,4,3,5,6,7,8,9,73,11,74,75,26,29,14,15,51,52,76,77,78,79,80,12,13,16,17,18,19,20,21,25,81,82,83,38,84,34,85,49,48,86,87,88,89,90,91,92,93,44,65,94,33,95,96,97,98,99,100,101,102,64,103,66,104,105,106,107,108,109,24,110,43,111,112,113,114,45,47,53,54,55,115,116,37,117,118,119,120,36,121,31,122,123,60,124,125,126,127,128,129,130,131,132,133,58,67,68,69,134,135,136]))),x=(0,_.lazy)(()=>i(()=>import(`./device-connections-panel-DE01vyK_.js`).then(e=>({default:e.DeviceConnectionsPanel})),__vite__mapDeps([137,1,2,4,3,5,6,7,8,9,138,11,139,140,105,78,108,27,141,142,143,144,29,145,146,33,101,147,148,14,15,37,48,51,52,132,54,135,16,149,150,151,23,25,152,34,17,18,19,20,21,35,36,56,153,13,82,38,92,86,154,155,156,157,49,76,158,159,160,161,103]))),S=(0,_.lazy)(()=>i(()=>import(`./device-connections-panel-DE01vyK_.js`).then(e=>({default:e.ConnectDeviceButton})),__vite__mapDeps([137,1,2,4,3,5,6,7,8,9,138,11,139,140,105,78,108,27,141,142,143,144,29,145,146,33,101,147,148,14,15,37,48,51,52,132,54,135,16,149,150,151,23,25,152,34,17,18,19,20,21,35,36,56,153,13,82,38,92,86,154,155,156,157,49,76,158,159,160,161,103]))),ne=(0,_.lazy)(()=>i(()=>import(`./plugin-details-dialog-FcOJaeP0.js`).then(e=>({default:e.PluginDetailsDialog})),__vite__mapDeps([162,1,2,4,3,5,6,7,8,9,94,11,34,16,14,15,48,51,93,44,65,96,97,74,75,26,29,52,76,77,98,78,99,100,101,102,64,103,66,163]))),re=(0,_.lazy)(()=>i(()=>import(`./apps-page-CH9wENBj.js`).then(e=>({default:e.ExtensionsPage})),__vite__mapDeps([164,1,2,4,3,5,6,7,8,9,97,11,165,166,24,25,29,30,31,23,32,33,34,14,15,35,36,37,38,39,40,41,94,112,101,45,46,16,48,116,117,51,52,53,54,55,115,118,119,120,121,122,123,91,60,124,125,126,90,127,49,128,129,130,131,77,58,18,19,20,96,74,75,26,76,98,78,99,100,102,64,65,103,66,104,67,68,17,69,163]))),ie=(0,_.lazy)(()=>i(()=>import(`./agents-DX-t3X7K.js`).then(e=>({default:e.AgentsSettingsPanel})),__vite__mapDeps([167,1,2,3,4,5,6,7,8,9,168,11,10,105,12,13,14,15,16,17,18,19,20,21,22,24,83,169,30,31,23,32,33,34,35,36,37,38,39,40,41,170,160,171,68,112,172,46,102,130,173,48,49,90,91,127,51,52,118,119,53,54,174,175,176,177,178,179,61,180,132,133,58,181,182,183,76,184,185,186,187,69,136,188,25,44,189,190,191,75,26,29,77,192,193]))),ae=(0,_.lazy)(()=>i(()=>import(`./channels-DlnXbcOj.js`).then(e=>({default:e.ChannelsSettingsPanel})),__vite__mapDeps([194,1,2,4,3,5,6,7,8,9,12,11,13,14,15,16,17,18,19,20,21,98,78,25,79,29,195,171,182,112,196,46,34,48,50,49,51,38,52,197,158,176,177,178,180,198,108,199,200,201,202,110,114,203,204,37,205,43,206,118,119,115,116,117,120,36,121,31,122,123,91,60,124,125,126,90,127,128,129,130,131,77,207,208,103,186,187,188,44,189,209,81,82,83,76,84,136])));function oe(e){return p.includes(e)?e:null}function se(e){let t=(0,g.c)(3),{label:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=Array.from({length:6},C),t[0]=r):r=t[0];let i;return t[1]===n?i=t[2]:(i=(0,v.jsx)(`div`,{className:`mx-auto grid w-full max-w-7xl gap-4 px-4 pb-7 pt-3 sm:grid-cols-2 sm:px-6 lg:grid-cols-3 lg:px-8 lg:pb-9 lg:pt-4`,"aria-label":n,"aria-busy":!0,children:r}),t[1]=n,t[2]=i),i}function C(e,t){return(0,v.jsx)(d,{className:`h-40 rounded-xl`},t)}function w(){let e=(0,g.c)(88),t=l(de),n=ee(ue),r;e[0]===t?r=e[1]:(r=u(t),e[0]=t,e[1]=r);let i=r,d=i.capabilitiesHub,{section:C,detailId:w}=s(),[T]=a(),E=o(),D;e[2]===T?D=e[3]:(D=T.get(`plugin`),e[2]=T,e[3]=D);let O=D,k;e[4]!==E||e[5]!==T?(k=()=>{let e=new URLSearchParams(T);e.delete(`plugin`),e.delete(`connect`),E({search:e.toString()},{replace:!0,preventScrollReset:!0})},e[4]=E,e[5]=T,e[6]=k):k=e[6];let A=k,j;e[7]===C?j=e[8]:(j=oe(C),e[7]=C,e[8]=j);let M=j,N=M??p[0],P=i.productNavigation.sections[`capabilities-${N}`],F=m(le),I=m(ce),L;e[9]===N?L=e[10]:(L={section:N,value:null},e[9]=N,e[10]=L);let[R,fe]=(0,_.useState)(L),z=N===`extensions`&&w?null:R.section===N?R.value:null,B;e[11]===N?B=e[12]:(B=e=>{fe({section:N,value:e})},e[11]=N,e[12]=B);let V=B,H,U;if(e[13]!==I||e[14]!==z||e[15]!==n||e[16]!==t||e[17]!==N||e[18]!==P||e[19]!==F?(H=()=>(F({startExtra:null,main:(0,v.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:P}),end:N===`devices`?n?(0,v.jsx)(_.Suspense,{fallback:null,children:(0,v.jsx)(S,{zh:t===`zh`})}):null:(0,v.jsx)(te,{contribution:z})}),()=>I()),U=[I,z,n,t,N,P,F],e[13]=I,e[14]=z,e[15]=n,e[16]=t,e[17]=N,e[18]=P,e[19]=F,e[20]=H,e[21]=U):(H=e[20],U=e[21]),(0,_.useLayoutEffect)(H,U),N===`extensions`&&w){let t;e[22]===T?t=e[23]:(t=T.get(`from`)===`connections`?`connections`:T.get(`from`)===`skills`?`skills`:`installed`,e[22]=T,e[23]=t);let n;e[24]===T?n=e[25]:(n=T.get(`connect`),e[24]=T,e[25]=n);let r=n===`1`,i;e[26]!==w||e[27]!==T||e[28]!==r||e[29]!==t?(i=h(w,t,r,T.get(`returnTo`)??void 0),e[26]=w,e[27]=T,e[28]=r,e[29]=t,e[30]=i):i=e[30];let a;return e[31]===i?a=e[32]:(a=(0,v.jsx)(c,{replace:!0,to:i}),e[31]=i,e[32]=a),a}if(!M){let t;return e[33]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,v.jsx)(c,{to:f(p[0]),replace:!0}),e[33]=t):t=e[33],t}if(N===`connectors`&&T.get(`tab`)===`devices`){let t,n,r,i;if(e[34]!==T){let a=new URLSearchParams(T);a.delete(`tab`),t=c,n=!0,e[39]===Symbol.for(`react.memo_cache_sentinel`)?(r=f(`devices`),e[39]=r):r=e[39],i=a.toString(),e[34]=T,e[35]=t,e[36]=n,e[37]=r,e[38]=i}else t=e[35],n=e[36],r=e[37],i=e[38];let a;e[40]!==r||e[41]!==i?(a={pathname:r,search:i},e[40]=r,e[41]=i,e[42]=a):a=e[42];let o;return e[43]!==t||e[44]!==n||e[45]!==a?(o=(0,v.jsx)(t,{replace:n,to:a}),e[43]=t,e[44]=n,e[45]=a,e[46]=o):o=e[46],o}let W;e[47]===d.discoverLoading?W=e[48]:(W=(0,v.jsx)(se,{label:d.discoverLoading}),e[47]=d.discoverLoading,e[48]=W);let G;e[49]!==w||e[50]!==V||e[51]!==N?(G=N===`agents`?(0,v.jsx)(ie,{agentId:w,onHeaderActionChange:V}):null,e[49]=w,e[50]=V,e[51]=N,e[52]=G):G=e[52];let K;e[53]!==V||e[54]!==N?(K=N===`skills`?(0,v.jsx)(y,{embedded:!0,onHeaderActionChange:V}):null,e[53]=V,e[54]=N,e[55]=K):K=e[55];let q;e[56]!==V||e[57]!==N?(q=N===`connectors`?(0,v.jsx)(b,{embedded:!0,onHeaderActionChange:V}):null,e[56]=V,e[57]=N,e[58]=q):q=e[58];let J;e[59]!==n||e[60]!==t||e[61]!==i.connectorsSettings||e[62]!==N||e[63]!==P?(J=N===`devices`?(0,v.jsx)(`section`,{"aria-label":P,className:`mx-auto w-full max-w-7xl px-4 pb-7 sm:px-6 lg:px-8 lg:pb-9`,children:n?(0,v.jsx)(x,{zh:t===`zh`}):(0,v.jsx)(`p`,{className:`mt-3 rounded-xl bg-surface-panel px-4 py-3 text-sm text-fg-muted lg:mt-4`,children:i.connectorsSettings.tokenHint})}):null,e[59]=n,e[60]=t,e[61]=i.connectorsSettings,e[62]=N,e[63]=P,e[64]=J):J=e[64];let Y;e[65]!==w||e[66]!==V||e[67]!==N?(Y=N===`channels`?(0,v.jsx)(ae,{channelId:w,onHeaderActionChange:V}):null,e[65]=w,e[66]=V,e[67]=N,e[68]=Y):Y=e[68];let X;e[69]!==V||e[70]!==N?(X=N===`extensions`?(0,v.jsx)(re,{embedded:!0,onHeaderActionChange:V}):null,e[69]=V,e[70]=N,e[71]=X):X=e[71];let Z;e[72]!==N||e[73]!==K||e[74]!==q||e[75]!==J||e[76]!==Y||e[77]!==X||e[78]!==W||e[79]!==G?(Z=(0,v.jsxs)(_.Suspense,{fallback:W,children:[G,K,q,J,Y,X]},N),e[72]=N,e[73]=K,e[74]=q,e[75]=J,e[76]=Y,e[77]=X,e[78]=W,e[79]=G,e[80]=Z):Z=e[80];let Q;e[81]!==A||e[82]!==O||e[83]!==T?(Q=O?(0,v.jsx)(_.Suspense,{fallback:null,children:(0,v.jsx)(ne,{pluginId:O,initialConnect:T.get(`connect`)===`1`,onClose:A},O)}):null,e[81]=A,e[82]=O,e[83]=T,e[84]=Q):Q=e[84];let $;return e[85]!==Z||e[86]!==Q?($=(0,v.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[Z,Q]}),e[85]=Z,e[86]=Q,e[87]=$):$=e[87],$}function ce(e){return e.clearPageHeader}function le(e){return e.setPageHeader}function ue(e){return!!e.conversationId}function de(e){return e.language}export{w as CapabilitiesPage};
@@ -1,5 +1,5 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-swr-CdRzEUwF.js","assets/rolldown-runtime-aKtaBQYM.js","assets/vendor-react-BOUWij0V.js"])))=>i.map(i=>d[i]);
2
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-Czpn1I53.js";import{_ as a,d as o,h as s,r as c,t as l}from"./chunk-KS7C4IRE-DIIvxCDx.js";import{a as u,i as d,l as f,n as p,o as m}from"./locale-store-CHjsq5NR.js";import{t as h}from"./messages-C7QSnTdg.js";import{a as g,i as _,n as v,o as y,r as b,s as x,t as S}from"./dist-DlirbHVs.js";import{t as C}from"./arrow-right-DSSvoX71.js";import{a as w,i as T,n as E,t as D}from"./video-generation-Cec49Jwg.js";import{t as O}from"./chevron-right-BweFrslA.js";import{n as k,r as A,t as j}from"./popover-select-hRG1EzAY.js";import{t as M}from"./circle-check-C23XjkUj.js";import{C as N,S as P,_ as F,a as I,b as L,c as R,d as ee,f as z,g as B,h as V,i as H,l as U,m as te,n as W,o as ne,p as re,r as G,s as ie,t as ae,u as oe,v as se,x as ce,y as K}from"./connected-providers-grid-BgW-ioIt.js";import{t as le}from"./cloud-C4-yfnnk.js";import{t as q}from"./external-link-DjqjBmc3.js";import{t as J}from"./secret-input-DsjfQmDn.js";import{t as ue}from"./eye-CABVeTq0.js";import{t as de}from"./image-Cwyalflz.js";import{t as fe}from"./key-round-DWbpyU2U.js";import{t as pe}from"./loader-circle-CifKLtgG.js";import{t as me}from"./pencil-DmIY3Oa-.js";import{t as he}from"./plug-DKYPEgkR.js";import{t as ge}from"./plus-Q2yW6OE7.js";import{t as _e}from"./refresh-cw-BRlGaq2w.js";import{t as ve}from"./settings-2-D-csvaET.js";import{t as ye}from"./shield-check-BU58siTV.js";import{t as be}from"./sliders-horizontal-DqsYor6I.js";import{t as xe}from"./trash-2-DusmjVPV.js";import{t as Se}from"./triangle-alert-2JXFNNKU.js";import{t as Ce}from"./wrench-DFb4r8bH.js";import{t as we}from"./x-B_N4OPjy.js";import{t as Y}from"./cn-0WouolD0.js";import{t as Te}from"./skeleton-DzdOeGYz.js";import{t as Ee}from"./voice-CUfqdnlR.js";import{n as De}from"./cloud-credits-B-nbtkqv.js";import{a as Oe,i as X}from"./vendor-swr-CdRzEUwF.js";import{n as ke,r as Ae}from"./gateway-config-swr-BD-ams0X.js";import{n as je,t as Me}from"./registry-api-CDpUAb2R.js";import{t as Z}from"./button-C5tRaJxt.js";import{i as Ne,o as Pe}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{n as Fe}from"./open-capability-settings-DQsmJxI7.js";import{n as Ie,t as Le}from"./interaction-BdhHBbYa.js";import{n as Re,t as ze}from"./voice-settings-bAmN4bUq.js";import{a as Be,o as Ve,s as He}from"./form-field-width-DJw_jULe.js";import{n as Ue}from"./is-masked-secret-DOkL5b_X.js";import{n as We,t as Ge}from"./secret-input-labels-B5Jl5HqK.js";import{a as Ke}from"./navigation-ByOzYT0t.js";import{t as qe}from"./electron-env-DHOGevH3.js";import{n as Je,t as Ye}from"./settings-form-draft-Dy10ldo8.js";import{t as Xe}from"./sliding-tab-list-CmcrqRzN.js";import{t as Ze}from"./confirm-dialog-MHCmEEUZ.js";import{n as Qe,t as $e}from"./model-sort-_Tz8s_4N.js";import{n as et,r as tt}from"./model-selector-QFZY5XNN.js";import{n as nt}from"./agents-app-path-ciChvpCS.js";import{n as rt,t as it}from"./global-defaults-api-B7suATYU.js";import{t as at}from"./settings-loading-skeleton-CAoOV17i.js";import{i as ot,n as st,r as ct,t as lt}from"./capability-navigation-CZbCI5C2.js";import{a as ut,i as dt,o as ft,r as pt,t as mt}from"./models-hub-cache-BrD6r5Qs.js";import{a as ht,r as gt,s as _t,t as vt}from"./providers-api-D9NuB7w3.js";import{a as yt,i as bt,n as xt,o as St,r as Ct,t as wt}from"./oauth-api-DnMpUoyx.js";import{n as Tt,t as Et}from"./capability-presentation-DlJQUUlM.js";import{t as Dt}from"./settings-advanced-section-CTLdGPvx.js";import{n as Ot,r as kt,t as At}from"./oauth-authorization-window-o6URRos4.js";import{t as jt}from"./number-input-El7Szeln.js";import{n as Mt,t as Nt}from"./settings-page-header-C21Iw2rD.js";import"./settings-page-layout-BXcLlp6p.js";import{t as Pt}from"./use-section-navigation-yC9HkVpd.js";import{n as Ft,t as It}from"./settings-form-section-num14vSv.js";import{n as Lt,t as Rt}from"./use-autosave-B_WH_LBE.js";import{c as zt,h as Bt,l as Vt,n as Ht,o as Ut,t as Wt}from"./voice-config-api-sXEIG6lz.js";import{a as Gt,i as Kt,n as qt,o as Jt,r as Yt,s as Xt,t as Zt}from"./image-generation-api-Baz4xdZ4.js";import{t as Qt}from"./xopc-cloud-account-card-e8HJFnTs.js";var $t=`tencent-mps`,en=n(),Q=e(t(),1),$=r(),tn={en:{addTitle:`Add image service`,editTitle:`Manage image service`,intro:`Connect an endpoint that implements the OpenAI Images protocol.`,connection:`Connection`,providerId:`Provider ID`,providerIdHint:`Lowercase letters, numbers, hyphens, or underscores.`,name:`Display name`,baseUrl:`Base URL`,auth:`Authentication`,bearer:`Bearer token`,header:`Custom API key header`,none:`No authentication`,headerName:`Header name`,apiKey:`API key`,apiKeyHint:`Stored in the local credential store, separate from models.json.`,apiKeyUrl:`API key page (optional)`,docsUrl:`Documentation page (optional)`,openKeyPage:`Create API key`,paths:`Protocol and network`,generationsPath:`Generations path`,editsPath:`Edits path`,allowedHosts:`Allowed private hosts (optional)`,allowedHostsHint:`One exact hostname or IP per line. Private endpoints stay blocked unless listed here.`,staticHeaders:`Static headers (optional)`,staticHeadersHint:`One per line: X-Tenant: value. Credential headers are rejected.`,models:`Image models`,addModel:`Add model`,modelId:`Model ID`,modelName:`Name (optional)`,defaultModel:`Default model`,maxCount:`Max images`,defaultCount:`Default count`,defaultSize:`Default size`,format:`Output format`,supportsSize:`Supports size`,edit:`Supports edits`,remove:`Remove`,cancel:`Cancel`,save:`Save service`,saving:`Saving…`,test:`Test generation`,testing:`Generating…`,delete:`Delete service`,confirmDelete:`Delete permanently`,saved:`Image service saved.`,deleted:`Image service deleted.`,testReady:`Test image generated.`,show:`Show key`,hide:`Hide key`,copy:`Copy key`,copied:`Copied`,revealFailed:`Unable to reveal the saved key.`,notRevealable:`No revealable key is stored locally.`,required:`Complete the required connection and model fields.`,duplicateModels:`Model IDs must be unique.`,invalidHeaders:`Static headers must use “Name: value”, one per line.`},zh:{addTitle:`添加图片服务`,editTitle:`管理图片服务`,intro:`连接一个严格实现 OpenAI Images 协议的服务端点。`,connection:`连接信息`,providerId:`Provider ID`,providerIdHint:`仅支持小写字母、数字、连字符和下划线。`,name:`显示名称`,baseUrl:`Base URL`,auth:`认证方式`,bearer:`Bearer Token`,header:`自定义 API Key Header`,none:`无需认证`,headerName:`Header 名称`,apiKey:`API Key`,apiKeyHint:`密钥单独保存在本机凭据存储,不写入 models.json。`,apiKeyUrl:`API Key 创建页面(可选)`,docsUrl:`协议文档页面(可选)`,openKeyPage:`去创建 API Key`,paths:`协议与网络`,generationsPath:`生成路径`,editsPath:`编辑路径`,allowedHosts:`允许访问的私有主机(可选)`,allowedHostsHint:`每行一个精确主机名或 IP;未列出的私网端点保持阻止。`,staticHeaders:`静态 Headers(可选)`,staticHeadersHint:`每行一个:X-Tenant: value。认证 Header 会被拒绝。`,models:`图片模型`,addModel:`添加模型`,modelId:`模型 ID`,modelName:`名称(可选)`,defaultModel:`默认模型`,maxCount:`单次最大张数`,defaultCount:`默认张数`,defaultSize:`默认尺寸`,format:`输出格式`,supportsSize:`支持尺寸参数`,edit:`支持图片编辑`,remove:`移除`,cancel:`取消`,save:`保存服务`,saving:`保存中…`,test:`测试生成`,testing:`生成中…`,delete:`删除服务`,confirmDelete:`确认永久删除`,saved:`图片服务已保存。`,deleted:`图片服务已删除。`,testReady:`测试图片生成成功。`,show:`显示密钥`,hide:`隐藏密钥`,copy:`复制密钥`,copied:`已复制`,revealFailed:`无法查看已保存的密钥。`,notRevealable:`本机没有可查看的密钥。`,required:`请补全必填的连接和模型信息。`,duplicateModels:`模型 ID 不能重复。`,invalidHeaders:`静态 Header 必须使用“名称: 值”格式,每行一个。`}},nn=`mt-1.5 h-10 w-full rounded-lg border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/20`;function rn(e){let t=e??{id:``,capabilities:{generate:{maxCount:1,supportsSize:!0},edit:{enabled:!1}}};return{original:t,id:t.id,name:t.name??``,maxCount:String(t.capabilities.generate?.maxCount??1),defaultCount:t.defaults?.count?String(t.defaults.count):``,defaultSize:t.defaults?.size??``,outputFormat:t.defaults?.outputFormat??``,supportsSize:t.capabilities.generate?.supportsSize??!1,editEnabled:t.capabilities.edit?.enabled??!1}}function an(e){let t=e.split(`
2
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-Czpn1I53.js";import{_ as a,d as o,h as s,r as c,t as l}from"./chunk-KS7C4IRE-DIIvxCDx.js";import{a as u,i as d,l as f,n as p,o as m}from"./locale-store-CHjsq5NR.js";import{t as h}from"./messages-C7QSnTdg.js";import{a as g,i as _,n as v,o as y,r as b,s as x,t as S}from"./dist-DlirbHVs.js";import{t as C}from"./arrow-right-DSSvoX71.js";import{a as w,i as T,n as E,t as D}from"./video-generation-Cec49Jwg.js";import{t as O}from"./chevron-right-BweFrslA.js";import{n as k,r as A,t as j}from"./popover-select-hRG1EzAY.js";import{t as M}from"./circle-check-C23XjkUj.js";import{C as N,S as P,_ as F,a as I,b as L,c as R,d as ee,f as z,g as B,h as V,i as H,l as U,m as te,n as W,o as ne,p as re,r as G,s as ie,t as ae,u as oe,v as se,x as ce,y as K}from"./connected-providers-grid-BgW-ioIt.js";import{t as le}from"./cloud-C4-yfnnk.js";import{t as q}from"./external-link-DjqjBmc3.js";import{t as J}from"./secret-input-DsjfQmDn.js";import{t as ue}from"./eye-CABVeTq0.js";import{t as de}from"./image-Cwyalflz.js";import{t as fe}from"./key-round-DWbpyU2U.js";import{t as pe}from"./loader-circle-CifKLtgG.js";import{t as me}from"./pencil-DmIY3Oa-.js";import{t as he}from"./plug-DKYPEgkR.js";import{t as ge}from"./plus-Q2yW6OE7.js";import{t as _e}from"./refresh-cw-BRlGaq2w.js";import{t as ve}from"./settings-2-D-csvaET.js";import{t as ye}from"./shield-check-BU58siTV.js";import{t as be}from"./sliders-horizontal-DqsYor6I.js";import{t as xe}from"./trash-2-DusmjVPV.js";import{t as Se}from"./triangle-alert-2JXFNNKU.js";import{t as Ce}from"./wrench-DFb4r8bH.js";import{t as we}from"./x-B_N4OPjy.js";import{t as Y}from"./cn-0WouolD0.js";import{t as Te}from"./skeleton-DzdOeGYz.js";import{t as Ee}from"./voice-CUfqdnlR.js";import{n as De}from"./cloud-credits-B-nbtkqv.js";import{a as Oe,i as X}from"./vendor-swr-CdRzEUwF.js";import{n as ke,r as Ae}from"./gateway-config-swr-BD-ams0X.js";import{n as je,t as Me}from"./registry-api-CDpUAb2R.js";import{t as Z}from"./button-C5tRaJxt.js";import{i as Ne,o as Pe}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{n as Fe}from"./open-capability-settings-DQsmJxI7.js";import{n as Ie,t as Le}from"./interaction-BdhHBbYa.js";import{n as Re,t as ze}from"./voice-settings-j8o-hGTm.js";import{a as Be,o as Ve,s as He}from"./form-field-width-DJw_jULe.js";import{n as Ue}from"./is-masked-secret-DOkL5b_X.js";import{n as We,t as Ge}from"./secret-input-labels-B5Jl5HqK.js";import{a as Ke}from"./navigation-ByOzYT0t.js";import{t as qe}from"./electron-env-DHOGevH3.js";import{n as Je,t as Ye}from"./settings-form-draft-Dy10ldo8.js";import{t as Xe}from"./sliding-tab-list-CmcrqRzN.js";import{t as Ze}from"./confirm-dialog-MHCmEEUZ.js";import{n as Qe,t as $e}from"./model-sort-_Tz8s_4N.js";import{n as et,r as tt}from"./model-selector-QFZY5XNN.js";import{n as nt}from"./agents-app-path-ciChvpCS.js";import{n as rt,t as it}from"./global-defaults-api-B7suATYU.js";import{t as at}from"./settings-loading-skeleton-CAoOV17i.js";import{i as ot,n as st,r as ct,t as lt}from"./capability-navigation-CZbCI5C2.js";import{a as ut,i as dt,o as ft,r as pt,t as mt}from"./models-hub-cache-BrD6r5Qs.js";import{a as ht,r as gt,s as _t,t as vt}from"./providers-api-D9NuB7w3.js";import{a as yt,i as bt,n as xt,o as St,r as Ct,t as wt}from"./oauth-api-DnMpUoyx.js";import{n as Tt,t as Et}from"./capability-presentation-DlJQUUlM.js";import{t as Dt}from"./settings-advanced-section-CTLdGPvx.js";import{n as Ot,r as kt,t as At}from"./oauth-authorization-window-o6URRos4.js";import{t as jt}from"./number-input-El7Szeln.js";import{n as Mt,t as Nt}from"./settings-page-header-C21Iw2rD.js";import"./settings-page-layout-BXcLlp6p.js";import{t as Pt}from"./use-section-navigation-yC9HkVpd.js";import{n as Ft,t as It}from"./settings-form-section-num14vSv.js";import{n as Lt,t as Rt}from"./use-autosave-B_WH_LBE.js";import{c as zt,h as Bt,l as Vt,n as Ht,o as Ut,t as Wt}from"./voice-config-api-sXEIG6lz.js";import{a as Gt,i as Kt,n as qt,o as Jt,r as Yt,s as Xt,t as Zt}from"./image-generation-api-Baz4xdZ4.js";import{t as Qt}from"./xopc-cloud-account-card-e8HJFnTs.js";var $t=`tencent-mps`,en=n(),Q=e(t(),1),$=r(),tn={en:{addTitle:`Add image service`,editTitle:`Manage image service`,intro:`Connect an endpoint that implements the OpenAI Images protocol.`,connection:`Connection`,providerId:`Provider ID`,providerIdHint:`Lowercase letters, numbers, hyphens, or underscores.`,name:`Display name`,baseUrl:`Base URL`,auth:`Authentication`,bearer:`Bearer token`,header:`Custom API key header`,none:`No authentication`,headerName:`Header name`,apiKey:`API key`,apiKeyHint:`Stored in the local credential store, separate from models.json.`,apiKeyUrl:`API key page (optional)`,docsUrl:`Documentation page (optional)`,openKeyPage:`Create API key`,paths:`Protocol and network`,generationsPath:`Generations path`,editsPath:`Edits path`,allowedHosts:`Allowed private hosts (optional)`,allowedHostsHint:`One exact hostname or IP per line. Private endpoints stay blocked unless listed here.`,staticHeaders:`Static headers (optional)`,staticHeadersHint:`One per line: X-Tenant: value. Credential headers are rejected.`,models:`Image models`,addModel:`Add model`,modelId:`Model ID`,modelName:`Name (optional)`,defaultModel:`Default model`,maxCount:`Max images`,defaultCount:`Default count`,defaultSize:`Default size`,format:`Output format`,supportsSize:`Supports size`,edit:`Supports edits`,remove:`Remove`,cancel:`Cancel`,save:`Save service`,saving:`Saving…`,test:`Test generation`,testing:`Generating…`,delete:`Delete service`,confirmDelete:`Delete permanently`,saved:`Image service saved.`,deleted:`Image service deleted.`,testReady:`Test image generated.`,show:`Show key`,hide:`Hide key`,copy:`Copy key`,copied:`Copied`,revealFailed:`Unable to reveal the saved key.`,notRevealable:`No revealable key is stored locally.`,required:`Complete the required connection and model fields.`,duplicateModels:`Model IDs must be unique.`,invalidHeaders:`Static headers must use “Name: value”, one per line.`},zh:{addTitle:`添加图片服务`,editTitle:`管理图片服务`,intro:`连接一个严格实现 OpenAI Images 协议的服务端点。`,connection:`连接信息`,providerId:`Provider ID`,providerIdHint:`仅支持小写字母、数字、连字符和下划线。`,name:`显示名称`,baseUrl:`Base URL`,auth:`认证方式`,bearer:`Bearer Token`,header:`自定义 API Key Header`,none:`无需认证`,headerName:`Header 名称`,apiKey:`API Key`,apiKeyHint:`密钥单独保存在本机凭据存储,不写入 models.json。`,apiKeyUrl:`API Key 创建页面(可选)`,docsUrl:`协议文档页面(可选)`,openKeyPage:`去创建 API Key`,paths:`协议与网络`,generationsPath:`生成路径`,editsPath:`编辑路径`,allowedHosts:`允许访问的私有主机(可选)`,allowedHostsHint:`每行一个精确主机名或 IP;未列出的私网端点保持阻止。`,staticHeaders:`静态 Headers(可选)`,staticHeadersHint:`每行一个:X-Tenant: value。认证 Header 会被拒绝。`,models:`图片模型`,addModel:`添加模型`,modelId:`模型 ID`,modelName:`名称(可选)`,defaultModel:`默认模型`,maxCount:`单次最大张数`,defaultCount:`默认张数`,defaultSize:`默认尺寸`,format:`输出格式`,supportsSize:`支持尺寸参数`,edit:`支持图片编辑`,remove:`移除`,cancel:`取消`,save:`保存服务`,saving:`保存中…`,test:`测试生成`,testing:`生成中…`,delete:`删除服务`,confirmDelete:`确认永久删除`,saved:`图片服务已保存。`,deleted:`图片服务已删除。`,testReady:`测试图片生成成功。`,show:`显示密钥`,hide:`隐藏密钥`,copy:`复制密钥`,copied:`已复制`,revealFailed:`无法查看已保存的密钥。`,notRevealable:`本机没有可查看的密钥。`,required:`请补全必填的连接和模型信息。`,duplicateModels:`模型 ID 不能重复。`,invalidHeaders:`静态 Header 必须使用“名称: 值”格式,每行一个。`}},nn=`mt-1.5 h-10 w-full rounded-lg border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/20`;function rn(e){let t=e??{id:``,capabilities:{generate:{maxCount:1,supportsSize:!0},edit:{enabled:!1}}};return{original:t,id:t.id,name:t.name??``,maxCount:String(t.capabilities.generate?.maxCount??1),defaultCount:t.defaults?.count?String(t.defaults.count):``,defaultSize:t.defaults?.size??``,outputFormat:t.defaults?.outputFormat??``,supportsSize:t.capabilities.generate?.supportsSize??!1,editEnabled:t.capabilities.edit?.enabled??!1}}function an(e){let t=e.split(`
3
3
  `).map(e=>e.trim()).filter(Boolean);if(t.length===0)return;let n=t.map(e=>{let t=e.indexOf(`:`);if(t<=0||!e.slice(t+1).trim())throw Error(`invalid_headers`);return[e.slice(0,t).trim(),e.slice(t+1).trim()]});return Object.fromEntries(n)}function on({open:e,onOpenChange:t,provider:n,configured:r,language:i,onSaved:a,portalContainer:o,onPendingChange:s}){let c=tn[i],[l,u]=(0,Q.useState)(``),[d,f]=(0,Q.useState)(``),[p,m]=(0,Q.useState)(``),[h,C]=(0,Q.useState)(`bearer`),[T,E]=(0,Q.useState)(`x-api-key`),[D,O]=(0,Q.useState)(``),[k,A]=(0,Q.useState)(``),[M,N]=(0,Q.useState)(``),[P,F]=(0,Q.useState)(`/images/generations`),[I,L]=(0,Q.useState)(`/images/edits`),[R,ee]=(0,Q.useState)(``),[z,B]=(0,Q.useState)(``),[V,H]=(0,Q.useState)([rn()]),[U,te]=(0,Q.useState)(``),[W,ne]=(0,Q.useState)(),[re,G]=(0,Q.useState)(!1),[ie,ae]=(0,Q.useState)(),[oe,se]=(0,Q.useState)(),[ce,K]=(0,Q.useState)();(0,Q.useEffect)(()=>(s?.(!!W),()=>s?.(!1)),[W,s]),(0,Q.useEffect)(()=>{if(!e)return;let t=n?.imageGeneration;u(n?.providerId??``),f(t?.name??``),m(n?.baseUrl??``),C(t?.auth.type??`bearer`),E(t?.auth.type===`header`?t.auth.headerName:`x-api-key`),O(r?`••••••••••••`:``),A(t?.apiKeyUrl??``),N(t?.documentationUrl??``),F(t?.paths?.generations??`/images/generations`),L(t?.paths?.edits??`/images/edits`),ee(t?.network?.allowedHosts.join(`
4
4
  `)??``),B(Object.entries(n?.headers??{}).map(([e,t])=>`${e}: ${t}`).join(`
5
5
  `)),H(t?.models.map(rn)??[rn()]),te(t?.defaultModel??``),se(void 0),ne(void 0),G(!1),ae(void 0),K(void 0)},[r,e,n]);let le=(0,Q.useMemo)(()=>V.filter(e=>e.id.trim()).sort(Qe).map(e=>({value:e.id.trim(),label:e.name.trim()||e.id.trim()})),[V]),q=(e,t)=>{H(n=>n.map((n,r)=>r===e?{...n,...t}:n))},de=()=>{let e=l.trim(),t=V.map(e=>({...e,id:e.id.trim(),name:e.name.trim()}));if(!e||!d.trim()||!p.trim()||t.some(e=>!e.id))throw Error(c.required);if(new Set(t.map(e=>e.id)).size!==t.length)throw Error(c.duplicateModels);let n=U||t[0]?.id;if(!n||!t.some(e=>e.id===n))throw Error(c.required);let r;try{r=an(z)}catch{throw Error(c.invalidHeaders)}return{providerId:e,input:{baseUrl:p.trim(),...r?{headers:r}:{},imageGeneration:{api:`openai-images`,name:d.trim(),...M.trim()?{documentationUrl:M.trim()}:{},...k.trim()?{apiKeyUrl:k.trim()}:{},defaultModel:n,auth:h===`header`?{type:`header`,headerName:T.trim()}:{type:h},paths:{...P.trim()?{generations:P.trim()}:{},...I.trim()?{edits:I.trim()}:{}},...R.trim()?{network:{allowedHosts:R.split(`