@xopcai/xopc 0.0.217 → 0.0.218

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 (168) 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-D6trMTyZ.js → activity-store-DF2dYXG1.js} +1 -1
  4. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-CAQdFrcu.js → agent-avatar-dicebear-Dw9rF5o1.js} +1 -1
  5. package/dist/gateway/static/root/assets/{agents-C6q_vDzP.js → agents-Dj86bHkl.js} +1 -1
  6. package/dist/gateway/static/root/assets/{api-B9pZAyMB.js → api-_H0Bam-t.js} +1 -1
  7. package/dist/gateway/static/root/assets/{app-management-settings-panel-DRsTwFbF.js → app-management-settings-panel-D-M6GN-8.js} +1 -1
  8. package/dist/gateway/static/root/assets/{appearance-settings-B99NaPTf.js → appearance-settings-XDhmzdIc.js} +1 -1
  9. package/dist/gateway/static/root/assets/{apps-page-Dx66anqa.js → apps-page-sfO835uz.js} +1 -1
  10. package/dist/gateway/static/root/assets/{archive-plugin-BF0q7N24.js → archive-plugin-DZCOhXch.js} +1 -1
  11. package/dist/gateway/static/root/assets/{attachment-load-D1qmjGDo.js → attachment-load-Bjb0FH2B.js} +1 -1
  12. package/dist/gateway/static/root/assets/{automations-page-Ccu4yRFa.js → automations-page-D4N3ZDhu.js} +1 -1
  13. package/dist/gateway/static/root/assets/{automations-workspace-CHbA8d-P.js → automations-workspace-PptuZgoo.js} +1 -1
  14. package/dist/gateway/static/root/assets/{binary-plugins-DooqxEZz.js → binary-plugins-uXPt0s47.js} +1 -1
  15. package/dist/gateway/static/root/assets/{block-editor-Dqg9kvb9.js → block-editor-gukkIEro.js} +1 -1
  16. package/dist/gateway/static/root/assets/{browser-settings-page-CpRc-9Jy.js → browser-settings-page-BoCmzMFV.js} +1 -1
  17. package/dist/gateway/static/root/assets/{browser-workflow-inputs-CsIh8ySc.js → browser-workflow-inputs-DAhdS-XZ.js} +1 -1
  18. package/dist/gateway/static/root/assets/{browser-workflows-page-BXQFxT0p.js → browser-workflows-page-LKjYzXS_.js} +1 -1
  19. package/dist/gateway/static/root/assets/{capabilities-settings-panel-C89FGECN.js → capabilities-settings-panel-DhkJsU8Z.js} +2 -2
  20. package/dist/gateway/static/root/assets/{capability-presets-api-BX9U0FRh.js → capability-presets-api-BBUkH833.js} +1 -1
  21. package/dist/gateway/static/root/assets/{capability-presets-settings-panel-XT6WEz9E.js → capability-presets-settings-panel-Dm7T61fE.js} +1 -1
  22. package/dist/gateway/static/root/assets/{channel-recipient-api-CUBTQ0Bz.js → channel-recipient-api-E5mo8M3a.js} +1 -1
  23. package/dist/gateway/static/root/assets/{channels-settings-DhKk1oNT.js → channels-settings-dG6UFVqt.js} +1 -1
  24. package/dist/gateway/static/root/assets/channels-status-swr-DgJxfNyK.js +1 -0
  25. package/dist/gateway/static/root/assets/{chat-terminal-dock-CTbkTsc2.js → chat-terminal-dock-CT5yoSMD.js} +1 -1
  26. package/dist/gateway/static/root/assets/{connectors-page-BDn3HTzX.js → connectors-page-BC6Ft9SU.js} +1 -1
  27. package/dist/gateway/static/root/assets/{cron-expression-XzPZhzVM.js → cron-expression-BGNuaqvI.js} +1 -1
  28. package/dist/gateway/static/root/assets/date-picker-k7mkklMU.js +1 -0
  29. package/dist/gateway/static/root/assets/{dependency-picker-ndtb88_T.js → dependency-picker-DZVSgLXH.js} +1 -1
  30. package/dist/gateway/static/root/assets/{desktop-pet-DZjW-7Tw.js → desktop-pet-p9EZyGzV.js} +1 -1
  31. package/dist/gateway/static/root/assets/{desktop-pet-settings-C7BLs783.js → desktop-pet-settings-Bw4cCFzI.js} +1 -1
  32. package/dist/gateway/static/root/assets/{directory-picker-path-field-BWiap88p.js → directory-picker-path-field-Cbst7IXR.js} +1 -1
  33. package/dist/gateway/static/root/assets/{extension-debug-page-D7APnE3n.js → extension-debug-page-Cd4BMKm_.js} +1 -1
  34. package/dist/gateway/static/root/assets/{extension-page-BhV5hz70.js → extension-page-CzEGCkOa.js} +1 -1
  35. package/dist/gateway/static/root/assets/{extension-settings-page-BhbcGuiJ.js → extension-settings-page-C1PAKSy2.js} +1 -1
  36. package/dist/gateway/static/root/assets/{gateway-config-api-CUt9bIpL.js → gateway-config-api-Bch9vO6t.js} +1 -1
  37. package/dist/gateway/static/root/assets/{gateway-config-swr-BTH9HVUk.js → gateway-config-swr-DNrttVr2.js} +1 -1
  38. package/dist/gateway/static/root/assets/{gateway-settings-RafSECLG.js → gateway-settings-DkDxZFGG.js} +1 -1
  39. package/dist/gateway/static/root/assets/{gateway-startup-retry-DAEk_tnd.js → gateway-startup-retry-B1vD3vRb.js} +1 -1
  40. package/dist/gateway/static/root/assets/{heartbeat-settings-CwVPlPLB.js → heartbeat-settings-DXNMxy5b.js} +1 -1
  41. package/dist/gateway/static/root/assets/{home-page-CbdBcCwC.js → home-page-CYcpVFNT.js} +1 -1
  42. package/dist/gateway/static/root/assets/{image-generation-api-HqcQrSed.js → image-generation-api-BTR0Wk_k.js} +1 -1
  43. package/dist/gateway/static/root/assets/index-Dgb1R07E.css +2 -0
  44. package/dist/gateway/static/root/assets/{index-CMLkr37Y.js → index-DlOYwVFK.js} +49 -49
  45. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BG6lShzn.js → keyboard-shortcuts-settings-CYlS4RGA.js} +1 -1
  46. package/dist/gateway/static/root/assets/{local-app-workbench-page-DdaPtQ5M.js → local-app-workbench-page-BFrgPwGE.js} +2 -2
  47. package/dist/gateway/static/root/assets/{local-apps-page-vaz8ewe2.js → local-apps-page-CNppYVew.js} +1 -1
  48. package/dist/gateway/static/root/assets/{locale-store-De8wYkd7.js → locale-store-gf9Bg2gb.js} +1 -1
  49. package/dist/gateway/static/root/assets/{logs-page-CjxMHTQO.js → logs-page-CPweLw3k.js} +1 -1
  50. package/dist/gateway/static/root/assets/{management-settings-tqTGCHt0.js → management-settings-IYk9xLgt.js} +1 -1
  51. package/dist/gateway/static/root/assets/{markdown-split-BGx8Aao0.js → markdown-split-D8e6pRMH.js} +1 -1
  52. package/dist/gateway/static/root/assets/{markdown-view-ybRARsPs.js → markdown-view-D0fiJjBQ.js} +1 -1
  53. package/dist/gateway/static/root/assets/{media-plugins-xbM-SSP5.js → media-plugins-CCq6TtEf.js} +1 -1
  54. package/dist/gateway/static/root/assets/messages-B9WQcZ1V.js +3 -0
  55. package/dist/gateway/static/root/assets/{notes-api-D9CCwyWK.js → notes-api-BBtWnlUU.js} +1 -1
  56. package/dist/gateway/static/root/assets/{notes-page-CMNBbg6g.js → notes-page-BKe1xa3U.js} +1 -1
  57. package/dist/gateway/static/root/assets/{notes-workbench-V9C-8vSn.js → notes-workbench-wieRAd1y.js} +2 -2
  58. package/dist/gateway/static/root/assets/{page-tabs-e99j9S9K.js → page-tabs-Bsluqyfb.js} +1 -1
  59. package/dist/gateway/static/root/assets/{preview-open-alternatives-DW9MDOva.js → preview-open-alternatives-BrpTWv44.js} +1 -1
  60. package/dist/gateway/static/root/assets/{product-open-page-CZdzgPZW.js → product-open-page-DXe5iWI6.js} +1 -1
  61. package/dist/gateway/static/root/assets/{project-detail-page-DHmAUggu.js → project-detail-page-Cww6V7HJ.js} +1 -1
  62. package/dist/gateway/static/root/assets/{projects-page-D0EiN69Y.js → projects-page-D0LKhCCw.js} +1 -1
  63. package/dist/gateway/static/root/assets/{registry-api-DYmKEwiG.js → registry-api-xj5gOva_.js} +1 -1
  64. package/dist/gateway/static/root/assets/{remote-access-hub-BuAVFk2O.js → remote-access-hub-Sf4Pde6Z.js} +1 -1
  65. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-DQ12tLCL.js → runtime-tools-settings-panel-BJTvmBCA.js} +1 -1
  66. package/dist/gateway/static/root/assets/{schema-form-DNCDIkqC.js → schema-form-DvGBa_7R.js} +1 -1
  67. package/dist/gateway/static/root/assets/{sessions-page-hzlTfgOl.js → sessions-page-S5gvgfu5.js} +1 -1
  68. package/dist/gateway/static/root/assets/settings-advanced-gate-B3XvdEy8.js +1 -0
  69. package/dist/gateway/static/root/assets/{settings-form-section-z0JH53Fu.js → settings-form-section-CiGFtdD8.js} +1 -1
  70. package/dist/gateway/static/root/assets/{settings-loading-skeleton-xgo41cfo.js → settings-loading-skeleton-sbef7GTm.js} +1 -1
  71. package/dist/gateway/static/root/assets/{settings-page-8astk_1U.js → settings-page-BNGxxXZe.js} +1 -1
  72. package/dist/gateway/static/root/assets/{setup-status-panel-fZQfoJAk.js → setup-status-panel-CGU_Mxjr.js} +1 -1
  73. package/dist/gateway/static/root/assets/{share-preview-page-BBZV4AGy.js → share-preview-page-C1523ij3.js} +1 -1
  74. package/dist/gateway/static/root/assets/{shares-settings-B5dPMq3Y.js → shares-settings-k0UQ8WxO.js} +1 -1
  75. package/dist/gateway/static/root/assets/skill-reload-api-DQ1GvL1w.js +1 -0
  76. package/dist/gateway/static/root/assets/{skills-page-BSN2VaqR.js → skills-page-OuHd9GcN.js} +1 -1
  77. package/dist/gateway/static/root/assets/{skills-page.utils-HmoDhJVh.js → skills-page.utils-Ditgz7Vo.js} +1 -1
  78. package/dist/gateway/static/root/assets/{system-settings-panel-CSibO8vj.js → system-settings-panel-CERqCsz2.js} +1 -1
  79. package/dist/gateway/static/root/assets/tab-completion-input-D64VNmiA.js +1 -0
  80. package/dist/gateway/static/root/assets/tab-completion-input.utils-BP3NH_du.js +1 -0
  81. package/dist/gateway/static/root/assets/{task-detail-page-HCKZ11E8.js → task-detail-page-BnRNL2sn.js} +1 -1
  82. package/dist/gateway/static/root/assets/{theme-store-STx6jo38.js → theme-store-DgSjes3O.js} +1 -1
  83. package/dist/gateway/static/root/assets/{typed-models-lib-zrYg51t3.js → typed-models-lib-abEJNkCO.js} +1 -1
  84. package/dist/gateway/static/root/assets/{use-autosave-CqFVx92z.js → use-autosave-Bp_qFZkl.js} +1 -1
  85. package/dist/gateway/static/root/assets/user-context-page-Cnkaiky5.js +1 -0
  86. package/dist/gateway/static/root/assets/{voice-api-key-field-pYDiKKMo.js → voice-api-key-field-hbzDfErG.js} +1 -1
  87. package/dist/gateway/static/root/assets/{work-discovery-overlay-LJLw9zf0.js → work-discovery-overlay-DZVib-04.js} +1 -1
  88. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-D0WhQ3kI.js → workflow-run-setup-panel-C2RKay1p.js} +1 -1
  89. package/dist/gateway/static/root/assets/workflows-page-B_VlcKiK.js +5 -0
  90. package/dist/gateway/static/root/index.html +11 -11
  91. package/dist/package.js +1 -1
  92. package/dist/src/agent/agent-manager.js +4 -4
  93. package/dist/src/agent/background-review/prompts.d.ts +1 -1
  94. package/dist/src/agent/background-review/prompts.js +4 -1
  95. package/dist/src/agent/embedded/model-runtime.js +1 -1
  96. package/dist/src/agent/embedded/run-for-session.js +1 -1
  97. package/dist/src/agent/image/tool-model-config.js +1 -1
  98. package/dist/src/agent/ipc/inbox.js +1 -1
  99. package/dist/src/agent/memory/create-memory-manager.js +1 -1
  100. package/dist/src/agent/service.js +2 -2
  101. package/dist/src/agent/session/session-inspector.js +1 -1
  102. package/dist/src/agent/skills/hub-lock.js +1 -1
  103. package/dist/src/agent/tasks/task-judge-service.js +3 -3
  104. package/dist/src/agent-runtime/index.js +1 -1
  105. package/dist/src/agent-runtime/runtime-profile.js +1 -1
  106. package/dist/src/ai-assist/text-assist.js +1 -1
  107. package/dist/src/auth/credentials.js +2 -2
  108. package/dist/src/auth/profiles/store.js +1 -1
  109. package/dist/src/auth/sync-provider-auth.js +2 -2
  110. package/dist/src/browser/providers/browser-ext-install.js +1 -1
  111. package/dist/src/cli/commands/doctor/checks/provider-auth.js +1 -1
  112. package/dist/src/cli/commands/models.js +1 -1
  113. package/dist/src/config/agent-profile.js +1 -1
  114. package/dist/src/config/index.js +4 -4
  115. package/dist/src/config/loader.js +1 -1
  116. package/dist/src/config/models-json.js +1 -1
  117. package/dist/src/connectors/connected-source-ingestion.js +21 -4
  118. package/dist/src/connectors/connected-source-normalizers.js +51 -4
  119. package/dist/src/connectors/connected-source-understanding.d.ts +19 -0
  120. package/dist/src/connectors/connected-source-understanding.js +132 -0
  121. package/dist/src/connectors/content-enrichment.d.ts +1 -0
  122. package/dist/src/connectors/content-enrichment.js +11 -7
  123. package/dist/src/connectors/learning-coordinator.js +55 -4
  124. package/dist/src/connectors/learning-recipes.js +2 -2
  125. package/dist/src/document-understanding/extract.d.ts +1 -1
  126. package/dist/src/document-understanding/extract.js +54 -1
  127. package/dist/src/extensions/lockfile.js +1 -1
  128. package/dist/src/gateway/agents-admin.js +2 -2
  129. package/dist/src/gateway/file-path-classifier.js +1 -1
  130. package/dist/src/gateway/heartbeat/service.js +1 -1
  131. package/dist/src/gateway/hono/lib/config-payload.js +1 -1
  132. package/dist/src/gateway/hono/routes/models.js +1 -1
  133. package/dist/src/gateway/hono/routes/understanding-sources.js +25 -7
  134. package/dist/src/gateway/hono/routes/workflows.js +2 -2
  135. package/dist/src/gateway/rate-limit/buckets.d.ts +1 -1
  136. package/dist/src/gateway/rate-limit/buckets.js +2 -2
  137. package/dist/src/gateway/service/config-coordinator.js +1 -1
  138. package/dist/src/gateway/service.js +9 -9
  139. package/dist/src/heartbeat/index.js +1 -1
  140. package/dist/src/providers/auth-runtime/resolve-auth.js +1 -1
  141. package/dist/src/providers/index.js +2 -2
  142. package/dist/src/providers/model-registry.js +1 -1
  143. package/dist/src/providers/register-runtime-providers.js +1 -1
  144. package/dist/src/tui/tui-startup-resources.js +1 -1
  145. package/dist/src/tui/tui.js +1 -1
  146. package/dist/src/user-context/sources/catalog.js +9 -2
  147. package/dist/src/user-context/sources/local-source-contract.d.ts +1 -1
  148. package/dist/src/user-context/sources/local-source-contract.js +1 -0
  149. package/dist/src/user-context/understanding-writing.d.ts +1 -0
  150. package/dist/src/user-context/understanding-writing.js +4 -0
  151. package/dist/src/work-discovery/analyzer.d.ts +6 -0
  152. package/dist/src/work-discovery/analyzer.js +181 -57
  153. package/dist/src/work-discovery/index.js +1 -1
  154. package/dist/src/work-discovery/probe.js +20 -0
  155. package/dist/src/work-discovery/service.d.ts +9 -0
  156. package/dist/src/work-discovery/service.js +18 -6
  157. package/dist/src/work-discovery/types.d.ts +5 -0
  158. package/dist/src/workflows/service/workflow-run-service.js +1 -1
  159. package/package.json +3 -3
  160. package/dist/gateway/static/root/assets/channels-status-swr-CiwOOoVL.js +0 -1
  161. package/dist/gateway/static/root/assets/date-picker-BmZjs4Bq.js +0 -1
  162. package/dist/gateway/static/root/assets/index-AbNnQyKk.css +0 -2
  163. package/dist/gateway/static/root/assets/messages-VI9m1xJl.js +0 -3
  164. package/dist/gateway/static/root/assets/settings-advanced-gate-BlCoA_9h.js +0 -1
  165. package/dist/gateway/static/root/assets/skill-reload-api-i1PGf1V2.js +0 -1
  166. package/dist/gateway/static/root/assets/tab-completion-input-B-VsxKhC.js +0 -1
  167. package/dist/gateway/static/root/assets/user-context-page-CqG56cDS.js +0 -1
  168. package/dist/gateway/static/root/assets/workflows-page-DQAJzV5w.js +0 -5
