@xopcai/xopc 0.0.241 → 0.0.243

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 (257) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/xopc.extension.json +1 -1
  3. package/dist/gateway/static/root/assets/{activity-store-CLnbVm9G.js → activity-store-CAah-_8h.js} +1 -1
  4. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-DuBewmbW.js → agent-avatar-dicebear-DDH4HgP7.js} +1 -1
  5. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-BDCfJZhh.js +1 -0
  6. package/dist/gateway/static/root/assets/agents-B0ZWgf-U.js +1 -0
  7. package/dist/gateway/static/root/assets/{api-DjBZe303.js → api-B2tKxbcz.js} +1 -1
  8. package/dist/gateway/static/root/assets/app-management-settings-panel-Blfwszzn.js +1 -0
  9. package/dist/gateway/static/root/assets/{appearance-settings-B-iul0RG.js → appearance-settings-C3V7Na75.js} +1 -1
  10. package/dist/gateway/static/root/assets/apps-page-BiEks0-F.js +1 -0
  11. package/dist/gateway/static/root/assets/{archive-plugin-BOx0EJZs.js → archive-plugin-BmSx7wzY.js} +1 -1
  12. package/dist/gateway/static/root/assets/{attachment-load-Cfk1lwBo.js → attachment-load-BS-S4LJ9.js} +1 -1
  13. package/dist/gateway/static/root/assets/{automations-page-BTSGvaeS.js → automations-page-C7Y3L30D.js} +1 -1
  14. package/dist/gateway/static/root/assets/automations-workspace-A3zPkPuo.js +6 -0
  15. package/dist/gateway/static/root/assets/{binary-plugins-ChZyZK45.js → binary-plugins-BM9B5kcm.js} +1 -1
  16. package/dist/gateway/static/root/assets/block-editor-BbnpkYP9.js +185 -0
  17. package/dist/gateway/static/root/assets/browser-settings-page-Dk4FQ7fY.js +8 -0
  18. package/dist/gateway/static/root/assets/{browser-workflow-inputs-jvfcgFG-.js → browser-workflow-inputs-CRnkgZHI.js} +1 -1
  19. package/dist/gateway/static/root/assets/{browser-workflows-page-DrHW7XNi.js → browser-workflows-page-B9qGL-it.js} +2 -2
  20. package/dist/gateway/static/root/assets/{button-CSEbl4zT.js → button-CtTvuElV.js} +1 -1
  21. package/dist/gateway/static/root/assets/capabilities-settings-panel--tR_El9e.js +7 -0
  22. package/dist/gateway/static/root/assets/channels-settings-D347vl_J.js +1 -0
  23. package/dist/gateway/static/root/assets/{channels-status-swr-CC9MFway.js → channels-status-swr-DuY4MGxe.js} +1 -1
  24. package/dist/gateway/static/root/assets/{chat-terminal-dock-DeeZrVbV.js → chat-terminal-dock-DABPvwBT.js} +2 -2
  25. package/dist/gateway/static/root/assets/connectors-page-B-tvJkRJ.js +2 -0
  26. package/dist/gateway/static/root/assets/{cron-expression-CiqQOeQ3.js → cron-expression-D3bsKbNd.js} +1 -1
  27. package/dist/gateway/static/root/assets/{date-picker-CGAMGPfU.js → date-picker-BsGM6Yty.js} +1 -1
  28. package/dist/gateway/static/root/assets/{dependency-picker-CxWeUTsc.js → dependency-picker-Dj3g6YXZ.js} +1 -1
  29. package/dist/gateway/static/root/assets/{desktop-pet-C3QmYO75.js → desktop-pet-C1QT0Sur.js} +1 -1
  30. package/dist/gateway/static/root/assets/{desktop-pet-settings-CAADkWYy.js → desktop-pet-settings-r6kAOnfY.js} +1 -1
  31. package/dist/gateway/static/root/assets/dist-CpzYSoz7.js +1 -0
  32. package/dist/gateway/static/root/assets/{dist-DaxPZj9e.js → dist-DBS3OB8K.js} +1 -1
  33. package/dist/gateway/static/root/assets/dist-DLmwHyAh.js +1 -0
  34. package/dist/gateway/static/root/assets/es2015-BvLh9GaE.js +41 -0
  35. package/dist/gateway/static/root/assets/{extension-debug-page-FQXjDJ8P.js → extension-debug-page-DOkf7nh9.js} +1 -1
  36. package/dist/gateway/static/root/assets/{extension-page-BJE1D5Ji.js → extension-page-Cq2IA4Ho.js} +1 -1
  37. package/dist/gateway/static/root/assets/{extension-settings-page-5Ik2tNry.js → extension-settings-page-DQn4qjDZ.js} +1 -1
  38. package/dist/gateway/static/root/assets/{files-DQjhZjr2.js → files-D6vf3S30.js} +1 -1
  39. package/dist/gateway/static/root/assets/{gateway-config-api-cTj71t2a.js → gateway-config-api-DM3poL22.js} +1 -1
  40. package/dist/gateway/static/root/assets/{gateway-config-swr-Bxe_R-JH.js → gateway-config-swr-BC3pgb_P.js} +1 -1
  41. package/dist/gateway/static/root/assets/{gateway-settings-KXBUjNcx.js → gateway-settings-DPgH1hnh.js} +1 -1
  42. package/dist/gateway/static/root/assets/{gateway-startup-retry-DJG-I0wW.js → gateway-startup-retry-uMcSfLru.js} +1 -1
  43. package/dist/gateway/static/root/assets/{heartbeat-settings-C8cVzIcs.js → heartbeat-settings-Bk80-E3b.js} +1 -1
  44. package/dist/gateway/static/root/assets/home-page-DKo5JiMR.js +1 -0
  45. package/dist/gateway/static/root/assets/{image-generation-api-Dc_ojQuj.js → image-generation-api-D1qlQA-A.js} +1 -1
  46. package/dist/gateway/static/root/assets/index-B0WJL9N1.js +71 -0
  47. package/dist/gateway/static/root/assets/index-Dbh5SXyV.css +2 -0
  48. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-pOKl7blR.js → keyboard-shortcuts-settings-BEwvd8ZU.js} +1 -1
  49. package/dist/gateway/static/root/assets/local-app-workbench-page--eJ5rmNj.js +2 -0
  50. package/dist/gateway/static/root/assets/{local-apps-page-Bi6wwKgm.js → local-apps-page-CgkY9E-r.js} +1 -1
  51. package/dist/gateway/static/root/assets/{locale-store-C5wr3_pc.js → locale-store-CMZljTJx.js} +1 -1
  52. package/dist/gateway/static/root/assets/logs-page-Z49Td0J9.js +2 -0
  53. package/dist/gateway/static/root/assets/{management-settings-DGlVizWi.js → management-settings-Dv8NSJKt.js} +1 -1
  54. package/dist/gateway/static/root/assets/{markdown-split-CXP5zBx_.js → markdown-split-Cm0RBB-t.js} +1 -1
  55. package/dist/gateway/static/root/assets/{markdown-view-D6LxlDxr.js → markdown-view-PPCLt7fu.js} +3 -3
  56. package/dist/gateway/static/root/assets/{media-plugins-BsENGLr2.js → media-plugins-Bcr5sU1f.js} +1 -1
  57. package/dist/gateway/static/root/assets/messages-CTSgFlE4.js +3 -0
  58. package/dist/gateway/static/root/assets/mobile-pairing-wizard-kKDiXofY.js +1 -0
  59. package/dist/gateway/static/root/assets/{models-hub-cache-Y7GUjxHx.js → models-hub-cache-ZrbGRiGY.js} +1 -1
  60. package/dist/gateway/static/root/assets/{notes-page-D2EqpDyo.js → notes-page-CgsaRaGi.js} +1 -1
  61. package/dist/gateway/static/root/assets/notes-workbench-C1DEE09k.js +4 -0
  62. package/dist/gateway/static/root/assets/{oauth-api-C5NVcsKE.js → oauth-api-4VeMbkTJ.js} +1 -1
  63. package/dist/gateway/static/root/assets/popover-select-C-Hj-nXR.js +1 -0
  64. package/dist/gateway/static/root/assets/{product-delivery-dUJgmBQZ.js → product-delivery-CV4pDOtG.js} +1 -1
  65. package/dist/gateway/static/root/assets/product-open-page-BU0HiZtv.js +1 -0
  66. package/dist/gateway/static/root/assets/project-detail-page-isRapnp5.js +1 -0
  67. package/dist/gateway/static/root/assets/projects-page-zvsjg0mi.js +1 -0
  68. package/dist/gateway/static/root/assets/{registry-api-FXdFaoWM.js → registry-api-CWOtPFrE.js} +1 -1
  69. package/dist/gateway/static/root/assets/remote-access-hub-C9TGZ9Hc.js +1 -0
  70. package/dist/gateway/static/root/assets/runtime-tools-settings-panel-2zm9edMA.js +5 -0
  71. package/dist/gateway/static/root/assets/{schema-form-BUzdHWx6.js → schema-form-54A5gzkN.js} +1 -1
  72. package/dist/gateway/static/root/assets/{schemas-zIBW3wiV.js → schemas-BHS7bo06.js} +1 -1
  73. package/dist/gateway/static/root/assets/sessions-page-BP8RyiUn.js +1 -0
  74. package/dist/gateway/static/root/assets/settings-advanced-gate-D4EMxWAZ.js +1 -0
  75. package/dist/gateway/static/root/assets/{settings-page-C0OBLqpu.js → settings-page-DzDhoyxv.js} +1 -1
  76. package/dist/gateway/static/root/assets/{setup-status-panel-NpLQkFCh.js → setup-status-panel-uDicHU1w.js} +1 -1
  77. package/dist/gateway/static/root/assets/{share-preview-page-BtbPYaYC.js → share-preview-page-lOmLCWFS.js} +1 -1
  78. package/dist/gateway/static/root/assets/shares-settings-T4Yvouvv.js +1 -0
  79. package/dist/gateway/static/root/assets/skill-reload-api-DVb7nrXz.js +1 -0
  80. package/dist/gateway/static/root/assets/{skills-page-CYk8pN97.js → skills-page-CnyNH3To.js} +1 -1
  81. package/dist/gateway/static/root/assets/skills-page.utils-CgDtf2qs.js +1 -0
  82. package/dist/gateway/static/root/assets/{system-settings-panel-DmCRSvtd.js → system-settings-panel-C8yWfwtR.js} +1 -1
  83. package/dist/gateway/static/root/assets/task-detail-page-Tzfjlbf3.js +1 -0
  84. package/dist/gateway/static/root/assets/{theme-store-DUko1ZnE.js → theme-store-uxUwr10D.js} +1 -1
  85. package/dist/gateway/static/root/assets/tunnel-api-Bvg679no.js +1 -0
  86. package/dist/gateway/static/root/assets/{use-autosave-W_P8Kiv4.js → use-autosave-D88VGoyG.js} +1 -1
  87. package/dist/gateway/static/root/assets/user-context-page-RijPtyfO.js +1 -0
  88. package/dist/gateway/static/root/assets/{voice-api-key-field-BZD0j1jc.js → voice-api-key-field-CBHLsMcc.js} +1 -1
  89. package/dist/gateway/static/root/assets/voice-config-api-MqyI6cgq.js +1 -0
  90. package/dist/gateway/static/root/assets/work-discovery-overlay-GGe2TQ98.js +1 -0
  91. package/dist/gateway/static/root/assets/workflow-run-setup-panel-C0layUE9.js +3 -0
  92. package/dist/gateway/static/root/assets/workflows-page-DQXIzBAc.js +5 -0
  93. package/dist/gateway/static/root/index.html +21 -22
  94. package/dist/package.js +1 -1
  95. package/dist/packages/realtime-protocol/src/voice-audio.js +20 -0
  96. package/dist/packages/realtime-protocol/src/voice.js +208 -0
  97. package/dist/src/agent/agent-manager.js +1 -0
  98. package/dist/src/agent/embedded/run-for-session.d.ts +1 -0
  99. package/dist/src/agent/embedded/run-for-session.js +2 -1
  100. package/dist/src/agent/inbound/turn-dispatcher.d.ts +1 -0
  101. package/dist/src/agent/inbound/turn-dispatcher.js +2 -1
  102. package/dist/src/agent/prompt/voice-presentation.d.ts +2 -0
  103. package/dist/src/agent/prompt/voice-presentation.js +12 -0
  104. package/dist/src/agent/service/direct-turn-helpers.d.ts +1 -0
  105. package/dist/src/agent/service/direct-turn-helpers.js +1 -0
  106. package/dist/src/agent/service/process-direct-streaming.d.ts +1 -0
  107. package/dist/src/agent/service/process-direct-streaming.js +2 -1
  108. package/dist/src/agent/session/session-config-service.js +4 -2
  109. package/dist/src/agent/skills/installer.d.ts +1 -0
  110. package/dist/src/agent/skills/installer.js +9 -6
  111. package/dist/src/agent/tools/factory.d.ts +2 -0
  112. package/dist/src/agent/tools/factory.js +5 -1
  113. package/dist/src/automations/draft/automation-draft-service.js +1 -1
  114. package/dist/src/config/models-json.d.ts +8 -8
  115. package/dist/src/config/schema.d.ts +60 -0
  116. package/dist/src/config/schema.js +36 -4
  117. package/dist/src/extensions/install.js +1 -1
  118. package/dist/src/files/file-service.d.ts +1 -0
  119. package/dist/src/files/file-service.js +4 -0
  120. package/dist/src/gateway/chat-stream/thinking-delta-coalescer.js +8 -3
  121. package/dist/src/gateway/hono/lib/config-payload.d.ts +1 -11
  122. package/dist/src/gateway/hono/lib/config-payload.js +2 -2
  123. package/dist/src/gateway/hono/lib/safe-voice-config.d.ts +14 -0
  124. package/dist/src/gateway/hono/lib/safe-voice-config.js +29 -1
  125. package/dist/src/gateway/hono/routes/config-patch/misc.js +2 -2
  126. package/dist/src/gateway/hono/routes/files.js +7 -0
  127. package/dist/src/gateway/hono/routes/lazy-fallback.js +18 -4
  128. package/dist/src/gateway/hono/routes/runtime-tools.js +7 -1
  129. package/dist/src/gateway/hono/routes/session-input-handler.js +14 -0
  130. package/dist/src/gateway/hono/routes/sessions.js +4 -1
  131. package/dist/src/gateway/hono/routes/voice.js +140 -3
  132. package/dist/src/gateway/server.js +1 -0
  133. package/dist/src/gateway/service/agent-runner.d.ts +1 -0
  134. package/dist/src/gateway/service/agent-runner.js +1 -6
  135. package/dist/src/gateway/service/run-gateway-agent.d.ts +1 -0
  136. package/dist/src/gateway/service/run-gateway-agent.js +19 -1
  137. package/dist/src/gateway/service.d.ts +2 -0
  138. package/dist/src/gateway/service.js +73 -0
  139. package/dist/src/media-understanding/types.d.ts +61 -0
  140. package/dist/src/runtime-tools/archive.js +17 -3
  141. package/dist/src/runtime-tools/command.d.ts +1 -0
  142. package/dist/src/runtime-tools/command.js +29 -8
  143. package/dist/src/runtime-tools/environment.d.ts +1 -0
  144. package/dist/src/runtime-tools/environment.js +11 -16
  145. package/dist/src/runtime-tools/install-lock.d.ts +1 -1
  146. package/dist/src/runtime-tools/install-lock.js +34 -21
  147. package/dist/src/runtime-tools/manager.d.ts +1 -1
  148. package/dist/src/runtime-tools/manager.js +99 -64
  149. package/dist/src/runtime-tools/manifest-store.d.ts +2 -0
  150. package/dist/src/runtime-tools/manifest-store.js +29 -8
  151. package/dist/src/runtime-tools/paths.d.ts +2 -1
  152. package/dist/src/runtime-tools/paths.js +19 -8
  153. package/dist/src/runtime-tools/probe.d.ts +2 -0
  154. package/dist/src/runtime-tools/probe.js +13 -1
  155. package/dist/src/runtime-tools/prune.js +21 -7
  156. package/dist/src/session/client-history.js +12 -0
  157. package/dist/src/session/manager.d.ts +1 -0
  158. package/dist/src/session/session-context-for-llm.js +8 -0
  159. package/dist/src/session/store.d.ts +1 -0
  160. package/dist/src/session/store.js +1 -0
  161. package/dist/src/session/stored-rows-to-file-entries.js +5 -1
  162. package/dist/src/session/voice-transcript.d.ts +9 -0
  163. package/dist/src/session/voice-transcript.js +45 -0
  164. package/dist/src/storage/sqlite/config-repository.js +9 -0
  165. package/dist/src/storage/sqlite/remote-context-repository.d.ts +3 -0
  166. package/dist/src/storage/sqlite/remote-context-repository.js +40 -0
  167. package/dist/src/storage/sqlite/session-repository.js +13 -0
  168. package/dist/src/storage/sqlite/user-context-repository.d.ts +3 -1
  169. package/dist/src/storage/sqlite/user-context-repository.js +50 -4
  170. package/dist/src/tui/tui.js +2 -1
  171. package/dist/src/user-context/automatic-context.d.ts +17 -0
  172. package/dist/src/user-context/automatic-context.js +85 -0
  173. package/dist/src/user-context/changes.d.ts +7 -0
  174. package/dist/src/user-context/changes.js +28 -0
  175. package/dist/src/user-context/planner.js +1 -24
  176. package/dist/src/user-context/retriever.js +10 -11
  177. package/dist/src/user-context/selection-policy.d.ts +20 -0
  178. package/dist/src/user-context/selection-policy.js +33 -0
  179. package/dist/src/user-context/sources/index.js +2 -2
  180. package/dist/src/user-context/sources/repository.d.ts +2 -1
  181. package/dist/src/user-context/sources/repository.js +26 -5
  182. package/dist/src/voice/dashscope/streaming-stt-session.d.ts +2 -0
  183. package/dist/src/voice/dashscope/streaming-stt-session.js +249 -0
  184. package/dist/src/voice/dashscope/streaming-tts-stream.d.ts +12 -0
  185. package/dist/src/voice/dashscope/streaming-tts-stream.js +153 -0
  186. package/dist/src/voice/realtime/agentEngine.d.ts +10 -0
  187. package/dist/src/voice/realtime/agentEngine.js +403 -0
  188. package/dist/src/voice/realtime/audio-playback-window.d.ts +9 -0
  189. package/dist/src/voice/realtime/audio-playback-window.js +49 -0
  190. package/dist/src/voice/realtime/conversation-context.d.ts +11 -0
  191. package/dist/src/voice/realtime/conversation-context.js +76 -0
  192. package/dist/src/voice/realtime/engine.d.ts +13 -0
  193. package/dist/src/voice/realtime/engine.js +1 -0
  194. package/dist/src/voice/realtime/memory-context.d.ts +17 -0
  195. package/dist/src/voice/realtime/memory-context.js +100 -0
  196. package/dist/src/voice/realtime/omniEngine.d.ts +18 -0
  197. package/dist/src/voice/realtime/omniEngine.js +443 -0
  198. package/dist/src/voice/realtime/omniRoute.d.ts +10 -0
  199. package/dist/src/voice/realtime/omniRoute.js +31 -0
  200. package/dist/src/voice/realtime/runtime.d.ts +99 -0
  201. package/dist/src/voice/realtime/runtime.js +622 -0
  202. package/dist/src/voice/realtime/speakable-segmenter.d.ts +10 -0
  203. package/dist/src/voice/realtime/speakable-segmenter.js +87 -0
  204. package/dist/src/voice/stt/list-providers.js +2 -1
  205. package/dist/src/voice/stt/providers/alibaba-transcription.js +13 -1
  206. package/dist/src/voice/stt/providers/xopc-cloud-transcription.js +23 -0
  207. package/dist/src/voice/tts/factory.js +1 -0
  208. package/dist/src/voice/tts/openai-compatible-speech.js +3 -1
  209. package/dist/src/voice/tts/providers/alibaba-speech.d.ts +1 -5
  210. package/dist/src/voice/tts/providers/alibaba-speech.js +25 -8
  211. package/dist/src/voice/tts/providers/edge-speech.js +21 -22
  212. package/dist/src/voice/tts/providers/minimax-speech.js +6 -3
  213. package/dist/src/voice/tts/providers/xopc-cloud-speech.js +26 -1
  214. package/dist/src/voice/tts/speak-core.d.ts +6 -2
  215. package/dist/src/voice/tts/speak-core.js +46 -34
  216. package/dist/src/voice/tts/speech-provider-types.d.ts +1 -0
  217. package/package.json +6 -6
  218. package/dist/gateway/static/root/assets/Combination-14nmIgxH.js +0 -41
  219. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-DbdgX6AA.js +0 -1
  220. package/dist/gateway/static/root/assets/agents-BX3uRVm4.js +0 -1
  221. package/dist/gateway/static/root/assets/app-chrome-BeB4KgOf.js +0 -1
  222. package/dist/gateway/static/root/assets/app-management-settings-panel-D8evZyFQ.js +0 -1
  223. package/dist/gateway/static/root/assets/apps-page-CoZd_cZu.js +0 -1
  224. package/dist/gateway/static/root/assets/automations-workspace-C8RRKT-a.js +0 -6
  225. package/dist/gateway/static/root/assets/block-editor-DCH9b2Ht.js +0 -184
  226. package/dist/gateway/static/root/assets/browser-settings-page-D1GPwIfx.js +0 -8
  227. package/dist/gateway/static/root/assets/capabilities-settings-panel-CrXB1Q-l.js +0 -7
  228. package/dist/gateway/static/root/assets/channels-settings-DWMSYaNZ.js +0 -1
  229. package/dist/gateway/static/root/assets/connectors-page-DXTl1fNB.js +0 -2
  230. package/dist/gateway/static/root/assets/dist-BPoKqzeH.js +0 -1
  231. package/dist/gateway/static/root/assets/dist-DqPZM2MH.js +0 -1
  232. package/dist/gateway/static/root/assets/home-page-NdWtBda5.js +0 -1
  233. package/dist/gateway/static/root/assets/index-7i2P3312.js +0 -70
  234. package/dist/gateway/static/root/assets/index-DTo3IcbW.css +0 -2
  235. package/dist/gateway/static/root/assets/local-app-workbench-page-C_j_od5f.js +0 -2
  236. package/dist/gateway/static/root/assets/logs-page-D6PDZEVP.js +0 -2
  237. package/dist/gateway/static/root/assets/messages-_tYhRAHD.js +0 -3
  238. package/dist/gateway/static/root/assets/mobile-pairing-wizard-DcEz7qcX.js +0 -1
  239. package/dist/gateway/static/root/assets/notes-workbench-Bu0a83Oj.js +0 -4
  240. package/dist/gateway/static/root/assets/popover-select-DrILF6mR.js +0 -1
  241. package/dist/gateway/static/root/assets/product-open-page-DMhf1rdz.js +0 -1
  242. package/dist/gateway/static/root/assets/project-detail-page-DDHi0Y4Q.js +0 -1
  243. package/dist/gateway/static/root/assets/projects-page-CVMFKpmu.js +0 -1
  244. package/dist/gateway/static/root/assets/remote-access-hub-B74aErBY.js +0 -1
  245. package/dist/gateway/static/root/assets/runtime-tools-settings-panel-Bv-akndY.js +0 -5
  246. package/dist/gateway/static/root/assets/sessions-page-D2wmGNZE.js +0 -1
  247. package/dist/gateway/static/root/assets/settings-advanced-gate-CYCCUMEt.js +0 -1
  248. package/dist/gateway/static/root/assets/shares-settings-rf8f1OGq.js +0 -1
  249. package/dist/gateway/static/root/assets/skill-reload-api-BkvclZ_o.js +0 -1
  250. package/dist/gateway/static/root/assets/skills-page.utils-DGjnz-NG.js +0 -1
  251. package/dist/gateway/static/root/assets/task-detail-page-6a2RdDl2.js +0 -1
  252. package/dist/gateway/static/root/assets/tunnel-api-Chfiba_x.js +0 -1
  253. package/dist/gateway/static/root/assets/user-context-page-SeOHP6XO.js +0 -1
  254. package/dist/gateway/static/root/assets/voice-config-api-BO6A8V3Z.js +0 -1
  255. package/dist/gateway/static/root/assets/work-discovery-overlay-BfwEoOGL.js +0 -1
  256. package/dist/gateway/static/root/assets/workflow-run-setup-panel-X7Z5_lRX.js +0 -3
  257. package/dist/gateway/static/root/assets/workflows-page-BklMzkg8.js +0 -5