@@ -1 +0,0 @@
1
- import{vr as e}from"./index-CMLkr37Y.js";function t(t){let{children:n,fallback:r}=t,i=r===void 0?null:r;return e()?n:i}export{t};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-aKtaBQYM.js";import{o as t,r as n}from"./locale-store-De8wYkd7.js";import{gr as r}from"./index-CMLkr37Y.js";var i=e({reloadSkills:()=>a});async function a(){let e=await t(n(`/api/skills/reload`),{method:`POST`});if(!e.ok)throw Error(await r(e))}export{i as n,a as t};
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";var i=n(),a=e(t(),1),o=r();function s(e){return e.replace(/^(?:例如\s*[::]?|for example\s*[::]?|e\.g\.\s*)/i,``).replace(/…$/,``).trim()}function c(e,t){return t?.trim()?e?e.split(/\s+/).includes(`Tab`)?e:`${e} Tab`:`Tab`:e}function l(e,t){return e.key===`Tab`&&!e.shiftKey&&!e.metaKey&&!e.ctrlKey&&!e.altKey&&!e.nativeEvent.isComposing&&!e.currentTarget.disabled&&!e.currentTarget.readOnly&&!e.currentTarget.value.trim()&&!!t?.trim()}function u(e,t,n,r){r?.(e),!(e.defaultPrevented||!l(e,t))&&(e.preventDefault(),n(t))}var d=(0,a.forwardRef)(function(e,t){let n=(0,i.c)(18),r,a,s,l,d;n[0]===e?(r=n[1],a=n[2],s=n[3],l=n[4],d=n[5]):({suggestion:d,onAcceptSuggestion:r,onKeyDown:a,"aria-keyshortcuts":l,...s}=e,n[0]=e,n[1]=r,n[2]=a,n[3]=s,n[4]=l,n[5]=d);let f;n[6]!==l||n[7]!==d?(f=c(l,d),n[6]=l,n[7]=d,n[8]=f):f=n[8];let p;n[9]!==r||n[10]!==a||n[11]!==d?(p=e=>u(e,d,r,a),n[9]=r,n[10]=a,n[11]=d,n[12]=p):p=n[12];let m;return n[13]!==s||n[14]!==t||n[15]!==f||n[16]!==p?(m=(0,o.jsx)(`input`,{...s,ref:t,"aria-keyshortcuts":f,onKeyDown:p}),n[13]=s,n[14]=t,n[15]=f,n[16]=p,n[17]=m):m=n[17],m}),f=(0,a.forwardRef)(function(e,t){let n=(0,i.c)(18),r,a,s,l,d;n[0]===e?(r=n[1],a=n[2],s=n[3],l=n[4],d=n[5]):({suggestion:d,onAcceptSuggestion:r,onKeyDown:a,"aria-keyshortcuts":l,...s}=e,n[0]=e,n[1]=r,n[2]=a,n[3]=s,n[4]=l,n[5]=d);let f;n[6]!==l||n[7]!==d?(f=c(l,d),n[6]=l,n[7]=d,n[8]=f):f=n[8];let p;n[9]!==r||n[10]!==a||n[11]!==d?(p=e=>u(e,d,r,a),n[9]=r,n[10]=a,n[11]=d,n[12]=p):p=n[12];let m;return n[13]!==s||n[14]!==t||n[15]!==f||n[16]!==p?(m=(0,o.jsx)(`textarea`,{...s,ref:t,"aria-keyshortcuts":f,onKeyDown:p}),n[13]=s,n[14]=t,n[15]=f,n[16]=p,n[17]=m):m=n[17],m});export{f as n,s as r,d as t};
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{p as i,t as a}from"./chunk-KS7C4IRE-BaASWQor.js";import{n as o,r as s}from"./popover-select-BzdnTy3h.js";import{t as c}from"./external-link-DjqjBmc3.js";import{t as l}from"./loader-circle-CifKLtgG.js";import{t as u}from"./plus-Q2yW6OE7.js";import{t as d}from"./x-B_N4OPjy.js";import{t as f}from"./button-CSEbl4zT.js";import{n as p}from"./locale-store-De8wYkd7.js";import{a as m,i as h,n as g,o as _,r as v,s as y,t as b}from"./dist-BPoKqzeH.js";import{i as x}from"./vendor-swr-BIWyz7Rc.js";import{Bl as S,Bs as C,Co as w,El as T,Fl as E,Jc as D,Ls as O,Ms as k,Pl as A,Ql as j,So as M,St as N,Ua as P,_o as F,ac as I,ao as L,bc as R,bo as z,co as B,do as V,fo as H,fs as U,go as W,ho as G,lo as K,mo as ee,oo as te,pc as q,pl as J,po as Y,ro as X,so as ne,uo as re,vo as ie,vs as ae,vt as oe,xo as se,xt as ce,yo as le,zl as ue}from"./index-CMLkr37Y.js";import{n as de,t as fe}from"./use-autosave-CqFVx92z.js";import{t as pe}from"./tab-completion-input-B-VsxKhC.js";import{t as me}from"./page-tabs-e99j9S9K.js";var Z=n(),Q=e(t(),1),$=r(),he=new Set([`profile`,`understanding`,`collaboration`,`sources`,`dreaming`,`privacy`]),ge=`w-full rounded-xl border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent/60 focus:ring-2 focus:ring-accent/20`,_e={en:{title:`You`,subtitle:`A living portrait, shaped together by you and xopc.`,profile:`Your portrait`,understanding:`Shared understanding`,collaboration:`Working together`,sources:`Sources`,dreaming:`Background review`,privacy:`Privacy`,portraitEyebrow:`YOU × XOPC`,portraitIntro:`This is how xopc currently understands you. It grows through your conversations and work — and you always have the final say.`,maintainedTogether:`Shaped together`,youDecide:`You decide what stays`,editProfile:`Edit basics`,talkAboutMe:`Add through conversation`,roleMissing:`Add what you do`,direction:`What matters now`,directionEmpty:`Add a direction so xopc can help keep important work moving.`,portraitUnderstanding:`What xopc understands`,portraitUnderstandingHint:`Confirmed context xopc can use across conversations.`,portraitRules:`How we work together`,portraitRulesHint:`The agreements xopc should follow when helping you.`,reviewWaiting:`waiting for your review`,seeAll:`See all`,addFirstUnderstanding:`Nothing confirmed yet. Tell xopc what matters to you, or review a suggestion when one appears.`,addFirstRule:`No working agreements yet. Add one to make collaboration feel more like yours.`,portraitControl:`How this portrait evolves`,portraitControlHint:`Manage where understanding comes from, how it is reviewed, and what is never retained.`,portraitLearn:`Learn how this portrait is formed`,advanced:`Portrait controls`,backToPortrait:`Back to your portrait`,controlSourcesHint:`See which conversations, connections, and explicit details shape xopc’s understanding.`,controlReviewHint:`Choose how xopc proposes updates and which changes require your confirmation.`,controlPrivacyHint:`Set the boundaries for sensitive content and long-term retention.`,controlTrust:`Inferred understanding is never activated automatically. You can review, correct, or remove it at any time.`,profileHint:`Facts you provide directly. These are available across conversations.`,done:`Done`,required:`This field cannot be empty.`,callName:`What should xopc call you?`,callNamePlaceholder:`For example: Alex, Joyce, or Dr. Chen`,role:`Your role`,rolePlaceholder:`For example: product designer, founder, or engineer`,primaryGoal:`What are you mainly trying to achieve?`,primaryGoalPlaceholder:`The outcome you want xopc to optimize for`,pronouns:`Pronouns (optional)`,pronounsPlaceholder:`For example: she/her, he/him, they/them`,timezone:`Timezone`,locale:`Language / locale`,detect:`Use this device`,understoodHint:`Reviewable beliefs learned from your conversations and work. Inferences stay pending until confirmed.`,addUnderstanding:`Add understanding`,statement:`What should xopc understand?`,kind:`Type`,add:`Add`,cancel:`Cancel`,active:`Active`,review:`Needs review`,confirm:`Confirm`,reject:`Wrong`,edit:`Edit`,delete:`Delete`,confirmDelete:`Delete now`,rulesHint:`Explicit instructions for how xopc should collaborate with you. Rules outrank inferred understanding.`,addRule:`Add rule`,ruleStatement:`How should xopc work with you?`,category:`Category`,disable:`Disable`,enable:`Enable`,emptyUnderstanding:`Nothing here yet. Tell xopc something explicitly, or confirm a suggestion after it learns one.`,qualityTitle:`Learning quality`,qualityActive:`Confirmed`,qualityPending:`Pending review`,qualityAcceptance:`30-day acceptance`,qualityRecall:`Helpful recall`,qualitySourceCoverage:`Source coverage`,qualityBootstrapTime:`Median first sync`,qualityNoData:`Not enough feedback yet`,emptyRules:`No working agreements yet.`,sourceExplicit:`You said this directly`,sourceInferred:`Inferred — may be wrong`,sourceObserved:`Observed across prior work`,sourcesHint:`Review every granted source, its access mode, retention, and last collection. Revoking stops future learning.`,manageSources:`Connect another source`,authorizedSources:`Authorized sources`,connectorsTitle:`Connectors`,openConnector:`Open connector`,noSources:`No sources are authorized.`,noConnectors:`No connectors are installed.`,connected:`Connected`,unavailable:`Needs attention`,revoke:`Revoke source`,revokeHint:`Revoke this source and remove its derived understanding`,confirmRevoke:`Confirm revoke`,revoking:`Revoking…`,revokeDone:`Source revoked and derived understanding removed.`,refresh:`Update`,refreshing:`Updating…`,refreshStarted:`Update started.`,actionFailed:`Action failed`,once:`One-time`,continuous:`Continuous`,localOnly:`Local only`,derivedOnly:`Derived understanding only`,focuses:`Current focuses`,focusHint:`Candidate focuses never activate until you confirm them.`,activate:`Activate`,pause:`Pause`,complete:`Complete`,noFocuses:`No focus candidates yet.`,focusCandidate:`Suggested`,focusActive:`Active`,focusPaused:`Paused`,focusCompleted:`Completed`,confidence:`Confidence`,confidenceHigh:`High`,confidenceMedium:`Medium`,confidenceLow:`Low`,contentReadTitle:`Optional deeper reading`,contentReadHint:`Metadata identified these recent items. Select up to 5 to explicitly allow one bounded content read; nothing is opened automatically.`,readSelected:`Read selected`,reading:`Reading…`,contentReadDone:`Selected content was read and indexed.`,dreamingHint:`A deterministic daily review checks expiry, contradictory evidence, and corroborated candidates. It never auto-activates an inference.`,mode:`Background review`,on:`On — propose for review`,off:`Off`,reviewTime:`Daily review time`,evidenceThreshold:`Supporting evidence required`,scanLimit:`Maximum items per run`,lastRun:`Last review`,neverRun:`Not run yet`,runCompleted:`Completed`,runFailed:`Failed`,runRunning:`Running`,runItems:`items`,privacyHint:`Choose how generic memory providers handle sensitive content. Structured user understanding applies stricter rules of its own.`,sensitivePolicy:`Sensitive memory writes`,policyDeny:`Do not store`,policyConfirm:`Ask before storing`,policyAllow:`Store when relevant`,privacyWarning:`Secret and regulated content is never stored as structured user understanding, regardless of this setting.`,error:`Could not load your context.`,retry:`Try again`},zh:{title:`你`,subtitle:`一份由你和 xopc 共同塑造、持续生长的画像。`,profile:`你的画像`,understanding:`共同理解`,collaboration:`协作方式`,sources:`数据来源`,dreaming:`后台复核`,privacy:`隐私`,portraitEyebrow:`YOU × XOPC`,portraitIntro:`这是 xopc 此刻对你的理解。它会在对话与共事中逐渐丰富,而你始终拥有最终决定权。`,maintainedTogether:`由你与 xopc 共同维护`,youDecide:`你决定什么被保留`,editProfile:`编辑基本信息`,talkAboutMe:`在对话中补充`,roleMissing:`补充你的角色`,direction:`此刻重要的事`,directionEmpty:`写下你此刻的方向,让 xopc 帮你持续推动真正重要的事。`,portraitUnderstanding:`xopc 对你的理解`,portraitUnderstandingHint:`已经确认、可以在不同对话中帮助你的上下文。`,portraitRules:`我们如何一起工作`,portraitRulesHint:`xopc 在帮助你时应该遵循的约定。`,reviewWaiting:`条等待你确认`,seeAll:`查看全部`,addFirstUnderstanding:`还没有已确认的理解。你可以直接告诉 xopc 什么对你重要,或在它形成建议后确认。`,addFirstRule:`还没有协作约定。添加后,xopc 会更像你熟悉的搭档。`,portraitControl:`这份画像如何更新`,portraitControlHint:`管理理解从哪里来、如何复核,以及哪些内容永远不会被保留。`,portraitLearn:`了解这份画像如何形成`,advanced:`画像管理`,backToPortrait:`返回你的画像`,controlSourcesHint:`查看哪些对话、连接与明确告知的内容塑造了 xopc 的理解。`,controlReviewHint:`决定 xopc 如何提出更新,以及哪些变化需要你确认。`,controlPrivacyHint:`设定敏感内容与长期保留的边界。`,controlTrust:`推断出的理解不会自动生效。你可以随时复核、修正或删除。`,profileHint:`由你直接提供的事实,会在不同对话中使用。`,done:`完成`,required:`此项不能为空。`,callName:`希望 xopc 如何称呼你?`,callNamePlaceholder:`例如:Mic、Joyce、张老师`,role:`你的角色`,rolePlaceholder:`例如:产品设计师、创业者、工程师`,primaryGoal:`你目前最想达成什么?`,primaryGoalPlaceholder:`希望 xopc 优先帮助你实现的结果`,pronouns:`代词(可选)`,pronounsPlaceholder:`例如:she/her、he/him、they/them`,timezone:`时区`,locale:`语言 / 地区`,detect:`使用本机时区`,understoodHint:`从对话和工作中形成、可复核的理解。推断内容在你确认前保持待审核。`,addUnderstanding:`添加理解`,statement:`希望 xopc 了解什么?`,kind:`类型`,add:`添加`,cancel:`取消`,active:`使用中`,review:`待审核`,confirm:`确认`,reject:`不正确`,edit:`编辑`,delete:`删除`,confirmDelete:`确认删除`,rulesHint:`你明确设定的协作方式。协作约定的优先级高于推断出的理解。`,addRule:`添加约定`,ruleStatement:`希望 xopc 如何与你协作?`,category:`类别`,disable:`停用`,enable:`启用`,emptyUnderstanding:`还没有内容。你可以直接告诉 xopc,或在它学到建议后进行确认。`,emptyRules:`还没有协作约定。`,qualityTitle:`学习质量`,qualityActive:`已确认`,qualityPending:`待审核`,qualityAcceptance:`30 天采纳率`,qualityRecall:`有效召回`,qualitySourceCoverage:`来源覆盖率`,qualityBootstrapTime:`首次同步中位耗时`,qualityNoData:`反馈数据还不足`,sourceExplicit:`由你直接告知`,sourceInferred:`推断内容,可能有误`,sourceObserved:`从过往工作中观察到`,sourcesHint:`查看每项授权的访问方式、保留策略和最近采集时间;撤销后将停止后续学习。`,manageSources:`连接其他来源`,authorizedSources:`已授权数据来源`,connectorsTitle:`连接器`,openConnector:`打开连接器`,noSources:`尚未授权任何来源。`,noConnectors:`尚未安装连接器。`,connected:`已连接`,unavailable:`需要处理`,revoke:`撤销来源`,revokeHint:`撤销此来源并删除由它产生的理解`,confirmRevoke:`确认撤销`,revoking:`正在撤销…`,revokeDone:`已撤销来源并删除派生理解。`,refresh:`更新`,refreshing:`正在更新…`,refreshStarted:`更新任务已开始。`,actionFailed:`操作失败`,once:`仅一次`,continuous:`持续更新`,localOnly:`仅本地处理`,derivedOnly:`仅保留派生理解`,focuses:`当前关注`,focusHint:`候选关注不会自动生效,只有你确认后才会启用。`,activate:`启用`,pause:`暂停`,complete:`完成`,noFocuses:`还没有候选关注。`,focusCandidate:`待确认`,focusActive:`进行中`,focusPaused:`已暂停`,focusCompleted:`已完成`,confidence:`置信度`,confidenceHigh:`高`,confidenceMedium:`中`,confidenceLow:`低`,contentReadTitle:`可选的深入读取`,contentReadHint:`元数据识别出这些近期条目。你可以选择最多 5 项,明确授权一次有界正文读取;系统不会自动打开内容。`,readSelected:`读取所选内容`,reading:`正在读取…`,contentReadDone:`已读取并索引所选内容。`,dreamingHint:`每天进行一次确定性复核,检查过期、矛盾证据和得到佐证的候选理解;推断内容不会自动生效。`,mode:`后台复核`,on:`开启并生成待审核项`,off:`关闭`,reviewTime:`每日复核时间`,evidenceThreshold:`所需支持证据数`,scanLimit:`每次最多检查`,lastRun:`最近一次复核`,neverRun:`尚未运行`,runCompleted:`已完成`,runFailed:`失败`,runRunning:`运行中`,runItems:`项`,privacyHint:`选择通用记忆服务如何处理敏感内容;结构化用户理解有独立且更严格的规则。`,sensitivePolicy:`敏感记忆写入`,policyDeny:`不保存`,policyConfirm:`保存前询问`,policyAllow:`相关时允许保存`,privacyWarning:`无论这里如何设置,秘密和受监管内容都不会保存为结构化用户理解。`,error:`无法加载用户上下文。`,retry:`重试`}},ve={preference:{en:`Preference`,zh:`偏好`},boundary:{en:`Boundary`,zh:`边界`},relationship:{en:`Relationship`,zh:`关系`},routine:{en:`Routine`,zh:`习惯`},current_state:{en:`Current state`,zh:`当前状态`},long_term_goal:{en:`Long-term goal`,zh:`长期目标`},project_context:{en:`Project context`,zh:`项目背景`},task_lesson:{en:`Task lesson`,zh:`任务经验`},derived_insight:{en:`Insight`,zh:`洞察`}},ye={communication:{en:`Communication`,zh:`沟通`},execution:{en:`Execution`,zh:`执行`},boundary:{en:`Boundary`,zh:`边界`},routine:{en:`Routine`,zh:`习惯`},proactive:{en:`Proactive help`,zh:`主动协助`}};function be(e){let t=(0,Z.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,$.jsx)(`section`,{className:`rounded-2xl border border-edge bg-surface-panel p-4 sm:p-5`,children:n}),t[0]=n,t[1]=r),r}function xe(e){let t=(0,Z.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,$.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge px-5 py-10 text-center text-sm text-fg-muted`,children:n}),t[0]=n,t[1]=r),r}function Se(e){let t=(0,Z.c)(33),{open:n,onOpenChange:r,title:i,description:a,submitLabel:o,cancelLabel:s,submitDisabled:c,onSubmit:l,children:u}=e,p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(m,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),t[0]=p):p=t[0];let x;t[1]===i?x=t[2]:(x=(0,$.jsx)(y,{className:`text-base font-semibold text-fg`,children:i}),t[1]=i,t[2]=x);let S;t[3]===a?S=t[4]:(S=(0,$.jsx)(h,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:a}),t[3]=a,t[4]=S);let C;t[5]!==x||t[6]!==S?(C=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[x,S]}),t[5]=x,t[6]=S,t[7]=C):C=t[7];let w;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,$.jsx)(d,{className:`size-4`}),t[8]=w):w=t[8];let T;t[9]===s?T=t[10]:(T=(0,$.jsx)(g,{asChild:!0,children:(0,$.jsx)(f,{type:`button`,variant:`ghost`,className:`size-8 shrink-0 p-0`,"aria-label":s,children:w})}),t[9]=s,t[10]=T);let E;t[11]!==C||t[12]!==T?(E=(0,$.jsxs)(`header`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge px-5 py-4`,children:[C,T]}),t[11]=C,t[12]=T,t[13]=E):E=t[13];let D;t[14]===u?D=t[15]:(D=(0,$.jsx)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-5`,children:u}),t[14]=u,t[15]=D);let O;t[16]===s?O=t[17]:(O=(0,$.jsx)(g,{asChild:!0,children:(0,$.jsx)(f,{type:`button`,children:s})}),t[16]=s,t[17]=O);let k;t[18]!==c||t[19]!==o?(k=(0,$.jsx)(f,{type:`submit`,variant:`primary`,disabled:c,children:o}),t[18]=c,t[19]=o,t[20]=k):k=t[20];let A;t[21]!==k||t[22]!==O?(A=(0,$.jsxs)(`footer`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-3`,children:[O,k]}),t[21]=k,t[22]=O,t[23]=A):A=t[23];let j;t[24]!==l||t[25]!==A||t[26]!==E||t[27]!==D?(j=(0,$.jsxs)(_,{children:[p,(0,$.jsx)(v,{className:`fixed left-1/2 top-1/2 z-[90] h-[min(30rem,calc(100vh-2rem))] w-[min(36rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`,children:(0,$.jsxs)(`form`,{className:`flex h-full min-h-0 flex-col`,onSubmit:l,children:[E,D,A]})})]}),t[24]=l,t[25]=A,t[26]=E,t[27]=D,t[28]=j):j=t[28];let M;return t[29]!==r||t[30]!==n||t[31]!==j?(M=(0,$.jsx)(b,{open:n,onOpenChange:r,children:j}),t[29]=r,t[30]=n,t[31]=j,t[32]=M):M=t[32],M}function Ce(e){return JSON.stringify(e)}function we(e){let t=(0,Z.c)(10),[n,r]=(0,Q.useState)(e),i;t[0]===e?i=t[1]:(i=Ce(e),t[0]=e,t[1]=i);let a=(0,Q.useRef)(i),o;t[2]===e?o=t[3]:(o=Ce(e),t[2]=e,t[3]=o);let s=o,c,l;t[4]!==e||t[5]!==s?(c=()=>{if(s===a.current)return;let t=a.current;a.current=s,r(n=>Ce(n)===t?e:n)},l=[e,s],t[4]=e,t[5]=s,t[6]=c,t[7]=l):(c=t[6],l=t[7]),(0,Q.useEffect)(c,l);let u;return t[8]===n?u=t[9]:(u=[n,r],t[8]=n,t[9]=u),u}function Te(e){return{callName:e.callName,role:e.role,primaryGoal:e.primaryGoal,pronouns:e.pronouns,timezone:e.timezone,locale:e.locale}}function Ee(){let e=(0,Z.c)(68),t=p(Ae),n=_e[t],[r,a]=i(),o;if(e[0]!==r){let t=r.get(`tab`);o=t&&he.has(t)?t:`profile`,e[0]=r,e[1]=o}else o=e[1];let s=o,c=X(ke),l=X(Oe),{data:u,error:d,isLoading:m,mutate:h}=x(`/api/you`,Y),g;e[2]!==l||e[3]!==c||e[4]!==n.subtitle||e[5]!==n.title?(g=()=>(c({startExtra:null,main:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h1`,{className:`text-base font-semibold text-fg`,children:n.title}),(0,$.jsx)(`p`,{className:`hidden text-xs text-fg-muted sm:block`,children:n.subtitle})]}),end:null}),l),e[2]=l,e[3]=c,e[4]=n.subtitle,e[5]=n.title,e[6]=g):g=e[6];let _;if(e[7]!==l||e[8]!==c||e[9]!==n?(_=[l,c,n],e[7]=l,e[8]=c,e[9]=n,e[10]=_):_=e[10],(0,Q.useEffect)(g,_),m){let t;return e[11]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`div`,{className:`space-y-4 p-4 sm:p-6`,children:[(0,$.jsx)(P,{className:`h-10 w-96 max-w-full`}),(0,$.jsx)(P,{className:`h-72 rounded-2xl`})]}),e[11]=t):t=e[11],t}if(d||!u){let t;e[12]===h?t=e[13]:(t=()=>void h(),e[12]=h,e[13]=t);let r;e[14]!==n.retry||e[15]!==t?(r=(0,$.jsx)(`button`,{className:`text-accent hover:underline`,onClick:t,children:n.retry}),e[14]=n.retry,e[15]=t,e[16]=r):r=e[16];let i;return e[17]!==n.error||e[18]!==r?(i=(0,$.jsx)(`div`,{className:`p-6`,children:(0,$.jsxs)(xe,{children:[n.error,` `,r]})}),e[17]=n.error,e[18]=r,e[19]=i):i=e[19],i}let v=s===`sources`||s===`dreaming`||s===`privacy`,y;e[20]!==v||e[21]!==u||e[22]!==a||e[23]!==n.advanced||e[24]!==n.backToPortrait||e[25]!==n.collaboration||e[26]!==n.profile||e[27]!==n.title||e[28]!==n.understanding||e[29]!==s?(y=v?(0,$.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-edge pb-4`,children:[(0,$.jsxs)(f,{variant:`ghost`,className:`-ml-2`,onClick:()=>a({tab:`profile`}),children:[(0,$.jsx)(E,{className:`size-4`}),n.backToPortrait]}),(0,$.jsx)(`span`,{className:`h-4 w-px bg-edge`,"aria-hidden":`true`}),(0,$.jsx)(`span`,{className:`text-sm font-medium text-fg-muted`,children:n.advanced})]}):(0,$.jsx)(me,{ariaLabel:n.title,activeTab:s,onChange:e=>a({tab:e}),items:[{id:`profile`,label:n.profile,icon:T},{id:`understanding`,label:n.understanding,icon:S,count:u.understandings.filter(De).length||void 0},{id:`collaboration`,label:n.collaboration,icon:D}]}),e[20]=v,e[21]=u,e[22]=a,e[23]=n.advanced,e[24]=n.backToPortrait,e[25]=n.collaboration,e[26]=n.profile,e[27]=n.title,e[28]=n.understanding,e[29]=s,e[30]=y):y=e[30];let b;e[31]!==u||e[32]!==t||e[33]!==h||e[34]!==a||e[35]!==n||e[36]!==s?(b=s===`profile`?(0,$.jsx)(je,{data:u,language:t,t:n,onNavigate:e=>a({tab:e}),onProfileChanged:e=>h(t=>t&&{...t,profile:e},{revalidate:!1})}):null,e[31]=u,e[32]=t,e[33]=h,e[34]=a,e[35]=n,e[36]=s,e[37]=b):b=e[37];let C;e[38]!==u||e[39]!==t||e[40]!==h||e[41]!==n||e[42]!==s?(C=s===`understanding`?(0,$.jsx)(Be,{items:u.understandings,quality:u.quality,language:t,t:n,onChanged:e=>e?h(t=>t&&{...t,understandings:t.understandings.map(t=>t.id===e.id?e:t)},{revalidate:!0}):h()}):null,e[38]=u,e[39]=t,e[40]=h,e[41]=n,e[42]=s,e[43]=C):C=e[43];let w;e[44]!==u||e[45]!==t||e[46]!==h||e[47]!==n||e[48]!==s?(w=s===`collaboration`?(0,$.jsx)(Je,{rules:u.rules,language:t,t:n,onChanged:()=>h()}):null,e[44]=u,e[45]=t,e[46]=h,e[47]=n,e[48]=s,e[49]=w):w=e[49];let O;e[50]!==n||e[51]!==s?(O=s===`sources`?(0,$.jsx)(Ze,{t:n}):null,e[50]=n,e[51]=s,e[52]=O):O=e[52];let k;e[53]!==u||e[54]!==n||e[55]!==s?(k=s===`dreaming`?(0,$.jsx)(Qe,{lastRun:u.consolidation?.lastRun??null,t:n}):null,e[53]=u,e[54]=n,e[55]=s,e[56]=k):k=e[56];let A;e[57]!==n||e[58]!==s?(A=s===`privacy`?(0,$.jsx)(et,{t:n}):null,e[57]=n,e[58]=s,e[59]=A):A=e[59];let j;return e[60]!==y||e[61]!==b||e[62]!==C||e[63]!==w||e[64]!==O||e[65]!==k||e[66]!==A?(j=(0,$.jsxs)(`div`,{className:`mx-auto w-full max-w-6xl space-y-5 p-4 sm:p-6 lg:py-8`,children:[y,b,C,w,O,k,A]}),e[60]=y,e[61]=b,e[62]=C,e[63]=w,e[64]=O,e[65]=k,e[66]=A,e[67]=j):j=e[67],j}function De(e){return[`candidate`,`needs_review`,`stale`].includes(e.status)}function Oe(e){return e.clearPageHeader}function ke(e){return e.setPageHeader}function Ae(e){return e.language}function je(e){let t=(0,Z.c)(176),{data:n,language:r,t:i,onNavigate:o,onProfileChanged:s}=e,[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(!1),p,m,h,g,_,v,y,b,x,w;if(t[0]!==n.profile.callName||t[1]!==n.profile.primaryGoal||t[2]!==n.profile.role||t[3]!==n.rules||t[4]!==n.understandings||t[5]!==r||t[6]!==o||t[7]!==i.addFirstRule||t[8]!==i.addFirstUnderstanding||t[9]!==i.advanced||t[10]!==i.direction||t[11]!==i.directionEmpty||t[12]!==i.editProfile||t[13]!==i.maintainedTogether||t[14]!==i.portraitEyebrow||t[15]!==i.portraitIntro||t[16]!==i.portraitRules||t[17]!==i.portraitRulesHint||t[18]!==i.portraitUnderstanding||t[19]!==i.portraitUnderstandingHint||t[20]!==i.reviewWaiting||t[21]!==i.roleMissing||t[22]!==i.seeAll||t[23]!==i.talkAboutMe||t[24]!==i.youDecide){let e=n.understandings.filter(Pe),s;t[35]===n.understandings?s=t[36]:(s=n.understandings.filter(Ne),t[35]=n.understandings,t[36]=s);let c=s,u=n.rules.filter(Me),C,T;t[37]!==n.profile.callName||t[38]!==r?(C=n.profile.callName.trim()||(r===`zh`?`你`:`You`),T=[...C][0]?.toLocaleUpperCase()??`Y`,t[37]=n.profile.callName,t[38]=r,t[39]=C,t[40]=T):(C=t[39],T=t[40]);let E=T;x=`space-y-5`;let M;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,$.jsx)(`div`,{className:`absolute inset-x-0 top-0 h-px bg-gradient-to-r from-transparent via-accent/40 to-transparent`,"aria-hidden":`true`}),t[41]=M):M=t[41];let N;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,$.jsx)(k,{className:`size-3.5`}),t[42]=N):N=t[42];let P;t[43]===i.portraitEyebrow?P=t[44]:(P=(0,$.jsxs)(`div`,{className:`mb-7 flex items-center gap-2 text-[11px] font-semibold tracking-[0.18em] text-accent`,children:[N,i.portraitEyebrow]}),t[43]=i.portraitEyebrow,t[44]=P);let F;t[45]===E?F=t[46]:(F=(0,$.jsx)(`div`,{className:`flex size-16 shrink-0 items-center justify-center rounded-2xl border border-edge bg-surface-muted text-2xl font-semibold text-fg sm:size-20 sm:text-3xl`,children:E}),t[45]=E,t[46]=F);let I;t[47]===C?I=t[48]:(I=(0,$.jsx)(`h2`,{className:`truncate text-2xl font-semibold tracking-tight text-fg sm:text-3xl`,children:C}),t[47]=C,t[48]=I);let L;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(L=()=>l(!0),t[49]=L):L=t[49];let z;t[50]!==n.profile.role||t[51]!==i.roleMissing?(z=n.profile.role.trim()||i.roleMissing,t[50]=n.profile.role,t[51]=i.roleMissing,t[52]=z):z=t[52];let B;t[53]===z?B=t[54]:(B=(0,$.jsx)(`button`,{className:`mt-1 text-left text-sm text-fg-muted transition-colors hover:text-accent`,onClick:L,children:z}),t[53]=z,t[54]=B);let V;t[55]!==I||t[56]!==B?(V=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[I,B]}),t[55]=I,t[56]=B,t[57]=V):V=t[57];let H;t[58]!==F||t[59]!==V?(H=(0,$.jsxs)(`div`,{className:`flex items-center gap-4`,children:[F,V]}),t[58]=F,t[59]=V,t[60]=H):H=t[60];let W;t[61]===i.portraitIntro?W=t[62]:(W=(0,$.jsx)(`p`,{className:`mt-7 max-w-2xl text-base leading-7 text-fg-muted`,children:i.portraitIntro}),t[61]=i.portraitIntro,t[62]=W);let G;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,$.jsx)(`span`,{className:`size-1.5 rounded-full bg-success`}),t[63]=G):G=t[63];let K;t[64]===i.maintainedTogether?K=t[65]:(K=(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[G,i.maintainedTogether]}),t[64]=i.maintainedTogether,t[65]=K);let ee,te;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(ee=()=>d(!0),te=(0,$.jsx)(O,{className:`size-3.5`}),t[66]=ee,t[67]=te):(ee=t[66],te=t[67]);let q;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,$.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),t[68]=q):q=t[68];let J;t[69]===i.advanced?J=t[70]:(J=(0,$.jsx)(`span`,{className:`font-medium text-accent`,children:i.advanced}),t[69]=i.advanced,t[70]=J);let Y;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,$.jsx)(A,{className:`size-3`}),t[71]=Y):Y=t[71];let X;t[72]!==i.youDecide||t[73]!==J?(X=(0,$.jsxs)(`button`,{className:`inline-flex items-center gap-1.5 rounded-md transition-colors hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/30`,onClick:ee,children:[te,i.youDecide,q,J,Y]}),t[72]=i.youDecide,t[73]=J,t[74]=X):X=t[74];let ne;t[75]!==K||t[76]!==X?(ne=(0,$.jsxs)(`div`,{className:`mt-6 flex flex-wrap items-center gap-x-5 gap-y-2 text-xs text-fg-subtle`,children:[K,X]}),t[75]=K,t[76]=X,t[77]=ne):ne=t[77];let re;t[78]!==P||t[79]!==H||t[80]!==W||t[81]!==ne?(re=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[P,H,W,ne]}),t[78]=P,t[79]=H,t[80]=W,t[81]=ne,t[82]=re):re=t[82];let ie;t[83]===i.direction?ie=t[84]:(ie=(0,$.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.12em] text-fg-subtle`,children:i.direction}),t[83]=i.direction,t[84]=ie);let ae=`mt-4 text-base leading-7 ${n.profile.primaryGoal.trim()?`text-fg`:`text-fg-muted`}`,oe;t[85]!==n.profile.primaryGoal||t[86]!==i.directionEmpty?(oe=n.profile.primaryGoal.trim()||i.directionEmpty,t[85]=n.profile.primaryGoal,t[86]=i.directionEmpty,t[87]=oe):oe=t[87];let se;t[88]!==ae||t[89]!==oe?(se=(0,$.jsx)(`p`,{className:ae,children:oe}),t[88]=ae,t[89]=oe,t[90]=se):se=t[90];let ce;t[91]!==ie||t[92]!==se?(ce=(0,$.jsxs)(`div`,{children:[ie,se]}),t[91]=ie,t[92]=se,t[93]=ce):ce=t[93];let le;t[94]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,$.jsx)(R,{className:`size-4`}),t[94]=le):le=t[94];let ue;t[95]===i.talkAboutMe?ue=t[96]:(ue=(0,$.jsx)(f,{variant:`primary`,asChild:!0,children:(0,$.jsxs)(a,{to:`/chat/new`,children:[le,i.talkAboutMe]})}),t[95]=i.talkAboutMe,t[96]=ue);let de,fe;t[97]===Symbol.for(`react.memo_cache_sentinel`)?(de=()=>l(!0),fe=(0,$.jsx)(U,{className:`size-4`}),t[97]=de,t[98]=fe):(de=t[97],fe=t[98]);let pe;t[99]===i.editProfile?pe=t[100]:(pe=(0,$.jsxs)(f,{onClick:de,children:[fe,i.editProfile]}),t[99]=i.editProfile,t[100]=pe);let me;t[101]!==ue||t[102]!==pe?(me=(0,$.jsxs)(`div`,{className:`mt-8 flex flex-wrap gap-2`,children:[ue,pe]}),t[101]=ue,t[102]=pe,t[103]=me):me=t[103];let Z;t[104]!==ce||t[105]!==me?(Z=(0,$.jsxs)(`div`,{className:`flex flex-col justify-between rounded-2xl border border-edge bg-surface-base/70 p-5 sm:p-6`,children:[ce,me]}),t[104]=ce,t[105]=me,t[106]=Z):Z=t[106],t[107]!==re||t[108]!==Z?(w=(0,$.jsxs)(`section`,{className:`relative overflow-hidden rounded-3xl border border-edge bg-surface-panel`,children:[M,(0,$.jsxs)(`div`,{className:`grid gap-8 px-5 py-7 sm:px-8 sm:py-9 lg:grid-cols-[minmax(0,1fr)_20rem] lg:gap-12 lg:px-10 lg:py-11`,children:[re,Z]})]}),t[107]=re,t[108]=Z,t[109]=w):w=t[109],y=`grid gap-5 lg:grid-cols-2`;let Q;t[110]===Symbol.for(`react.memo_cache_sentinel`)?(Q=(0,$.jsx)(S,{className:`size-4`}),t[110]=Q):Q=t[110];let he;t[111]===o?he=t[112]:(he=()=>o(`understanding`),t[111]=o,t[112]=he);let ge;t[113]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,$.jsx)(A,{className:`size-3.5`}),t[113]=ge):ge=t[113];let _e;t[114]!==i.seeAll||t[115]!==he?(_e=(0,$.jsxs)(`button`,{className:`inline-flex items-center gap-1 text-xs font-medium text-accent hover:underline`,onClick:he,children:[i.seeAll,ge]}),t[114]=i.seeAll,t[115]=he,t[116]=_e):_e=t[116];let be;t[117]!==o||t[118]!==c.length||t[119]!==i.reviewWaiting?(be=c.length?(0,$.jsxs)(`button`,{className:`mb-4 flex w-full items-center justify-between rounded-xl border border-accent/20 bg-accent-soft px-3 py-2.5 text-left text-xs text-accent transition-colors hover:border-accent/40`,onClick:()=>o(`understanding`),children:[(0,$.jsxs)(`span`,{children:[(0,$.jsx)(k,{className:`mr-1.5 inline size-3.5`}),c.length,` `,i.reviewWaiting]}),(0,$.jsx)(j,{className:`size-3.5`})]}):null,t[117]=o,t[118]=c.length,t[119]=i.reviewWaiting,t[120]=be):be=t[120];let xe=e.length?(0,$.jsx)(`div`,{className:`space-y-1`,children:e.slice(0,4).map(e=>(0,$.jsxs)(`div`,{className:`group flex gap-3 rounded-xl px-2 py-2.5 transition-colors hover:bg-surface-hover`,children:[(0,$.jsx)(`span`,{className:`mt-2 size-1.5 shrink-0 rounded-full bg-accent/70`}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:e.statement}),(0,$.jsx)(`p`,{className:`mt-0.5 text-[11px] text-fg-subtle`,children:ve[e.kind][r]})]})]},e.id))}):(0,$.jsx)(`p`,{className:`py-5 text-sm leading-6 text-fg-muted`,children:i.addFirstUnderstanding});t[121]!==i.portraitUnderstanding||t[122]!==i.portraitUnderstandingHint||t[123]!==_e||t[124]!==be||t[125]!==xe?(b=(0,$.jsxs)(Fe,{icon:Q,title:i.portraitUnderstanding,description:i.portraitUnderstandingHint,action:_e,children:[be,xe]}),t[121]=i.portraitUnderstanding,t[122]=i.portraitUnderstandingHint,t[123]=_e,t[124]=be,t[125]=xe,t[126]=b):b=t[126],p=Fe,t[127]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(D,{className:`size-4`}),t[127]=m):m=t[127],h=i.portraitRules,g=i.portraitRulesHint;let Se;t[128]===o?Se=t[129]:(Se=()=>o(`collaboration`),t[128]=o,t[129]=Se);let Ce;t[130]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=(0,$.jsx)(A,{className:`size-3.5`}),t[130]=Ce):Ce=t[130],t[131]!==i.seeAll||t[132]!==Se?(_=(0,$.jsxs)(`button`,{className:`inline-flex items-center gap-1 text-xs font-medium text-accent hover:underline`,onClick:Se,children:[i.seeAll,Ce]}),t[131]=i.seeAll,t[132]=Se,t[133]=_):_=t[133],v=u.length?(0,$.jsx)(`div`,{className:`space-y-1`,children:u.slice(0,4).map(e=>(0,$.jsxs)(`div`,{className:`flex gap-3 rounded-xl px-2 py-2.5 transition-colors hover:bg-surface-hover`,children:[(0,$.jsx)(`span`,{className:`mt-2 size-1.5 shrink-0 rounded-full bg-fg-subtle`}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:e.statement}),(0,$.jsx)(`p`,{className:`mt-0.5 text-[11px] text-fg-subtle`,children:ye[e.category][r]})]})]},e.id))}):(0,$.jsx)(`p`,{className:`py-5 text-sm leading-6 text-fg-muted`,children:i.addFirstRule}),t[0]=n.profile.callName,t[1]=n.profile.primaryGoal,t[2]=n.profile.role,t[3]=n.rules,t[4]=n.understandings,t[5]=r,t[6]=o,t[7]=i.addFirstRule,t[8]=i.addFirstUnderstanding,t[9]=i.advanced,t[10]=i.direction,t[11]=i.directionEmpty,t[12]=i.editProfile,t[13]=i.maintainedTogether,t[14]=i.portraitEyebrow,t[15]=i.portraitIntro,t[16]=i.portraitRules,t[17]=i.portraitRulesHint,t[18]=i.portraitUnderstanding,t[19]=i.portraitUnderstandingHint,t[20]=i.reviewWaiting,t[21]=i.roleMissing,t[22]=i.seeAll,t[23]=i.talkAboutMe,t[24]=i.youDecide,t[25]=p,t[26]=m,t[27]=h,t[28]=g,t[29]=_,t[30]=v,t[31]=y,t[32]=b,t[33]=x,t[34]=w}else p=t[25],m=t[26],h=t[27],g=t[28],_=t[29],v=t[30],y=t[31],b=t[32],x=t[33],w=t[34];let T;t[134]!==p||t[135]!==m||t[136]!==h||t[137]!==g||t[138]!==_||t[139]!==v?(T=(0,$.jsx)(p,{icon:m,title:h,description:g,action:_,children:v}),t[134]=p,t[135]=m,t[136]=h,t[137]=g,t[138]=_,t[139]=v,t[140]=T):T=t[140];let E;t[141]!==T||t[142]!==y||t[143]!==b?(E=(0,$.jsxs)(`div`,{className:y,children:[b,T]}),t[141]=T,t[142]=y,t[143]=b,t[144]=E):E=t[144];let M;t[145]===Symbol.for(`react.memo_cache_sentinel`)?(M=()=>d(!0),t[145]=M):M=t[145];let N;t[146]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,$.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-xl bg-surface-muted text-fg-muted`,children:(0,$.jsx)(C,{className:`size-4`})}),t[146]=N):N=t[146];let P;t[147]===i.portraitLearn?P=t[148]:(P=(0,$.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:i.portraitLearn}),t[147]=i.portraitLearn,t[148]=P);let F;t[149]===i.portraitControlHint?F=t[150]:(F=(0,$.jsx)(`span`,{className:`mt-0.5 block text-xs leading-5 text-fg-muted`,children:i.portraitControlHint}),t[149]=i.portraitControlHint,t[150]=F);let I;t[151]!==P||t[152]!==F?(I=(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[P,F]}),t[151]=P,t[152]=F,t[153]=I):I=t[153];let L;t[154]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,$.jsx)(A,{className:`size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5`}),t[154]=L):L=t[154];let z;t[155]===I?z=t[156]:(z=(0,$.jsxs)(`button`,{className:`group flex w-full items-center gap-4 rounded-2xl border border-edge bg-surface-panel px-5 py-4 text-left transition-colors hover:bg-surface-hover sm:px-6`,onClick:M,children:[N,I,L]}),t[155]=I,t[156]=z);let B;t[157]!==n.profile||t[158]!==c||t[159]!==r||t[160]!==s||t[161]!==i?(B=(0,$.jsx)(Le,{open:c,onOpenChange:l,profile:n.profile,language:r,t:i,onChanged:s}),t[157]=n.profile,t[158]=c,t[159]=r,t[160]=s,t[161]=i,t[162]=B):B=t[162];let V;t[163]===o?V=t[164]:(V=e=>{d(!1),o(e)},t[163]=o,t[164]=V);let H;t[165]!==u||t[166]!==i||t[167]!==V?(H=(0,$.jsx)(Ie,{open:u,onOpenChange:d,t:i,onNavigate:V}),t[165]=u,t[166]=i,t[167]=V,t[168]=H):H=t[168];let W;return t[169]!==E||t[170]!==z||t[171]!==B||t[172]!==H||t[173]!==x||t[174]!==w?(W=(0,$.jsxs)(`div`,{className:x,children:[w,E,z,B,H]}),t[169]=E,t[170]=z,t[171]=B,t[172]=H,t[173]=x,t[174]=w,t[175]=W):W=t[175],W}function Me(e){return e.status===`active`}function Ne(e){return[`candidate`,`needs_review`,`stale`].includes(e.status)}function Pe(e){return e.status===`active`}function Fe(e){let t=(0,Z.c)(20),{icon:n,title:r,description:i,action:a,children:o}=e,s;t[0]===n?s=t[1]:(s=(0,$.jsx)(`span`,{className:`mt-0.5 flex size-8 shrink-0 items-center justify-center rounded-xl bg-surface-muted text-fg-muted`,children:n}),t[0]=n,t[1]=s);let c;t[2]===r?c=t[3]:(c=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:r}),t[2]=r,t[3]=c);let l;t[4]!==a||t[5]!==c?(l=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[c,a]}),t[4]=a,t[5]=c,t[6]=l):l=t[6];let u;t[7]===i?u=t[8]:(u=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:i}),t[7]=i,t[8]=u);let d;t[9]!==l||t[10]!==u?(d=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[l,u]}),t[9]=l,t[10]=u,t[11]=d):d=t[11];let f;t[12]!==s||t[13]!==d?(f=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[s,d]}),t[12]=s,t[13]=d,t[14]=f):f=t[14];let p;t[15]===o?p=t[16]:(p=(0,$.jsx)(`div`,{className:`mt-4 border-t border-edge pt-3`,children:o}),t[15]=o,t[16]=p);let m;return t[17]!==f||t[18]!==p?(m=(0,$.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-panel p-5 sm:p-6`,children:[f,p]}),t[17]=f,t[18]=p,t[19]=m):m=t[19],m}function Ie(e){let t=(0,Z.c)(47),{open:n,onOpenChange:r,t:i,onNavigate:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsx)(ue,{className:`size-4`}),t[0]=o):o=t[0];let s;t[1]!==i.controlSourcesHint||t[2]!==i.sources?(s={tab:`sources`,icon:o,label:i.sources,description:i.controlSourcesHint},t[1]=i.controlSourcesHint,t[2]=i.sources,t[3]=s):s=t[3];let c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(q,{className:`size-4`}),t[4]=c):c=t[4];let l;t[5]!==i.controlReviewHint||t[6]!==i.dreaming?(l={tab:`dreaming`,icon:c,label:i.dreaming,description:i.controlReviewHint},t[5]=i.controlReviewHint,t[6]=i.dreaming,t[7]=l):l=t[7];let u;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,$.jsx)(O,{className:`size-4`}),t[8]=u):u=t[8];let p;t[9]!==i.controlPrivacyHint||t[10]!==i.privacy?(p={tab:`privacy`,icon:u,label:i.privacy,description:i.controlPrivacyHint},t[9]=i.controlPrivacyHint,t[10]=i.privacy,t[11]=p):p=t[11];let x;t[12]!==s||t[13]!==l||t[14]!==p?(x=[s,l,p],t[12]=s,t[13]=l,t[14]=p,t[15]=x):x=t[15];let S=x,w;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,$.jsx)(m,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),t[16]=w):w=t[16];let T;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,$.jsx)(`div`,{className:`mb-3 flex size-9 items-center justify-center rounded-xl bg-accent-soft text-accent`,children:(0,$.jsx)(C,{className:`size-4`})}),t[17]=T):T=t[17];let E;t[18]===i.portraitControl?E=t[19]:(E=(0,$.jsx)(y,{className:`text-lg font-semibold tracking-tight text-fg`,children:i.portraitControl}),t[18]=i.portraitControl,t[19]=E);let D;t[20]===i.portraitControlHint?D=t[21]:(D=(0,$.jsx)(h,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:i.portraitControlHint}),t[20]=i.portraitControlHint,t[21]=D);let k;t[22]!==E||t[23]!==D?(k=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[T,E,D]}),t[22]=E,t[23]=D,t[24]=k):k=t[24];let j;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,$.jsx)(d,{className:`size-4`}),t[25]=j):j=t[25];let M;t[26]===i.cancel?M=t[27]:(M=(0,$.jsx)(g,{asChild:!0,children:(0,$.jsx)(f,{variant:`ghost`,className:`size-8 shrink-0 p-0`,"aria-label":i.cancel,children:j})}),t[26]=i.cancel,t[27]=M);let N;t[28]!==k||t[29]!==M?(N=(0,$.jsxs)(`header`,{className:`flex shrink-0 items-start justify-between gap-4 border-b border-edge px-5 py-5 sm:px-6 sm:py-6`,children:[k,M]}),t[28]=k,t[29]=M,t[30]=N):N=t[30];let P;t[31]!==S||t[32]!==a?(P=(0,$.jsx)(`div`,{className:`space-y-3`,children:S.map(e=>(0,$.jsxs)(`button`,{className:`group flex w-full items-start gap-4 rounded-2xl border border-edge bg-surface-base p-4 text-left transition-colors hover:border-edge-strong hover:bg-surface-hover`,onClick:()=>a(e.tab),children:[(0,$.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-xl bg-surface-muted text-fg-muted transition-colors group-hover:text-accent`,children:e.icon}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.label}),(0,$.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:e.description})]}),(0,$.jsx)(A,{className:`mt-2.5 size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5`})]},e.tab))}),t[31]=S,t[32]=a,t[33]=P):P=t[33];let F;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,$.jsx)(O,{className:`mt-0.5 size-4 shrink-0 text-success`}),t[34]=F):F=t[34];let I;t[35]===i.controlTrust?I=t[36]:(I=(0,$.jsxs)(`div`,{className:`mt-6 flex gap-3 rounded-2xl bg-surface-muted p-4`,children:[F,(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:i.controlTrust})]}),t[35]=i.controlTrust,t[36]=I);let L;t[37]!==P||t[38]!==I?(L=(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-4 sm:p-6`,children:[P,I]}),t[37]=P,t[38]=I,t[39]=L):L=t[39];let R;t[40]!==N||t[41]!==L?(R=(0,$.jsxs)(_,{children:[w,(0,$.jsx)(v,{className:`fixed inset-y-0 right-0 z-[90] h-full w-[min(30rem,100vw)] overflow-hidden border-l border-edge bg-surface-panel shadow-popover outline-none sm:rounded-l-2xl`,children:(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[N,L]})})]}),t[40]=N,t[41]=L,t[42]=R):R=t[42];let z;return t[43]!==r||t[44]!==n||t[45]!==R?(z=(0,$.jsx)(b,{open:n,onOpenChange:r,children:R}),t[43]=r,t[44]=n,t[45]=R,t[46]=z):z=t[46],z}function Le(e){let t=(0,Z.c)(26),{open:n,onOpenChange:r,profile:i,language:a,t:o,onChanged:s}=e,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(m,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),t[0]=c):c=t[0];let l;t[1]===o.editProfile?l=t[2]:(l=(0,$.jsx)(y,{className:`text-base font-semibold text-fg`,children:o.editProfile}),t[1]=o.editProfile,t[2]=l);let u;t[3]===o.profileHint?u=t[4]:(u=(0,$.jsx)(h,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:o.profileHint}),t[3]=o.profileHint,t[4]=u);let p;t[5]!==l||t[6]!==u?(p=(0,$.jsxs)(`div`,{children:[l,u]}),t[5]=l,t[6]=u,t[7]=p):p=t[7];let x;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,$.jsx)(d,{className:`size-4`}),t[8]=x):x=t[8];let S;t[9]===o.cancel?S=t[10]:(S=(0,$.jsx)(g,{asChild:!0,children:(0,$.jsx)(f,{variant:`ghost`,className:`size-8 shrink-0 p-0`,"aria-label":o.cancel,children:x})}),t[9]=o.cancel,t[10]=S);let C;t[11]!==p||t[12]!==S?(C=(0,$.jsxs)(`header`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge px-5 py-4 sm:px-6`,children:[p,S]}),t[11]=p,t[12]=S,t[13]=C):C=t[13];let w;t[14]!==a||t[15]!==s||t[16]!==i||t[17]!==o?(w=(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5 sm:p-6`,children:(0,$.jsx)(Re,{profile:i,language:a,t:o,onChanged:s,bare:!0})}),t[14]=a,t[15]=s,t[16]=i,t[17]=o,t[18]=w):w=t[18];let T;t[19]!==C||t[20]!==w?(T=(0,$.jsxs)(_,{children:[c,(0,$.jsx)(v,{className:`fixed left-1/2 top-1/2 z-[90] h-[min(42rem,calc(100vh-2rem))] w-[min(44rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`,children:(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[C,w]})})]}),t[19]=C,t[20]=w,t[21]=T):T=t[21];let E;return t[22]!==r||t[23]!==n||t[24]!==T?(E=(0,$.jsx)(b,{open:n,onOpenChange:r,children:T}),t[22]=r,t[23]=n,t[24]=T,t[25]=E):E=t[25],E}function Re(e){let t=(0,Z.c)(80),{profile:n,language:r,t:i,onChanged:a,bare:o}=e,s=o===void 0?!1:o,c;t[0]===n?c=t[1]:(c=Te(n),t[0]=n,t[1]=c);let l=c,[u,d]=we(l),p;t[2]===u?p=t[3]:(p=Ce(u),t[2]=u,t[3]=p);let m;t[4]===l?m=t[5]:(m=Ce(l),t[4]=l,t[5]=m);let h=p!==m,g;t[6]!==a||t[7]!==n?(g=async e=>{await a((await w({...e,accessibility:n.accessibility})).profile)},t[6]=a,t[7]=n,t[8]=g):g=t[8];let _;t[9]!==u||t[10]!==h||t[11]!==g?(_={value:u,dirty:h,delayMs:500,onSave:g},t[9]=u,t[10]=h,t[11]=g,t[12]=_):_=t[12];let v=fe(_),y;t[13]!==u||t[14]!==d?(y=(e,t,n)=>(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:t}),(0,$.jsx)(`input`,{className:ge,placeholder:n,value:u[e],onChange:t=>d(n=>({...n,[e]:t.target.value}))})]}),t[13]=u,t[14]=d,t[15]=y):y=t[15];let b=y,x=v.onBlurCapture,S;t[16]!==b||t[17]!==i.callName||t[18]!==i.callNamePlaceholder?(S=b(`callName`,i.callName,i.callNamePlaceholder),t[16]=b,t[17]=i.callName,t[18]=i.callNamePlaceholder,t[19]=S):S=t[19];let C;t[20]!==b||t[21]!==i.role||t[22]!==i.rolePlaceholder?(C=b(`role`,i.role,i.rolePlaceholder),t[20]=b,t[21]=i.role,t[22]=i.rolePlaceholder,t[23]=C):C=t[23];let T;t[24]===i.primaryGoal?T=t[25]:(T=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:i.primaryGoal}),t[24]=i.primaryGoal,t[25]=T);let E;t[26]===d?E=t[27]:(E=e=>d(t=>({...t,primaryGoal:e.target.value})),t[26]=d,t[27]=E);let D;t[28]!==u.primaryGoal||t[29]!==i.primaryGoalPlaceholder||t[30]!==E?(D=(0,$.jsx)(`textarea`,{className:ge,rows:3,placeholder:i.primaryGoalPlaceholder,value:u.primaryGoal,onChange:E}),t[28]=u.primaryGoal,t[29]=i.primaryGoalPlaceholder,t[30]=E,t[31]=D):D=t[31];let O;t[32]!==T||t[33]!==D?(O=(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm sm:col-span-2`,children:[T,D]}),t[32]=T,t[33]=D,t[34]=O):O=t[34];let k;t[35]!==b||t[36]!==r||t[37]!==i.pronouns||t[38]!==i.pronounsPlaceholder?(k=r===`en`?b(`pronouns`,i.pronouns,i.pronounsPlaceholder):null,t[35]=b,t[36]=r,t[37]=i.pronouns,t[38]=i.pronounsPlaceholder,t[39]=k):k=t[39];let A;t[40]===i.timezone?A=t[41]:(A=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:i.timezone}),t[40]=i.timezone,t[41]=A);let j;t[42]===d?j=t[43]:(j=e=>d(t=>({...t,timezone:e.target.value})),t[42]=d,t[43]=j);let M;t[44]!==u.timezone||t[45]!==j?(M=(0,$.jsx)(`input`,{className:`${ge} min-w-0 flex-1`,value:u.timezone,onChange:j}),t[44]=u.timezone,t[45]=j,t[46]=M):M=t[46];let N;t[47]===d?N=t[48]:(N=()=>d(ze),t[47]=d,t[48]=N);let P;t[49]!==i.detect||t[50]!==N?(P=(0,$.jsx)(f,{className:`shrink-0 whitespace-nowrap`,onClick:N,children:i.detect}),t[49]=i.detect,t[50]=N,t[51]=P):P=t[51];let F;t[52]!==M||t[53]!==P?(F=(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[M,P]}),t[52]=M,t[53]=P,t[54]=F):F=t[54];let I;t[55]!==A||t[56]!==F?(I=(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[A,F]}),t[55]=A,t[56]=F,t[57]=I):I=t[57];let L;t[58]!==b||t[59]!==i.locale?(L=b(`locale`,i.locale),t[58]=b,t[59]=i.locale,t[60]=L):L=t[60];let R;t[61]!==S||t[62]!==C||t[63]!==O||t[64]!==k||t[65]!==I||t[66]!==L?(R=(0,$.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[S,C,O,k,I,L]}),t[61]=S,t[62]=C,t[63]=O,t[64]=k,t[65]=I,t[66]=L,t[67]=R):R=t[67];let z;t[68]!==v.error||t[69]!==v.status?(z=(0,$.jsx)(`div`,{className:`mt-5 flex justify-end`,children:(0,$.jsx)(de,{status:v.status,error:v.error})}),t[68]=v.error,t[69]=v.status,t[70]=z):z=t[70];let B;t[71]!==v.onBlurCapture||t[72]!==R||t[73]!==z?(B=(0,$.jsxs)(`div`,{onBlurCapture:x,children:[R,z]}),t[71]=v.onBlurCapture,t[72]=R,t[73]=z,t[74]=B):B=t[74];let V=B;if(s)return V;let H;t[75]===i.profileHint?H=t[76]:(H=(0,$.jsx)(`p`,{className:`mb-5 text-sm leading-6 text-fg-muted`,children:i.profileHint}),t[75]=i.profileHint,t[76]=H);let U;return t[77]!==V||t[78]!==H?(U=(0,$.jsxs)(be,{children:[H,V]}),t[77]=V,t[78]=H,t[79]=U):U=t[79],U}function ze(e){return{...e,timezone:re()}}function Be(e){let t=(0,Z.c)(78),{items:n,quality:r,language:i,t:a,onChanged:c}=e,[l,d]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(``),[h,g]=(0,Q.useState)(`preference`),_;t[0]===n?_=t[1]:(_=n.filter(He),t[0]=n,t[1]=_);let v=_,y;t[2]===n?y=t[3]:(y=n.filter(Ve),t[2]=n,t[3]=y);let b=y,x;t[4]!==h||t[5]!==c||t[6]!==p?(x=async e=>{e.preventDefault(),p.trim()&&(await te({statement:p,kind:h}),m(``),d(!1),await c())},t[4]=h,t[5]=c,t[6]=p,t[7]=x):x=t[7];let S=x,C;t[8]===a.understoodHint?C=t[9]:(C=(0,$.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:a.understoodHint}),t[8]=a.understoodHint,t[9]=C);let w,T;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(w=()=>d(!0),T=(0,$.jsx)(u,{className:`size-4`}),t[10]=w,t[11]=T):(w=t[10],T=t[11]);let E;t[12]===a.addUnderstanding?E=t[13]:(E=(0,$.jsxs)(f,{variant:`primary`,onClick:w,children:[T,a.addUnderstanding]}),t[12]=a.addUnderstanding,t[13]=E);let D;t[14]!==C||t[15]!==E?(D=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[C,E]}),t[14]=C,t[15]=E,t[16]=D):D=t[16];let O=a.addUnderstanding,k=a.understoodHint,A=a.add,j=a.cancel,M;t[17]===p?M=t[18]:(M=p.trim(),t[17]=p,t[18]=M);let N=!M,P;t[19]===a.statement?P=t[20]:(P=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:a.statement}),t[19]=a.statement,t[20]=P);let F;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(F=e=>m(e.target.value),t[21]=F):F=t[21];let I;t[22]!==p||t[23]!==a.statement?(I=(0,$.jsx)(`textarea`,{autoFocus:!0,className:ge,rows:4,placeholder:a.statement,value:p,onChange:F}),t[22]=p,t[23]=a.statement,t[24]=I):I=t[24];let L;t[25]!==P||t[26]!==I?(L=(0,$.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[P,I]}),t[25]=P,t[26]=I,t[27]=L):L=t[27];let R;t[28]===a.kind?R=t[29]:(R=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:a.kind}),t[28]=a.kind,t[29]=R);let z,B;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(z=e=>g(e.target.value),B=Object.entries(ve),t[30]=z,t[31]=B):(z=t[30],B=t[31]);let V;t[32]===i?V=t[33]:(V=B.map(e=>{let[t,n]=e;return(0,$.jsx)(s,{value:t,children:n[i]},t)}),t[32]=i,t[33]=V);let H;t[34]!==h||t[35]!==V?(H=(0,$.jsx)(o,{value:h,onChange:z,children:V}),t[34]=h,t[35]=V,t[36]=H):H=t[36];let U;t[37]!==R||t[38]!==H?(U=(0,$.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[R,H]}),t[37]=R,t[38]=H,t[39]=U):U=t[39];let W;t[40]!==l||t[41]!==S||t[42]!==a.add||t[43]!==a.addUnderstanding||t[44]!==a.cancel||t[45]!==a.understoodHint||t[46]!==N||t[47]!==L||t[48]!==U?(W=(0,$.jsxs)(Se,{open:l,onOpenChange:d,title:O,description:k,submitLabel:A,cancelLabel:j,submitDisabled:N,onSubmit:S,children:[L,U]}),t[40]=l,t[41]=S,t[42]=a.add,t[43]=a.addUnderstanding,t[44]=a.cancel,t[45]=a.understoodHint,t[46]=N,t[47]=L,t[48]=U,t[49]=W):W=t[49];let G;t[50]!==r||t[51]!==a?(G=(0,$.jsx)(Ue,{quality:r,t:a}),t[50]=r,t[51]=a,t[52]=G):G=t[52];let K;t[53]===a?K=t[54]:(K=(0,$.jsx)(Ke,{t:a}),t[53]=a,t[54]=K);let ee;t[55]!==i||t[56]!==c||t[57]!==b||t[58]!==a?(ee=b.length?(0,$.jsxs)(`section`,{className:`space-y-2`,children:[(0,$.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[a.review,` · `,b.length]}),(0,$.jsx)(`div`,{className:`divide-y divide-edge overflow-hidden rounded-2xl border border-edge bg-surface-panel`,children:b.map(e=>(0,$.jsx)(Ge,{item:e,language:i,t:a,onChanged:c},e.id))})]}):null,t[55]=i,t[56]=c,t[57]=b,t[58]=a,t[59]=ee):ee=t[59];let q;t[60]!==v.length||t[61]!==a.active?(q=(0,$.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[a.active,` · `,v.length]}),t[60]=v.length,t[61]=a.active,t[62]=q):q=t[62];let J;t[63]!==v||t[64]!==i||t[65]!==c||t[66]!==a?(J=v.length?(0,$.jsx)(`div`,{className:`divide-y divide-edge overflow-hidden rounded-2xl border border-edge bg-surface-panel`,children:v.map(e=>(0,$.jsx)(Ge,{item:e,language:i,t:a,onChanged:c},e.id))}):(0,$.jsx)(xe,{children:a.emptyUnderstanding}),t[63]=v,t[64]=i,t[65]=c,t[66]=a,t[67]=J):J=t[67];let Y;t[68]!==q||t[69]!==J?(Y=(0,$.jsxs)(`section`,{className:`space-y-2`,children:[q,J]}),t[68]=q,t[69]=J,t[70]=Y):Y=t[70];let X;return t[71]!==W||t[72]!==G||t[73]!==K||t[74]!==ee||t[75]!==Y||t[76]!==D?(X=(0,$.jsxs)(`div`,{className:`space-y-5`,children:[D,W,G,K,ee,Y]}),t[71]=W,t[72]=G,t[73]=K,t[74]=ee,t[75]=Y,t[76]=D,t[77]=X):X=t[77],X}function Ve(e){return[`candidate`,`needs_review`,`stale`].includes(e.status)}function He(e){return e.status===`active`}function Ue(e){let t=(0,Z.c)(46),{quality:n,t:r}=e,i;t[0]===r.qualityNoData?i=t[1]:(i=e=>e==null?r.qualityNoData:`${Math.round(e*100)}%`,t[0]=r.qualityNoData,t[1]=i);let a=i,o=r.qualityActive,s=String(n.records.active),c;t[2]!==r.qualityActive||t[3]!==s?(c=[o,s],t[2]=r.qualityActive,t[3]=s,t[4]=c):c=t[4];let l=r.qualityPending,u=String(n.records.candidate+n.records.needsReview),d;t[5]!==r.qualityPending||t[6]!==u?(d=[l,u],t[5]=r.qualityPending,t[6]=u,t[7]=d):d=t[7];let f=r.qualityAcceptance,p;t[8]!==n.decisions.acceptanceRate||t[9]!==a?(p=a(n.decisions.acceptanceRate),t[8]=n.decisions.acceptanceRate,t[9]=a,t[10]=p):p=t[10];let m;t[11]!==r.qualityAcceptance||t[12]!==p?(m=[f,p],t[11]=r.qualityAcceptance,t[12]=p,t[13]=m):m=t[13];let h=r.qualityRecall,g;t[14]!==n.recall.helpfulRate||t[15]!==a?(g=a(n.recall.helpfulRate),t[14]=n.recall.helpfulRate,t[15]=a,t[16]=g):g=t[16];let _;t[17]!==r.qualityRecall||t[18]!==g?(_=[h,g],t[17]=r.qualityRecall,t[18]=g,t[19]=_):_=t[19];let v=r.qualitySourceCoverage,y;t[20]!==n.quickUnderstanding.sourceCoverage||t[21]!==a?(y=a(n.quickUnderstanding.sourceCoverage),t[20]=n.quickUnderstanding.sourceCoverage,t[21]=a,t[22]=y):y=t[22];let b;t[23]!==r.qualitySourceCoverage||t[24]!==y?(b=[v,y],t[23]=r.qualitySourceCoverage,t[24]=y,t[25]=b):b=t[25];let x;t[26]!==n.quickUnderstanding.medianBootstrapDurationMs||t[27]!==r.qualityNoData?(x=n.quickUnderstanding.medianBootstrapDurationMs==null?r.qualityNoData:`${(n.quickUnderstanding.medianBootstrapDurationMs/1e3).toFixed(1)}s`,t[26]=n.quickUnderstanding.medianBootstrapDurationMs,t[27]=r.qualityNoData,t[28]=x):x=t[28];let S;t[29]!==r.qualityBootstrapTime||t[30]!==x?(S=[r.qualityBootstrapTime,x],t[29]=r.qualityBootstrapTime,t[30]=x,t[31]=S):S=t[31];let C;t[32]!==m||t[33]!==_||t[34]!==b||t[35]!==S||t[36]!==c||t[37]!==d?(C=[c,d,m,_,b,S],t[32]=m,t[33]=_,t[34]=b,t[35]=S,t[36]=c,t[37]=d,t[38]=C):C=t[38];let w=C,T;t[39]===r.qualityTitle?T=t[40]:(T=(0,$.jsx)(`h2`,{className:`text-xs font-medium text-fg-muted`,children:r.qualityTitle}),t[39]=r.qualityTitle,t[40]=T);let E;t[41]===w?E=t[42]:(E=w.map(We),t[41]=w,t[42]=E);let D;return t[43]!==T||t[44]!==E?(D=(0,$.jsxs)(`section`,{className:`flex flex-wrap items-center gap-x-5 gap-y-2 rounded-xl bg-surface-muted px-3 py-2.5`,children:[T,E]}),t[43]=T,t[44]=E,t[45]=D):D=t[45],D}function We(e){let[t,n]=e;return(0,$.jsxs)(`div`,{className:`flex items-baseline gap-1.5 text-xs`,children:[(0,$.jsx)(`span`,{className:`text-fg-subtle`,children:t}),(0,$.jsx)(`span`,{className:`font-semibold text-fg`,children:n})]},t)}function Ge(e){let t=(0,Z.c)(60),{item:n,language:r,t:i,onChanged:a}=e,[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(!1),[u,d]=we(n.statement),p=u!==n.statement,m;t[0]===i.required?m=t[1]:(m=e=>e.trim()?null:i.required,t[0]=i.required,t[1]=m);let h;t[2]!==n.id||t[3]!==a?(h=async e=>{await a((await z(n.id,{statement:e})).understanding)},t[2]=n.id,t[3]=a,t[4]=h):h=t[4];let g;t[5]!==u||t[6]!==o||t[7]!==p||t[8]!==m||t[9]!==h?(g={value:u,dirty:p,enabled:o,delayMs:500,validate:m,onSave:h},t[5]=u,t[6]=o,t[7]=p,t[8]=m,t[9]=h,t[10]=g):g=t[10];let _=fe(g),v;t[11]!==u||t[12]!==o||t[13]!==d?(v=o?(0,$.jsx)(`textarea`,{autoFocus:!0,className:ge,value:u,onChange:e=>d(e.target.value),rows:3}):(0,$.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:u}),t[11]=u,t[12]=o,t[13]=d,t[14]=v):v=t[14];let y=ve[n.kind][r],b;t[15]===y?b=t[16]:(b=(0,$.jsx)(`span`,{children:y}),t[15]=y,t[16]=b);let x;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,$.jsx)(`span`,{children:`·`}),t[17]=x):x=t[17];let S=n.explicitness===`explicit`?i.sourceExplicit:n.explicitness===`observed`?i.sourceObserved:i.sourceInferred,C;t[18]===S?C=t[19]:(C=(0,$.jsx)(`span`,{children:S}),t[18]=S,t[19]=C);let w;t[20]!==C||t[21]!==b?(w=(0,$.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-2 text-[11px] text-fg-subtle`,children:[b,x,C]}),t[20]=C,t[21]=b,t[22]=w):w=t[22];let T;t[23]!==w||t[24]!==v?(T=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[v,w]}),t[23]=w,t[24]=v,t[25]=T):T=t[25];let E;t[26]!==_||t[27]!==o||t[28]!==i.done||t[29]!==i.edit?(E=o?(0,$.jsx)(f,{variant:`ghost`,onClick:()=>{_.flush(),s(!1)},children:i.done}):(0,$.jsxs)(f,{variant:`ghost`,onClick:()=>s(!0),children:[(0,$.jsx)(I,{className:`size-3.5`}),i.edit]}),t[26]=_,t[27]=o,t[28]=i.done,t[29]=i.edit,t[30]=E):E=t[30];let D;t[31]!==n.id||t[32]!==n.status||t[33]!==a||t[34]!==i.confirm||t[35]!==i.reject?(D=n.status===`active`?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(f,{variant:`primary`,onClick:async()=>{await a((await z(n.id,{status:`active`})).understanding)},children:i.confirm}),(0,$.jsx)(f,{onClick:async()=>{await a((await z(n.id,{status:`rejected`})).understanding)},children:i.reject})]}),t[31]=n.id,t[32]=n.status,t[33]=a,t[34]=i.confirm,t[35]=i.reject,t[36]=D):D=t[36];let O;t[37]!==c||t[38]!==n.id||t[39]!==a?(O=async()=>{if(!c){l(!0);return}await B(n.id),l(!1),await a()},t[37]=c,t[38]=n.id,t[39]=a,t[40]=O):O=t[40];let k;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,$.jsx)(ae,{className:`size-3.5`}),t[41]=k):k=t[41];let A=c?i.confirmDelete:i.delete,j;t[42]!==O||t[43]!==A?(j=(0,$.jsxs)(f,{variant:`ghost`,className:`text-danger`,onClick:O,children:[k,A]}),t[42]=O,t[43]=A,t[44]=j):j=t[44];let M;t[45]!==E||t[46]!==D||t[47]!==j?(M=(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-1 sm:justify-end`,children:[E,D,j]}),t[45]=E,t[46]=D,t[47]=j,t[48]=M):M=t[48];let N;t[49]!==T||t[50]!==M?(N=(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-start sm:gap-4`,children:[T,M]}),t[49]=T,t[50]=M,t[51]=N):N=t[51];let P;t[52]!==_.error||t[53]!==_.status||t[54]!==o?(P=o||_.status!==`idle`?(0,$.jsx)(de,{className:`mt-2`,status:_.status,error:_.error}):null,t[52]=_.error,t[53]=_.status,t[54]=o,t[55]=P):P=t[55];let F;return t[56]!==_.onBlurCapture||t[57]!==N||t[58]!==P?(F=(0,$.jsx)(`article`,{className:`px-4 py-3 sm:px-5`,children:(0,$.jsxs)(`div`,{onBlurCapture:_.onBlurCapture,children:[N,P]})}),t[56]=_.onBlurCapture,t[57]=N,t[58]=P,t[59]=F):F=t[59],F}function Ke(e){let t=(0,Z.c)(35),{t:n}=e,{data:r,error:i,isLoading:a,mutate:o}=x(`you-focuses`,G),[s,c]=(0,Q.useState)(null);if(a){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(P,{className:`h-40 rounded-2xl`}),t[0]=e):e=t[0],e}if(i){let e;return t[1]===n.error?e=t[2]:(e=(0,$.jsx)(xe,{children:n.error}),t[1]=n.error,t[2]=e),e}let l;if(t[3]!==r||t[4]!==s||t[5]!==o||t[6]!==n.activate||t[7]!==n.complete||t[8]!==n.confidence||t[9]!==n.confidenceHigh||t[10]!==n.confidenceLow||t[11]!==n.confidenceMedium||t[12]!==n.confirmDelete||t[13]!==n.delete||t[14]!==n.focusActive||t[15]!==n.focusCandidate||t[16]!==n.focusCompleted||t[17]!==n.focusHint||t[18]!==n.focusPaused||t[19]!==n.focuses||t[20]!==n.noFocuses||t[21]!==n.pause||t[22]!==n.reject){let e=(r??[]).filter(qe),i;t[24]!==n.focusActive||t[25]!==n.focusCandidate||t[26]!==n.focusCompleted||t[27]!==n.focusPaused?(i=e=>e===`candidate`?n.focusCandidate:e===`active`?n.focusActive:e===`paused`?n.focusPaused:n.focusCompleted,t[24]=n.focusActive,t[25]=n.focusCandidate,t[26]=n.focusCompleted,t[27]=n.focusPaused,t[28]=i):i=t[28];let a=i,u;t[29]!==n.confidenceHigh||t[30]!==n.confidenceLow||t[31]!==n.confidenceMedium?(u=e=>e>=.85?n.confidenceHigh:e>=.65?n.confidenceMedium:n.confidenceLow,t[29]=n.confidenceHigh,t[30]=n.confidenceLow,t[31]=n.confidenceMedium,t[32]=u):u=t[32];let d=u,p;t[33]===n.focusHint?p=t[34]:(p=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n.focusHint}),t[33]=n.focusHint,t[34]=p),l=(0,$.jsxs)(`section`,{className:`space-y-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[n.focuses,` · `,e.length]}),p]}),e.length?(0,$.jsx)(`div`,{className:`divide-y divide-edge overflow-hidden rounded-2xl border border-edge bg-surface-panel`,children:e.map(e=>(0,$.jsxs)(`article`,{className:`flex flex-col gap-3 px-4 py-3 sm:flex-row sm:items-center sm:px-5`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:e.title}),(0,$.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-[11px] text-fg-muted`,children:a(e.status)}),(0,$.jsxs)(`span`,{className:`text-[11px] text-fg-subtle`,children:[n.confidence,` · `,d(e.confidence)]})]}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-5 text-fg-muted`,children:e.summary})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-1 sm:justify-end`,children:[e.status===`active`?(0,$.jsx)(f,{onClick:async()=>{await M(e.id,`paused`),await o()},children:n.pause}):(0,$.jsx)(f,{variant:`primary`,onClick:async()=>{await M(e.id,`active`),await o()},children:n.activate}),(0,$.jsx)(f,{variant:`ghost`,onClick:async()=>{await M(e.id,`completed`),await o()},children:n.complete}),e.status===`candidate`?(0,$.jsx)(f,{variant:`ghost`,className:`text-danger`,onClick:async()=>{await M(e.id,`rejected`),await o()},children:n.reject}):null,(0,$.jsxs)(f,{variant:`ghost`,className:`text-danger`,onClick:async()=>{if(s!==e.id){c(e.id);return}await K(e.id),c(null),await o()},children:[(0,$.jsx)(ae,{className:`size-3.5`}),s===e.id?n.confirmDelete:n.delete]})]})]},e.id))}):(0,$.jsx)(xe,{children:n.noFocuses})]}),t[3]=r,t[4]=s,t[5]=o,t[6]=n.activate,t[7]=n.complete,t[8]=n.confidence,t[9]=n.confidenceHigh,t[10]=n.confidenceLow,t[11]=n.confidenceMedium,t[12]=n.confirmDelete,t[13]=n.delete,t[14]=n.focusActive,t[15]=n.focusCandidate,t[16]=n.focusCompleted,t[17]=n.focusHint,t[18]=n.focusPaused,t[19]=n.focuses,t[20]=n.noFocuses,t[21]=n.pause,t[22]=n.reject,t[23]=l}else l=t[23];return l}function qe(e){return e.status!==`rejected`}function Je(e){let t=(0,Z.c)(80),{rules:n,language:r,t:i,onChanged:a}=e,[c,l]=(0,Q.useState)(!1),[d,p]=(0,Q.useState)(``),[m,h]=(0,Q.useState)(`communication`),[g,_]=(0,Q.useState)(null),v,y,b,x,S,C;if(t[0]!==c||t[1]!==m||t[2]!==g||t[3]!==r||t[4]!==a||t[5]!==n||t[6]!==d||t[7]!==i.add||t[8]!==i.addRule||t[9]!==i.cancel||t[10]!==i.category||t[11]!==i.collaboration||t[12]!==i.confirmDelete||t[13]!==i.delete||t[14]!==i.disable||t[15]!==i.emptyRules||t[16]!==i.enable||t[17]!==i.ruleStatement||t[18]!==i.rulesHint){let e=n.filter(Ye),w;t[25]!==m||t[26]!==a||t[27]!==d?(w=async e=>{e.preventDefault(),d.trim()&&(await L({statement:d,category:m}),p(``),l(!1),await a())},t[25]=m,t[26]=a,t[27]=d,t[28]=w):w=t[28];let T=w;x=`space-y-5`;let E;t[29]===i.rulesHint?E=t[30]:(E=(0,$.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:i.rulesHint}),t[29]=i.rulesHint,t[30]=E);let D,O;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(O=()=>l(!0),D=(0,$.jsx)(u,{className:`size-4`}),t[31]=D,t[32]=O):(D=t[31],O=t[32]);let k;t[33]===i.addRule?k=t[34]:(k=(0,$.jsxs)(f,{variant:`primary`,onClick:O,children:[D,i.addRule]}),t[33]=i.addRule,t[34]=k),t[35]!==k||t[36]!==E?(S=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[E,k]}),t[35]=k,t[36]=E,t[37]=S):S=t[37];let A=i.addRule,j=i.rulesHint,M=i.add,N=i.cancel,P;t[38]===d?P=t[39]:(P=d.trim(),t[38]=d,t[39]=P);let F=!P,I;t[40]===i.ruleStatement?I=t[41]:(I=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:i.ruleStatement}),t[40]=i.ruleStatement,t[41]=I);let R;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(R=e=>p(e.target.value),t[42]=R):R=t[42];let z;t[43]!==d||t[44]!==i.ruleStatement?(z=(0,$.jsx)(`textarea`,{autoFocus:!0,className:ge,rows:4,placeholder:i.ruleStatement,value:d,onChange:R}),t[43]=d,t[44]=i.ruleStatement,t[45]=z):z=t[45];let B;t[46]!==I||t[47]!==z?(B=(0,$.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[I,z]}),t[46]=I,t[47]=z,t[48]=B):B=t[48];let V;t[49]===i.category?V=t[50]:(V=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:i.category}),t[49]=i.category,t[50]=V);let H,U;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(H=e=>h(e.target.value),U=Object.entries(ye),t[51]=H,t[52]=U):(H=t[51],U=t[52]);let W;t[53]===r?W=t[54]:(W=U.map(e=>{let[t,n]=e;return(0,$.jsx)(s,{value:t,children:n[r]},t)}),t[53]=r,t[54]=W);let G;t[55]!==m||t[56]!==W?(G=(0,$.jsx)(o,{value:m,onChange:H,children:W}),t[55]=m,t[56]=W,t[57]=G):G=t[57];let K;t[58]!==V||t[59]!==G?(K=(0,$.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[V,G]}),t[58]=V,t[59]=G,t[60]=K):K=t[60],t[61]!==c||t[62]!==T||t[63]!==i.add||t[64]!==i.addRule||t[65]!==i.cancel||t[66]!==i.rulesHint||t[67]!==F||t[68]!==B||t[69]!==K?(C=(0,$.jsxs)(Se,{open:c,onOpenChange:l,title:A,description:j,submitLabel:M,cancelLabel:N,submitDisabled:F,onSubmit:T,children:[B,K]}),t[61]=c,t[62]=T,t[63]=i.add,t[64]=i.addRule,t[65]=i.cancel,t[66]=i.rulesHint,t[67]=F,t[68]=B,t[69]=K,t[70]=C):C=t[70],v=`space-y-2`,y=(0,$.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[i.collaboration,` · `,e.length]}),b=e.length?(0,$.jsx)(`div`,{className:`divide-y divide-edge overflow-hidden rounded-2xl border border-edge bg-surface-panel`,children:e.map(e=>(0,$.jsxs)(`article`,{className:`flex flex-col gap-2 px-4 py-3 sm:flex-row sm:items-start sm:gap-4 sm:px-5`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`p`,{className:`text-sm leading-6 ${e.status===`disabled`?`text-fg-subtle line-through`:`text-fg`}`,children:e.statement}),(0,$.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-2 text-[11px] text-fg-subtle`,children:[(0,$.jsx)(`span`,{children:ye[e.category][r]}),(0,$.jsx)(`span`,{children:`·`}),(0,$.jsxs)(`span`,{children:[`P`,e.priority]}),e.status===`disabled`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{children:`·`}),(0,$.jsx)(`span`,{children:i.disable})]}):null]})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-1 sm:justify-end`,children:[(0,$.jsx)(f,{variant:`ghost`,onClick:async()=>{await le(e.id,{status:e.status===`active`?`disabled`:`active`}),await a()},children:e.status===`active`?i.disable:i.enable}),(0,$.jsxs)(f,{variant:`ghost`,className:`text-danger`,onClick:async()=>{if(g!==e.id){_(e.id);return}await ne(e.id),_(null),await a()},children:[(0,$.jsx)(ae,{className:`size-3.5`}),g===e.id?i.confirmDelete:i.delete]})]})]},e.id))}):(0,$.jsx)(xe,{children:i.emptyRules}),t[0]=c,t[1]=m,t[2]=g,t[3]=r,t[4]=a,t[5]=n,t[6]=d,t[7]=i.add,t[8]=i.addRule,t[9]=i.cancel,t[10]=i.category,t[11]=i.collaboration,t[12]=i.confirmDelete,t[13]=i.delete,t[14]=i.disable,t[15]=i.emptyRules,t[16]=i.enable,t[17]=i.ruleStatement,t[18]=i.rulesHint,t[19]=v,t[20]=y,t[21]=b,t[22]=x,t[23]=S,t[24]=C}else v=t[19],y=t[20],b=t[21],x=t[22],S=t[23],C=t[24];let w;t[71]!==v||t[72]!==y||t[73]!==b?(w=(0,$.jsxs)(`section`,{className:v,children:[y,b]}),t[71]=v,t[72]=y,t[73]=b,t[74]=w):w=t[74];let T;return t[75]!==x||t[76]!==S||t[77]!==C||t[78]!==w?(T=(0,$.jsxs)(`div`,{className:x,children:[S,C,w]}),t[75]=x,t[76]=S,t[77]=C,t[78]=w,t[79]=T):T=t[79],T}function Ye(e){return e.status!==`archived`}async function Xe(){let[e,t,n]=await Promise.all([H(),N(),ce()]);return{grants:e,connectors:t,catalog:n}}function Ze({t:e}){let{data:t,error:n,isLoading:r,mutate:i}=x(`you-understanding-sources`,Xe),{data:o=[],mutate:s}=x(`you-connected-content-candidates`,V),[u,d]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)([]),[_,v]=(0,Q.useState)(!1),[y,b]=(0,Q.useState)(null);if(r)return(0,$.jsx)(P,{className:`h-64 rounded-2xl`});if(n)return(0,$.jsxs)(xe,{children:[e.error,` `,(0,$.jsx)(`button`,{className:`text-accent hover:underline`,onClick:()=>void i(),children:e.retry})]});let S=t?.grants??[],C=t?.connectors??[],w=new Map((t?.catalog??[]).map(e=>[e.id,e])),T=e=>{let t=e.displayName.trim().toLocaleLowerCase(),n=C.find(e=>e.displayName.trim().toLocaleLowerCase()===t);return n?w.get(n.connectorId):[...w.values()].find(n=>n.displayName.trim().toLocaleLowerCase()===t||e.sourceKey.toLocaleLowerCase().includes(n.id.toLocaleLowerCase()))},E=t=>`${e.actionFailed}: ${t instanceof Error?t.message:String(t)}`,D=async t=>{b(null),m(null),d({grantId:t.id,kind:`refresh`});try{await F(t.id),await i().catch(()=>void 0),b({tone:`success`,message:`${t.displayName}: ${e.refreshStarted}`})}catch(e){b({tone:`error`,message:E(e)})}finally{d(null)}},O=async t=>{if(p!==t.id){m(t.id),b(null);return}d({grantId:t.id,kind:`revoke`});try{await ie(t.id),await i().catch(()=>void 0),m(null),b({tone:`success`,message:`${t.displayName}: ${e.revokeDone}`})}catch(e){b({tone:`error`,message:E(e)})}finally{d(null)}},k=async()=>{if(h.length){v(!0),b(null);try{let t=await W(h);t.result.failed.length?b({tone:`error`,message:t.result.failed.map(e=>e.error).join(`; `)}):b({tone:`success`,message:e.contentReadDone}),g([]),await s()}catch(e){b({tone:`error`,message:E(e)})}finally{v(!1)}}};return(0,$.jsxs)(`div`,{className:`space-y-5`,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,$.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:e.sourcesHint}),(0,$.jsx)(f,{asChild:!0,variant:`primary`,children:(0,$.jsxs)(a,{to:`/connectors?understanding=1&returnTo=%2Fyou%3Ftab%3Dsources`,children:[e.manageSources,(0,$.jsx)(c,{className:`size-4`})]})})]}),y?(0,$.jsx)(`p`,{role:`status`,"aria-live":`polite`,className:`rounded-xl px-3 py-2 text-sm ${y.tone===`success`?`bg-success-soft text-success`:`bg-danger/10 text-danger`}`,children:y.message}):null,(0,$.jsxs)(`section`,{className:`space-y-2`,children:[(0,$.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[e.authorizedSources,` · `,S.length]}),S.length?(0,$.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:S.map(t=>{let n=T(t);return(0,$.jsxs)(`article`,{className:`flex min-h-28 items-start gap-3 rounded-2xl border border-edge bg-surface-panel p-4`,children:[n?(0,$.jsx)(oe,{connector:n,size:`sm`}):(0,$.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg border border-edge bg-surface-base`,children:(0,$.jsx)(J,{className:`size-4 text-fg-muted`})}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:t.displayName}),(0,$.jsxs)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:[t.accessMode===`continuous`?e.continuous:e.once,` · `,t.processingPolicy===`local_only`?e.localOnly:t.retentionPolicy===`derived_only`?e.derivedOnly:t.retentionPolicy]}),t.lastCollectedAt?(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:new Date(t.lastCollectedAt).toLocaleString()}):null]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-1`,children:[t.accessMode===`continuous`?(0,$.jsx)(f,{variant:`ghost`,disabled:u!==null,"aria-busy":u?.grantId===t.id&&u.kind===`refresh`,onClick:()=>void D(t),children:u?.grantId===t.id&&u.kind===`refresh`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(l,{className:`size-4 animate-spin`}),e.refreshing]}):e.refresh}):null,(0,$.jsx)(f,{variant:`ghost`,className:`text-danger`,title:e.revokeHint,"aria-label":`${e.revoke}: ${t.displayName}`,disabled:u!==null,"aria-busy":u?.grantId===t.id&&u.kind===`revoke`,onClick:()=>void O(t),children:u?.grantId===t.id&&u.kind===`revoke`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(l,{className:`size-4 animate-spin`}),e.revoking]}):p===t.id?e.confirmRevoke:e.revoke})]})]},t.id)})}):(0,$.jsx)(xe,{children:e.noSources})]}),o.length?(0,$.jsxs)(`section`,{className:`space-y-2`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.contentReadTitle}),(0,$.jsx)(`p`,{className:`mt-1 max-w-2xl text-xs leading-5 text-fg-muted`,children:e.contentReadHint})]}),(0,$.jsx)(f,{variant:`primary`,disabled:!h.length||_,onClick:()=>void k(),children:_?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(l,{className:`size-4 animate-spin`}),e.reading]}):`${e.readSelected} · ${h.length}`})]}),(0,$.jsx)(`div`,{className:`divide-y divide-edge overflow-hidden rounded-2xl border border-edge bg-surface-panel`,children:o.map(e=>{let t=h.includes(e.sourceItemId),n=h.length>=5&&!t;return(0,$.jsxs)(`label`,{className:`flex items-center gap-3 px-4 py-3 ${n?`opacity-50`:`cursor-pointer hover:bg-surface-hover`}`,children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`size-4 rounded border-edge accent-[var(--color-accent)]`,checked:t,disabled:n||_,onChange:t=>g(n=>t.target.checked?[...n,e.sourceItemId]:n.filter(t=>t!==e.sourceItemId))}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`p`,{className:`truncate text-sm text-fg`,children:e.title}),(0,$.jsxs)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:[e.toolkit===`gmail`?`Gmail`:`Google Drive`,e.occurredAt?` · ${new Date(e.occurredAt).toLocaleDateString()}`:``]})]})]},e.sourceItemId)})})]}):null,(0,$.jsxs)(`section`,{className:`space-y-2`,children:[(0,$.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[e.connectorsTitle,` · `,C.length]}),C.length?(0,$.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:C.map(t=>{let n=t.enabled&&(t.status===`connected`||t.connectionStatus===`connected`||t.authStatus===`connected`),r=w.get(t.connectorId);return(0,$.jsxs)(a,{to:`/connectors?tab=connected&instance=${encodeURIComponent(t.instanceId)}`,"aria-label":`${e.openConnector}: ${t.displayName}`,className:`group flex min-h-24 items-center gap-3 rounded-2xl border border-edge bg-surface-panel p-4 transition-colors hover:border-edge-strong hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,children:[(0,$.jsx)(oe,{connector:r??{displayName:t.displayName}}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:t.displayName}),(0,$.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:t.connectorId})]}),(0,$.jsx)(`span`,{className:`shrink-0 rounded-full px-2 py-1 text-xs ${n?`bg-success-soft text-success`:`bg-warning-soft text-warning`}`,children:n?e.connected:e.unavailable}),(0,$.jsx)(A,{className:`size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5`})]},t.instanceId)})}):(0,$.jsx)(xe,{children:e.noConnectors})]})]})}function Qe(e){let t=(0,Z.c)(115),{lastRun:n,t:r}=e,{data:i,error:a,isLoading:c,mutate:l}=x(`you-context-settings`,ee),u=i?.dreaming??null,[d,p]=we(u),m;t[0]!==d||t[1]!==u?(m=d&&u&&Ce(d)!==Ce(u),t[0]=d,t[1]=u,t[2]=m):m=t[2];let h=!!m,g;t[3]===l?g=t[4]:(g=async e=>{await se({dreaming:e}),await l()},t[3]=l,t[4]=g);let _;t[5]!==d||t[6]!==h||t[7]!==g?(_={value:d,dirty:h,delayMs:500,onSave:g},t[5]=d,t[6]=h,t[7]=g,t[8]=_):_=t[8];let v=fe(_);if(a){let e;t[9]===l?e=t[10]:(e=()=>void l(),t[9]=l,t[10]=e);let n;t[11]!==r.retry||t[12]!==e?(n=(0,$.jsx)(`button`,{className:`text-accent hover:underline`,onClick:e,children:r.retry}),t[11]=r.retry,t[12]=e,t[13]=n):n=t[13];let i;return t[14]!==r.error||t[15]!==n?(i=(0,$.jsxs)(xe,{children:[r.error,` `,n]}),t[14]=r.error,t[15]=n,t[16]=i):i=t[16],i}if(c||!d){let e;return t[17]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(P,{className:`h-72 rounded-2xl`}),t[17]=e):e=t[17],e}let y=n?.status===`completed`?r.runCompleted:n?.status===`failed`?r.runFailed:r.runRunning,b;t[18]===r.dreamingHint?b=t[19]:(b=(0,$.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:r.dreamingHint}),t[18]=r.dreamingHint,t[19]=b);let S=v.onBlurCapture,C;t[20]===r.mode?C=t[21]:(C=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:r.mode}),t[20]=r.mode,t[21]=C);let w;t[22]===p?w=t[23]:(w=e=>p(t=>t&&{...t,mode:e.target.value}),t[22]=p,t[23]=w);let T;t[24]===r.on?T=t[25]:(T=(0,$.jsx)(s,{value:`review`,children:r.on}),t[24]=r.on,t[25]=T);let E;t[26]===r.off?E=t[27]:(E=(0,$.jsx)(s,{value:`off`,children:r.off}),t[26]=r.off,t[27]=E);let D;t[28]!==d.mode||t[29]!==E||t[30]!==w||t[31]!==T?(D=(0,$.jsxs)(o,{value:d.mode,onChange:w,children:[T,E]}),t[28]=d.mode,t[29]=E,t[30]=w,t[31]=T,t[32]=D):D=t[32];let O;t[33]!==D||t[34]!==C?(O=(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[C,D]}),t[33]=D,t[34]=C,t[35]=O):O=t[35];let k;t[36]===r.reviewTime?k=t[37]:(k=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:r.reviewTime}),t[36]=r.reviewTime,t[37]=k);let A;t[38]===p?A=t[39]:(A=e=>p(t=>t&&{...t,schedule:{time:e.target.value}}),t[38]=p,t[39]=A);let j;t[40]!==d.schedule.time||t[41]!==A?(j=(0,$.jsx)(`input`,{type:`time`,className:ge,value:d.schedule.time,onChange:A}),t[40]=d.schedule.time,t[41]=A,t[42]=j):j=t[42];let M;t[43]!==k||t[44]!==j?(M=(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[k,j]}),t[43]=k,t[44]=j,t[45]=M):M=t[45];let N;t[46]===r.timezone?N=t[47]:(N=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:r.timezone}),t[46]=r.timezone,t[47]=N);let F=d.timezone??``,I,L;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(I=re(),L=re(),t[48]=I,t[49]=L):(I=t[48],L=t[49]);let R,z;t[50]===p?(R=t[51],z=t[52]):(R=e=>p(t=>t&&{...t,timezone:e}),z=e=>p(t=>t&&{...t,timezone:e.target.value||void 0}),t[50]=p,t[51]=R,t[52]=z);let B;t[53]!==F||t[54]!==R||t[55]!==z?(B=(0,$.jsx)(pe,{className:`${ge} min-w-0 flex-1`,value:F,placeholder:I,suggestion:L,onAcceptSuggestion:R,onChange:z}),t[53]=F,t[54]=R,t[55]=z,t[56]=B):B=t[56];let V;t[57]===p?V=t[58]:(V=()=>p($e),t[57]=p,t[58]=V);let H;t[59]!==r.detect||t[60]!==V?(H=(0,$.jsx)(f,{className:`shrink-0 whitespace-nowrap`,onClick:V,children:r.detect}),t[59]=r.detect,t[60]=V,t[61]=H):H=t[61];let U;t[62]!==B||t[63]!==H?(U=(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[B,H]}),t[62]=B,t[63]=H,t[64]=U):U=t[64];let W;t[65]!==N||t[66]!==U?(W=(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm sm:col-span-2`,children:[N,U]}),t[65]=N,t[66]=U,t[67]=W):W=t[67];let G;t[68]===r.evidenceThreshold?G=t[69]:(G=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:r.evidenceThreshold}),t[68]=r.evidenceThreshold,t[69]=G);let K;t[70]===p?K=t[71]:(K=e=>p(t=>t&&{...t,minEvidenceSources:Number(e.target.value)}),t[70]=p,t[71]=K);let te;t[72]!==d.minEvidenceSources||t[73]!==K?(te=(0,$.jsx)(`input`,{type:`number`,min:2,max:10,className:ge,value:d.minEvidenceSources,onChange:K}),t[72]=d.minEvidenceSources,t[73]=K,t[74]=te):te=t[74];let q;t[75]!==G||t[76]!==te?(q=(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[G,te]}),t[75]=G,t[76]=te,t[77]=q):q=t[77];let J;t[78]===r.scanLimit?J=t[79]:(J=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:r.scanLimit}),t[78]=r.scanLimit,t[79]=J);let Y;t[80]===p?Y=t[81]:(Y=e=>p(t=>t&&{...t,limit:Number(e.target.value)}),t[80]=p,t[81]=Y);let X;t[82]!==d.limit||t[83]!==Y?(X=(0,$.jsx)(`input`,{type:`number`,min:1,max:2e3,className:ge,value:d.limit,onChange:Y}),t[82]=d.limit,t[83]=Y,t[84]=X):X=t[84];let ne;t[85]!==J||t[86]!==X?(ne=(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[J,X]}),t[85]=J,t[86]=X,t[87]=ne):ne=t[87];let ie;t[88]!==O||t[89]!==M||t[90]!==W||t[91]!==q||t[92]!==ne?(ie=(0,$.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[O,M,W,q,ne]}),t[88]=O,t[89]=M,t[90]=W,t[91]=q,t[92]=ne,t[93]=ie):ie=t[93];let ae;t[94]!==v.error||t[95]!==v.status?(ae=(0,$.jsx)(`div`,{className:`mt-5 flex justify-end`,children:(0,$.jsx)(de,{status:v.status,error:v.error})}),t[94]=v.error,t[95]=v.status,t[96]=ae):ae=t[96];let oe;t[97]!==v.onBlurCapture||t[98]!==ie||t[99]!==ae?(oe=(0,$.jsx)(be,{children:(0,$.jsxs)(`div`,{onBlurCapture:S,children:[ie,ae]})}),t[97]=v.onBlurCapture,t[98]=ie,t[99]=ae,t[100]=oe):oe=t[100];let ce;t[101]===r.lastRun?ce=t[102]:(ce=(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:r.lastRun}),t[101]=r.lastRun,t[102]=ce);let le;t[103]!==n||t[104]!==y||t[105]!==r.neverRun||t[106]!==r.runItems?(le=n?(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-sm text-fg-muted`,children:[(0,$.jsx)(`span`,{children:y}),(0,$.jsx)(`span`,{children:`·`}),(0,$.jsx)(`time`,{children:new Date(n.startedAt).toLocaleString()}),typeof n.metrics.scanned==`number`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{children:`·`}),(0,$.jsxs)(`span`,{children:[String(n.metrics.scanned),` `,r.runItems]})]}):null]}):(0,$.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:r.neverRun}),t[103]=n,t[104]=y,t[105]=r.neverRun,t[106]=r.runItems,t[107]=le):le=t[107];let ue;t[108]!==ce||t[109]!==le?(ue=(0,$.jsxs)(be,{children:[ce,le]}),t[108]=ce,t[109]=le,t[110]=ue):ue=t[110];let me;return t[111]!==oe||t[112]!==ue||t[113]!==b?(me=(0,$.jsxs)(`div`,{className:`space-y-5`,children:[b,oe,ue]}),t[111]=oe,t[112]=ue,t[113]=b,t[114]=me):me=t[114],me}function $e(e){return e&&{...e,timezone:re()}}function et(e){let t=(0,Z.c)(49),{t:n}=e,{data:r,error:i,isLoading:a,mutate:c}=x(`you-context-settings`,ee),l=r?.privacy.sensitiveWritePolicy??null,[u,d]=we(l),f=!!(u&&l&&u!==l),p;t[0]===c?p=t[1]:(p=async e=>{await se({privacy:{sensitiveWritePolicy:e}}),await c()},t[0]=c,t[1]=p);let m;t[2]!==u||t[3]!==f||t[4]!==p?(m={value:u,dirty:f,delayMs:350,onSave:p},t[2]=u,t[3]=f,t[4]=p,t[5]=m):m=t[5];let h=fe(m);if(i){let e;t[6]===c?e=t[7]:(e=()=>void c(),t[6]=c,t[7]=e);let r;t[8]!==n.retry||t[9]!==e?(r=(0,$.jsx)(`button`,{className:`text-accent hover:underline`,onClick:e,children:n.retry}),t[8]=n.retry,t[9]=e,t[10]=r):r=t[10];let i;return t[11]!==n.error||t[12]!==r?(i=(0,$.jsxs)(xe,{children:[n.error,` `,r]}),t[11]=n.error,t[12]=r,t[13]=i):i=t[13],i}if(a||!u){let e;return t[14]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(P,{className:`h-56 rounded-2xl`}),t[14]=e):e=t[14],e}let g;t[15]===n.privacyHint?g=t[16]:(g=(0,$.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:n.privacyHint}),t[15]=n.privacyHint,t[16]=g);let _;t[17]===n.sensitivePolicy?_=t[18]:(_=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:n.sensitivePolicy}),t[17]=n.sensitivePolicy,t[18]=_);let v;t[19]===d?v=t[20]:(v=e=>d(e.target.value),t[19]=d,t[20]=v);let y;t[21]===n.policyDeny?y=t[22]:(y=(0,$.jsx)(s,{value:`deny`,children:n.policyDeny}),t[21]=n.policyDeny,t[22]=y);let b;t[23]===n.policyConfirm?b=t[24]:(b=(0,$.jsx)(s,{value:`confirm`,children:n.policyConfirm}),t[23]=n.policyConfirm,t[24]=b);let S;t[25]===n.policyAllow?S=t[26]:(S=(0,$.jsx)(s,{value:`allow`,children:n.policyAllow}),t[25]=n.policyAllow,t[26]=S);let C;t[27]!==u||t[28]!==v||t[29]!==y||t[30]!==b||t[31]!==S?(C=(0,$.jsxs)(o,{value:u,onChange:v,children:[y,b,S]}),t[27]=u,t[28]=v,t[29]=y,t[30]=b,t[31]=S,t[32]=C):C=t[32];let w;t[33]!==C||t[34]!==_?(w=(0,$.jsxs)(`label`,{className:`block max-w-xl space-y-1.5 text-sm`,children:[_,C]}),t[33]=C,t[34]=_,t[35]=w):w=t[35];let T;t[36]===n.privacyWarning?T=t[37]:(T=(0,$.jsx)(`p`,{className:`mt-3 max-w-2xl text-xs leading-5 text-fg-subtle`,children:n.privacyWarning}),t[36]=n.privacyWarning,t[37]=T);let E;t[38]!==h.error||t[39]!==h.status?(E=(0,$.jsx)(`div`,{className:`mt-5 flex justify-end`,children:(0,$.jsx)(de,{status:h.status,error:h.error})}),t[38]=h.error,t[39]=h.status,t[40]=E):E=t[40];let D;t[41]!==h.onBlurCapture||t[42]!==w||t[43]!==T||t[44]!==E?(D=(0,$.jsx)(be,{children:(0,$.jsxs)(`div`,{onBlurCapture:h.onBlurCapture,children:[w,T,E]})}),t[41]=h.onBlurCapture,t[42]=w,t[43]=T,t[44]=E,t[45]=D):D=t[45];let O;return t[46]!==D||t[47]!==g?(O=(0,$.jsxs)(`div`,{className:`space-y-5`,children:[g,D]}),t[46]=D,t[47]=g,t[48]=O):O=t[48],O}export{Ee as UserContextPage};
@@ -1,5 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{d as i,l as a,p as o,t as s}from"./chunk-KS7C4IRE-BaASWQor.js";import{t as c}from"./check-DUBLcKHA.js";import{n as l,r as u,t as d}from"./popover-select-BzdnTy3h.js";import{t as f}from"./copy-Dv6d4Dvw.js";import{t as p}from"./download-Dk-ZjtO6.js";import{t as m}from"./markdown-view-ybRARsPs.js";import{d as h}from"./notes-api-D9CCwyWK.js";import{t as g}from"./plus-Q2yW6OE7.js";import{t as _}from"./x-B_N4OPjy.js";import{t as v}from"./cn-JdwAhgNB.js";import{t as y}from"./button-CSEbl4zT.js";import{t as b}from"./copy-to-clipboard-HOJ79TWv.js";import{t as x}from"./messages-VI9m1xJl.js";import{l as S,n as C}from"./locale-store-De8wYkd7.js";import{a as w,c as T,i as E,n as D,o as O,r as k,s as A,t as j}from"./dist-BPoKqzeH.js";import{i as M}from"./vendor-swr-BIWyz7Rc.js";import{$r as N,A as P,Aa as F,C as I,Ci as L,D as R,Dl as z,E as B,Ei as V,Fc as H,Gl as U,Il as W,Jr as G,Kr as ee,Ks as te,Ms as ne,Nc as re,O as ie,Oa as K,Oc as q,Pl as ae,Qr as J,S as oe,Sc as se,Si as ce,T as le,Ti as ue,Ua as Y,Uc as de,Ul as fe,Us as pe,Vl as me,Ws as he,Xo as ge,Xr as _e,Yc as ve,Yr as X,Zr as ye,_ as be,_c as xe,_i as Se,_s as Ce,a as we,ac as Te,ai as Ee,al as De,b as Oe,bi as ke,ca as Ae,ci as je,d as Me,di as Ne,ei as Pe,el as Fe,er as Ie,eu as Le,f as Re,fi as ze,g as Be,h as Ve,hi as He,hl as Ue,ii as We,jc as Ge,k as Ke,li as qe,m as Je,mi as Ye,ni as Xe,oi as Ze,os as Qe,p as $e,pi as et,ri as tt,ro as nt,sr as rt,tc as it,ti as at,ui as ot,ul as st,us as ct,v as lt,vs as ut,w as dt,wi as ft,x as pt,y as mt,yi as ht,zc as gt}from"./index-CMLkr37Y.js";import{n as _t,r as vt,t as yt}from"./tab-completion-input-B-VsxKhC.js";import{t as bt}from"./page-tabs-e99j9S9K.js";import{i as xt,r as St,t as Ct}from"./workflow-run-setup-panel-D0WhQ3kI.js";import{a as wt,c as Tt,i as Et,l as Dt,n as Ot,o as kt,r as At,s as jt,t as Mt}from"./style-TIDOdKy0.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||!at(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 ke(-r,`second`,n);let i=Math.round(r/60);if(i<60)return ke(-i,`minute`,n);let a=Math.round(i/60);return a<48?ke(-a,`hour`,n):ke(-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=x(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,b=n.status===`running`||n.status===`queued`,S;t[4]!==n.metrics.agentCount||t[5]!==n.metrics.doneAgentCount?(S=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]=S):S=t[6];let C=S,w=n.metrics.errorAgentCount>0,T=n.startedAtMs??n.createdAtMs,E=_e(_?a-T:n.metrics.durationMs),D=J(d.taskArtifacts,{count:n.metrics.artifactCount}),O;t[7]===n?O=t[8]:(O=zt(n),t[7]=n,t[8]=O);let k=O,A;t[9]===n?A=t[10]:(A=Bt(n),t[9]=n,t[10]=A);let j=A,M;t[11]!==s||t[12]!==n?(M=()=>{s(n)},t[11]=s,t[12]=n,t[13]=M):M=t[13];let N=M,P;t[14]!==h||t[15]!==c||t[16]!==n?(P=()=>{h||c(n)},t[14]=h,t[15]=c,t[16]=n,t[17]=P):P=t[17];let F=P,I=o&&`ring-1 ring-accent/30`,L;t[18]===I?L=t[19]:(L=v(`group relative min-h-24 overflow-hidden rounded-lg bg-surface-panel p-3 shadow-surface transition-colors`,I,`hover:bg-surface-hover`),t[18]=I,t[19]=L);let R;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(R=v(`w-full text-left`,ge.focusRingPanel),t[20]=R):R=t[20];let z;t[21]===k?z=t[22]:(z=(0,$.jsx)(`div`,{className:`line-clamp-2 text-sm font-medium leading-5 text-fg`,children:k}),t[21]=k,t[22]=z);let B;t[23]===j?B=t[24]:(B=(0,$.jsx)(`div`,{className:`mt-1 truncate text-[11px] font-medium text-fg-muted`,children:j}),t[23]=j,t[24]=B);let V;t[25]!==z||t[26]!==B?(V=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[z,B]}),t[25]=z,t[26]=B,t[27]=V):V=t[27];let H;t[28]===n.status?H=t[29]:(H=v(`shrink-0 rounded-full px-2 py-0.5 text-[10px] font-semibold shadow-sm`,Xe(n.status)),t[28]=n.status,t[29]=H);let U;t[30]!==i||t[31]!==a||t[32]!==T?(U=qt(T,a,i),t[30]=i,t[31]=a,t[32]=T,t[33]=U):U=t[33];let W;t[34]===U?W=t[35]:(W=(0,$.jsx)(`span`,{children:U}),t[34]=U,t[35]=W);let G=E===`—`?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,$.jsx)(`span`,{children:J(d.taskElapsed,{duration:E})})]}),ee;t[36]!==W||t[37]!==G?(ee=(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5 text-[11px] text-fg-subtle`,children:[W,G]}),t[36]=W,t[37]=G,t[38]=ee):ee=t[38];let te=n.metrics.artifactCount>0?(0,$.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 font-medium text-fg-muted`,children:D}):null,ne=o?(0,$.jsx)(`span`,{className:`font-medium text-accent-fg`,children:d.taskOpenDetails}):null,re;t[39]!==te||t[40]!==ne?(re=(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2 text-[11px] text-fg-subtle`,children:[te,ne]}),t[39]=te,t[40]=ne,t[41]=re):re=t[41];let ie=h&&`cursor-not-allowed text-fg-disabled hover:bg-transparent`,K;t[42]===ie?K=t[43]:(K=v(`rounded-md px-2 py-1 text-xs font-medium`,`text-accent-fg hover:bg-accent-soft`,ge.focusRingPanel,ie),t[42]=ie,t[43]=K);let q;t[44]!==h||t[45]!==F||t[46]!==d.continueInChat||t[47]!==K?(q=(0,$.jsx)(`button`,{type:`button`,className:K,disabled:h,onClick:F,children:d.continueInChat}),t[44]=h,t[45]=F,t[46]=d.continueInChat,t[47]=K,t[48]=q):q=t[48];let ae;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(ae=v(`rounded-md px-2 py-1 text-xs font-medium text-fg-muted hover:bg-surface-hover hover:text-fg`,ge.focusRingPanel),t[49]=ae):ae=t[49];let oe;t[50]!==N||t[51]!==d.taskOpenDetails?(oe=(0,$.jsx)(`button`,{type:`button`,className:ae,onClick:N,children:d.taskOpenDetails}),t[50]=N,t[51]=d.taskOpenDetails,t[52]=oe):oe=t[52];let se;t[53]!==q||t[54]!==oe?(se=(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2 border-t border-edge-subtle pt-2`,children:[q,oe]}),t[53]=q,t[54]=oe,t[55]=se):se=t[55];let ce;t[56]===p?ce=t[57]:(ce=()=>p(Qt),t[56]=p,t[57]=ce);let le;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,$.jsx)(st,{className:`size-4`,"aria-hidden":!0}),t[58]=le):le=t[58];let ue;t[59]!==d.taskActionsAria||t[60]!==f||t[61]!==ce?(ue=(0,$.jsx)(y,{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:ce,children:le}),t[59]=d.taskActionsAria,t[60]=f,t[61]=ce,t[62]=ue):ue=t[62];let Y;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?(Y=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]=Y):Y=t[72];let de;return t[73]!==ue||t[74]!==Y?(de=(0,$.jsxs)(`div`,{className:`absolute right-2 top-2`,children:[ue,Y]}),t[73]=ue,t[74]=Y,t[75]=de):de=t[75],(0,$.jsxs)(`div`,{className:L,children:[(0,$.jsxs)(`button`,{type:`button`,onClick:N,"aria-label":`${d.taskOpenDetails}: ${k}`,"aria-current":o?`true`:void 0,className:R,children:[(0,$.jsxs)(`div`,{className:`pr-7`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-2`,children:[V,(0,$.jsx)(`span`,{className:H,children:d.status[n.status]??n.status})]}),ee]}),b?(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:J(d.agentProgress,{done:n.metrics.doneAgentCount,total:n.metrics.agentCount})}),(0,$.jsxs)(`span`,{children:[C,`%`]})]}),(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:`${C}%`}})})]}):null,re,w?(0,$.jsxs)(`div`,{className:`mt-2 flex items-center gap-1 text-[11px] text-amber-700 dark:text-amber-300`,children:[(0,$.jsx)(Ce,{className:`size-3 shrink-0`,"aria-hidden":!0}),J(d.runRowErrorSummary,{count:n.metrics.errorAgentCount})]}):null]}),se,de]})});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=v(`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=x(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 b=_,S=h&&n.runs.length>5&&!p,C=h&&p,w;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(w=v(`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]=w):w=t[5];let T;t[6]===n.runs.length?T=t[7]:(T=(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:n.runs.length}),t[6]=n.runs.length,t[7]=T);let E;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,$.jsx)(st,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[8]=E):E=t[8];let D=s&&b.length===0?(0,$.jsx)(tn,{}):b.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}):b.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)),O=S?(0,$.jsx)(y,{variant:`ghost`,className:`h-8 w-full text-xs`,onClick:()=>m(!0),children:J(f.boardExpandSucceeded,{count:Math.min(n.runs.length,n.totalInWindow??n.runs.length)})}):null,k;t[9]!==C||t[10]!==f||t[11]!==m?(k=C?(0,$.jsx)(y,{variant:`ghost`,className:`h-8 w-full text-xs`,onClick:()=>m(!1),children:f.boardCollapseSucceeded}):null,t[9]=C,t[10]=f,t[11]=m,t[12]=k):k=t[12];let A;return t[13]!==D||t[14]!==O||t[15]!==k?(A=(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:[D,O,k]}),t[13]=D,t[14]=O,t[15]=k,t[16]=A):A=t[16],(0,$.jsxs)(`section`,{className:w,"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)}),T]}),E]}),A]})});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)(Y,{className:`size-4/5`}),(0,$.jsx)(Y,{className:`mt-2 h-3 w-24`})]}),(0,$.jsx)(Y,{className:`h-5 w-14 rounded-full`})]}),(0,$.jsx)(Y,{className:`mt-3 h-3 w-2/3`}),(0,$.jsx)(Y,{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),b=(0,Z.useRef)(null),[x,S]=(0,Z.useState)(on),[C,w]=(0,Z.useState)(!1),T,E;t[2]===_?(T=t[3],E=t[4]):(T=()=>{if(!_)return;let e=window.setInterval(()=>S(Date.now()),1e3);return()=>window.clearInterval(e)},E=[_],t[2]=_,t[3]=T,t[4]=E),(0,Z.useEffect)(T,E);let D;t[5]!==x||t[6]!==n||t[7]!==o||t[8]!==c||t[9]!==s?(D=Kt(Ht(n,{searchQuery:o,workflowFilterId:s,triggerFilter:c}),x),t[5]=x,t[6]=n,t[7]=o,t[8]=c,t[9]=s,t[10]=D):D=t[10];let O=D,k=O.reduce(sn,0),A;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(A=e=>{let t=b.current;!t||t.pointerId!==e.pointerId||(b.current=null,w(!1),e.currentTarget.hasPointerCapture?.(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))},t[11]=A):A=t[11];let j=A,M;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(M=e=>{if(e.button!==0||nn(e.target))return;let t=v.current;t&&(b.current={pointerId:e.pointerId,startX:e.clientX,scrollLeft:t.scrollLeft,active:!1},e.currentTarget.setPointerCapture(e.pointerId))},t[12]=M):M=t[12];let N=M,P;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(P=e=>{let t=b.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,w(!0)),e.preventDefault(),n.scrollLeft=t.scrollLeft-r)},t[13]=P):P=t[13];let F=P;if(!u&&k===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)(y,{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=C?`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=>{b.current?.pointerId===e.pointerId&&(b.current=null,w(!1))},t[27]=z):z=t[27];let B;if(t[28]!==O||t[29]!==r||t[30]!==u||t[31]!==i||t[32]!==x||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]!==x||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:x,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]=x,t[43]=p,t[44]=d,t[45]=f,t[46]=m,t[47]=l,t[48]=e):e=t[48],B=O.map(e),t[28]=O,t[29]=r,t[30]=u,t[31]=i,t[32]=x,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:N,onPointerMove:F,onPointerUp:j,onPointerCancel:j,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?J(t.agentScaleExact,{count:n.min}):J(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=Se(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=v(`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 b;t[11]!==n.inputSchema||t[12]!==i.inputSchemaBadge?(b=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)(me,{className:`size-2.5`,"aria-hidden":!0}),i.inputSchemaBadge]}):null,t[11]=n.inputSchema,t[12]=i.inputSchemaBadge,t[13]=b):b=t[13];let x;t[14]!==i.projectWorkflowBadge||t[15]!==c?(x=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)(U,{className:`size-2.5`,"aria-hidden":!0}),i.projectWorkflowBadge]}):null,t[14]=i.projectWorkflowBadge,t[15]=c,t[16]=x):x=t[16];let S;t[17]!==_||t[18]!==b||t[19]!==x?(S=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[_,b,x]}),t[17]=_,t[18]=b,t[19]=x,t[20]=S):S=t[20];let C;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(C=v(`mt-2 line-clamp-2 text-left text-sm font-semibold leading-5 text-fg hover:text-accent-fg`,ge.focusRingPanel),t[21]=C):C=t[21];let w;t[22]!==n||t[23]!==o?(w=()=>o(n),t[22]=n,t[23]=o,t[24]=w):w=t[24];let T;t[25]!==n.title||t[26]!==w?(T=(0,$.jsx)(`button`,{type:`button`,className:C,onClick:w,children:n.title}),t[25]=n.title,t[26]=w,t[27]=T):T=t[27];let E;t[28]!==T||t[29]!==S?(E=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[S,T]}),t[28]=T,t[29]=S,t[30]=E):E=t[30];let D=`${p?i.editWorkflow:i.copyAndEditWorkflow}: ${n.title}`,O;t[31]!==n||t[32]!==s?(O=()=>s(n),t[31]=n,t[32]=s,t[33]=O):O=t[33];let k;t[34]===p?k=t[35]:(k=p?(0,$.jsx)(Te,{className:`size-3.5`,"aria-hidden":!0}):(0,$.jsx)(Ue,{className:`size-3.5`,"aria-hidden":!0}),t[34]=p,t[35]=k);let A;t[36]!==D||t[37]!==O||t[38]!==k?(A=(0,$.jsx)(y,{type:`button`,variant:`ghost`,className:`size-8 shrink-0 p-0`,"aria-label":D,onClick:O,children:k}),t[36]=D,t[37]=O,t[38]=k,t[39]=A):A=t[39];let j;t[40]!==E||t[41]!==A?(j=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-3`,children:[E,A]}),t[40]=E,t[41]=A,t[42]=j):j=t[42];let M=u.whenToUse||u.description||n.description,N;t[43]===M?N=t[44]:(N=(0,$.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-5 text-fg-muted`,children:M}),t[43]=M,t[44]=N);let P;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,$.jsx)(H,{className:`size-3`,"aria-hidden":!0}),t[45]=P):P=t[45];let F;t[46]!==n.phases.length||t[47]!==i.phaseCount?(F=J(i.phaseCount,{count:n.phases.length}),t[46]=n.phases.length,t[47]=i.phaseCount,t[48]=F):F=t[48];let I;t[49]===F?I=t[50]:(I=(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[P,F]}),t[49]=F,t[50]=I);let L;t[51]===f?L=t[52]:(L=f?(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,$.jsx)(ct,{className:`size-3`,"aria-hidden":!0}),f]}):null,t[51]=f,t[52]=L);let R;t[53]!==I||t[54]!==L?(R=(0,$.jsxs)(`div`,{className:`mt-auto flex flex-wrap items-center gap-3 pt-4 text-[11px] text-fg-subtle`,children:[I,L]}),t[53]=I,t[54]=L,t[55]=R):R=t[55];let z;t[56]!==n||t[57]!==a?(z=()=>a(n),t[56]=n,t[57]=a,t[58]=z):z=t[58];let B;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,$.jsx)(it,{className:`size-3.5`,"aria-hidden":!0}),t[59]=B):B=t[59];let V;t[60]!==i.configureAndRun||t[61]!==z?(V=(0,$.jsxs)(y,{type:`button`,variant:`secondary`,className:`h-8 flex-1 rounded-lg text-xs`,onClick:z,children:[B,i.configureAndRun]}),t[60]=i.configureAndRun,t[61]=z,t[62]=V):V=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)(y,{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 ee;t[69]!==V||t[70]!==G?(ee=(0,$.jsxs)(`div`,{className:`mt-3 flex items-center gap-2 border-t border-edge-subtle pt-3`,children:[V,G]}),t[69]=V,t[70]=G,t[71]=ee):ee=t[71];let te;return t[72]!==j||t[73]!==N||t[74]!==R||t[75]!==ee?(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:[j,N,R,ee]}),t[72]=j,t[73]=N,t[74]=R,t[75]=ee,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,[d]=(0,Z.useState)(pn),f=x(i).workflows,p=i===`zh`?`zh-CN`:`en-US`,[m,h]=(0,Z.useState)(``),[g,_]=(0,Z.useState)(`all`),[y,b]=(0,Z.useState)(`all`),S;t[0]!==g||t[1]!==n||t[2]!==m||t[3]!==y?(S=X(n,m,g,y),t[0]=g,t[1]=n,t[2]=m,t[3]=y,t[4]=S):S=t[4];let C=S,w;if(t[5]!==n||t[6]!==r){let e=new Map(n.map(fn)),i=new Set;w=[...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]=w}else w=t[7];let T=w,E=J(f.workflowCount,{count:C.length}),D;t[8]===E?D=t[9]:(D=(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:E}),t[8]=E,t[9]=D);let O=f.sourceFilterAria,k;t[10]!==f.sources||t[11]!==b||t[12]!==y?(k=ze.map(e=>(0,$.jsx)(`button`,{type:`button`,className:v(`h-8 rounded-md px-2.5 text-xs font-medium transition-colors`,y===e?`bg-surface-base text-fg shadow-surface`:`text-fg-muted hover:text-fg`,ge.focusRingPanel),"aria-pressed":y===e,onClick:()=>b(e),children:f.sources[e]},e)),t[10]=f.sources,t[11]=b,t[12]=y,t[13]=k):k=t[13];let A;t[14]!==f.sourceFilterAria||t[15]!==k?(A=(0,$.jsx)(`div`,{className:`flex rounded-lg bg-surface-muted p-0.5`,role:`group`,"aria-label":O,children:k}),t[14]=f.sourceFilterAria,t[15]=k,t[16]=A):A=t[16];let j=f.categoryFilterAria,M;t[17]===_?M=t[18]:(M=e=>_(e.target.value),t[17]=_,t[18]=M);let N;t[19]===f.categories?N=t[20]:(N=je.map(e=>(0,$.jsx)(u,{value:e,children:f.categories[e]},e)),t[19]=f.categories,t[20]=N);let P;t[21]!==g||t[22]!==f.categoryFilterAria||t[23]!==M||t[24]!==N?(P=(0,$.jsx)(l,{value:g,"aria-label":j,onChange:M,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:N}),t[21]=g,t[22]=f.categoryFilterAria,t[23]=M,t[24]=N,t[25]=P):P=t[25];let F;t[26]!==P||t[27]!==A?(F=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[A,P]}),t[26]=P,t[27]=A,t[28]=F):F=t[28];let I;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,$.jsx)(pe,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),t[29]=I):I=t[29];let L;t[30]===h?L=t[31]:(L=e=>h(e.target.value),t[30]=h,t[31]=L);let R=f.librarySearchPlaceholder,z;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(z=v(`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`,ge.focusRingPanel),t[32]=z):z=t[32];let B;t[33]!==f.librarySearchPlaceholder||t[34]!==m||t[35]!==L?(B=(0,$.jsxs)(`div`,{className:`relative max-w-xl`,children:[I,(0,$.jsx)(`input`,{value:m,onChange:L,placeholder:R,className:z})]}),t[33]=f.librarySearchPlaceholder,t[34]=m,t[35]=L,t[36]=B):B=t[36];let V;return t[37]!==C||t[38]!==f||t[39]!==i||t[40]!==s||t[41]!==c||t[42]!==o||t[43]!==a?(V=C.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:f.noDefinitions}),(0,$.jsx)(`p`,{className:`mt-1 max-w-sm text-xs leading-5 text-fg-muted`,children:f.noDefinitionsHint})]}):(0,$.jsx)(`div`,{className:`grid grid-cols-1 gap-3 pt-4 sm:grid-cols-2 xl:grid-cols-3`,children:C.map(e=>(0,$.jsx)(ln,{definition:e,language:i,labels:f,savedForProject:a?.has(e.id)??!1,onPick:o,onDetail:s,onEdit:c},e.id))}),t[37]=C,t[38]=f,t[39]=i,t[40]=s,t[41]=c,t[42]=o,t[43]=a,t[44]=V):V=t[44],(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-5`,children:[T.length>0&&!m&&g===`all`&&y===`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:f.recentlyUsed}),(0,$.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:T.map(e=>{let{definition:t,lastRunAtMs:n}=e;return(0,$.jsxs)(`button`,{type:`button`,className:v(`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`,ge.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,d,p)})]}),(0,$.jsx)(it,{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:f.allWorkflows}),D]}),F]}),B]}),V]})]})}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,_,b,S,C,w,T,E,D,O,k;if(t[0]!==r||t[1]!==i||t[2]!==a||t[3]!==o||t[4]!==n){f=x(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,y=_e(u?a-l:n.metrics.durationMs),A;t[28]!==n.metrics.agentCount||t[29]!==n.metrics.doneAgentCount?(A=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]=A):A=t[30];let j=A;b=`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`,O=`button`,t[31]!==o||t[32]!==n?(k=()=>o(n),t[31]=o,t[32]=n,t[33]=k):k=t[33],t[34]===Symbol.for(`react.memo_cache_sentinel`)?(h=v(`min-w-0 flex-1 text-left`,ge.focusRingPanel),t[34]=h):h=t[34];let M=f.taskOpenDetails,N;t[35]===n?N=t[36]:(N=zt(n),t[35]=n,t[36]=N),g=`${M}: ${N}`,E=`flex min-w-0 items-start gap-3`;let P;t[37]===n.status?P=t[38]:(P=v(`mt-0.5 shrink-0 rounded-full px-2 py-0.5 text-[10px] font-semibold`,Xe(n.status)),t[37]=n.status,t[38]=P),D=(0,$.jsx)(`span`,{className:P,children:f.status[n.status]??n.status}),m=`min-w-0 flex-1`;let F;t[39]===n?F=t[40]:(F=zt(n),t[39]=n,t[40]=F),t[41]===F?S=t[42]:(S=(0,$.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:F}),t[41]=F,t[42]=S);let I;t[43]===n?I=t[44]:(I=Bt(n),t[43]=n,t[44]=I);let L;t[45]===I?L=t[46]:(L=(0,$.jsx)(`span`,{className:`truncate font-medium`,children:I}),t[45]=I,t[46]=L);let R;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,$.jsx)(`span`,{"aria-hidden":!0,children:`·`}),t[47]=R):R=t[47];let z;t[48]!==i||t[49]!==a||t[50]!==l?(z=qt(l,a,i),t[48]=i,t[49]=a,t[50]=l,t[51]=z):z=t[51];let B;t[52]===z?B=t[53]:(B=(0,$.jsx)(`span`,{children:z}),t[52]=z,t[53]=B);let V=y===`—`?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,$.jsx)(`span`,{children:J(f.taskElapsed,{duration:y})})]});t[54]!==L||t[55]!==B||t[56]!==V?(C=(0,$.jsxs)(`span`,{className:`mt-1 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-fg-muted`,children:[L,R,B,V]}),t[54]=L,t[55]=B,t[56]=V,t[57]=C):C=t[57],w=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:J(f.agentProgress,{done:n.metrics.doneAgentCount,total:n.metrics.agentCount})}),(0,$.jsxs)(`span`,{className:`tabular-nums`,children:[j,`%`]})]}),(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:`${j}%`}})})]}):null,T=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)(Ce,{className:`size-3 shrink-0`,"aria-hidden":!0}),J(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]=b,t[14]=S,t[15]=C,t[16]=w,t[17]=T,t[18]=E,t[19]=D,t[20]=O,t[21]=k}else u=t[5],d=t[6],f=t[7],p=t[8],m=t[9],h=t[10],g=t[11],_=t[12],b=t[13],S=t[14],C=t[15],w=t[16],T=t[17],E=t[18],D=t[19],O=t[20],k=t[21];let A;t[58]!==m||t[59]!==S||t[60]!==C||t[61]!==w||t[62]!==T?(A=(0,$.jsxs)(`span`,{className:m,children:[S,C,w,T]}),t[58]=m,t[59]=S,t[60]=C,t[61]=w,t[62]=T,t[63]=A):A=t[63];let j;t[64]!==A||t[65]!==E||t[66]!==D?(j=(0,$.jsxs)(`div`,{className:E,children:[D,A]}),t[64]=A,t[65]=E,t[66]=D,t[67]=j):j=t[67];let M;t[68]!==h||t[69]!==g||t[70]!==j||t[71]!==O||t[72]!==k?(M=(0,$.jsx)(`button`,{type:O,onClick:k,className:h,"aria-label":g,children:j}),t[68]=h,t[69]=g,t[70]=j,t[71]=O,t[72]=k,t[73]=M):M=t[73];let N;t[74]!==f.rerun||t[75]!==l||t[76]!==p||t[77]!==n.id?(N=p?(0,$.jsx)(y,{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]=N):N=t[78];let P;t[79]!==d||t[80]!==f.continueInChat||t[81]!==s||t[82]!==n?(P=n.status===`succeeded`&&d?(0,$.jsx)(y,{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]=P):P=t[83];let F;t[84]!==u||t[85]!==f.cancel||t[86]!==c||t[87]!==n.id?(F=u?(0,$.jsx)(y,{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]=F):F=t[88];let I;t[89]!==o||t[90]!==n?(I=()=>o(n),t[89]=o,t[90]=n,t[91]=I):I=t[91];let L;t[92]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,$.jsx)(ae,{className:`size-4`,"aria-hidden":!0}),t[92]=L):L=t[92];let R;t[93]!==f.taskOpenDetails||t[94]!==I?(R=(0,$.jsx)(y,{type:`button`,variant:`ghost`,className:`size-8 p-0`,"aria-label":f.taskOpenDetails,onClick:I,children:L}),t[93]=f.taskOpenDetails,t[94]=I,t[95]=R):R=t[95];let z;t[96]!==N||t[97]!==P||t[98]!==F||t[99]!==R?(z=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end gap-1.5 pl-7 lg:pl-0`,children:[N,P,F,R]}),t[96]=N,t[97]=P,t[98]=F,t[99]=R,t[100]=z):z=t[100];let B;t[101]!==_||t[102]!==M||t[103]!==z?(B=(0,$.jsxs)(`div`,{className:_,children:[M,z]}),t[101]=_,t[102]=M,t[103]=z,t[104]=B):B=t[104];let V;return t[105]!==b||t[106]!==B?(V=(0,$.jsx)(`article`,{className:b,children:B}),t[105]=b,t[106]=B,t[107]=V):V=t[107],V});function hn(e){let t=(0,Q.c)(17),{vm:n}=e,{labels:r,language:i,loading:a,ownerAgentId:o,agentOptions:c,setOwnerAgentId:d,refreshAll:f}=n,p;t[0]!==c||t[1]!==r.agentFilterAria||t[2]!==i||t[3]!==o||t[4]!==d?(p=c.length>1?(0,$.jsx)(l,{value:o??``,"aria-label":r.agentFilterAria,onChange:e=>d(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)(u,{value:e.id,children:Ie(e,x(i).agentsSettings)},e.id))}):null,t[0]=c,t[1]=r.agentFilterAria,t[2]=i,t[3]=o,t[4]=d,t[5]=p):p=t[5];let m;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(g,{className:`size-4`,"aria-hidden":!0}),t[6]=m):m=t[6];let h;t[7]===r.addWorkflow?h=t[8]:(h=(0,$.jsx)(y,{asChild:!0,variant:`primary`,className:`h-9 rounded-lg`,children:(0,$.jsxs)(s,{to:`/workflows/new`,children:[m,r.addWorkflow]})}),t[7]=r.addWorkflow,t[8]=h);let _;t[9]!==r.refresh||t[10]!==a||t[11]!==f?(_=(0,$.jsx)(Ae,{className:`size-9 shrink-0 p-0`,loading:a,label:r.refresh,onClick:f}),t[9]=r.refresh,t[10]=a,t[11]=f,t[12]=_):_=t[12];let v;return t[13]!==p||t[14]!==h||t[15]!==_?(v=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[p,h,_]}),t[13]=p,t[14]=h,t[15]=_,t[16]=v):v=t[16],v}var gn=new Set([`failed`,`timeout`,`cancelled`]),_n=[{id:`runs`,icon:q},{id:`library`,icon:Ge}],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)(Y,{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)(Y,{className:`h-4 w-52 max-w-full`}),(0,$.jsx)(Y,{className:`mt-2 h-3 w-36 max-w-full`})]}),(0,$.jsx)(Y,{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:d,searchQuery:f,setSearchQuery:p,workflowFilterId:m,setWorkflowFilterId:h,triggerFilter:g,setTriggerFilter:b,statusFilter:x,setStatusFilter:S,clearRunFilters:C,pageTab:w,setPageTab:T,runLayout:E,setRunLayout:D,openRunDetails:O,openRunInChat:k,openDefinitionDetails:A,openWorkflowEditor:j,startWorkflow:M,actionError:N,loading:P,error:F,cancelRun:I,retryRun:L}=n,R=nt(On),z=nt(Dn),B=Date.now(),V=xn(d.filter(yn)),H;t[0]===x?H=t[1]:(H=e=>bn(e,x),t[0]=x,t[1]=H);let U=xn(Ht(d,{searchQuery:f,workflowFilterId:m,triggerFilter:g}).filter(H)),W=!!(f||m||g!==`all`||x!==`all`),G,ee;if(t[2]!==z||t[3]!==o||t[4]!==a.librarySubtitle||t[5]!==a.runsSubtitle||t[6]!==a.title||t[7]!==w||t[8]!==R||t[9]!==n?(G=()=>{if(!o){z();return}return R({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:w===`runs`?a.runsSubtitle:a.librarySubtitle})]}),end:(0,$.jsx)(hn,{vm:n})}),()=>z()},ee=[z,o,a.librarySubtitle,a.runsSubtitle,a.title,w,R,n],t[2]=z,t[3]=o,t[4]=a.librarySubtitle,t[5]=a.runsSubtitle,t[6]=a.title,t[7]=w,t[8]=R,t[9]=n,t[10]=G,t[11]=ee):(G=t[10],ee=t[11]),(0,Z.useLayoutEffect)(G,ee),!o){let e;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(ve,{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 te=a.pageTabsAria,ne=_n.map(e=>{let{id:t,icon:n}=e;return(0,$.jsxs)(`button`,{id:`workflow-tab-${t}`,type:`button`,role:`tab`,"aria-selected":w===t,"aria-controls":`workflow-panel-${t}`,tabIndex:w===t?0:-1,draggable:!1,className:v(`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`,w===t?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),onClick:()=>T(t),onKeyDown:e=>{let n=Sn(e.key,t);n&&(e.preventDefault(),T(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`&&V.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:V.length}):null]},t)}),ie;t[20]!==a.pageTabsAria||t[21]!==ne?(ie=(0,$.jsx)(`nav`,{className:`-mx-1 flex gap-1 overflow-x-auto px-1 pb-1`,"aria-label":te,role:`tablist`,children:ne}),t[20]=a.pageTabsAria,t[21]=ne,t[22]=ie):ie=t[22];let K;t[23]!==N||t[24]!==F?(K=N??F?(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??F}):null,t[23]=N,t[24]=F,t[25]=K):K=t[25];let q=w===`runs`?(0,$.jsxs)(`div`,{id:`workflow-panel-runs`,role:`tabpanel`,"aria-labelledby":`workflow-tab-runs`,className:`flex flex-col gap-4 py-4`,children:[V.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)(Ce,{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:V.length})]}),(0,$.jsxs)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:[zt(V[0]),` · `,qt(V[0].completedAtMs??V[0].createdAtMs,B,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)(y,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg text-xs`,onClick:()=>O(V[0]),children:a.attentionView}),(0,$.jsx)(y,{type:`button`,variant:`primary`,className:`h-8 rounded-lg text-xs`,onClick:()=>void L(V[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)(pe,{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:f,onChange:e=>p(e.target.value),placeholder:a.runsSearchPlaceholder,className:v(`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`,ge.focusRingPanel)})]}),(0,$.jsx)(l,{value:x,"aria-label":a.statusFilterAria,onChange:e=>S(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)(u,{value:e,children:a.runStatuses[e]},e))}),(0,$.jsxs)(l,{value:g,"aria-label":a.boardTriggerFilterAria,onChange:e=>b(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)(u,{value:`all`,children:a.boardTriggerFilterAll}),(0,$.jsx)(u,{value:`automation`,children:a.boardTriggerFilterAutomation}),(0,$.jsx)(u,{value:`webui`,children:a.boardTriggerFilterWebui}),(0,$.jsx)(u,{value:`chat`,children:a.boardTriggerFilterChat}),(0,$.jsx)(u,{value:`api`,children:a.boardTriggerFilterApi})]}),(0,$.jsxs)(l,{value:m,"aria-label":a.boardWorkflowFilterAria,onChange:e=>h(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)(u,{value:``,children:a.boardWorkflowFilterAll}),s.map(En)]}),W?(0,$.jsxs)(y,{type:`button`,variant:`ghost`,className:`h-9 rounded-lg text-xs`,onClick:C,children:[(0,$.jsx)(_,{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:v(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium transition-colors`,E===`list`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`,ge.focusRingPanel),"aria-pressed":E===`list`,onClick:()=>D(`list`),children:[(0,$.jsx)(se,{className:`size-3.5`,"aria-hidden":!0}),a.runLayouts.list]}),(0,$.jsxs)(`button`,{type:`button`,className:v(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium transition-colors`,E===`board`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`,ge.focusRingPanel),"aria-pressed":E===`board`,onClick:()=>D(`board`),children:[(0,$.jsx)(re,{className:`size-3.5`,"aria-hidden":!0}),a.runLayouts.board]})]})]})}),E===`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:U.length})]}),P&&U.length===0?Array.from({length:4}).map(Tn):U.length>0?U.map(e=>(0,$.jsx)(mn,{run:e,language:r,localeTag:i,nowMs:B,onOpen:O,onOpenChat:k,onCancel:e=>void I(e),onRetry:e=>void L(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)(ve,{className:`size-8 text-fg-subtle`,"aria-hidden":!0}),(0,$.jsx)(`h3`,{className:`mt-3 text-sm font-semibold text-fg`,children:W?a.noRunResultsTitle:a.noRunsTitle}),(0,$.jsx)(`p`,{className:`mt-1 max-w-md text-xs leading-5 text-fg-muted`,children:W?a.noRunResultsHint:a.noRunsStartHint}),(0,$.jsx)(y,{type:`button`,variant:W?`secondary`:`primary`,className:`mt-4 h-9 rounded-lg text-xs`,onClick:W?C:()=>T(`library`),children:W?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:U,language:r,localeTag:i,labels:{boardEmptyTitle:a.boardEmptyTitle,boardEmptyHint:a.boardEmptyHint,boardStart:a.chooseWorkflow,loading:a.loading},searchQuery:``,workflowFilterId:``,triggerFilter:`all`,selectedRunId:null,loading:P,onOpenRun:O,onOpenRunChat:k,onCancelRun:e=>void I(e),onRetryRun:e=>void L(e),onStart:()=>T(`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:d,language:r,projectPresetDefinitionIds:c,onPick:M,onDetail:A,onEdit:j})}),ae;return t[26]!==K||t[27]!==q||t[28]!==ie?(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:[ie,K,q]})}),t[26]=K,t[27]=q,t[28]=ie,t[29]=ae):ae=t[29],ae}function Tn(e,t){return(0,$.jsx)(Cn,{},t)}function En(e){return(0,$.jsx)(u,{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=C(Fn),n;e[0]===t?n=e[1]:(n=x(t),e[0]=t,e[1]=n);let r=n.workflows,i=t===`zh`?`zh-CN`:`en-US`,s=S(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,w,T;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=qe.has(n)?n:`runs`,w=Ne.has(r)?r:`list`,T=Ye.has(t)?t:`all`,e[8]=u,e[9]=v,e[10]=y,e[11]=b,e[12]=w,e[13]=T}else v=e[9],y=e[10],b=e[11],w=e[12],T=e[13];let E=T,[D,O]=(0,Z.useState)(null),k;e[14]!==c||e[15]!==s?(k=c?[`workflow-agents`,s]:null,e[14]=c,e[15]=s,e[16]=k):k=e[16];let A;e[17]===Symbol.for(`react.memo_cache_sentinel`)?(A={revalidateOnFocus:!1},e[17]=A):A=e[17];let j=M(k,rt,A),N;bb0:{let e=j.data?.agents??[];if(v&&(e.length===0||e.some(e=>e.id===v))){N=v;break bb0}N=j.data?.defaultId}let P=N,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=M(F,mt,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=()=>lt(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=M(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=()=>pt(100,{ownerAgentId:P,projectId:b}),e[34]=P,e[35]=b,e[36]=U):U=e[36];let W;e[37]===Symbol.for(`react.memo_cache_sentinel`)?(W={revalidateOnFocus:!1,refreshInterval:Mn},e[37]=W):W=e[37];let G=M(H,U,W),ee;e[38]===L.data?ee=e[39]:(ee=L.data??[],e[38]=L.data,e[39]=ee);let te=ee,ne;e[40]===G.data?ne=e[41]:(ne=G.data??[],e[40]=G.data,e[41]=ne);let re=ne,ie;e[42]===d?ie=e[43]:(ie=e=>{d(t=>{let n=new URLSearchParams(t);return e(n),n},{replace:!0})},e[42]=d,e[43]=ie);let K=ie,q;e[44]===K?q=e[45]:(q=e=>K(t=>{let n=e.trim();n?t.set(`q`,n):t.delete(`q`)}),e[44]=K,e[45]=q);let ae=q,J;e[46]===K?J=e[47]:(J=e=>K(t=>{let n=e.trim();n?t.set(Ze,n):t.delete(Ze)}),e[46]=K,e[47]=J);let oe=J,se;e[48]===K?se=e[49]:(se=e=>K(t=>{let n=e.trim();n?t.set(`wf`,n):t.delete(`wf`)}),e[48]=K,e[49]=se);let ce=se,ue;e[50]===K?ue=e[51]:(ue=e=>K(t=>{e&&e!==`all`?t.set(He,e):t.delete(He)}),e[50]=K,e[51]=ue);let Y=ue,de;e[52]===K?de=e[53]:(de=e=>K(t=>{e===`runs`?t.delete(`tab`):t.set(`tab`,e)}),e[52]=K,e[53]=de);let fe=de,pe;e[54]===K?pe=e[55]:(pe=e=>K(t=>{e===`list`?t.delete(ot):t.set(ot,e)}),e[54]=K,e[55]=pe);let me=pe,he;e[56]===K?he=e[57]:(he=e=>K(t=>{e===`all`?t.delete(et):t.set(et,e)}),e[56]=K,e[57]=he);let ge=he,_e;e[58]===K?_e=e[59]:(_e=()=>K(jn),e[58]=K,e[59]=_e);let ve=_e,X;if(e[60]!==P||e[61]!==b){let t=new URLSearchParams;P&&t.set(`agentId`,P),b&&t.set(`projectId`,b),X=t.size?`?${t.toString()}`:``,e[60]=P,e[61]=b,e[62]=X}else X=e[62];let ye=X,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,Ce;e[66]!==l||e[67]!==ye?(Ce=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]=Ce):Ce=e[68];let we=Ce,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(tt(t))},e[72]=l,e[73]=De);let Oe=De,ke;e[74]!==r.cancelFailed||e[75]!==P||e[76]!==G?(ke=async e=>{try{await Re(e,{ownerAgentId:P}),await G.mutate()}catch(e){let t=e;O(t instanceof Error?t.message:r.cancelFailed)}},e[74]=r.cancelFailed,e[75]=P,e[76]=G,e[77]=ke):ke=e[77];let Ae=ke,je;e[78]!==r.retryFailed||e[79]!==l||e[80]!==P||e[81]!==ye?(je=async e=>{try{l(`/workflows/runs/${(await le(e,{ownerAgentId:P})).runId}${ye}`)}catch(e){let t=e;O(t instanceof Error?t.message:r.retryFailed)}},e[78]=r.retryFailed,e[79]=l,e[80]=P,e[81]=ye,e[82]=je):je=e[82];let Me=je,Pe,Fe;e[83]===G?(Pe=e[84],Fe=e[85]):(Pe=()=>{let e=()=>void G.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)}},Fe=[G],e[83]=G,e[84]=Pe,e[85]=Fe),(0,Z.useEffect)(Pe,Fe);let Ie;e[86]!==j||e[87]!==L||e[88]!==V||e[89]!==G?(Ie=()=>{Promise.all([j.mutate(),L.mutate(),V.mutate(),G.mutate()])},e[86]=j,e[87]=L,e[88]=V,e[89]=G,e[90]=Ie):Ie=e[90];let Le=Ie,ze=j.isLoading||L.isLoading||G.isLoading||V.isLoading,Be=j.error?.message??L.error?.message??G.error?.message??V.error?.message??null,Ve;e[91]===j.data?.agents?Ve=e[92]:(Ve=j.data?.agents??[],e[91]=j.data?.agents,e[92]=Ve);let Ue;e[93]===V.data?Ue=e[94]:(Ue=new Set((V.data??[]).map(An)),e[93]=V.data,e[94]=Ue);let We;return e[95]!==D||e[96]!==Ae||e[97]!==ve||e[98]!==te||e[99]!==Be||e[100]!==c||e[101]!==r||e[102]!==t||e[103]!==ze||e[104]!==i||e[105]!==xe||e[106]!==Ee||e[107]!==Oe||e[108]!==we||e[109]!==P||e[110]!==y||e[111]!==b||e[112]!==Le||e[113]!==Me||e[114]!==w||e[115]!==re||e[116]!==p||e[117]!==oe||e[118]!==fe||e[119]!==me||e[120]!==ae||e[121]!==ge||e[122]!==Y||e[123]!==ce||e[124]!==Se||e[125]!==E||e[126]!==Ve||e[127]!==Ue||e[128]!==_||e[129]!==h?(We={language:t,localeTag:i,labels:r,hasToken:c,searchQuery:p,setSearchQuery:ae,ownerAgentId:P,projectId:b,agentOptions:Ve,setOwnerAgentId:oe,workflowFilterId:h,setWorkflowFilterId:ce,triggerFilter:_,setTriggerFilter:Y,statusFilter:E,setStatusFilter:ge,clearRunFilters:ve,pageTab:y,setPageTab:fe,runLayout:w,setRunLayout:me,definitions:te,projectPresetDefinitionIds:Ue,runs:re,openDefinitionDetails:xe,startWorkflow:Se,openWorkflowEditor:we,openRunDetails:Ee,openRunInChat:Oe,actionError:D,loading:ze,error:Be,refreshAll:Le,cancelRun:Ae,retryRun:Me},e[95]=D,e[96]=Ae,e[97]=ve,e[98]=te,e[99]=Be,e[100]=c,e[101]=r,e[102]=t,e[103]=ze,e[104]=i,e[105]=xe,e[106]=Ee,e[107]=Oe,e[108]=we,e[109]=P,e[110]=y,e[111]=b,e[112]=Le,e[113]=Me,e[114]=w,e[115]=re,e[116]=p,e[117]=oe,e[118]=fe,e[119]=me,e[120]=ae,e[121]=ge,e[122]=Y,e[123]=ce,e[124]=Se,e[125]=E,e[126]=Ve,e[127]=Ue,e[128]=_,e[129]=h,e[130]=We):We=e[130],We}function An(e){return e.definitionId}function jn(e){e.delete(`q`),e.delete(`wf`),e.delete(He),e.delete(et)}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()),[_,b]=(0,Z.useState)(()=>({title:f.untitled,description:``,tags:[`custom`]})),[x,S]=(0,Z.useState)(`agent-1`),[C,w,T]=jt(h.nodes.map(e=>Zn(e,e.id===`agent-1`))),[E,D]=(0,Z.useState)(``),[O,k]=(0,Z.useState)(``),[A,j]=(0,Z.useState)(!1),[M,N]=(0,Z.useState)(null),[F,I]=(0,Z.useState)(null),[L,z]=(0,Z.useState)(!!r),[B,V]=(0,Z.useState)(null),[U,W]=(0,Z.useState)(`idle`),[G,ee]=(0,Z.useState)(0),[re,ie]=(0,Z.useState)([]),[K,q]=(0,Z.useState)(null),ae=(0,Z.useRef)(``),J=(0,Z.useRef)(``),oe=(0,Z.useRef)(void 0),se=(0,Z.useRef)(void 0),ce=(0,Z.useRef)(!1),le=(0,Z.useRef)(null),[ue,Y]=(0,Z.useState)(0);(0,Z.useEffect)(()=>{let e=`${r?.mode??`new`}:${r?.name??i}:${r?.baseRevision??0}:${r?.repairPrompt??``}`;ae.current!==e&&(ae.current=e,m(r?.name??i),g(structuredClone(r?.graph??$n())),Y(e=>e+1),b(structuredClone(r?.manifest??{title:f.untitled,description:``,tags:[`custom`]})),S(r?.graph.nodes.find(e=>e.kind===`agent`)?.id??`agent-1`),D(r?.repairPrompt??``),N(null),I(null),z(!!r),k(``),V(null),ee(r?.baseRevision??0),ie([]),q(null),oe.current=void 0,se.current=void 0,W(`idle`))},[f.untitled,r,i]),(0,Z.useEffect)(()=>{r?.mode===`edit`&&Oe(r.name).then(ie).catch(()=>ie([]))},[r?.mode,r?.name]),(0,Z.useEffect)(()=>{if(!p.trim())return;let e=window.setTimeout(()=>{P(p,h).then(V).catch(()=>V(null))},350);return()=>window.clearTimeout(e)},[h,p]),(0,Z.useEffect)(()=>{if(!p.trim())return;W(`saving`);let e=window.setTimeout(()=>{R({id:oe.current,workflowName:p,graph:h,manifest:_,baseRevision:G,expectedUpdatedAtMs:se.current}).then(e=>{oe.current=e.id,se.current=e.updatedAtMs,W(`saved`)}).catch(()=>W(`error`))},900);return()=>window.clearTimeout(e)},[G,h,_,p]);let pe=(0,Z.useMemo)(()=>tr(h,M?.graph??null),[h,M?.graph]),me=(0,Z.useMemo)(()=>{if(!M)return h;let e=new Set(M.graph.nodes.map(e=>e.id)),t=h.nodes.filter(t=>!e.has(t.id));return{...M.graph,nodes:[...M.graph.nodes,...t]}},[h,M]);(0,Z.useLayoutEffect)(()=>{w(e=>{let t=new Map(e.map(e=>[e.id,e]));return me.nodes.map(e=>({...t.get(e.id),...Zn(e,e.id===x,pe.nodeStates.get(e.id))}))})},[me.nodes,pe.nodeStates,x,w]),(0,Z.useEffect)(()=>{let e=le.current;if(!e||me.nodes.length===0)return;let t=window.requestAnimationFrame(()=>{e.fitView(Bn)});return()=>window.cancelAnimationFrame(t)},[me.nodes.length,ue]);let _e=(0,Z.useMemo)(()=>me.edges.map(Qn),[me.edges]),X=h.nodes.find(e=>e.id===x)??null,ye=(0,Z.useMemo)(()=>new Set(a),[a]),be=r?.mode!==`edit`&&ye.has(p),xe=be?Rn(p,ye):p,Se=B?.valid===!0&&!be&&!n&&!A,Ce=(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})},[]),we=(0,Z.useCallback)(e=>{let t=e.filter(e=>e.type!==`select`);t.length!==0&&g(e=>({...e,edges:wt(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}))}))},[]),Te=(0,Z.useCallback)(e=>{!e.source||!e.target||g(t=>({...t,edges:Et({...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}))}))},[]),Ee=(0,Z.useCallback)((e,t)=>{g(n=>({...n,nodes:n.nodes.map(n=>n.id===e?t(n):n)}))},[]),De=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===x&&e.kind!==`output`),i=r?[{id:`edge-${crypto.randomUUID()}`,source:r.id,target:t}]:[];return{...e,nodes:[...e.nodes,n],edges:[...e.edges,...i]}}),Y(e=>e+1),S(t)},ke=()=>{!X||X.kind===`input`||X.kind===`output`||(g(e=>({...e,nodes:e.nodes.filter(e=>e.id!==X.id),edges:e.edges.filter(e=>e.source!==X.id&&e.target!==X.id)})),Y(e=>e+1),S(``))},Ae=(0,Z.useCallback)(async()=>{if(E.trim()){j(!0);try{let n=await $e({prompt:E,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,ye);I(i===n.name?null:n.name),N(i===n.name?n:{...n,name:i}),z(!0),Y(e=>e+1),S(n.graph.nodes.find(e=>e.kind===`agent`)?.id??``)}finally{j(!1)}}},[E,ye,h,r,e,t]);(0,Z.useEffect)(()=>{let e=r?.repairPrompt?.trim();!e||E.trim()!==e||A||M||J.current===e||(J.current=e,Ae())},[E,Ae,A,r?.repairPrompt,M]);let je=()=>{N(null),I(null),S(h.nodes.find(e=>e.kind===`agent`)?.id??``),Y(e=>e+1)},Me=async()=>{if(!(!M||n||ce.current)){ce.current=!0;try{let e=await c({name:M.name,graph:M.graph,manifest:M.manifest,expectedRevision:G});if(!e)return;m(e.name),g(structuredClone(e.graph)),b(Ln(e)),V(M.validation),ee(e.revision),N(null),I(null),D(``),S(e.graph.nodes.find(e=>e.kind===`agent`)?.id??``),oe.current&&await Je(oe.current).catch(()=>void 0)}catch{}finally{ce.current=!1}}},Ne=async e=>{if(!Se||ce.current)return;ce.current=!0;let t={name:p,graph:h,manifest:_,expectedRevision:G};try{if(e)await l({...t,goal:O.trim()||_.description||p});else{let e=await c(t);if(!e)return;ee(e.revision)}oe.current&&await Je(oe.current).catch(()=>void 0)}catch{return}finally{ce.current=!1}},Pe=async e=>{if(!(K!==null||r?.mode!==`edit`)){q(e);try{let t=await dt(r.name,e,G);g(t.graph),Y(e=>e+1),b(Ln(t)),ee(t.revision),S(t.graph.nodes.find(e=>e.kind===`agent`)?.id??``),ie(await Oe(r.name))}finally{q(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:v(`inline-flex size-9 shrink-0 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,ge.focusRingPanel),"aria-label":e===`zh`?`返回工作流`:`Back to workflows`,children:(0,$.jsx)(Le,{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:v(`text-xs`,U===`error`?`text-danger`:`text-fg-subtle`),children:U===`saving`?f.savingDraft:U===`saved`?f.savedDraft:U===`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)(y,{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)(y,{variant:`secondary`,className:`h-8`,onClick:d,children:e===`zh`?`加载最新版本`:`Load latest`})]}):null,!o&&be?(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)(y,{variant:`secondary`,className:`h-8`,onClick:()=>m(xe),children:e===`zh`?`使用 ${xe}`:`Use ${xe}`})]}):null,!o&&!be&&F&&M?(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`?`“${F}”已存在,方案将保存为“${M.name}”。`:`“${F}” already exists. This proposal will be saved as “${M.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)(y,{variant:`secondary`,className:`h-8 rounded-lg text-xs`,disabled:!!M,onClick:()=>De(`agent`),children:[(0,$.jsx)(fe,{className:`size-3.5`}),f.addAgent]}),(0,$.jsxs)(y,{variant:`secondary`,className:`h-8 rounded-lg text-xs`,disabled:!!M,onClick:()=>De(`decision`),children:[(0,$.jsx)(ve,{className:`size-3.5`}),f.addDecision]}),(0,$.jsxs)(y,{variant:`secondary`,className:`h-8 rounded-lg text-xs`,disabled:!!M,onClick:()=>De(`merge`),children:[(0,$.jsx)(H,{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)(kt,{"aria-label":f.flowAria,nodes:C,edges:_e,nodeTypes:Jn,onNodesChange:T,onEdgesChange:we,onConnect:Te,nodesDraggable:!M,nodesConnectable:!M,onNodeClick:(e,t)=>S(t.id),onNodeDragStart:(e,t)=>S(t.id),onNodeDragStop:(e,t)=>Ce(t),onInit:e=>{le.current=e,window.requestAnimationFrame(()=>{e.fitView(Bn)})},fitView:!0,fitViewOptions:Bn,minZoom:.25,maxZoom:1.5,deleteKeyCode:null,proOptions:{hideAttribution:!0},children:[(0,$.jsx)(Mt,{color:`var(--color-edge)`,gap:22,size:1}),(0,$.jsx)(Ot,{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:M?(0,$.jsx)(Un,{proposal:M,diff:pe,copy:f,saving:n,onAccept:()=>void Me(),onReject:je}):(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=>b(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=>b(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}),be?(0,$.jsx)(`p`,{className:`mt-1 text-xs text-danger`,children:e===`zh`?`该内部名称已被使用,请换一个名称。`:`This internal name is already in use.`}):null,r?.mode===`edit`&&re.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)(de,{className:`size-3.5`}),f.versions,` · v`,G]}),(0,$.jsx)(`div`,{className:`mt-2 space-y-1`,children:re.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,` · `,ht(t.createdAtMs,e)]}),t.revision===G?(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:f.currentVersion}):(0,$.jsxs)(y,{variant:`ghost`,className:`h-7 shrink-0 px-2 text-xs`,disabled:K!==null,onClick:()=>void Pe(t.revision),children:[(0,$.jsx)(te,{className:`size-3`}),K===t.revision?f.restoring:f.restore]})]},t.revision))})]}):null]})]}),(0,$.jsx)(`div`,{className:`my-4 border-t border-edge`}),X?(0,$.jsx)(Yn,{node:X,copy:f,updateNode:Ee,onDelete:ke}):(0,$.jsx)(`div`,{className:`py-8 text-center text-sm text-fg-muted`,children:f.selectNode}),B&&!B.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:B.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)(ne,{className:`size-4 shrink-0 text-accent-fg`}),(0,$.jsx)(yt,{value:E,onChange:e=>D(e.target.value),suggestion:vt(f.aiPlaceholder),onAcceptSuggestion:D,onKeyDown:e=>{e.key===`Enter`&&Ae()},placeholder:f.aiPlaceholder,className:`${Xn} mt-0 flex-1`}),(0,$.jsx)(y,{variant:`secondary`,className:`h-10 shrink-0`,disabled:!!M||A||!E.trim(),onClick:()=>void Ae(),children:A?f.designing:f.applyWithAi})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`input`,{value:O,onChange:e=>k(e.target.value),placeholder:f.testGoal,className:`${Xn} mt-0 w-52`}),(0,$.jsxs)(y,{variant:`secondary`,disabled:!Se,onClick:()=>void Ne(!1),children:[(0,$.jsx)(he,{className:`size-4`}),f.publish]}),(0,$.jsxs)(y,{variant:`primary`,disabled:!Se,onClick:()=>void Ne(!0),children:[(0,$.jsx)(it,{className:`size-4`}),f.publishAndRun]})]})]})})]}):(0,$.jsx)(Hn,{copy:f,prompt:E,generating:A,onPromptChange:D,onGenerate:()=>void Ae(),onManual:()=>z(!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)(ne,{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=vt(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)(_t,{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)(ne,{className:`size-4`}),t[25]=_):_=t[25];let v=i?n.designing:n.designWorkflow,b;t[26]!==o||t[27]!==v||t[28]!==g?(b=(0,$.jsxs)(y,{variant:`primary`,disabled:g,onClick:o,children:[_,v]}),t[26]=o,t[27]=v,t[28]=g,t[29]=b):b=t[29];let x;t[30]!==n.manualStart||t[31]!==s?(x=(0,$.jsx)(y,{variant:`ghost`,onClick:s,children:n.manualStart}),t[30]=n.manualStart,t[31]=s,t[32]=x):x=t[32];let S;t[33]!==b||t[34]!==x?(S=(0,$.jsxs)(`div`,{className:`mt-6 flex flex-wrap items-center gap-3`,children:[b,x]}),t[33]=b,t[34]=x,t[35]=S):S=t[35];let C;return t[36]!==S||t[37]!==l||t[38]!==u||t[39]!==p||t[40]!==h?(C=(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,S]})}),t[36]=S,t[37]=l,t[38]=u,t[39]=p,t[40]=h,t[41]=C):C=t[41],C}function Un(e){let t=(0,Q.c)(74),{proposal:n,diff:r,copy:i,saving:a,onAccept:o,onReject:s}=e,l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-accent-fg`,children:(0,$.jsx)(ne,{className:`size-4`})}),t[0]=l):l=t[0];let u;t[1]===i.proposalTitle?u=t[2]:(u=(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:i.proposalTitle}),t[1]=i.proposalTitle,t[2]=u);let d;t[3]===i.proposalHint?d=t[4]:(d=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:i.proposalHint}),t[3]=i.proposalHint,t[4]=d);let f;t[5]!==u||t[6]!==d?(f=(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[l,(0,$.jsxs)(`div`,{className:`min-w-0`,children:[u,d]})]}),t[5]=u,t[6]=d,t[7]=f):f=t[7];let p=n.manifest.title||n.name,m;t[8]===p?m=t[9]:(m=(0,$.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:p}),t[8]=p,t[9]=m);let h=n.explanation||n.manifest.description,g;t[10]===h?g=t[11]:(g=(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:h}),t[10]=h,t[11]=g);let v;t[12]===i.added?v=t[13]:(v=(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.added}),t[12]=i.added,t[13]=v);let b;t[14]===r.addedIds.length?b=t[15]:(b=(0,$.jsx)(`dd`,{className:`mt-1 font-semibold text-success`,children:r.addedIds.length}),t[14]=r.addedIds.length,t[15]=b);let x;t[16]!==b||t[17]!==v?(x=(0,$.jsxs)(`div`,{className:`rounded-lg bg-success-soft p-2`,children:[v,b]}),t[16]=b,t[17]=v,t[18]=x):x=t[18];let S;t[19]===i.changed?S=t[20]:(S=(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.changed}),t[19]=i.changed,t[20]=S);let C=r.changedIds.length+r.connectionChanges,w;t[21]===C?w=t[22]:(w=(0,$.jsx)(`dd`,{className:`mt-1 font-semibold text-accent-fg`,children:C}),t[21]=C,t[22]=w);let T;t[23]!==S||t[24]!==w?(T=(0,$.jsxs)(`div`,{className:`rounded-lg bg-accent-soft p-2`,children:[S,w]}),t[23]=S,t[24]=w,t[25]=T):T=t[25];let E;t[26]===i.removed?E=t[27]:(E=(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.removed}),t[26]=i.removed,t[27]=E);let D;t[28]===r.removedIds.length?D=t[29]:(D=(0,$.jsx)(`dd`,{className:`mt-1 font-semibold text-danger`,children:r.removedIds.length}),t[28]=r.removedIds.length,t[29]=D);let O;t[30]!==E||t[31]!==D?(O=(0,$.jsxs)(`div`,{className:`rounded-lg bg-danger/5 p-2`,children:[E,D]}),t[30]=E,t[31]=D,t[32]=O):O=t[32];let k;t[33]!==x||t[34]!==T||t[35]!==O?(k=(0,$.jsxs)(`dl`,{className:`mt-3 grid grid-cols-3 gap-2 text-center text-xs`,children:[x,T,O]}),t[33]=x,t[34]=T,t[35]=O,t[36]=k):k=t[36];let A;t[37]!==k||t[38]!==m||t[39]!==g?(A=(0,$.jsxs)(`div`,{className:`mt-4 rounded-xl border border-edge bg-surface-base/50 p-3`,children:[m,g,k]}),t[37]=k,t[38]=m,t[39]=g,t[40]=A):A=t[40];let j;t[41]!==i.assumptions||t[42]!==n.assumptions?(j=n.assumptions.length?(0,$.jsx)(Gn,{title:i.assumptions,items:n.assumptions}):null,t[41]=i.assumptions,t[42]=n.assumptions,t[43]=j):j=t[43];let M;t[44]!==i.risks||t[45]!==n.risks?(M=n.risks.length?(0,$.jsx)(Gn,{title:i.risks,items:n.risks}):null,t[44]=i.risks,t[45]=n.risks,t[46]=M):M=t[46];let N;t[47]!==i.permissions||t[48]!==n.permissionsSummary?(N=n.permissionsSummary.length?(0,$.jsx)(Gn,{title:i.permissions,items:n.permissionsSummary}):null,t[47]=i.permissions,t[48]=n.permissionsSummary,t[49]=N):N=t[49];let P;t[50]!==n.validation.errors||t[51]!==n.validation.valid?(P=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]=P):P=t[52];let F=a||!n.validation.valid,I;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,$.jsx)(c,{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)(y,{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)(_,{className:`size-4`}),t[58]=z):z=t[58];let B;t[59]!==i.rejectProposal||t[60]!==s||t[61]!==a?(B=(0,$.jsxs)(y,{variant:`ghost`,disabled:a,onClick:s,children:[z,i.rejectProposal]}),t[59]=i.rejectProposal,t[60]=s,t[61]=a,t[62]=B):B=t[62];let V;t[63]!==R||t[64]!==B?(V=(0,$.jsxs)(`div`,{className:`mt-5 grid gap-2`,children:[R,B]}),t[63]=R,t[64]=B,t[65]=V):V=t[65];let H;return t[66]!==A||t[67]!==j||t[68]!==M||t[69]!==N||t[70]!==P||t[71]!==V||t[72]!==f?(H=(0,$.jsxs)(`section`,{children:[f,A,j,M,N,P,V]}),t[66]=A,t[67]=j,t[68]=M,t[69]=N,t[70]=P,t[71]=V,t[72]=f,t[73]=H):H=t[73],H}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)(gt,{}):i.kind===`agent`?(0,$.jsx)(fe,{}):i.kind===`decision`?(0,$.jsx)(ve,{}):i.kind===`merge`?(0,$.jsx)(H,{}):(0,$.jsx)(it,{}),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=v(`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)(At,{type:`target`,position:Dt.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 y;t[18]!==_||t[19]!==h?(y=(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[h,_]}),t[18]=_,t[19]=h,t[20]=y):y=t[20];let b;t[21]===a?b=t[22]:(b=a?(0,$.jsx)(`span`,{className:v(`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]=b);let x;t[23]!==y||t[24]!==b||t[25]!==m?(x=(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[m,y,b]}),t[23]=y,t[24]=b,t[25]=m,t[26]=x):x=t[26];let S;t[27]===i.kind?S=t[28]:(S=i.kind===`decision`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(At,{id:`true`,type:`source`,position:Dt.Right,style:{top:`38%`},className:`!size-2.5 !border-2 !border-surface-panel !bg-success`}),(0,$.jsx)(At,{id:`false`,type:`source`,position:Dt.Right,style:{top:`70%`},className:`!size-2.5 !border-2 !border-surface-panel !bg-danger`})]}):i.kind===`output`?null:(0,$.jsx)(At,{type:`source`,position:Dt.Right,className:`!size-2.5 !border-2 !border-surface-panel !bg-accent`}),t[27]=i.kind,t[28]=S);let C;return t[29]!==x||t[30]!==S||t[31]!==f||t[32]!==p?(C=(0,$.jsxs)(`div`,{className:f,children:[p,x,S]}),t[29]=x,t[30]=S,t[31]=f,t[32]=p,t[33]=C):C=t[33],C}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 f;t[8]!==r.remove||t[9]!==n.kind||t[10]!==a?(f=n.kind!==`input`&&n.kind!==`output`?(0,$.jsxs)(y,{variant:`ghost`,className:`h-8 px-2 text-danger`,onClick:a,children:[(0,$.jsx)(ut,{className:`size-3.5`}),r.remove]}):null,t[8]=r.remove,t[9]=n.kind,t[10]=a,t[11]=f):f=t[11];let p;t[12]!==u||t[13]!==f?(p=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[u,f]}),t[12]=u,t[13]=f,t[14]=p):p=t[14];let m;t[15]===r.stepName?m=t[16]:(m=(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]=m);let h;t[17]===s?h=t[18]:(h=e=>s({title:e.target.value}),t[17]=s,t[18]=h);let g;t[19]!==n.title||t[20]!==h?(g=(0,$.jsx)(`input`,{id:`node-title`,value:n.title,onChange:h,className:Xn}),t[19]=n.title,t[20]=h,t[21]=g):g=t[21];let _;t[22]===r.stepPurpose?_=t[23]:(_=(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]=_);let v=n.description??``,b;t[24]===s?b=t[25]:(b=e=>s({description:e.target.value}),t[24]=s,t[25]=b);let x;t[26]!==v||t[27]!==b?(x=(0,$.jsx)(`textarea`,{id:`node-description`,value:v,onChange:b,className:`${Xn} min-h-16 resize-y`}),t[26]=v,t[27]=b,t[28]=x):x=t[28];let S;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?(S=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]=S):S=t[36];let C;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?(C=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)(d,{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]=C):C=t[47];let w;t[48]!==r.combineAs||t[49]!==r.listResults||t[50]!==r.namedResults||t[51]!==n.config||t[52]!==n.kind||t[53]!==l?(w=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)(d,{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]=w):w=t[54];let T;t[55]!==r.autoSummary||t[56]!==r.summaryTemplate||t[57]!==n.config||t[58]!==n.kind||t[59]!==l?(T=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]=T):T=t[60];let E;return t[61]!==x||t[62]!==S||t[63]!==C||t[64]!==w||t[65]!==T||t[66]!==p||t[67]!==m||t[68]!==g||t[69]!==_?(E=(0,$.jsxs)(`section`,{children:[p,m,g,_,x,S,C,w,T]}),t[61]=x,t[62]=S,t[63]=C,t[64]=w,t[65]=T,t[66]=p,t[67]=m,t[68]=g,t[69]=_,t[70]=E):E=t[70],E}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:Tt.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=x(r).workflows,s=x(r).projectDetailPage.board.operationalStates,c;t[0]===n?c=t[1]:(c=n?[`workflow-context-project`,n]:null,t[0]=n,t[1]=c);let l;t[2]===n?l=t[3]:(l=()=>K(n),t[2]=n,t[3]=l);let u;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(u={revalidateOnFocus:!1},t[4]=u):u=t[4];let d=M(c,l,u),f;t[5]===n?f=t[6]:(f=n?[`workflow-context-notes`,n]:null,t[5]=n,t[6]=f);let p;t[7]===n?p=t[8]:(p=()=>h({projectId:n,limit:100,sortBy:`updatedAt`,sortOrder:`desc`}),t[7]=n,t[8]=p);let m;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(m={revalidateOnFocus:!1},t[9]=m):m=t[9];let v=M(f,p,m),b;t[10]!==a||t[11]!==i?(b=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]=b):b=t[12];let S=b,C;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,$.jsx)(g,{className:`size-3.5`,"aria-hidden":!0}),t[13]=C):C=t[13];let N;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,$.jsx)(w,{className:`fixed inset-0 z-50 bg-black/35`}),t[14]=N):N=t[14];let P;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,$.jsx)(_,{className:`size-4`}),t[15]=P):P=t[15];let F=d.isLoading||v.isLoading?(0,$.jsx)(`div`,{className:`grid gap-3`,children:Array.from({length:6},cr)}):d.error||v.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:q,empty:o.contextTasksEmpty,items:(d.data?.tasks??[]).map(e=>({id:e.id,title:e.title,subtitle:s[e.operationalState]})),selected:i,kind:`task`,onToggle:S}),(0,$.jsx)(lr,{title:o.contextNotes,icon:De,empty:o.contextNotesEmpty,items:(v.data?.items??[]).map(e=>({id:e.id,title:e.title||o.contextUntitled,subtitle:e.snippet})),selected:i,kind:`note`,onToggle:S})]}),I;t[16]===F?I=t[17]:(I=(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:F}),t[16]=F,t[17]=I);let L=o.contextPickerCount.replace(`{{count}}`,String(i.length)),R;t[18]===L?R=t[19]:(R=(0,$.jsx)(`span`,{className:`text-xs text-fg-muted`,children:L}),t[18]=L,t[19]=R);let z;t[20]===o.contextPickerDone?z=t[21]:(z=(0,$.jsx)(D,{asChild:!0,children:(0,$.jsx)(y,{type:`button`,variant:`primary`,className:`h-9`,children:o.contextPickerDone})}),t[20]=o.contextPickerDone,t[21]=z);let B;return t[22]!==R||t[23]!==z?(B=(0,$.jsxs)(`footer`,{className:`flex shrink-0 items-center justify-between border-t border-edge px-5 py-3`,children:[R,z]}),t[22]=R,t[23]=z,t[24]=B):B=t[24],(0,$.jsxs)(j,{children:[(0,$.jsx)(T,{asChild:!0,children:(0,$.jsxs)(y,{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,C]})]})}),(0,$.jsxs)(O,{children:[N,(0,$.jsxs)(k,{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)(A,{className:`text-base font-semibold text-fg`,children:o.contextPickerTitle}),(0,$.jsx)(E,{className:`mt-1 text-xs text-fg-muted`,children:o.contextPickerDescription})]}),(0,$.jsx)(D,{asChild:!0,children:(0,$.jsx)(y,{type:`button`,variant:`ghost`,className:`size-8 p-0`,"aria-label":o.pickStartClose,children:P})})]}),I,B]})]})]})}function cr(e,t){return(0,$.jsx)(Y,{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:l}=e,u;t[0]===r?u=t[1]:(u=(0,$.jsx)(r,{className:`size-4 text-fg-subtle`,"aria-hidden":!0}),t[0]=r,t[1]=u);let d;t[2]!==u||t[3]!==n?(d=(0,$.jsxs)(`h3`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[u,n]}),t[2]=u,t[3]=n,t[4]=d):d=t[4];let f;t[5]!==i||t[6]!==a||t[7]!==s||t[8]!==l||t[9]!==o?(f=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:v(`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:()=>l({kind:s,id:e.id,role:s===`task`?`objective`:`reference`,title:e.title}),children:[(0,$.jsx)(`span`,{className:v(`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)(c,{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]=l,t[9]=o,t[10]=f):f=t[10];let p;return t[11]!==d||t[12]!==f?(p=(0,$.jsxs)(`section`,{children:[d,f]}),t[11]=d,t[12]=f,t[13]=p):p=t[13],p}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:Tt.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,_,y,b;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=v(`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]:(_=v(`overflow-hidden bg-surface-base/45`,i),t[36]=i,t[37]=_),y=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,x,S;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(d={hideAttribution:!0},x=(0,$.jsx)(Mt,{color:`var(--color-edge)`,gap:22,size:1}),S=(0,$.jsx)(Ot,{showInteractive:!1,className:`!border-edge !bg-surface-panel !shadow-surface`}),t[40]=d,t[41]=x,t[42]=S):(d=t[40],x=t[41],S=t[42]),t[43]!==f||t[44]!==u?(b=(0,$.jsx)(`div`,{className:`h-[22rem] min-h-72`,children:(0,$.jsxs)(kt,{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:[x,S]})}),t[43]=f,t[44]=u,t[45]=b):b=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]=y,t[28]=b}else m=t[23],h=t[24],g=t[25],_=t[26],y=t[27],b=t[28];if(m!==Symbol.for(`react.early_return_sentinel`))return m;let x;t[46]!==h||t[47]!==g?(x=(0,$.jsx)(`div`,{className:h,children:g}),t[46]=h,t[47]=g,t[48]=x):x=t[48];let S;return t[49]!==x||t[50]!==_||t[51]!==y||t[52]!==b?(S=(0,$.jsxs)(`section`,{className:_,"aria-label":y,children:[b,x]}),t[49]=x,t[50]=_,t[51]=y,t[52]=b,t[53]=S):S=t[53],S}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=v(`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)(At,{type:`target`,position:Dt.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)(At,{id:`true`,type:`source`,position:Dt.Right,style:{top:`38%`},className:`!invisible`}),(0,$.jsx)(At,{id:`false`,type:`source`,position:Dt.Right,style:{top:`70%`},className:`!invisible`})]}):i.kind===`output`?null:(0,$.jsx)(At,{type:`source`,position:Dt.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)(gt,{className:`size-4`,"aria-hidden":!0}):e===`agent`?(0,$.jsx)(fe,{className:`size-4`,"aria-hidden":!0}):e===`decision`?(0,$.jsx)(ve,{className:`size-4`,"aria-hidden":!0}):e===`merge`?(0,$.jsx)(H,{className:`size-4`,"aria-hidden":!0}):(0,$.jsx)(it,{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)(),l=(0,Z.useRef)(null),u=(0,Z.useRef)(void 0),d;t[0]===i?d=t[1]:(d=Tr(i),t[0]=i,t[1]=d);let f=d,p;t[2]===r.nodes?p=t[3]:(p=new Map(r.nodes.map(xr)),t[2]=r.nodes,t[3]=p);let m=p,h;if(t[4]!==n.nodes||t[5]!==m){let e;t[7]===m?e=t[8]:(e=e=>({id:e.id,type:`runNode`,position:e.position,data:{definitionNode:e,runNode:m.get(e.id)}}),t[7]=m,t[8]=e),h=n.nodes.map(e),t[4]=n.nodes,t[5]=m,t[6]=h}else h=t[6];let g=h,_;if(t[9]!==n.edges||t[10]!==m){let e;t[12]===m?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:Tt.ArrowClosed},animated:m.get(e.source)?.status===`running`,style:{stroke:m.get(e.source)?.status===`done`?`var(--color-success)`:`var(--color-fg-subtle)`,strokeWidth:1.5}}),t[12]=m,t[13]=e),_=n.edges.map(e),t[9]=n.edges,t[10]=m,t[11]=_}else _=t[11];let b=_,x;t[14]!==o||t[15]!==m?(x=o?m.get(o):void 0,t[14]=o,t[15]=m,t[16]=x):x=t[16];let S=x,C;t[17]!==n.nodes||t[18]!==o?(C=o?n.nodes.find(e=>e.id===o):void 0,t[17]=n.nodes,t[18]=o,t[19]=C):C=t[19];let w=C,T;t[20]===r.nodes?T=t[21]:(T=r.nodes.some(br),t[20]=r.nodes,t[21]=T);let E=T,D,O;t[22]===r.nodes?(D=t[23],O=t[24]):(D=()=>{let e=r.nodes.find(yr)??r.nodes.find(vr)??[...r.nodes].reverse().find(_r);if(!e||u.current===e.id)return;u.current=e.id,s(e.id);let t=window.requestAnimationFrame(()=>{l.current?.fitView({nodes:[{id:e.id}],padding:1.4,minZoom:.65,maxZoom:1,duration:300})});return()=>window.cancelAnimationFrame(t)},O=[r.nodes],t[22]=r.nodes,t[23]=D,t[24]=O),(0,Z.useEffect)(D,O);let k;t[25]===f.title?k=t[26]:(k=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:f.title}),t[25]=f.title,t[26]=k);let A;t[27]===f.hint?A=t[28]:(A=(0,$.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:f.hint}),t[27]=f.hint,t[28]=A);let j;t[29]!==k||t[30]!==A?(j=(0,$.jsxs)(`div`,{children:[k,A]}),t[29]=k,t[30]=A,t[31]=j):j=t[31];let M;t[32]!==f.repair||t[33]!==E||t[34]!==a?(M=E&&a?(0,$.jsxs)(y,{variant:`secondary`,className:`h-8 text-xs`,onClick:a,children:[(0,$.jsx)(te,{className:`size-3.5`}),f.repair]}):null,t[32]=f.repair,t[33]=E,t[34]=a,t[35]=M):M=t[35];let N;t[36]!==j||t[37]!==M?(N=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[j,M]}),t[36]=j,t[37]=M,t[38]=N):N=t[38];let P,F;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(P=(e,t)=>s(t.id),F=e=>{l.current=e},t[39]=P,t[40]=F):(P=t[39],F=t[40]);let I,L;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(I={hideAttribution:!0},L=(0,$.jsx)(Mt,{color:`var(--color-edge)`,gap:22,size:1}),t[41]=I,t[42]=L):(I=t[41],L=t[42]);let R;t[43]!==b||t[44]!==g?(R=(0,$.jsx)(`div`,{className:`h-[28rem]`,children:(0,$.jsx)(kt,{nodes:g,edges:b,nodeTypes:wr,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!0,onNodeClick:P,onInit:F,fitView:!0,minZoom:.3,maxZoom:1.25,panOnScroll:!0,zoomOnDoubleClick:!1,proOptions:I,children:L})}),t[43]=b,t[44]=g,t[45]=R):R=t[45];let z;t[46]!==f.status||t[47]!==S||t[48]!==w?(z=S?(0,$.jsxs)(`div`,{className:v(`flex items-start gap-2 border-t border-edge px-4 py-3 text-xs`,S.status===`error`?`text-danger`:`text-fg-muted`),children:[S.status===`error`?(0,$.jsx)(Ce,{className:`mt-0.5 size-3.5 shrink-0`}):S.status===`done`?(0,$.jsx)(c,{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:S.title}),w?.description?(0,$.jsx)(`span`,{className:`block pt-0.5 text-fg-subtle`,children:w.description}):null,(0,$.jsx)(`span`,{className:`block pt-1`,children:S.error||S.resultPreview||f.status[S.status]})]})]}):null,t[46]=f.status,t[47]=S,t[48]=w,t[49]=z):z=t[49];let B;return t[50]!==N||t[51]!==R||t[52]!==z?(B=(0,$.jsxs)(`section`,{className:`mt-5 overflow-hidden rounded-2xl border border-edge bg-surface-base/35`,children:[N,R,z]}),t[50]=N,t[51]=R,t[52]=z,t[53]=B):B=t[53],B}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)(gt,{}):i.kind===`agent`?(0,$.jsx)(fe,{}):i.kind===`decision`?(0,$.jsx)(ve,{}):i.kind===`merge`?(0,$.jsx)(H,{}):(0,$.jsx)(it,{}),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=v(`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)(At,{type:`target`,position:Dt.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 y;t[16]!==g||t[17]!==_||t[18]!==h?(y=(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[h,g,_]}),t[16]=g,t[17]=_,t[18]=h,t[19]=y):y=t[19];let b;t[20]===i.description?b=t[21]:(b=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]=b);let x;t[22]===i.kind?x=t[23]:(x=i.kind===`decision`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(At,{id:`true`,type:`source`,position:Dt.Right,className:`!invisible`}),(0,$.jsx)(At,{id:`false`,type:`source`,position:Dt.Right,className:`!invisible`})]}):i.kind===`output`?null:(0,$.jsx)(At,{type:`source`,position:Dt.Right,className:`!invisible`}),t[22]=i.kind,t[23]=x);let S;return t[24]!==y||t[25]!==b||t[26]!==x||t[27]!==p||t[28]!==m?(S=(0,$.jsxs)(`div`,{className:p,children:[m,y,b,x]}),t[24]=y,t[25]=b,t[26]=x,t[27]=p,t[28]=m,t[29]=S):S=t[29],S}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)(c,{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)(Ce,{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`?J(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:J(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 Pe(e)}function jr({view:e,comparison:t,loading:n,language:r,localeTag:i,activeTab:o,onTabChange:s,onCancel:l,onRetry:u,onReplay:d,onOpenRunId:h,ownerAgentId:g,onRepairWorkflow:_}){let S=x(r).workflows,C=ee(r),w=a(),[T,E]=(0,Z.useState)(!1),[D,O]=(0,Z.useState)(!1),[k,A]=(0,Z.useState)(null),[j,M]=(0,Z.useState)(!1),[P,F]=(0,Z.useState)(null),[I,L]=(0,Z.useState)(null),[,R]=(0,Z.useState)(0),B=e?.run.status,H=B?Ee.has(B):!1;(0,Z.useEffect)(()=>{e?.run.id&&(E(!1),F(null))},[e?.run.id,H,B,e?.run.metrics.errorAgentCount]),(0,Z.useEffect)(()=>{if(!H)return;let e=window.setInterval(()=>R(e=>e+1),1e3);return()=>window.clearInterval(e)},[H]);let U=(0,Z.useMemo)(()=>e?Me(e):null,[e]),W=(0,Z.useMemo)(()=>U?V(U):{phases:[],unphased:null},[U]),ne=(0,Z.useMemo)(()=>k==null||!U?null:U.agents.find(e=>e.id===k)??null,[k,U]);(0,Z.useEffect)(()=>{U?.runId&&A((U.agents.find(e=>e.status===`error`||e.status===`skipped`)??U.agents.find(e=>e.status===`running`)??null)?.id??null)},[U?.runId]);let re=(0,Z.useCallback)(e=>{A(e.id)},[]),ie=(0,Z.useMemo)(()=>e?G(e):[],[e]),K=e?N(e.run.result):void 0,q=K?$r(K):null,ae=K?We(K):``,oe=!!K,se=(0,Z.useCallback)(async()=>{oe&&await b(ae)&&(M(!0),window.setTimeout(()=>M(!1),1500))},[oe,ae]),le=(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]),ue=(0,Z.useCallback)(()=>{if(!e)return;let t=Ar(e);t&&w(tt(t))},[w,e]),de=(0,Z.useCallback)(async t=>{if(e){F(null),L(t.id);try{Zr(await Ve(e.run.id,t.id,{ownerAgentId:g}),t.name||t.id)}catch(e){F(e instanceof Error?e.message:String(e))}finally{L(null)}}},[g,e]),fe=(0,Z.useCallback)(t=>{if(!e||!t.prompt)return;let n=Ar(e);if(!n){b(t.prompt);return}w(tt(n,t.prompt))},[w,e]),pe=(0,Z.useCallback)(e=>{if(e.kind===`copy_result`){se();return}if(e.kind===`open_artifact`){let t=ti(e.payload),n=q?.artifacts.find(e=>e.id===t||e.name===t);n&&de(n);return}let t=ti(e.payload),n=q?.followUps.find(e=>e.id===t);if(n?.prompt){fe(n);return}let r=ni(e.payload);r&&fe({id:e.id,title:e.label,prompt:r})},[se,de,fe,q?.artifacts,q?.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);A(Number.isFinite(i)?i:r+1)},[e]),he=e?Ar(e):null,ge=q?.actions.filter(e=>ri(e,q))??[],ve=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)(Y,{className:`h-8 w-72 max-w-full`}),(0,$.jsx)(Y,{className:`mt-4 h-28 rounded-2xl`}),(0,$.jsx)(Y,{className:`mt-5 h-[28rem] rounded-2xl`})]})});if(!e||!U)return null;let{run:X}=e,be=e.controls.canCancel&&H,Se=H&&X.startedAtMs!=null?_e(Date.now()-X.startedAtMs):_e(X.metrics.durationMs??void 0),Ce=Or(e,S),we=kr(e,S),Te=e.controls.canRetry&&e.agents.some(e=>(e.status===`error`||e.status===`skipped`)&&e.prompt?.trim()),De=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())),Oe=X.goal?.trim()||X.title,ke=e.nodes.find(e=>e.status===`running`)??e.nodes.find(e=>e.status===`error`)??[...e.nodes].reverse().find(e=>e.status===`done`),Ae=ke?.kind===`output`&&!ke.error?K?.summary??ke.resultPreview:null,je=Ae??(ke?ke.error||(r===`zh`?`${ke.status===`running`?`正在执行`:ke.status===`done`?`刚刚完成`:`需要处理`}:${ke.title}`:`${ke.status===`running`?`Working on`:ke.status===`done`?`Just completed`:`Needs attention`}: ${ke.title}`):Ce),Ne=ie.length>0||!!we,Pe=(X.status===`failed`||X.status===`timeout`)&&!!_,Fe=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:Oe}),(0,$.jsx)(`span`,{className:v(`rounded-full px-2 py-0.5 text-xs font-medium`,Xe(X.status)),children:Er(X.status,S)})]}),(0,$.jsxs)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:[X.title,` · `,X.definitionId]}),(0,$.jsx)(`p`,{className:`mt-3 text-sm leading-6 text-fg-muted`,children:Ce}),we?(0,$.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-subtle`,children:we}):null,(0,$.jsxs)(`div`,{className:v(`mt-4 rounded-xl border px-3 py-2.5`,ke?.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`}),Ae?(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)(m,{content:je,compact:!0,className:`workflow-status-markdown`,codeCopy:!1,renderMermaid:!1,openHttpLinksInNewTab:!0})}):(0,$.jsx)(`p`,{className:`mt-1 text-sm font-medium text-fg`,children:je})]})]})}),(0,$.jsxs)(`dl`,{className:`mt-4 grid gap-3 sm:grid-cols-2 lg:grid-cols-4`,children:[(0,$.jsx)(ci,{label:S.metrics.startedAt,value:ye(X.startedAtMs??X.createdAtMs,i)}),(0,$.jsx)(ci,{label:S.metrics.duration,value:Se}),(0,$.jsx)(ci,{label:S.metrics.agents,value:J(S.agentProgress,{done:X.metrics.doneAgentCount,total:X.metrics.agentCount})}),(0,$.jsx)(ci,{label:S.metrics.artifacts,value:String(X.metrics.artifactCount)})]})]}),(0,$.jsx)(Nr,{activeTab:Fe,onChange:s,labels:S,artifactCount:q?.artifacts.length??e.artifacts.length}),Fe===`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:S.resultTitle}),(0,$.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:S.resultReadyHint})]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[he?(0,$.jsxs)(y,{variant:`primary`,className:`h-8 text-xs`,onClick:ue,children:[(0,$.jsx)(xe,{className:`size-3.5`,"aria-hidden":!0}),S.continueInChat]}):null,ge.map(e=>(0,$.jsx)(y,{variant:`secondary`,className:`h-8 text-xs`,onClick:()=>pe(e),children:e.label},e.id)),ve?null:(0,$.jsxs)(y,{variant:`secondary`,className:`h-8 text-xs`,onClick:se,children:[j?(0,$.jsx)(c,{className:`size-3.5`,"aria-hidden":!0}):(0,$.jsx)(f,{className:`size-3.5`,"aria-hidden":!0}),j?S.copied:S.copyResult]}),(0,$.jsxs)(y,{variant:`secondary`,className:`h-8 text-xs`,onClick:le,children:[(0,$.jsx)(p,{className:`size-3.5`,"aria-hidden":!0}),S.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)(ce,{result:K,labels:C.result})})})]}):X.status!==`failed`&&X.status!==`timeout`?(0,$.jsx)(`div`,{className:`rounded-xl border border-dashed border-edge p-4 text-sm text-fg-muted`,children:S.noResult}):null,X.status===`failed`||X.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:S.recoveryActionsTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:we})]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[Pe?(0,$.jsxs)(y,{variant:`primary`,onClick:_,children:[(0,$.jsx)(Qe,{className:`size-4`,"aria-hidden":!0}),r===`zh`?`让 AI 修复`:`Fix with AI`]}):null,Te?(0,$.jsxs)(y,{variant:`secondary`,onClick:()=>d(`failed_agents`),children:[(0,$.jsx)(te,{className:`size-4`,"aria-hidden":!0}),S.replayFailedAgents]}):null,De?(0,$.jsxs)(y,{variant:`secondary`,onClick:()=>d(`failed_phases`),children:[(0,$.jsx)(te,{className:`size-4`,"aria-hidden":!0}),S.replayFailedPhases]}):null,e.controls.canRetry?(0,$.jsxs)(y,{variant:`secondary`,onClick:u,children:[(0,$.jsx)(te,{className:`size-4`,"aria-hidden":!0}),S.rerun]}):null]})]}),(0,$.jsx)(Wr,{view:e,language:r})]}):null,q?(0,$.jsx)(Xr,{task:q,labels:S,downloadingArtifactId:I,downloadError:P,onCopyText:e=>void b(e),onDownloadArtifact:e=>void de(e),onStartFollowUp:fe,compact:!0}):null,be?(0,$.jsx)(`div`,{className:`flex justify-end`,children:(0,$.jsxs)(y,{variant:`secondary`,onClick:l,className:`text-red-600 dark:text-red-300`,children:[(0,$.jsx)(z,{className:`size-4`,"aria-hidden":!0}),S.cancel]})}):null]}):null,Fe===`process`?(0,$.jsxs)($.Fragment,{children:[e.run.metadata?.definition.graph?(0,$.jsx)(gr,{graph:e.run.metadata.definition.graph,view:e,language:r,onRepair:_}):null,Ne?(0,$.jsx)(Mr,{diagnostics:ie,labels:S,hint:we,onOpenAgent:me}):null,(0,$.jsx)(Pr,{snapshot:U,rollup:W,view:e,labels:S,cardLabels:C,isActive:H,processExpanded:T,logsExpanded:D,selectedAgentId:k,selectedAgent:ne,durationText:Se,onToggleProcess:()=>E(e=>!e),onToggleLogs:()=>O(e=>!e),onSelectAgent:re}),(0,$.jsx)(Br,{view:e,comparison:t,labels:S,onOpenRunId:h}),(0,$.jsx)(Vr,{view:e,labels:S})]}):null,Fe===`artifacts`?(0,$.jsx)(Xr,{task:q,labels:S,downloadingArtifactId:I,downloadError:P,onCopyText:e=>void b(e),onDownloadArtifact:e=>void de(e),onStartFollowUp:fe}):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)(Ce,{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)(y,{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)(bt,{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?(_=J(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 y;t[6]!==f||t[7]!==_?(y=(0,$.jsxs)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:[_,` · `,f]}),t[6]=f,t[7]=_,t[8]=y):y=t[8];let b;t[9]!==g||t[10]!==y?(b=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[g,y]}),t[9]=g,t[10]=y,t[11]=b):b=t[11];let x=c?`rotate-180`:null,S;t[12]===x?S=t[13]:(S=v(`size-4 shrink-0 text-fg-subtle transition-transform`,x),t[12]=x,t[13]=S);let C;t[14]===S?C=t[15]:(C=(0,$.jsx)(W,{className:S,"aria-hidden":!0}),t[14]=S,t[15]=C);let w;t[16]!==p||t[17]!==c||t[18]!==b||t[19]!==C?(w=(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:[b,C]}),t[16]=p,t[17]=c,t[18]=b,t[19]=C,t[20]=w):w=t[20];let T;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=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)(ft,{snapshot:n,labels:o,logsExpanded:l,onToggleLogs:m,selectedAgentId:u,onSelectAgent:h}):(0,$.jsx)(L,{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]=T):T=t[33];let E;return t[34]!==w||t[35]!==T?(E=(0,$.jsxs)(`div`,{className:`mt-5 rounded-2xl border border-edge bg-surface-base/35`,children:[w,T]}),t[34]=w,t[35]=T,t[36]=E):E=t[36],E}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=ue(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(` · `),y;t[12]===_?y=t[13]:(y=(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:_}),t[12]=_,t[13]=y);let b;t[14]!==m||t[15]!==y?(b=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[m,y]}),t[14]=m,t[15]=y,t[16]=b):b=t[16];let x;t[17]===n.status?x=t[18]:(x=v(`rounded-full px-2 py-0.5 text-xs font-medium`,si(n.status)),t[17]=n.status,t[18]=x);let S=i.agentStatus[n.status]??n.status,C;t[19]!==x||t[20]!==S?(C=(0,$.jsx)(`span`,{className:x,children:S}),t[19]=x,t[20]=S,t[21]=C):C=t[21];let w;t[22]!==b||t[23]!==C?(w=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[b,C]}),t[22]=b,t[23]=C,t[24]=w):w=t[24];let T;t[25]===i.agentOutputHeading?T=t[26]:(T=(0,$.jsx)(`h4`,{className:`text-xs font-semibold text-fg`,children:i.agentOutputHeading}),t[25]=i.agentOutputHeading,t[26]=T);let E=n.error?`font-mono text-rose-600 dark:text-rose-400`:`text-fg-muted`,D;t[27]===E?D=t[28]:(D=v(`mt-2 max-h-72 overflow-auto whitespace-pre-wrap wrap-break-word text-sm leading-6`,E),t[27]=E,t[28]=D);let O;t[29]!==p||t[30]!==D?(O=(0,$.jsx)(`div`,{className:D,children:p}),t[29]=p,t[30]=D,t[31]=O):O=t[31];let k;t[32]!==T||t[33]!==O?(k=(0,$.jsxs)(`section`,{className:`mt-4 rounded-xl border border-edge-subtle bg-surface-base/60 p-3`,children:[T,O]}),t[32]=T,t[33]=O,t[34]=k):k=t[34];let A;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(A=()=>s(Rr),t[35]=A):A=t[35];let j=i.debugDetailsTitle,M=o&&`rotate-180`,N;t[36]===M?N=t[37]:(N=v(`size-4 shrink-0 text-fg-subtle transition-transform`,M),t[36]=M,t[37]=N);let P;t[38]===N?P=t[39]:(P=(0,$.jsx)(W,{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:A,"aria-expanded":o,children:[j,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]!==w||t[54]!==k||t[55]!==L?(R=(0,$.jsxs)(`aside`,{className:`min-w-0 rounded-2xl border border-edge bg-surface-panel p-4`,children:[w,k,L]}),t[53]=w,t[54]=k,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?J(t.diagnosticsRunErrorWithCode,{code:e.code}):t.diagnosticsRunError:e.kind===`agent_error`?J(t.diagnosticsAgentError,{agent:e.agentLabel??String(e.agentId??`—`)}):e.kind===`step_error`?J(t.diagnosticsStepError,{agent:e.agentLabel??String(e.agentId??`—`),step:e.stepLabel??e.stepId??`—`}):J(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=J(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)(y,{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?`-`:``}${_e(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=v(`grid gap-3 lg:grid-cols-3`,d),t[2]=d,t[3]=f);let m;t[4]!==a||t[5]!==i||t[6]!==r||t[7]!==s||t[8]!==n.artifacts?(m=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)(p,{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]=m):m=t[9];let h;t[10]!==r||t[11]!==o||t[12]!==c||t[13]!==n.followUps?(h=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]=h):h=t[14];let g;return t[15]!==f||t[16]!==m||t[17]!==h?(g=(0,$.jsxs)(`div`,{className:f,children:[m,h]}),t[15]=f,t[16]=m,t[17]=h,t[18]=g):g=t[18],g}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=v(`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=S(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=M(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=S(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=M(r,mt,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=C(e=>e.language),d=x(c).workflows,f=c===`zh`?`zh-CN`:`en-US`,p=nt(e=>e.setPageHeader),m=nt(e=>e.clearPageHeader),{ownerAgentId:h}=ui(),g=t.get(`projectId`)?.trim()||void 0,{definition:_,loading:v,error:b}=fi(e),S=M(`workflow-project-options`,()=>F({limit:100,sortBy:`updatedAt`,sortOrder:`desc`}),{revalidateOnFocus:!1}),w=M(g?[`workflow-project-presets`,g]:null,()=>lt(g),{revalidateOnFocus:!1}),T=M(h?[`workflow-detail-runs`,h,e,g??``]:null,()=>pt(100,{ownerAgentId:h,projectId:g}),{revalidateOnFocus:!1}),[E,D]=(0,Z.useState)(mi),[O,k]=(0,Z.useState)([]),[A,j]=(0,Z.useState)(!1),[N,P]=(0,Z.useState)(!1),[I,L]=(0,Z.useState)(null),R=(0,Z.useRef)(void 0),z=(0,Z.useMemo)(()=>(T.data??[]).filter(e=>e.definitionId===_?.id).slice(0,6),[_?.id,T.data]),V=xt(_,E),H=_?Se(_,c):null,W=w.data?.find(e=>e.definitionId===_?.id),G=!!W&&JSON.stringify(W?.contextRefs)===JSON.stringify(O);(0,Z.useEffect)(()=>{if(!g||!_||!w.data)return;let e=`${g}:${_.id}`;R.current!==e&&(R.current=e,k(W?.contextRefs??[]))},[_,g,W?.contextRefs,w.data]);let ee=(0,Z.useCallback)(e=>{R.current=void 0,k([]),n(t=>{let n=new URLSearchParams(t);return e?n.set(`projectId`,e):n.delete(`projectId`),n},{replace:!0})},[n]),te=(0,Z.useCallback)(async()=>{if(!(!g||!_||N)){P(!0),L(null);try{let e=await B(g,_.id,O);await w.mutate(t=>[e,...(t??[]).filter(t=>t.definitionId!==e.definitionId)],{revalidate:!1})}catch(e){L(e instanceof Error?e.message:d.projectWorkflowSaveFailed)}finally{P(!1)}}},[O,_,d.projectWorkflowSaveFailed,g,w,N]),ne=(0,Z.useCallback)(async()=>{if(!(!g||!_||N)){P(!0),L(null);try{await oe(g,_.id),await w.mutate(e=>(e??[]).filter(e=>e.definitionId!==_.id),{revalidate:!1})}catch(e){L(e instanceof Error?e.message:d.projectWorkflowRemoveFailed)}finally{P(!1)}}},[_,d.projectWorkflowRemoveFailed,g,w,N]),re=new URLSearchParams({tab:`library`});h&&re.set(`agentId`,h),g&&re.set(`projectId`,g);let ie=`/workflows?${re.toString()}`,K=new URLSearchParams;h&&K.set(`agentId`,h),g&&K.set(`projectId`,g);let q=K.size?`?${K.toString()}`:``,ae=null;if(_){let e=new URLSearchParams;h&&e.set(`agentId`,h),g&&e.set(`projectId`,g),_.metadata.source!==`user`&&e.set(`copy`,_.id),ae=`${_.metadata.source===`user`?`/workflows/${_.id}/edit`:`/workflows/new`}${e.size?`?${e.toString()}`:``}`}(0,Z.useLayoutEffect)(()=>(p({startExtra:(0,$.jsx)(s,{to:ie,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)(Le,{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:_?.title??(c===`zh`?`工作流详情`:`Workflow details`)}),_?(0,$.jsxs)(`p`,{className:`truncate text-xs text-fg-muted`,children:[_.metadata.source===`user`?d.badgeUser:d.badgeBuiltin,` · `,c===`zh`?`版本 ${_.revision}`:`Version ${_.revision}`]}):null]}),end:_&&ae?(0,$.jsx)(y,{asChild:!0,variant:`secondary`,className:`h-9 shrink-0`,children:(0,$.jsxs)(s,{to:ae,children:[_.metadata.source===`user`?(0,$.jsx)(Te,{className:`size-4`,"aria-hidden":!0}):(0,$.jsx)(Ue,{className:`size-4`,"aria-hidden":!0}),_.metadata.source===`user`?d.editWorkflow:d.copyAndEditWorkflow]})}):null}),()=>m()),[m,_,ae,d.badgeBuiltin,d.badgeUser,d.copyAndEditWorkflow,d.editWorkflow,c,ie,p]);let J=(0,Z.useCallback)(async()=>{if(!(!_||!V.valid||A)){j(!0),L(null);try{r(`/workflows/runs/${(await Ke({definitionId:_.id,goal:E.goal.trim()||H?.description||_.title,input:St(_,E),agentId:h,projectId:g,contextRefs:O,concurrency:E.concurrency.trim()?Number(E.concurrency):void 0,maxSubagents:E.maxSubagents.trim()?Number(E.maxSubagents):void 0})).runId}${q}`)}catch(e){L(e instanceof Error?e.message:d.startFailed)}finally{j(!1)}}},[O,_,V.valid,d.startFailed,H?.description,r,h,g,q,E,A]);return v?(0,$.jsx)(bi,{}):!_||!H?(0,$.jsx)(xi,{message:b?.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:H.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:_.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:H.whenToUse||H.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)(Fe,{className:`size-3.5 text-fg-subtle`,"aria-hidden":!0}),d.runProject]}),(0,$.jsxs)(l,{value:g??``,"aria-label":d.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)(u,{value:``,children:d.runProjectNone}),(S.data?.items??[]).filter(e=>e.status!==`archived`&&e.status!==`cancelled`).map(e=>(0,$.jsx)(u,{value:e.id,children:e.name},e.id))]})]}),(0,$.jsx)(`div`,{className:`mt-3`,children:(0,$.jsx)(sr,{projectId:g,language:c,value:O,onChange:k})}),g?(0,$.jsxs)(`div`,{className:`mt-2 flex items-center gap-2`,children:[(0,$.jsxs)(y,{type:`button`,variant:`ghost`,className:`h-8 flex-1 justify-start px-2 text-xs`,disabled:N||G,onClick:()=>void te(),children:[(0,$.jsx)(U,{className:`size-3.5`,"aria-hidden":!0}),G?d.projectWorkflowSaved:W?d.updateProjectWorkflow:d.saveProjectWorkflow]}),W?(0,$.jsx)(y,{type:`button`,variant:`ghost`,className:`size-8 p-0 text-fg-muted`,disabled:N,"aria-label":d.removeProjectWorkflow,onClick:()=>void ne(),children:(0,$.jsx)(ut,{className:`size-3.5`,"aria-hidden":!0})}):null]}):null,(0,$.jsx)(`div`,{className:`mt-4`,children:(0,$.jsx)(Ct,{definition:_,language:c,value:E,onChange:D,mode:`manual`,badgeLabel:d.readyToStart,aiAssist:{context:{surface:`workflow-start`,workflowId:_.id,workflowName:_.name,workflowTitle:_.title,workflowDescription:H.description}}})}),I?(0,$.jsx)(`p`,{className:`mt-3 text-sm text-danger`,children:I}):null,(0,$.jsxs)(y,{variant:`primary`,className:`mt-4 w-full`,disabled:!V.valid||A,onClick:()=>void J(),children:[(0,$.jsx)(it,{className:`size-4`,"aria-hidden":!0}),A?d.starting:d.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:d.status[e.status]})]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:ht(e.createdAtMs,f)})]},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=C(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=M(l&&s?[`workflow-repair-run`,l,s]:null,()=>Be(l,{ownerAgentId:s}),{revalidateOnFocus:!1}),[y,b]=(0,Z.useState)(!1),[x,S]=(0,Z.useState)(null),[w,T]=(0,Z.useState)(null),E=(0,Z.useMemo)(()=>m.map(e=>e.name),[m]),D=(0,Z.useMemo)(()=>Rn(`my_workflow`,E),[E]),O=(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]),k=(0,Z.useCallback)(async e=>{b(!0),S(null),T(null);try{let t=await ie(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);T(t),t||S(e instanceof Error?e.message:String(e))}finally{b(!1)}},[f,n,g]),A=(0,Z.useCallback)(async e=>{b(!0),S(null),T(null);try{let t=await ie(e.name,e.graph,e.manifest,e.expectedRevision);await g(t),n(`/workflows/runs/${(await Ke({definitionId:t.id,goal:e.goal,input:{goal:e.goal},agentId:s,projectId:u})).runId}${f}`)}catch(e){let t=zn(e);throw T(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:O,initialName:D,existingNames:E,saveConflict:w,onSave:k,onSaveAndStart:A,onClearSaveConflict:()=>T(null),onReloadLatest:()=>{T(null),S(null),_()}})]})}function _i(){let e=(0,Q.c)(53),{runId:t}=i(),n=a(),r=C(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=()=>be(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=M(p,m,h),_;e[10]===l.view?_=e[11]:(_=l.view?Ee.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,w;e[18]!==S||e[19]!==s||e[20]!==t?(w=async()=>{t&&S((await le(t,{ownerAgentId:s})).runId)},e[18]=S,e[19]=s,e[20]=t,e[21]=w):w=e[21];let T=w,E;e[22]!==S||e[23]!==s||e[24]!==t?(E=async e=>{t&&S((await I(t,e,{ownerAgentId:s})).runId)},e[22]=S,e[23]=s,e[24]=t,e[25]=E):E=e[25];let D=E;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 O;e[28]!==l||e[29]!==s||e[30]!==t?(O=()=>t&&void Re(t,{ownerAgentId:s}).then(()=>l.mutate()),e[28]=l,e[29]=s,e[30]=t,e[31]=O):O=e[31];let k;e[32]===T?k=e[33]:(k=()=>void T(),e[32]=T,e[33]=k);let A;e[34]===D?A=e[35]:(A=e=>void D(e),e[34]=D,e[35]=A);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 N;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]!==O||e[49]!==k||e[50]!==A||e[51]!==j?(N=(0,$.jsx)(jr,{view:l.view,comparison:g.data,loading:l.loading,language:r,localeTag:o,activeTab:u,onTabChange:d,onCancel:O,onRetry:k,onReplay:A,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]=O,e[49]=k,e[50]=A,e[51]=j,e[52]=N):N=e[52],N}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)(Y,{className:`h-5 w-36`}),(0,$.jsx)(Y,{className:`mt-5 h-9 w-80 max-w-full`}),(0,$.jsx)(Y,{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)(y,{asChild:!0,variant:`secondary`,className:`mt-4`,children:(0,$.jsxs)(s,{to:`/workflows`,children:[(0,$.jsx)(Le,{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};