@@ -0,0 +1,3 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{a as i,n as a,o,r as s,s as c,t as l}from"./dist-CpzYSoz7.js";import{n as u,r as d}from"./popover-select-C-Hj-nXR.js";import{t as f}from"./eye-CABVeTq0.js";import{t as p}from"./markdown-view-PPCLt7fu.js";import{t as m}from"./x-B_N4OPjy.js";import{t as h}from"./messages-CTSgFlE4.js";import{i as g,r as _}from"./locale-store-CMZljTJx.js";import{t as v}from"./cn-JdwAhgNB.js";import{t as y}from"./button-CtTvuElV.js";import{As as b,Bc as x,Bs as S,Hs as C,Ll as w,Rs as T,Wn as E,Yn as D,ec as O,ir as k,mr as A,pr as j,vs as M}from"./index-B0WJL9N1.js";var N=e(t(),1),P=n();function F(e){if(!e.trim())return null;try{return JSON.parse(e)}catch{return null}}function I(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 L(e,t={}){let n=F(e.split(`
2
+ `).filter(e=>e.startsWith(`data:`)).map(e=>e.slice(5).trimStart()).join(`
3
+ `));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(I(n));return null}async function R(e,t={}){let n=await g(_(`/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=L(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=L(a,{onDelta:e=>{o+=e,t.onDelta?.(e)},onThinkingDelta:e=>{s+=e,t.onThinkingDelta?.(e)}});e!==null&&(o=e)}let c=o.trim();if(!c)throw Error(`AI returned an empty suggestion`);return{text:c,thinking:s.trim()||void 0}}function ee(){let[e,t]=(0,N.useState)(``),[n,r]=(0,N.useState)(``),[i,a]=(0,N.useState)(!1),[o,s]=(0,N.useState)(null);return{suggestion:e,thinking:n,loading:i,error:o,generate:(0,N.useCallback)(async e=>{a(!0),s(null),t(``),r(``);try{let n=await R(e,{onDelta:e=>{t(t=>t+e)},onThinkingDelta:e=>{r(t=>t+e)}});return t(n.text),r(n.thinking??``),n.text}catch(e){return s(e instanceof Error?e.message:`AI suggestion failed`),null}finally{a(!1)}},[]),reset:(0,N.useCallback)(()=>{t(``),r(``),s(null),a(!1)},[])}}var z=r(),te=5;function ne(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 B(e){let t=(0,P.c)(239),{value:n,onApply:r,fieldId:u,fieldLabel:d,scenario:h,format:g,intent:_,locale:b,context:x,disabled:C,className:E,showLabel:D}=e,k=h===void 0?`generic.text`:h,A=g===void 0?`plain`:g,j=_===void 0?`improve`:_,M=D===void 0?!0:D,[F,I]=(0,N.useState)(!1),[L,R]=(0,N.useState)(n),[B,V]=(0,N.useState)(`preview`),[H,U]=(0,N.useState)(``),[W,ae]=(0,N.useState)(`edit`),[G,K]=(0,N.useState)(!0),[oe,se]=(0,N.useState)(!1),[ce,q]=(0,N.useState)(null),le=(0,N.useRef)(null),ue=(0,N.useRef)(!0),{suggestion:de,thinking:J,loading:Y,error:X,generate:fe,reset:pe}=ee(),me;t[0]===b?me=t[1]:(me=ne(b),t[0]=b,t[1]=me);let Z=me,he;t[2]!==Y||t[3]!==J?(he=Y&&J.trim().length>0,t[2]=Y,t[3]=J,t[4]=he):he=t[4];let Q=he,ge,_e;t[5]!==F||t[6]!==n?(ge=()=>{F||R(n)},_e=[F,n],t[5]=F,t[6]=n,t[7]=ge,t[8]=_e):(ge=t[7],_e=t[8]),(0,N.useEffect)(ge,_e);let ve,ye;t[9]===de?(ve=t[10],ye=t[11]):(ye=()=>{U(de)},ve=[de],t[9]=de,t[10]=ve,t[11]=ye),(0,N.useEffect)(ye,ve);let be,xe;t[12]===J?(be=t[13],xe=t[14]):(be=()=>{J.trim()&&K(!0)},xe=[J],t[12]=J,t[13]=be,t[14]=xe),(0,N.useEffect)(be,xe);let Se;t[15]!==Q||t[16]!==G?(Se=()=>{let e=le.current;!e||!Q||!G||ue.current&&(e.scrollTop=e.scrollHeight)},t[15]=Q,t[16]=G,t[17]=Se):Se=t[17];let Ce;t[18]!==Q||t[19]!==J||t[20]!==G?(Ce=[Q,J,G],t[18]=Q,t[19]=J,t[20]=G,t[21]=Ce):Ce=t[21],(0,N.useLayoutEffect)(Se,Ce);let we;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(we=()=>{let e=le.current;e&&(ue.current=e.scrollHeight-e.scrollTop-e.clientHeight<=te)},t[22]=we):we=t[22];let Te=we,Ee;t[23]!==x||t[24]!==u||t[25]!==d||t[26]!==A||t[27]!==fe||t[28]!==j||t[29]!==b||t[30]!==k?(Ee=async e=>{ae(`edit`),K(!0),ue.current=!0,await fe({intent:j,scenario:k,input:e,locale:b,field:{id:u,label:d,format:A},context:x})},t[23]=x,t[24]=u,t[25]=d,t[26]=A,t[27]=fe,t[28]=j,t[29]=b,t[30]=k,t[31]=Ee):Ee=t[31];let De=Ee,Oe;t[32]!==pe||t[33]!==n?(Oe=e=>{se(!!e.currentTarget.closest(`[role="dialog"]`)),q(document.querySelector(`.app-main-surface`)),R(n),V(`preview`),U(``),ae(`edit`),K(!0),pe(),I(!0)},t[32]=pe,t[33]=n,t[34]=Oe):Oe=t[34];let ke=Oe,Ae;t[35]!==L||t[36]!==De?(Ae=async()=>{await De(L)},t[35]=L,t[36]=De,t[37]=Ae):Ae=t[37];let je=Ae,Me;t[38]!==pe||t[39]!==n?(Me=()=>{I(!1),R(n),V(`preview`),U(``),ae(`edit`),K(!0),pe()},t[38]=pe,t[39]=n,t[40]=Me):Me=t[40];let $=Me,Ne;t[41]!==$||t[42]!==L||t[43]!==r?(Ne=()=>{r(L),$()},t[41]=$,t[42]=L,t[43]=r,t[44]=Ne):Ne=t[44];let Pe=Ne,Fe;t[45]!==$||t[46]!==H||t[47]!==r?(Fe=()=>{H.trim()&&(r(H),$())},t[45]=$,t[46]=H,t[47]=r,t[48]=Fe):Fe=t[48];let Ie=Fe,Le;t[49]!==$||t[50]!==L||t[51]!==H||t[52]!==r?(Le=()=>{if(!H.trim())return;let e=L.trimEnd();r(e?`${e}\n\n${H}`:H),$()},t[49]=$,t[50]=L,t[51]=H,t[52]=r,t[53]=Le):Le=t[53];let Re=Le,ze;t[54]!==H||t[55]!==X||t[56]!==Y?(ze=!Y&&!X&&H.trim().length>0,t[54]=H,t[55]=X,t[56]=Y,t[57]=ze):ze=t[57];let Be=ze,Ve=L!==n,He;t[58]!==H||t[59]!==X||t[60]!==J?(He=H.trim().length>0||J.trim().length>0||!!X,t[58]=H,t[59]=X,t[60]=J,t[61]=He):He=t[61];let Ue=He,We=!M&&`size-7 p-0`,Ge;t[62]!==E||t[63]!==We?(Ge=v(`h-7 gap-1 px-2 text-xs`,We,E),t[62]=E,t[63]=We,t[64]=Ge):Ge=t[64];let Ke=C||Y,qe;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(qe=(0,z.jsx)(S,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[65]=qe):qe=t[65];let Je=M?Z.buttonTitle:null,Ye;t[66]!==Z.buttonTitle||t[67]!==ke||t[68]!==Ge||t[69]!==Ke||t[70]!==Je?(Ye=(0,z.jsxs)(y,{type:`button`,variant:`ghost`,className:Ge,title:Z.buttonTitle,"aria-label":Z.buttonTitle,disabled:Ke,onClick:ke,children:[qe,Je]}),t[66]=Z.buttonTitle,t[67]=ke,t[68]=Ge,t[69]=Ke,t[70]=Je,t[71]=Ye):Ye=t[71];let Xe;t[72]===$?Xe=t[73]:(Xe=e=>e?I(!0):$(),t[72]=$,t[73]=Xe);let Ze=ce??void 0,Qe=oe?`bg-transparent`:`bg-scrim`,$e;t[74]===Qe?$e=t[75]:($e=v(`xopc-dialog-overlay absolute inset-0 z-[80]`,Qe),t[74]=Qe,t[75]=$e);let et;t[76]===$e?et=t[77]:(et=(0,z.jsx)(i,{className:$e}),t[76]=$e,t[77]=et);let tt;t[78]===Z.title?tt=t[79]:(tt=(0,z.jsx)(c,{className:`text-base font-semibold text-fg`,children:Z.title}),t[78]=Z.title,t[79]=tt);let nt;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(nt=(0,z.jsx)(m,{className:`size-5`,strokeWidth:1.75}),t[80]=nt):nt=t[80];let rt;t[81]===Z.close?rt=t[82]:(rt=(0,z.jsx)(a,{asChild:!0,children:(0,z.jsx)(y,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":Z.close,children:nt})}),t[81]=Z.close,t[82]=rt);let it;t[83]!==tt||t[84]!==rt?(it=(0,z.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[tt,rt]}),t[83]=tt,t[84]=rt,t[85]=it):it=t[85];let at;t[86]===Z.current?at=t[87]:(at=(0,z.jsx)(`div`,{className:`min-w-0 text-xs font-medium text-fg-muted`,children:Z.current}),t[86]=Z.current,t[87]=at);let ot=B===`edit`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,st;t[88]===ot?st=t[89]:(st=v(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,ot),t[88]=ot,t[89]=st);let ct,lt;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(ct=()=>V(`edit`),lt=(0,z.jsx)(T,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[90]=ct,t[91]=lt):(ct=t[90],lt=t[91]);let ut;t[92]!==Z.edit||t[93]!==st?(ut=(0,z.jsxs)(`button`,{type:`button`,className:st,onClick:ct,children:[lt,Z.edit]}),t[92]=Z.edit,t[93]=st,t[94]=ut):ut=t[94];let dt=B===`preview`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,ft;t[95]===dt?ft=t[96]:(ft=v(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,dt),t[95]=dt,t[96]=ft);let pt,mt;t[97]===Symbol.for(`react.memo_cache_sentinel`)?(pt=()=>V(`preview`),mt=(0,z.jsx)(f,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[97]=pt,t[98]=mt):(pt=t[97],mt=t[98]);let ht;t[99]!==Z.preview||t[100]!==ft?(ht=(0,z.jsxs)(`button`,{type:`button`,className:ft,onClick:pt,children:[mt,Z.preview]}),t[99]=Z.preview,t[100]=ft,t[101]=ht):ht=t[101];let gt;t[102]!==ut||t[103]!==ht?(gt=(0,z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 rounded-lg border border-edge bg-surface-muted p-0.5`,children:[ut,ht]}),t[102]=ut,t[103]=ht,t[104]=gt):gt=t[104];let _t;t[105]!==at||t[106]!==gt?(_t=(0,z.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[at,gt]}),t[105]=at,t[106]=gt,t[107]=_t):_t=t[107];let vt;t[108]!==L||t[109]!==B||t[110]!==A||t[111]!==Z.current||t[112]!==Z.empty?(vt=B===`preview`?(0,z.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:A===`markdown`?(0,z.jsx)(p,{content:L||Z.empty,compact:!0,className:`text-sm`}):(0,z.jsx)(`pre`,{className:`whitespace-pre-wrap text-sm leading-6 text-fg`,children:L||Z.empty})}):(0,z.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:L,onChange:e=>R(e.currentTarget.value),placeholder:Z.empty,"aria-label":Z.current}),t[108]=L,t[109]=B,t[110]=A,t[111]=Z.current,t[112]=Z.empty,t[113]=vt):vt=t[113];let yt;t[114]!==_t||t[115]!==vt?(yt=(0,z.jsxs)(`div`,{className:`flex min-h-0 flex-col overflow-hidden`,children:[_t,vt]}),t[114]=_t,t[115]=vt,t[116]=yt):yt=t[116];let bt;t[117]===Z.editedSuggestion?bt=t[118]:(bt=(0,z.jsx)(`span`,{children:Z.editedSuggestion}),t[117]=Z.editedSuggestion,t[118]=bt);let xt;t[119]!==Z.loading||t[120]!==Y?(xt=Y?(0,z.jsx)(`span`,{className:`ml-2 font-normal`,children:Z.loading}):null,t[119]=Z.loading,t[120]=Y,t[121]=xt):xt=t[121];let St;t[122]!==bt||t[123]!==xt?(St=(0,z.jsxs)(`div`,{className:`min-w-0 text-xs font-medium text-fg-muted`,children:[bt,xt]}),t[122]=bt,t[123]=xt,t[124]=St):St=t[124];let Ct=W===`edit`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,wt;t[125]===Ct?wt=t[126]:(wt=v(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,Ct),t[125]=Ct,t[126]=wt);let Tt,Et;t[127]===Symbol.for(`react.memo_cache_sentinel`)?(Tt=()=>ae(`edit`),Et=(0,z.jsx)(T,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[127]=Tt,t[128]=Et):(Tt=t[127],Et=t[128]);let Dt;t[129]!==Z.edit||t[130]!==wt?(Dt=(0,z.jsxs)(`button`,{type:`button`,className:wt,onClick:Tt,children:[Et,Z.edit]}),t[129]=Z.edit,t[130]=wt,t[131]=Dt):Dt=t[131];let Ot=W===`preview`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,kt;t[132]===Ot?kt=t[133]:(kt=v(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,Ot),t[132]=Ot,t[133]=kt);let At,jt;t[134]===Symbol.for(`react.memo_cache_sentinel`)?(At=()=>ae(`preview`),jt=(0,z.jsx)(f,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[134]=At,t[135]=jt):(At=t[134],jt=t[135]);let Mt;t[136]!==Z.preview||t[137]!==kt?(Mt=(0,z.jsxs)(`button`,{type:`button`,className:kt,onClick:At,children:[jt,Z.preview]}),t[136]=Z.preview,t[137]=kt,t[138]=Mt):Mt=t[138];let Nt;t[139]!==Dt||t[140]!==Mt?(Nt=(0,z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 rounded-lg border border-edge bg-surface-muted p-0.5`,children:[Dt,Mt]}),t[139]=Dt,t[140]=Mt,t[141]=Nt):Nt=t[141];let Pt;t[142]!==St||t[143]!==Nt?(Pt=(0,z.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[St,Nt]}),t[142]=St,t[143]=Nt,t[144]=Pt):Pt=t[144];let Ft=Q?`opacity-100`:`pointer-events-none opacity-0`,It;t[145]===Ft?It=t[146]:(It=v(`absolute inset-0 min-h-0 transition-opacity duration-200 ease-out motion-reduce:transition-none`,Ft),t[145]=Ft,t[146]=It);let Lt=!Q,Rt;t[147]===Symbol.for(`react.memo_cache_sentinel`)?(Rt=()=>K(re),t[147]=Rt):Rt=t[147];let zt;t[148]!==Z.thinkingLoading||t[149]!==Y?(zt=Y?(0,z.jsxs)(`span`,{className:`ml-1 font-normal`,children:[`· `,Z.thinkingLoading]}):null,t[148]=Z.thinkingLoading,t[149]=Y,t[150]=zt):zt=t[150];let Bt;t[151]!==Z.thinking||t[152]!==zt?(Bt=(0,z.jsxs)(`span`,{className:`min-w-0 truncate`,children:[Z.thinking,zt]}),t[151]=Z.thinking,t[152]=zt,t[153]=Bt):Bt=t[153];let Vt=G&&`rotate-180`,Ht;t[154]===Vt?Ht=t[155]:(Ht=v(`size-3.5 shrink-0 transition-transform`,Vt),t[154]=Vt,t[155]=Ht);let Ut;t[156]===Ht?Ut=t[157]:(Ut=(0,z.jsx)(w,{className:Ht,strokeWidth:1.75,"aria-hidden":!0}),t[156]=Ht,t[157]=Ut);let Wt;t[158]!==Bt||t[159]!==Ut?(Wt=(0,z.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:Rt,children:[Bt,Ut]}),t[158]=Bt,t[159]=Ut,t[160]=Wt):Wt=t[160];let Gt;t[161]!==J||t[162]!==G?(Gt=G?(0,z.jsx)(`pre`,{ref:le,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:Te,children:J}):null,t[161]=J,t[162]=G,t[163]=Gt):Gt=t[163];let Kt;t[164]!==Wt||t[165]!==Gt?(Kt=(0,z.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col rounded-lg border border-edge bg-surface-muted/70`,children:[Wt,Gt]}),t[164]=Wt,t[165]=Gt,t[166]=Kt):Kt=t[166];let qt;t[167]!==It||t[168]!==Lt||t[169]!==Kt?(qt=(0,z.jsx)(`div`,{className:It,"aria-hidden":Lt,children:Kt}),t[167]=It,t[168]=Lt,t[169]=Kt,t[170]=qt):qt=t[170];let Jt=Q?`pointer-events-none opacity-0`:`opacity-100`,Yt;t[171]===Jt?Yt=t[172]:(Yt=v(`absolute inset-0 min-h-0 transition-opacity duration-200 ease-out motion-reduce:transition-none`,Jt),t[171]=Jt,t[172]=Yt);let Xt;t[173]!==H||t[174]!==X||t[175]!==A||t[176]!==Z.empty||t[177]!==Z.loading||t[178]!==Z.suggestion||t[179]!==Y||t[180]!==W?(Xt=X?(0,z.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:X}):W===`preview`?(0,z.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:Y&&!H.trim()?(0,z.jsx)(`p`,{className:`text-sm text-fg-muted`,children:Z.loading}):A===`markdown`?(0,z.jsx)(p,{content:H||Z.empty,compact:!0,className:`text-sm`}):(0,z.jsx)(`pre`,{className:`whitespace-pre-wrap text-sm leading-6 text-fg`,children:H||Z.empty})}):(0,z.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:H,onChange:e=>U(e.currentTarget.value),disabled:Y,placeholder:Y?Z.loading:Z.empty,"aria-label":Z.suggestion}),t[173]=H,t[174]=X,t[175]=A,t[176]=Z.empty,t[177]=Z.loading,t[178]=Z.suggestion,t[179]=Y,t[180]=W,t[181]=Xt):Xt=t[181];let Zt;t[182]!==Yt||t[183]!==Xt?(Zt=(0,z.jsx)(`div`,{className:Yt,children:Xt}),t[182]=Yt,t[183]=Xt,t[184]=Zt):Zt=t[184];let Qt;t[185]!==qt||t[186]!==Zt?(Qt=(0,z.jsxs)(`div`,{className:`relative min-h-0 flex-1 overflow-hidden`,children:[qt,Zt]}),t[185]=qt,t[186]=Zt,t[187]=Qt):Qt=t[187];let $t;t[188]!==Pt||t[189]!==Qt?($t=(0,z.jsxs)(`div`,{className:`flex min-h-0 flex-col overflow-hidden`,children:[Pt,Qt]}),t[188]=Pt,t[189]=Qt,t[190]=$t):$t=t[190];let en;t[191]!==yt||t[192]!==$t?(en=(0,z.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-cols-1 gap-3 overflow-hidden p-4 md:grid-cols-2`,children:[yt,$t]}),t[191]=yt,t[192]=$t,t[193]=en):en=t[193];let tn;t[194]!==$||t[195]!==Z.cancel?(tn=(0,z.jsx)(y,{type:`button`,variant:`secondary`,onClick:$,children:Z.cancel}),t[194]=$,t[195]=Z.cancel,t[196]=tn):tn=t[196];let nn=!Ve,rn;t[197]!==Pe||t[198]!==Z.applyCurrent||t[199]!==nn?(rn=(0,z.jsx)(y,{type:`button`,variant:`secondary`,disabled:nn,onClick:Pe,children:Z.applyCurrent}),t[197]=Pe,t[198]=Z.applyCurrent,t[199]=nn,t[200]=rn):rn=t[200];let an;t[201]===je?an=t[202]:(an=()=>void je(),t[201]=je,t[202]=an);let on;t[203]===Ue?on=t[204]:(on=Ue?(0,z.jsx)(O,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}):(0,z.jsx)(S,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[203]=Ue,t[204]=on);let sn=Ue?Z.regenerate:Z.generate,cn;t[205]!==Y||t[206]!==an||t[207]!==on||t[208]!==sn?(cn=(0,z.jsxs)(y,{type:`button`,variant:`secondary`,disabled:Y,onClick:an,children:[on,sn]}),t[205]=Y,t[206]=an,t[207]=on,t[208]=sn,t[209]=cn):cn=t[209];let ln=!Be,un;t[210]!==Re||t[211]!==Z.append||t[212]!==ln?(un=(0,z.jsx)(y,{type:`button`,variant:`secondary`,disabled:ln,onClick:Re,children:Z.append}),t[210]=Re,t[211]=Z.append,t[212]=ln,t[213]=un):un=t[213];let dn=!Be,fn;t[214]!==Ie||t[215]!==Z.replace||t[216]!==dn?(fn=(0,z.jsx)(y,{type:`button`,variant:`primary`,disabled:dn,onClick:Ie,children:Z.replace}),t[214]=Ie,t[215]=Z.replace,t[216]=dn,t[217]=fn):fn=t[217];let pn;t[218]!==fn||t[219]!==tn||t[220]!==rn||t[221]!==cn||t[222]!==un?(pn=(0,z.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-4 py-3`,children:[tn,rn,cn,un,fn]}),t[218]=fn,t[219]=tn,t[220]=rn,t[221]=cn,t[222]=un,t[223]=pn):pn=t[223];let mn;t[224]!==pn||t[225]!==it||t[226]!==en?(mn=(0,z.jsx)(`div`,{className:`absolute inset-0 z-[80] flex items-center justify-center p-4 pointer-events-none`,children:(0,z.jsxs)(s,{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-panel shadow-popover outline-none`,onOpenAutoFocus:ie,children:[it,en,pn]})}),t[224]=pn,t[225]=it,t[226]=en,t[227]=mn):mn=t[227];let hn;t[228]!==mn||t[229]!==Ze||t[230]!==et?(hn=(0,z.jsxs)(o,{container:Ze,children:[et,mn]}),t[228]=mn,t[229]=Ze,t[230]=et,t[231]=hn):hn=t[231];let gn;t[232]!==F||t[233]!==hn||t[234]!==Xe?(gn=(0,z.jsx)(l,{open:F,onOpenChange:Xe,children:hn}),t[232]=F,t[233]=hn,t[234]=Xe,t[235]=gn):gn=t[235];let _n;return t[236]!==gn||t[237]!==Ye?(_n=(0,z.jsxs)(z.Fragment,{children:[Ye,gn]}),t[236]=gn,t[237]=Ye,t[238]=_n):_n=t[238],_n}function re(e){return!e}function ie(e){return e.preventDefault()}function V(e){return!!(e&&e.type===`object`&&e.properties&&!Array.isArray(e.properties))}function H(e){let t=e.properties??{},n=new Set(e.required??[]);return Object.entries(t).map(([e,t])=>({key:e,schema:t,required:n.has(e)}))}function U(e,t){return!V(e)||!e?!0:H(e).every(e=>{if(!e.required)return!0;let n=t[e.key];return n==null?!1:typeof n==`string`?n.trim().length>0:!0})}function W(e,t){if(e)return V(e.inputSchema)?Object.keys(t.schemaInput).length>0?t.schemaInput:void 0:E(t.argValues)}function ae(e,t,n){let r=h(t).workflows;if(!e)return r.noInputSummary;let i=A(e,t);if(V(e.inputSchema)&&Object.keys(n.schemaInput).length>0)return Object.entries(n.schemaInput).map(([e,t])=>`${e}: ${String(t)}`).join(` · `);let a=Object.values(n.argValues).map(e=>e.trim()).filter(Boolean),o=n.goal.trim()||i.description;return o&&a.unshift(o),a.length>0?a.join(` · `):r.noInputSummary}function G(e,t,n=!0){return e?n?V(e.inputSchema)?U(e.inputSchema,t.schemaInput)?{valid:!0}:{valid:!1,reason:`schema-required`}:{valid:(k[e.name]??[]).every(e=>!e.required||!!t.argValues[e.key]?.trim())}:{valid:!1,reason:`raw-json`}:{valid:!1}}function K(e,t){return e[t]??t}function oe(e,t){let n=k[e]??[];if(n.length===0)return{};let r=t&&typeof t==`object`&&!Array.isArray(t)?t:{},i={};for(let e of n){let t=r[e.key];t!=null&&(i[e.key]=String(t))}return i}function se(e){let t=(0,P.c)(12),{examples:n,labels:r,onSelect:i}=e;if(n.length===0)return null;let a;t[0]===r.examplePrompts?a=t[1]:(a=(0,z.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:r.examplePrompts}),t[0]=r.examplePrompts,t[1]=a);let o;if(t[2]!==n||t[3]!==i){let e;t[5]===i?e=t[6]:(e=e=>(0,z.jsx)(`button`,{type:`button`,onClick:()=>i(e),className:`rounded-lg border border-edge bg-surface-base/50 px-3 py-2 text-left text-xs text-fg-muted hover:bg-surface-hover`,children:e.text},`${e.field}:${e.text}`),t[5]=i,t[6]=e),o=n.map(e),t[2]=n,t[3]=i,t[4]=o}else o=t[4];let s;t[7]===o?s=t[8]:(s=(0,z.jsx)(`div`,{className:`mt-2 flex flex-col gap-1.5`,children:o}),t[7]=o,t[8]=s);let c;return t[9]!==a||t[10]!==s?(c=(0,z.jsxs)(`div`,{children:[a,s]}),t[9]=a,t[10]=s,t[11]=c):c=t[11],c}function ce(e){let t=(0,P.c)(34),{workflowName:n,language:r,argValues:i,onArgValuesChange:a,goal:o,onGoalChange:s,examplePrompts:c,showGoal:l,inputClassName:u,aiAssist:d}=e,f;t[0]===c?f=t[1]:(f=c===void 0?[]:c,t[0]=c,t[1]=f);let p=f,m=l===void 0?!0:l,g,_,y,b,x,S,C;if(t[2]!==d||t[3]!==i||t[4]!==p||t[5]!==o||t[6]!==u||t[7]!==r||t[8]!==a||t[9]!==s||t[10]!==m||t[11]!==n){y=h(r).workflows;let e=k[n]??[];_=e.length>0;let c=v(`mt-1.5 w-full rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`,u),l;t[19]!==i||t[20]!==a||t[21]!==s?(l=e=>{j(e,s,e=>{a(e(i))})},t[19]=i,t[20]=a,t[21]=s,t[22]=l):l=t[22],g=l,b=`flex flex-col gap-3`,x=e.map(e=>{let t=K(y.args,e.labelKey),o=K(y.args,e.placeholderKey),s=i[e.key]??``;return(0,z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,z.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[(0,z.jsxs)(`span`,{className:`text-xs font-medium text-fg-muted`,children:[t,e.required?` *`:``]}),e.multiline&&d?(0,z.jsx)(B,{value:s,onApply:t=>a({...i,[e.key]:t}),fieldId:`workflow.arg.${e.key}`,fieldLabel:t,scenario:d.argScenario??`workflow.arg`,locale:r,context:{...d.context,workflowName:n,workflowArgs:i,fieldKey:e.key},disabled:d.disabled,showLabel:!1}):null]}),e.multiline?(0,z.jsx)(`textarea`,{value:s,onChange:t=>a({...i,[e.key]:t.target.value}),placeholder:o,className:v(c,`min-h-20 resize-y`)}):(0,z.jsx)(`input`,{value:s,onChange:t=>a({...i,[e.key]:t.target.value}),placeholder:o,className:c})]},e.key)}),S=_&&p.length>0?(0,z.jsx)(se,{examples:p,labels:y,onSelect:g}):null,C=m?(0,z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,z.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[(0,z.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:y.goalLabel}),d?(0,z.jsx)(B,{value:o,onApply:s,fieldId:`workflow.goal`,fieldLabel:y.goalLabel,scenario:d.goalScenario??`cron.workflowGoal`,locale:r,context:{...d.context,workflowName:n,workflowArgs:i},disabled:d.disabled,showLabel:!1}):null]}),(0,z.jsx)(`textarea`,{value:o,onChange:e=>s(e.target.value),placeholder:y.goalPlaceholder,className:v(c,`min-h-20 resize-y`)})]}):null,t[2]=d,t[3]=i,t[4]=p,t[5]=o,t[6]=u,t[7]=r,t[8]=a,t[9]=s,t[10]=m,t[11]=n,t[12]=g,t[13]=_,t[14]=y,t[15]=b,t[16]=x,t[17]=S,t[18]=C}else g=t[12],_=t[13],y=t[14],b=t[15],x=t[16],S=t[17],C=t[18];let w;t[23]!==g||t[24]!==p||t[25]!==_||t[26]!==y?(w=!_&&p.length>0?(0,z.jsx)(se,{examples:p,labels:y,onSelect:g}):null,t[23]=g,t[24]=p,t[25]=_,t[26]=y,t[27]=w):w=t[27];let T;return t[28]!==b||t[29]!==x||t[30]!==S||t[31]!==C||t[32]!==w?(T=(0,z.jsxs)(`div`,{className:b,children:[x,S,C,w]}),t[28]=b,t[29]=x,t[30]=S,t[31]=C,t[32]=w,t[33]=T):T=t[33],T}var q=`mt-1.5 w-full rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`;function le({schema:e,value:t,onChange:n,labels:r,aiAssist:i,onValidChange:a}){let o=(0,N.useMemo)(()=>H(e),[e]),[s,c]=(0,N.useState)(!1),[l,u]=(0,N.useState)(()=>JSON.stringify(t,null,2)),[d,f]=(0,N.useState)(null);if(o.length===0)return null;let p=(e,r)=>{let i={...t,[e]:r};(r===``||r===void 0)&&delete i[e],n(i),s&&u(JSON.stringify(i,null,2))},m=e=>{u(e);try{let t=e.trim()?JSON.parse(e):{};if(!t||typeof t!=`object`||Array.isArray(t)){f(r.rawJsonInvalid),a?.(!1);return}f(null),n(t),a?.(!0,t)}catch{f(r.rawJsonInvalid),a?.(!1)}};return(0,z.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel/70 p-4 shadow-surface`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,z.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:r.inputSchemaHeading}),(0,z.jsx)(`button`,{type:`button`,className:`text-xs font-medium text-accent-fg hover:underline`,onClick:()=>{let e=!s;c(e),e&&(u(JSON.stringify(t,null,2)),f(null),a?.(!0))},children:r.rawJson})]}),s?(0,z.jsxs)(`div`,{className:`mt-3`,children:[(0,z.jsx)(`textarea`,{value:l,onChange:e=>m(e.target.value),spellCheck:!1,className:v(q,`min-h-40 font-mono text-xs leading-5`)}),d?(0,z.jsx)(`p`,{className:`mt-1 text-xs text-red-600 dark:text-red-300`,children:d}):null]}):(0,z.jsx)(`div`,{className:`mt-3 grid gap-3`,children:o.map(e=>(0,z.jsx)(ue,{field:e,value:t[e.key],labels:r,aiAssist:i,allValues:t,onChange:t=>p(e.key,t)},e.key))})]})}function ue(e){let t=(0,P.c)(30),{field:n,value:r,labels:i,aiAssist:a,allValues:o,onChange:s}=e,c=n.schema.title||n.key,l=typeof n.schema.description==`string`?n.schema.description:void 0,f=Array.isArray(n.schema.type)?n.schema.type[0]:n.schema.type,p;t[0]===n.schema.enum?p=t[1]:(p=Array.isArray(n.schema.enum)?n.schema.enum:[],t[0]=n.schema.enum,t[1]=p);let m=p,h=!!a&&!m.length&&(f===`string`||!f),g=String(c),_=n.required?` *`:``,y;t[2]!==g||t[3]!==_?(y=(0,z.jsxs)(`span`,{className:`text-xs font-medium text-fg`,children:[g,_]}),t[2]=g,t[3]=_,t[4]=y):y=t[4];let b;t[5]!==a||t[6]!==o||t[7]!==n.key||t[8]!==n.schema||t[9]!==s||t[10]!==h||t[11]!==c||t[12]!==r?(b=h&&a?(0,z.jsx)(B,{value:typeof r==`string`?r:r==null?``:String(r),onApply:s,fieldId:`workflow.schema.${n.key}`,fieldLabel:String(c),scenario:a.scenario??`workflow.arg`,locale:a.locale,context:{...a.context,fieldKey:n.key,fieldSchema:n.schema,inputValues:o},disabled:a.disabled,showLabel:!1}):null,t[5]=a,t[6]=o,t[7]=n.key,t[8]=n.schema,t[9]=s,t[10]=h,t[11]=c,t[12]=r,t[13]=b):b=t[13];let x;t[14]!==y||t[15]!==b?(x=(0,z.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[y,b]}),t[14]=y,t[15]=b,t[16]=x):x=t[16];let S;t[17]===l?S=t[18]:(S=l?(0,z.jsx)(`p`,{className:`mt-0.5 text-xs leading-5 text-fg-subtle`,children:l}):null,t[17]=l,t[18]=S);let C;t[19]!==l||t[20]!==m||t[21]!==i||t[22]!==s||t[23]!==f||t[24]!==r?(C=m.length>0?(0,z.jsxs)(u,{value:r==null?``:String(r),onChange:e=>s(e.target.value),className:q,children:[(0,z.jsx)(d,{value:``}),m.map(de)]}):f===`boolean`?(0,z.jsxs)(u,{value:typeof r==`boolean`?String(r):``,onChange:e=>s(e.target.value===``?void 0:e.target.value===`true`),className:q,children:[(0,z.jsx)(d,{value:``}),(0,z.jsx)(d,{value:`true`,children:i.booleanTrue}),(0,z.jsx)(d,{value:`false`,children:i.booleanFalse})]}):f===`number`||f===`integer`?(0,z.jsx)(`input`,{type:`number`,value:typeof r==`number`||typeof r==`string`?String(r):``,onChange:e=>s(e.target.value===``?void 0:Number(e.target.value)),className:q}):(0,z.jsx)(`textarea`,{value:typeof r==`string`?r:r==null?``:String(r),onChange:e=>s(e.target.value),className:v(q,l&&l.length>80?`min-h-20 resize-y`:`min-h-10 resize-y`)}),t[19]=l,t[20]=m,t[21]=i,t[22]=s,t[23]=f,t[24]=r,t[25]=C):C=t[25];let w;return t[26]!==x||t[27]!==S||t[28]!==C?(w=(0,z.jsxs)(`div`,{className:`block`,children:[x,S,C]}),t[26]=x,t[27]=S,t[28]=C,t[29]=w):w=t[29],w}function de(e){return(0,z.jsx)(d,{value:String(e),children:String(e)},String(e))}function J(e){let t=(0,P.c)(12),{examples:n,labels:r,onSelect:i}=e;if(n.length===0)return null;let a;t[0]===r.examplePrompts?a=t[1]:(a=(0,z.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:r.examplePrompts}),t[0]=r.examplePrompts,t[1]=a);let o;if(t[2]!==n||t[3]!==i){let e;t[5]===i?e=t[6]:(e=e=>(0,z.jsx)(`button`,{type:`button`,onClick:()=>i(e),className:`rounded-lg border border-edge bg-surface-base/50 px-3 py-2 text-left text-xs text-fg-muted hover:bg-surface-hover`,children:e.text},`${e.field}:${e.text}`),t[5]=i,t[6]=e),o=n.map(e),t[2]=n,t[3]=i,t[4]=o}else o=t[4];let s;t[7]===o?s=t[8]:(s=(0,z.jsx)(`div`,{className:`mt-2 flex flex-col gap-1.5`,children:o}),t[7]=o,t[8]=s);let c;return t[9]!==a||t[10]!==s?(c=(0,z.jsxs)(`div`,{children:[a,s]}),t[9]=a,t[10]=s,t[11]=c):c=t[11],c}function Y(e){let t=(0,P.c)(114),{definition:n,language:r,value:i,onChange:a,aiAssist:o,inputClassName:s,onValidityChange:c}=e,l;t[0]===r?l=t[1]:(l=h(r),t[0]=r,t[1]=l);let u=l.workflows,d;t[2]!==n||t[3]!==r?(d=A(n,r),t[2]=n,t[3]=r,t[4]=d):d=t[4];let f=d,[p,m]=(0,N.useState)(!0),g;t[5]===f.examplePrompts?g=t[6]:(g=f.examplePrompts??[],t[5]=f.examplePrompts,t[6]=g);let _=g,y;t[7]===n.inputSchema?y=t[8]:(y=V(n.inputSchema),t[7]=n.inputSchema,t[8]=y);let b=y,x,S,C,w,T,E,D,O,k,j;if(t[9]!==o||t[10]!==n||t[11]!==_||t[12]!==b||t[13]!==s||t[14]!==u||t[15]!==r||t[16]!==f.description||t[17]!==a||t[18]!==c||t[19]!==p||t[20]!==i){T=Symbol.for(`react.early_return_sentinel`);bb0:{let e=v(`mt-1.5 w-full rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`,s),l;t[31]!==n||t[32]!==a||t[33]!==c||t[34]!==p?(l=(e,t)=>{let r=t===void 0?p:t;a(e),c?.(G(n,e,r))},t[31]=n,t[32]=a,t[33]=c,t[34]=p,t[35]=l):l=t[35];let d=l,h;t[36]!==d||t[37]!==i?(h=e=>d({...i,goal:e}),t[36]=d,t[37]=i,t[38]=h):h=t[38];let g=h,y;t[39]!==d||t[40]!==i?(y=e=>d({...i,schemaInput:e}),t[39]=d,t[40]=i,t[41]=y):y=t[41];let A=y,M;t[42]!==d||t[43]!==i?(M=e=>d({...i,argValues:e}),t[42]=d,t[43]=i,t[44]=M):M=t[44];let N=M,P;if(t[45]!==g||t[46]!==A||t[47]!==i.schemaInput?(P=e=>{if(e.field===`goal`){g(e.text);return}A({...i.schemaInput,[e.field]:e.text})},t[45]=g,t[46]=A,t[47]=i.schemaInput,t[48]=P):P=t[48],x=P,!b){let e;t[49]!==o||t[50]!==n.id||t[51]!==n.name||t[52]!==n.title||t[53]!==f.description?(e=o?{disabled:o.disabled,argScenario:o.inputScenario??`workflow.arg`,goalScenario:o.goalScenario??`workflow.goal`,context:{...o.context,workflowId:n.id,workflowName:n.name,workflowTitle:n.title,workflowDescription:f.description}}:void 0,t[49]=o,t[50]=n.id,t[51]=n.name,t[52]=n.title,t[53]=f.description,t[54]=e):e=t[54];let a;t[55]!==n.name||t[56]!==_||t[57]!==s||t[58]!==r||t[59]!==N||t[60]!==g||t[61]!==e||t[62]!==i.argValues||t[63]!==i.goal?(a=(0,z.jsx)(ce,{workflowName:n.name,language:r,argValues:i.argValues,onArgValuesChange:N,goal:i.goal,onGoalChange:g,examplePrompts:_,inputClassName:s,aiAssist:e}),t[55]=n.name,t[56]=_,t[57]=s,t[58]=r,t[59]=N,t[60]=g,t[61]=e,t[62]=i.argValues,t[63]=i.goal,t[64]=a):a=t[64],T=a;break bb0}C=`flex flex-col gap-3`,t[65]!==o||t[66]!==n||t[67]!==u.booleanFalse||t[68]!==u.booleanTrue||t[69]!==u.inputSchemaHeading||t[70]!==u.rawJson||t[71]!==u.rawJsonInvalid||t[72]!==r||t[73]!==f.description||t[74]!==c||t[75]!==A||t[76]!==i?(w=n.inputSchema?(0,z.jsx)(le,{schema:n.inputSchema,value:i.schemaInput,onChange:A,onValidChange:(e,t)=>{m(e),c?.(G(n,t?{...i,schemaInput:t}:i,e))},aiAssist:o?{locale:r,disabled:o.disabled,scenario:o.inputScenario??`workflow.arg`,context:{...o.context,workflowId:n.id,workflowName:n.name,workflowTitle:n.title,workflowDescription:f.description}}:void 0,labels:{inputSchemaHeading:u.inputSchemaHeading,rawJson:u.rawJson,rawJsonInvalid:u.rawJsonInvalid,booleanTrue:u.booleanTrue,booleanFalse:u.booleanFalse}}):null,t[65]=o,t[66]=n,t[67]=u.booleanFalse,t[68]=u.booleanTrue,t[69]=u.inputSchemaHeading,t[70]=u.rawJson,t[71]=u.rawJsonInvalid,t[72]=r,t[73]=f.description,t[74]=c,t[75]=A,t[76]=i,t[77]=w):w=t[77],j=`flex flex-col gap-1`;let F;t[78]===u.goalLabel?F=t[79]:(F=(0,z.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:u.goalLabel}),t[78]=u.goalLabel,t[79]=F);let I;t[80]!==o||t[81]!==n.id||t[82]!==n.name||t[83]!==n.title||t[84]!==u.goalLabel||t[85]!==r||t[86]!==f.description||t[87]!==g||t[88]!==i.goal||t[89]!==i.schemaInput?(I=o?(0,z.jsx)(B,{value:i.goal,onApply:g,fieldId:`workflow.goal`,fieldLabel:u.goalLabel,scenario:o.goalScenario??`workflow.goal`,locale:r,context:{...o.context,workflowId:n.id,workflowName:n.name,workflowTitle:n.title,workflowDescription:f.description,workflowInput:i.schemaInput},disabled:o.disabled,showLabel:!1}):null,t[80]=o,t[81]=n.id,t[82]=n.name,t[83]=n.title,t[84]=u.goalLabel,t[85]=r,t[86]=f.description,t[87]=g,t[88]=i.goal,t[89]=i.schemaInput,t[90]=I):I=t[90],t[91]!==F||t[92]!==I?(S=(0,z.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[F,I]}),t[91]=F,t[92]=I,t[93]=S):S=t[93],E=i.goal,t[94]===g?D=t[95]:(D=e=>g(e.target.value),t[94]=g,t[95]=D),O=u.goalPlaceholder,k=v(e,`min-h-20 resize-y`)}t[9]=o,t[10]=n,t[11]=_,t[12]=b,t[13]=s,t[14]=u,t[15]=r,t[16]=f.description,t[17]=a,t[18]=c,t[19]=p,t[20]=i,t[21]=x,t[22]=S,t[23]=C,t[24]=w,t[25]=T,t[26]=E,t[27]=D,t[28]=O,t[29]=k,t[30]=j}else x=t[21],S=t[22],C=t[23],w=t[24],T=t[25],E=t[26],D=t[27],O=t[28],k=t[29],j=t[30];if(T!==Symbol.for(`react.early_return_sentinel`))return T;let M;t[96]!==E||t[97]!==D||t[98]!==O||t[99]!==k?(M=(0,z.jsx)(`textarea`,{value:E,onChange:D,placeholder:O,className:k}),t[96]=E,t[97]=D,t[98]=O,t[99]=k,t[100]=M):M=t[100];let F;t[101]!==S||t[102]!==M||t[103]!==j?(F=(0,z.jsxs)(`div`,{className:j,children:[S,M]}),t[101]=S,t[102]=M,t[103]=j,t[104]=F):F=t[104];let I;t[105]!==x||t[106]!==_||t[107]!==u?(I=(0,z.jsx)(J,{examples:_,labels:u,onSelect:x}),t[105]=x,t[106]=_,t[107]=u,t[108]=I):I=t[108];let L;return t[109]!==C||t[110]!==w||t[111]!==F||t[112]!==I?(L=(0,z.jsxs)(`div`,{className:C,children:[w,F,I]}),t[109]=C,t[110]=w,t[111]=F,t[112]=I,t[113]=L):L=t[113],L}function X(e,t){let n=e.metadata.estimatedAgents;return n?n.min===n.max?D(t.agentScaleExact,{count:n.min}):D(t.agentScaleRange,{min:n.min,max:n.max}):D(t.agentScaleExact,{count:e.defaults.maxSubagents})}function fe(e){let t=(0,P.c)(41),{definition:n,language:r,value:i,onChange:a,mode:o,badgeLabel:s,aiAssist:c,inputClassName:l,showTimeout:u,defaultAdvancedOpen:d,onValidityChange:f}=e,p=u===void 0?!1:u,m=d===void 0?!1:d,g=h(r).workflows,[_,y]=(0,N.useState)(m),S;t[0]!==n||t[1]!==r?(S=A(n,r),t[0]=n,t[1]=r,t[2]=S):S=t[2];let T=S,E;t[3]!==n.defaults||t[4]!==i.concurrency?(E=i.concurrency.trim()?Number(i.concurrency):n.defaults.concurrency,t[3]=n.defaults,t[4]=i.concurrency,t[5]=E):E=t[5];let O=E,k;t[6]!==n.defaults||t[7]!==i.maxSubagents?(k=i.maxSubagents.trim()?Number(i.maxSubagents):n.defaults.maxSubagents,t[6]=n.defaults,t[7]=i.maxSubagents,t[8]=k):k=t[8];let j=k,F;t[9]!==n||t[10]!==r||t[11]!==i?(F=ae(n,r,i),t[9]=n,t[10]=r,t[11]=i,t[12]=F):F=t[12];let I=F,L=s??g.readyToStart,R;t[13]!==a||t[14]!==i?(R=e=>a({...i,...e}),t[13]=a,t[14]=i,t[15]=R):R=t[15];let ee=R,te=o===`automation`&&`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,ne;t[16]===te?ne=t[17]:(ne=v(`space-y-4`,te),t[16]=te,t[17]=ne);let B=I||T.description,re;t[18]===B?re=t[19]:(re=(0,z.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:B}),t[18]=B,t[19]=re);let ie;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,z.jsx)(x,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[20]=ie):ie=t[20];let V;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,z.jsx)(M,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[21]=V):V=t[21];let H;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,z.jsx)(C,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[22]=H):H=t[22];let U;t[23]!==a||t[24]!==i?(U=e=>a({...i,...e}),t[23]=a,t[24]=i,t[25]=U):U=t[25];let W;t[26]===f?W=t[27]:(W=e=>{f?.(e)},t[26]=f,t[27]=W);let G;t[28]!==c||t[29]!==n||t[30]!==l||t[31]!==r||t[32]!==U||t[33]!==W||t[34]!==i?(G=(0,z.jsx)(Y,{definition:n,language:r,value:i,onChange:U,onValidityChange:W,aiAssist:c,inputClassName:l}),t[28]=c,t[29]=n,t[30]=l,t[31]=r,t[32]=U,t[33]=W,t[34]=i,t[35]=G):G=t[35];let K;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(K=()=>y(pe),t[36]=K):K=t[36];let oe=g.advancedSettings,se=_&&`rotate-180`,ce;t[37]===se?ce=t[38]:(ce=v(`size-4 transition-transform`,se),t[37]=se,t[38]=ce);let q;return t[39]===ce?q=t[40]:(q=(0,z.jsx)(w,{className:ce}),t[39]=ce,t[40]=q),(0,z.jsxs)(`div`,{className:ne,children:[(0,z.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:g.runPlanPreview}),re]}),(0,z.jsx)(`span`,{className:`shrink-0 rounded-full bg-accent-soft px-2 py-1 text-[11px] font-medium text-accent-fg`,children:L})]}),(0,z.jsxs)(`div`,{className:`mt-4 grid gap-2 text-xs text-fg-muted sm:grid-cols-3`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl bg-surface-panel px-2.5 py-2`,children:[ie,(0,z.jsx)(`span`,{children:D(g.phaseCount,{count:n.phases.length})})]}),(0,z.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl bg-surface-panel px-2.5 py-2`,children:[V,(0,z.jsx)(`span`,{children:X(n,g)})]}),(0,z.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl bg-surface-panel px-2.5 py-2`,children:[H,(0,z.jsx)(`span`,{children:D(g.runLimitsSummary,{concurrency:O,max:j})})]})]}),n.phases.length>0?(0,z.jsxs)(`div`,{className:`mt-4`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-medium uppercase tracking-wide text-fg-subtle`,children:[(0,z.jsx)(b,{className:`size-3.5`,"aria-hidden":!0}),g.startPlanPhases]}),(0,z.jsx)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5`,children:n.phases.map(me)})]}):null]}),G,(0,z.jsxs)(`div`,{className:`rounded-xl border border-edge`,children:[(0,z.jsxs)(`button`,{type:`button`,className:`flex w-full items-center justify-between px-3 py-2.5 text-left text-sm text-fg`,onClick:K,children:[oe,q]}),_?(0,z.jsxs)(`div`,{className:`grid gap-3 border-t border-edge px-3 pb-3 pt-3 sm:grid-cols-2`,children:[(0,z.jsx)(`input`,{value:i.concurrency,onChange:e=>ee({concurrency:e.target.value}),placeholder:D(g.concurrencyPlaceholder,{default:n.defaults.concurrency}),inputMode:`numeric`,className:`rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`}),(0,z.jsx)(`input`,{value:i.maxSubagents,onChange:e=>ee({maxSubagents:e.target.value}),placeholder:D(g.maxSubagentsPlaceholder,{default:n.defaults.maxSubagents}),inputMode:`numeric`,className:`rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`}),p?(0,z.jsx)(`input`,{value:i.timeoutSeconds??``,onChange:e=>ee({timeoutSeconds:e.target.value}),placeholder:D(g.timeoutSecondsPlaceholder,{default:n.defaults.timeoutSec}),inputMode:`numeric`,className:`rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`}):null]}):null]})]})}function pe(e){return!e}function me(e,t){return(0,z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[t>0?(0,z.jsx)(`span`,{className:`text-fg-subtle`,children:`→`}):null,(0,z.jsx)(`span`,{className:`rounded-lg border border-edge-subtle bg-surface-panel px-2 py-1 text-[11px] text-fg-muted`,children:e.title})]},e.id)}export{B as a,G as i,oe as n,W as r,fe as t};
@@ -0,0 +1,5 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{d as i,l as a,p as o,t as s}from"./chunk-KS7C4IRE-BaASWQor.js";import{a as c,c as l,i as u,n as d,o as f,r as p,s as m,t as h}from"./dist-CpzYSoz7.js";import{t as g}from"./check-DUBLcKHA.js";import{n as _,r as v,t as y}from"./popover-select-C-Hj-nXR.js";import{t as b}from"./copy-Dv6d4Dvw.js";import{t as x}from"./download-Dk-ZjtO6.js";import{t as S}from"./ellipsis-0k4rZLoy.js";import{t as C}from"./markdown-view-PPCLt7fu.js";import{t as w}from"./pencil-DmIY3Oa-.js";import{t as T}from"./plus-Q2yW6OE7.js";import{t as E}from"./search-DA7gz22f.js";import{t as D}from"./x-B_N4OPjy.js";import{t as O}from"./copy-to-clipboard-HOJ79TWv.js";import{t as k}from"./messages-CTSgFlE4.js";import{n as A,s as j}from"./locale-store-CMZljTJx.js";import{t as M}from"./cn-JdwAhgNB.js";import{i as N}from"./vendor-swr-BIWyz7Rc.js";import{t as P}from"./button-CtTvuElV.js";import{n as F}from"./interaction-BmQogeqz.js";import{t as I}from"./skeleton-BwbyijEw.js";import{$n as L,$s as R,Bc as z,Bs as B,C as V,Cr as H,D as U,Dl as ee,E as W,Es as G,Fl as K,Gl as te,Gn as ne,Ic as re,Jn as q,Kn as J,Ll as ie,O as ae,Oc as oe,Pc as se,Qn as ce,Qs as le,Rc as ue,S as de,Sc as fe,Si as pe,Sr as me,T as he,Ti as ge,Ts as _e,Ul as Y,Un as ve,Wc as ye,Wt as be,Xn as xe,Yc as Se,Yn as X,Zn as Ce,_ as we,_r as Te,al as Ee,ar as De,b as Oe,bn as ke,br as Ae,cc as je,cr as Me,d as Ne,dr as Pe,er as Fe,eu as Ie,f as Le,fr as Re,g as ze,gl as Be,gr as Ve,h as He,hs as Ue,i as We,k as Ge,ll as Ke,lr as qe,m as Je,mr as Ye,ni as Xe,nr as Ze,oa as Qe,or as $e,p as et,ql as tt,qn as nt,qt as rt,rr as it,sr as at,tl as ot,tr as st,u as ct,ur as lt,v as ut,vs as dt,w as ft,x as pt,xr as mt,y as ht,yr as gt}from"./index-B0WJL9N1.js";import{t as _t}from"./page-tabs-BaEQMYm_.js";import{n as vt,t as yt}from"./tab-completion-input-D64VNmiA.js";import{a as bt,c as xt,i as St,l as Ct,n as wt,o as Tt,r as Et,s as Dt,t as Ot}from"./style-TIDOdKy0.js";import{i as kt,r as At,t as jt}from"./workflow-run-setup-panel-C0layUE9.js";import{t as Mt}from"./tab-completion-input.utils-BP3NH_du.js";var Z=e(t(),1),Q=n(),Nt=[`queued`,`running`,`succeeded`,`attention`],Pt=new Set([`failed`,`timeout`,`cancelled`]);function Ft(e){return e.metadata?.sessionKey?.trim()||null}function It(e,t){return e.length<=t?e:`${e.slice(0,t-1)}…`}function Lt(e,t){if(!e||typeof e!=`object`)return null;let n=e;for(let e of t){let t=n[e];if(typeof t==`string`&&t.trim())return t.trim()}return null}function Rt(e,t=90){let n=e.metadata?.input?.goal?.trim()||(typeof e.metadata?.input?.payload==`string`?e.metadata.input.payload.trim():null)||Lt(e.metadata?.input?.payload,[`query`,`goal`,`prompt`,`input`,`message`])||Lt(e.metadata?.input?.variables,[`query`,`goal`,`prompt`,`input`,`message`]);return n?It(n,t):null}function zt(e,t=90){return Rt(e,t)??It(e.title?.trim()||e.definitionId,t)}function Bt(e,t=44){return It(e.title?.trim()||e.definitionId,t)}function Vt(e,t){let n=t.trim().toLowerCase();return n?[Rt(e,500),e.title,e.definitionId,e.id].filter(Boolean).join(` `).toLowerCase().includes(n):!0}function Ht(e,t){let n=t.workflowFilterId.trim();return e.filter(e=>n&&e.definitionId!==n||!ce(e,t.triggerFilter??`all`)?!1:Vt(e,t.searchQuery))}function Ut(e){return e.completedAtMs??e.createdAtMs}function Wt(e,t){return e.status===`queued`?`queued`:e.status===`running`?`running`:e.status===`succeeded`?`succeeded`:Pt.has(e.status)?`attention`:null}function Gt(e,t){let n=[...t];return e===`queued`?n.sort((e,t)=>e.createdAtMs-t.createdAtMs):e===`running`?n.sort((e,t)=>(t.startedAtMs??t.createdAtMs)-(e.startedAtMs??e.createdAtMs)):n.sort((e,t)=>Ut(t)-Ut(e))}function Kt(e,t){let n={queued:[],running:[],succeeded:[],attention:[]};for(let r of e){let e=Wt(r,t);e&&n[e].push(r)}return Nt.map(e=>{if(e===`succeeded`){let t=Gt(`succeeded`,n.succeeded);return{id:e,runs:t,totalInWindow:t.length}}return{id:e,runs:Gt(e,n[e])}})}function qt(e,t,n){let r=Math.round((t-e)/1e3);if(r<60)return Te(-r,`second`,n);let i=Math.round(r/60);if(i<60)return Te(-i,`minute`,n);let a=Math.round(i/60);return a<48?Te(-a,`hour`,n):Te(-Math.round(a/24),`day`,n)}function Jt(e){return e.status===`queued`||e.status===`running`}function Yt(e){return e.status===`failed`||e.status===`timeout`||e.status===`cancelled`}var $=r(),Xt=(0,Z.memo)(function(e){let t=(0,Q.c)(76),{run:n,language:r,localeTag:i,nowMs:a,selected:o,onOpen:s,onOpenChat:c,onCancel:l,onRetry:u}=e,d=k(r).workflows,[f,p]=(0,Z.useState)(!1),m;t[0]===n?m=t[1]:(m=Ft(n),t[0]=n,t[1]=m);let h=!m,g;t[2]===n?g=t[3]:(g=Jt(n),t[2]=n,t[3]=g);let _=g,v=n.status===`running`||n.status===`queued`,y;t[4]!==n.metrics.agentCount||t[5]!==n.metrics.doneAgentCount?(y=n.metrics.agentCount>0?Math.round(n.metrics.doneAgentCount/n.metrics.agentCount*100):0,t[4]=n.metrics.agentCount,t[5]=n.metrics.doneAgentCount,t[6]=y):y=t[6];let b=y,x=n.metrics.errorAgentCount>0,C=n.startedAtMs??n.createdAtMs,w=nt(_?a-C:n.metrics.durationMs),T=X(d.taskArtifacts,{count:n.metrics.artifactCount}),E;t[7]===n?E=t[8]:(E=zt(n),t[7]=n,t[8]=E);let D=E,O;t[9]===n?O=t[10]:(O=Bt(n),t[9]=n,t[10]=O);let A=O,j;t[11]!==s||t[12]!==n?(j=()=>{s(n)},t[11]=s,t[12]=n,t[13]=j):j=t[13];let N=j,I;t[14]!==h||t[15]!==c||t[16]!==n?(I=()=>{h||c(n)},t[14]=h,t[15]=c,t[16]=n,t[17]=I):I=t[17];let R=I,z=o&&`ring-1 ring-accent/30`,B;t[18]===z?B=t[19]:(B=M(`group relative min-h-24 overflow-hidden rounded-lg bg-surface-panel p-3 shadow-surface transition-colors`,z,`hover:bg-surface-hover`),t[18]=z,t[19]=B);let V;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(V=M(`w-full text-left`,F.focusRingPanel),t[20]=V):V=t[20];let H;t[21]===D?H=t[22]:(H=(0,$.jsx)(`div`,{className:`line-clamp-2 text-sm font-medium leading-5 text-fg`,children:D}),t[21]=D,t[22]=H);let U;t[23]===A?U=t[24]:(U=(0,$.jsx)(`div`,{className:`mt-1 truncate text-[11px] font-medium text-fg-muted`,children:A}),t[23]=A,t[24]=U);let ee;t[25]!==H||t[26]!==U?(ee=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[H,U]}),t[25]=H,t[26]=U,t[27]=ee):ee=t[27];let W;t[28]===n.status?W=t[29]:(W=M(`shrink-0 rounded-full px-2 py-0.5 text-[10px] font-semibold shadow-sm`,L(n.status)),t[28]=n.status,t[29]=W);let G;t[30]!==i||t[31]!==a||t[32]!==C?(G=qt(C,a,i),t[30]=i,t[31]=a,t[32]=C,t[33]=G):G=t[33];let K;t[34]===G?K=t[35]:(K=(0,$.jsx)(`span`,{children:G}),t[34]=G,t[35]=K);let te=w===`—`?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,$.jsx)(`span`,{children:X(d.taskElapsed,{duration:w})})]}),ne;t[36]!==K||t[37]!==te?(ne=(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5 text-[11px] text-fg-subtle`,children:[K,te]}),t[36]=K,t[37]=te,t[38]=ne):ne=t[38];let re=n.metrics.artifactCount>0?(0,$.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 font-medium text-fg-muted`,children:T}):null,q=o?(0,$.jsx)(`span`,{className:`font-medium text-accent-fg`,children:d.taskOpenDetails}):null,J;t[39]!==re||t[40]!==q?(J=(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2 text-[11px] text-fg-subtle`,children:[re,q]}),t[39]=re,t[40]=q,t[41]=J):J=t[41];let ie=h&&`cursor-not-allowed text-fg-disabled hover:bg-transparent`,ae;t[42]===ie?ae=t[43]:(ae=M(`rounded-md px-2 py-1 text-xs font-medium`,`text-accent-fg hover:bg-accent-soft`,F.focusRingPanel,ie),t[42]=ie,t[43]=ae);let oe;t[44]!==h||t[45]!==R||t[46]!==d.continueInChat||t[47]!==ae?(oe=(0,$.jsx)(`button`,{type:`button`,className:ae,disabled:h,onClick:R,children:d.continueInChat}),t[44]=h,t[45]=R,t[46]=d.continueInChat,t[47]=ae,t[48]=oe):oe=t[48];let se;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(se=M(`rounded-md px-2 py-1 text-xs font-medium text-fg-muted hover:bg-surface-hover hover:text-fg`,F.focusRingPanel),t[49]=se):se=t[49];let ce;t[50]!==N||t[51]!==d.taskOpenDetails?(ce=(0,$.jsx)(`button`,{type:`button`,className:se,onClick:N,children:d.taskOpenDetails}),t[50]=N,t[51]=d.taskOpenDetails,t[52]=ce):ce=t[52];let le;t[53]!==oe||t[54]!==ce?(le=(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2 border-t border-edge-subtle pt-2`,children:[oe,ce]}),t[53]=oe,t[54]=ce,t[55]=le):le=t[55];let ue;t[56]===p?ue=t[57]:(ue=()=>p(Qt),t[56]=p,t[57]=ue);let de;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,$.jsx)(S,{className:`size-4`,"aria-hidden":!0}),t[58]=de):de=t[58];let fe;t[59]!==d.taskActionsAria||t[60]!==f||t[61]!==ue?(fe=(0,$.jsx)(P,{variant:`ghost`,className:`size-7 p-0 opacity-0 group-hover:opacity-100 group-focus-within:opacity-100`,"aria-label":d.taskActionsAria,"aria-expanded":f,onClick:ue,children:de}),t[59]=d.taskActionsAria,t[60]=f,t[61]=ue,t[62]=fe):fe=t[62];let pe;t[63]!==_||t[64]!==d.cancel||t[65]!==d.rerun||t[66]!==d.taskCloseMenu||t[67]!==f||t[68]!==l||t[69]!==u||t[70]!==n||t[71]!==p?(pe=f?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`button`,{type:`button`,className:`fixed inset-0 z-10 cursor-default`,"aria-label":d.taskCloseMenu,onClick:()=>p(!1)}),(0,$.jsxs)(`div`,{className:`absolute right-0 z-20 mt-1 min-w-36 rounded-lg border border-edge bg-surface-panel py-1 shadow-surface`,children:[_?(0,$.jsx)(Zt,{label:d.cancel,tone:`danger`,onClick:()=>{p(!1),l(n.id)}}):null,Yt(n)?(0,$.jsx)(Zt,{label:d.rerun,onClick:()=>{p(!1),u(n.id)}}):null]})]}):null,t[63]=_,t[64]=d.cancel,t[65]=d.rerun,t[66]=d.taskCloseMenu,t[67]=f,t[68]=l,t[69]=u,t[70]=n,t[71]=p,t[72]=pe):pe=t[72];let me;return t[73]!==fe||t[74]!==pe?(me=(0,$.jsxs)(`div`,{className:`absolute right-2 top-2`,children:[fe,pe]}),t[73]=fe,t[74]=pe,t[75]=me):me=t[75],(0,$.jsxs)(`div`,{className:B,children:[(0,$.jsxs)(`button`,{type:`button`,onClick:N,"aria-label":`${d.taskOpenDetails}: ${D}`,"aria-current":o?`true`:void 0,className:V,children:[(0,$.jsxs)(`div`,{className:`pr-7`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-2`,children:[ee,(0,$.jsx)(`span`,{className:W,children:d.status[n.status]??n.status})]}),ne]}),v?(0,$.jsxs)(`div`,{className:`mt-2.5`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2 text-[11px] text-fg-muted`,children:[(0,$.jsx)(`span`,{children:X(d.agentProgress,{done:n.metrics.doneAgentCount,total:n.metrics.agentCount})}),(0,$.jsxs)(`span`,{children:[b,`%`]})]}),(0,$.jsx)(`div`,{className:`mt-1.5 h-1.5 overflow-hidden rounded-full bg-surface-hover`,children:(0,$.jsx)(`div`,{className:`h-full rounded-full bg-accent transition-all`,style:{width:`${b}%`}})})]}):null,J,x?(0,$.jsxs)(`div`,{className:`mt-2 flex items-center gap-1 text-[11px] text-amber-700 dark:text-amber-300`,children:[(0,$.jsx)(_e,{className:`size-3 shrink-0`,"aria-hidden":!0}),X(d.runRowErrorSummary,{count:n.metrics.errorAgentCount})]}):null]}),le,me]})});function Zt(e){let t=(0,Q.c)(8),{label:n,disabled:r,tone:i,onClick:a}=e,o=r?`cursor-not-allowed text-fg-subtle`:`text-fg hover:bg-surface-hover`,s=i===`danger`&&!r&&`text-red-600 dark:text-red-300`,c;t[0]!==o||t[1]!==s?(c=M(`block w-full px-3 py-1.5 text-left text-xs`,o,s),t[0]=o,t[1]=s,t[2]=c):c=t[2];let l;return t[3]!==r||t[4]!==n||t[5]!==a||t[6]!==c?(l=(0,$.jsx)(`button`,{type:`button`,disabled:r,onClick:a,className:c,children:n}),t[3]=r,t[4]=n,t[5]=a,t[6]=c,t[7]=l):l=t[7],l}function Qt(e){return!e}function $t(e,t){return t.boardColumns[e]}var en=(0,Z.memo)(function(e){let t=(0,Q.c)(17),{column:n,language:r,localeTag:i,nowMs:a,selectedRunId:o,loading:s,onOpenRun:c,onOpenRunChat:l,onCancelRun:u,onRetryRun:d}=e,f=k(r).workflows,[p,m]=(0,Z.useState)(!1),h=n.id===`succeeded`,g=h?5:n.runs.length,_;t[0]!==g||t[1]!==n.runs||t[2]!==p||t[3]!==h?(_=h&&!p?n.runs.slice(0,g):n.runs,t[0]=g,t[1]=n.runs,t[2]=p,t[3]=h,t[4]=_):_=t[4];let v=_,y=h&&n.runs.length>5&&!p,b=h&&p,x;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(x=M(`flex max-h-full w-72 min-w-72 max-w-72 shrink-0 flex-col overflow-y-auto rounded-lg bg-surface-base shadow-surface`),t[5]=x):x=t[5];let C;t[6]===n.runs.length?C=t[7]:(C=(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:n.runs.length}),t[6]=n.runs.length,t[7]=C);let w;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,$.jsx)(S,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[8]=w):w=t[8];let T=s&&v.length===0?(0,$.jsx)(tn,{}):v.length===0?(0,$.jsx)(`div`,{className:`rounded-lg bg-surface-panel/70 px-3 py-6 text-center text-xs text-fg-subtle`,children:f.boardColumnEmpty}):v.map(e=>(0,$.jsx)(Xt,{run:e,language:r,localeTag:i,nowMs:a,selected:e.id===o,onOpen:c,onOpenChat:l,onCancel:u,onRetry:d},e.id)),E=y?(0,$.jsx)(P,{variant:`ghost`,className:`h-8 w-full text-xs`,onClick:()=>m(!0),children:X(f.boardExpandSucceeded,{count:Math.min(n.runs.length,n.totalInWindow??n.runs.length)})}):null,D;t[9]!==b||t[10]!==f||t[11]!==m?(D=b?(0,$.jsx)(P,{variant:`ghost`,className:`h-8 w-full text-xs`,onClick:()=>m(!1),children:f.boardCollapseSucceeded}):null,t[9]=b,t[10]=f,t[11]=m,t[12]=D):D=t[12];let O;return t[13]!==T||t[14]!==E||t[15]!==D?(O=(0,$.jsxs)(`div`,{className:`mx-2 mt-3 grid min-h-0 min-w-0 content-start gap-2 pb-2 pr-1 [scrollbar-gutter:stable]`,children:[T,E,D]}),t[13]=T,t[14]=E,t[15]=D,t[16]=O):O=t[16],(0,$.jsxs)(`section`,{className:x,"aria-label":$t(n.id,f),children:[(0,$.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-2 p-3`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,$.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:$t(n.id,f)}),C]}),w]}),O]})});function tn(){let e=(0,Q.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`article`,{className:`min-h-24 rounded-lg bg-surface-panel p-3 shadow-surface`,"aria-hidden":`true`,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(I,{className:`size-4/5`}),(0,$.jsx)(I,{className:`mt-2 h-3 w-24`})]}),(0,$.jsx)(I,{className:`h-5 w-14 rounded-full`})]}),(0,$.jsx)(I,{className:`mt-3 h-3 w-2/3`}),(0,$.jsx)(I,{className:`mt-4 h-5 w-20 rounded-full`})]}),e[0]=t):t=e[0],t}function nn(e){return e instanceof Element?!!e.closest(`a,button,input,select,textarea,[contenteditable="true"],[draggable="true"],[data-board-pan-skip="true"]`):!0}var rn=(0,Z.memo)(function(e){let t=(0,Q.c)(54),{runs:n,language:r,localeTag:i,labels:a,searchQuery:o,workflowFilterId:s,triggerFilter:c,selectedRunId:l,loading:u,onOpenRun:d,onOpenRunChat:f,onCancelRun:p,onRetryRun:m,onStart:h}=e,g;t[0]===n?g=t[1]:(g=n.some(an),t[0]=n,t[1]=g);let _=g,v=(0,Z.useRef)(null),y=(0,Z.useRef)(null),[b,x]=(0,Z.useState)(on),[S,C]=(0,Z.useState)(!1),w,T;t[2]===_?(w=t[3],T=t[4]):(w=()=>{if(!_)return;let e=window.setInterval(()=>x(Date.now()),1e3);return()=>window.clearInterval(e)},T=[_],t[2]=_,t[3]=w,t[4]=T),(0,Z.useEffect)(w,T);let E;t[5]!==b||t[6]!==n||t[7]!==o||t[8]!==c||t[9]!==s?(E=Kt(Ht(n,{searchQuery:o,workflowFilterId:s,triggerFilter:c}),b),t[5]=b,t[6]=n,t[7]=o,t[8]=c,t[9]=s,t[10]=E):E=t[10];let D=E,O=D.reduce(sn,0),k;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(k=e=>{let t=y.current;!t||t.pointerId!==e.pointerId||(y.current=null,C(!1),e.currentTarget.hasPointerCapture?.(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))},t[11]=k):k=t[11];let A=k,j;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(j=e=>{if(e.button!==0||nn(e.target))return;let t=v.current;t&&(y.current={pointerId:e.pointerId,startX:e.clientX,scrollLeft:t.scrollLeft,active:!1},e.currentTarget.setPointerCapture(e.pointerId))},t[12]=j):j=t[12];let M=j,N;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(N=e=>{let t=y.current,n=v.current;if(!t||!n||t.pointerId!==e.pointerId)return;let r=e.clientX-t.startX;!t.active&&Math.abs(r)<5||(t.active||(t.active=!0,C(!0)),e.preventDefault(),n.scrollLeft=t.scrollLeft-r)},t[13]=N):N=t[13];let F=N;if(!u&&O===0){let e;t[14]===a.boardEmptyTitle?e=t[15]:(e=(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:a.boardEmptyTitle}),t[14]=a.boardEmptyTitle,t[15]=e);let n;t[16]===a.boardEmptyHint?n=t[17]:(n=(0,$.jsx)(`p`,{className:`mx-auto mt-2 max-w-md text-sm leading-6 text-fg-muted`,children:a.boardEmptyHint}),t[16]=a.boardEmptyHint,t[17]=n);let r;t[18]!==a.boardStart||t[19]!==h?(r=(0,$.jsx)(`div`,{className:`mt-4 flex justify-center`,children:(0,$.jsx)(P,{variant:`primary`,onClick:h,children:a.boardStart})}),t[18]=a.boardStart,t[19]=h,t[20]=r):r=t[20];let i;return t[21]!==r||t[22]!==e||t[23]!==n?(i=(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col items-center justify-center rounded-2xl border border-dashed border-edge bg-surface-panel/40 px-6 py-12 text-center`,children:[e,n,r]}),t[21]=r,t[22]=e,t[23]=n,t[24]=i):i=t[24],i}let I=S?`cursor-grabbing select-none`:`cursor-grab`,L;t[25]===I?L=t[26]:(L=[`min-h-0 h-full min-w-0 overflow-x-auto rounded-lg p-2`,I],t[25]=I,t[26]=L);let R=L.join(` `),z;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(z=e=>{y.current?.pointerId===e.pointerId&&(y.current=null,C(!1))},t[27]=z):z=t[27];let B;if(t[28]!==D||t[29]!==r||t[30]!==u||t[31]!==i||t[32]!==b||t[33]!==p||t[34]!==d||t[35]!==f||t[36]!==m||t[37]!==l){let e;t[39]!==r||t[40]!==u||t[41]!==i||t[42]!==b||t[43]!==p||t[44]!==d||t[45]!==f||t[46]!==m||t[47]!==l?(e=e=>(0,$.jsx)(en,{column:e,language:r,localeTag:i,nowMs:b,selectedRunId:l,loading:u,onOpenRun:d,onOpenRunChat:f,onCancelRun:p,onRetryRun:m},e.id),t[39]=r,t[40]=u,t[41]=i,t[42]=b,t[43]=p,t[44]=d,t[45]=f,t[46]=m,t[47]=l,t[48]=e):e=t[48],B=D.map(e),t[28]=D,t[29]=r,t[30]=u,t[31]=i,t[32]=b,t[33]=p,t[34]=d,t[35]=f,t[36]=m,t[37]=l,t[38]=B}else B=t[38];let V;t[49]===B?V=t[50]:(V=(0,$.jsx)(`div`,{className:`flex min-h-full min-w-max items-start gap-3 pr-4`,children:B}),t[49]=B,t[50]=V);let H;return t[51]!==R||t[52]!==V?(H=(0,$.jsx)(`div`,{ref:v,className:R,onPointerDown:M,onPointerMove:F,onPointerUp:A,onPointerCancel:A,onLostPointerCapture:z,children:V}),t[51]=R,t[52]=V,t[53]=H):H=t[53],H});function an(e){return e.status===`queued`||e.status===`running`}function on(){return Date.now()}function sn(e,t){return e+t.runs.length}function cn(e,t){let n=e.metadata.estimatedAgents;return n?n.min===n.max?X(t.agentScaleExact,{count:n.min}):X(t.agentScaleRange,{min:n.min,max:n.max}):null}function ln(e){let t=(0,Q.c)(77),{definition:n,language:r,labels:i,onPick:a,onDetail:o,onEdit:s,savedForProject:c}=e,l;t[0]!==n||t[1]!==r?(l=Ye(n,r),t[0]=n,t[1]=r,t[2]=l):l=t[2];let u=l,d;t[3]!==n||t[4]!==i?(d=cn(n,i),t[3]=n,t[4]=i,t[5]=d):d=t[5];let f=d,p=n.metadata.source===`user`,m=p?`bg-accent-soft text-accent-fg`:`bg-surface-muted text-fg-muted`,h;t[6]===m?h=t[7]:(h=M(`rounded-full px-2 py-0.5 text-[10px] font-medium`,m),t[6]=m,t[7]=h);let g=p?i.badgeUser:i.badgeBuiltin,_;t[8]!==h||t[9]!==g?(_=(0,$.jsx)(`span`,{className:h,children:g}),t[8]=h,t[9]=g,t[10]=_):_=t[10];let v;t[11]!==n.inputSchema||t[12]!==i.inputSchemaBadge?(v=n.inputSchema?(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-surface-muted px-2 py-0.5 text-[10px] text-fg-subtle`,children:[(0,$.jsx)(Y,{className:`size-2.5`,"aria-hidden":!0}),i.inputSchemaBadge]}):null,t[11]=n.inputSchema,t[12]=i.inputSchemaBadge,t[13]=v):v=t[13];let y;t[14]!==i.projectWorkflowBadge||t[15]!==c?(y=c?(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-success-soft px-2 py-0.5 text-[10px] text-success`,children:[(0,$.jsx)(tt,{className:`size-2.5`,"aria-hidden":!0}),i.projectWorkflowBadge]}):null,t[14]=i.projectWorkflowBadge,t[15]=c,t[16]=y):y=t[16];let b;t[17]!==_||t[18]!==v||t[19]!==y?(b=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[_,v,y]}),t[17]=_,t[18]=v,t[19]=y,t[20]=b):b=t[20];let x;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(x=M(`mt-2 line-clamp-2 text-left text-sm font-semibold leading-5 text-fg hover:text-accent-fg`,F.focusRingPanel),t[21]=x):x=t[21];let S;t[22]!==n||t[23]!==o?(S=()=>o(n),t[22]=n,t[23]=o,t[24]=S):S=t[24];let C;t[25]!==n.title||t[26]!==S?(C=(0,$.jsx)(`button`,{type:`button`,className:x,onClick:S,children:n.title}),t[25]=n.title,t[26]=S,t[27]=C):C=t[27];let T;t[28]!==C||t[29]!==b?(T=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[b,C]}),t[28]=C,t[29]=b,t[30]=T):T=t[30];let E=`${p?i.editWorkflow:i.copyAndEditWorkflow}: ${n.title}`,D;t[31]!==n||t[32]!==s?(D=()=>s(n),t[31]=n,t[32]=s,t[33]=D):D=t[33];let O;t[34]===p?O=t[35]:(O=p?(0,$.jsx)(w,{className:`size-3.5`,"aria-hidden":!0}):(0,$.jsx)(Be,{className:`size-3.5`,"aria-hidden":!0}),t[34]=p,t[35]=O);let k;t[36]!==E||t[37]!==D||t[38]!==O?(k=(0,$.jsx)(P,{type:`button`,variant:`ghost`,className:`size-8 shrink-0 p-0`,"aria-label":E,onClick:D,children:O}),t[36]=E,t[37]=D,t[38]=O,t[39]=k):k=t[39];let A;t[40]!==T||t[41]!==k?(A=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-3`,children:[T,k]}),t[40]=T,t[41]=k,t[42]=A):A=t[42];let j=u.whenToUse||u.description||n.description,N;t[43]===j?N=t[44]:(N=(0,$.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-5 text-fg-muted`,children:j}),t[43]=j,t[44]=N);let I;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,$.jsx)(z,{className:`size-3`,"aria-hidden":!0}),t[45]=I):I=t[45];let L;t[46]!==n.phases.length||t[47]!==i.phaseCount?(L=X(i.phaseCount,{count:n.phases.length}),t[46]=n.phases.length,t[47]=i.phaseCount,t[48]=L):L=t[48];let R;t[49]===L?R=t[50]:(R=(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[I,L]}),t[49]=L,t[50]=R);let B;t[51]===f?B=t[52]:(B=f?(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,$.jsx)(dt,{className:`size-3`,"aria-hidden":!0}),f]}):null,t[51]=f,t[52]=B);let V;t[53]!==R||t[54]!==B?(V=(0,$.jsxs)(`div`,{className:`mt-auto flex flex-wrap items-center gap-3 pt-4 text-[11px] text-fg-subtle`,children:[R,B]}),t[53]=R,t[54]=B,t[55]=V):V=t[55];let H;t[56]!==n||t[57]!==a?(H=()=>a(n),t[56]=n,t[57]=a,t[58]=H):H=t[58];let U;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,$.jsx)(je,{className:`size-3.5`,"aria-hidden":!0}),t[59]=U):U=t[59];let ee;t[60]!==i.configureAndRun||t[61]!==H?(ee=(0,$.jsxs)(P,{type:`button`,variant:`secondary`,className:`h-8 flex-1 rounded-lg text-xs`,onClick:H,children:[U,i.configureAndRun]}),t[60]=i.configureAndRun,t[61]=H,t[62]=ee):ee=t[62];let W;t[63]!==n||t[64]!==o?(W=()=>o(n),t[63]=n,t[64]=o,t[65]=W):W=t[65];let G;t[66]!==i.viewDetails||t[67]!==W?(G=(0,$.jsx)(P,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg text-xs`,onClick:W,children:i.viewDetails}),t[66]=i.viewDetails,t[67]=W,t[68]=G):G=t[68];let K;t[69]!==ee||t[70]!==G?(K=(0,$.jsxs)(`div`,{className:`mt-3 flex items-center gap-2 border-t border-edge-subtle pt-3`,children:[ee,G]}),t[69]=ee,t[70]=G,t[71]=K):K=t[71];let te;return t[72]!==A||t[73]!==N||t[74]!==V||t[75]!==K?(te=(0,$.jsxs)(`article`,{className:`flex min-h-48 flex-col rounded-xl border border-edge-subtle bg-surface-base p-4 transition-colors hover:border-edge hover:bg-surface-hover/35`,children:[A,N,V,K]}),t[72]=A,t[73]=N,t[74]=V,t[75]=K,t[76]=te):te=t[76],te}function un(e){let t=(0,Q.c)(45),{definitions:n,runs:r,language:i,projectPresetDefinitionIds:a,onPick:o,onDetail:s,onEdit:c}=e,[l]=(0,Z.useState)(pn),u=k(i).workflows,d=i===`zh`?`zh-CN`:`en-US`,[f,p]=(0,Z.useState)(``),[m,h]=(0,Z.useState)(`all`),[g,y]=(0,Z.useState)(`all`),b;t[0]!==m||t[1]!==n||t[2]!==f||t[3]!==g?(b=J(n,f,m,g),t[0]=m,t[1]=n,t[2]=f,t[3]=g,t[4]=b):b=t[4];let x=b,S;if(t[5]!==n||t[6]!==r){let e=new Map(n.map(fn)),i=new Set;S=[...r].sort(dn).flatMap(t=>{if(i.has(t.definitionId))return[];let n=e.get(t.definitionId);return n?(i.add(t.definitionId),[{definition:n,lastRunAtMs:t.startedAtMs??t.createdAtMs}]):[]}).slice(0,3),t[5]=n,t[6]=r,t[7]=S}else S=t[7];let C=S,w=X(u.workflowCount,{count:x.length}),T;t[8]===w?T=t[9]:(T=(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:w}),t[8]=w,t[9]=T);let D=u.sourceFilterAria,O;t[10]!==u.sources||t[11]!==y||t[12]!==g?(O=qe.map(e=>(0,$.jsx)(`button`,{type:`button`,className:M(`h-8 rounded-md px-2.5 text-xs font-medium transition-colors`,g===e?`bg-surface-base text-fg shadow-surface`:`text-fg-muted hover:text-fg`,F.focusRingPanel),"aria-pressed":g===e,onClick:()=>y(e),children:u.sources[e]},e)),t[10]=u.sources,t[11]=y,t[12]=g,t[13]=O):O=t[13];let A;t[14]!==u.sourceFilterAria||t[15]!==O?(A=(0,$.jsx)(`div`,{className:`flex rounded-lg bg-surface-muted p-0.5`,role:`group`,"aria-label":D,children:O}),t[14]=u.sourceFilterAria,t[15]=O,t[16]=A):A=t[16];let j=u.categoryFilterAria,N;t[17]===h?N=t[18]:(N=e=>h(e.target.value),t[17]=h,t[18]=N);let P;t[19]===u.categories?P=t[20]:(P=De.map(e=>(0,$.jsx)(v,{value:e,children:u.categories[e]},e)),t[19]=u.categories,t[20]=P);let I;t[21]!==m||t[22]!==u.categoryFilterAria||t[23]!==N||t[24]!==P?(I=(0,$.jsx)(_,{value:m,"aria-label":j,onChange:N,className:`h-9 min-w-36 rounded-lg border border-edge bg-surface-base px-2.5 text-xs font-medium text-fg shadow-surface`,children:P}),t[21]=m,t[22]=u.categoryFilterAria,t[23]=N,t[24]=P,t[25]=I):I=t[25];let L;t[26]!==I||t[27]!==A?(L=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[A,I]}),t[26]=I,t[27]=A,t[28]=L):L=t[28];let R;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,$.jsx)(E,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),t[29]=R):R=t[29];let z;t[30]===p?z=t[31]:(z=e=>p(e.target.value),t[30]=p,t[31]=z);let B=u.librarySearchPlaceholder,V;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(V=M(`h-10 w-full rounded-lg border border-edge bg-surface-base py-2 pl-10 pr-3 text-sm text-fg`,`placeholder:text-fg-muted`,F.focusRingPanel),t[32]=V):V=t[32];let H;t[33]!==u.librarySearchPlaceholder||t[34]!==f||t[35]!==z?(H=(0,$.jsxs)(`div`,{className:`relative max-w-xl`,children:[R,(0,$.jsx)(`input`,{value:f,onChange:z,placeholder:B,className:V})]}),t[33]=u.librarySearchPlaceholder,t[34]=f,t[35]=z,t[36]=H):H=t[36];let U;return t[37]!==x||t[38]!==u||t[39]!==i||t[40]!==s||t[41]!==c||t[42]!==o||t[43]!==a?(U=x.length===0?(0,$.jsxs)(`div`,{className:`flex min-h-64 flex-col items-center justify-center px-4 py-12 text-center`,children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:u.noDefinitions}),(0,$.jsx)(`p`,{className:`mt-1 max-w-sm text-xs leading-5 text-fg-muted`,children:u.noDefinitionsHint})]}):(0,$.jsx)(`div`,{className:`grid grid-cols-1 gap-3 pt-4 sm:grid-cols-2 xl:grid-cols-3`,children:x.map(e=>(0,$.jsx)(ln,{definition:e,language:i,labels:u,savedForProject:a?.has(e.id)??!1,onPick:o,onDetail:s,onEdit:c},e.id))}),t[37]=x,t[38]=u,t[39]=i,t[40]=s,t[41]=c,t[42]=o,t[43]=a,t[44]=U):U=t[44],(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-5`,children:[C.length>0&&!f&&m===`all`&&g===`all`?(0,$.jsxs)(`section`,{"aria-labelledby":`recent-workflows-heading`,children:[(0,$.jsx)(`h2`,{id:`recent-workflows-heading`,className:`text-sm font-semibold text-fg`,children:u.recentlyUsed}),(0,$.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:C.map(e=>{let{definition:t,lastRunAtMs:n}=e;return(0,$.jsxs)(`button`,{type:`button`,className:M(`flex min-w-52 flex-1 items-center justify-between gap-3 rounded-lg border border-edge-subtle bg-surface-base px-3 py-2 text-left hover:bg-surface-hover`,`sm:max-w-sm`,F.focusRingPanel),onClick:()=>o(t),children:[(0,$.jsxs)(`span`,{className:`min-w-0`,children:[(0,$.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:t.title}),(0,$.jsx)(`span`,{className:`mt-0.5 block text-[11px] text-fg-subtle`,children:qt(n,l,d)})]}),(0,$.jsx)(je,{className:`size-3.5 shrink-0 text-accent-fg`,"aria-hidden":!0})]},t.id)})})]}):null,(0,$.jsxs)(`section`,{"aria-labelledby":`all-workflows-heading`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 border-b border-edge-subtle pb-4`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{id:`all-workflows-heading`,className:`text-sm font-semibold text-fg`,children:u.allWorkflows}),T]}),L]}),H]}),U]})]})}function dn(e,t){return(t.startedAtMs??t.createdAtMs)-(e.startedAtMs??e.createdAtMs)}function fn(e){return[e.id,e]}function pn(){return Date.now()}var mn=(0,Z.memo)(function(e){let t=(0,Q.c)(108),{run:n,language:r,localeTag:i,nowMs:a,onOpen:o,onOpenChat:s,onCancel:c,onRetry:l}=e,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E;if(t[0]!==r||t[1]!==i||t[2]!==a||t[3]!==o||t[4]!==n){f=k(r).workflows;let e;t[22]===n?e=t[23]:(e=Jt(n),t[22]=n,t[23]=e),u=e;let s;t[24]===n?s=t[25]:(s=Yt(n),t[24]=n,t[25]=s),p=s;let c;t[26]===n?c=t[27]:(c=Ft(n),t[26]=n,t[27]=c),d=!!c;let l=n.startedAtMs??n.createdAtMs,D=nt(u?a-l:n.metrics.durationMs),O;t[28]!==n.metrics.agentCount||t[29]!==n.metrics.doneAgentCount?(O=n.metrics.agentCount>0?Math.round(n.metrics.doneAgentCount/n.metrics.agentCount*100):0,t[28]=n.metrics.agentCount,t[29]=n.metrics.doneAgentCount,t[30]=O):O=t[30];let A=O;v=`group border-b border-edge-subtle last:border-b-0`,_=`flex min-w-0 flex-col gap-3 p-3 transition-colors hover:bg-surface-hover/55 sm:px-4 lg:flex-row lg:items-center`,T=`button`,t[31]!==o||t[32]!==n?(E=()=>o(n),t[31]=o,t[32]=n,t[33]=E):E=t[33],t[34]===Symbol.for(`react.memo_cache_sentinel`)?(h=M(`min-w-0 flex-1 text-left`,F.focusRingPanel),t[34]=h):h=t[34];let j=f.taskOpenDetails,N;t[35]===n?N=t[36]:(N=zt(n),t[35]=n,t[36]=N),g=`${j}: ${N}`,C=`flex min-w-0 items-start gap-3`;let P;t[37]===n.status?P=t[38]:(P=M(`mt-0.5 shrink-0 rounded-full px-2 py-0.5 text-[10px] font-semibold`,L(n.status)),t[37]=n.status,t[38]=P),w=(0,$.jsx)(`span`,{className:P,children:f.status[n.status]??n.status}),m=`min-w-0 flex-1`;let I;t[39]===n?I=t[40]:(I=zt(n),t[39]=n,t[40]=I),t[41]===I?y=t[42]:(y=(0,$.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:I}),t[41]=I,t[42]=y);let R;t[43]===n?R=t[44]:(R=Bt(n),t[43]=n,t[44]=R);let z;t[45]===R?z=t[46]:(z=(0,$.jsx)(`span`,{className:`truncate font-medium`,children:R}),t[45]=R,t[46]=z);let B;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,$.jsx)(`span`,{"aria-hidden":!0,children:`·`}),t[47]=B):B=t[47];let V;t[48]!==i||t[49]!==a||t[50]!==l?(V=qt(l,a,i),t[48]=i,t[49]=a,t[50]=l,t[51]=V):V=t[51];let H;t[52]===V?H=t[53]:(H=(0,$.jsx)(`span`,{children:V}),t[52]=V,t[53]=H);let U=D===`—`?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,$.jsx)(`span`,{children:X(f.taskElapsed,{duration:D})})]});t[54]!==z||t[55]!==H||t[56]!==U?(b=(0,$.jsxs)(`span`,{className:`mt-1 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-fg-muted`,children:[z,B,H,U]}),t[54]=z,t[55]=H,t[56]=U,t[57]=b):b=t[57],x=u&&n.metrics.agentCount>0?(0,$.jsxs)(`span`,{className:`mt-2 block max-w-md`,children:[(0,$.jsxs)(`span`,{className:`flex items-center justify-between text-[11px] text-fg-subtle`,children:[(0,$.jsx)(`span`,{children:X(f.agentProgress,{done:n.metrics.doneAgentCount,total:n.metrics.agentCount})}),(0,$.jsxs)(`span`,{className:`tabular-nums`,children:[A,`%`]})]}),(0,$.jsx)(`span`,{className:`mt-1 block h-1.5 overflow-hidden rounded-full bg-surface-muted`,children:(0,$.jsx)(`span`,{className:`block h-full rounded-full bg-accent transition-[width] duration-200 motion-reduce:transition-none`,style:{width:`${A}%`}})})]}):null,S=n.metrics.errorAgentCount>0?(0,$.jsxs)(`span`,{className:`mt-2 flex items-center gap-1 text-[11px] text-amber-700 dark:text-amber-300`,children:[(0,$.jsx)(_e,{className:`size-3 shrink-0`,"aria-hidden":!0}),X(f.runRowErrorSummary,{count:n.metrics.errorAgentCount})]}):null,t[0]=r,t[1]=i,t[2]=a,t[3]=o,t[4]=n,t[5]=u,t[6]=d,t[7]=f,t[8]=p,t[9]=m,t[10]=h,t[11]=g,t[12]=_,t[13]=v,t[14]=y,t[15]=b,t[16]=x,t[17]=S,t[18]=C,t[19]=w,t[20]=T,t[21]=E}else u=t[5],d=t[6],f=t[7],p=t[8],m=t[9],h=t[10],g=t[11],_=t[12],v=t[13],y=t[14],b=t[15],x=t[16],S=t[17],C=t[18],w=t[19],T=t[20],E=t[21];let D;t[58]!==m||t[59]!==y||t[60]!==b||t[61]!==x||t[62]!==S?(D=(0,$.jsxs)(`span`,{className:m,children:[y,b,x,S]}),t[58]=m,t[59]=y,t[60]=b,t[61]=x,t[62]=S,t[63]=D):D=t[63];let O;t[64]!==D||t[65]!==C||t[66]!==w?(O=(0,$.jsxs)(`div`,{className:C,children:[w,D]}),t[64]=D,t[65]=C,t[66]=w,t[67]=O):O=t[67];let A;t[68]!==h||t[69]!==g||t[70]!==O||t[71]!==T||t[72]!==E?(A=(0,$.jsx)(`button`,{type:T,onClick:E,className:h,"aria-label":g,children:O}),t[68]=h,t[69]=g,t[70]=O,t[71]=T,t[72]=E,t[73]=A):A=t[73];let j;t[74]!==f.rerun||t[75]!==l||t[76]!==p||t[77]!==n.id?(j=p?(0,$.jsx)(P,{type:`button`,variant:`primary`,className:`h-8 rounded-lg text-xs`,onClick:()=>l(n.id),children:f.rerun}):null,t[74]=f.rerun,t[75]=l,t[76]=p,t[77]=n.id,t[78]=j):j=t[78];let N;t[79]!==d||t[80]!==f.continueInChat||t[81]!==s||t[82]!==n?(N=n.status===`succeeded`&&d?(0,$.jsx)(P,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg text-xs`,onClick:()=>s(n),children:f.continueInChat}):null,t[79]=d,t[80]=f.continueInChat,t[81]=s,t[82]=n,t[83]=N):N=t[83];let I;t[84]!==u||t[85]!==f.cancel||t[86]!==c||t[87]!==n.id?(I=u?(0,$.jsx)(P,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg text-xs text-red-600 dark:text-red-300`,onClick:()=>c(n.id),children:f.cancel}):null,t[84]=u,t[85]=f.cancel,t[86]=c,t[87]=n.id,t[88]=I):I=t[88];let R;t[89]!==o||t[90]!==n?(R=()=>o(n),t[89]=o,t[90]=n,t[91]=R):R=t[91];let z;t[92]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,$.jsx)(K,{className:`size-4`,"aria-hidden":!0}),t[92]=z):z=t[92];let B;t[93]!==f.taskOpenDetails||t[94]!==R?(B=(0,$.jsx)(P,{type:`button`,variant:`ghost`,className:`size-8 p-0`,"aria-label":f.taskOpenDetails,onClick:R,children:z}),t[93]=f.taskOpenDetails,t[94]=R,t[95]=B):B=t[95];let V;t[96]!==j||t[97]!==N||t[98]!==I||t[99]!==B?(V=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end gap-1.5 pl-7 lg:pl-0`,children:[j,N,I,B]}),t[96]=j,t[97]=N,t[98]=I,t[99]=B,t[100]=V):V=t[100];let H;t[101]!==_||t[102]!==A||t[103]!==V?(H=(0,$.jsxs)(`div`,{className:_,children:[A,V]}),t[101]=_,t[102]=A,t[103]=V,t[104]=H):H=t[104];let U;return t[105]!==v||t[106]!==H?(U=(0,$.jsx)(`article`,{className:v,children:H}),t[105]=v,t[106]=H,t[107]=U):U=t[107],U});function hn(e){let t=(0,Q.c)(17),{vm:n}=e,{labels:r,language:i,loading:a,ownerAgentId:o,agentOptions:c,setOwnerAgentId:l,refreshAll:u}=n,d;t[0]!==c||t[1]!==r.agentFilterAria||t[2]!==i||t[3]!==o||t[4]!==l?(d=c.length>1?(0,$.jsx)(_,{value:o??``,"aria-label":r.agentFilterAria,onChange:e=>l(e.target.value),className:`h-9 min-w-32 rounded-lg border border-edge bg-surface-panel px-2.5 text-xs font-medium text-fg shadow-surface`,children:c.map(e=>(0,$.jsx)(v,{value:e.id,children:be(e,k(i).agentsSettings)},e.id))}):null,t[0]=c,t[1]=r.agentFilterAria,t[2]=i,t[3]=o,t[4]=l,t[5]=d):d=t[5];let f;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsx)(T,{className:`size-4`,"aria-hidden":!0}),t[6]=f):f=t[6];let p;t[7]===r.addWorkflow?p=t[8]:(p=(0,$.jsx)(P,{asChild:!0,variant:`primary`,className:`h-9 rounded-lg`,children:(0,$.jsxs)(s,{to:`/workflows/new`,children:[f,r.addWorkflow]})}),t[7]=r.addWorkflow,t[8]=p);let m;t[9]!==r.refresh||t[10]!==a||t[11]!==u?(m=(0,$.jsx)(Xe,{className:`size-9 shrink-0 p-0`,loading:a,label:r.refresh,onClick:u}),t[9]=r.refresh,t[10]=a,t[11]=u,t[12]=m):m=t[12];let h;return t[13]!==d||t[14]!==p||t[15]!==m?(h=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[d,p,m]}),t[13]=d,t[14]=p,t[15]=m,t[16]=h):h=t[16],h}var gn=new Set([`failed`,`timeout`,`cancelled`]),_n=[{id:`runs`,icon:se},{id:`library`,icon:re}],vn={failed:0,timeout:0,cancelled:0,running:1,queued:2,succeeded:3};function yn(e){return gn.has(e.status)}function bn(e,t){return t===`all`?!0:t===`attention`?yn(e):e.status===t}function xn(e){return[...e].sort((e,t)=>{let n=(vn[e.status]??4)-(vn[t.status]??4);if(n!==0)return n;if(e.status===`queued`&&t.status===`queued`)return e.createdAtMs-t.createdAtMs;let r=e.completedAtMs??e.startedAtMs??e.createdAtMs;return(t.completedAtMs??t.startedAtMs??t.createdAtMs)-r})}function Sn(e,t){return e===`Home`?`runs`:e===`End`?`library`:e===`ArrowLeft`||e===`ArrowRight`?t===`runs`?`library`:`runs`:null}function Cn(){let e=(0,Q.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(I,{className:`h-5 w-16 rounded-full`}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-edge-subtle p-4 last:border-b-0`,"aria-hidden":`true`,children:[t,(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(I,{className:`h-4 w-52 max-w-full`}),(0,$.jsx)(I,{className:`mt-2 h-3 w-36 max-w-full`})]}),(0,$.jsx)(I,{className:`hidden h-8 w-20 rounded-lg sm:block`})]}),e[1]=n):n=e[1],n}function wn(e){let t=(0,Q.c)(30),{vm:n}=e,{language:r,localeTag:i,labels:a,hasToken:o,definitions:s,projectPresetDefinitionIds:c,runs:l,searchQuery:u,setSearchQuery:d,workflowFilterId:f,setWorkflowFilterId:p,triggerFilter:m,setTriggerFilter:h,statusFilter:g,setStatusFilter:y,clearRunFilters:b,pageTab:x,setPageTab:S,runLayout:C,setRunLayout:w,openRunDetails:T,openRunInChat:O,openDefinitionDetails:k,openWorkflowEditor:A,startWorkflow:j,actionError:N,loading:I,error:L,cancelRun:R,retryRun:z}=n,B=Qe(On),V=Qe(Dn),H=Date.now(),U=xn(l.filter(yn)),ee;t[0]===g?ee=t[1]:(ee=e=>bn(e,g),t[0]=g,t[1]=ee);let W=xn(Ht(l,{searchQuery:u,workflowFilterId:f,triggerFilter:m}).filter(ee)),G=!!(u||f||m!==`all`||g!==`all`),K,te;if(t[2]!==V||t[3]!==o||t[4]!==a.librarySubtitle||t[5]!==a.runsSubtitle||t[6]!==a.title||t[7]!==x||t[8]!==B||t[9]!==n?(K=()=>{if(!o){V();return}return B({startExtra:null,main:(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:a.title}),(0,$.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:x===`runs`?a.runsSubtitle:a.librarySubtitle})]}),end:(0,$.jsx)(hn,{vm:n})}),()=>V()},te=[V,o,a.librarySubtitle,a.runsSubtitle,a.title,x,B,n],t[2]=V,t[3]=o,t[4]=a.librarySubtitle,t[5]=a.runsSubtitle,t[6]=a.title,t[7]=x,t[8]=B,t[9]=n,t[10]=K,t[11]=te):(K=t[10],te=t[11]),(0,Z.useLayoutEffect)(K,te),!o){let e;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(ot,{className:`size-10 text-accent-fg`,"aria-hidden":!0}),t[12]=e):e=t[12];let n;t[13]===a.title?n=t[14]:(n=(0,$.jsx)(`h1`,{className:`mt-4 text-xl font-semibold text-fg`,children:a.title}),t[13]=a.title,t[14]=n);let r;t[15]===a.needToken?r=t[16]:(r=(0,$.jsx)(`p`,{className:`mt-2 max-w-md text-sm leading-6 text-fg-muted`,children:a.needToken}),t[15]=a.needToken,t[16]=r);let i;return t[17]!==n||t[18]!==r?(i=(0,$.jsx)(`main`,{className:`min-h-0 flex-1 overflow-auto bg-surface-panel`,children:(0,$.jsxs)(`div`,{className:`flex w-full flex-col items-center px-3 py-16 text-center sm:px-5 xl:px-6`,children:[e,n,r]})}),t[17]=n,t[18]=r,t[19]=i):i=t[19],i}let ne=a.pageTabsAria,re=_n.map(e=>{let{id:t,icon:n}=e;return(0,$.jsxs)(`button`,{id:`workflow-tab-${t}`,type:`button`,role:`tab`,"aria-selected":x===t,"aria-controls":`workflow-panel-${t}`,tabIndex:x===t?0:-1,draggable:!1,className:M(`relative inline-flex shrink-0 items-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium`,`transition-transform duration-150 ease-out active:scale-95 motion-reduce:transition-none motion-reduce:active:scale-100`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,x===t?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),onClick:()=>S(t),onKeyDown:e=>{let n=Sn(e.key,t);n&&(e.preventDefault(),S(n),window.requestAnimationFrame(()=>{document.getElementById(`workflow-tab-${n}`)?.focus()}))},children:[(0,$.jsx)(n,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),(0,$.jsx)(`span`,{children:a.pageTabs[t]}),t===`runs`&&U.length>0?(0,$.jsx)(`span`,{className:`rounded-full bg-red-500/15 px-1.5 py-0.5 text-[10px] font-semibold text-red-700 dark:text-red-300`,children:U.length}):null]},t)}),q;t[20]!==a.pageTabsAria||t[21]!==re?(q=(0,$.jsx)(`nav`,{className:`-mx-1 flex gap-1 overflow-x-auto px-1 pb-1`,"aria-label":ne,role:`tablist`,children:re}),t[20]=a.pageTabsAria,t[21]=re,t[22]=q):q=t[22];let J;t[23]!==N||t[24]!==L?(J=N??L?(0,$.jsx)(`div`,{className:`mt-4 rounded-lg border border-red-500/25 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,role:`alert`,children:N??L}):null,t[23]=N,t[24]=L,t[25]=J):J=t[25];let ie=x===`runs`?(0,$.jsxs)(`div`,{id:`workflow-panel-runs`,role:`tabpanel`,"aria-labelledby":`workflow-tab-runs`,className:`flex flex-col gap-4 py-4`,children:[U.length>0?(0,$.jsx)(`section`,{className:`rounded-xl border border-amber-500/30 bg-amber-500/8 px-4 py-3`,"aria-labelledby":`workflow-attention-heading`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 lg:flex-row lg:items-center lg:justify-between`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,$.jsx)(_e,{className:`mt-0.5 size-4 shrink-0 text-amber-700 dark:text-amber-300`,"aria-hidden":!0}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`h2`,{id:`workflow-attention-heading`,className:`text-sm font-semibold text-fg`,children:a.attentionTitle}),(0,$.jsx)(`span`,{className:`rounded-full bg-amber-500/15 px-2 py-0.5 text-[10px] font-semibold text-amber-800 dark:text-amber-200`,children:U.length})]}),(0,$.jsxs)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:[zt(U[0]),` · `,qt(U[0].completedAtMs??U[0].createdAtMs,H,i)]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:a.attentionHint})]})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 pl-7 lg:pl-0`,children:[(0,$.jsx)(P,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg text-xs`,onClick:()=>T(U[0]),children:a.attentionView}),(0,$.jsx)(P,{type:`button`,variant:`primary`,className:`h-8 rounded-lg text-xs`,onClick:()=>void z(U[0].id),children:a.rerun})]})]})}):null,(0,$.jsx)(`section`,{className:`flex flex-col gap-3 rounded-xl border border-edge-subtle bg-surface-base p-3`,"aria-label":a.runFiltersAria,children:(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsxs)(`div`,{className:`relative min-w-52 flex-1 sm:max-w-sm`,children:[(0,$.jsx)(E,{className:`pointer-events-none absolute left-2.5 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,$.jsx)(`input`,{value:u,onChange:e=>d(e.target.value),placeholder:a.runsSearchPlaceholder,className:M(`h-9 w-full rounded-lg border border-edge bg-surface-panel py-2 pl-9 pr-3 text-sm text-fg shadow-surface`,`placeholder:text-fg-muted`,F.focusRingPanel)})]}),(0,$.jsx)(_,{value:g,"aria-label":a.statusFilterAria,onChange:e=>y(e.target.value),className:`h-9 min-w-32 rounded-lg border border-edge bg-surface-panel px-2.5 text-xs font-medium text-fg shadow-surface`,children:[`all`,`attention`,`running`,`queued`,`succeeded`].map(e=>(0,$.jsx)(v,{value:e,children:a.runStatuses[e]},e))}),(0,$.jsxs)(_,{value:m,"aria-label":a.boardTriggerFilterAria,onChange:e=>h(e.target.value),className:`h-9 min-w-[7.5rem] rounded-lg border border-edge bg-surface-panel px-2.5 text-xs font-medium text-fg shadow-surface`,children:[(0,$.jsx)(v,{value:`all`,children:a.boardTriggerFilterAll}),(0,$.jsx)(v,{value:`automation`,children:a.boardTriggerFilterAutomation}),(0,$.jsx)(v,{value:`webui`,children:a.boardTriggerFilterWebui}),(0,$.jsx)(v,{value:`chat`,children:a.boardTriggerFilterChat}),(0,$.jsx)(v,{value:`api`,children:a.boardTriggerFilterApi})]}),(0,$.jsxs)(_,{value:f,"aria-label":a.boardWorkflowFilterAria,onChange:e=>p(e.target.value),className:`h-9 min-w-40 rounded-lg border border-edge bg-surface-panel px-2.5 text-xs font-medium text-fg shadow-surface`,children:[(0,$.jsx)(v,{value:``,children:a.boardWorkflowFilterAll}),s.map(En)]}),G?(0,$.jsxs)(P,{type:`button`,variant:`ghost`,className:`h-9 rounded-lg text-xs`,onClick:b,children:[(0,$.jsx)(D,{className:`size-3.5`,"aria-hidden":!0}),a.clearFilters]}):null,(0,$.jsxs)(`div`,{className:`ml-auto flex rounded-lg bg-surface-muted p-0.5`,role:`group`,"aria-label":a.layoutAria,children:[(0,$.jsxs)(`button`,{type:`button`,className:M(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium transition-colors`,C===`list`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`,F.focusRingPanel),"aria-pressed":C===`list`,onClick:()=>w(`list`),children:[(0,$.jsx)(oe,{className:`size-3.5`,"aria-hidden":!0}),a.runLayouts.list]}),(0,$.jsxs)(`button`,{type:`button`,className:M(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium transition-colors`,C===`board`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`,F.focusRingPanel),"aria-pressed":C===`board`,onClick:()=>w(`board`),children:[(0,$.jsx)(ue,{className:`size-3.5`,"aria-hidden":!0}),a.runLayouts.board]})]})]})}),C===`list`?(0,$.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge-subtle bg-surface-base`,"aria-labelledby":`workflow-runs-heading`,children:[(0,$.jsxs)(`header`,{className:`flex items-start justify-between gap-3 border-b border-edge-subtle px-4 py-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{id:`workflow-runs-heading`,className:`text-sm font-semibold text-fg`,children:a.allRuns}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:a.allRunsHint})]}),(0,$.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-xs font-semibold tabular-nums text-fg-muted`,children:W.length})]}),I&&W.length===0?Array.from({length:4}).map(Tn):W.length>0?W.map(e=>(0,$.jsx)(mn,{run:e,language:r,localeTag:i,nowMs:H,onOpen:T,onOpenChat:O,onCancel:e=>void R(e),onRetry:e=>void z(e)},e.id)):(0,$.jsxs)(`div`,{className:`flex min-h-64 flex-col items-center justify-center px-4 py-12 text-center`,children:[(0,$.jsx)(ot,{className:`size-8 text-fg-subtle`,"aria-hidden":!0}),(0,$.jsx)(`h3`,{className:`mt-3 text-sm font-semibold text-fg`,children:G?a.noRunResultsTitle:a.noRunsTitle}),(0,$.jsx)(`p`,{className:`mt-1 max-w-md text-xs leading-5 text-fg-muted`,children:G?a.noRunResultsHint:a.noRunsStartHint}),(0,$.jsx)(P,{type:`button`,variant:G?`secondary`:`primary`,className:`mt-4 h-9 rounded-lg text-xs`,onClick:G?b:()=>S(`library`),children:G?a.clearFilters:a.chooseWorkflow})]})]}):(0,$.jsx)(`div`,{className:`h-[min(72vh,48rem)] min-h-[24rem] w-full sm:min-h-[28rem]`,children:(0,$.jsx)(rn,{runs:W,language:r,localeTag:i,labels:{boardEmptyTitle:a.boardEmptyTitle,boardEmptyHint:a.boardEmptyHint,boardStart:a.chooseWorkflow,loading:a.loading},searchQuery:``,workflowFilterId:``,triggerFilter:`all`,selectedRunId:null,loading:I,onOpenRun:T,onOpenRunChat:O,onCancelRun:e=>void R(e),onRetryRun:e=>void z(e),onStart:()=>S(`library`)})})]}):(0,$.jsx)(`section`,{id:`workflow-panel-library`,role:`tabpanel`,"aria-labelledby":`workflow-tab-library`,className:`py-5`,children:(0,$.jsx)(un,{definitions:s,runs:l,language:r,projectPresetDefinitionIds:c,onPick:j,onDetail:k,onEdit:A})}),ae;return t[26]!==J||t[27]!==ie||t[28]!==q?(ae=(0,$.jsx)(`main`,{className:`min-h-0 flex-1 overflow-y-auto bg-surface-panel`,children:(0,$.jsxs)(`div`,{className:`mx-auto flex min-h-full w-full max-w-[96rem] flex-col px-3 py-5 sm:px-5 xl:px-6`,children:[q,J,ie]})}),t[26]=J,t[27]=ie,t[28]=q,t[29]=ae):ae=t[29],ae}function Tn(e,t){return(0,$.jsx)(Cn,{},t)}function En(e){return(0,$.jsx)(v,{value:e.id,children:e.title},e.id)}function Dn(e){return e.clearPageHeader}function On(e){return e.setPageHeader}function kn(){let e=(0,Q.c)(131),t=A(Fn),n;e[0]===t?n=e[1]:(n=k(t),e[0]=t,e[1]=n);let r=n.workflows,i=t===`zh`?`zh-CN`:`en-US`,s=j(Pn),c=!!s,l=a(),[u,d]=o(),f;e[2]===u?f=e[3]:(f=u.get(`q`)??``,e[2]=u,e[3]=f);let p=f,m;e[4]===u?m=e[5]:(m=u.get(`wf`)?.trim()??``,e[4]=u,e[5]=m);let h=m,g;e[6]===u?g=e[7]:(g=u.get(`trigger`)?.trim()||`all`,e[6]=u,e[7]=g);let _=g,v,y,b,x,S;if(e[8]!==u){let t=u.get(`status`)?.trim()??``,n=u.get(`tab`)?.trim()??``,r=u.get(`layout`)?.trim()??``;v=u.get(`agent`)?.trim()??``,b=u.get(`projectId`)?.trim()||void 0,y=$e.has(n)?n:`runs`,x=Me.has(r)?r:`list`,S=Pe.has(t)?t:`all`,e[8]=u,e[9]=v,e[10]=y,e[11]=b,e[12]=x,e[13]=S}else v=e[9],y=e[10],b=e[11],x=e[12],S=e[13];let C=S,[w,T]=(0,Z.useState)(null),E;e[14]!==c||e[15]!==s?(E=c?[`workflow-agents`,s]:null,e[14]=c,e[15]=s,e[16]=E):E=e[16];let D;e[17]===Symbol.for(`react.memo_cache_sentinel`)?(D={revalidateOnFocus:!1},e[17]=D):D=e[17];let O=N(E,rt,D),M;bb0:{let e=O.data?.agents??[];if(v&&(e.length===0||e.some(e=>e.id===v))){M=v;break bb0}M=O.data?.defaultId}let P=M,F;e[18]!==c||e[19]!==s?(F=c?[`workflow-definitions`,s]:null,e[18]=c,e[19]=s,e[20]=F):F=e[20];let I;e[21]===Symbol.for(`react.memo_cache_sentinel`)?(I={revalidateOnFocus:!1},e[21]=I):I=e[21];let L=N(F,ut,I),R;e[22]!==c||e[23]!==b||e[24]!==s?(R=c&&b?[`workflow-project-presets`,s,b]:null,e[22]=c,e[23]=b,e[24]=s,e[25]=R):R=e[25];let z;e[26]===b?z=e[27]:(z=()=>we(b),e[26]=b,e[27]=z);let B;e[28]===Symbol.for(`react.memo_cache_sentinel`)?(B={revalidateOnFocus:!1},e[28]=B):B=e[28];let V=N(R,z,B),H;e[29]!==c||e[30]!==P||e[31]!==b||e[32]!==s?(H=c&&P?[`workflow-runs`,s,P,b??``]:null,e[29]=c,e[30]=P,e[31]=b,e[32]=s,e[33]=H):H=e[33];let U;e[34]!==P||e[35]!==b?(U=()=>Oe(100,{ownerAgentId:P,projectId:b}),e[34]=P,e[35]=b,e[36]=U):U=e[36];let ee;e[37]===Symbol.for(`react.memo_cache_sentinel`)?(ee={revalidateOnFocus:!1,refreshInterval:Mn},e[37]=ee):ee=e[37];let W=N(H,U,ee),G;e[38]===L.data?G=e[39]:(G=L.data??[],e[38]=L.data,e[39]=G);let K=G,te;e[40]===W.data?te=e[41]:(te=W.data??[],e[40]=W.data,e[41]=te);let ne=te,re;e[42]===d?re=e[43]:(re=e=>{d(t=>{let n=new URLSearchParams(t);return e(n),n},{replace:!0})},e[42]=d,e[43]=re);let q=re,J;e[44]===q?J=e[45]:(J=e=>q(t=>{let n=e.trim();n?t.set(`q`,n):t.delete(`q`)}),e[44]=q,e[45]=J);let ie=J,ae;e[46]===q?ae=e[47]:(ae=e=>q(t=>{let n=e.trim();n?t.set(it,n):t.delete(it)}),e[46]=q,e[47]=ae);let oe=ae,se;e[48]===q?se=e[49]:(se=e=>q(t=>{let n=e.trim();n?t.set(`wf`,n):t.delete(`wf`)}),e[48]=q,e[49]=se);let ce=se,le;e[50]===q?le=e[51]:(le=e=>q(t=>{e&&e!==`all`?t.set(Re,e):t.delete(Re)}),e[50]=q,e[51]=le);let ue=le,de;e[52]===q?de=e[53]:(de=e=>q(t=>{e===`runs`?t.delete(`tab`):t.set(`tab`,e)}),e[52]=q,e[53]=de);let fe=de,pe;e[54]===q?pe=e[55]:(pe=e=>q(t=>{e===`list`?t.delete(at):t.set(at,e)}),e[54]=q,e[55]=pe);let me=pe,he;e[56]===q?he=e[57]:(he=e=>q(t=>{e===`all`?t.delete(lt):t.set(lt,e)}),e[56]=q,e[57]=he);let ge=he,_e;e[58]===q?_e=e[59]:(_e=()=>q(jn),e[58]=q,e[59]=_e);let Y=_e,ve;if(e[60]!==P||e[61]!==b){let t=new URLSearchParams;P&&t.set(`agentId`,P),b&&t.set(`projectId`,b),ve=t.size?`?${t.toString()}`:``,e[60]=P,e[61]=b,e[62]=ve}else ve=e[62];let ye=ve,be;e[63]!==l||e[64]!==ye?(be=e=>l(`/workflows/${e.id}${ye}`),e[63]=l,e[64]=ye,e[65]=be):be=e[65];let xe=be,Se=xe,X;e[66]!==l||e[67]!==ye?(X=e=>{let t=new URLSearchParams(ye.slice(1));e.metadata.source!==`user`&&t.set(`copy`,e.id),l(e.metadata.source===`user`?`/workflows/${e.id}/edit${ye}`:`/workflows/new${t.size?`?${t.toString()}`:``}`)},e[66]=l,e[67]=ye,e[68]=X):X=e[68];let Ce=X,Te;e[69]!==l||e[70]!==ye?(Te=e=>l(`/workflows/runs/${e.id}${ye}`),e[69]=l,e[70]=ye,e[71]=Te):Te=e[71];let Ee=Te,De;e[72]===l?De=e[73]:(De=e=>{let t=Ft(e);t&&l(Fe(t))},e[72]=l,e[73]=De);let ke=De,Ae;e[74]!==r.cancelFailed||e[75]!==P||e[76]!==W?(Ae=async e=>{try{await Ne(e,{ownerAgentId:P}),await W.mutate()}catch(e){let t=e;T(t instanceof Error?t.message:r.cancelFailed)}},e[74]=r.cancelFailed,e[75]=P,e[76]=W,e[77]=Ae):Ae=e[77];let je=Ae,Ie;e[78]!==r.retryFailed||e[79]!==l||e[80]!==P||e[81]!==ye?(Ie=async e=>{try{l(`/workflows/runs/${(await ft(e,{ownerAgentId:P})).runId}${ye}`)}catch(e){let t=e;T(t instanceof Error?t.message:r.retryFailed)}},e[78]=r.retryFailed,e[79]=l,e[80]=P,e[81]=ye,e[82]=Ie):Ie=e[82];let Le=Ie,ze,Be;e[83]===W?(ze=e[84],Be=e[85]):(ze=()=>{let e=()=>void W.mutate();return window.addEventListener(`workflow-run-updated`,e),window.addEventListener(`workflow-run-error`,e),()=>{window.removeEventListener(`workflow-run-updated`,e),window.removeEventListener(`workflow-run-error`,e)}},Be=[W],e[83]=W,e[84]=ze,e[85]=Be),(0,Z.useEffect)(ze,Be);let Ve;e[86]!==O||e[87]!==L||e[88]!==V||e[89]!==W?(Ve=()=>{Promise.all([O.mutate(),L.mutate(),V.mutate(),W.mutate()])},e[86]=O,e[87]=L,e[88]=V,e[89]=W,e[90]=Ve):Ve=e[90];let He=Ve,Ue=O.isLoading||L.isLoading||W.isLoading||V.isLoading,We=O.error?.message??L.error?.message??W.error?.message??V.error?.message??null,Ge;e[91]===O.data?.agents?Ge=e[92]:(Ge=O.data?.agents??[],e[91]=O.data?.agents,e[92]=Ge);let Ke;e[93]===V.data?Ke=e[94]:(Ke=new Set((V.data??[]).map(An)),e[93]=V.data,e[94]=Ke);let qe;return e[95]!==w||e[96]!==je||e[97]!==Y||e[98]!==K||e[99]!==We||e[100]!==c||e[101]!==r||e[102]!==t||e[103]!==Ue||e[104]!==i||e[105]!==xe||e[106]!==Ee||e[107]!==ke||e[108]!==Ce||e[109]!==P||e[110]!==y||e[111]!==b||e[112]!==He||e[113]!==Le||e[114]!==x||e[115]!==ne||e[116]!==p||e[117]!==oe||e[118]!==fe||e[119]!==me||e[120]!==ie||e[121]!==ge||e[122]!==ue||e[123]!==ce||e[124]!==Se||e[125]!==C||e[126]!==Ge||e[127]!==Ke||e[128]!==_||e[129]!==h?(qe={language:t,localeTag:i,labels:r,hasToken:c,searchQuery:p,setSearchQuery:ie,ownerAgentId:P,projectId:b,agentOptions:Ge,setOwnerAgentId:oe,workflowFilterId:h,setWorkflowFilterId:ce,triggerFilter:_,setTriggerFilter:ue,statusFilter:C,setStatusFilter:ge,clearRunFilters:Y,pageTab:y,setPageTab:fe,runLayout:x,setRunLayout:me,definitions:K,projectPresetDefinitionIds:Ke,runs:ne,openDefinitionDetails:xe,startWorkflow:Se,openWorkflowEditor:Ce,openRunDetails:Ee,openRunInChat:ke,actionError:w,loading:Ue,error:We,refreshAll:He,cancelRun:je,retryRun:Le},e[95]=w,e[96]=je,e[97]=Y,e[98]=K,e[99]=We,e[100]=c,e[101]=r,e[102]=t,e[103]=Ue,e[104]=i,e[105]=xe,e[106]=Ee,e[107]=ke,e[108]=Ce,e[109]=P,e[110]=y,e[111]=b,e[112]=He,e[113]=Le,e[114]=x,e[115]=ne,e[116]=p,e[117]=oe,e[118]=fe,e[119]=me,e[120]=ie,e[121]=ge,e[122]=ue,e[123]=ce,e[124]=Se,e[125]=C,e[126]=Ge,e[127]=Ke,e[128]=_,e[129]=h,e[130]=qe):qe=e[130],qe}function An(e){return e.definitionId}function jn(e){e.delete(`q`),e.delete(`wf`),e.delete(Re),e.delete(lt)}function Mn(e){return e?.some(Nn)?3e3:0}function Nn(e){return e.status===`queued`||e.status===`running`}function Pn(e){return e.token}function Fn(e){return e.language}function In(){let e=(0,Q.c)(2),t=kn(),n;return e[0]===t?n=e[1]:(n=(0,$.jsx)(wn,{vm:t}),e[0]=t,e[1]=n),n}function Ln(e){return{title:e.title,description:e.description,version:e.version,inputSchema:e.inputSchema,outputSchema:e.outputSchema,defaults:e.defaults,tags:e.metadata.tags,whenToUse:e.metadata.whenToUse,estimatedAgents:e.metadata.estimatedAgents,permissions:e.permissions,resources:e.resources}}function Rn(e,t){let n=new Set(t);if(!n.has(e))return e;for(let t=2;t<1e3;t+=1){let r=`${e}_${t}`;if(!n.has(r))return r}return`${e}_${Date.now()}`}function zn(e){if(!(e instanceof Error))return null;let t=e;if(t.status!==409||!t.body||typeof t.body!=`object`)return null;let n=t.body,r=typeof n.currentRevision==`number`?n.currentRevision:0;return n.code===`WORKFLOW_NAME_EXISTS`&&typeof n.name==`string`&&typeof n.suggestedName==`string`?{code:`WORKFLOW_NAME_EXISTS`,name:n.name,currentRevision:r,suggestedName:n.suggestedName}:n.code===`WORKFLOW_REVISION_CONFLICT`?{code:`WORKFLOW_REVISION_CONFLICT`,currentRevision:r}:null}var Bn={padding:.24,minZoom:.45,maxZoom:1};function Vn({language:e,ownerAgentId:t,saving:n,initialDraft:r,initialName:i,existingNames:a,saveConflict:o,onSave:c,onSaveAndStart:l,onClearSaveConflict:u,onReloadLatest:d}){let f=or(e),[p,m]=(0,Z.useState)(`my_workflow`),[h,g]=(0,Z.useState)(()=>$n()),[_,v]=(0,Z.useState)(()=>({title:f.untitled,description:``,tags:[`custom`]})),[y,b]=(0,Z.useState)(`agent-1`),[x,S,C]=Dt(h.nodes.map(e=>Zn(e,e.id===`agent-1`))),[w,T]=(0,Z.useState)(``),[E,D]=(0,Z.useState)(``),[O,k]=(0,Z.useState)(!1),[A,j]=(0,Z.useState)(null),[N,I]=(0,Z.useState)(null),[L,H]=(0,Z.useState)(!!r),[U,ee]=(0,Z.useState)(null),[G,K]=(0,Z.useState)(`idle`),[ne,re]=(0,Z.useState)(0),[q,J]=(0,Z.useState)([]),[ie,ae]=(0,Z.useState)(null),oe=(0,Z.useRef)(``),se=(0,Z.useRef)(``),ce=(0,Z.useRef)(void 0),ue=(0,Z.useRef)(void 0),de=(0,Z.useRef)(!1),fe=(0,Z.useRef)(null),[pe,me]=(0,Z.useState)(0);(0,Z.useEffect)(()=>{let e=`${r?.mode??`new`}:${r?.name??i}:${r?.baseRevision??0}:${r?.repairPrompt??``}`;oe.current!==e&&(oe.current=e,m(r?.name??i),g(structuredClone(r?.graph??$n())),me(e=>e+1),v(structuredClone(r?.manifest??{title:f.untitled,description:``,tags:[`custom`]})),b(r?.graph.nodes.find(e=>e.kind===`agent`)?.id??`agent-1`),T(r?.repairPrompt??``),j(null),I(null),H(!!r),D(``),ee(null),re(r?.baseRevision??0),J([]),ae(null),ce.current=void 0,ue.current=void 0,K(`idle`))},[f.untitled,r,i]),(0,Z.useEffect)(()=>{r?.mode===`edit`&&ht(r.name).then(J).catch(()=>J([]))},[r?.mode,r?.name]),(0,Z.useEffect)(()=>{if(!p.trim())return;let e=window.setTimeout(()=>{Ge(p,h).then(ee).catch(()=>ee(null))},350);return()=>window.clearTimeout(e)},[h,p]),(0,Z.useEffect)(()=>{if(!p.trim())return;K(`saving`);let e=window.setTimeout(()=>{W({id:ce.current,workflowName:p,graph:h,manifest:_,baseRevision:ne,expectedUpdatedAtMs:ue.current}).then(e=>{ce.current=e.id,ue.current=e.updatedAtMs,K(`saved`)}).catch(()=>K(`error`))},900);return()=>window.clearTimeout(e)},[ne,h,_,p]);let he=(0,Z.useMemo)(()=>tr(h,A?.graph??null),[h,A?.graph]),ge=(0,Z.useMemo)(()=>{if(!A)return h;let e=new Set(A.graph.nodes.map(e=>e.id)),t=h.nodes.filter(t=>!e.has(t.id));return{...A.graph,nodes:[...A.graph.nodes,...t]}},[h,A]);(0,Z.useLayoutEffect)(()=>{S(e=>{let t=new Map(e.map(e=>[e.id,e]));return ge.nodes.map(e=>({...t.get(e.id),...Zn(e,e.id===y,he.nodeStates.get(e.id))}))})},[ge.nodes,he.nodeStates,y,S]),(0,Z.useEffect)(()=>{let e=fe.current;if(!e||ge.nodes.length===0)return;let t=window.requestAnimationFrame(()=>{e.fitView(Bn)});return()=>window.cancelAnimationFrame(t)},[ge.nodes.length,pe]);let _e=(0,Z.useMemo)(()=>ge.edges.map(Qn),[ge.edges]),Y=h.nodes.find(e=>e.id===y)??null,ve=(0,Z.useMemo)(()=>new Set(a),[a]),ye=r?.mode!==`edit`&&ve.has(p),be=ye?Rn(p,ve):p,xe=U?.valid===!0&&!ye&&!n&&!O,X=(0,Z.useCallback)(e=>{g(t=>{let n=t.nodes.map(t=>t.id!==e.id||t.position.x===e.position.x&&t.position.y===e.position.y?t:{...t,position:e.position});return n.some((e,n)=>e!==t.nodes[n])?{...t,nodes:n}:t})},[]),Ce=(0,Z.useCallback)(e=>{let t=e.filter(e=>e.type!==`select`);t.length!==0&&g(e=>({...e,edges:bt(t,e.edges.map(Qn)).map(e=>({id:e.id,source:e.source,target:e.target,sourcePort:e.sourceHandle===`true`||e.sourceHandle===`false`?e.sourceHandle:void 0}))}))},[]),we=(0,Z.useCallback)(e=>{!e.source||!e.target||g(t=>({...t,edges:St({...e,id:`edge-${crypto.randomUUID()}`},t.edges.map(Qn)).map(e=>({id:e.id,source:e.source,target:e.target,sourcePort:e.sourceHandle===`true`||e.sourceHandle===`false`?e.sourceHandle:void 0}))}))},[]),Te=(0,Z.useCallback)((e,t)=>{g(n=>({...n,nodes:n.nodes.map(n=>n.id===e?t(n):n)}))},[]),Ee=e=>{let t=`${e}-${crypto.randomUUID().slice(0,8)}`,n=er(e,t,h.nodes.length);g(e=>{let r=e.nodes.find(e=>e.id===y&&e.kind!==`output`),i=r?[{id:`edge-${crypto.randomUUID()}`,source:r.id,target:t}]:[];return{...e,nodes:[...e.nodes,n],edges:[...e.edges,...i]}}),me(e=>e+1),b(t)},De=()=>{!Y||Y.kind===`input`||Y.kind===`output`||(g(e=>({...e,nodes:e.nodes.filter(e=>e.id!==Y.id),edges:e.edges.filter(e=>e.source!==Y.id&&e.target!==Y.id)})),me(e=>e+1),b(``))},Oe=(0,Z.useCallback)(async()=>{if(w.trim()){k(!0);try{let n=await Le({prompt:w,agentId:t,language:e===`zh`?`zh`:`en`,mode:r||h.nodes.length>3?`improve`:`create`,existingGraph:h}),i=r?.mode===`edit`?r.name:Rn(n.name,ve);I(i===n.name?null:n.name),j(i===n.name?n:{...n,name:i}),H(!0),me(e=>e+1),b(n.graph.nodes.find(e=>e.kind===`agent`)?.id??``)}finally{k(!1)}}},[w,ve,h,r,e,t]);(0,Z.useEffect)(()=>{let e=r?.repairPrompt?.trim();!e||w.trim()!==e||O||A||se.current===e||(se.current=e,Oe())},[w,Oe,O,r?.repairPrompt,A]);let ke=()=>{j(null),I(null),b(h.nodes.find(e=>e.kind===`agent`)?.id??``),me(e=>e+1)},Ae=async()=>{if(!(!A||n||de.current)){de.current=!0;try{let e=await c({name:A.name,graph:A.graph,manifest:A.manifest,expectedRevision:ne});if(!e)return;m(e.name),g(structuredClone(e.graph)),v(Ln(e)),ee(A.validation),re(e.revision),j(null),I(null),T(``),b(e.graph.nodes.find(e=>e.kind===`agent`)?.id??``),ce.current&&await et(ce.current).catch(()=>void 0)}catch{}finally{de.current=!1}}},Me=async e=>{if(!xe||de.current)return;de.current=!0;let t={name:p,graph:h,manifest:_,expectedRevision:ne};try{if(e)await l({...t,goal:E.trim()||_.description||p});else{let e=await c(t);if(!e)return;re(e.revision)}ce.current&&await et(ce.current).catch(()=>void 0)}catch{return}finally{de.current=!1}},Ne=async e=>{if(!(ie!==null||r?.mode!==`edit`)){ae(e);try{let t=await V(r.name,e,ne);g(t.graph),me(e=>e+1),v(Ln(t)),re(t.revision),b(t.graph.nodes.find(e=>e.kind===`agent`)?.id??``),J(await ht(r.name))}finally{ae(null)}}};return(0,$.jsxs)(`main`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden bg-surface-panel`,children:[(0,$.jsxs)(`header`,{className:`flex shrink-0 items-center gap-3 border-b border-edge px-4 py-3`,children:[(0,$.jsx)(s,{to:`/workflows`,className:M(`inline-flex size-9 shrink-0 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,F.focusRingPanel),"aria-label":e===`zh`?`返回工作流`:`Back to workflows`,children:(0,$.jsx)(Ie,{className:`size-4`,"aria-hidden":!0})}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`h1`,{className:`text-base font-semibold text-fg`,children:r?.mode===`edit`?f.editTitle:f.createTitle}),(0,$.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:f.subtitle})]}),(0,$.jsx)(`span`,{className:M(`text-xs`,G===`error`?`text-danger`:`text-fg-subtle`),children:G===`saving`?f.savingDraft:G===`saved`?f.savedDraft:G===`error`?f.draftError:``})]}),o?(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2 border-b border-warning/30 bg-warning/5 px-4 py-2 text-sm text-fg`,children:[(0,$.jsx)(`span`,{className:`min-w-0 flex-1`,children:o.code===`WORKFLOW_NAME_EXISTS`?e===`zh`?`内部名称“${o.name}”已被使用。`:`The internal name “${o.name}” is already in use.`:e===`zh`?`这个工作流已更新到版本 ${o.currentRevision}。`:`This workflow has changed to revision ${o.currentRevision}.`}),o.code===`WORKFLOW_NAME_EXISTS`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(P,{variant:`secondary`,className:`h-8`,onClick:()=>{m(o.suggestedName),u()},children:e===`zh`?`使用 ${o.suggestedName}`:`Use ${o.suggestedName}`}),(0,$.jsx)(s,{className:`text-sm font-medium text-accent-fg hover:underline`,to:`/workflows/${encodeURIComponent(o.name)}`,children:e===`zh`?`打开已有工作流`:`Open existing`})]}):(0,$.jsx)(P,{variant:`secondary`,className:`h-8`,onClick:d,children:e===`zh`?`加载最新版本`:`Load latest`})]}):null,!o&&ye?(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2 border-b border-warning/30 bg-warning/5 px-4 py-2 text-sm text-fg`,children:[(0,$.jsx)(`span`,{className:`min-w-0 flex-1`,children:e===`zh`?`内部名称“${p}”已被使用。`:`The internal name “${p}” is already in use.`}),(0,$.jsx)(P,{variant:`secondary`,className:`h-8`,onClick:()=>m(be),children:e===`zh`?`使用 ${be}`:`Use ${be}`})]}):null,!o&&!ye&&N&&A?(0,$.jsx)(`div`,{className:`shrink-0 border-b border-accent/20 bg-accent/5 px-4 py-2 text-sm text-fg-muted`,children:e===`zh`?`“${N}”已存在,方案将保存为“${A.name}”。`:`“${N}” already exists. This proposal will be saved as “${A.name}”.`}):null,L?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto lg:flex-row lg:overflow-hidden`,children:[(0,$.jsxs)(`section`,{className:`flex min-h-[32rem] min-w-0 flex-1 flex-col bg-surface-base lg:min-h-0`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2 border-b border-edge px-3 py-2`,children:[(0,$.jsxs)(`div`,{className:`mr-2 min-w-36`,children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:f.flowTitle}),(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:f.stepCount(h.nodes.length)})]}),(0,$.jsxs)(P,{variant:`secondary`,className:`h-8 rounded-lg text-xs`,disabled:!!A,onClick:()=>Ee(`agent`),children:[(0,$.jsx)(te,{className:`size-3.5`}),f.addAgent]}),(0,$.jsxs)(P,{variant:`secondary`,className:`h-8 rounded-lg text-xs`,disabled:!!A,onClick:()=>Ee(`decision`),children:[(0,$.jsx)(ot,{className:`size-3.5`}),f.addDecision]}),(0,$.jsxs)(P,{variant:`secondary`,className:`h-8 rounded-lg text-xs`,disabled:!!A,onClick:()=>Ee(`merge`),children:[(0,$.jsx)(z,{className:`size-3.5`}),f.addMerge]}),(0,$.jsx)(`span`,{className:`ml-auto text-xs text-fg-subtle`,children:f.canvasHint})]}),(0,$.jsx)(`div`,{className:`relative min-h-72 flex-1`,children:h.nodes.length>0?(0,$.jsxs)(Tt,{"aria-label":f.flowAria,nodes:x,edges:_e,nodeTypes:Jn,onNodesChange:C,onEdgesChange:Ce,onConnect:we,nodesDraggable:!A,nodesConnectable:!A,onNodeClick:(e,t)=>b(t.id),onNodeDragStart:(e,t)=>b(t.id),onNodeDragStop:(e,t)=>X(t),onInit:e=>{fe.current=e,window.requestAnimationFrame(()=>{e.fitView(Bn)})},fitView:!0,fitViewOptions:Bn,minZoom:.25,maxZoom:1.5,deleteKeyCode:null,proOptions:{hideAttribution:!0},children:[(0,$.jsx)(Ot,{color:`var(--color-edge)`,gap:22,size:1}),(0,$.jsx)(wt,{showInteractive:!1,className:`!border-edge !bg-surface-panel !shadow-surface`})]}):(0,$.jsx)(`div`,{className:`flex h-full items-center justify-center px-6 text-center text-sm text-fg-muted`,children:f.emptyFlow})})]}),(0,$.jsx)(`aside`,{className:`flex w-full shrink-0 flex-col border-t border-edge bg-surface-panel lg:w-[22rem] lg:border-l lg:border-t-0`,children:(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-4`,children:A?(0,$.jsx)(Un,{proposal:A,diff:he,copy:f,saving:n,onAccept:()=>void Ae(),onReject:ke}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`label`,{className:`block text-xs font-medium text-fg`,htmlFor:`workflow-title`,children:f.humanTitle}),(0,$.jsx)(`input`,{id:`workflow-title`,value:_.title??``,onChange:e=>v(t=>({...t,title:e.target.value})),className:Xn}),(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,htmlFor:`workflow-description`,children:f.task}),(0,$.jsx)(`textarea`,{id:`workflow-description`,value:_.description??``,onChange:e=>v(t=>({...t,description:e.target.value})),className:`${Xn} min-h-20 resize-y`}),(0,$.jsxs)(`details`,{className:`mt-4 border-t border-edge pt-3`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer text-xs font-medium text-fg-muted`,children:f.advanced}),(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,htmlFor:`workflow-name`,children:f.workflowName}),(0,$.jsx)(`input`,{id:`workflow-name`,value:p,onChange:e=>m(ir(e.target.value)),className:Xn}),ye?(0,$.jsx)(`p`,{className:`mt-1 text-xs text-danger`,children:e===`zh`?`该内部名称已被使用,请换一个名称。`:`This internal name is already in use.`}):null,r?.mode===`edit`&&q.length>0?(0,$.jsxs)(`div`,{className:`mt-4 border-t border-edge pt-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-medium text-fg-muted`,children:[(0,$.jsx)(Se,{className:`size-3.5`}),f.versions,` · v`,ne]}),(0,$.jsx)(`div`,{className:`mt-2 space-y-1`,children:q.map(t=>(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2 rounded-lg px-2 py-1.5 hover:bg-surface-hover`,children:[(0,$.jsxs)(`span`,{className:`min-w-0 text-xs text-fg-muted`,children:[`v`,t.revision,` · `,Ve(t.createdAtMs,e)]}),t.revision===ne?(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:f.currentVersion}):(0,$.jsxs)(P,{variant:`ghost`,className:`h-7 shrink-0 px-2 text-xs`,disabled:ie!==null,onClick:()=>void Ne(t.revision),children:[(0,$.jsx)(R,{className:`size-3`}),ie===t.revision?f.restoring:f.restore]})]},t.revision))})]}):null]})]}),(0,$.jsx)(`div`,{className:`my-4 border-t border-edge`}),Y?(0,$.jsx)(Yn,{node:Y,copy:f,updateNode:Te,onDelete:De}):(0,$.jsx)(`div`,{className:`py-8 text-center text-sm text-fg-muted`,children:f.selectNode}),U&&!U.valid?(0,$.jsxs)(`section`,{className:`mt-4 rounded-lg border border-danger/30 bg-danger/5 p-3`,children:[(0,$.jsx)(`h3`,{className:`text-xs font-medium text-danger`,children:f.needsAttention}),(0,$.jsx)(`ul`,{className:`mt-2 space-y-1 text-xs text-danger`,children:U.errors.slice(0,5).map((e,t)=>(0,$.jsxs)(`li`,{children:[`• `,e.message]},`${e.code}-${t}`))})]}):null]})})})]}),(0,$.jsx)(`footer`,{className:`shrink-0 border-t border-edge bg-surface-panel p-3`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 lg:flex-row lg:items-center`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[(0,$.jsx)(B,{className:`size-4 shrink-0 text-accent-fg`}),(0,$.jsx)(yt,{value:w,onChange:e=>T(e.target.value),suggestion:Mt(f.aiPlaceholder),onAcceptSuggestion:T,onKeyDown:e=>{e.key===`Enter`&&Oe()},placeholder:f.aiPlaceholder,className:`${Xn} mt-0 flex-1`}),(0,$.jsx)(P,{variant:`secondary`,className:`h-10 shrink-0`,disabled:!!A||O||!w.trim(),onClick:()=>void Oe(),children:O?f.designing:f.applyWithAi})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`input`,{value:E,onChange:e=>D(e.target.value),placeholder:f.testGoal,className:`${Xn} mt-0 w-52`}),(0,$.jsxs)(P,{variant:`secondary`,disabled:!xe,onClick:()=>void Me(!1),children:[(0,$.jsx)(le,{className:`size-4`}),f.publish]}),(0,$.jsxs)(P,{variant:`primary`,disabled:!xe,onClick:()=>void Me(!0),children:[(0,$.jsx)(je,{className:`size-4`}),f.publishAndRun]})]})]})})]}):(0,$.jsx)(Hn,{copy:f,prompt:w,generating:O,onPromptChange:T,onGenerate:()=>void Oe(),onManual:()=>H(!0)})]})}function Hn(e){let t=(0,Q.c)(42),{copy:n,prompt:r,generating:i,onPromptChange:a,onGenerate:o,onManual:s}=e,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(`div`,{className:`flex size-11 items-center justify-center rounded-2xl bg-accent-soft text-accent-fg`,children:(0,$.jsx)(B,{className:`size-5`})}),t[0]=c):c=t[0];let l;t[1]===n.introTitle?l=t[2]:(l=(0,$.jsx)(`h2`,{className:`mt-5 text-2xl font-semibold text-fg`,children:n.introTitle}),t[1]=n.introTitle,t[2]=l);let u;t[3]===n.introDescription?u=t[4]:(u=(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:n.introDescription}),t[3]=n.introDescription,t[4]=u);let d;t[5]===a?d=t[6]:(d=e=>a(e.target.value),t[5]=a,t[6]=d);let f;t[7]===n.introPlaceholder?f=t[8]:(f=Mt(n.introPlaceholder),t[7]=n.introPlaceholder,t[8]=f);let p;t[9]!==n.introPlaceholder||t[10]!==a||t[11]!==r||t[12]!==d||t[13]!==f?(p=(0,$.jsx)(vt,{value:r,onChange:d,suggestion:f,onAcceptSuggestion:a,placeholder:n.introPlaceholder,className:`${Xn} mt-6 h-auto min-h-32 resize-y py-3 text-base leading-6`}),t[9]=n.introPlaceholder,t[10]=a,t[11]=r,t[12]=d,t[13]=f,t[14]=p):p=t[14];let m;if(t[15]!==n.examples||t[16]!==a){let e;t[18]===a?e=t[19]:(e=e=>(0,$.jsx)(`button`,{type:`button`,className:`rounded-full border border-edge bg-surface-panel px-3 py-1.5 text-xs text-fg-muted hover:bg-surface-hover hover:text-fg`,onClick:()=>a(e),children:e},e),t[18]=a,t[19]=e),m=n.examples.map(e),t[15]=n.examples,t[16]=a,t[17]=m}else m=t[17];let h;t[20]===m?h=t[21]:(h=(0,$.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:m}),t[20]=m,t[21]=h);let g;t[22]!==i||t[23]!==r?(g=!r.trim()||i,t[22]=i,t[23]=r,t[24]=g):g=t[24];let _;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(B,{className:`size-4`}),t[25]=_):_=t[25];let v=i?n.designing:n.designWorkflow,y;t[26]!==o||t[27]!==v||t[28]!==g?(y=(0,$.jsxs)(P,{variant:`primary`,disabled:g,onClick:o,children:[_,v]}),t[26]=o,t[27]=v,t[28]=g,t[29]=y):y=t[29];let b;t[30]!==n.manualStart||t[31]!==s?(b=(0,$.jsx)(P,{variant:`ghost`,onClick:s,children:n.manualStart}),t[30]=n.manualStart,t[31]=s,t[32]=b):b=t[32];let x;t[33]!==y||t[34]!==b?(x=(0,$.jsxs)(`div`,{className:`mt-6 flex flex-wrap items-center gap-3`,children:[y,b]}),t[33]=y,t[34]=b,t[35]=x):x=t[35];let S;return t[36]!==x||t[37]!==l||t[38]!==u||t[39]!==p||t[40]!==h?(S=(0,$.jsx)(`section`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-y-auto bg-surface-base px-5 py-10`,children:(0,$.jsxs)(`div`,{className:`w-full max-w-2xl`,children:[c,l,u,p,h,x]})}),t[36]=x,t[37]=l,t[38]=u,t[39]=p,t[40]=h,t[41]=S):S=t[41],S}function Un(e){let t=(0,Q.c)(74),{proposal:n,diff:r,copy:i,saving:a,onAccept:o,onReject:s}=e,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-accent-fg`,children:(0,$.jsx)(B,{className:`size-4`})}),t[0]=c):c=t[0];let l;t[1]===i.proposalTitle?l=t[2]:(l=(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:i.proposalTitle}),t[1]=i.proposalTitle,t[2]=l);let u;t[3]===i.proposalHint?u=t[4]:(u=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:i.proposalHint}),t[3]=i.proposalHint,t[4]=u);let d;t[5]!==l||t[6]!==u?(d=(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[c,(0,$.jsxs)(`div`,{className:`min-w-0`,children:[l,u]})]}),t[5]=l,t[6]=u,t[7]=d):d=t[7];let f=n.manifest.title||n.name,p;t[8]===f?p=t[9]:(p=(0,$.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:f}),t[8]=f,t[9]=p);let m=n.explanation||n.manifest.description,h;t[10]===m?h=t[11]:(h=(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:m}),t[10]=m,t[11]=h);let _;t[12]===i.added?_=t[13]:(_=(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.added}),t[12]=i.added,t[13]=_);let v;t[14]===r.addedIds.length?v=t[15]:(v=(0,$.jsx)(`dd`,{className:`mt-1 font-semibold text-success`,children:r.addedIds.length}),t[14]=r.addedIds.length,t[15]=v);let y;t[16]!==v||t[17]!==_?(y=(0,$.jsxs)(`div`,{className:`rounded-lg bg-success-soft p-2`,children:[_,v]}),t[16]=v,t[17]=_,t[18]=y):y=t[18];let b;t[19]===i.changed?b=t[20]:(b=(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.changed}),t[19]=i.changed,t[20]=b);let x=r.changedIds.length+r.connectionChanges,S;t[21]===x?S=t[22]:(S=(0,$.jsx)(`dd`,{className:`mt-1 font-semibold text-accent-fg`,children:x}),t[21]=x,t[22]=S);let C;t[23]!==b||t[24]!==S?(C=(0,$.jsxs)(`div`,{className:`rounded-lg bg-accent-soft p-2`,children:[b,S]}),t[23]=b,t[24]=S,t[25]=C):C=t[25];let w;t[26]===i.removed?w=t[27]:(w=(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.removed}),t[26]=i.removed,t[27]=w);let T;t[28]===r.removedIds.length?T=t[29]:(T=(0,$.jsx)(`dd`,{className:`mt-1 font-semibold text-danger`,children:r.removedIds.length}),t[28]=r.removedIds.length,t[29]=T);let E;t[30]!==w||t[31]!==T?(E=(0,$.jsxs)(`div`,{className:`rounded-lg bg-danger/5 p-2`,children:[w,T]}),t[30]=w,t[31]=T,t[32]=E):E=t[32];let O;t[33]!==y||t[34]!==C||t[35]!==E?(O=(0,$.jsxs)(`dl`,{className:`mt-3 grid grid-cols-3 gap-2 text-center text-xs`,children:[y,C,E]}),t[33]=y,t[34]=C,t[35]=E,t[36]=O):O=t[36];let k;t[37]!==O||t[38]!==p||t[39]!==h?(k=(0,$.jsxs)(`div`,{className:`mt-4 rounded-xl border border-edge bg-surface-base/50 p-3`,children:[p,h,O]}),t[37]=O,t[38]=p,t[39]=h,t[40]=k):k=t[40];let A;t[41]!==i.assumptions||t[42]!==n.assumptions?(A=n.assumptions.length?(0,$.jsx)(Gn,{title:i.assumptions,items:n.assumptions}):null,t[41]=i.assumptions,t[42]=n.assumptions,t[43]=A):A=t[43];let j;t[44]!==i.risks||t[45]!==n.risks?(j=n.risks.length?(0,$.jsx)(Gn,{title:i.risks,items:n.risks}):null,t[44]=i.risks,t[45]=n.risks,t[46]=j):j=t[46];let M;t[47]!==i.permissions||t[48]!==n.permissionsSummary?(M=n.permissionsSummary.length?(0,$.jsx)(Gn,{title:i.permissions,items:n.permissionsSummary}):null,t[47]=i.permissions,t[48]=n.permissionsSummary,t[49]=M):M=t[49];let N;t[50]!==n.validation.errors||t[51]!==n.validation.valid?(N=n.validation.valid?null:(0,$.jsx)(`div`,{className:`mt-4 rounded-xl border border-danger/30 bg-danger/5 p-3 text-xs text-danger`,children:n.validation.errors.slice(0,4).map(Wn)}),t[50]=n.validation.errors,t[51]=n.validation.valid,t[52]=N):N=t[52];let F=a||!n.validation.valid,I;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,$.jsx)(g,{className:`size-4`}),t[53]=I):I=t[53];let L=a?i.savingProposal:i.acceptAndSave,R;t[54]!==o||t[55]!==F||t[56]!==L?(R=(0,$.jsxs)(P,{variant:`primary`,disabled:F,onClick:o,children:[I,L]}),t[54]=o,t[55]=F,t[56]=L,t[57]=R):R=t[57];let z;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,$.jsx)(D,{className:`size-4`}),t[58]=z):z=t[58];let V;t[59]!==i.rejectProposal||t[60]!==s||t[61]!==a?(V=(0,$.jsxs)(P,{variant:`ghost`,disabled:a,onClick:s,children:[z,i.rejectProposal]}),t[59]=i.rejectProposal,t[60]=s,t[61]=a,t[62]=V):V=t[62];let H;t[63]!==R||t[64]!==V?(H=(0,$.jsxs)(`div`,{className:`mt-5 grid gap-2`,children:[R,V]}),t[63]=R,t[64]=V,t[65]=H):H=t[65];let U;return t[66]!==k||t[67]!==A||t[68]!==j||t[69]!==M||t[70]!==N||t[71]!==H||t[72]!==d?(U=(0,$.jsxs)(`section`,{children:[d,k,A,j,M,N,H]}),t[66]=k,t[67]=A,t[68]=j,t[69]=M,t[70]=N,t[71]=H,t[72]=d,t[73]=U):U=t[73],U}function Wn(e){return(0,$.jsxs)(`p`,{children:[`• `,e.message]},`${e.code}:${e.message}`)}function Gn(e){let t=(0,Q.c)(9),{title:n,items:r}=e,i;t[0]===n?i=t[1]:(i=(0,$.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-fg-subtle`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=r.slice(0,4).map(Kn),t[2]=r,t[3]=a);let o;t[4]===a?o=t[5]:(o=(0,$.jsx)(`ul`,{className:`mt-2 space-y-1 text-xs leading-5 text-fg-muted`,children:a}),t[4]=a,t[5]=o);let s;return t[6]!==i||t[7]!==o?(s=(0,$.jsxs)(`section`,{className:`mt-4`,children:[i,o]}),t[6]=i,t[7]=o,t[8]=s):s=t[8],s}function Kn(e){return(0,$.jsxs)(`li`,{children:[`• `,e]},e)}function qn(e){let t=(0,Q.c)(34),{data:n,selected:r}=e,i=n.workflowNode,a=n.diffState,o;t[0]===i.kind?o=t[1]:(o=i.kind===`input`?(0,$.jsx)(ye,{}):i.kind===`agent`?(0,$.jsx)(te,{}):i.kind===`decision`?(0,$.jsx)(ot,{}):i.kind===`merge`?(0,$.jsx)(z,{}):(0,$.jsx)(je,{}),t[0]=i.kind,t[1]=o);let s=o,c=r?`border-accent ring-2 ring-accent/20`:`border-edge`,l=a===`added`&&`border-success ring-2 ring-success/15`,u=a===`changed`&&`border-accent ring-2 ring-accent/15`,d=a===`removed`&&`border-dashed border-danger opacity-55`,f;t[2]!==c||t[3]!==l||t[4]!==u||t[5]!==d?(f=M(`w-52 rounded-xl border bg-surface-panel p-3 shadow-surface transition-colors`,c,l,u,d),t[2]=c,t[3]=l,t[4]=u,t[5]=d,t[6]=f):f=t[6];let p;t[7]===i.kind?p=t[8]:(p=i.kind===`input`?null:(0,$.jsx)(Et,{type:`target`,position:Ct.Left,className:`!size-2.5 !border-2 !border-surface-panel !bg-fg-subtle`}),t[7]=i.kind,t[8]=p);let m;t[9]===s?m=t[10]:(m=(0,$.jsx)(`span`,{className:`mt-0.5 [&>svg]:size-4 text-accent-fg`,children:s}),t[9]=s,t[10]=m);let h;t[11]===i.title?h=t[12]:(h=(0,$.jsx)(`strong`,{className:`block truncate text-sm font-medium text-fg`,children:i.title}),t[11]=i.title,t[12]=h);let g;t[13]!==i.description||t[14]!==i.kind?(g=i.description||ar(i.kind),t[13]=i.description,t[14]=i.kind,t[15]=g):g=t[15];let _;t[16]===g?_=t[17]:(_=(0,$.jsx)(`span`,{className:`mt-1 block line-clamp-2 text-xs leading-4 text-fg-muted`,children:g}),t[16]=g,t[17]=_);let v;t[18]!==_||t[19]!==h?(v=(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[h,_]}),t[18]=_,t[19]=h,t[20]=v):v=t[20];let y;t[21]===a?y=t[22]:(y=a?(0,$.jsx)(`span`,{className:M(`rounded-full px-1.5 py-0.5 text-[10px] font-medium`,a===`added`?`bg-success-soft text-success`:a===`removed`?`bg-danger/10 text-danger`:`bg-accent-soft text-accent-fg`),children:a===`added`?`+`:a===`removed`?`−`:`Δ`}):null,t[21]=a,t[22]=y);let b;t[23]!==v||t[24]!==y||t[25]!==m?(b=(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[m,v,y]}),t[23]=v,t[24]=y,t[25]=m,t[26]=b):b=t[26];let x;t[27]===i.kind?x=t[28]:(x=i.kind===`decision`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Et,{id:`true`,type:`source`,position:Ct.Right,style:{top:`38%`},className:`!size-2.5 !border-2 !border-surface-panel !bg-success`}),(0,$.jsx)(Et,{id:`false`,type:`source`,position:Ct.Right,style:{top:`70%`},className:`!size-2.5 !border-2 !border-surface-panel !bg-danger`})]}):i.kind===`output`?null:(0,$.jsx)(Et,{type:`source`,position:Ct.Right,className:`!size-2.5 !border-2 !border-surface-panel !bg-accent`}),t[27]=i.kind,t[28]=x);let S;return t[29]!==b||t[30]!==x||t[31]!==f||t[32]!==p?(S=(0,$.jsxs)(`div`,{className:f,children:[p,b,x]}),t[29]=b,t[30]=x,t[31]=f,t[32]=p,t[33]=S):S=t[33],S}var Jn={workflow:qn};function Yn(e){let t=(0,Q.c)(71),{node:n,copy:r,updateNode:i,onDelete:a}=e,o;t[0]!==n.id||t[1]!==i?(o=e=>i(n.id,t=>({...t,...e})),t[0]=n.id,t[1]=i,t[2]=o):o=t[2];let s=o,c;t[3]!==n.id||t[4]!==i?(c=e=>i(n.id,t=>({...t,config:{...t.config,...e}})),t[3]=n.id,t[4]=i,t[5]=c):c=t[5];let l=c,u;t[6]===r.stepSettings?u=t[7]:(u=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:r.stepSettings}),t[6]=r.stepSettings,t[7]=u);let d;t[8]!==r.remove||t[9]!==n.kind||t[10]!==a?(d=n.kind!==`input`&&n.kind!==`output`?(0,$.jsxs)(P,{variant:`ghost`,className:`h-8 px-2 text-danger`,onClick:a,children:[(0,$.jsx)(G,{className:`size-3.5`}),r.remove]}):null,t[8]=r.remove,t[9]=n.kind,t[10]=a,t[11]=d):d=t[11];let f;t[12]!==u||t[13]!==d?(f=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[u,d]}),t[12]=u,t[13]=d,t[14]=f):f=t[14];let p;t[15]===r.stepName?p=t[16]:(p=(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,htmlFor:`node-title`,children:r.stepName}),t[15]=r.stepName,t[16]=p);let m;t[17]===s?m=t[18]:(m=e=>s({title:e.target.value}),t[17]=s,t[18]=m);let h;t[19]!==n.title||t[20]!==m?(h=(0,$.jsx)(`input`,{id:`node-title`,value:n.title,onChange:m,className:Xn}),t[19]=n.title,t[20]=m,t[21]=h):h=t[21];let g;t[22]===r.stepPurpose?g=t[23]:(g=(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,htmlFor:`node-description`,children:r.stepPurpose}),t[22]=r.stepPurpose,t[23]=g);let _=n.description??``,v;t[24]===s?v=t[25]:(v=e=>s({description:e.target.value}),t[24]=s,t[25]=v);let b;t[26]!==_||t[27]!==v?(b=(0,$.jsx)(`textarea`,{id:`node-description`,value:_,onChange:v,className:`${Xn} min-h-16 resize-y`}),t[26]=_,t[27]=v,t[28]=b):b=t[28];let x;t[29]!==r.advanced||t[30]!==r.defaultModel||t[31]!==r.instructions||t[32]!==r.model||t[33]!==n.config||t[34]!==n.kind||t[35]!==l?(x=n.kind===`agent`?(0,$.jsx)($.Fragment,{children:(0,$.jsxs)(`details`,{className:`mt-4 border-t border-edge pt-3`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer text-xs font-medium text-fg-muted`,children:r.advanced}),(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,htmlFor:`node-prompt`,children:r.instructions}),(0,$.jsx)(`textarea`,{id:`node-prompt`,value:String(n.config.prompt??``),onChange:e=>l({prompt:e.target.value}),className:`${Xn} min-h-36 resize-y`}),(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,htmlFor:`node-model`,children:r.model}),(0,$.jsx)(`input`,{id:`node-model`,value:String(n.config.model??``),onChange:e=>l({model:e.target.value||void 0}),placeholder:r.defaultModel,className:Xn})]})}):null,t[29]=r.advanced,t[30]=r.defaultModel,t[31]=r.instructions,t[32]=r.model,t[33]=n.config,t[34]=n.kind,t[35]=l,t[36]=x):x=t[36];let S;t[37]!==r.compareValue||t[38]!==r.condition||t[39]!==r.contains||t[40]!==r.equals||t[41]!==r.exists||t[42]!==r.notEquals||t[43]!==r.valuePath||t[44]!==n.config||t[45]!==n.kind||t[46]!==l?(S=n.kind===`decision`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,htmlFor:`decision-path`,children:r.valuePath}),(0,$.jsx)(`input`,{id:`decision-path`,value:n.config.rule?.path??``,onChange:e=>l({rule:{...n.config.rule??{operator:`exists`},path:e.target.value}}),placeholder:`result.approved`,className:Xn}),(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,id:`decision-operator-label`,children:r.condition}),(0,$.jsx)(y,{value:n.config.rule?.operator??`exists`,placeholder:r.condition,allowEmpty:!1,ariaLabelledBy:`decision-operator-label`,options:[{value:`exists`,label:r.exists},{value:`equals`,label:r.equals},{value:`not_equals`,label:r.notEquals},{value:`contains`,label:r.contains}],onChange:e=>l({rule:{...n.config.rule??{path:``},operator:e}})}),n.config.rule?.operator===`exists`?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,htmlFor:`decision-value`,children:r.compareValue}),(0,$.jsx)(`input`,{id:`decision-value`,value:String(n.config.rule?.value??``),onChange:e=>l({rule:{...n.config.rule,value:e.target.value}}),className:Xn})]})]}):null,t[37]=r.compareValue,t[38]=r.condition,t[39]=r.contains,t[40]=r.equals,t[41]=r.exists,t[42]=r.notEquals,t[43]=r.valuePath,t[44]=n.config,t[45]=n.kind,t[46]=l,t[47]=S):S=t[47];let C;t[48]!==r.combineAs||t[49]!==r.listResults||t[50]!==r.namedResults||t[51]!==n.config||t[52]!==n.kind||t[53]!==l?(C=n.kind===`merge`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,id:`merge-mode-label`,children:r.combineAs}),(0,$.jsx)(y,{value:String(n.config.mode??`object`),placeholder:r.combineAs,allowEmpty:!1,ariaLabelledBy:`merge-mode-label`,options:[{value:`object`,label:r.namedResults},{value:`array`,label:r.listResults}],onChange:e=>l({mode:e})})]}):null,t[48]=r.combineAs,t[49]=r.listResults,t[50]=r.namedResults,t[51]=n.config,t[52]=n.kind,t[53]=l,t[54]=C):C=t[54];let w;t[55]!==r.autoSummary||t[56]!==r.summaryTemplate||t[57]!==n.config||t[58]!==n.kind||t[59]!==l?(w=n.kind===`output`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,htmlFor:`output-summary`,children:r.summaryTemplate}),(0,$.jsx)(`textarea`,{id:`output-summary`,value:String(n.config.summary??``),onChange:e=>l({summary:e.target.value||void 0}),placeholder:r.autoSummary,className:`${Xn} min-h-20 resize-y`})]}):null,t[55]=r.autoSummary,t[56]=r.summaryTemplate,t[57]=n.config,t[58]=n.kind,t[59]=l,t[60]=w):w=t[60];let T;return t[61]!==b||t[62]!==x||t[63]!==S||t[64]!==C||t[65]!==w||t[66]!==f||t[67]!==p||t[68]!==h||t[69]!==g?(T=(0,$.jsxs)(`section`,{children:[f,p,h,g,b,x,S,C,w]}),t[61]=b,t[62]=x,t[63]=S,t[64]=C,t[65]=w,t[66]=f,t[67]=p,t[68]=h,t[69]=g,t[70]=T):T=t[70],T}var Xn=`mt-1 block h-10 w-full rounded-lg border border-edge bg-surface-subtle px-3 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-edge-strong`;function Zn(e,t=!1,n){return{id:e.id,type:`workflow`,position:e.position,selected:t,data:{workflowNode:e,diffState:n}}}function Qn(e){return{id:e.id,source:e.source,target:e.target,sourceHandle:e.sourcePort===`true`||e.sourcePort===`false`?e.sourcePort:void 0,markerEnd:{type:xt.ArrowClosed},style:{stroke:`var(--color-fg-subtle)`,strokeWidth:1.5}}}function $n(){return{schemaVersion:1,nodes:[{id:`input`,kind:`input`,title:`Input`,description:`What the user provides`,position:{x:0,y:120},config:{}},{id:`agent-1`,kind:`agent`,title:`Do the work`,description:`Understand and complete the request`,phaseId:`work`,position:{x:300,y:120},config:{prompt:`Complete this goal: {{goal}}
2
+
3
+ User input:
4
+ {{input}}`,maxIterations:12}},{id:`output`,kind:`output`,title:`Result`,description:`A clear answer for the user`,position:{x:620,y:120},config:{}}],edges:[{id:`input-agent`,source:`input`,target:`agent-1`},{id:`agent-output`,source:`agent-1`,target:`output`}]}}function er(e,t,n){let r={x:280+n%3*280,y:80+Math.floor(n/3)*180};return e===`agent`?{id:t,kind:e,title:`New AI step`,description:`Describe what this step should accomplish`,phaseId:`work`,position:r,config:{prompt:`Use the previous results to complete this step:
5
+ {{predecessors}}`,maxIterations:12}}:e===`decision`?{id:t,kind:e,title:`Check a condition`,description:`Choose what happens next`,position:r,config:{rule:{path:``,operator:`exists`}}}:{id:t,kind:e,title:`Combine results`,description:`Bring parallel work together`,position:r,config:{mode:`object`}}}function tr(e,t){let n=new Map;if(!t)return{addedIds:[],changedIds:[],removedIds:[],connectionChanges:0,nodeStates:n};let r=new Map(e.nodes.map(e=>[e.id,e])),i=new Map(t.nodes.map(e=>[e.id,e])),a=t.nodes.filter(e=>!r.has(e.id)).map(e=>e.id),o=e.nodes.filter(e=>!i.has(e.id)).map(e=>e.id),s=t.nodes.filter(e=>{let t=r.get(e.id);return t?nr(t)!==nr(e):!1}).map(e=>e.id);a.forEach(e=>n.set(e,`added`)),s.forEach(e=>n.set(e,`changed`)),o.forEach(e=>n.set(e,`removed`));let c=new Set(e.edges.map(rr)),l=new Set(t.edges.map(rr));return{addedIds:a,changedIds:s,removedIds:o,connectionChanges:e.edges.filter(e=>!l.has(rr(e))).length+t.edges.filter(e=>!c.has(rr(e))).length,nodeStates:n}}function nr(e){let{position:t,...n}=e;return JSON.stringify(n)}function rr(e){return`${e.source}:${e.sourcePort??``}->${e.target}`}function ir(e){return e.toLowerCase().replace(/[^a-z0-9_-]+/g,`_`).replace(/^_+/,``)}function ar(e){return{input:`User input`,agent:`AI step`,decision:`Decision`,merge:`Combine`,output:`User result`}[e]}function or(e){return e===`zh`?{untitled:`未命名工作流`,editTitle:`编辑工作流`,createTitle:`创建工作流`,subtitle:`描述目标、确认方案,然后用示例测试。无需编写代码。`,close:`关闭`,savingDraft:`正在保存草稿…`,savedDraft:`草稿已保存`,draftError:`草稿保存失败`,flowTitle:`工作流步骤图`,flowAria:`可编辑的工作流步骤图`,stepCount:e=>`${e} 个步骤 · 点击步骤可编辑`,emptyFlow:`还没有步骤。添加一个 AI 步骤开始设计。`,addAgent:`添加 AI 步骤`,addDecision:`添加判断`,addMerge:`合并结果`,canvasHint:`拖动步骤并连接圆点`,workflowName:`内部名称`,humanTitle:`用户看到的名称`,task:`这个工作流最终帮用户得到什么?`,versions:`版本记录`,currentVersion:`当前`,restore:`恢复为新版本`,restoring:`恢复中…`,selectNode:`选择一个步骤来编辑`,needsAttention:`发布前需要处理`,stepSettings:`步骤设置`,remove:`删除`,stepName:`步骤名称`,stepPurpose:`这一步的作用`,instructions:`告诉 AI 要做什么`,advanced:`高级设置`,model:`模型(可选)`,defaultModel:`使用智能默认值`,valuePath:`要检查的值`,condition:`判断条件`,exists:`存在`,equals:`等于`,notEquals:`不等于`,contains:`包含`,compareValue:`比较值`,combineAs:`合并方式`,namedResults:`按步骤名称组织`,listResults:`按列表组织`,summaryTemplate:`结果摘要(可选)`,autoSummary:`留空则自动生成`,aiPlaceholder:`例如:增加一个风险评审步骤,并与方案分析并行`,designing:`正在设计…`,applyWithAi:`让 AI 提出修改`,testGoal:`用什么例子测试?`,publish:`保存`,publishAndRun:`保存并测试`,introTitle:`你希望这个工作流持续帮你完成什么?`,introDescription:`直接描述最终目标。AI 会先给出一份可理解的步骤方案,只有你确认后才会保存。`,introPlaceholder:`例如:每周整理项目进展,识别风险,并生成一份可以发给团队的周报。`,examples:[`研究一个主题并给出可靠结论`,`评审需求并生成实现计划`,`分析问题、定位原因并给出修复建议`],designWorkflow:`生成方案`,manualStart:`高级:手动搭建`,proposalTitle:`AI 提出的方案`,proposalHint:`绿色是新增,蓝色是修改,红色虚线是删除。确认前不会改变现有工作流。`,added:`新增`,changed:`修改`,removed:`删除`,assumptions:`方案假设`,risks:`需要留意`,permissions:`需要的权限`,acceptAndSave:`采用并保存`,savingProposal:`正在保存…`,rejectProposal:`不采用,返回修改`}:{untitled:`Untitled workflow`,editTitle:`Edit workflow`,createTitle:`Create workflow`,subtitle:`Describe the task, review the plan, then test it with an example. No code required.`,close:`Close`,savingDraft:`Saving draft…`,savedDraft:`Draft saved`,draftError:`Draft could not be saved`,flowTitle:`Workflow map`,flowAria:`Editable workflow step map`,stepCount:e=>`${e} steps · select a step to edit`,emptyFlow:`No steps yet. Add an AI step to start designing.`,addAgent:`Add AI step`,addDecision:`Add decision`,addMerge:`Combine results`,canvasHint:`Drag steps and connect the dots`,workflowName:`Internal name`,humanTitle:`Name users see`,task:`What will this workflow help the user achieve?`,versions:`Version history`,currentVersion:`Current`,restore:`Restore as new`,restoring:`Restoring…`,selectNode:`Select a step to edit it`,needsAttention:`Needs attention before publishing`,stepSettings:`Step settings`,remove:`Remove`,stepName:`Step name`,stepPurpose:`Purpose of this step`,instructions:`Tell the AI what to do`,advanced:`Advanced settings`,model:`Model (optional)`,defaultModel:`Use smart default`,valuePath:`Value to check`,condition:`Condition`,exists:`Exists`,equals:`Equals`,notEquals:`Does not equal`,contains:`Contains`,compareValue:`Compare with`,combineAs:`Combine as`,namedResults:`Named results`,listResults:`List of results`,summaryTemplate:`Result summary (optional)`,autoSummary:`Leave blank to generate automatically`,aiPlaceholder:`For example: add a risk review in parallel with solution analysis`,designing:`Designing…`,applyWithAi:`Ask AI to propose changes`,testGoal:`What example should we test?`,publish:`Save`,publishAndRun:`Save & test`,introTitle:`What should this workflow keep doing for you?`,introDescription:`Describe the task in plain language. AI will propose an understandable plan and will not save anything until you approve it.`,introPlaceholder:`For example: summarize project progress every week, identify risks, and produce a team-ready update.`,examples:[`Research a topic and deliver a reliable conclusion`,`Review a request and produce an implementation plan`,`Analyze an issue, find the cause, and recommend a fix`],designWorkflow:`Generate plan`,manualStart:`Advanced: build manually`,proposalTitle:`AI proposal`,proposalHint:`Green is added, blue is changed, and dashed red is removed. Nothing changes until you approve.`,added:`Added`,changed:`Changed`,removed:`Removed`,assumptions:`Assumptions`,risks:`Things to check`,permissions:`Required access`,acceptAndSave:`Accept & save`,savingProposal:`Saving…`,rejectProposal:`Reject and revise`}}function sr(e){let t=(0,Q.c)(25),{projectId:n,language:r,value:i,onChange:a}=e,o=k(r).workflows,s=k(r).projectDetailPage.board.operationalStates,g;t[0]===n?g=t[1]:(g=n?[`workflow-context-project`,n]:null,t[0]=n,t[1]=g);let _;t[2]===n?_=t[3]:(_=()=>pe(n),t[2]=n,t[3]=_);let v;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(v={revalidateOnFocus:!1},t[4]=v):v=t[4];let y=N(g,_,v),b;t[5]===n?b=t[6]:(b=n?[`workflow-context-notes`,n]:null,t[5]=n,t[6]=b);let x;t[7]===n?x=t[8]:(x=()=>ke({projectId:n,limit:100,sortBy:`updatedAt`,sortOrder:`desc`}),t[7]=n,t[8]=x);let S;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(S={revalidateOnFocus:!1},t[9]=S):S=t[9];let C=N(b,x,S),w;t[10]!==a||t[11]!==i?(w=e=>{a(i.some(t=>t.kind===e.kind&&t.id===e.id)?i.filter(t=>t.kind!==e.kind||t.id!==e.id):[...i,e])},t[10]=a,t[11]=i,t[12]=w):w=t[12];let E=w,O;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,$.jsx)(T,{className:`size-3.5`,"aria-hidden":!0}),t[13]=O):O=t[13];let A;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,$.jsx)(c,{className:`fixed inset-0 z-50 bg-black/35`}),t[14]=A):A=t[14];let j;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,$.jsx)(D,{className:`size-4`}),t[15]=j):j=t[15];let M=y.isLoading||C.isLoading?(0,$.jsx)(`div`,{className:`grid gap-3`,children:Array.from({length:6},cr)}):y.error||C.error?(0,$.jsx)(`p`,{className:`rounded-xl border border-danger/30 bg-danger/5 p-4 text-sm text-danger`,children:o.contextPickerLoadFailed}):(0,$.jsxs)(`div`,{className:`space-y-6`,children:[(0,$.jsx)(lr,{title:o.contextTasks,icon:se,empty:o.contextTasksEmpty,items:(y.data?.tasks??[]).map(e=>({id:e.id,title:e.title,subtitle:s[e.operationalState]})),selected:i,kind:`task`,onToggle:E}),(0,$.jsx)(lr,{title:o.contextNotes,icon:Ke,empty:o.contextNotesEmpty,items:(C.data?.items??[]).map(e=>({id:e.id,title:e.title||o.contextUntitled,subtitle:e.snippet})),selected:i,kind:`note`,onToggle:E})]}),F;t[16]===M?F=t[17]:(F=(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:M}),t[16]=M,t[17]=F);let I=o.contextPickerCount.replace(`{{count}}`,String(i.length)),L;t[18]===I?L=t[19]:(L=(0,$.jsx)(`span`,{className:`text-xs text-fg-muted`,children:I}),t[18]=I,t[19]=L);let R;t[20]===o.contextPickerDone?R=t[21]:(R=(0,$.jsx)(d,{asChild:!0,children:(0,$.jsx)(P,{type:`button`,variant:`primary`,className:`h-9`,children:o.contextPickerDone})}),t[20]=o.contextPickerDone,t[21]=R);let z;return t[22]!==L||t[23]!==R?(z=(0,$.jsxs)(`footer`,{className:`flex shrink-0 items-center justify-between border-t border-edge px-5 py-3`,children:[L,R]}),t[22]=L,t[23]=R,t[24]=z):z=t[24],(0,$.jsxs)(h,{children:[(0,$.jsx)(l,{asChild:!0,children:(0,$.jsxs)(P,{type:`button`,variant:`secondary`,className:`h-9 w-full justify-between rounded-lg px-3 text-xs`,disabled:!n,children:[(0,$.jsx)(`span`,{children:o.contextPickerLabel}),(0,$.jsxs)(`span`,{className:`flex items-center gap-1 text-fg-muted`,children:[i.length?o.contextPickerCount.replace(`{{count}}`,String(i.length)):o.contextPickerEmpty,O]})]})}),(0,$.jsxs)(f,{children:[A,(0,$.jsxs)(p,{className:`fixed left-1/2 top-1/2 z-50 flex h-[min(42rem,calc(100vh-2rem))] w-[min(44rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-base shadow-xl`,children:[(0,$.jsxs)(`header`,{className:`flex shrink-0 items-start justify-between gap-4 border-b border-edge px-5 py-4`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(m,{className:`text-base font-semibold text-fg`,children:o.contextPickerTitle}),(0,$.jsx)(u,{className:`mt-1 text-xs text-fg-muted`,children:o.contextPickerDescription})]}),(0,$.jsx)(d,{asChild:!0,children:(0,$.jsx)(P,{type:`button`,variant:`ghost`,className:`size-8 p-0`,"aria-label":o.pickStartClose,children:j})})]}),F,z]})]})]})}function cr(e,t){return(0,$.jsx)(I,{className:`h-14 rounded-xl`},t)}function lr(e){let t=(0,Q.c)(14),{title:n,icon:r,empty:i,items:a,selected:o,kind:s,onToggle:c}=e,l;t[0]===r?l=t[1]:(l=(0,$.jsx)(r,{className:`size-4 text-fg-subtle`,"aria-hidden":!0}),t[0]=r,t[1]=l);let u;t[2]!==l||t[3]!==n?(u=(0,$.jsxs)(`h3`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[l,n]}),t[2]=l,t[3]=n,t[4]=u):u=t[4];let d;t[5]!==i||t[6]!==a||t[7]!==s||t[8]!==c||t[9]!==o?(d=a.length?(0,$.jsx)(`div`,{className:`mt-2 grid gap-2 sm:grid-cols-2`,children:a.map(e=>{let t=o.some(t=>t.kind===s&&t.id===e.id);return(0,$.jsxs)(`button`,{type:`button`,className:M(`flex min-w-0 items-start gap-3 rounded-xl border p-3 text-left`,t?`border-accent bg-accent-soft`:`border-edge-subtle hover:bg-surface-hover`),"aria-pressed":t,onClick:()=>c({kind:s,id:e.id,role:s===`task`?`objective`:`reference`,title:e.title}),children:[(0,$.jsx)(`span`,{className:M(`mt-0.5 flex size-5 shrink-0 items-center justify-center rounded-md border`,t?`border-accent bg-accent text-white`:`border-edge`),children:t?(0,$.jsx)(g,{className:`size-3.5`,"aria-hidden":!0}):null}),(0,$.jsxs)(`span`,{className:`min-w-0`,children:[(0,$.jsx)(`strong`,{className:`block truncate text-sm font-medium text-fg`,children:e.title}),e.subtitle?(0,$.jsx)(`span`,{className:`mt-0.5 line-clamp-2 block text-xs text-fg-muted`,children:e.subtitle}):null]})]},e.id)})}):(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:i}),t[5]=i,t[6]=a,t[7]=s,t[8]=c,t[9]=o,t[10]=d):d=t[10];let f;return t[11]!==u||t[12]!==d?(f=(0,$.jsxs)(`section`,{children:[u,d]}),t[11]=u,t[12]=d,t[13]=f):f=t[13],f}function ur(e){let t=(0,Q.c)(54),{graph:n,language:r,className:i}=e,a;t[0]===r?a=t[1]:(a=hr(r),t[0]=r,t[1]=a);let o=a,[s,c]=(0,Z.useState)(n.nodes.find(dr)?.id??n.nodes[0]?.id),l;if(t[2]!==o.kind||t[3]!==n.nodes){let e;t[5]===o.kind?e=t[6]:(e=e=>({id:e.id,type:`definitionNode`,position:e.position,data:{definitionNode:e,kindLabel:o.kind[e.kind]}}),t[5]=o.kind,t[6]=e),l=n.nodes.map(e),t[2]=o.kind,t[3]=n.nodes,t[4]=l}else l=t[4];let u=l,d;if(t[7]!==o.no||t[8]!==o.yes||t[9]!==n.edges){let e;t[11]!==o.no||t[12]!==o.yes?(e=e=>({id:e.id,source:e.source,target:e.target,sourceHandle:e.sourcePort===`true`||e.sourcePort===`false`?e.sourcePort:void 0,label:e.sourcePort===`true`?o.yes:e.sourcePort===`false`?o.no:void 0,labelStyle:{fill:`var(--color-fg-subtle)`,fontSize:10},labelBgStyle:{fill:`var(--color-surface-panel)`,fillOpacity:.9},markerEnd:{type:xt.ArrowClosed},style:{stroke:`var(--color-fg-subtle)`,strokeWidth:1.5}}),t[11]=o.no,t[12]=o.yes,t[13]=e):e=t[13],d=n.edges.map(e),t[7]=o.no,t[8]=o.yes,t[9]=n.edges,t[10]=d}else d=t[10];let f=d,p=n.nodes,m,h,g,_,v,y;if(t[14]!==i||t[15]!==o.ariaLabel||t[16]!==o.empty||t[17]!==o.kind||t[18]!==o.selectHint||t[19]!==f||t[20]!==n.nodes||t[21]!==u||t[22]!==s){m=Symbol.for(`react.early_return_sentinel`);bb0:{let e;t[29]===s?e=t[30]:(e=e=>e.id===s,t[29]=s,t[30]=e);let r=p.find(e);if(n.nodes.length===0){let e;t[31]===i?e=t[32]:(e=M(`flex min-h-72 items-center justify-center bg-surface-base/40 px-6 text-center text-sm text-fg-muted`,i),t[31]=i,t[32]=e);let n;t[33]!==o.empty||t[34]!==e?(n=(0,$.jsx)(`div`,{className:e,children:o.empty}),t[33]=o.empty,t[34]=e,t[35]=n):n=t[35],m=n;break bb0}t[36]===i?_=t[37]:(_=M(`overflow-hidden bg-surface-base/45`,i),t[36]=i,t[37]=_),v=o.ariaLabel;let a;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(a=(e,t)=>c(t.id),t[38]=a):a=t[38];let l;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(l={padding:.24,minZoom:.45,maxZoom:1},t[39]=l):l=t[39];let d,b,x;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(d={hideAttribution:!0},b=(0,$.jsx)(Ot,{color:`var(--color-edge)`,gap:22,size:1}),x=(0,$.jsx)(wt,{showInteractive:!1,className:`!border-edge !bg-surface-panel !shadow-surface`}),t[40]=d,t[41]=b,t[42]=x):(d=t[40],b=t[41],x=t[42]),t[43]!==f||t[44]!==u?(y=(0,$.jsx)(`div`,{className:`h-[22rem] min-h-72`,children:(0,$.jsxs)(Tt,{nodes:u,edges:f,nodeTypes:mr,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!0,onNodeClick:a,fitView:!0,fitViewOptions:l,minZoom:.3,maxZoom:1.25,panOnScroll:!0,zoomOnDoubleClick:!1,proOptions:d,children:[b,x]})}),t[43]=f,t[44]=u,t[45]=y):y=t[45],h=`flex min-h-16 items-start gap-3 border-t border-edge bg-surface-panel px-4 py-3`,g=r?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`mt-0.5 flex size-7 shrink-0 items-center justify-center rounded-lg bg-accent-soft text-accent-fg`,children:pr(r.kind)}),(0,$.jsxs)(`span`,{className:`min-w-0`,children:[(0,$.jsx)(`strong`,{className:`block text-sm font-medium text-fg`,children:r.title}),(0,$.jsx)(`span`,{className:`mt-0.5 block text-xs leading-5 text-fg-muted`,children:r.description||o.kind[r.kind]})]})]}):(0,$.jsx)(`span`,{className:`text-xs text-fg-muted`,children:o.selectHint})}t[14]=i,t[15]=o.ariaLabel,t[16]=o.empty,t[17]=o.kind,t[18]=o.selectHint,t[19]=f,t[20]=n.nodes,t[21]=u,t[22]=s,t[23]=m,t[24]=h,t[25]=g,t[26]=_,t[27]=v,t[28]=y}else m=t[23],h=t[24],g=t[25],_=t[26],v=t[27],y=t[28];if(m!==Symbol.for(`react.early_return_sentinel`))return m;let b;t[46]!==h||t[47]!==g?(b=(0,$.jsx)(`div`,{className:h,children:g}),t[46]=h,t[47]=g,t[48]=b):b=t[48];let x;return t[49]!==b||t[50]!==_||t[51]!==v||t[52]!==y?(x=(0,$.jsxs)(`section`,{className:_,"aria-label":v,children:[y,b]}),t[49]=b,t[50]=_,t[51]=v,t[52]=y,t[53]=x):x=t[53],x}function dr(e){return e.kind===`agent`}function fr(e){let t=(0,Q.c)(25),{data:n,selected:r}=e,i=n.definitionNode,a=r?`border-accent ring-2 ring-accent/20`:`border-edge`,o;t[0]===a?o=t[1]:(o=M(`w-48 rounded-xl border bg-surface-panel p-3 shadow-surface transition-colors`,a),t[0]=a,t[1]=o);let s;t[2]===i.kind?s=t[3]:(s=i.kind===`input`?null:(0,$.jsx)(Et,{type:`target`,position:Ct.Left,className:`!invisible`}),t[2]=i.kind,t[3]=s);let c;t[4]===i.kind?c=t[5]:(c=pr(i.kind),t[4]=i.kind,t[5]=c);let l;t[6]===c?l=t[7]:(l=(0,$.jsx)(`span`,{className:`mt-0.5 flex size-7 shrink-0 items-center justify-center rounded-lg bg-accent-soft text-accent-fg`,children:c}),t[6]=c,t[7]=l);let u;t[8]===i.title?u=t[9]:(u=(0,$.jsx)(`strong`,{className:`block truncate text-sm font-medium text-fg`,children:i.title}),t[8]=i.title,t[9]=u);let d;t[10]===n.kindLabel?d=t[11]:(d=(0,$.jsx)(`span`,{className:`mt-1 block text-xs text-fg-subtle`,children:n.kindLabel}),t[10]=n.kindLabel,t[11]=d);let f;t[12]!==u||t[13]!==d?(f=(0,$.jsxs)(`span`,{className:`min-w-0`,children:[u,d]}),t[12]=u,t[13]=d,t[14]=f):f=t[14];let p;t[15]!==l||t[16]!==f?(p=(0,$.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[l,f]}),t[15]=l,t[16]=f,t[17]=p):p=t[17];let m;t[18]===i.kind?m=t[19]:(m=i.kind===`decision`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Et,{id:`true`,type:`source`,position:Ct.Right,style:{top:`38%`},className:`!invisible`}),(0,$.jsx)(Et,{id:`false`,type:`source`,position:Ct.Right,style:{top:`70%`},className:`!invisible`})]}):i.kind===`output`?null:(0,$.jsx)(Et,{type:`source`,position:Ct.Right,className:`!invisible`}),t[18]=i.kind,t[19]=m);let h;return t[20]!==m||t[21]!==o||t[22]!==s||t[23]!==p?(h=(0,$.jsxs)(`div`,{className:o,children:[s,p,m]}),t[20]=m,t[21]=o,t[22]=s,t[23]=p,t[24]=h):h=t[24],h}function pr(e){return e===`input`?(0,$.jsx)(ye,{className:`size-4`,"aria-hidden":!0}):e===`agent`?(0,$.jsx)(te,{className:`size-4`,"aria-hidden":!0}):e===`decision`?(0,$.jsx)(ot,{className:`size-4`,"aria-hidden":!0}):e===`merge`?(0,$.jsx)(z,{className:`size-4`,"aria-hidden":!0}):(0,$.jsx)(je,{className:`size-4`,"aria-hidden":!0})}var mr={definitionNode:fr};function hr(e){return e===`zh`?{ariaLabel:`工作流步骤图`,empty:`这个工作流还没有可展示的步骤。`,selectHint:`点击步骤查看它的作用。`,yes:`是`,no:`否`,kind:{input:`任务输入`,agent:`AI 执行`,decision:`条件判断`,merge:`汇总结果`,output:`最终结果`}}:{ariaLabel:`Workflow step map`,empty:`This workflow has no steps to display yet.`,selectHint:`Select a step to see what it does.`,yes:`Yes`,no:`No`,kind:{input:`Task input`,agent:`AI work`,decision:`Decision`,merge:`Combine results`,output:`Deliverable`}}}function gr(e){let t=(0,Q.c)(54),{graph:n,view:r,language:i,onRepair:a}=e,[o,s]=(0,Z.useState)(),c=(0,Z.useRef)(null),l=(0,Z.useRef)(void 0),u;t[0]===i?u=t[1]:(u=Tr(i),t[0]=i,t[1]=u);let d=u,f;t[2]===r.nodes?f=t[3]:(f=new Map(r.nodes.map(xr)),t[2]=r.nodes,t[3]=f);let p=f,m;if(t[4]!==n.nodes||t[5]!==p){let e;t[7]===p?e=t[8]:(e=e=>({id:e.id,type:`runNode`,position:e.position,data:{definitionNode:e,runNode:p.get(e.id)}}),t[7]=p,t[8]=e),m=n.nodes.map(e),t[4]=n.nodes,t[5]=p,t[6]=m}else m=t[6];let h=m,_;if(t[9]!==n.edges||t[10]!==p){let e;t[12]===p?e=t[13]:(e=e=>({id:e.id,source:e.source,target:e.target,sourceHandle:e.sourcePort===`true`||e.sourcePort===`false`?e.sourcePort:void 0,markerEnd:{type:xt.ArrowClosed},animated:p.get(e.source)?.status===`running`,style:{stroke:p.get(e.source)?.status===`done`?`var(--color-success)`:`var(--color-fg-subtle)`,strokeWidth:1.5}}),t[12]=p,t[13]=e),_=n.edges.map(e),t[9]=n.edges,t[10]=p,t[11]=_}else _=t[11];let v=_,y;t[14]!==o||t[15]!==p?(y=o?p.get(o):void 0,t[14]=o,t[15]=p,t[16]=y):y=t[16];let b=y,x;t[17]!==n.nodes||t[18]!==o?(x=o?n.nodes.find(e=>e.id===o):void 0,t[17]=n.nodes,t[18]=o,t[19]=x):x=t[19];let S=x,C;t[20]===r.nodes?C=t[21]:(C=r.nodes.some(br),t[20]=r.nodes,t[21]=C);let w=C,T,E;t[22]===r.nodes?(T=t[23],E=t[24]):(T=()=>{let e=r.nodes.find(yr)??r.nodes.find(vr)??[...r.nodes].reverse().find(_r);if(!e||l.current===e.id)return;l.current=e.id,s(e.id);let t=window.requestAnimationFrame(()=>{c.current?.fitView({nodes:[{id:e.id}],padding:1.4,minZoom:.65,maxZoom:1,duration:300})});return()=>window.cancelAnimationFrame(t)},E=[r.nodes],t[22]=r.nodes,t[23]=T,t[24]=E),(0,Z.useEffect)(T,E);let D;t[25]===d.title?D=t[26]:(D=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:d.title}),t[25]=d.title,t[26]=D);let O;t[27]===d.hint?O=t[28]:(O=(0,$.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:d.hint}),t[27]=d.hint,t[28]=O);let k;t[29]!==D||t[30]!==O?(k=(0,$.jsxs)(`div`,{children:[D,O]}),t[29]=D,t[30]=O,t[31]=k):k=t[31];let A;t[32]!==d.repair||t[33]!==w||t[34]!==a?(A=w&&a?(0,$.jsxs)(P,{variant:`secondary`,className:`h-8 text-xs`,onClick:a,children:[(0,$.jsx)(R,{className:`size-3.5`}),d.repair]}):null,t[32]=d.repair,t[33]=w,t[34]=a,t[35]=A):A=t[35];let j;t[36]!==k||t[37]!==A?(j=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[k,A]}),t[36]=k,t[37]=A,t[38]=j):j=t[38];let N,F;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(N=(e,t)=>s(t.id),F=e=>{c.current=e},t[39]=N,t[40]=F):(N=t[39],F=t[40]);let I,L;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(I={hideAttribution:!0},L=(0,$.jsx)(Ot,{color:`var(--color-edge)`,gap:22,size:1}),t[41]=I,t[42]=L):(I=t[41],L=t[42]);let z;t[43]!==v||t[44]!==h?(z=(0,$.jsx)(`div`,{className:`h-[28rem]`,children:(0,$.jsx)(Tt,{nodes:h,edges:v,nodeTypes:wr,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!0,onNodeClick:N,onInit:F,fitView:!0,minZoom:.3,maxZoom:1.25,panOnScroll:!0,zoomOnDoubleClick:!1,proOptions:I,children:L})}),t[43]=v,t[44]=h,t[45]=z):z=t[45];let B;t[46]!==d.status||t[47]!==b||t[48]!==S?(B=b?(0,$.jsxs)(`div`,{className:M(`flex items-start gap-2 border-t border-edge px-4 py-3 text-xs`,b.status===`error`?`text-danger`:`text-fg-muted`),children:[b.status===`error`?(0,$.jsx)(_e,{className:`mt-0.5 size-3.5 shrink-0`}):b.status===`done`?(0,$.jsx)(g,{className:`mt-0.5 size-3.5 shrink-0 text-success`}):null,(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`strong`,{className:`font-medium text-fg`,children:b.title}),S?.description?(0,$.jsx)(`span`,{className:`block pt-0.5 text-fg-subtle`,children:S.description}):null,(0,$.jsx)(`span`,{className:`block pt-1`,children:b.error||b.resultPreview||d.status[b.status]})]})]}):null,t[46]=d.status,t[47]=b,t[48]=S,t[49]=B):B=t[49];let V;return t[50]!==j||t[51]!==z||t[52]!==B?(V=(0,$.jsxs)(`section`,{className:`mt-5 overflow-hidden rounded-2xl border border-edge bg-surface-base/35`,children:[j,z,B]}),t[50]=j,t[51]=z,t[52]=B,t[53]=V):V=t[53],V}function _r(e){return e.status===`done`}function vr(e){return e.status===`error`}function yr(e){return e.status===`running`}function br(e){return e.status===`error`}function xr(e){return[e.id,e]}function Sr(e){let t=(0,Q.c)(30),{data:n,selected:r}=e,i=n.definitionNode,a=n.runNode?.status??`pending`,o;t[0]===i.kind?o=t[1]:(o=i.kind===`input`?(0,$.jsx)(ye,{}):i.kind===`agent`?(0,$.jsx)(te,{}):i.kind===`decision`?(0,$.jsx)(ot,{}):i.kind===`merge`?(0,$.jsx)(z,{}):(0,$.jsx)(je,{}),t[0]=i.kind,t[1]=o);let s=o,c=a===`running`&&`border-accent ring-2 ring-accent/20`,l=a===`done`&&`border-success/50`,u=a===`error`&&`border-danger ring-2 ring-danger/15`,d=(a===`pending`||a===`skipped`)&&`border-edge opacity-70`,f=r&&`ring-2 ring-accent/25`,p;t[2]!==c||t[3]!==l||t[4]!==u||t[5]!==d||t[6]!==f?(p=M(`w-48 rounded-xl border bg-surface-panel px-3 py-2.5 shadow-surface`,c,l,u,d,f),t[2]=c,t[3]=l,t[4]=u,t[5]=d,t[6]=f,t[7]=p):p=t[7];let m;t[8]===i.kind?m=t[9]:(m=i.kind===`input`?null:(0,$.jsx)(Et,{type:`target`,position:Ct.Left,className:`!invisible`}),t[8]=i.kind,t[9]=m);let h;t[10]===s?h=t[11]:(h=(0,$.jsx)(`span`,{className:`[&>svg]:size-4 text-fg-subtle`,children:s}),t[10]=s,t[11]=h);let g;t[12]===i.title?g=t[13]:(g=(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm font-medium text-fg`,children:i.title}),t[12]=i.title,t[13]=g);let _;t[14]===a?_=t[15]:(_=(0,$.jsx)(Cr,{status:a}),t[14]=a,t[15]=_);let v;t[16]!==g||t[17]!==_||t[18]!==h?(v=(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[h,g,_]}),t[16]=g,t[17]=_,t[18]=h,t[19]=v):v=t[19];let y;t[20]===i.description?y=t[21]:(y=i.description?(0,$.jsx)(`p`,{className:`mt-1.5 line-clamp-2 text-xs leading-4 text-fg-muted`,children:i.description}):null,t[20]=i.description,t[21]=y);let b;t[22]===i.kind?b=t[23]:(b=i.kind===`decision`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Et,{id:`true`,type:`source`,position:Ct.Right,className:`!invisible`}),(0,$.jsx)(Et,{id:`false`,type:`source`,position:Ct.Right,className:`!invisible`})]}):i.kind===`output`?null:(0,$.jsx)(Et,{type:`source`,position:Ct.Right,className:`!invisible`}),t[22]=i.kind,t[23]=b);let x;return t[24]!==v||t[25]!==y||t[26]!==b||t[27]!==p||t[28]!==m?(x=(0,$.jsxs)(`div`,{className:p,children:[m,v,y,b]}),t[24]=v,t[25]=y,t[26]=b,t[27]=p,t[28]=m,t[29]=x):x=t[29],x}function Cr(e){let t=(0,Q.c)(4),{status:n}=e;if(n===`done`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(`span`,{className:`flex size-5 items-center justify-center rounded-full bg-success-soft text-success`,children:(0,$.jsx)(g,{className:`size-3`})}),t[0]=e):e=t[0],e}if(n===`error`){let e;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(`span`,{className:`flex size-5 items-center justify-center rounded-full bg-danger/10 text-danger`,children:(0,$.jsx)(_e,{className:`size-3`})}),t[1]=e):e=t[1],e}if(n===`running`){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(`span`,{className:`size-2.5 animate-pulse rounded-full bg-accent motion-reduce:animate-none`}),t[2]=e):e=t[2],e}let r;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(`span`,{className:`size-2 rounded-full bg-edge-strong`}),t[3]=r):r=t[3],r}var wr={runNode:Sr};function Tr(e){return e===`zh`?{title:`运行过程`,hint:`点选步骤查看当前结果;画布会随着执行自动更新。`,repair:`修复这个工作流`,status:{pending:`等待中`,running:`执行中`,done:`已完成`,error:`失败`,skipped:`已跳过`}}:{title:`Live workflow`,hint:`Select a step to inspect it. The canvas updates as work progresses.`,repair:`Repair workflow`,status:{pending:`Waiting`,running:`Running`,done:`Completed`,error:`Failed`,skipped:`Skipped`}}}function Er(e,t){return t.status[e]??e}function Dr(e,t){return t.phaseStatus[e]??e}function Or(e,t){let{run:n}=e;return n.status===`succeeded`?X(t.runSummarySucceeded,{agents:n.metrics.doneAgentCount,artifacts:n.metrics.artifactCount}):n.status===`failed`||n.status===`timeout`?n.error?.message??t.runSummaryFailedFallback:n.status===`cancelled`?t.runSummaryCancelled:X(t.runSummaryActive,{done:n.metrics.doneAgentCount,total:n.metrics.agentCount})}function kr(e,t){let{run:n}=e;return n.status===`failed`?t.diagnosticFailedHint:n.status===`timeout`?t.diagnosticTimeoutHint:n.status===`cancelled`?t.diagnosticCancelledHint:n.status===`succeeded`&&n.metrics.errorAgentCount>0?t.diagnosticPartialHint:null}function Ar(e){return Ce(e)}function jr({view:e,comparison:t,loading:n,language:r,localeTag:i,activeTab:o,onTabChange:s,onCancel:c,onRetry:l,onReplay:u,onOpenRunId:d,ownerAgentId:f,onRepairWorkflow:p}){let m=k(r).workflows,h=ve(r),_=a(),[v,y]=(0,Z.useState)(!1),[S,w]=(0,Z.useState)(!1),[T,E]=(0,Z.useState)(null),[D,A]=(0,Z.useState)(!1),[j,N]=(0,Z.useState)(null),[F,z]=(0,Z.useState)(null),[,B]=(0,Z.useState)(0),V=e?.run.status,U=V?Ze.has(V):!1;(0,Z.useEffect)(()=>{e?.run.id&&(y(!1),N(null))},[e?.run.id,U,V,e?.run.metrics.errorAgentCount]),(0,Z.useEffect)(()=>{if(!U)return;let e=window.setInterval(()=>B(e=>e+1),1e3);return()=>window.clearInterval(e)},[U]);let W=(0,Z.useMemo)(()=>e?ct(e):null,[e]),G=(0,Z.useMemo)(()=>W?H(W):{phases:[],unphased:null},[W]),K=(0,Z.useMemo)(()=>T==null||!W?null:W.agents.find(e=>e.id===T)??null,[T,W]);(0,Z.useEffect)(()=>{W?.runId&&E((W.agents.find(e=>e.status===`error`||e.status===`skipped`)??W.agents.find(e=>e.status===`running`)??null)?.id??null)},[W?.runId]);let te=(0,Z.useCallback)(e=>{E(e.id)},[]),re=(0,Z.useMemo)(()=>e?ne(e):[],[e]),J=e?xe(e.run.result):void 0,ie=J?$r(J):null,ae=J?st(J):``,oe=!!J,se=(0,Z.useCallback)(async()=>{oe&&await O(ae)&&(A(!0),window.setTimeout(()=>A(!1),1500))},[oe,ae]),ce=(0,Z.useCallback)(()=>{if(!oe||!e)return;let t=new Blob([ae],{type:`text/markdown;charset=utf-8`}),n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=`${e.run.definitionId}-${e.run.id.slice(0,8)}.md`,r.click(),URL.revokeObjectURL(n)},[oe,ae,e]),le=(0,Z.useCallback)(()=>{if(!e)return;let t=Ar(e);t&&_(Fe(t))},[_,e]),ue=(0,Z.useCallback)(async t=>{if(e){N(null),z(t.id);try{Zr(await Je(e.run.id,t.id,{ownerAgentId:f}),t.name||t.id)}catch(e){N(e instanceof Error?e.message:String(e))}finally{z(null)}}},[f,e]),de=(0,Z.useCallback)(t=>{if(!e||!t.prompt)return;let n=Ar(e);if(!n){O(t.prompt);return}_(Fe(n,t.prompt))},[_,e]),pe=(0,Z.useCallback)(e=>{if(e.kind===`copy_result`){se();return}if(e.kind===`open_artifact`){let t=ti(e.payload),n=ie?.artifacts.find(e=>e.id===t||e.name===t);n&&ue(n);return}let t=ti(e.payload),n=ie?.followUps.find(e=>e.id===t);if(n?.prompt){de(n);return}let r=ni(e.payload);r&&de({id:e.id,title:e.label,prompt:r})},[se,ue,de,ie?.artifacts,ie?.followUps]),me=(0,Z.useCallback)(t=>{if(!e||t==null)return;let n=String(t),r=e.agents.findIndex(e=>String(e.id)===n);if(r<0)return;let i=Number.parseInt(n,10);E(Number.isFinite(i)?i:r+1)},[e]),he=e?Ar(e):null,ge=ie?.actions.filter(e=>ri(e,ie))??[],_e=ge.some(e=>e.kind===`copy_result`);if(n)return(0,$.jsx)(`main`,{className:`min-h-0 flex-1 overflow-y-auto bg-surface-panel p-5`,children:(0,$.jsxs)(`div`,{className:`mx-auto w-full max-w-6xl`,"aria-busy":!0,children:[(0,$.jsx)(I,{className:`h-8 w-72 max-w-full`}),(0,$.jsx)(I,{className:`mt-4 h-28 rounded-2xl`}),(0,$.jsx)(I,{className:`mt-5 h-[28rem] rounded-2xl`})]})});if(!e||!W)return null;let{run:Y}=e,ye=e.controls.canCancel&&U,be=U&&Y.startedAtMs!=null?nt(Date.now()-Y.startedAtMs):nt(Y.metrics.durationMs??void 0),Se=Or(e,m),Ce=kr(e,m),we=e.controls.canRetry&&e.agents.some(e=>(e.status===`error`||e.status===`skipped`)&&e.prompt?.trim()),Te=e.controls.canRetry&&(e.phases.some(t=>t.status===`failed`&&e.agents.some(e=>e.phaseId===t.id&&e.prompt?.trim()))||e.agents.some(e=>(e.status===`error`||e.status===`skipped`)&&e.phaseId&&e.prompt?.trim())),Ee=Y.goal?.trim()||Y.title,De=e.nodes.find(e=>e.status===`running`)??e.nodes.find(e=>e.status===`error`)??[...e.nodes].reverse().find(e=>e.status===`done`),Oe=De?.kind===`output`&&!De.error?J?.summary??De.resultPreview:null,ke=Oe??(De?De.error||(r===`zh`?`${De.status===`running`?`正在执行`:De.status===`done`?`刚刚完成`:`需要处理`}:${De.title}`:`${De.status===`running`?`Working on`:De.status===`done`?`Just completed`:`Needs attention`}: ${De.title}`):Se),Ae=re.length>0||!!Ce,je=(Y.status===`failed`||Y.status===`timeout`)&&!!p,Me=o===`diagnostics`||o===`debug`?`process`:o;return(0,$.jsx)(`main`,{className:`min-h-0 flex-1 overflow-y-auto bg-surface-panel`,children:(0,$.jsxs)(`section`,{className:`mx-auto w-full max-w-6xl p-5`,children:[(0,$.jsxs)(`header`,{className:`rounded-2xl border border-edge-subtle bg-surface-base/60 p-4`,children:[(0,$.jsx)(`div`,{className:`flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between`,children:(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`h2`,{className:`text-lg font-semibold leading-7 text-fg`,children:Ee}),(0,$.jsx)(`span`,{className:M(`rounded-full px-2 py-0.5 text-xs font-medium`,L(Y.status)),children:Er(Y.status,m)})]}),(0,$.jsxs)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:[Y.title,` · `,Y.definitionId]}),(0,$.jsx)(`p`,{className:`mt-3 text-sm leading-6 text-fg-muted`,children:Se}),Ce?(0,$.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-subtle`,children:Ce}):null,(0,$.jsxs)(`div`,{className:M(`mt-4 rounded-xl border px-3 py-2.5`,De?.status===`error`?`border-danger/30 bg-danger/5`:`border-accent/20 bg-accent-soft/50`),children:[(0,$.jsx)(`div`,{className:`text-[11px] font-medium uppercase tracking-wide text-fg-subtle`,children:r===`zh`?`当前状态`:`Current status`}),Oe?(0,$.jsx)(`div`,{className:`mt-2 max-h-40 overflow-hidden [mask-image:linear-gradient(to_bottom,black_calc(100%-1.5rem),transparent)]`,children:(0,$.jsx)(C,{content:ke,compact:!0,className:`workflow-status-markdown`,codeCopy:!1,renderMermaid:!1})}):(0,$.jsx)(`p`,{className:`mt-1 text-sm font-medium text-fg`,children:ke})]})]})}),(0,$.jsxs)(`dl`,{className:`mt-4 grid gap-3 sm:grid-cols-2 lg:grid-cols-4`,children:[(0,$.jsx)(ci,{label:m.metrics.startedAt,value:q(Y.startedAtMs??Y.createdAtMs,i)}),(0,$.jsx)(ci,{label:m.metrics.duration,value:be}),(0,$.jsx)(ci,{label:m.metrics.agents,value:X(m.agentProgress,{done:Y.metrics.doneAgentCount,total:Y.metrics.agentCount})}),(0,$.jsx)(ci,{label:m.metrics.artifacts,value:String(Y.metrics.artifactCount)})]})]}),(0,$.jsx)(Nr,{activeTab:Me,onChange:s,labels:m,artifactCount:ie?.artifacts.length??e.artifacts.length}),Me===`result`?(0,$.jsxs)(`section`,{className:`mt-5 space-y-4`,children:[oe?(0,$.jsxs)(`section`,{className:`overflow-hidden rounded-2xl border border-edge bg-surface-base`,children:[(0,$.jsxs)(`header`,{className:`flex flex-col gap-3 border-b border-edge-subtle bg-surface-panel/45 px-4 py-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:m.resultTitle}),(0,$.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:m.resultReadyHint})]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[he?(0,$.jsxs)(P,{variant:`primary`,className:`h-8 text-xs`,onClick:le,children:[(0,$.jsx)(fe,{className:`size-3.5`,"aria-hidden":!0}),m.continueInChat]}):null,ge.map(e=>(0,$.jsx)(P,{variant:`secondary`,className:`h-8 text-xs`,onClick:()=>pe(e),children:e.label},e.id)),_e?null:(0,$.jsxs)(P,{variant:`secondary`,className:`h-8 text-xs`,onClick:se,children:[D?(0,$.jsx)(g,{className:`size-3.5`,"aria-hidden":!0}):(0,$.jsx)(b,{className:`size-3.5`,"aria-hidden":!0}),D?m.copied:m.copyResult]}),(0,$.jsxs)(P,{variant:`secondary`,className:`h-8 text-xs`,onClick:ce,children:[(0,$.jsx)(x,{className:`size-3.5`,"aria-hidden":!0}),m.exportResult]})]})]}),(0,$.jsx)(`div`,{className:`px-5 py-6 sm:px-8 sm:py-8`,children:(0,$.jsx)(`div`,{className:`mx-auto w-full max-w-4xl`,children:(0,$.jsx)(gt,{result:J,labels:h.result})})})]}):Y.status!==`failed`&&Y.status!==`timeout`?(0,$.jsx)(`div`,{className:`rounded-xl border border-dashed border-edge p-4 text-sm text-fg-muted`,children:m.noResult}):null,Y.status===`failed`||Y.status===`timeout`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`section`,{className:`flex flex-col gap-3 rounded-2xl border border-amber-500/25 bg-amber-500/5 p-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:m.recoveryActionsTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:Ce})]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[je?(0,$.jsxs)(P,{variant:`primary`,onClick:p,children:[(0,$.jsx)(Ue,{className:`size-4`,"aria-hidden":!0}),r===`zh`?`让 AI 修复`:`Fix with AI`]}):null,we?(0,$.jsxs)(P,{variant:`secondary`,onClick:()=>u(`failed_agents`),children:[(0,$.jsx)(R,{className:`size-4`,"aria-hidden":!0}),m.replayFailedAgents]}):null,Te?(0,$.jsxs)(P,{variant:`secondary`,onClick:()=>u(`failed_phases`),children:[(0,$.jsx)(R,{className:`size-4`,"aria-hidden":!0}),m.replayFailedPhases]}):null,e.controls.canRetry?(0,$.jsxs)(P,{variant:`secondary`,onClick:l,children:[(0,$.jsx)(R,{className:`size-4`,"aria-hidden":!0}),m.rerun]}):null]})]}),(0,$.jsx)(Wr,{view:e,language:r})]}):null,ie?(0,$.jsx)(Xr,{task:ie,labels:m,downloadingArtifactId:F,downloadError:j,onCopyText:e=>void O(e),onDownloadArtifact:e=>void ue(e),onStartFollowUp:de,compact:!0}):null,ye?(0,$.jsx)(`div`,{className:`flex justify-end`,children:(0,$.jsxs)(P,{variant:`secondary`,onClick:c,className:`text-red-600 dark:text-red-300`,children:[(0,$.jsx)(ee,{className:`size-4`,"aria-hidden":!0}),m.cancel]})}):null]}):null,Me===`process`?(0,$.jsxs)($.Fragment,{children:[e.run.metadata?.definition.graph?(0,$.jsx)(gr,{graph:e.run.metadata.definition.graph,view:e,language:r,onRepair:p}):null,Ae?(0,$.jsx)(Mr,{diagnostics:re,labels:m,hint:Ce,onOpenAgent:me}):null,(0,$.jsx)(Pr,{snapshot:W,rollup:G,view:e,labels:m,cardLabels:h,isActive:U,processExpanded:v,logsExpanded:S,selectedAgentId:T,selectedAgent:K,durationText:be,onToggleProcess:()=>y(e=>!e),onToggleLogs:()=>w(e=>!e),onSelectAgent:te}),(0,$.jsx)(Br,{view:e,comparison:t,labels:m,onOpenRunId:d}),(0,$.jsx)(Vr,{view:e,labels:m})]}):null,Me===`artifacts`?(0,$.jsx)(Xr,{task:ie,labels:m,downloadingArtifactId:F,downloadError:j,onCopyText:e=>void O(e),onDownloadArtifact:e=>void ue(e),onStartFollowUp:de}):null]})})}function Mr(e){let t=(0,Q.c)(13),{diagnostics:n,labels:r,hint:i,onOpenAgent:a}=e;if(n.length===0&&!i)return null;let o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsx)(`div`,{className:`rounded-xl bg-rose-500/10 p-2 text-rose-700 dark:text-rose-300`,children:(0,$.jsx)(_e,{className:`size-4`,"aria-hidden":!0})}),t[0]=o):o=t[0];let s;t[1]===r.reliabilityTitle?s=t[2]:(s=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:r.reliabilityTitle}),t[1]=r.reliabilityTitle,t[2]=s);let c=i??r.reliabilityHint,l;t[3]===c?l=t[4]:(l=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:c}),t[3]=c,t[4]=l);let u;t[5]!==n||t[6]!==r||t[7]!==a?(u=n.length>0?(0,$.jsx)(`ul`,{className:`mt-3 space-y-2`,children:n.slice(0,5).map(e=>(0,$.jsx)(`li`,{className:`rounded-xl border border-edge-subtle bg-surface-panel px-3 py-2`,children:(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:zr(e,r)}),e.message?(0,$.jsx)(`div`,{className:`mt-0.5 text-xs leading-5 text-fg-muted`,children:e.message}):null,e.detail?(0,$.jsx)(`div`,{className:`mt-0.5 line-clamp-2 text-xs leading-5 text-fg-subtle`,children:e.detail}):null]}),e.agentId==null?null:(0,$.jsx)(P,{type:`button`,variant:`ghost`,className:`h-8 shrink-0 px-2 text-xs`,onClick:()=>a(e.agentId),children:r.openAgentDetails})]})},e.key))}):null,t[5]=n,t[6]=r,t[7]=a,t[8]=u):u=t[8];let d;return t[9]!==s||t[10]!==l||t[11]!==u?(d=(0,$.jsx)(`section`,{className:`mt-5 rounded-2xl border border-rose-500/20 bg-rose-500/5 p-4`,children:(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[o,(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[s,l,u]})]})}),t[9]=s,t[10]=l,t[11]=u,t[12]=d):d=t[12],d}function Nr(e){let t=(0,Q.c)(16),{activeTab:n,onChange:r,labels:i,artifactCount:a}=e,o;t[0]===i.resultTitle?o=t[1]:(o={id:`result`,label:i.resultTitle},t[0]=i.resultTitle,t[1]=o);let s;t[2]===i.process?s=t[3]:(s={id:`process`,label:i.process},t[2]=i.process,t[3]=s);let c=a||void 0,l;t[4]!==i.taskArtifacts||t[5]!==c?(l={id:`artifacts`,label:i.taskArtifacts,count:c},t[4]=i.taskArtifacts,t[5]=c,t[6]=l):l=t[6];let u;t[7]!==o||t[8]!==s||t[9]!==l?(u=[o,s,l],t[7]=o,t[8]=s,t[9]=l,t[10]=u):u=t[10];let d=u,f;return t[11]!==n||t[12]!==i.taskActionsAria||t[13]!==r||t[14]!==d?(f=(0,$.jsx)(`div`,{className:`mt-5 flex overflow-x-auto border-b border-edge pb-2`,children:(0,$.jsx)(_t,{items:d,activeTab:n,onChange:r,ariaLabel:i.taskActionsAria})}),t[11]=n,t[12]=i.taskActionsAria,t[13]=r,t[14]=d,t[15]=f):f=t[15],f}function Pr(e){let t=(0,Q.c)(37),{snapshot:n,rollup:r,view:i,labels:a,cardLabels:o,isActive:s,processExpanded:c,logsExpanded:l,selectedAgentId:u,selectedAgent:d,durationText:f,onToggleProcess:p,onToggleLogs:m,onSelectAgent:h}=e,g;t[0]===a.process?g=t[1]:(g=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:a.process}),t[0]=a.process,t[1]=g);let _;t[2]!==a.agentProgress||t[3]!==i.run.metrics.agentCount||t[4]!==i.run.metrics.doneAgentCount?(_=X(a.agentProgress,{done:i.run.metrics.doneAgentCount,total:i.run.metrics.agentCount}),t[2]=a.agentProgress,t[3]=i.run.metrics.agentCount,t[4]=i.run.metrics.doneAgentCount,t[5]=_):_=t[5];let v;t[6]!==f||t[7]!==_?(v=(0,$.jsxs)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:[_,` · `,f]}),t[6]=f,t[7]=_,t[8]=v):v=t[8];let y;t[9]!==g||t[10]!==v?(y=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[g,v]}),t[9]=g,t[10]=v,t[11]=y):y=t[11];let b=c?`rotate-180`:null,x;t[12]===b?x=t[13]:(x=M(`size-4 shrink-0 text-fg-subtle transition-transform`,b),t[12]=b,t[13]=x);let S;t[14]===x?S=t[15]:(S=(0,$.jsx)(ie,{className:x,"aria-hidden":!0}),t[14]=x,t[15]=S);let C;t[16]!==p||t[17]!==c||t[18]!==y||t[19]!==S?(C=(0,$.jsxs)(`button`,{type:`button`,className:`flex w-full items-center justify-between gap-4 px-4 py-3 text-left`,onClick:p,"aria-expanded":c,children:[y,S]}),t[16]=p,t[17]=c,t[18]=y,t[19]=S,t[20]=C):C=t[20];let w;t[21]!==o||t[22]!==s||t[23]!==a||t[24]!==l||t[25]!==h||t[26]!==m||t[27]!==c||t[28]!==r||t[29]!==d||t[30]!==u||t[31]!==n||t[32]!==i.phases?(w=c?(0,$.jsx)(`div`,{className:`border-t border-edge px-4 pb-4 pt-4`,children:(0,$.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-[minmax(0,1fr)_minmax(20rem,26rem)]`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[s?(0,$.jsx)(mt,{snapshot:n,labels:o,logsExpanded:l,onToggleLogs:m,selectedAgentId:u,onSelectAgent:h}):(0,$.jsx)(Ae,{rollup:r,currentPhase:n.currentPhase,labels:o.phase,recentLogs:n.logs,recentLogsHeading:o.recentLogsHeading,showAllLogsLabel:o.showAllLogs,logsExpanded:l,onToggleLogs:m,selectedAgentId:u,onSelectAgent:h}),i.phases.length>0?(0,$.jsx)(`div`,{className:`mt-4 grid gap-2 sm:grid-cols-2`,children:i.phases.map(e=>(0,$.jsx)(`div`,{className:`rounded-xl border border-edge bg-surface-panel px-3 py-2`,children:(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:e.title}),(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:Dr(e.status,a)})]})},e.id))}):null]}),(0,$.jsx)(Fr,{agent:d,snapshot:n,labels:a,cardLabels:o})]})}):null,t[21]=o,t[22]=s,t[23]=a,t[24]=l,t[25]=h,t[26]=m,t[27]=c,t[28]=r,t[29]=d,t[30]=u,t[31]=n,t[32]=i.phases,t[33]=w):w=t[33];let T;return t[34]!==C||t[35]!==w?(T=(0,$.jsxs)(`div`,{className:`mt-5 rounded-2xl border border-edge bg-surface-base/35`,children:[C,w]}),t[34]=C,t[35]=w,t[36]=T):T=t[36],T}function Fr(e){let t=(0,Q.c)(57),{agent:n,snapshot:r,labels:i,cardLabels:a}=e,[o,s]=(0,Z.useState)(!1),c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>{s(!1)},t[0]=c):c=t[0];let l=n?.id,u;if(t[1]===l?u=t[2]:(u=[l],t[1]=l,t[2]=u),(0,Z.useEffect)(c,u),!n){let e;return t[3]===i.noSubagents?e=t[4]:(e=(0,$.jsx)(`aside`,{className:`min-w-0 rounded-2xl border border-dashed border-edge bg-surface-panel/45 p-4 text-sm text-fg-muted`,children:i.noSubagents}),t[3]=i.noSubagents,t[4]=e),e}let d;t[5]===n?d=t[6]:(d=me(n),t[5]=n,t[6]=d);let f=d,p=n.error||n.resultPreview||n.currentStep||a.checkDetail.runningPlaceholder,m;t[7]===n.label?m=t[8]:(m=(0,$.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:n.label}),t[7]=n.label,t[8]=m);let h=n.phase||i.process,g;t[9]!==f||t[10]!==h?(g=[h,f].filter(Boolean),t[9]=f,t[10]=h,t[11]=g):g=t[11];let _=g.join(` · `),v;t[12]===_?v=t[13]:(v=(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:_}),t[12]=_,t[13]=v);let y;t[14]!==m||t[15]!==v?(y=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[m,v]}),t[14]=m,t[15]=v,t[16]=y):y=t[16];let b;t[17]===n.status?b=t[18]:(b=M(`rounded-full px-2 py-0.5 text-xs font-medium`,si(n.status)),t[17]=n.status,t[18]=b);let x=i.agentStatus[n.status]??n.status,S;t[19]!==b||t[20]!==x?(S=(0,$.jsx)(`span`,{className:b,children:x}),t[19]=b,t[20]=x,t[21]=S):S=t[21];let C;t[22]!==y||t[23]!==S?(C=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[y,S]}),t[22]=y,t[23]=S,t[24]=C):C=t[24];let w;t[25]===i.agentOutputHeading?w=t[26]:(w=(0,$.jsx)(`h4`,{className:`text-xs font-semibold text-fg`,children:i.agentOutputHeading}),t[25]=i.agentOutputHeading,t[26]=w);let T=n.error?`font-mono text-rose-600 dark:text-rose-400`:`text-fg-muted`,E;t[27]===T?E=t[28]:(E=M(`mt-2 max-h-72 overflow-auto whitespace-pre-wrap wrap-break-word text-sm leading-6`,T),t[27]=T,t[28]=E);let D;t[29]!==p||t[30]!==E?(D=(0,$.jsx)(`div`,{className:E,children:p}),t[29]=p,t[30]=E,t[31]=D):D=t[31];let O;t[32]!==w||t[33]!==D?(O=(0,$.jsxs)(`section`,{className:`mt-4 rounded-xl border border-edge-subtle bg-surface-base/60 p-3`,children:[w,D]}),t[32]=w,t[33]=D,t[34]=O):O=t[34];let k;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(k=()=>s(Rr),t[35]=k):k=t[35];let A=i.debugDetailsTitle,j=o&&`rotate-180`,N;t[36]===j?N=t[37]:(N=M(`size-4 shrink-0 text-fg-subtle transition-transform`,j),t[36]=j,t[37]=N);let P;t[38]===N?P=t[39]:(P=(0,$.jsx)(ie,{className:N,"aria-hidden":!0}),t[38]=N,t[39]=P);let F;t[40]!==o||t[41]!==i.debugDetailsTitle||t[42]!==P?(F=(0,$.jsxs)(`button`,{type:`button`,className:`flex w-full items-center justify-between gap-3 px-3 py-2 text-left text-xs font-semibold text-fg`,onClick:k,"aria-expanded":o,children:[A,P]}),t[40]=o,t[41]=i.debugDetailsTitle,t[42]=P,t[43]=F):F=t[43];let I;t[44]!==o||t[45]!==n||t[46]!==a||t[47]!==i||t[48]!==r?(I=o?(0,$.jsxs)(`div`,{className:`space-y-3 border-t border-edge-subtle p-3`,children:[n.steps?.length?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-[10px] font-medium uppercase tracking-wide text-fg-subtle`,children:a.checkDetail.stepsHeading}),(0,$.jsx)(`div`,{className:`mt-2 space-y-2`,children:n.steps.slice(0,8).map(Lr)})]}):null,(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-[10px] font-medium uppercase tracking-wide text-fg-subtle`,children:i.agentInputHeading}),(0,$.jsx)(`pre`,{className:`mt-1 max-h-44 overflow-auto whitespace-pre-wrap wrap-break-word rounded-lg bg-surface-panel p-2 font-mono text-xs leading-5 text-fg-muted`,children:n.prompt||`—`})]}),(0,$.jsx)(ii,{agent:n,labels:i}),r.logs.length>0?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-[10px] font-medium uppercase tracking-wide text-fg-subtle`,children:a.recentLogsHeading}),(0,$.jsx)(`div`,{className:`mt-1 max-h-36 space-y-0.5 overflow-auto rounded-lg bg-surface-panel p-2 font-mono text-xs text-fg-subtle`,children:r.logs.map(Ir)})]}):null]}):null,t[44]=o,t[45]=n,t[46]=a,t[47]=i,t[48]=r,t[49]=I):I=t[49];let L;t[50]!==F||t[51]!==I?(L=(0,$.jsxs)(`section`,{className:`mt-3 rounded-xl border border-edge-subtle bg-surface-base/40`,children:[F,I]}),t[50]=F,t[51]=I,t[52]=L):L=t[52];let R;return t[53]!==C||t[54]!==O||t[55]!==L?(R=(0,$.jsxs)(`aside`,{className:`min-w-0 rounded-2xl border border-edge bg-surface-panel p-4`,children:[C,O,L]}),t[53]=C,t[54]=O,t[55]=L,t[56]=R):R=t[56],R}function Ir(e){return(0,$.jsx)(`div`,{className:`wrap-break-word`,children:e},e)}function Lr(e){return(0,$.jsxs)(`div`,{className:`rounded-lg bg-surface-panel px-2.5 py-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-fg`,children:e.label}),(0,$.jsx)(`span`,{className:`shrink-0 text-[10px] text-fg-subtle`,children:e.status})]}),e.detail||e.resultPreview||e.error?(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:e.error||e.resultPreview||e.detail}):null]},e.id)}function Rr(e){return!e}function zr(e,t){return e.kind===`run_error`?e.code?X(t.diagnosticsRunErrorWithCode,{code:e.code}):t.diagnosticsRunError:e.kind===`agent_error`?X(t.diagnosticsAgentError,{agent:e.agentLabel??String(e.agentId??`—`)}):e.kind===`step_error`?X(t.diagnosticsStepError,{agent:e.agentLabel??String(e.agentId??`—`),step:e.stepLabel??e.stepId??`—`}):X(t.diagnosticsAgentSkipped,{agent:e.agentLabel??String(e.agentId??`—`)})}function Br(e){let t=(0,Q.c)(36),{view:n,comparison:r,labels:i,onOpenRunId:a}=e,o=n.run.metadata?.replay;if(!o)return null;let s;t[0]===i.replayLineageTitle?s=t[1]:(s=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:i.replayLineageTitle}),t[0]=i.replayLineageTitle,t[1]=s);let c;t[2]!==i||t[3]!==o.scope||t[4]!==o.targetCount?(c=X(i.replayLineageSummary,{scope:Ur(o.scope,i),count:o.targetCount}),t[2]=i,t[3]=o.scope,t[4]=o.targetCount,t[5]=c):c=t[5];let l;t[6]===c?l=t[7]:(l=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:c}),t[6]=c,t[7]=l);let u;t[8]!==i.replaySourceRun||t[9]!==o.sourceRunId?(u=(0,$.jsx)(li,{label:i.replaySourceRun,value:o.sourceRunId}),t[8]=i.replaySourceRun,t[9]=o.sourceRunId,t[10]=u):u=t[10];let d=i.replayTargetAgents,f;t[11]===o.agentIds?f=t[12]:(f=o.agentIds.join(`, `),t[11]=o.agentIds,t[12]=f);let p;t[13]!==i.replayTargetAgents||t[14]!==f?(p=(0,$.jsx)(li,{label:d,value:f}),t[13]=i.replayTargetAgents,t[14]=f,t[15]=p):p=t[15];let m;t[16]!==u||t[17]!==p?(m=(0,$.jsxs)(`dl`,{className:`mt-3 grid gap-2 text-xs sm:grid-cols-2`,children:[u,p]}),t[16]=u,t[17]=p,t[18]=m):m=t[18];let h;t[19]!==r||t[20]!==i.replayDurationDelta||t[21]!==i.replayFixedAgents||t[22]!==i.replayStillFailingAgents?(h=r?(0,$.jsxs)(`div`,{className:`mt-3 grid gap-2 sm:grid-cols-3`,children:[(0,$.jsx)(ci,{label:i.replayFixedAgents,value:String(r.fixedAgentIds.length)}),(0,$.jsx)(ci,{label:i.replayStillFailingAgents,value:String(r.stillFailingAgentIds.length)}),(0,$.jsx)(ci,{label:i.replayDurationDelta,value:Hr(r.durationDeltaMs)})]}):null,t[19]=r,t[20]=i.replayDurationDelta,t[21]=i.replayFixedAgents,t[22]=i.replayStillFailingAgents,t[23]=h):h=t[23];let g;t[24]!==s||t[25]!==l||t[26]!==m||t[27]!==h?(g=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[s,l,m,h]}),t[24]=s,t[25]=l,t[26]=m,t[27]=h,t[28]=g):g=t[28];let _;t[29]!==i.replayOpenSource||t[30]!==a||t[31]!==o.sourceRunId?(_=a?(0,$.jsx)(P,{type:`button`,variant:`secondary`,className:`shrink-0`,onClick:()=>a(o.sourceRunId),children:i.replayOpenSource}):null,t[29]=i.replayOpenSource,t[30]=a,t[31]=o.sourceRunId,t[32]=_):_=t[32];let v;return t[33]!==g||t[34]!==_?(v=(0,$.jsx)(`section`,{className:`mt-5 rounded-2xl border border-edge-subtle bg-surface-base/35 p-4`,children:(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[g,_]})}),t[33]=g,t[34]=_,t[35]=v):v=t[35],v}function Vr(e){let t=(0,Q.c)(40),{view:n,labels:r}=e,i;t[0]===n.run.metadata?.contextRefs?i=t[1]:(i=n.run.metadata?.contextRefs??[],t[0]=n.run.metadata?.contextRefs,t[1]=i);let a=i,o=n.run.metadata?.contextSnapshot,s;t[2]===n.run.metadata?.writebackPolicy?.targets?s=t[3]:(s=n.run.metadata?.writebackPolicy?.targets??[],t[2]=n.run.metadata?.writebackPolicy?.targets,t[3]=s);let c=s;if(!a.length&&!c.length)return null;let l;t[4]===r.contextRefsTitle?l=t[5]:(l=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:r.contextRefsTitle}),t[4]=r.contextRefsTitle,t[5]=l);let u;t[6]!==r.contextRefsHint||t[7]!==r.contextSnapshotSummary||t[8]!==o?(u=o?r.contextSnapshotSummary.replace(`{{count}}`,String(o.totalTokens)):r.contextRefsHint,t[6]=r.contextRefsHint,t[7]=r.contextSnapshotSummary,t[8]=o,t[9]=u):u=t[9];let d;t[10]===u?d=t[11]:(d=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:u}),t[10]=u,t[11]=d);let f;t[12]!==r.contextRefKinds||t[13]!==r.noContextRefs||t[14]!==a?(f=a.length?a.map(e=>(0,$.jsx)(li,{label:r.contextRefKinds[e.kind]??e.kind,value:[e.title||e.id,e.role].filter(Boolean).join(` · `)},`${e.kind}:${e.id}:${e.role??``}`)):(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:r.noContextRefs}),t[12]=r.contextRefKinds,t[13]=r.noContextRefs,t[14]=a,t[15]=f):f=t[15];let p;t[16]===f?p=t[17]:(p=(0,$.jsx)(`div`,{className:`mt-3 grid gap-2`,children:f}),t[16]=f,t[17]=p);let m;t[18]!==l||t[19]!==d||t[20]!==p?(m=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[l,d,p]}),t[18]=l,t[19]=d,t[20]=p,t[21]=m):m=t[21];let h;t[22]===r.writebackTitle?h=t[23]:(h=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:r.writebackTitle}),t[22]=r.writebackTitle,t[23]=h);let g;t[24]===r.writebackHint?g=t[25]:(g=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:r.writebackHint}),t[24]=r.writebackHint,t[25]=g);let _;t[26]!==r.noWritebackTargets||t[27]!==r.writebackModes||t[28]!==r.writebackTargetKinds||t[29]!==c?(_=c.length?c.map(e=>(0,$.jsx)(li,{label:r.writebackTargetKinds[e.kind]??e.kind,value:`${e.id} · ${r.writebackModes[e.mode]??e.mode}`},`${e.kind}:${e.id}:${e.mode}`)):(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:r.noWritebackTargets}),t[26]=r.noWritebackTargets,t[27]=r.writebackModes,t[28]=r.writebackTargetKinds,t[29]=c,t[30]=_):_=t[30];let v;t[31]===_?v=t[32]:(v=(0,$.jsx)(`div`,{className:`mt-3 grid gap-2`,children:_}),t[31]=_,t[32]=v);let y;t[33]!==g||t[34]!==v||t[35]!==h?(y=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[h,g,v]}),t[33]=g,t[34]=v,t[35]=h,t[36]=y):y=t[36];let b;return t[37]!==y||t[38]!==m?(b=(0,$.jsx)(`section`,{className:`mt-5 rounded-2xl border border-edge-subtle bg-surface-base/35 p-4`,children:(0,$.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[m,y]})}),t[37]=y,t[38]=m,t[39]=b):b=t[39],b}function Hr(e){return e==null?`—`:`${e>0?`+`:e<0?`-`:``}${nt(Math.abs(e))}`}function Ur(e,t){return e===`failed_phases`?t.replayScopeFailedPhases:t.replayScopeFailedAgents}function Wr(e){let t=(0,Q.c)(8),{view:n,language:r}=e,i=n.nodes,a,o;if(t[0]!==r||t[1]!==n.nodes){o=Symbol.for(`react.early_return_sentinel`);bb0:{let e=i.filter(Yr),s=n.nodes.filter(Jr);if(e.length===0&&s.length===0){o=null;break bb0}let c=r===`zh`?`已保留的阶段结果`:`Work completed before the failure`,l;t[4]===c?l=t[5]:(l=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:c}),t[4]=c,t[5]=l);let u=r===`zh`?`失败不会清空已经完成的工作。你可以先使用这些结果,再让 AI 修复剩余步骤。`:`Completed work is preserved. You can use it now and ask AI to repair the remaining steps.`,d;t[6]===u?d=t[7]:(d=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:u}),t[6]=u,t[7]=d),a=(0,$.jsxs)(`section`,{className:`rounded-2xl border border-amber-500/25 bg-amber-500/5 p-4`,children:[l,d,e.length>0?(0,$.jsx)(`ul`,{className:`mt-3 space-y-2`,children:e.map(qr)}):null,s.length>0?(0,$.jsx)(`p`,{className:`mt-3 text-xs text-danger`,children:r===`zh`?`待修复:${s.map(Kr).join(`、`)}`:`Needs repair: ${s.map(Gr).join(`, `)}`}):null]})}t[0]=r,t[1]=n.nodes,t[2]=a,t[3]=o}else a=t[2],o=t[3];return o===Symbol.for(`react.early_return_sentinel`)?a:o}function Gr(e){return e.title}function Kr(e){return e.title}function qr(e){return(0,$.jsxs)(`li`,{className:`rounded-xl border border-edge-subtle bg-surface-base/60 px-3 py-2.5`,children:[(0,$.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:e.title}),(0,$.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap break-words text-xs leading-5 text-fg-muted`,children:e.resultPreview})]},e.id)}function Jr(e){return e.status===`error`}function Yr(e){return e.status===`done`&&e.resultPreview?.trim()}function Xr(e){let t=(0,Q.c)(19),{task:n,labels:r,downloadingArtifactId:i,downloadError:a,onCopyText:o,onDownloadArtifact:s,onStartFollowUp:c,compact:l}=e,u=l===void 0?!1:l;if(!n||!n.artifacts.length&&!n.followUps.length){if(u)return null;let e;return t[0]===r.noArtifacts?e=t[1]:(e=(0,$.jsx)(`section`,{className:`mt-5 rounded-xl border border-dashed border-edge p-4 text-sm text-fg-muted`,children:r.noArtifacts}),t[0]=r.noArtifacts,t[1]=e),e}let d=!u&&`mt-5`,f;t[2]===d?f=t[3]:(f=M(`grid gap-3 lg:grid-cols-3`,d),t[2]=d,t[3]=f);let p;t[4]!==a||t[5]!==i||t[6]!==r||t[7]!==s||t[8]!==n.artifacts?(p=n.artifacts.length>0?(0,$.jsxs)(Qr,{title:r.taskArtifacts,children:[(0,$.jsx)(`ul`,{className:`space-y-2`,children:n.artifacts.map(e=>(0,$.jsxs)(`li`,{className:`min-w-0 rounded-lg bg-surface-base px-2.5 py-2`,children:[(0,$.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,title:e.title??e.name,children:e.title??e.name}),(0,$.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-subtle`,children:e.mimeType}),(0,$.jsxs)(`button`,{type:`button`,className:`mt-1 inline-flex items-center gap-1 text-xs font-medium text-accent-fg hover:underline disabled:cursor-wait disabled:opacity-60`,disabled:i===e.id,onClick:()=>s(e),children:[(0,$.jsx)(x,{className:`size-3`,"aria-hidden":!0}),i===e.id?r.downloadingArtifact:r.downloadArtifact]})]},e.id))}),a?(0,$.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-rose-600 dark:text-rose-400`,children:a}):null]}):null,t[4]=a,t[5]=i,t[6]=r,t[7]=s,t[8]=n.artifacts,t[9]=p):p=t[9];let m;t[10]!==r||t[11]!==o||t[12]!==c||t[13]!==n.followUps?(m=n.followUps.length>0?(0,$.jsx)(Qr,{title:r.taskFollowUps,children:(0,$.jsx)(`ul`,{className:`space-y-2`,children:n.followUps.map(e=>(0,$.jsxs)(`li`,{className:`rounded-lg bg-surface-base px-2.5 py-2`,children:[(0,$.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:e.title}),e.prompt?(0,$.jsxs)(`div`,{className:`mt-1 flex flex-wrap gap-2`,children:[(0,$.jsx)(`button`,{type:`button`,className:`text-xs font-medium text-accent-fg hover:underline`,onClick:()=>c(e),children:r.startFollowUp}),(0,$.jsx)(`button`,{type:`button`,className:`text-xs font-medium text-fg-subtle hover:text-fg`,onClick:()=>o(e.prompt??``),children:r.copyPrompt})]}):null]},e.id))})}):null,t[10]=r,t[11]=o,t[12]=c,t[13]=n.followUps,t[14]=m):m=t[14];let h;return t[15]!==f||t[16]!==p||t[17]!==m?(h=(0,$.jsxs)(`div`,{className:f,children:[p,m]}),t[15]=f,t[16]=p,t[17]=m,t[18]=h):h=t[18],h}function Zr(e,t){let n=URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=t,r.click(),URL.revokeObjectURL(n)}function Qr(e){let t=(0,Q.c)(10),{title:n,children:r,className:i}=e,a;t[0]===i?a=t[1]:(a=M(`min-w-0 rounded-xl border border-edge-subtle bg-surface-base/35 p-3`,i),t[0]=i,t[1]=a);let o;t[2]===n?o=t[3]:(o=(0,$.jsx)(`h4`,{className:`text-xs font-semibold uppercase tracking-wide text-fg-subtle`,children:n}),t[2]=n,t[3]=o);let s;t[4]===r?s=t[5]:(s=(0,$.jsx)(`div`,{className:`mt-2`,children:r}),t[4]=r,t[5]=s);let c;return t[6]!==a||t[7]!==o||t[8]!==s?(c=(0,$.jsxs)(`section`,{className:a,children:[o,s]}),t[6]=a,t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function $r(e){if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e,n=Array.isArray(t.actions)?t.actions:[],r=Array.isArray(t.artifacts)?t.artifacts:[],i=Array.isArray(t.followUps)?t.followUps:[];return n.length===0&&r.length===0&&i.length===0?null:{actions:n,artifacts:r,followUps:i}}function ei(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:null}function ti(e){if(typeof e==`string`)return e.trim()||null;let t=ei(e);if(!t)return null;for(let e of[`artifactId`,`followUpId`,`id`,`name`])if(typeof t[e]==`string`&&t[e].trim())return t[e].trim();return null}function ni(e){let t=ei(e);if(!t)return null;for(let e of[`prompt`,`message`,`text`])if(typeof t[e]==`string`&&t[e].trim())return t[e].trim();return null}function ri(e,t){if(e.kind===`copy_result`)return!0;let n=ti(e.payload);return e.kind===`open_artifact`?!!(n&&t.artifacts.some(e=>e.id===n||e.name===n)):e.kind===`start_followup`?!!(ni(e.payload)||n&&t.followUps.some(e=>e.id===n&&e.prompt)):!!ni(e.payload)}function ii(e){let t=(0,Q.c)(21),{agent:n,labels:r}=e,i=n.invocation;if(!i)return null;let a=i.resolvedModelRef??i.modelRef,o;t[0]!==r.agentInvocationModel||t[1]!==a?(o={label:r.agentInvocationModel,value:a},t[0]=r.agentInvocationModel,t[1]=a,t[2]=o):o=t[2];let s;t[3]===i.toolset?s=t[4]:(s=i.toolset?.join(`, `),t[3]=i.toolset,t[4]=s);let c;t[5]!==r.agentInvocationTools||t[6]!==s?(c={label:r.agentInvocationTools,value:s},t[5]=r.agentInvocationTools,t[6]=s,t[7]=c):c=t[7];let l=i.maxIterations==null?void 0:String(i.maxIterations),u;t[8]!==r.agentInvocationIterations||t[9]!==l?(u={label:r.agentInvocationIterations,value:l},t[8]=r.agentInvocationIterations,t[9]=l,t[10]=u):u=t[10];let d=i.schema?r.agentInvocationSchemaPresent:void 0,f;t[11]!==r.agentInvocationSchema||t[12]!==d?(f={label:r.agentInvocationSchema,value:d},t[11]=r.agentInvocationSchema,t[12]=d,t[13]=f):f=t[13];let p;t[14]!==o||t[15]!==c||t[16]!==u||t[17]!==f?(p=[o,c,u,f].filter(oi),t[14]=o,t[15]=c,t[16]=u,t[17]=f,t[18]=p):p=t[18];let m=p;if(m.length===0)return null;let h;return t[19]===m?h=t[20]:(h=(0,$.jsx)(`dl`,{className:`mt-3 grid gap-2 border-t border-edge-subtle pt-3 text-xs sm:grid-cols-2 lg:grid-cols-4`,children:m.map(ai)}),t[19]=m,t[20]=h),h}function ai(e){return(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:e.label}),(0,$.jsx)(`dd`,{className:`mt-0.5 truncate font-medium text-fg-muted`,title:e.value,children:e.value})]},e.label)}function oi(e){return!!e.value}function si(e){return e===`done`?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`error`?`bg-rose-500/10 text-rose-700 dark:text-rose-300`:e===`running`?`bg-accent-soft text-accent-fg`:`bg-surface-hover text-fg-subtle`}function ci(e){let t=(0,Q.c)(7),{label:n,value:r}=e,i;t[0]===n?i=t[1]:(i=(0,$.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=(0,$.jsx)(`dd`,{className:`mt-1 text-sm font-semibold text-fg`,children:r}),t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,$.jsxs)(`div`,{className:`rounded-xl border border-edge bg-surface-base/40 p-3`,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function li(e){let t=(0,Q.c)(7),{label:n,value:r}=e,i;t[0]===n?i=t[1]:(i=(0,$.jsx)(`div`,{className:`text-xs text-fg-subtle`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=(0,$.jsx)(`div`,{className:`mt-1 truncate text-sm font-medium text-fg`,title:r,children:r}),t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function ui(){let e=(0,Q.c)(8),t=j(di),[n]=o(),r;e[0]===n?r=e[1]:(r=n.get(`agentId`)?.trim()||void 0,e[0]=n,e[1]=r);let i=r,a;e[2]===t?a=e[3]:(a=t?[`workflow-route-agents`,t]:null,e[2]=t,e[3]=a);let s;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(s={revalidateOnFocus:!1},e[4]=s):s=e[4];let c=N(a,rt,s),l=i??c.data?.defaultId,u;return e[5]!==c.isLoading||e[6]!==l?(u={ownerAgentId:l,loading:c.isLoading},e[5]=c.isLoading,e[6]=l,e[7]=u):u=e[7],u}function di(e){return e.token}function fi(e){let t=(0,Q.c)(19),n=j(pi),r;t[0]===n?r=t[1]:(r=n?[`workflow-route-definitions`,n]:null,t[0]=n,t[1]=r);let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i={revalidateOnFocus:!1},t[2]=i):i=t[2];let a=N(r,ut,i),o;t[3]!==e||t[4]!==a.data?(o=a.data?.find(t=>t.id===e||t.name===e),t[3]=e,t[4]=a.data,t[5]=o):o=t[5];let s=o,c;t[6]===a?c=t[7]:(c=async e=>{await a.mutate(t=>[...(t??[]).filter(t=>t.id!==e.id&&t.name!==e.name),e],{revalidate:!1})},t[6]=a,t[7]=c);let l=c,u;t[8]===a?u=t[9]:(u=async()=>{await a.mutate()},t[8]=a,t[9]=u);let d=u,f;t[10]===a.data?f=t[11]:(f=a.data??[],t[10]=a.data,t[11]=f);let p;return t[12]!==s||t[13]!==a.error||t[14]!==a.isLoading||t[15]!==d||t[16]!==f||t[17]!==l?(p={definition:s,definitions:f,loading:a.isLoading,error:a.error,upsertDefinition:l,refreshDefinitions:d},t[12]=s,t[13]=a.error,t[14]=a.isLoading,t[15]=d,t[16]=f,t[17]=l,t[18]=p):p=t[18],p}function pi(e){return e.token}var mi=()=>({goal:``,argValues:{},schemaInput:{},concurrency:``,maxSubagents:``});function hi(){let{definitionId:e}=i(),[t,n]=o(),r=a(),c=A(e=>e.language),l=k(c).workflows,u=c===`zh`?`zh-CN`:`en-US`,d=Qe(e=>e.setPageHeader),f=Qe(e=>e.clearPageHeader),{ownerAgentId:p}=ui(),m=t.get(`projectId`)?.trim()||void 0,{definition:h,loading:g,error:y}=fi(e),b=N(`workflow-project-options`,()=>ge({limit:100,sortBy:`updatedAt`,sortOrder:`desc`}),{revalidateOnFocus:!1}),x=N(m?[`workflow-project-presets`,m]:null,()=>we(m),{revalidateOnFocus:!1}),S=N(p?[`workflow-detail-runs`,p,e,m??``]:null,()=>Oe(100,{ownerAgentId:p,projectId:m}),{revalidateOnFocus:!1}),[C,T]=(0,Z.useState)(mi),[E,D]=(0,Z.useState)([]),[O,j]=(0,Z.useState)(!1),[M,F]=(0,Z.useState)(!1),[I,L]=(0,Z.useState)(null),R=(0,Z.useRef)(void 0),z=(0,Z.useMemo)(()=>(S.data??[]).filter(e=>e.definitionId===h?.id).slice(0,6),[h?.id,S.data]),B=kt(h,C),V=h?Ye(h,c):null,H=x.data?.find(e=>e.definitionId===h?.id),U=!!H&&JSON.stringify(H?.contextRefs)===JSON.stringify(E);(0,Z.useEffect)(()=>{if(!m||!h||!x.data)return;let e=`${m}:${h.id}`;R.current!==e&&(R.current=e,D(H?.contextRefs??[]))},[h,m,H?.contextRefs,x.data]);let ee=(0,Z.useCallback)(e=>{R.current=void 0,D([]),n(t=>{let n=new URLSearchParams(t);return e?n.set(`projectId`,e):n.delete(`projectId`),n},{replace:!0})},[n]),W=(0,Z.useCallback)(async()=>{if(!(!m||!h||M)){F(!0),L(null);try{let e=await he(m,h.id,E);await x.mutate(t=>[e,...(t??[]).filter(t=>t.definitionId!==e.definitionId)],{revalidate:!1})}catch(e){L(e instanceof Error?e.message:l.projectWorkflowSaveFailed)}finally{F(!1)}}},[E,h,l.projectWorkflowSaveFailed,m,x,M]),K=(0,Z.useCallback)(async()=>{if(!(!m||!h||M)){F(!0),L(null);try{await pt(m,h.id),await x.mutate(e=>(e??[]).filter(e=>e.definitionId!==h.id),{revalidate:!1})}catch(e){L(e instanceof Error?e.message:l.projectWorkflowRemoveFailed)}finally{F(!1)}}},[h,l.projectWorkflowRemoveFailed,m,x,M]),te=new URLSearchParams({tab:`library`});p&&te.set(`agentId`,p),m&&te.set(`projectId`,m);let ne=`/workflows?${te.toString()}`,re=new URLSearchParams;p&&re.set(`agentId`,p),m&&re.set(`projectId`,m);let q=re.size?`?${re.toString()}`:``,J=null;if(h){let e=new URLSearchParams;p&&e.set(`agentId`,p),m&&e.set(`projectId`,m),h.metadata.source!==`user`&&e.set(`copy`,h.id),J=`${h.metadata.source===`user`?`/workflows/${h.id}/edit`:`/workflows/new`}${e.size?`?${e.toString()}`:``}`}(0,Z.useLayoutEffect)(()=>(d({startExtra:(0,$.jsx)(s,{to:ne,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":c===`zh`?`返回工作流库`:`Back to workflow library`,children:(0,$.jsx)(Ie,{className:`size-4`,"aria-hidden":!0})}),main:(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:h?.title??(c===`zh`?`工作流详情`:`Workflow details`)}),h?(0,$.jsxs)(`p`,{className:`truncate text-xs text-fg-muted`,children:[h.metadata.source===`user`?l.badgeUser:l.badgeBuiltin,` · `,c===`zh`?`版本 ${h.revision}`:`Version ${h.revision}`]}):null]}),end:h&&J?(0,$.jsx)(P,{asChild:!0,variant:`secondary`,className:`h-9 shrink-0`,children:(0,$.jsxs)(s,{to:J,children:[h.metadata.source===`user`?(0,$.jsx)(w,{className:`size-4`,"aria-hidden":!0}):(0,$.jsx)(Be,{className:`size-4`,"aria-hidden":!0}),h.metadata.source===`user`?l.editWorkflow:l.copyAndEditWorkflow]})}):null}),()=>f()),[f,h,J,l.badgeBuiltin,l.badgeUser,l.copyAndEditWorkflow,l.editWorkflow,c,ne,d]);let ie=(0,Z.useCallback)(async()=>{if(!(!h||!B.valid||O)){j(!0),L(null);try{r(`/workflows/runs/${(await ae({definitionId:h.id,goal:C.goal.trim()||V?.description||h.title,input:At(h,C),agentId:p,projectId:m,contextRefs:E,concurrency:C.concurrency.trim()?Number(C.concurrency):void 0,maxSubagents:C.maxSubagents.trim()?Number(C.maxSubagents):void 0})).runId}${q}`)}catch(e){L(e instanceof Error?e.message:l.startFailed)}finally{j(!1)}}},[E,h,B.valid,l.startFailed,V?.description,r,p,m,q,C,O]);return g?(0,$.jsx)(bi,{}):!h||!V?(0,$.jsx)(xi,{message:y?.message??(c===`zh`?`没有找到这个工作流`:`Workflow not found`)}):(0,$.jsx)(`main`,{className:`min-h-0 flex-1 overflow-y-auto bg-surface-panel`,children:(0,$.jsxs)(`div`,{className:`mx-auto w-full max-w-6xl px-4 py-5 sm:px-6`,children:[(0,$.jsx)(`p`,{className:`max-w-3xl text-sm leading-6 text-fg-muted`,children:V.description}),(0,$.jsxs)(`div`,{className:`mt-5 grid gap-5 xl:grid-cols-[minmax(0,1fr)_22rem]`,children:[(0,$.jsx)(`div`,{className:`min-w-0`,children:(0,$.jsx)(ur,{graph:h.graph,language:c,className:`h-[28rem] rounded-xl border border-edge`})}),(0,$.jsxs)(`aside`,{className:`rounded-xl border border-edge bg-surface-base/45 p-4`,children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:c===`zh`?`开始一次运行`:`Start a run`}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:V.whenToUse||V.description}),(0,$.jsxs)(`label`,{className:`mt-4 block text-xs font-medium text-fg-muted`,children:[(0,$.jsxs)(`span`,{className:`mb-1.5 flex items-center gap-1.5`,children:[(0,$.jsx)(Ee,{className:`size-3.5 text-fg-subtle`,"aria-hidden":!0}),l.runProject]}),(0,$.jsxs)(_,{value:m??``,"aria-label":l.runProject,onChange:e=>ee(e.target.value),className:`h-9 w-full rounded-lg border border-edge bg-surface-panel px-2.5 text-sm text-fg shadow-surface`,children:[(0,$.jsx)(v,{value:``,children:l.runProjectNone}),(b.data?.items??[]).filter(e=>e.status!==`archived`&&e.status!==`cancelled`).map(e=>(0,$.jsx)(v,{value:e.id,children:e.name},e.id))]})]}),(0,$.jsx)(`div`,{className:`mt-3`,children:(0,$.jsx)(sr,{projectId:m,language:c,value:E,onChange:D})}),m?(0,$.jsxs)(`div`,{className:`mt-2 flex items-center gap-2`,children:[(0,$.jsxs)(P,{type:`button`,variant:`ghost`,className:`h-8 flex-1 justify-start px-2 text-xs`,disabled:M||U,onClick:()=>void W(),children:[(0,$.jsx)(tt,{className:`size-3.5`,"aria-hidden":!0}),U?l.projectWorkflowSaved:H?l.updateProjectWorkflow:l.saveProjectWorkflow]}),H?(0,$.jsx)(P,{type:`button`,variant:`ghost`,className:`size-8 p-0 text-fg-muted`,disabled:M,"aria-label":l.removeProjectWorkflow,onClick:()=>void K(),children:(0,$.jsx)(G,{className:`size-3.5`,"aria-hidden":!0})}):null]}):null,(0,$.jsx)(`div`,{className:`mt-4`,children:(0,$.jsx)(jt,{definition:h,language:c,value:C,onChange:T,mode:`manual`,badgeLabel:l.readyToStart,aiAssist:{context:{surface:`workflow-start`,workflowId:h.id,workflowName:h.name,workflowTitle:h.title,workflowDescription:V.description}}})}),I?(0,$.jsx)(`p`,{className:`mt-3 text-sm text-danger`,children:I}):null,(0,$.jsxs)(P,{variant:`primary`,className:`mt-4 w-full`,disabled:!B.valid||O,onClick:()=>void ie(),children:[(0,$.jsx)(je,{className:`size-4`,"aria-hidden":!0}),O?l.starting:l.runWorkflow]})]})]}),(0,$.jsxs)(`section`,{className:`mt-6 border-t border-edge pt-5`,children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:c===`zh`?`最近运行`:`Recent runs`}),z.length?(0,$.jsx)(`div`,{className:`mt-3 grid gap-2 md:grid-cols-2 xl:grid-cols-3`,children:z.map(e=>(0,$.jsxs)(`button`,{type:`button`,className:`rounded-xl border border-edge bg-surface-base/40 p-3 text-left hover:bg-surface-hover`,onClick:()=>r(`/workflows/runs/${e.id}${q}`),children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,$.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.title}),(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:l.status[e.status]})]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:Ve(e.createdAtMs,u)})]},e.id))}):(0,$.jsx)(`p`,{className:`mt-3 text-sm text-fg-muted`,children:c===`zh`?`还没有运行记录。`:`No runs yet.`})]})]})})}function gi(){let{definitionId:e}=i(),[t]=o(),n=a(),r=A(e=>e.language),{ownerAgentId:s}=ui(),c=t.get(`copy`)?.trim()||void 0,l=t.get(`repairRun`)?.trim()||void 0,u=t.get(`projectId`)?.trim()||void 0,d=new URLSearchParams;s&&d.set(`agentId`,s),u&&d.set(`projectId`,u);let f=d.size?`?${d.toString()}`:``,{definition:p,definitions:m,loading:h,upsertDefinition:g,refreshDefinitions:_}=fi(e??c),v=N(l&&s?[`workflow-repair-run`,l,s]:null,()=>He(l,{ownerAgentId:s}),{revalidateOnFocus:!1}),[y,b]=(0,Z.useState)(!1),[x,S]=(0,Z.useState)(null),[C,w]=(0,Z.useState)(null),T=(0,Z.useMemo)(()=>m.map(e=>e.name),[m]),E=(0,Z.useMemo)(()=>Rn(`my_workflow`,T),[T]),D=(0,Z.useMemo)(()=>{if(!p)return null;let t=e&&p.metadata.source===`user`?`edit`:`copy`,n=(v.data?.nodes.filter(e=>e.status===`error`)??[]).map(e=>r===`zh`?`${e.title}:${e.error??`执行失败`}`:`${e.title}: ${e.error??`execution failed`}`).join(r===`zh`?`;`:`; `)||v.data?.run.error?.message||void 0,i=l&&v.data?r===`zh`?`修复这次运行中的失败步骤,并保持原始目标不变:${n??`请根据运行记录定位失败原因`}`:`Repair the failed steps from this run while preserving the original goal: ${n??`use the run record to identify the failure`}`:void 0;return{mode:t,name:t===`edit`?p.name:yi(p.name,m),graph:structuredClone(p.graph),manifest:Ln(p),baseRevision:t===`edit`?p.revision:0,sourceTitle:p.title,repairPrompt:i}},[p,e,m,r,v.data?.nodes,l]),O=(0,Z.useCallback)(async e=>{b(!0),S(null),w(null);try{let t=await U(e.name,e.graph,e.manifest,e.expectedRevision);return await g(t),n(`/workflows/${t.id}/edit${f}`,{replace:!0}),t}catch(e){let t=zn(e);w(t),t||S(e instanceof Error?e.message:String(e))}finally{b(!1)}},[f,n,g]),k=(0,Z.useCallback)(async e=>{b(!0),S(null),w(null);try{let t=await U(e.name,e.graph,e.manifest,e.expectedRevision);await g(t),n(`/workflows/runs/${(await ae({definitionId:t.id,goal:e.goal,input:{goal:e.goal},agentId:s,projectId:u})).runId}${f}`)}catch(e){let t=zn(e);throw w(t),t||S(e instanceof Error?e.message:String(e)),e}finally{b(!1)}},[f,n,s,u,g]);return h?(0,$.jsx)(bi,{}):e&&!p?(0,$.jsx)(xi,{message:r===`zh`?`没有找到这个工作流`:`Workflow not found`}):(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[x?(0,$.jsx)(`div`,{className:`border-b border-danger/30 bg-danger/5 px-4 py-2 text-sm text-danger`,children:x}):null,(0,$.jsx)(Vn,{language:r,ownerAgentId:s,saving:y,initialDraft:D,initialName:E,existingNames:T,saveConflict:C,onSave:O,onSaveAndStart:k,onClearSaveConflict:()=>w(null),onReloadLatest:()=>{w(null),S(null),_()}})]})}function _i(){let e=(0,Q.c)(53),{runId:t}=i(),n=a(),r=A(vi),o=r===`zh`?`zh-CN`:`en-US`,{ownerAgentId:s}=ui(),c;e[0]===s?c=e[1]:(c={ownerAgentId:s},e[0]=s,e[1]=c);let l=We(t,c),[u,d]=(0,Z.useState)(`process`),f=(0,Z.useRef)(!0),p;e[2]!==l.view?.run.metadata?.replay||e[3]!==s||e[4]!==t?(p=l.view?.run.metadata?.replay&&t?[`workflow-run-page-comparison`,t,s]:null,e[2]=l.view?.run.metadata?.replay,e[3]=s,e[4]=t,e[5]=p):p=e[5];let m;e[6]!==s||e[7]!==t?(m=()=>ze(t,{ownerAgentId:s}),e[6]=s,e[7]=t,e[8]=m):m=e[8];let h;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(h={revalidateOnFocus:!1},e[9]=h):h=e[9];let g=N(p,m,h),_;e[10]===l.view?_=e[11]:(_=l.view?Ze.has(l.view.run.status):!0,e[10]=l.view,e[11]=_);let v=_,y,b;e[12]===v?(y=e[13],b=e[14]):(y=()=>{f.current&&!v&&d(`result`),f.current=v},b=[v],e[12]=v,e[13]=y,e[14]=b),(0,Z.useEffect)(y,b);let x;e[15]!==n||e[16]!==s?(x=e=>{n(`/workflows/runs/${e}${s?`?agentId=${encodeURIComponent(s)}`:``}`)},e[15]=n,e[16]=s,e[17]=x):x=e[17];let S=x,C;e[18]!==S||e[19]!==s||e[20]!==t?(C=async()=>{t&&S((await ft(t,{ownerAgentId:s})).runId)},e[18]=S,e[19]=s,e[20]=t,e[21]=C):C=e[21];let w=C,T;e[22]!==S||e[23]!==s||e[24]!==t?(T=async e=>{t&&S((await de(t,e,{ownerAgentId:s})).runId)},e[22]=S,e[23]=s,e[24]=t,e[25]=T):T=e[25];let E=T;if(!l.loading&&!l.view){let t=l.error instanceof Error?l.error.message:r===`zh`?`没有找到这次运行`:`Workflow run not found`,n;return e[26]===t?n=e[27]:(n=(0,$.jsx)(xi,{message:t}),e[26]=t,e[27]=n),n}let D;e[28]!==l||e[29]!==s||e[30]!==t?(D=()=>t&&void Ne(t,{ownerAgentId:s}).then(()=>l.mutate()),e[28]=l,e[29]=s,e[30]=t,e[31]=D):D=e[31];let O;e[32]===w?O=e[33]:(O=()=>void w(),e[32]=w,e[33]=O);let k;e[34]===E?k=e[35]:(k=e=>void E(e),e[34]=E,e[35]=k);let j;e[36]!==l.view||e[37]!==n||e[38]!==s?(j=l.view?()=>n(`/workflows/${l.view.run.definitionId}/edit?repairRun=${encodeURIComponent(l.view.run.id)}${s?`&agentId=${encodeURIComponent(s)}`:``}`):void 0,e[36]=l.view,e[37]=n,e[38]=s,e[39]=j):j=e[39];let M;return e[40]!==u||e[41]!==g.data||e[42]!==r||e[43]!==l.loading||e[44]!==l.view||e[45]!==o||e[46]!==S||e[47]!==s||e[48]!==D||e[49]!==O||e[50]!==k||e[51]!==j?(M=(0,$.jsx)(jr,{view:l.view,comparison:g.data,loading:l.loading,language:r,localeTag:o,activeTab:u,onTabChange:d,onCancel:D,onRetry:O,onReplay:k,onOpenRunId:S,ownerAgentId:s,onRepairWorkflow:j}),e[40]=u,e[41]=g.data,e[42]=r,e[43]=l.loading,e[44]=l.view,e[45]=o,e[46]=S,e[47]=s,e[48]=D,e[49]=O,e[50]=k,e[51]=j,e[52]=M):M=e[52],M}function vi(e){return e.language}function yi(e,t){let n=new Set(t.map(e=>e.name)),r=`${e}_copy`;if(!n.has(r))return r;for(let e=2;e<100;e+=1){let t=`${r}_${e}`;if(!n.has(t))return t}return`${r}_${Date.now()}`}function bi(){let e=(0,Q.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(`main`,{className:`min-h-0 flex-1 overflow-auto bg-surface-panel p-5`,"aria-busy":!0,children:(0,$.jsxs)(`div`,{className:`mx-auto w-full max-w-6xl`,children:[(0,$.jsx)(I,{className:`h-5 w-36`}),(0,$.jsx)(I,{className:`mt-5 h-9 w-80 max-w-full`}),(0,$.jsx)(I,{className:`mt-4 h-[28rem] rounded-xl`})]})}),e[0]=t):t=e[0],t}function xi(e){let t=(0,Q.c)(5),{message:n}=e,r;t[0]===n?r=t[1]:(r=(0,$.jsx)(`p`,{className:`text-sm text-danger`,children:n}),t[0]=n,t[1]=r);let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsx)(P,{asChild:!0,variant:`secondary`,className:`mt-4`,children:(0,$.jsxs)(s,{to:`/workflows`,children:[(0,$.jsx)(Ie,{className:`size-4`}),`Back`]})}),t[2]=i):i=t[2];let a;return t[3]===r?a=t[4]:(a=(0,$.jsx)(`main`,{className:`flex min-h-0 flex-1 items-center justify-center bg-surface-panel p-6 text-center`,children:(0,$.jsxs)(`div`,{children:[r,i]})}),t[3]=r,t[4]=a),a}export{hi as WorkflowDetailPage,gi as WorkflowEditorPage,_i as WorkflowRunPage,In as WorkflowsPage};
@@ -11,34 +11,34 @@
11
11
  <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png?v=20260713-1" />
12
12
  <link rel="manifest" href="/site.webmanifest?v=20260713-1" />
13
13
  <title>XOPC — Keep what matters moving.</title>
14
- <script type="module" crossorigin src="/assets/index-7i2P3312.js"></script>
14
+ <script type="module" crossorigin src="/assets/index-B0WJL9N1.js"></script>
15
15
  <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-aKtaBQYM.js">
16
16
  <link rel="modulepreload" crossorigin href="/assets/preload-helper-zJ_50EbN.js">
17
17
  <link rel="modulepreload" crossorigin href="/assets/vendor-react-BOUWij0V.js">
18
18
  <link rel="modulepreload" crossorigin href="/assets/dist-CxGUk8J-.js">
19
- <link rel="modulepreload" crossorigin href="/assets/Combination-14nmIgxH.js">
19
+ <link rel="modulepreload" crossorigin href="/assets/es2015-BvLh9GaE.js">
20
20
  <link rel="modulepreload" crossorigin href="/assets/floating-ui.dom-B7uQOZZW.js">
21
- <link rel="modulepreload" crossorigin href="/assets/dist-DaxPZj9e.js">
22
- <link rel="modulepreload" crossorigin href="/assets/dist-BPoKqzeH.js">
21
+ <link rel="modulepreload" crossorigin href="/assets/dist-DBS3OB8K.js">
22
+ <link rel="modulepreload" crossorigin href="/assets/dist-CpzYSoz7.js">
23
23
  <link rel="modulepreload" crossorigin href="/assets/chunk-KS7C4IRE-BaASWQor.js">
24
24
  <link rel="modulepreload" crossorigin href="/assets/createLucideIcon-DPHK1VkS.js">
25
25
  <link rel="modulepreload" crossorigin href="/assets/download-Dk-ZjtO6.js">
26
26
  <link rel="modulepreload" crossorigin href="/assets/plus-Q2yW6OE7.js">
27
27
  <link rel="modulepreload" crossorigin href="/assets/x-B_N4OPjy.js">
28
- <link rel="modulepreload" crossorigin href="/assets/messages-_tYhRAHD.js">
29
- <link rel="modulepreload" crossorigin href="/assets/locale-store-C5wr3_pc.js">
28
+ <link rel="modulepreload" crossorigin href="/assets/messages-CTSgFlE4.js">
29
+ <link rel="modulepreload" crossorigin href="/assets/locale-store-CMZljTJx.js">
30
30
  <link rel="modulepreload" crossorigin href="/assets/cn-JdwAhgNB.js">
31
- <link rel="modulepreload" crossorigin href="/assets/schemas-zIBW3wiV.js">
32
- <link rel="modulepreload" crossorigin href="/assets/product-delivery-dUJgmBQZ.js">
31
+ <link rel="modulepreload" crossorigin href="/assets/schemas-BHS7bo06.js">
32
+ <link rel="modulepreload" crossorigin href="/assets/product-delivery-CV4pDOtG.js">
33
33
  <link rel="modulepreload" crossorigin href="/assets/copy-to-clipboard-HOJ79TWv.js">
34
- <link rel="modulepreload" crossorigin href="/assets/markdown-view-D6LxlDxr.js">
35
- <link rel="modulepreload" crossorigin href="/assets/dist-DqPZM2MH.js">
34
+ <link rel="modulepreload" crossorigin href="/assets/markdown-view-PPCLt7fu.js">
35
+ <link rel="modulepreload" crossorigin href="/assets/dist-DLmwHyAh.js">
36
36
  <link rel="modulepreload" crossorigin href="/assets/vendor-swr-BIWyz7Rc.js">
37
37
  <link rel="modulepreload" crossorigin href="/assets/check-DUBLcKHA.js">
38
38
  <link rel="modulepreload" crossorigin href="/assets/skeleton-BwbyijEw.js">
39
39
  <link rel="modulepreload" crossorigin href="/assets/settings-shell-dialog-layer-BU3UuiJr.js">
40
40
  <link rel="modulepreload" crossorigin href="/assets/settings-shell-layer-context-DCp6ykjQ.js">
41
- <link rel="modulepreload" crossorigin href="/assets/popover-select-DrILF6mR.js">
41
+ <link rel="modulepreload" crossorigin href="/assets/popover-select-C-Hj-nXR.js">
42
42
  <link rel="modulepreload" crossorigin href="/assets/circle-check-C23XjkUj.js">
43
43
  <link rel="modulepreload" crossorigin href="/assets/cloud-C4-yfnnk.js">
44
44
  <link rel="modulepreload" crossorigin href="/assets/copy-Dv6d4Dvw.js">
@@ -56,24 +56,23 @@
56
56
  <link rel="modulepreload" crossorigin href="/assets/rotate-cw-LIg3Am9S.js">
57
57
  <link rel="modulepreload" crossorigin href="/assets/search-DA7gz22f.js">
58
58
  <link rel="modulepreload" crossorigin href="/assets/middleware-Pd0e8Igk.js">
59
- <link rel="modulepreload" crossorigin href="/assets/files-DQjhZjr2.js">
59
+ <link rel="modulepreload" crossorigin href="/assets/files-D6vf3S30.js">
60
60
  <link rel="modulepreload" crossorigin href="/assets/tool-activity-R8V9l6nk.js">
61
- <link rel="modulepreload" crossorigin href="/assets/app-chrome-BeB4KgOf.js">
62
- <link rel="modulepreload" crossorigin href="/assets/button-CSEbl4zT.js">
63
- <link rel="modulepreload" crossorigin href="/assets/gateway-startup-retry-DJG-I0wW.js">
64
- <link rel="modulepreload" crossorigin href="/assets/registry-api-FXdFaoWM.js">
61
+ <link rel="modulepreload" crossorigin href="/assets/button-CtTvuElV.js">
62
+ <link rel="modulepreload" crossorigin href="/assets/gateway-startup-retry-uMcSfLru.js">
63
+ <link rel="modulepreload" crossorigin href="/assets/registry-api-CWOtPFrE.js">
65
64
  <link rel="modulepreload" crossorigin href="/assets/config-reload-event-Bjh2zoKp.js">
66
- <link rel="modulepreload" crossorigin href="/assets/gateway-config-swr-Bxe_R-JH.js">
67
- <link rel="modulepreload" crossorigin href="/assets/models-hub-cache-Y7GUjxHx.js">
65
+ <link rel="modulepreload" crossorigin href="/assets/gateway-config-swr-BC3pgb_P.js">
66
+ <link rel="modulepreload" crossorigin href="/assets/models-hub-cache-ZrbGRiGY.js">
68
67
  <link rel="modulepreload" crossorigin href="/assets/electron-env-DH5wF8X8.js">
69
- <link rel="modulepreload" crossorigin href="/assets/oauth-api-C5NVcsKE.js">
68
+ <link rel="modulepreload" crossorigin href="/assets/oauth-api-4VeMbkTJ.js">
70
69
  <link rel="modulepreload" crossorigin href="/assets/form-field-width-DJw_jULe.js">
71
70
  <link rel="modulepreload" crossorigin href="/assets/interaction-BmQogeqz.js">
72
71
  <link rel="modulepreload" crossorigin href="/assets/is-masked-secret-DOkL5b_X.js">
73
- <link rel="modulepreload" crossorigin href="/assets/activity-store-CLnbVm9G.js">
74
- <link rel="modulepreload" crossorigin href="/assets/theme-store-DUko1ZnE.js">
72
+ <link rel="modulepreload" crossorigin href="/assets/activity-store-CAah-_8h.js">
73
+ <link rel="modulepreload" crossorigin href="/assets/theme-store-uxUwr10D.js">
75
74
  <link rel="stylesheet" crossorigin href="/assets/markdown-view-Y68dCxuc.css">
76
- <link rel="stylesheet" crossorigin href="/assets/index-DTo3IcbW.css">
75
+ <link rel="stylesheet" crossorigin href="/assets/index-Dbh5SXyV.css">
77
76
  </head>
78
77
  <body>
79
78
  <div id="root"></div>
package/dist/package.js CHANGED
@@ -1,4 +1,4 @@
1
1
  //#region package.json
2
- var version = "0.0.241";
2
+ var version = "0.0.243";
3
3
  //#endregion
4
4
  export { version };