@xopcai/xopc 0.0.434 → 0.0.435

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 (65) 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/{automations-page-CmxICTM4.js → automations-page-BjbM15eY.js} +1 -1
  4. package/dist/gateway/static/root/assets/{automations-workspace-R6YNDdAO.js → automations-workspace-CqurzLYX.js} +2 -2
  5. package/dist/gateway/static/root/assets/{chat-page-BJ8PlDjZ.js → chat-page--wcFhTjW.js} +30 -30
  6. package/dist/gateway/static/root/assets/{index-DWQ4LbBn.js → index-8xLWo0Tt.js} +4 -4
  7. package/dist/gateway/static/root/assets/{personal-page-l9_vYfdJ.js → personal-page-BhuT79Wd.js} +1 -1
  8. package/dist/gateway/static/root/assets/{project-detail-page-BbyV8EiG.js → project-detail-page-CuugOYfe.js} +1 -1
  9. package/dist/gateway/static/root/assets/{route-preload-BWpw9qxc.js → route-preload-BQapekpy.js} +2 -2
  10. package/dist/gateway/static/root/assets/{settings-page-XJXcnE1_.js → settings-page-CedwaHM0.js} +1 -1
  11. package/dist/gateway/static/root/assets/{task-detail-page-DvX9JoEd.js → task-detail-page-_Og3plZL.js} +1 -1
  12. package/dist/gateway/static/root/index.html +3 -3
  13. package/dist/package.js +1 -1
  14. package/dist/src/agent/agent-manager.js +1 -1
  15. package/dist/src/agent/background-review/run-background-review.js +1 -1
  16. package/dist/src/agent/external-tools/cliProvider.js +2 -2
  17. package/dist/src/agent/external-tools/composio-provider.js +2 -2
  18. package/dist/src/agent/external-tools/endpoint-provider.js +2 -2
  19. package/dist/src/agent/service.js +1 -1
  20. package/dist/src/agent/skills/index.js +1 -1
  21. package/dist/src/agent/skills/managed-store.js +1 -1
  22. package/dist/src/agent/skills/skill-manage-ops.js +1 -1
  23. package/dist/src/agent/tools/personal-read-tool.js +1 -1
  24. package/dist/src/agent/tools/xopc-use-tool.js +2 -2
  25. package/dist/src/agent-catalog/capabilities.js +2 -2
  26. package/dist/src/agent-catalog/repository.js +1 -1
  27. package/dist/src/automations/api/routes.js +2 -2
  28. package/dist/src/automations/capabilities/drafts.js +1 -1
  29. package/dist/src/automations/capabilities/write.js +1 -1
  30. package/dist/src/automations/configuration-conversation.js +1 -1
  31. package/dist/src/browser/providers/browser-ext-install.js +1 -1
  32. package/dist/src/capabilities/runtime/dispatcher.js +1 -1
  33. package/dist/src/capabilities/runtime/product.js +1 -1
  34. package/dist/src/cli/commands/agents.js +1 -1
  35. package/dist/src/cli/commands/models.js +1 -1
  36. package/dist/src/cli/commands/onboard/model.js +1 -1
  37. package/dist/src/cli/utils/init-workspace-core.js +1 -1
  38. package/dist/src/computer/broker.d.ts +2 -0
  39. package/dist/src/computer/broker.js +14 -0
  40. package/dist/src/config/agent-profile.js +1 -1
  41. package/dist/src/execution-environments/local-worktree-manager.js +1 -1
  42. package/dist/src/extensions/agent-plugins/skill-catalog.js +1 -1
  43. package/dist/src/extensions/agent-plugins/validation.js +1 -1
  44. package/dist/src/gateway/agents-admin.js +1 -1
  45. package/dist/src/gateway/global-defaults-admin.js +1 -1
  46. package/dist/src/gateway/hono/routes/agents.js +1 -1
  47. package/dist/src/gateway/hono/routes/config-patch/misc.js +1 -1
  48. package/dist/src/gateway/hono/routes/notes.js +2 -2
  49. package/dist/src/gateway/hono/routes/phone-setup.js +1 -1
  50. package/dist/src/gateway/hono/routes/projects.js +2 -2
  51. package/dist/src/gateway/hono/routes/session-input-handler.js +1 -1
  52. package/dist/src/gateway/hono/routes/tasks.js +1 -1
  53. package/dist/src/gateway/image-generation-setup.js +1 -1
  54. package/dist/src/gateway/service.js +4 -4
  55. package/dist/src/gateway/xopc-cloud-capability-setup.js +1 -1
  56. package/dist/src/home-intelligence/host.js +2 -2
  57. package/dist/src/imports/importService.js +1 -1
  58. package/dist/src/local-apps/service.js +1 -1
  59. package/dist/src/personal-agent/service.js +1 -1
  60. package/dist/src/runtime-tools/archive.js +1 -1
  61. package/dist/src/tasks/capabilities/read.js +2 -2
  62. package/dist/src/tasks/capabilities/write.js +1 -1
  63. package/dist/src/tui/backends/embedded-backend.js +1 -1
  64. package/dist/src/voice/realtime/persona-context.js +1 -1
  65. package/package.json +1 -1
@@ -3,7 +3,7 @@
3
3
  "minimum_chrome_version": "120",
4
4
  "default_locale": "en",
5
5
  "name": "__MSG_appName__",
6
- "version": "0.0.434",
6
+ "version": "0.0.435",
7
7
  "description": "__MSG_appDescription__",
8
8
  "key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqnpr4vpLC/nmvy+wiOWk3SWlp2nEZkFijfk8ivGw7StNZgCK90nOMvwhdEtlkk3GOWDvdVnq8HxCsM3UNQ8FnGUyerpH1FJXqXuradxeHf8ZxFjiQU/mIWfnKbUuONWQORon3/pigyoXoK/VUXgg0Wbm/rbVwsS0bv+25R6m+mZgBspOLeKuoH7ivhL+48WV6POtMBsFPZweY26477EM7ukh+56Ff5ENevB8ymxBBn7qK5ZoeZd2a23U8ioX5TsHfe6fnrjitPWjIxD8G0NoKQxcaa/Mo+xs+T6UiLKxP0wjz5bm7jB5H+CXtkRJqzBWUB0h+RSLJckzZfA8BAJrRwIDAQAB",
9
9
  "permissions": [
@@ -2,7 +2,7 @@
2
2
  "id": "telegram",
3
3
  "name": "Telegram Channel",
4
4
  "description": "Bundled Telegram Bot channel (private workspace sources; ships inside @xopcai/xopc dist/)",
5
- "version": "0.0.434",
5
+ "version": "0.0.435",
6
6
  "kind": "channel",
7
7
  "main": "src/index.js",
8
8
  "channels": [
@@ -1 +1 @@
1
- import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./automations-workspace-R6YNDdAO.js";var r=e(),i=t();function a(){let e=(0,r.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,i.jsx)(n,{}),e[0]=t):t=e[0],t}export{a as AutomationsPage};
1
+ import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./automations-workspace-CqurzLYX.js";var r=e(),i=t();function a(){let e=(0,r.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,i.jsx)(n,{}),e[0]=t):t=e[0],t}export{a as AutomationsPage};
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/chat-page-BJ8PlDjZ.js","assets/rolldown-runtime-aKtaBQYM.js","assets/vendor-react-BOUWij0V.js","assets/preload-helper-Czpn1I53.js","assets/chunk-KS7C4IRE-CiwuuyV8.js","assets/locale-store-CAZaC05J.js","assets/messages-C7fckbyG.js","assets/dist-BGTk37IG.js","assets/es2015-DBLcMg5B.js","assets/dist-CxGUk8J-.js","assets/createLucideIcon-DPHK1VkS.js","assets/app-window-DXFNqt_0.js","assets/archive-Dz0hferG.js","assets/arrow-left-D880xG-P.js","assets/arrow-up-D5ZtR1QT.js","assets/product-automation-feedback-DbJvv92z.js","assets/activity-YogQEteU.js","assets/bot-DjLkhyZL.js","assets/circle-check-C23XjkUj.js","assets/circle-pause-CN9jYH2s.js","assets/clock-3-DnrAnuyZ.js","assets/external-link-DjqjBmc3.js","assets/notes-api-zXpV6UXu.js","assets/markdown-view-BatP4qeK.js","assets/download-Dk-ZjtO6.js","assets/file-image-CDUPkZvG.js","assets/plus-Q2yW6OE7.js","assets/x-B_N4OPjy.js","assets/cn-0WouolD0.js","assets/bundle-mjs-rHxsej31.js","assets/app-link-DRy3-k7j.js","assets/product-delivery-DRyD9_Xq.js","assets/schemas-CCWMleym.js","assets/local-apps-Ck6kACsY.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/xml-_d7dTN2Q.js","assets/mermaid-render-oOellPHt.js","assets/markdown-view-C-DHb3Io.css","assets/chat-chart-block-CcVcKsDZ.js","assets/check-DUBLcKHA.js","assets/copy-Dv6d4Dvw.js","assets/skeleton-BI5TyibZ.js","assets/loader-circle-CifKLtgG.js","assets/message-square-fVE7Ghj1.js","assets/pause-DuPxgSxk.js","assets/play-kxZvpBg8.js","assets/rotate-ccw-JM1TBLpp.js","assets/rotate-cw-LIg3Am9S.js","assets/sparkles-DHlfQFAF.js","assets/triangle-alert-2JXFNNKU.js","assets/volume-2-BSJhAY97.js","assets/zap-dximCGjy.js","assets/vendor-swr-CdRzEUwF.js","assets/button-Cc4hUNTt.js","assets/automation-api-4fVKv9PJ.js","assets/book-open-CCGtrT3R.js","assets/chevron-down-ccbiQQz_.js","assets/chevron-right-BweFrslA.js","assets/working-directory-picker-modal-q39BUcJ6.js","assets/file-archive-DanfQJNe.js","assets/interaction-BdhHBbYa.js","assets/form-field-width-DJw_jULe.js","assets/settings-form-draft-Dy10ldo8.js","assets/popover-select-CEMWIrtY.js","assets/dist-GJ8-1PAx.js","assets/dist-BuHnPloF.js","assets/floating-ui.dom-seOukHzT.js","assets/settings-shell-dialog-layer-BU3UuiJr.js","assets/circle-alert-BEjgurr2.js","assets/new-chat-navigation-B6NPQ4h4.js","assets/circle-x-DFsCKeya.js","assets/circle-BoO4YvTx.js","assets/file-tree-utils-DJs1faGv.js","assets/database-CjjeZfRG.js","assets/earth-BMhZtzcj.js","assets/ellipsis-0k4rZLoy.js","assets/file-BqMS_3DT.js","assets/file-text-D12HbeVy.js","assets/folder-kanban-CpLlFI1o.js","assets/folder-open-CyzJ19I9.js","assets/folder-CN-pC3XL.js","assets/use-file-preview-expanded-nd_CuFsd.js","assets/eye-CABVeTq0.js","assets/link-2-D_ZKYUW7.js","assets/message-square-plus-XP0tGdlV.js","assets/minimize-2-DtOGrlpo.js","assets/paperclip-f1HujQY1.js","assets/pencil-DmIY3Oa-.js","assets/refresh-cw-BRlGaq2w.js","assets/save-DRDABU--.js","assets/search-DA7gz22f.js","assets/constants-DBtMsXdW.js","assets/session-api-CHRP5Lwf.js","assets/gateway-startup-retry-PMJi5mX4.js","assets/attachment-utils-core-BIOUBrpT.js","assets/activity-store-Cwn_CNwl.js","assets/app-chrome-BeB4KgOf.js","assets/electron-env-DHOGevH3.js","assets/use-async-resource-BHFGZCY2.js","assets/sliding-tab-list-DuQyViqe.js","assets/sliding-indicator-hwz0sx3h.js","assets/index.module-Cd9ENXfk.js","assets/workspace-api-Di2OmCvz.js","assets/files-BNL4kkSB.js","assets/dist-ZrL34Ps4.js","assets/git-branch-Dh9uxTot.js","assets/globe-DSSGFWFn.js","assets/history-DXH_9jsE.js","assets/key-round-DWbpyU2U.js","assets/laptop-CI3hBVrl.js","assets/list-checks-BbsExAoq.js","assets/list-todo-CTVRto8O.js","assets/messages-square-BckAJrEW.js","assets/mic-CuUb7zc-.js","assets/monitor-Af5eAvF7.js","assets/install-connector-dialog-Bo06Ry3H.js","assets/secret-input-Dryrns2s.js","assets/is-masked-secret-DOkL5b_X.js","assets/connectors-api-NcWECWKg.js","assets/gateway-config-swr-Cq-ByXL4.js","assets/oauth-provider-connect-D4Gfs-Ba.js","assets/cloud-C4-yfnnk.js","assets/models-hub-cache-CzC9y3D0.js","assets/registry-api-fLOqFyrz.js","assets/oauth-api-DmxSaxM1.js","assets/connection-usage-guide-Ddh0bfkj.js","assets/arrow-up-right-T72JbQ1Q.js","assets/connection-usage-Cm_McddI.js","assets/settings-2-D-csvaET.js","assets/settings-uiTATseT.js","assets/shield-check-BU58siTV.js","assets/smartphone-DSSsQFqA.js","assets/square-DMK_fB-3.js","assets/trash-2-DusmjVPV.js","assets/share-link-dialog-CTATUaa4.js","assets/copy-text-row-CpiRzq4G.js","assets/wrench-DFb4r8bH.js","assets/tasks-DRmd6sWt.js","assets/specialists-xbB3xL9e.js","assets/api-B9fZL-V8.js","assets/session-manager-DRRWwKE4.js","assets/local-session-drafts-jgw8UGsO.js","assets/tool-activity-BtJkgjFf.js","assets/personal-proactivity-DaRnbB1f.js","assets/gateway-realtime-DwMd2PCt.js","assets/gateway-realtime-store-CHrf6-nR.js","assets/agents-admin-api-B5lKH_ps.js","assets/new-session-preferences-gb411vZP.js","assets/extension-provider-NKWfjpdP.js","assets/capabilities-C7lnwKKm.js","assets/theme-store-8GFVtotZ.js","assets/middleware-Pd0e8Igk.js","assets/use-composer-attachments-lecOV2q5.js","assets/chevron-left-DqFhpbvK.js","assets/capabilities-DaeQXJT4.js","assets/file-preview-surface-BcLeaSNe.js","assets/phone-workspace-store-Dxp-KhFP.js","assets/shares-api-zegE8pSE.js","assets/skill-wire-pattern-BPpeIcCi.js","assets/chat-agents-api-BUi_7GRo.js","assets/composer-payload-handoff-B5XNxNCb.js","assets/voice-transcribe-api-BJCfiRFU.js","assets/open-capability-settings-Cvb65hQB.js","assets/workspace-editor-agent-store-B2r9wlix.js","assets/voice-input-shortcut-events-_SgYmx7X.js","assets/chunk-D32TOXHM-DQIy-Baq.js","assets/tool-friendly-title-DcCc6g7o.js","assets/voice-call-context-BM2A4bLz.js","assets/page-header-store-D7G5utVi.js","assets/loopi-CNtmi9FU.js","assets/loopi-C09I2mNj.css","assets/agent-avatar-display-ByzM7u9S.js","assets/use-directory-picker-C4p7AgWY.js","assets/confirm-dialog-D7dQJytv.js","assets/command-palette-api-luUjQPsh.js","assets/skill-list-api-Bv0mmHbu.js","assets/skill-api-utils-C7V4JVXM.js","assets/model-selector-raBRBkN_.js","assets/dev-view-store-DQJ61P5L.js","assets/extension-iframe-host-Bds-5kY_.js","assets/automation-task-card-DZWhCWJa.js","assets/calendar-clock-D-quYVPe.js","assets/message-circle-Badhj-4D.js","assets/date-picker-Cfjq1hD_.js","assets/calendar-days-hw_Y-g-s.js","assets/api-Djju8qIR.js","assets/runtime-health-D2TDFLLq.js","assets/terminal-panel-store-Djf9l2qZ.js","assets/agents-app-path-ciChvpCS.js","assets/agent-display-names-Bje7vfSn.js","assets/use-media-query-ady-FgjK.js","assets/oauth-authorization-window-o6URRos4.js","assets/page-context-draft-C4IIZaKd.js","assets/side-chat-shortcut-BIw-1TTD.js","assets/chat-page-zQeUaawJ.css"])))=>i.map(i=>d[i]);
2
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-Czpn1I53.js";import{m as a,t as o,u as s}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{a as c,i as l,l as u,n as d}from"./locale-store-CAZaC05J.js";import{t as f}from"./messages-C7fckbyG.js";import{a as p,n as m,o as h,r as g,s as _,t as v}from"./dist-BGTk37IG.js";import{t as y}from"./activity-YogQEteU.js";import{t as b}from"./arrow-left-D880xG-P.js";import{t as x}from"./calendar-clock-D-quYVPe.js";import{t as S}from"./check-DUBLcKHA.js";import{t as C}from"./chevron-down-ccbiQQz_.js";import{t as w}from"./chevron-right-BweFrslA.js";import{n as T,r as E}from"./popover-select-CEMWIrtY.js";import{t as D}from"./circle-alert-BEjgurr2.js";import{t as ee}from"./circle-check-C23XjkUj.js";import{t as O}from"./copy-Dv6d4Dvw.js";import{t as k}from"./ellipsis-0k4rZLoy.js";import{t as A}from"./eye-CABVeTq0.js";import{t as j}from"./git-branch-Dh9uxTot.js";import{t as M}from"./list-filter-CIPvpfLA.js";import{n as N,r as P,t as F}from"./automation-run-list-CJOdy_R2.js";import{t as te}from"./markdown-view-BatP4qeK.js";import{t as I}from"./message-circle-Badhj-4D.js";import{t as L}from"./pause-DuPxgSxk.js";import{t as ne}from"./pencil-DmIY3Oa-.js";import{t as re}from"./play-kxZvpBg8.js";import{t as ie}from"./plus-Q2yW6OE7.js";import{t as R}from"./refresh-cw-BRlGaq2w.js";import{t as ae}from"./search-DA7gz22f.js";import{t as z}from"./shield-check-BU58siTV.js";import{t as oe}from"./sparkles-DHlfQFAF.js";import{t as se}from"./square-pen-B8FsvqNu.js";import{t as ce}from"./trash-2-DusmjVPV.js";import{t as le}from"./x-B_N4OPjy.js";import{t as B}from"./zap-dximCGjy.js";import{t as ue}from"./cn-0WouolD0.js";import{t as V}from"./skeleton-BI5TyibZ.js";import{d as H}from"./api-B9fZL-V8.js";import{a as de}from"./session-api-CHRP5Lwf.js";import{T as fe}from"./session-manager-DRRWwKE4.js";import{a as U,i as W,o as pe}from"./vendor-swr-CdRzEUwF.js";import{t as me}from"./chat-agents-api-BUi_7GRo.js";import{t as G}from"./button-Cc4hUNTt.js";import{t as he}from"./page-header-store-D7G5utVi.js";import{t as K}from"./automation-api-4fVKv9PJ.js";import{t as q}from"./sliding-tab-list-DuQyViqe.js";import{t as ge}from"./refresh-button-DiWdGAaX.js";import{a as _e,c as ve,d as ye,f as be,i as xe,l as Se,m as Ce,o as we,p as Te,r as J,s as Ee,t as De,u as Y}from"./dist-ZrL34Ps4.js";import{n as Oe}from"./model-selector-raBRBkN_.js";import{C as X,S as ke,T as Z,_ as Ae,a as je,b as Me,c as Ne,d as Pe,f as Fe,g as Ie,h as Le,l as Re,m as ze,n as Be,o as Ve,p as He,r as Ue,s as We,u as Ge,v as Ke,w as qe,x as Je,y as Ye}from"./automation-task-card-DZWhCWJa.js";import{n as Xe}from"./agent-display-names-Bje7vfSn.js";import{i as Ze,n as Qe,r as $e,t as et}from"./automation-result-state-m7PeK2kl.js";import{i as tt,n as nt,r as rt,t as it}from"./browser-automation-inputs-DL4YPCuN.js";var at=n(),Q=e(t(),1),$=r(),ot=(0,Q.lazy)(()=>i(()=>import(`./chat-page-BJ8PlDjZ.js`).then(e=>e.n).then(e=>({default:e.ChatPage})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194])));function st(e){let t=(0,at.c)(110),{runId:n,automationId:r,projectId:i,language:a,onConfigure:o,onDetails:s,onBack:c}=e,l=a===`zh`,[u,d]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(null),_;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(_=e=>g(e),t[0]=_):_=t[0];let v=_,y;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(y=()=>m(!0),t[1]=y):y=t[1];let x=y,{mutate:S}=U(),C=(0,Q.useRef)(!1),w=i??``,T;t[2]!==r||t[3]!==n||t[4]!==w?(T=[`automation-execution`,r,n,w],t[2]=r,t[3]=n,t[4]=w,t[5]=T):T=t[5];let E;t[6]!==r||t[7]!==i||t[8]!==n||t[9]!==l?(E=async()=>{let{run:e}=await K.getRun(n);if(e.automationId!==r)throw Error(l?`执行记录不属于此自动化`:`Execution does not belong to this automation`);let{automation:t}=await K.get(r);if(i&&t.projectId!==i)throw Error(l?`执行记录不属于此项目`:`Execution does not belong to this project`);return{run:e,automation:t}},t[6]=r,t[7]=i,t[8]=n,t[9]=l,t[10]=E):E=t[10];let D;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(D={refreshInterval:ut,shouldRetryOnError:!1},t[11]=D):D=t[11];let{data:ee,error:O,mutate:k}=W(T,E,D),A=ee?.run,j=A?.conversationId,M;t[12]===j?M=t[13]:(M=e=>!!(j&&(e.sessions[j]?.streaming||e.sessions[j]?.sending)),t[12]=j,t[13]=M);let P=fe(M),F;t[14]===j?F=t[15]:(F=j?[`automation-execution-session`,j]:null,t[14]=j,t[15]=F);let I;t[16]===j?I=t[17]:(I=()=>de(j),t[16]=j,t[17]=I);let L;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(L={shouldRetryOnError:!1},t[18]=L):L=t[18];let{data:ne,error:re,mutate:ie}=W(F,I,L),R=A?.conversationShared||ee?.automation.conversationMode===`continuous`||ne?.customData?.latestAutomationRunId!==void 0&&ne.customData.latestAutomationRunId!==n,ae=!!(ne&&(!R||u)),z=!O&&!!(A&&(!j||R&&!u&&ne&&!re&&(A?.summary||A?.error)||ne&&!re&&p)),oe,se;if(t[19]!==z||t[20]!==k||t[21]!==S||t[22]!==A?(oe=()=>{!A||!z||N(A)||A.readAtMs!=null||C.current||(C.current=!0,K.markRunRead(A.id).then(async()=>{await Promise.all([k(),S(lt)])}).catch(ct).finally(()=>{C.current=!1}))},se=[A,z,k,S],t[19]=z,t[20]=k,t[21]=S,t[22]=A,t[23]=oe,t[24]=se):(oe=t[23],se=t[24]),(0,Q.useEffect)(oe,se),O){let e=O instanceof Error?O.message:l?`执行记录加载失败`:`Could not load execution`,n;t[25]===e?n=t[26]:(n=(0,$.jsx)(`p`,{children:e}),t[25]=e,t[26]=n);let r;t[27]===k?r=t[28]:(r=()=>void k(),t[27]=k,t[28]=r);let i=l?`重试`:`Retry`,a;t[29]!==r||t[30]!==i?(a=(0,$.jsx)(G,{onClick:r,children:i}),t[29]=r,t[30]=i,t[31]=a):a=t[31];let o=l?`返回自动化`:`Back to automation`,s;t[32]!==c||t[33]!==o?(s=(0,$.jsx)(G,{onClick:c,children:o}),t[32]=c,t[33]=o,t[34]=s):s=t[34];let u;return t[35]!==n||t[36]!==a||t[37]!==s?(u=(0,$.jsxs)(`section`,{role:`alert`,className:`space-y-3 p-5`,children:[n,a,s]}),t[35]=n,t[36]=a,t[37]=s,t[38]=u):u=t[38],u}if(!A){let e;return t[39]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsxs)(`div`,{className:`space-y-4 p-5`,"aria-busy":`true`,children:[(0,$.jsx)(V,{className:`h-6 w-2/3`}),(0,$.jsx)(V,{className:`h-20`})]}),t[39]=e):e=t[39],e}let ce;t[40]===A?ce=t[41]:(ce=N(A),t[40]=A,t[41]=ce);let le=ce,B=l?`执行会话`:`Execution conversation`,ue=l?`返回自动化`:`Back to automation`,H;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,$.jsx)(b,{className:`size-4`}),t[42]=H):H=t[42];let pe;t[43]!==c||t[44]!==ue?(pe=(0,$.jsx)(G,{variant:`ghost`,className:`shrink-0`,onClick:c,"aria-label":ue,children:H}),t[43]=c,t[44]=ue,t[45]=pe):pe=t[45];let me;t[46]===A.automationName?me=t[47]:(me=(0,$.jsx)(`h2`,{className:`truncate text-sm font-medium text-fg`,children:A.automationName}),t[46]=A.automationName,t[47]=me);let he;t[48]!==pe||t[49]!==me?(he=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[pe,me]}),t[48]=pe,t[49]=me,t[50]=he):he=t[50];let q;t[51]!==A.createdAtMs||t[52]!==l?(q=new Date(A.createdAtMs).toLocaleString(l?`zh-CN`:`en-US`),t[51]=A.createdAtMs,t[52]=l,t[53]=q):q=t[53];let ge;t[54]===a?ge=t[55]:(ge=f(a),t[54]=a,t[55]=ge);let _e=ge.automations.status[A.status],ve;t[56]!==q||t[57]!==_e?(ve=(0,$.jsxs)(`span`,{children:[q,` · `,_e]}),t[56]=q,t[57]=_e,t[58]=ve):ve=t[58];let ye;t[59]!==s||t[60]!==A.id?(ye=()=>s(A.id),t[59]=s,t[60]=A.id,t[61]=ye):ye=t[61];let be=l?`运行详情`:`Run details`,xe;t[62]!==ye||t[63]!==be?(xe=(0,$.jsx)(`button`,{type:`button`,className:`rounded px-2 py-1.5 text-accent-fg hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,onClick:ye,children:be}),t[62]=ye,t[63]=be,t[64]=xe):xe=t[64];let Se;t[65]!==o||t[66]!==A?(Se=()=>o(A),t[65]=o,t[66]=A,t[67]=Se):Se=t[67];let Ce=l?`调整自动化`:`Adjust automation`,we;t[68]!==Se||t[69]!==Ce?(we=(0,$.jsx)(`button`,{type:`button`,className:`rounded px-2 py-1.5 text-accent-fg hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,onClick:Se,children:Ce}),t[68]=Se,t[69]=Ce,t[70]=we):we=t[70];let Te;t[71]!==ve||t[72]!==xe||t[73]!==we?(Te=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 text-xs text-fg-muted`,children:[ve,xe,we]}),t[71]=ve,t[72]=xe,t[73]=we,t[74]=Te):Te=t[74];let J;t[75]!==ee?.automation||t[76]!==R||t[77]!==l?(J=R?(0,$.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[l?`多次执行可能共用此会话;下方摘要对应所选执行。`:`Executions may share this conversation. The summary belongs to the selected execution.`,ee?.automation.conversationMode===`continuous`?l?`追问会进入后续运行上下文。`:` Follow-ups become context for future runs.`:null]}):null,t[75]=ee?.automation,t[76]=R,t[77]=l,t[78]=J):J=t[78];let Ee;t[79]!==h||t[80]!==u||t[81]!==l?(Ee=u?(0,$.jsx)(`p`,{role:`status`,className:`text-xs text-fg-muted`,children:h===!0?l?`已定位到所选执行的会话起点。`:`Located the selected execution in this conversation.`:h===!1?l?`旧记录缺少可用的执行定位信息,当前显示完整会话。`:`No matching turn was found in the available history. Showing the full conversation.`:l?`正在定位所选执行…`:`Locating the selected execution…`}):null,t[79]=h,t[80]=u,t[81]=l,t[82]=Ee):Ee=t[82];let De;t[83]!==le||t[84]!==l?(De=le?(0,$.jsx)(`p`,{role:`status`,className:`text-xs text-fg-muted`,children:l?`执行中,完成后可继续追问。`:`Execution in progress. Follow up after it finishes.`}):null,t[83]=le,t[84]=l,t[85]=De):De=t[85];let Y;t[86]!==he||t[87]!==Te||t[88]!==J||t[89]!==Ee||t[90]!==De?(Y=(0,$.jsxs)(`header`,{className:`shrink-0 space-y-2 border-b border-edge px-4 py-3`,children:[he,Te,J,Ee,De]}),t[86]=he,t[87]=Te,t[88]=J,t[89]=Ee,t[90]=De,t[91]=Y):Y=t[91];let Oe;t[92]!==le||t[93]!==j||t[94]!==P||t[95]!==ne||t[96]!==a||t[97]!==ie||t[98]!==A.error||t[99]!==A.id||t[100]!==A.summary||t[101]!==re||t[102]!==R||t[103]!==ae||t[104]!==l?(Oe=ae?(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(V,{className:`m-5 h-40`}),children:(0,$.jsx)(ot,{embedded:!0,automationExecution:!0,conversationId:j,readOnly:le||P,onHistoryReady:x,initialTurnId:R?A.id:void 0,onInitialTurnLocated:v},j)}):(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-5`,children:[A.summary?(0,$.jsx)(te,{content:A.summary}):null,A.error?(0,$.jsx)(`p`,{className:`whitespace-pre-wrap text-sm text-danger`,children:A.error}):null,j?null:(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:le?l?`等待执行会话,开始后会自动更新。`:`Waiting for the execution conversation. This view updates automatically.`:l?`本次执行没有关联会话,可查看运行结果和详情。`:`No conversation is associated with this execution. Results and diagnostics remain available.`}),j&&!ne&&!re?(0,$.jsx)(V,{className:`h-24`}):null,re?(0,$.jsxs)(`div`,{role:`alert`,className:`space-y-2 text-sm text-fg-muted`,children:[(0,$.jsx)(`p`,{children:re.status===404?l?`执行会话已删除,运行结果仍保留。`:`The execution conversation was deleted. Results are still available.`:l?`执行会话暂时无法读取,运行结果仍保留。`:`The conversation is unavailable. Results are still available.`}),(0,$.jsx)(G,{onClick:()=>void ie(),children:l?`重试`:`Retry`})]}):null,R&&ne?(0,$.jsx)(G,{variant:`secondary`,onClick:()=>d(!0),children:l?`打开共享会话`:`Open shared conversation`}):null,le?null:(0,$.jsx)(Ze,{runId:A.id,language:a})]}),t[92]=le,t[93]=j,t[94]=P,t[95]=ne,t[96]=a,t[97]=ie,t[98]=A.error,t[99]=A.id,t[100]=A.summary,t[101]=re,t[102]=R,t[103]=ae,t[104]=l,t[105]=Oe):Oe=t[105];let X;return t[106]!==B||t[107]!==Y||t[108]!==Oe?(X=(0,$.jsxs)(`section`,{className:`flex h-full min-h-0 min-w-0 flex-col overflow-hidden`,"aria-label":B,children:[Y,Oe]}),t[106]=B,t[107]=Y,t[108]=Oe,t[109]=X):X=t[109],X}function ct(){}function lt(e){return Array.isArray(e)&&[`automations`,`automation-runs`,`automation-history`,`automation-navigation-runs`].includes(String(e[0]))||e===`automations-global-system-source`}function ut(e){return e&&N(e.run)?3e3:15e3}function dt(e){let t=(0,at.c)(44),{automation:n,language:r,busy:i,onEdit:a,onAction:o}=e,s=r===`zh`,c=n.management,l=s?`${n.name}的更多操作`:`More actions for ${n.name}`,u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,$.jsx)(k,{className:`size-4`}),t[0]=u):u=t[0];let d;t[1]===l?d=t[2]:(d=(0,$.jsx)(Ce,{asChild:!0,children:(0,$.jsx)(G,{variant:`ghost`,className:`size-8 p-0`,"aria-label":l,children:u})}),t[1]=l,t[2]=d);let f;t[3]!==n||t[4]!==i||t[5]!==c||t[6]!==o||t[7]!==s?(f=(!c||c.editable.includes(`enabled`))&&!X(n)?(0,$.jsxs)(J,{className:`flex cursor-pointer items-center gap-2 rounded-md px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover data-[disabled]:opacity-50`,disabled:i,onSelect:()=>void o(`automation:${n.id}:toggle`,()=>n.enabled?K.pause(n.id):K.resume(n.id)),children:[n.enabled?(0,$.jsx)(L,{className:`size-4`}):(0,$.jsx)(re,{className:`size-4`}),n.enabled?s?`暂停`:`Pause`:s?`恢复`:`Resume`]}):null,t[3]=n,t[4]=i,t[5]=c,t[6]=o,t[7]=s,t[8]=f):f=t[8];let p;t[9]!==n.id||t[10]!==i||t[11]!==c||t[12]!==o||t[13]!==s?(p=!c||c.runnable?(0,$.jsxs)(J,{className:`flex cursor-pointer items-center gap-2 rounded-md px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover data-[disabled]:opacity-50`,disabled:i,onSelect:()=>void o(`automation:${n.id}:run`,()=>K.runNow(n.id)),children:[(0,$.jsx)(re,{className:`size-4`}),s?`立即运行`:`Run now`]}):null,t[9]=n.id,t[10]=i,t[11]=c,t[12]=o,t[13]=s,t[14]=p):p=t[14];let m;t[15]!==n||t[16]!==i||t[17]!==c||t[18]!==a||t[19]!==s?(m=!c||c.editable.includes(`trigger`)?(0,$.jsxs)(J,{className:`flex cursor-pointer items-center gap-2 rounded-md px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover data-[disabled]:opacity-50`,disabled:i,onSelect:()=>a(n),children:[(0,$.jsx)(ne,{className:`size-4`}),s?`编辑`:`Edit`]}):null,t[15]=n,t[16]=i,t[17]=c,t[18]=a,t[19]=s,t[20]=m):m=t[20];let h;t[21]!==n.id||t[22]!==o||t[23]!==s?(h=()=>void o(`automation:${n.id}:copy-link`,()=>navigator.clipboard.writeText(`${window.location.origin}${window.location.pathname}#/automations?automation=${encodeURIComponent(n.id)}`),s?`任务链接已复制`:`Task link copied`),t[21]=n.id,t[22]=o,t[23]=s,t[24]=h):h=t[24];let g;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsx)(O,{className:`size-4`}),t[25]=g):g=t[25];let _=s?`复制任务链接`:`Copy task link`,v;t[26]!==h||t[27]!==_?(v=(0,$.jsxs)(J,{className:`flex cursor-pointer items-center gap-2 rounded-md px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover data-[disabled]:opacity-50`,onSelect:h,children:[g,_]}),t[26]=h,t[27]=_,t[28]=v):v=t[28];let y;t[29]!==n.id||t[30]!==i||t[31]!==c||t[32]!==o||t[33]!==s?(y=!c||c.deletable?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Y,{className:`my-1 h-px bg-edge-subtle`}),(0,$.jsxs)(J,{className:`flex cursor-pointer items-center gap-2 rounded-md px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover data-[disabled]:opacity-50 text-danger`,disabled:i,onSelect:()=>{window.confirm(s?`删除这个定时任务?已保存的对话仍可查看。`:`Delete this scheduled task? Saved conversations will remain available.`)&&o(`automation:${n.id}:delete`,()=>K.remove(n.id))},children:[(0,$.jsx)(ce,{className:`size-4`}),s?`删除`:`Delete`]})]}):null,t[29]=n.id,t[30]=i,t[31]=c,t[32]=o,t[33]=s,t[34]=y):y=t[34];let b;t[35]!==v||t[36]!==y||t[37]!==f||t[38]!==p||t[39]!==m?(b=(0,$.jsx)(we,{children:(0,$.jsxs)(De,{align:`end`,sideOffset:4,className:`z-70 min-w-44 rounded-xl border border-edge bg-surface-overlay p-1 shadow-popover`,children:[f,p,m,v,y]})}),t[35]=v,t[36]=y,t[37]=f,t[38]=p,t[39]=m,t[40]=b):b=t[40];let x;return t[41]!==b||t[42]!==d?(x=(0,$.jsxs)(Se,{children:[d,b]}),t[41]=b,t[42]=d,t[43]=x):x=t[43],x}function ft({automations:e,runs:t,labels:n,cronLabels:r,language:i,selectedAutomationId:a,selectedRunId:o,selectedRun:s,projectId:c,executionSummaries:l,onSelectRun:d,onOpenDetails:f,busy:p,onEdit:m,onAction:h}){let g=`xopc.automation-navigation:${u(e=>e.baseUrl)}:${u(e=>e.conversationId)??`local`}`,[_,v]=(0,Q.useState)(()=>{try{let e=JSON.parse(localStorage.getItem(g)??`{}`);return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}catch{return{}}});(0,Q.useEffect)(()=>{try{let e=JSON.parse(localStorage.getItem(g)??`{}`);v(e&&typeof e==`object`&&!Array.isArray(e)?e:{})}catch{v({})}},[g]);let y=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{!a||y.current===a||(y.current=a,v(e=>({...e,[a]:!0})))},[a]);let b=e=>v(t=>{let n={...t,[e]:!t[e]};try{localStorage.setItem(g,JSON.stringify(n))}catch{}return n});return e.length===0?(0,$.jsx)(`p`,{className:`p-4 text-sm text-fg-muted`,children:n.empty.filtered}):(0,$.jsx)(`div`,{className:`min-h-0 overflow-y-auto divide-y divide-edge-subtle`,children:e.map(e=>{let u=t.filter(t=>t.automationId===e.id).sort((e,t)=>t.createdAtMs-e.createdAtMs),g=u.find(N);return(0,$.jsxs)(`div`,{className:`group relative`,children:[(0,$.jsx)(`button`,{type:`button`,"aria-expanded":!!_[e.id],"aria-controls":`automation-runs-${e.id}`,"aria-label":i===`zh`?`${_[e.id]?`收起`:`展开`} ${e.name} 的执行记录`:`${_[e.id]?`Collapse`:`Expand`} executions for ${e.name}`,className:`absolute left-1 top-2 z-10 rounded-md p-2 text-fg-muted hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,onClick:()=>b(e.id),children:_[e.id]?(0,$.jsx)(C,{className:`size-4`}):(0,$.jsx)(w,{className:`size-4`})}),(0,$.jsxs)(`button`,{type:`button`,className:ue(`block w-full p-3 pl-9 pr-10 text-left outline-none hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,a===e.id&&!o&&`bg-surface-hover`),style:{contentVisibility:`auto`,containIntrinsicSize:`auto 76px`},"aria-current":a===e.id&&!o?`true`:void 0,onClick:()=>f(e.id),children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(`span`,{className:ue(`size-2 shrink-0 rounded-full`,g?`bg-blue-500`:Qe(e,u)?`bg-red-500`:e.enabled?`bg-emerald-500`:`bg-fg-subtle`)}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm font-medium text-fg`,children:e.name}),(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:X(e)?i===`zh`?`已完成`:`Completed`:e.enabled?n.enabled:n.paused}),(l?.[e.id]?.unreadCount??0)>0?(0,$.jsx)(`span`,{className:`ml-auto size-2 shrink-0 rounded-full bg-blue-500`,children:(0,$.jsx)(`span`,{className:`sr-only`,children:n.filters.unread})}):null]}),(0,$.jsxs)(`p`,{className:`mt-1 truncate pl-4 text-xs leading-5 text-fg-muted`,children:[e.enabled?(0,$.jsxs)($.Fragment,{children:[Ie(e,n,i),(0,$.jsx)(`span`,{className:`mx-1.5`,children:`·`})]}):null,Ae(e.trigger,n,r,i)]}),Qe(e,u)?(0,$.jsx)(`p`,{className:`mt-1 pl-4 text-xs text-red-700 dark:text-red-300`,children:n.dashboard.needsAttention}):null]}),(0,$.jsx)(`div`,{id:`automation-runs-${e.id}`,hidden:!_[e.id],children:(0,$.jsx)(F,{automationId:e.id,projectId:c,language:i,selectedRunId:o,selectedRun:s,enabled:!!_[e.id],onSelectRun:d})}),(0,$.jsx)(`div`,{className:`absolute right-1 top-2 opacity-100 sm:opacity-0 sm:group-hover:opacity-100 sm:group-focus-within:opacity-100`,children:(0,$.jsx)(dt,{automation:e,language:i,busy:p,onEdit:m,onAction:h})})]},e.id)})})}var pt=`xopc.automations.listWidth`,mt=272,ht=200,gt=560;function _t({children:e,language:t,busy:n}){let r=(0,Q.useRef)(null),i=(0,Q.useRef)(null),[a,o]=(0,Q.useState)(!1),[s,c]=(0,Q.useState)(()=>{try{let e=Number(window.localStorage.getItem(pt));if(Number.isFinite(e)&&e>=ht&&e<=gt)return e}catch{}return mt});(0,Q.useEffect)(()=>{try{window.localStorage.setItem(pt,String(s))}catch{}},[s]),(0,Q.useEffect)(()=>{if(!a)return;let{cursor:e,userSelect:t}=document.body.style;return document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`,()=>{document.body.style.cursor=e,document.body.style.userSelect=t}},[a]);let l=e=>{let t=r.current?.getBoundingClientRect().width??1e3,n=Math.max(ht,Math.min(gt,t*.6,t-292));return Math.round(Math.max(ht,Math.min(n,e)))},u=t===`zh`?`调整任务列表宽度`:`Resize task list`;return(0,$.jsxs)(`section`,{ref:r,"aria-busy":n,className:`grid min-h-0 min-w-0 flex-1 grid-rows-[auto_minmax(0,1fr)] gap-y-3 md:grid-cols-[minmax(0,min(var(--automation-list-width),60%))_0.75rem_minmax(0,1fr)] md:grid-rows-1 md:gap-y-0`,style:{"--automation-list-width":`${s}px`},children:[e[0],(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":u,"aria-valuemin":ht,"aria-valuemax":gt,"aria-valuenow":s,tabIndex:0,title:t===`zh`?`左右拖动调整宽度,双击恢复默认`:`Drag to resize, double-click to reset`,className:`relative hidden touch-none select-none cursor-col-resize focus-visible:outline-accent md:block`,onPointerDown:e=>{if(e.button!==0)return;e.preventDefault(),e.currentTarget.setPointerCapture(e.pointerId);let t=e.currentTarget.previousElementSibling?.getBoundingClientRect().width??s;i.current={pointerId:e.pointerId,startX:e.clientX,startWidth:t},o(!0)},onPointerMove:e=>{let t=i.current;t?.pointerId===e.pointerId&&c(l(t.startWidth+e.clientX-t.startX))},onPointerUp:e=>{i.current?.pointerId===e.pointerId&&(i.current=null,o(!1),e.currentTarget.releasePointerCapture(e.pointerId))},onPointerCancel:()=>{i.current=null,o(!1)},onLostPointerCapture:()=>{i.current=null,o(!1)},onDoubleClick:()=>c(mt),onKeyDown:e=>{[`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(e.key)&&(e.preventDefault(),c(l(e.key===`Home`?ht:e.key===`End`?gt:s+(e.key===`ArrowLeft`?-16:16))))}}),e[1]]})}var vt=(0,Q.lazy)(()=>i(()=>import(`./chat-page-BJ8PlDjZ.js`).then(e=>e.n).then(e=>({default:e.ChatPage})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194])));function yt(e){let t=(0,at.c)(51),{automation:n,conversationId:r,runs:i,language:a,onSelectRun:o,onConfigured:s}=e,c=n?.id,l;t[0]!==c||t[1]!==r?(l=c&&!r?[`automation-workspace-chat`,c]:null,t[0]=c,t[1]=r,t[2]=l):l=t[2];let u;t[3]===c?u=t[4]:(u=()=>K.openConfiguration({automationId:c}),t[3]=c,t[4]=u);let d;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(d={revalidateOnFocus:!1,revalidateOnReconnect:!1,shouldRetryOnError:!1},t[5]=d):d=t[5];let{data:p,error:m,mutate:h}=W(l,u,d),g;t[6]===r?g=t[7]:(g=r?[`automation-configuration`,r]:null,t[6]=r,t[7]=g);let _;t[8]===r?_=t[9]:(_=()=>K.configuration(r),t[8]=r,t[9]=_);let v;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(v={refreshInterval:3e3},t[10]=v):v=t[10];let{data:y}=W(g,_,v),b,x;t[11]!==n||t[12]!==s||t[13]!==y?(b=()=>{!n&&y?.automation&&s?.(y.automation.id)},x=[n,y,s],t[11]=n,t[12]=s,t[13]=y,t[14]=b,t[15]=x):(b=t[14],x=t[15]),(0,Q.useEffect)(b,x);let S=r??p?.conversationId,{mutate:C}=U(),w;t[16]===S?w=t[17]:(w=e=>!!(S&&(e.sessions[S]?.streaming||e.sessions[S]?.sending)),t[16]=S,t[17]=w);let T=fe(w),E=(0,Q.useRef)(!1),D,ee;t[18]!==C||t[19]!==T?(D=()=>{E.current&&!T&&C(bt),E.current=T},ee=[T,C],t[18]=C,t[19]=T,t[20]=D,t[21]=ee):(D=t[20],ee=t[21]),(0,Q.useEffect)(D,ee);let O=a===`zh`,k;t[22]===a?k=t[23]:(k=f(a),t[22]=a,t[23]=k);let A=k,j;if(t[24]!==a||t[25]!==A.automations.status||t[26]!==o||t[27]!==i||t[28]!==O){let e;t[30]!==a||t[31]!==A.automations.status||t[32]!==o||t[33]!==O?(e=e=>({id:`automation-run:${e.id}`,timestamp:e.createdAtMs,content:(0,$.jsxs)(`article`,{className:`mx-auto w-full max-w-[var(--max-width-chat-frame)] space-y-3 py-3`,"aria-label":O?`任务运行结果`:`Task run result`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-xs text-fg-muted`,children:[(0,$.jsxs)(`span`,{children:[new Date(e.createdAtMs).toLocaleString(O?`zh-CN`:`en-US`,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}),` · `,A.automations.status[e.status]]}),(0,$.jsx)(`button`,{type:`button`,className:`rounded-md px-2 py-1.5 hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,onClick:()=>o(e.id),children:O?`查看详情`:`View details`})]}),e.error?(0,$.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-6 text-danger`,children:$e(e,a)}):e.summary?(0,$.jsx)(te,{content:e.summary}):(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:O?`正在执行,结果会显示在这里。`:`Running. The result will appear here.`}),e.status===`failed`||e.status===`timeout`?(0,$.jsx)(Be,{automationId:e.automationId,runId:e.id,language:a,variant:`secondary`}):null,[`queued`,`running`,`cancelling`].includes(e.status)?null:(0,$.jsx)(Ze,{runId:e.id,language:a})]})}),t[30]=a,t[31]=A.automations.status,t[32]=o,t[33]=O,t[34]=e):e=t[34],j=i.map(e),t[24]=a,t[25]=A.automations.status,t[26]=o,t[27]=i,t[28]=O,t[29]=j}else j=t[29];let M=j;if(m){let e=O?`暂时无法打开任务对话。`:`Could not open the task conversation.`,n;t[35]===e?n=t[36]:(n=(0,$.jsx)(`p`,{children:e}),t[35]=e,t[36]=n);let r;t[37]===h?r=t[38]:(r=()=>void h(),t[37]=h,t[38]=r);let i=O?`重试`:`Retry`,a;t[39]!==r||t[40]!==i?(a=(0,$.jsx)(G,{variant:`secondary`,onClick:r,children:i}),t[39]=r,t[40]=i,t[41]=a):a=t[41];let o;return t[42]!==n||t[43]!==a?(o=(0,$.jsxs)(`div`,{role:`alert`,className:`p-6 text-sm text-fg-muted`,children:[n,a]}),t[42]=n,t[43]=a,t[44]=o):o=t[44],o}let N=O?`任务对话`:`Task conversation`,P;t[45]!==M||t[46]!==S?(P=S?(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(V,{className:`m-5 h-40`}),children:(0,$.jsx)(vt,{embedded:!0,conversationId:S,automationWorkspace:!0,automationTimelineEntries:M},S)}):(0,$.jsxs)(`div`,{className:`space-y-4 p-6`,children:[(0,$.jsx)(V,{className:`h-20 w-2/3`}),(0,$.jsx)(V,{className:`h-28`})]}),t[45]=M,t[46]=S,t[47]=P):P=t[47];let F;return t[48]!==N||t[49]!==P?(F=(0,$.jsx)(`section`,{className:`flex h-full min-h-0 min-w-0 flex-col overflow-hidden`,"aria-label":N,children:P}),t[48]=N,t[49]=P,t[50]=F):F=t[50],F}function bt(e){return Array.isArray(e)&&[`automations`,`automation-runs`,`automation-history`,`automation-configuration`].includes(String(e[0]))}var xt=`relative flex min-h-9 cursor-pointer items-center rounded-md py-2 pl-3 pr-8 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover`,St=`z-70 max-h-[min(32rem,calc(100dvh-2rem))] min-w-52 overflow-y-auto rounded-xl border border-edge bg-surface-overlay p-1.5 shadow-popover`;function Ct(e){let t=(0,at.c)(4),{value:n,children:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsx)(xe,{className:`absolute right-2.5`,children:(0,$.jsx)(S,{className:`size-3.5`,"aria-hidden":!0})}),t[0]=i):i=t[0];let a;return t[1]!==r||t[2]!==n?(a=(0,$.jsxs)(ve,{value:n,className:xt,children:[i,r]}),t[1]=r,t[2]=n,t[3]=a):a=t[3],a}function wt(e){let t=(0,at.c)(134),{language:n,labels:r,filter:i,ownership:a,source:o,projectId:s,projects:c,projectLocked:l,query:u,unreadCount:d,markReadBusy:f,onFilter:p,onOwnership:m,onSource:h,onProject:g,onQuery:_,onClear:v,onMarkAllRead:y}=e,b=n===`zh`,[x,S]=(0,Q.useState)(!1),C=(0,Q.useRef)(null),T=(0,Q.useRef)(null),E=x||!!u,D=i!==`all`||o!==`all`||a!==`user`||!l&&!!s,ee;t[0]===_?ee=t[1]:(ee=()=>{_(``),S(!1),T.current?.focus()},t[0]=_,t[1]=ee);let O=ee,k=b?`定时任务`:`Scheduled tasks`,A;t[2]===k?A=t[3]:(A=(0,$.jsx)(`h2`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:k}),t[2]=k,t[3]=A);let j=b?`筛选任务`:`Filter tasks`,N=b?`筛选任务`:`Filter tasks`,P=D&&`text-accent-fg`,F;t[4]===P?F=t[5]:(F=ue(`relative rounded-md p-2 text-fg-muted hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent data-[state=open]:bg-surface-hover`,P),t[4]=P,t[5]=F);let te;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,$.jsx)(M,{className:`size-4`,"aria-hidden":!0}),t[6]=te):te=t[6];let I;t[7]!==D||t[8]!==b?(I=D?(0,$.jsx)(`span`,{className:`absolute right-1.5 top-1.5 size-1 rounded-full bg-accent`,children:(0,$.jsx)(`span`,{className:`sr-only`,children:b?`已应用筛选`:`Filters applied`})}):null,t[7]=D,t[8]=b,t[9]=I):I=t[9];let L;t[10]!==j||t[11]!==N||t[12]!==F||t[13]!==I?(L=(0,$.jsx)(Ce,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,"aria-label":j,title:N,className:F,children:[te,I]})}),t[10]=j,t[11]=N,t[12]=F,t[13]=I,t[14]=L):L=t[14];let ne=b?`状态`:`Status`,re;t[15]===ne?re=t[16]:(re=(0,$.jsx)(_e,{className:`px-3 py-1.5 text-xs text-fg-subtle`,children:ne}),t[15]=ne,t[16]=re);let ie;t[17]===p?ie=t[18]:(ie=e=>p(e),t[17]=p,t[18]=ie);let R=b?`全部状态`:`All statuses`,z;t[19]===R?z=t[20]:(z=(0,$.jsx)(Ct,{value:`all`,children:R}),t[19]=R,t[20]=z);let oe;t[21]===r.filters.active?oe=t[22]:(oe=(0,$.jsx)(Ct,{value:`active`,children:r.filters.active}),t[21]=r.filters.active,t[22]=oe);let se;t[23]===r.paused?se=t[24]:(se=(0,$.jsx)(Ct,{value:`paused`,children:r.paused}),t[23]=r.paused,t[24]=se);let ce=b?`已完成`:`Completed`,B;t[25]===ce?B=t[26]:(B=(0,$.jsx)(Ct,{value:`completed`,children:ce}),t[25]=ce,t[26]=B);let V;t[27]===r.metrics.running?V=t[28]:(V=(0,$.jsx)(Ct,{value:`running`,children:r.metrics.running}),t[27]=r.metrics.running,t[28]=V);let H;t[29]===r.dashboard.needsAttention?H=t[30]:(H=(0,$.jsx)(Ct,{value:`attention`,children:r.dashboard.needsAttention}),t[29]=r.dashboard.needsAttention,t[30]=H);let de;t[31]!==i||t[32]!==ie||t[33]!==z||t[34]!==oe||t[35]!==se||t[36]!==B||t[37]!==V||t[38]!==H?(de=(0,$.jsxs)(Ee,{value:i,onValueChange:ie,children:[z,oe,se,B,V,H]}),t[31]=i,t[32]=ie,t[33]=z,t[34]=oe,t[35]=se,t[36]=B,t[37]=V,t[38]=H,t[39]=de):de=t[39];let fe;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(fe=(0,$.jsx)(Y,{className:`my-1 border-t border-edge`}),t[40]=fe):fe=t[40];let U=b?`归属`:`Owner`,W;t[41]===U?W=t[42]:(W=(0,$.jsx)(_e,{className:`px-3 py-1.5 text-xs text-fg-subtle`,children:U}),t[41]=U,t[42]=W);let pe;t[43]===m?pe=t[44]:(pe=e=>m(e),t[43]=m,t[44]=pe);let me=b?`我的任务`:`My tasks`,G;t[45]===me?G=t[46]:(G=(0,$.jsx)(Ct,{value:`user`,children:me}),t[45]=me,t[46]=G);let he=b?`系统任务`:`System tasks`,K;t[47]===he?K=t[48]:(K=(0,$.jsx)(Ct,{value:`system`,children:he}),t[47]=he,t[48]=K);let q;t[49]!==a||t[50]!==pe||t[51]!==G||t[52]!==K?(q=(0,$.jsxs)(Ee,{value:a,onValueChange:pe,children:[G,K]}),t[49]=a,t[50]=pe,t[51]=G,t[52]=K,t[53]=q):q=t[53];let ge;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,$.jsx)(Y,{className:`my-1 border-t border-edge`}),t[54]=ge):ge=t[54];let ve;t[55]!==r.filters.allProjects||t[56]!==g||t[57]!==s||t[58]!==l||t[59]!==c||t[60]!==b?(ve=l?null:(0,$.jsxs)(ye,{children:[(0,$.jsxs)(Te,{className:`flex min-h-9 cursor-pointer items-center justify-between gap-4 rounded-md px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover`,children:[b?`项目`:`Project`,(0,$.jsx)(`span`,{className:`ml-auto max-w-28 truncate text-xs text-fg-muted`,children:c.find(e=>e.id===s)?.name??r.filters.allProjects}),(0,$.jsx)(w,{className:`size-3.5 text-fg-subtle`,"aria-hidden":!0})]}),(0,$.jsx)(we,{children:(0,$.jsx)(be,{sideOffset:4,className:St,children:(0,$.jsxs)(Ee,{value:s,onValueChange:g,children:[(0,$.jsx)(Ct,{value:``,children:r.filters.allProjects}),c.map(Tt)]})})})]}),t[55]=r.filters.allProjects,t[56]=g,t[57]=s,t[58]=l,t[59]=c,t[60]=b,t[61]=ve):ve=t[61];let xe=b?`任务类型`:`Task type`,Oe;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=(0,$.jsx)(w,{className:`size-3.5 text-fg-subtle`,"aria-hidden":!0}),t[62]=Oe):Oe=t[62];let X;t[63]===xe?X=t[64]:(X=(0,$.jsxs)(Te,{className:`flex min-h-9 cursor-pointer items-center justify-between gap-4 rounded-md px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover`,children:[xe,Oe]}),t[63]=xe,t[64]=X);let ke;t[65]===h?ke=t[66]:(ke=e=>h(e),t[65]=h,t[66]=ke);let Z=b?`全部类型`:`All types`,Ae;t[67]===Z?Ae=t[68]:(Ae=(0,$.jsx)(Ct,{value:`all`,children:Z}),t[67]=Z,t[68]=Ae);let je;t[69]===r.sources.agent?je=t[70]:(je=(0,$.jsx)(Ct,{value:`agent`,children:r.sources.agent}),t[69]=r.sources.agent,t[70]=je);let Me;t[71]===r.sources.task?Me=t[72]:(Me=(0,$.jsx)(Ct,{value:`task_command`,children:r.sources.task}),t[71]=r.sources.task,t[72]=Me);let Ne;t[73]===r.sources.browser?Ne=t[74]:(Ne=(0,$.jsx)(Ct,{value:`browser_automation`,children:r.sources.browser}),t[73]=r.sources.browser,t[74]=Ne);let Pe;t[75]!==o||t[76]!==ke||t[77]!==Ae||t[78]!==je||t[79]!==Me||t[80]!==Ne?(Pe=(0,$.jsx)(we,{children:(0,$.jsx)(be,{sideOffset:4,className:St,children:(0,$.jsxs)(Ee,{value:o,onValueChange:ke,children:[Ae,je,Me,Ne]})})}),t[75]=o,t[76]=ke,t[77]=Ae,t[78]=je,t[79]=Me,t[80]=Ne,t[81]=Pe):Pe=t[81];let Fe;t[82]!==X||t[83]!==Pe?(Fe=(0,$.jsxs)(ye,{children:[X,Pe]}),t[82]=X,t[83]=Pe,t[84]=Fe):Fe=t[84];let Ie;t[85]!==D||t[86]!==v||t[87]!==u||t[88]!==b?(Ie=D||u?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Y,{className:`my-1 border-t border-edge`}),(0,$.jsx)(J,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-fg-muted outline-none data-[highlighted]:bg-surface-hover`,onSelect:v,children:b?`重置筛选`:`Reset filters`})]}):null,t[85]=D,t[86]=v,t[87]=u,t[88]=b,t[89]=Ie):Ie=t[89];let Le;t[90]!==r.filters.markAllRead||t[91]!==f||t[92]!==y||t[93]!==d?(Le=d>0?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Y,{className:`my-1 border-t border-edge`}),(0,$.jsx)(J,{disabled:f,className:`cursor-pointer rounded-md px-3 py-2 text-sm text-fg-muted outline-none data-[highlighted]:bg-surface-hover data-[disabled]:opacity-50`,onSelect:y,children:r.filters.markAllRead})]}):null,t[90]=r.filters.markAllRead,t[91]=f,t[92]=y,t[93]=d,t[94]=Le):Le=t[94];let Re;t[95]!==re||t[96]!==de||t[97]!==W||t[98]!==q||t[99]!==ve||t[100]!==Fe||t[101]!==Ie||t[102]!==Le?(Re=(0,$.jsx)(we,{children:(0,$.jsxs)(De,{align:`end`,sideOffset:6,className:St,children:[re,de,fe,W,q,ge,ve,Fe,Ie,Le]})}),t[95]=re,t[96]=de,t[97]=W,t[98]=q,t[99]=ve,t[100]=Fe,t[101]=Ie,t[102]=Le,t[103]=Re):Re=t[103];let ze;t[104]!==L||t[105]!==Re?(ze=(0,$.jsxs)(Se,{children:[L,Re]}),t[104]=L,t[105]=Re,t[106]=ze):ze=t[106];let Be=b?`搜索任务`:`Search tasks`,Ve=b?`搜索任务`:`Search tasks`,He;t[107]!==O||t[108]!==E?(He=()=>{E?O():(S(!0),requestAnimationFrame(()=>C.current?.focus()))},t[107]=O,t[108]=E,t[109]=He):He=t[109];let Ue=E&&`bg-surface-hover text-fg`,We;t[110]===Ue?We=t[111]:(We=ue(`rounded-md p-2 text-fg-muted hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,Ue),t[110]=Ue,t[111]=We);let Ge;t[112]===Symbol.for(`react.memo_cache_sentinel`)?(Ge=(0,$.jsx)(ae,{className:`size-4`,"aria-hidden":!0}),t[112]=Ge):Ge=t[112];let Ke;t[113]!==E||t[114]!==Be||t[115]!==Ve||t[116]!==He||t[117]!==We?(Ke=(0,$.jsx)(`button`,{ref:T,type:`button`,"aria-label":Be,title:Ve,"aria-expanded":E,onClick:He,className:We,children:Ge}),t[113]=E,t[114]=Be,t[115]=Ve,t[116]=He,t[117]=We,t[118]=Ke):Ke=t[118];let qe;t[119]!==ze||t[120]!==Ke?(qe=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5`,children:[ze,Ke]}),t[119]=ze,t[120]=Ke,t[121]=qe):qe=t[121];let Je;t[122]!==A||t[123]!==qe?(Je=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-1`,children:[A,qe]}),t[122]=A,t[123]=qe,t[124]=Je):Je=t[124];let Ye;t[125]!==O||t[126]!==_||t[127]!==u||t[128]!==E||t[129]!==b?(Ye=E?(0,$.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-edge bg-surface-panel px-2.5 focus-within:border-accent`,children:[(0,$.jsx)(ae,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,$.jsx)(`input`,{ref:C,value:u,onChange:e=>_(e.target.value),onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),O())},"aria-label":b?`搜索任务名称或内容`:`Search task names or content`,placeholder:b?`搜索任务…`:`Search tasks…`,className:`min-h-10 min-w-0 flex-1 bg-transparent text-sm text-fg outline-none placeholder:text-fg-subtle`}),(0,$.jsx)(`button`,{type:`button`,"aria-label":b?`关闭搜索`:`Close search`,onClick:O,className:`rounded-md p-1 text-fg-muted hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,children:(0,$.jsx)(le,{className:`size-3.5`,"aria-hidden":!0})})]}):null,t[125]=O,t[126]=_,t[127]=u,t[128]=E,t[129]=b,t[130]=Ye):Ye=t[130];let Xe;return t[131]!==Je||t[132]!==Ye?(Xe=(0,$.jsxs)(`div`,{className:`space-y-2`,children:[Je,Ye]}),t[131]=Je,t[132]=Ye,t[133]=Xe):Xe=t[133],Xe}function Tt(e){return(0,$.jsx)(Ct,{value:e.id,children:(0,$.jsx)(`span`,{className:`max-w-56 truncate`,children:e.name})},e.id)}var Et=[[`☀️`,`晨间简报`,`每天开始工作前,整理今天值得关注的任务与进展。`,`Morning briefing`,`Start each day with your tasks and project updates.`,`每天早上帮我整理当天到期、逾期的任务和项目进展,给出今天的重点。`,`Each morning, summarize my due and overdue tasks and project progress, and suggest priorities.`],[`📝`,`每周工作回顾`,`回顾一周的成果和问题,为下周留出清晰的方向。`,`Weekly review`,`Review the week and find a clear direction for the next.`,`每周五帮我回顾本周完成的任务和项目进展,整理未解决的问题,建议下周的重点。`,`Every Friday, review completed tasks and project progress, unresolved issues, and priorities for next week.`],[`🌱`,`项目进展跟进`,`定期看看项目进度,找出需要你关注的事情。`,`Project check-in`,`Keep an eye on project progress and what needs attention.`,`定期帮我检查项目进度,整理延期、阻塞和需要我决策的事项。先和我确认关注哪个项目以及运行时间。`,`Regularly review a project for delays, blockers, and decisions I need to make. Ask which project and when to run.`],[`🔔`,`重要事项提醒`,`把容易忘记的事情交给提醒,安心专注眼前。`,`A timely reminder`,`Make room to focus by setting a reminder for later.`,`我想安排一个重要事项提醒。请先问我需要提醒什么、什么时候提醒,以及是否重复。`,`Help me schedule a reminder. Ask what to remember, when, and whether it should repeat.`],[`📚`,`笔记整理`,`回看新收集的想法,整理出值得继续推进的线索。`,`Notes roundup`,`Revisit recent ideas and surface useful next steps.`,`每周帮我回顾最近新增的笔记,按主题整理,找出值得继续推进的想法。请先确认时间和范围。`,`Each week, group my recent notes by topic and suggest ideas worth pursuing. Confirm the schedule and scope.`],[`🧭`,`明日工作计划`,`下班前梳理未完成的事,安排明天最重要的三件事。`,`Plan tomorrow`,`Wrap up loose ends and choose tomorrow’s top three priorities.`,`每个工作日下班前,帮我梳理未完成的任务,建议明天最重要的三件事。请先确认具体时间。`,`Before the end of each workday, review unfinished tasks and suggest tomorrow’s top three priorities. Confirm the time.`],[`🗓️`,`月度复盘`,`拉远一点看进展,发现反复出现的问题和新的机会。`,`Monthly reflection`,`Step back to spot progress, recurring problems, and opportunities.`,`每月月底帮我回顾项目和任务的进展,总结成果、反复出现的问题和下个月的重点。请确认运行时间。`,`At the end of each month, review project and task progress, achievements, recurring problems, and priorities. Confirm the schedule.`],[`🎯`,`逾期任务检查`,`定期发现被搁置的事项,让重要的事重新向前。`,`Overdue task check`,`Find neglected tasks and get important work moving again.`,`定期帮我检查逾期任务,按紧迫程度整理,并建议下一步。请先确认运行频率和时间。`,`Regularly review overdue tasks, prioritize them by urgency, and suggest next steps. Confirm the frequency and time.`]];function Dt(e=Math.random){let t=[...Et];for(let n=t.length-1;n>0;n--){let r=Math.min(n,Math.max(0,Math.floor(e()*(n+1))));[t[n],t[r]]=[t[r],t[n]]}return t.slice(0,6)}function Ot({language:e,projectId:t,onOpenConversation:n}){let r=s(),[i,a]=(0,Q.useState)(!1),[o,c]=(0,Q.useState)(``),l=async e=>{a(!0),c(``);try{let i=await He({projectId:t,prompt:e});n?n(i):r(i)}catch(e){c(e instanceof Error?e.message:String(e))}finally{a(!1)}},u=e===`zh`,[d,f]=(0,Q.useState)(Dt),p=(0,$.jsxs)(`div`,{className:`mx-auto w-full max-w-3xl px-2 py-10 sm:px-6 md:py-20`,children:[(0,$.jsxs)(`div`,{className:`text-center`,children:[(0,$.jsx)(x,{className:`mx-auto size-10 text-fg-muted`,strokeWidth:1.3,"aria-hidden":!0}),(0,$.jsx)(`h2`,{className:`mt-4 text-xl font-semibold tracking-tight text-fg`,children:u?`安排任务`:`Schedule a task`}),(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:u?`说说你希望定期完成什么,我们一起安排好。`:`Tell us what you’d like done regularly. We’ll work out the details together.`})]}),(0,$.jsxs)(`div`,{className:`mb-3 mt-10 flex items-center justify-between text-xs text-fg-muted`,children:[(0,$.jsx)(`span`,{children:u?`也可以从这些想法开始`:`Or start with an idea`}),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>f(Dt()),className:`flex items-center gap-1.5 rounded-md px-2 py-1.5 hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,$.jsx)(R,{className:`size-3.5`,"aria-hidden":!0}),u?`换一组`:`More ideas`]})]}),(0,$.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:d.map(e=>(0,$.jsxs)(`button`,{type:`button`,disabled:i,onClick:()=>void l(u?e[5]:e[6]),className:`flex min-h-28 items-center gap-4 rounded-xl border border-dashed border-edge bg-surface-panel px-5 py-4 transition-colors hover:border-edge-strong hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,$.jsx)(`span`,{className:`shrink-0 text-2xl`,"aria-hidden":!0,children:e[0]}),(0,$.jsxs)(`span`,{className:`min-w-0`,children:[(0,$.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:u?e[1]:e[3]}),(0,$.jsx)(`span`,{className:`mt-1 block text-sm leading-5 text-fg-muted`,children:u?e[2]:e[4]})]})]},e[1]))}),(0,$.jsx)(`div`,{className:`mt-6 text-center`,children:(0,$.jsx)(`button`,{type:`button`,disabled:i,onClick:()=>void l(),className:`rounded-md px-3 py-2 text-sm text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:ring-2 focus-visible:ring-accent`,children:u?`说说你想安排的其他任务`:`Describe another task`})}),o?(0,$.jsx)(`p`,{role:`alert`,className:`mt-3 text-center text-sm text-danger`,children:o}):null]});return(0,$.jsx)(`section`,{"aria-label":u?`安排任务`:`Schedule a task`,children:p})}function kt(e){if(!e.trim())return null;try{return JSON.parse(e)}catch{return null}}function At(e){return typeof e.message==`string`&&e.message.trim()?e.message:typeof e.error==`string`&&e.error.trim()?e.error:e.error&&typeof e.error==`object`&&typeof e.error.message==`string`?e.error.message:`AI suggestion failed`}function jt(e,t={}){let n=kt(e.split(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/chat-page--wcFhTjW.js","assets/rolldown-runtime-aKtaBQYM.js","assets/vendor-react-BOUWij0V.js","assets/preload-helper-Czpn1I53.js","assets/chunk-KS7C4IRE-CiwuuyV8.js","assets/locale-store-CAZaC05J.js","assets/messages-C7fckbyG.js","assets/dist-BGTk37IG.js","assets/es2015-DBLcMg5B.js","assets/dist-CxGUk8J-.js","assets/createLucideIcon-DPHK1VkS.js","assets/app-window-DXFNqt_0.js","assets/archive-Dz0hferG.js","assets/arrow-left-D880xG-P.js","assets/arrow-up-D5ZtR1QT.js","assets/product-automation-feedback-DbJvv92z.js","assets/activity-YogQEteU.js","assets/bot-DjLkhyZL.js","assets/circle-check-C23XjkUj.js","assets/circle-pause-CN9jYH2s.js","assets/clock-3-DnrAnuyZ.js","assets/external-link-DjqjBmc3.js","assets/notes-api-zXpV6UXu.js","assets/markdown-view-BatP4qeK.js","assets/download-Dk-ZjtO6.js","assets/file-image-CDUPkZvG.js","assets/plus-Q2yW6OE7.js","assets/x-B_N4OPjy.js","assets/cn-0WouolD0.js","assets/bundle-mjs-rHxsej31.js","assets/app-link-DRy3-k7j.js","assets/product-delivery-DRyD9_Xq.js","assets/schemas-CCWMleym.js","assets/local-apps-Ck6kACsY.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/xml-_d7dTN2Q.js","assets/mermaid-render-oOellPHt.js","assets/markdown-view-C-DHb3Io.css","assets/chat-chart-block-CcVcKsDZ.js","assets/check-DUBLcKHA.js","assets/copy-Dv6d4Dvw.js","assets/skeleton-BI5TyibZ.js","assets/loader-circle-CifKLtgG.js","assets/message-square-fVE7Ghj1.js","assets/pause-DuPxgSxk.js","assets/play-kxZvpBg8.js","assets/rotate-ccw-JM1TBLpp.js","assets/rotate-cw-LIg3Am9S.js","assets/sparkles-DHlfQFAF.js","assets/triangle-alert-2JXFNNKU.js","assets/volume-2-BSJhAY97.js","assets/zap-dximCGjy.js","assets/vendor-swr-CdRzEUwF.js","assets/button-Cc4hUNTt.js","assets/automation-api-4fVKv9PJ.js","assets/book-open-CCGtrT3R.js","assets/chevron-down-ccbiQQz_.js","assets/chevron-right-BweFrslA.js","assets/working-directory-picker-modal-q39BUcJ6.js","assets/file-archive-DanfQJNe.js","assets/interaction-BdhHBbYa.js","assets/form-field-width-DJw_jULe.js","assets/settings-form-draft-Dy10ldo8.js","assets/popover-select-CEMWIrtY.js","assets/dist-GJ8-1PAx.js","assets/dist-BuHnPloF.js","assets/floating-ui.dom-seOukHzT.js","assets/settings-shell-dialog-layer-BU3UuiJr.js","assets/circle-alert-BEjgurr2.js","assets/new-chat-navigation-B6NPQ4h4.js","assets/circle-x-DFsCKeya.js","assets/circle-BoO4YvTx.js","assets/file-tree-utils-DJs1faGv.js","assets/database-CjjeZfRG.js","assets/earth-BMhZtzcj.js","assets/ellipsis-0k4rZLoy.js","assets/file-BqMS_3DT.js","assets/file-text-D12HbeVy.js","assets/folder-kanban-CpLlFI1o.js","assets/folder-open-CyzJ19I9.js","assets/folder-CN-pC3XL.js","assets/use-file-preview-expanded-nd_CuFsd.js","assets/eye-CABVeTq0.js","assets/link-2-D_ZKYUW7.js","assets/message-square-plus-XP0tGdlV.js","assets/minimize-2-DtOGrlpo.js","assets/paperclip-f1HujQY1.js","assets/pencil-DmIY3Oa-.js","assets/refresh-cw-BRlGaq2w.js","assets/save-DRDABU--.js","assets/search-DA7gz22f.js","assets/constants-DBtMsXdW.js","assets/session-api-CHRP5Lwf.js","assets/gateway-startup-retry-PMJi5mX4.js","assets/attachment-utils-core-BIOUBrpT.js","assets/activity-store-Cwn_CNwl.js","assets/app-chrome-BeB4KgOf.js","assets/electron-env-DHOGevH3.js","assets/use-async-resource-BHFGZCY2.js","assets/sliding-tab-list-DuQyViqe.js","assets/sliding-indicator-hwz0sx3h.js","assets/index.module-Cd9ENXfk.js","assets/workspace-api-Di2OmCvz.js","assets/files-BNL4kkSB.js","assets/dist-ZrL34Ps4.js","assets/git-branch-Dh9uxTot.js","assets/globe-DSSGFWFn.js","assets/history-DXH_9jsE.js","assets/key-round-DWbpyU2U.js","assets/laptop-CI3hBVrl.js","assets/list-checks-BbsExAoq.js","assets/list-todo-CTVRto8O.js","assets/messages-square-BckAJrEW.js","assets/mic-CuUb7zc-.js","assets/monitor-Af5eAvF7.js","assets/install-connector-dialog-Bo06Ry3H.js","assets/secret-input-Dryrns2s.js","assets/is-masked-secret-DOkL5b_X.js","assets/connectors-api-NcWECWKg.js","assets/gateway-config-swr-Cq-ByXL4.js","assets/oauth-provider-connect-D4Gfs-Ba.js","assets/cloud-C4-yfnnk.js","assets/models-hub-cache-CzC9y3D0.js","assets/registry-api-fLOqFyrz.js","assets/oauth-api-DmxSaxM1.js","assets/connection-usage-guide-Ddh0bfkj.js","assets/arrow-up-right-T72JbQ1Q.js","assets/connection-usage-Cm_McddI.js","assets/settings-2-D-csvaET.js","assets/settings-uiTATseT.js","assets/shield-check-BU58siTV.js","assets/smartphone-DSSsQFqA.js","assets/square-DMK_fB-3.js","assets/trash-2-DusmjVPV.js","assets/share-link-dialog-CTATUaa4.js","assets/copy-text-row-CpiRzq4G.js","assets/wrench-DFb4r8bH.js","assets/tasks-DRmd6sWt.js","assets/specialists-xbB3xL9e.js","assets/api-B9fZL-V8.js","assets/session-manager-DRRWwKE4.js","assets/local-session-drafts-jgw8UGsO.js","assets/tool-activity-BtJkgjFf.js","assets/personal-proactivity-DaRnbB1f.js","assets/gateway-realtime-DwMd2PCt.js","assets/gateway-realtime-store-CHrf6-nR.js","assets/agents-admin-api-B5lKH_ps.js","assets/new-session-preferences-gb411vZP.js","assets/extension-provider-NKWfjpdP.js","assets/capabilities-C7lnwKKm.js","assets/theme-store-8GFVtotZ.js","assets/middleware-Pd0e8Igk.js","assets/use-composer-attachments-lecOV2q5.js","assets/chevron-left-DqFhpbvK.js","assets/capabilities-DaeQXJT4.js","assets/file-preview-surface-BcLeaSNe.js","assets/phone-workspace-store-Dxp-KhFP.js","assets/shares-api-zegE8pSE.js","assets/skill-wire-pattern-BPpeIcCi.js","assets/chat-agents-api-BUi_7GRo.js","assets/composer-payload-handoff-B5XNxNCb.js","assets/voice-transcribe-api-BJCfiRFU.js","assets/open-capability-settings-Cvb65hQB.js","assets/workspace-editor-agent-store-B2r9wlix.js","assets/voice-input-shortcut-events-_SgYmx7X.js","assets/chunk-D32TOXHM-DQIy-Baq.js","assets/tool-friendly-title-DcCc6g7o.js","assets/voice-call-context-BM2A4bLz.js","assets/page-header-store-D7G5utVi.js","assets/loopi-CNtmi9FU.js","assets/loopi-C09I2mNj.css","assets/agent-avatar-display-ByzM7u9S.js","assets/use-directory-picker-C4p7AgWY.js","assets/confirm-dialog-D7dQJytv.js","assets/command-palette-api-luUjQPsh.js","assets/skill-list-api-Bv0mmHbu.js","assets/skill-api-utils-C7V4JVXM.js","assets/model-selector-raBRBkN_.js","assets/dev-view-store-DQJ61P5L.js","assets/extension-iframe-host-Bds-5kY_.js","assets/automation-task-card-DZWhCWJa.js","assets/calendar-clock-D-quYVPe.js","assets/message-circle-Badhj-4D.js","assets/date-picker-Cfjq1hD_.js","assets/calendar-days-hw_Y-g-s.js","assets/api-Djju8qIR.js","assets/runtime-health-D2TDFLLq.js","assets/terminal-panel-store-Djf9l2qZ.js","assets/agents-app-path-ciChvpCS.js","assets/agent-display-names-Bje7vfSn.js","assets/use-media-query-ady-FgjK.js","assets/oauth-authorization-window-o6URRos4.js","assets/page-context-draft-C4IIZaKd.js","assets/side-chat-shortcut-BIw-1TTD.js","assets/chat-page-zQeUaawJ.css"])))=>i.map(i=>d[i]);
2
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-Czpn1I53.js";import{m as a,t as o,u as s}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{a as c,i as l,l as u,n as d}from"./locale-store-CAZaC05J.js";import{t as f}from"./messages-C7fckbyG.js";import{a as p,n as m,o as h,r as g,s as _,t as v}from"./dist-BGTk37IG.js";import{t as y}from"./activity-YogQEteU.js";import{t as b}from"./arrow-left-D880xG-P.js";import{t as x}from"./calendar-clock-D-quYVPe.js";import{t as S}from"./check-DUBLcKHA.js";import{t as C}from"./chevron-down-ccbiQQz_.js";import{t as w}from"./chevron-right-BweFrslA.js";import{n as T,r as E}from"./popover-select-CEMWIrtY.js";import{t as D}from"./circle-alert-BEjgurr2.js";import{t as ee}from"./circle-check-C23XjkUj.js";import{t as O}from"./copy-Dv6d4Dvw.js";import{t as k}from"./ellipsis-0k4rZLoy.js";import{t as A}from"./eye-CABVeTq0.js";import{t as j}from"./git-branch-Dh9uxTot.js";import{t as M}from"./list-filter-CIPvpfLA.js";import{n as N,r as P,t as F}from"./automation-run-list-CJOdy_R2.js";import{t as te}from"./markdown-view-BatP4qeK.js";import{t as I}from"./message-circle-Badhj-4D.js";import{t as L}from"./pause-DuPxgSxk.js";import{t as ne}from"./pencil-DmIY3Oa-.js";import{t as re}from"./play-kxZvpBg8.js";import{t as ie}from"./plus-Q2yW6OE7.js";import{t as R}from"./refresh-cw-BRlGaq2w.js";import{t as ae}from"./search-DA7gz22f.js";import{t as z}from"./shield-check-BU58siTV.js";import{t as oe}from"./sparkles-DHlfQFAF.js";import{t as se}from"./square-pen-B8FsvqNu.js";import{t as ce}from"./trash-2-DusmjVPV.js";import{t as le}from"./x-B_N4OPjy.js";import{t as B}from"./zap-dximCGjy.js";import{t as ue}from"./cn-0WouolD0.js";import{t as V}from"./skeleton-BI5TyibZ.js";import{d as H}from"./api-B9fZL-V8.js";import{a as de}from"./session-api-CHRP5Lwf.js";import{T as fe}from"./session-manager-DRRWwKE4.js";import{a as U,i as W,o as pe}from"./vendor-swr-CdRzEUwF.js";import{t as me}from"./chat-agents-api-BUi_7GRo.js";import{t as G}from"./button-Cc4hUNTt.js";import{t as he}from"./page-header-store-D7G5utVi.js";import{t as K}from"./automation-api-4fVKv9PJ.js";import{t as q}from"./sliding-tab-list-DuQyViqe.js";import{t as ge}from"./refresh-button-DiWdGAaX.js";import{a as _e,c as ve,d as ye,f as be,i as xe,l as Se,m as Ce,o as we,p as Te,r as J,s as Ee,t as De,u as Y}from"./dist-ZrL34Ps4.js";import{n as Oe}from"./model-selector-raBRBkN_.js";import{C as X,S as ke,T as Z,_ as Ae,a as je,b as Me,c as Ne,d as Pe,f as Fe,g as Ie,h as Le,l as Re,m as ze,n as Be,o as Ve,p as He,r as Ue,s as We,u as Ge,v as Ke,w as qe,x as Je,y as Ye}from"./automation-task-card-DZWhCWJa.js";import{n as Xe}from"./agent-display-names-Bje7vfSn.js";import{i as Ze,n as Qe,r as $e,t as et}from"./automation-result-state-m7PeK2kl.js";import{i as tt,n as nt,r as rt,t as it}from"./browser-automation-inputs-DL4YPCuN.js";var at=n(),Q=e(t(),1),$=r(),ot=(0,Q.lazy)(()=>i(()=>import(`./chat-page--wcFhTjW.js`).then(e=>e.n).then(e=>({default:e.ChatPage})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194])));function st(e){let t=(0,at.c)(110),{runId:n,automationId:r,projectId:i,language:a,onConfigure:o,onDetails:s,onBack:c}=e,l=a===`zh`,[u,d]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(null),_;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(_=e=>g(e),t[0]=_):_=t[0];let v=_,y;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(y=()=>m(!0),t[1]=y):y=t[1];let x=y,{mutate:S}=U(),C=(0,Q.useRef)(!1),w=i??``,T;t[2]!==r||t[3]!==n||t[4]!==w?(T=[`automation-execution`,r,n,w],t[2]=r,t[3]=n,t[4]=w,t[5]=T):T=t[5];let E;t[6]!==r||t[7]!==i||t[8]!==n||t[9]!==l?(E=async()=>{let{run:e}=await K.getRun(n);if(e.automationId!==r)throw Error(l?`执行记录不属于此自动化`:`Execution does not belong to this automation`);let{automation:t}=await K.get(r);if(i&&t.projectId!==i)throw Error(l?`执行记录不属于此项目`:`Execution does not belong to this project`);return{run:e,automation:t}},t[6]=r,t[7]=i,t[8]=n,t[9]=l,t[10]=E):E=t[10];let D;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(D={refreshInterval:ut,shouldRetryOnError:!1},t[11]=D):D=t[11];let{data:ee,error:O,mutate:k}=W(T,E,D),A=ee?.run,j=A?.conversationId,M;t[12]===j?M=t[13]:(M=e=>!!(j&&(e.sessions[j]?.streaming||e.sessions[j]?.sending)),t[12]=j,t[13]=M);let P=fe(M),F;t[14]===j?F=t[15]:(F=j?[`automation-execution-session`,j]:null,t[14]=j,t[15]=F);let I;t[16]===j?I=t[17]:(I=()=>de(j),t[16]=j,t[17]=I);let L;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(L={shouldRetryOnError:!1},t[18]=L):L=t[18];let{data:ne,error:re,mutate:ie}=W(F,I,L),R=A?.conversationShared||ee?.automation.conversationMode===`continuous`||ne?.customData?.latestAutomationRunId!==void 0&&ne.customData.latestAutomationRunId!==n,ae=!!(ne&&(!R||u)),z=!O&&!!(A&&(!j||R&&!u&&ne&&!re&&(A?.summary||A?.error)||ne&&!re&&p)),oe,se;if(t[19]!==z||t[20]!==k||t[21]!==S||t[22]!==A?(oe=()=>{!A||!z||N(A)||A.readAtMs!=null||C.current||(C.current=!0,K.markRunRead(A.id).then(async()=>{await Promise.all([k(),S(lt)])}).catch(ct).finally(()=>{C.current=!1}))},se=[A,z,k,S],t[19]=z,t[20]=k,t[21]=S,t[22]=A,t[23]=oe,t[24]=se):(oe=t[23],se=t[24]),(0,Q.useEffect)(oe,se),O){let e=O instanceof Error?O.message:l?`执行记录加载失败`:`Could not load execution`,n;t[25]===e?n=t[26]:(n=(0,$.jsx)(`p`,{children:e}),t[25]=e,t[26]=n);let r;t[27]===k?r=t[28]:(r=()=>void k(),t[27]=k,t[28]=r);let i=l?`重试`:`Retry`,a;t[29]!==r||t[30]!==i?(a=(0,$.jsx)(G,{onClick:r,children:i}),t[29]=r,t[30]=i,t[31]=a):a=t[31];let o=l?`返回自动化`:`Back to automation`,s;t[32]!==c||t[33]!==o?(s=(0,$.jsx)(G,{onClick:c,children:o}),t[32]=c,t[33]=o,t[34]=s):s=t[34];let u;return t[35]!==n||t[36]!==a||t[37]!==s?(u=(0,$.jsxs)(`section`,{role:`alert`,className:`space-y-3 p-5`,children:[n,a,s]}),t[35]=n,t[36]=a,t[37]=s,t[38]=u):u=t[38],u}if(!A){let e;return t[39]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsxs)(`div`,{className:`space-y-4 p-5`,"aria-busy":`true`,children:[(0,$.jsx)(V,{className:`h-6 w-2/3`}),(0,$.jsx)(V,{className:`h-20`})]}),t[39]=e):e=t[39],e}let ce;t[40]===A?ce=t[41]:(ce=N(A),t[40]=A,t[41]=ce);let le=ce,B=l?`执行会话`:`Execution conversation`,ue=l?`返回自动化`:`Back to automation`,H;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,$.jsx)(b,{className:`size-4`}),t[42]=H):H=t[42];let pe;t[43]!==c||t[44]!==ue?(pe=(0,$.jsx)(G,{variant:`ghost`,className:`shrink-0`,onClick:c,"aria-label":ue,children:H}),t[43]=c,t[44]=ue,t[45]=pe):pe=t[45];let me;t[46]===A.automationName?me=t[47]:(me=(0,$.jsx)(`h2`,{className:`truncate text-sm font-medium text-fg`,children:A.automationName}),t[46]=A.automationName,t[47]=me);let he;t[48]!==pe||t[49]!==me?(he=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[pe,me]}),t[48]=pe,t[49]=me,t[50]=he):he=t[50];let q;t[51]!==A.createdAtMs||t[52]!==l?(q=new Date(A.createdAtMs).toLocaleString(l?`zh-CN`:`en-US`),t[51]=A.createdAtMs,t[52]=l,t[53]=q):q=t[53];let ge;t[54]===a?ge=t[55]:(ge=f(a),t[54]=a,t[55]=ge);let _e=ge.automations.status[A.status],ve;t[56]!==q||t[57]!==_e?(ve=(0,$.jsxs)(`span`,{children:[q,` · `,_e]}),t[56]=q,t[57]=_e,t[58]=ve):ve=t[58];let ye;t[59]!==s||t[60]!==A.id?(ye=()=>s(A.id),t[59]=s,t[60]=A.id,t[61]=ye):ye=t[61];let be=l?`运行详情`:`Run details`,xe;t[62]!==ye||t[63]!==be?(xe=(0,$.jsx)(`button`,{type:`button`,className:`rounded px-2 py-1.5 text-accent-fg hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,onClick:ye,children:be}),t[62]=ye,t[63]=be,t[64]=xe):xe=t[64];let Se;t[65]!==o||t[66]!==A?(Se=()=>o(A),t[65]=o,t[66]=A,t[67]=Se):Se=t[67];let Ce=l?`调整自动化`:`Adjust automation`,we;t[68]!==Se||t[69]!==Ce?(we=(0,$.jsx)(`button`,{type:`button`,className:`rounded px-2 py-1.5 text-accent-fg hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,onClick:Se,children:Ce}),t[68]=Se,t[69]=Ce,t[70]=we):we=t[70];let Te;t[71]!==ve||t[72]!==xe||t[73]!==we?(Te=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 text-xs text-fg-muted`,children:[ve,xe,we]}),t[71]=ve,t[72]=xe,t[73]=we,t[74]=Te):Te=t[74];let J;t[75]!==ee?.automation||t[76]!==R||t[77]!==l?(J=R?(0,$.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[l?`多次执行可能共用此会话;下方摘要对应所选执行。`:`Executions may share this conversation. The summary belongs to the selected execution.`,ee?.automation.conversationMode===`continuous`?l?`追问会进入后续运行上下文。`:` Follow-ups become context for future runs.`:null]}):null,t[75]=ee?.automation,t[76]=R,t[77]=l,t[78]=J):J=t[78];let Ee;t[79]!==h||t[80]!==u||t[81]!==l?(Ee=u?(0,$.jsx)(`p`,{role:`status`,className:`text-xs text-fg-muted`,children:h===!0?l?`已定位到所选执行的会话起点。`:`Located the selected execution in this conversation.`:h===!1?l?`旧记录缺少可用的执行定位信息,当前显示完整会话。`:`No matching turn was found in the available history. Showing the full conversation.`:l?`正在定位所选执行…`:`Locating the selected execution…`}):null,t[79]=h,t[80]=u,t[81]=l,t[82]=Ee):Ee=t[82];let De;t[83]!==le||t[84]!==l?(De=le?(0,$.jsx)(`p`,{role:`status`,className:`text-xs text-fg-muted`,children:l?`执行中,完成后可继续追问。`:`Execution in progress. Follow up after it finishes.`}):null,t[83]=le,t[84]=l,t[85]=De):De=t[85];let Y;t[86]!==he||t[87]!==Te||t[88]!==J||t[89]!==Ee||t[90]!==De?(Y=(0,$.jsxs)(`header`,{className:`shrink-0 space-y-2 border-b border-edge px-4 py-3`,children:[he,Te,J,Ee,De]}),t[86]=he,t[87]=Te,t[88]=J,t[89]=Ee,t[90]=De,t[91]=Y):Y=t[91];let Oe;t[92]!==le||t[93]!==j||t[94]!==P||t[95]!==ne||t[96]!==a||t[97]!==ie||t[98]!==A.error||t[99]!==A.id||t[100]!==A.summary||t[101]!==re||t[102]!==R||t[103]!==ae||t[104]!==l?(Oe=ae?(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(V,{className:`m-5 h-40`}),children:(0,$.jsx)(ot,{embedded:!0,automationExecution:!0,conversationId:j,readOnly:le||P,onHistoryReady:x,initialTurnId:R?A.id:void 0,onInitialTurnLocated:v},j)}):(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-5`,children:[A.summary?(0,$.jsx)(te,{content:A.summary}):null,A.error?(0,$.jsx)(`p`,{className:`whitespace-pre-wrap text-sm text-danger`,children:A.error}):null,j?null:(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:le?l?`等待执行会话,开始后会自动更新。`:`Waiting for the execution conversation. This view updates automatically.`:l?`本次执行没有关联会话,可查看运行结果和详情。`:`No conversation is associated with this execution. Results and diagnostics remain available.`}),j&&!ne&&!re?(0,$.jsx)(V,{className:`h-24`}):null,re?(0,$.jsxs)(`div`,{role:`alert`,className:`space-y-2 text-sm text-fg-muted`,children:[(0,$.jsx)(`p`,{children:re.status===404?l?`执行会话已删除,运行结果仍保留。`:`The execution conversation was deleted. Results are still available.`:l?`执行会话暂时无法读取,运行结果仍保留。`:`The conversation is unavailable. Results are still available.`}),(0,$.jsx)(G,{onClick:()=>void ie(),children:l?`重试`:`Retry`})]}):null,R&&ne?(0,$.jsx)(G,{variant:`secondary`,onClick:()=>d(!0),children:l?`打开共享会话`:`Open shared conversation`}):null,le?null:(0,$.jsx)(Ze,{runId:A.id,language:a})]}),t[92]=le,t[93]=j,t[94]=P,t[95]=ne,t[96]=a,t[97]=ie,t[98]=A.error,t[99]=A.id,t[100]=A.summary,t[101]=re,t[102]=R,t[103]=ae,t[104]=l,t[105]=Oe):Oe=t[105];let X;return t[106]!==B||t[107]!==Y||t[108]!==Oe?(X=(0,$.jsxs)(`section`,{className:`flex h-full min-h-0 min-w-0 flex-col overflow-hidden`,"aria-label":B,children:[Y,Oe]}),t[106]=B,t[107]=Y,t[108]=Oe,t[109]=X):X=t[109],X}function ct(){}function lt(e){return Array.isArray(e)&&[`automations`,`automation-runs`,`automation-history`,`automation-navigation-runs`].includes(String(e[0]))||e===`automations-global-system-source`}function ut(e){return e&&N(e.run)?3e3:15e3}function dt(e){let t=(0,at.c)(44),{automation:n,language:r,busy:i,onEdit:a,onAction:o}=e,s=r===`zh`,c=n.management,l=s?`${n.name}的更多操作`:`More actions for ${n.name}`,u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,$.jsx)(k,{className:`size-4`}),t[0]=u):u=t[0];let d;t[1]===l?d=t[2]:(d=(0,$.jsx)(Ce,{asChild:!0,children:(0,$.jsx)(G,{variant:`ghost`,className:`size-8 p-0`,"aria-label":l,children:u})}),t[1]=l,t[2]=d);let f;t[3]!==n||t[4]!==i||t[5]!==c||t[6]!==o||t[7]!==s?(f=(!c||c.editable.includes(`enabled`))&&!X(n)?(0,$.jsxs)(J,{className:`flex cursor-pointer items-center gap-2 rounded-md px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover data-[disabled]:opacity-50`,disabled:i,onSelect:()=>void o(`automation:${n.id}:toggle`,()=>n.enabled?K.pause(n.id):K.resume(n.id)),children:[n.enabled?(0,$.jsx)(L,{className:`size-4`}):(0,$.jsx)(re,{className:`size-4`}),n.enabled?s?`暂停`:`Pause`:s?`恢复`:`Resume`]}):null,t[3]=n,t[4]=i,t[5]=c,t[6]=o,t[7]=s,t[8]=f):f=t[8];let p;t[9]!==n.id||t[10]!==i||t[11]!==c||t[12]!==o||t[13]!==s?(p=!c||c.runnable?(0,$.jsxs)(J,{className:`flex cursor-pointer items-center gap-2 rounded-md px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover data-[disabled]:opacity-50`,disabled:i,onSelect:()=>void o(`automation:${n.id}:run`,()=>K.runNow(n.id)),children:[(0,$.jsx)(re,{className:`size-4`}),s?`立即运行`:`Run now`]}):null,t[9]=n.id,t[10]=i,t[11]=c,t[12]=o,t[13]=s,t[14]=p):p=t[14];let m;t[15]!==n||t[16]!==i||t[17]!==c||t[18]!==a||t[19]!==s?(m=!c||c.editable.includes(`trigger`)?(0,$.jsxs)(J,{className:`flex cursor-pointer items-center gap-2 rounded-md px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover data-[disabled]:opacity-50`,disabled:i,onSelect:()=>a(n),children:[(0,$.jsx)(ne,{className:`size-4`}),s?`编辑`:`Edit`]}):null,t[15]=n,t[16]=i,t[17]=c,t[18]=a,t[19]=s,t[20]=m):m=t[20];let h;t[21]!==n.id||t[22]!==o||t[23]!==s?(h=()=>void o(`automation:${n.id}:copy-link`,()=>navigator.clipboard.writeText(`${window.location.origin}${window.location.pathname}#/automations?automation=${encodeURIComponent(n.id)}`),s?`任务链接已复制`:`Task link copied`),t[21]=n.id,t[22]=o,t[23]=s,t[24]=h):h=t[24];let g;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsx)(O,{className:`size-4`}),t[25]=g):g=t[25];let _=s?`复制任务链接`:`Copy task link`,v;t[26]!==h||t[27]!==_?(v=(0,$.jsxs)(J,{className:`flex cursor-pointer items-center gap-2 rounded-md px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover data-[disabled]:opacity-50`,onSelect:h,children:[g,_]}),t[26]=h,t[27]=_,t[28]=v):v=t[28];let y;t[29]!==n.id||t[30]!==i||t[31]!==c||t[32]!==o||t[33]!==s?(y=!c||c.deletable?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Y,{className:`my-1 h-px bg-edge-subtle`}),(0,$.jsxs)(J,{className:`flex cursor-pointer items-center gap-2 rounded-md px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover data-[disabled]:opacity-50 text-danger`,disabled:i,onSelect:()=>{window.confirm(s?`删除这个定时任务?已保存的对话仍可查看。`:`Delete this scheduled task? Saved conversations will remain available.`)&&o(`automation:${n.id}:delete`,()=>K.remove(n.id))},children:[(0,$.jsx)(ce,{className:`size-4`}),s?`删除`:`Delete`]})]}):null,t[29]=n.id,t[30]=i,t[31]=c,t[32]=o,t[33]=s,t[34]=y):y=t[34];let b;t[35]!==v||t[36]!==y||t[37]!==f||t[38]!==p||t[39]!==m?(b=(0,$.jsx)(we,{children:(0,$.jsxs)(De,{align:`end`,sideOffset:4,className:`z-70 min-w-44 rounded-xl border border-edge bg-surface-overlay p-1 shadow-popover`,children:[f,p,m,v,y]})}),t[35]=v,t[36]=y,t[37]=f,t[38]=p,t[39]=m,t[40]=b):b=t[40];let x;return t[41]!==b||t[42]!==d?(x=(0,$.jsxs)(Se,{children:[d,b]}),t[41]=b,t[42]=d,t[43]=x):x=t[43],x}function ft({automations:e,runs:t,labels:n,cronLabels:r,language:i,selectedAutomationId:a,selectedRunId:o,selectedRun:s,projectId:c,executionSummaries:l,onSelectRun:d,onOpenDetails:f,busy:p,onEdit:m,onAction:h}){let g=`xopc.automation-navigation:${u(e=>e.baseUrl)}:${u(e=>e.conversationId)??`local`}`,[_,v]=(0,Q.useState)(()=>{try{let e=JSON.parse(localStorage.getItem(g)??`{}`);return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}catch{return{}}});(0,Q.useEffect)(()=>{try{let e=JSON.parse(localStorage.getItem(g)??`{}`);v(e&&typeof e==`object`&&!Array.isArray(e)?e:{})}catch{v({})}},[g]);let y=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{!a||y.current===a||(y.current=a,v(e=>({...e,[a]:!0})))},[a]);let b=e=>v(t=>{let n={...t,[e]:!t[e]};try{localStorage.setItem(g,JSON.stringify(n))}catch{}return n});return e.length===0?(0,$.jsx)(`p`,{className:`p-4 text-sm text-fg-muted`,children:n.empty.filtered}):(0,$.jsx)(`div`,{className:`min-h-0 overflow-y-auto divide-y divide-edge-subtle`,children:e.map(e=>{let u=t.filter(t=>t.automationId===e.id).sort((e,t)=>t.createdAtMs-e.createdAtMs),g=u.find(N);return(0,$.jsxs)(`div`,{className:`group relative`,children:[(0,$.jsx)(`button`,{type:`button`,"aria-expanded":!!_[e.id],"aria-controls":`automation-runs-${e.id}`,"aria-label":i===`zh`?`${_[e.id]?`收起`:`展开`} ${e.name} 的执行记录`:`${_[e.id]?`Collapse`:`Expand`} executions for ${e.name}`,className:`absolute left-1 top-2 z-10 rounded-md p-2 text-fg-muted hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,onClick:()=>b(e.id),children:_[e.id]?(0,$.jsx)(C,{className:`size-4`}):(0,$.jsx)(w,{className:`size-4`})}),(0,$.jsxs)(`button`,{type:`button`,className:ue(`block w-full p-3 pl-9 pr-10 text-left outline-none hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,a===e.id&&!o&&`bg-surface-hover`),style:{contentVisibility:`auto`,containIntrinsicSize:`auto 76px`},"aria-current":a===e.id&&!o?`true`:void 0,onClick:()=>f(e.id),children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(`span`,{className:ue(`size-2 shrink-0 rounded-full`,g?`bg-blue-500`:Qe(e,u)?`bg-red-500`:e.enabled?`bg-emerald-500`:`bg-fg-subtle`)}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm font-medium text-fg`,children:e.name}),(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:X(e)?i===`zh`?`已完成`:`Completed`:e.enabled?n.enabled:n.paused}),(l?.[e.id]?.unreadCount??0)>0?(0,$.jsx)(`span`,{className:`ml-auto size-2 shrink-0 rounded-full bg-blue-500`,children:(0,$.jsx)(`span`,{className:`sr-only`,children:n.filters.unread})}):null]}),(0,$.jsxs)(`p`,{className:`mt-1 truncate pl-4 text-xs leading-5 text-fg-muted`,children:[e.enabled?(0,$.jsxs)($.Fragment,{children:[Ie(e,n,i),(0,$.jsx)(`span`,{className:`mx-1.5`,children:`·`})]}):null,Ae(e.trigger,n,r,i)]}),Qe(e,u)?(0,$.jsx)(`p`,{className:`mt-1 pl-4 text-xs text-red-700 dark:text-red-300`,children:n.dashboard.needsAttention}):null]}),(0,$.jsx)(`div`,{id:`automation-runs-${e.id}`,hidden:!_[e.id],children:(0,$.jsx)(F,{automationId:e.id,projectId:c,language:i,selectedRunId:o,selectedRun:s,enabled:!!_[e.id],onSelectRun:d})}),(0,$.jsx)(`div`,{className:`absolute right-1 top-2 opacity-100 sm:opacity-0 sm:group-hover:opacity-100 sm:group-focus-within:opacity-100`,children:(0,$.jsx)(dt,{automation:e,language:i,busy:p,onEdit:m,onAction:h})})]},e.id)})})}var pt=`xopc.automations.listWidth`,mt=272,ht=200,gt=560;function _t({children:e,language:t,busy:n}){let r=(0,Q.useRef)(null),i=(0,Q.useRef)(null),[a,o]=(0,Q.useState)(!1),[s,c]=(0,Q.useState)(()=>{try{let e=Number(window.localStorage.getItem(pt));if(Number.isFinite(e)&&e>=ht&&e<=gt)return e}catch{}return mt});(0,Q.useEffect)(()=>{try{window.localStorage.setItem(pt,String(s))}catch{}},[s]),(0,Q.useEffect)(()=>{if(!a)return;let{cursor:e,userSelect:t}=document.body.style;return document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`,()=>{document.body.style.cursor=e,document.body.style.userSelect=t}},[a]);let l=e=>{let t=r.current?.getBoundingClientRect().width??1e3,n=Math.max(ht,Math.min(gt,t*.6,t-292));return Math.round(Math.max(ht,Math.min(n,e)))},u=t===`zh`?`调整任务列表宽度`:`Resize task list`;return(0,$.jsxs)(`section`,{ref:r,"aria-busy":n,className:`grid min-h-0 min-w-0 flex-1 grid-rows-[auto_minmax(0,1fr)] gap-y-3 md:grid-cols-[minmax(0,min(var(--automation-list-width),60%))_0.75rem_minmax(0,1fr)] md:grid-rows-1 md:gap-y-0`,style:{"--automation-list-width":`${s}px`},children:[e[0],(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":u,"aria-valuemin":ht,"aria-valuemax":gt,"aria-valuenow":s,tabIndex:0,title:t===`zh`?`左右拖动调整宽度,双击恢复默认`:`Drag to resize, double-click to reset`,className:`relative hidden touch-none select-none cursor-col-resize focus-visible:outline-accent md:block`,onPointerDown:e=>{if(e.button!==0)return;e.preventDefault(),e.currentTarget.setPointerCapture(e.pointerId);let t=e.currentTarget.previousElementSibling?.getBoundingClientRect().width??s;i.current={pointerId:e.pointerId,startX:e.clientX,startWidth:t},o(!0)},onPointerMove:e=>{let t=i.current;t?.pointerId===e.pointerId&&c(l(t.startWidth+e.clientX-t.startX))},onPointerUp:e=>{i.current?.pointerId===e.pointerId&&(i.current=null,o(!1),e.currentTarget.releasePointerCapture(e.pointerId))},onPointerCancel:()=>{i.current=null,o(!1)},onLostPointerCapture:()=>{i.current=null,o(!1)},onDoubleClick:()=>c(mt),onKeyDown:e=>{[`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(e.key)&&(e.preventDefault(),c(l(e.key===`Home`?ht:e.key===`End`?gt:s+(e.key===`ArrowLeft`?-16:16))))}}),e[1]]})}var vt=(0,Q.lazy)(()=>i(()=>import(`./chat-page--wcFhTjW.js`).then(e=>e.n).then(e=>({default:e.ChatPage})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194])));function yt(e){let t=(0,at.c)(51),{automation:n,conversationId:r,runs:i,language:a,onSelectRun:o,onConfigured:s}=e,c=n?.id,l;t[0]!==c||t[1]!==r?(l=c&&!r?[`automation-workspace-chat`,c]:null,t[0]=c,t[1]=r,t[2]=l):l=t[2];let u;t[3]===c?u=t[4]:(u=()=>K.openConfiguration({automationId:c}),t[3]=c,t[4]=u);let d;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(d={revalidateOnFocus:!1,revalidateOnReconnect:!1,shouldRetryOnError:!1},t[5]=d):d=t[5];let{data:p,error:m,mutate:h}=W(l,u,d),g;t[6]===r?g=t[7]:(g=r?[`automation-configuration`,r]:null,t[6]=r,t[7]=g);let _;t[8]===r?_=t[9]:(_=()=>K.configuration(r),t[8]=r,t[9]=_);let v;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(v={refreshInterval:3e3},t[10]=v):v=t[10];let{data:y}=W(g,_,v),b,x;t[11]!==n||t[12]!==s||t[13]!==y?(b=()=>{!n&&y?.automation&&s?.(y.automation.id)},x=[n,y,s],t[11]=n,t[12]=s,t[13]=y,t[14]=b,t[15]=x):(b=t[14],x=t[15]),(0,Q.useEffect)(b,x);let S=r??p?.conversationId,{mutate:C}=U(),w;t[16]===S?w=t[17]:(w=e=>!!(S&&(e.sessions[S]?.streaming||e.sessions[S]?.sending)),t[16]=S,t[17]=w);let T=fe(w),E=(0,Q.useRef)(!1),D,ee;t[18]!==C||t[19]!==T?(D=()=>{E.current&&!T&&C(bt),E.current=T},ee=[T,C],t[18]=C,t[19]=T,t[20]=D,t[21]=ee):(D=t[20],ee=t[21]),(0,Q.useEffect)(D,ee);let O=a===`zh`,k;t[22]===a?k=t[23]:(k=f(a),t[22]=a,t[23]=k);let A=k,j;if(t[24]!==a||t[25]!==A.automations.status||t[26]!==o||t[27]!==i||t[28]!==O){let e;t[30]!==a||t[31]!==A.automations.status||t[32]!==o||t[33]!==O?(e=e=>({id:`automation-run:${e.id}`,timestamp:e.createdAtMs,content:(0,$.jsxs)(`article`,{className:`mx-auto w-full max-w-[var(--max-width-chat-frame)] space-y-3 py-3`,"aria-label":O?`任务运行结果`:`Task run result`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-xs text-fg-muted`,children:[(0,$.jsxs)(`span`,{children:[new Date(e.createdAtMs).toLocaleString(O?`zh-CN`:`en-US`,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}),` · `,A.automations.status[e.status]]}),(0,$.jsx)(`button`,{type:`button`,className:`rounded-md px-2 py-1.5 hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,onClick:()=>o(e.id),children:O?`查看详情`:`View details`})]}),e.error?(0,$.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-6 text-danger`,children:$e(e,a)}):e.summary?(0,$.jsx)(te,{content:e.summary}):(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:O?`正在执行,结果会显示在这里。`:`Running. The result will appear here.`}),e.status===`failed`||e.status===`timeout`?(0,$.jsx)(Be,{automationId:e.automationId,runId:e.id,language:a,variant:`secondary`}):null,[`queued`,`running`,`cancelling`].includes(e.status)?null:(0,$.jsx)(Ze,{runId:e.id,language:a})]})}),t[30]=a,t[31]=A.automations.status,t[32]=o,t[33]=O,t[34]=e):e=t[34],j=i.map(e),t[24]=a,t[25]=A.automations.status,t[26]=o,t[27]=i,t[28]=O,t[29]=j}else j=t[29];let M=j;if(m){let e=O?`暂时无法打开任务对话。`:`Could not open the task conversation.`,n;t[35]===e?n=t[36]:(n=(0,$.jsx)(`p`,{children:e}),t[35]=e,t[36]=n);let r;t[37]===h?r=t[38]:(r=()=>void h(),t[37]=h,t[38]=r);let i=O?`重试`:`Retry`,a;t[39]!==r||t[40]!==i?(a=(0,$.jsx)(G,{variant:`secondary`,onClick:r,children:i}),t[39]=r,t[40]=i,t[41]=a):a=t[41];let o;return t[42]!==n||t[43]!==a?(o=(0,$.jsxs)(`div`,{role:`alert`,className:`p-6 text-sm text-fg-muted`,children:[n,a]}),t[42]=n,t[43]=a,t[44]=o):o=t[44],o}let N=O?`任务对话`:`Task conversation`,P;t[45]!==M||t[46]!==S?(P=S?(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(V,{className:`m-5 h-40`}),children:(0,$.jsx)(vt,{embedded:!0,conversationId:S,automationWorkspace:!0,automationTimelineEntries:M},S)}):(0,$.jsxs)(`div`,{className:`space-y-4 p-6`,children:[(0,$.jsx)(V,{className:`h-20 w-2/3`}),(0,$.jsx)(V,{className:`h-28`})]}),t[45]=M,t[46]=S,t[47]=P):P=t[47];let F;return t[48]!==N||t[49]!==P?(F=(0,$.jsx)(`section`,{className:`flex h-full min-h-0 min-w-0 flex-col overflow-hidden`,"aria-label":N,children:P}),t[48]=N,t[49]=P,t[50]=F):F=t[50],F}function bt(e){return Array.isArray(e)&&[`automations`,`automation-runs`,`automation-history`,`automation-configuration`].includes(String(e[0]))}var xt=`relative flex min-h-9 cursor-pointer items-center rounded-md py-2 pl-3 pr-8 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover`,St=`z-70 max-h-[min(32rem,calc(100dvh-2rem))] min-w-52 overflow-y-auto rounded-xl border border-edge bg-surface-overlay p-1.5 shadow-popover`;function Ct(e){let t=(0,at.c)(4),{value:n,children:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsx)(xe,{className:`absolute right-2.5`,children:(0,$.jsx)(S,{className:`size-3.5`,"aria-hidden":!0})}),t[0]=i):i=t[0];let a;return t[1]!==r||t[2]!==n?(a=(0,$.jsxs)(ve,{value:n,className:xt,children:[i,r]}),t[1]=r,t[2]=n,t[3]=a):a=t[3],a}function wt(e){let t=(0,at.c)(134),{language:n,labels:r,filter:i,ownership:a,source:o,projectId:s,projects:c,projectLocked:l,query:u,unreadCount:d,markReadBusy:f,onFilter:p,onOwnership:m,onSource:h,onProject:g,onQuery:_,onClear:v,onMarkAllRead:y}=e,b=n===`zh`,[x,S]=(0,Q.useState)(!1),C=(0,Q.useRef)(null),T=(0,Q.useRef)(null),E=x||!!u,D=i!==`all`||o!==`all`||a!==`user`||!l&&!!s,ee;t[0]===_?ee=t[1]:(ee=()=>{_(``),S(!1),T.current?.focus()},t[0]=_,t[1]=ee);let O=ee,k=b?`定时任务`:`Scheduled tasks`,A;t[2]===k?A=t[3]:(A=(0,$.jsx)(`h2`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:k}),t[2]=k,t[3]=A);let j=b?`筛选任务`:`Filter tasks`,N=b?`筛选任务`:`Filter tasks`,P=D&&`text-accent-fg`,F;t[4]===P?F=t[5]:(F=ue(`relative rounded-md p-2 text-fg-muted hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent data-[state=open]:bg-surface-hover`,P),t[4]=P,t[5]=F);let te;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,$.jsx)(M,{className:`size-4`,"aria-hidden":!0}),t[6]=te):te=t[6];let I;t[7]!==D||t[8]!==b?(I=D?(0,$.jsx)(`span`,{className:`absolute right-1.5 top-1.5 size-1 rounded-full bg-accent`,children:(0,$.jsx)(`span`,{className:`sr-only`,children:b?`已应用筛选`:`Filters applied`})}):null,t[7]=D,t[8]=b,t[9]=I):I=t[9];let L;t[10]!==j||t[11]!==N||t[12]!==F||t[13]!==I?(L=(0,$.jsx)(Ce,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,"aria-label":j,title:N,className:F,children:[te,I]})}),t[10]=j,t[11]=N,t[12]=F,t[13]=I,t[14]=L):L=t[14];let ne=b?`状态`:`Status`,re;t[15]===ne?re=t[16]:(re=(0,$.jsx)(_e,{className:`px-3 py-1.5 text-xs text-fg-subtle`,children:ne}),t[15]=ne,t[16]=re);let ie;t[17]===p?ie=t[18]:(ie=e=>p(e),t[17]=p,t[18]=ie);let R=b?`全部状态`:`All statuses`,z;t[19]===R?z=t[20]:(z=(0,$.jsx)(Ct,{value:`all`,children:R}),t[19]=R,t[20]=z);let oe;t[21]===r.filters.active?oe=t[22]:(oe=(0,$.jsx)(Ct,{value:`active`,children:r.filters.active}),t[21]=r.filters.active,t[22]=oe);let se;t[23]===r.paused?se=t[24]:(se=(0,$.jsx)(Ct,{value:`paused`,children:r.paused}),t[23]=r.paused,t[24]=se);let ce=b?`已完成`:`Completed`,B;t[25]===ce?B=t[26]:(B=(0,$.jsx)(Ct,{value:`completed`,children:ce}),t[25]=ce,t[26]=B);let V;t[27]===r.metrics.running?V=t[28]:(V=(0,$.jsx)(Ct,{value:`running`,children:r.metrics.running}),t[27]=r.metrics.running,t[28]=V);let H;t[29]===r.dashboard.needsAttention?H=t[30]:(H=(0,$.jsx)(Ct,{value:`attention`,children:r.dashboard.needsAttention}),t[29]=r.dashboard.needsAttention,t[30]=H);let de;t[31]!==i||t[32]!==ie||t[33]!==z||t[34]!==oe||t[35]!==se||t[36]!==B||t[37]!==V||t[38]!==H?(de=(0,$.jsxs)(Ee,{value:i,onValueChange:ie,children:[z,oe,se,B,V,H]}),t[31]=i,t[32]=ie,t[33]=z,t[34]=oe,t[35]=se,t[36]=B,t[37]=V,t[38]=H,t[39]=de):de=t[39];let fe;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(fe=(0,$.jsx)(Y,{className:`my-1 border-t border-edge`}),t[40]=fe):fe=t[40];let U=b?`归属`:`Owner`,W;t[41]===U?W=t[42]:(W=(0,$.jsx)(_e,{className:`px-3 py-1.5 text-xs text-fg-subtle`,children:U}),t[41]=U,t[42]=W);let pe;t[43]===m?pe=t[44]:(pe=e=>m(e),t[43]=m,t[44]=pe);let me=b?`我的任务`:`My tasks`,G;t[45]===me?G=t[46]:(G=(0,$.jsx)(Ct,{value:`user`,children:me}),t[45]=me,t[46]=G);let he=b?`系统任务`:`System tasks`,K;t[47]===he?K=t[48]:(K=(0,$.jsx)(Ct,{value:`system`,children:he}),t[47]=he,t[48]=K);let q;t[49]!==a||t[50]!==pe||t[51]!==G||t[52]!==K?(q=(0,$.jsxs)(Ee,{value:a,onValueChange:pe,children:[G,K]}),t[49]=a,t[50]=pe,t[51]=G,t[52]=K,t[53]=q):q=t[53];let ge;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,$.jsx)(Y,{className:`my-1 border-t border-edge`}),t[54]=ge):ge=t[54];let ve;t[55]!==r.filters.allProjects||t[56]!==g||t[57]!==s||t[58]!==l||t[59]!==c||t[60]!==b?(ve=l?null:(0,$.jsxs)(ye,{children:[(0,$.jsxs)(Te,{className:`flex min-h-9 cursor-pointer items-center justify-between gap-4 rounded-md px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover`,children:[b?`项目`:`Project`,(0,$.jsx)(`span`,{className:`ml-auto max-w-28 truncate text-xs text-fg-muted`,children:c.find(e=>e.id===s)?.name??r.filters.allProjects}),(0,$.jsx)(w,{className:`size-3.5 text-fg-subtle`,"aria-hidden":!0})]}),(0,$.jsx)(we,{children:(0,$.jsx)(be,{sideOffset:4,className:St,children:(0,$.jsxs)(Ee,{value:s,onValueChange:g,children:[(0,$.jsx)(Ct,{value:``,children:r.filters.allProjects}),c.map(Tt)]})})})]}),t[55]=r.filters.allProjects,t[56]=g,t[57]=s,t[58]=l,t[59]=c,t[60]=b,t[61]=ve):ve=t[61];let xe=b?`任务类型`:`Task type`,Oe;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=(0,$.jsx)(w,{className:`size-3.5 text-fg-subtle`,"aria-hidden":!0}),t[62]=Oe):Oe=t[62];let X;t[63]===xe?X=t[64]:(X=(0,$.jsxs)(Te,{className:`flex min-h-9 cursor-pointer items-center justify-between gap-4 rounded-md px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover`,children:[xe,Oe]}),t[63]=xe,t[64]=X);let ke;t[65]===h?ke=t[66]:(ke=e=>h(e),t[65]=h,t[66]=ke);let Z=b?`全部类型`:`All types`,Ae;t[67]===Z?Ae=t[68]:(Ae=(0,$.jsx)(Ct,{value:`all`,children:Z}),t[67]=Z,t[68]=Ae);let je;t[69]===r.sources.agent?je=t[70]:(je=(0,$.jsx)(Ct,{value:`agent`,children:r.sources.agent}),t[69]=r.sources.agent,t[70]=je);let Me;t[71]===r.sources.task?Me=t[72]:(Me=(0,$.jsx)(Ct,{value:`task_command`,children:r.sources.task}),t[71]=r.sources.task,t[72]=Me);let Ne;t[73]===r.sources.browser?Ne=t[74]:(Ne=(0,$.jsx)(Ct,{value:`browser_automation`,children:r.sources.browser}),t[73]=r.sources.browser,t[74]=Ne);let Pe;t[75]!==o||t[76]!==ke||t[77]!==Ae||t[78]!==je||t[79]!==Me||t[80]!==Ne?(Pe=(0,$.jsx)(we,{children:(0,$.jsx)(be,{sideOffset:4,className:St,children:(0,$.jsxs)(Ee,{value:o,onValueChange:ke,children:[Ae,je,Me,Ne]})})}),t[75]=o,t[76]=ke,t[77]=Ae,t[78]=je,t[79]=Me,t[80]=Ne,t[81]=Pe):Pe=t[81];let Fe;t[82]!==X||t[83]!==Pe?(Fe=(0,$.jsxs)(ye,{children:[X,Pe]}),t[82]=X,t[83]=Pe,t[84]=Fe):Fe=t[84];let Ie;t[85]!==D||t[86]!==v||t[87]!==u||t[88]!==b?(Ie=D||u?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Y,{className:`my-1 border-t border-edge`}),(0,$.jsx)(J,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-fg-muted outline-none data-[highlighted]:bg-surface-hover`,onSelect:v,children:b?`重置筛选`:`Reset filters`})]}):null,t[85]=D,t[86]=v,t[87]=u,t[88]=b,t[89]=Ie):Ie=t[89];let Le;t[90]!==r.filters.markAllRead||t[91]!==f||t[92]!==y||t[93]!==d?(Le=d>0?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Y,{className:`my-1 border-t border-edge`}),(0,$.jsx)(J,{disabled:f,className:`cursor-pointer rounded-md px-3 py-2 text-sm text-fg-muted outline-none data-[highlighted]:bg-surface-hover data-[disabled]:opacity-50`,onSelect:y,children:r.filters.markAllRead})]}):null,t[90]=r.filters.markAllRead,t[91]=f,t[92]=y,t[93]=d,t[94]=Le):Le=t[94];let Re;t[95]!==re||t[96]!==de||t[97]!==W||t[98]!==q||t[99]!==ve||t[100]!==Fe||t[101]!==Ie||t[102]!==Le?(Re=(0,$.jsx)(we,{children:(0,$.jsxs)(De,{align:`end`,sideOffset:6,className:St,children:[re,de,fe,W,q,ge,ve,Fe,Ie,Le]})}),t[95]=re,t[96]=de,t[97]=W,t[98]=q,t[99]=ve,t[100]=Fe,t[101]=Ie,t[102]=Le,t[103]=Re):Re=t[103];let ze;t[104]!==L||t[105]!==Re?(ze=(0,$.jsxs)(Se,{children:[L,Re]}),t[104]=L,t[105]=Re,t[106]=ze):ze=t[106];let Be=b?`搜索任务`:`Search tasks`,Ve=b?`搜索任务`:`Search tasks`,He;t[107]!==O||t[108]!==E?(He=()=>{E?O():(S(!0),requestAnimationFrame(()=>C.current?.focus()))},t[107]=O,t[108]=E,t[109]=He):He=t[109];let Ue=E&&`bg-surface-hover text-fg`,We;t[110]===Ue?We=t[111]:(We=ue(`rounded-md p-2 text-fg-muted hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,Ue),t[110]=Ue,t[111]=We);let Ge;t[112]===Symbol.for(`react.memo_cache_sentinel`)?(Ge=(0,$.jsx)(ae,{className:`size-4`,"aria-hidden":!0}),t[112]=Ge):Ge=t[112];let Ke;t[113]!==E||t[114]!==Be||t[115]!==Ve||t[116]!==He||t[117]!==We?(Ke=(0,$.jsx)(`button`,{ref:T,type:`button`,"aria-label":Be,title:Ve,"aria-expanded":E,onClick:He,className:We,children:Ge}),t[113]=E,t[114]=Be,t[115]=Ve,t[116]=He,t[117]=We,t[118]=Ke):Ke=t[118];let qe;t[119]!==ze||t[120]!==Ke?(qe=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5`,children:[ze,Ke]}),t[119]=ze,t[120]=Ke,t[121]=qe):qe=t[121];let Je;t[122]!==A||t[123]!==qe?(Je=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-1`,children:[A,qe]}),t[122]=A,t[123]=qe,t[124]=Je):Je=t[124];let Ye;t[125]!==O||t[126]!==_||t[127]!==u||t[128]!==E||t[129]!==b?(Ye=E?(0,$.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-edge bg-surface-panel px-2.5 focus-within:border-accent`,children:[(0,$.jsx)(ae,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,$.jsx)(`input`,{ref:C,value:u,onChange:e=>_(e.target.value),onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),O())},"aria-label":b?`搜索任务名称或内容`:`Search task names or content`,placeholder:b?`搜索任务…`:`Search tasks…`,className:`min-h-10 min-w-0 flex-1 bg-transparent text-sm text-fg outline-none placeholder:text-fg-subtle`}),(0,$.jsx)(`button`,{type:`button`,"aria-label":b?`关闭搜索`:`Close search`,onClick:O,className:`rounded-md p-1 text-fg-muted hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,children:(0,$.jsx)(le,{className:`size-3.5`,"aria-hidden":!0})})]}):null,t[125]=O,t[126]=_,t[127]=u,t[128]=E,t[129]=b,t[130]=Ye):Ye=t[130];let Xe;return t[131]!==Je||t[132]!==Ye?(Xe=(0,$.jsxs)(`div`,{className:`space-y-2`,children:[Je,Ye]}),t[131]=Je,t[132]=Ye,t[133]=Xe):Xe=t[133],Xe}function Tt(e){return(0,$.jsx)(Ct,{value:e.id,children:(0,$.jsx)(`span`,{className:`max-w-56 truncate`,children:e.name})},e.id)}var Et=[[`☀️`,`晨间简报`,`每天开始工作前,整理今天值得关注的任务与进展。`,`Morning briefing`,`Start each day with your tasks and project updates.`,`每天早上帮我整理当天到期、逾期的任务和项目进展,给出今天的重点。`,`Each morning, summarize my due and overdue tasks and project progress, and suggest priorities.`],[`📝`,`每周工作回顾`,`回顾一周的成果和问题,为下周留出清晰的方向。`,`Weekly review`,`Review the week and find a clear direction for the next.`,`每周五帮我回顾本周完成的任务和项目进展,整理未解决的问题,建议下周的重点。`,`Every Friday, review completed tasks and project progress, unresolved issues, and priorities for next week.`],[`🌱`,`项目进展跟进`,`定期看看项目进度,找出需要你关注的事情。`,`Project check-in`,`Keep an eye on project progress and what needs attention.`,`定期帮我检查项目进度,整理延期、阻塞和需要我决策的事项。先和我确认关注哪个项目以及运行时间。`,`Regularly review a project for delays, blockers, and decisions I need to make. Ask which project and when to run.`],[`🔔`,`重要事项提醒`,`把容易忘记的事情交给提醒,安心专注眼前。`,`A timely reminder`,`Make room to focus by setting a reminder for later.`,`我想安排一个重要事项提醒。请先问我需要提醒什么、什么时候提醒,以及是否重复。`,`Help me schedule a reminder. Ask what to remember, when, and whether it should repeat.`],[`📚`,`笔记整理`,`回看新收集的想法,整理出值得继续推进的线索。`,`Notes roundup`,`Revisit recent ideas and surface useful next steps.`,`每周帮我回顾最近新增的笔记,按主题整理,找出值得继续推进的想法。请先确认时间和范围。`,`Each week, group my recent notes by topic and suggest ideas worth pursuing. Confirm the schedule and scope.`],[`🧭`,`明日工作计划`,`下班前梳理未完成的事,安排明天最重要的三件事。`,`Plan tomorrow`,`Wrap up loose ends and choose tomorrow’s top three priorities.`,`每个工作日下班前,帮我梳理未完成的任务,建议明天最重要的三件事。请先确认具体时间。`,`Before the end of each workday, review unfinished tasks and suggest tomorrow’s top three priorities. Confirm the time.`],[`🗓️`,`月度复盘`,`拉远一点看进展,发现反复出现的问题和新的机会。`,`Monthly reflection`,`Step back to spot progress, recurring problems, and opportunities.`,`每月月底帮我回顾项目和任务的进展,总结成果、反复出现的问题和下个月的重点。请确认运行时间。`,`At the end of each month, review project and task progress, achievements, recurring problems, and priorities. Confirm the schedule.`],[`🎯`,`逾期任务检查`,`定期发现被搁置的事项,让重要的事重新向前。`,`Overdue task check`,`Find neglected tasks and get important work moving again.`,`定期帮我检查逾期任务,按紧迫程度整理,并建议下一步。请先确认运行频率和时间。`,`Regularly review overdue tasks, prioritize them by urgency, and suggest next steps. Confirm the frequency and time.`]];function Dt(e=Math.random){let t=[...Et];for(let n=t.length-1;n>0;n--){let r=Math.min(n,Math.max(0,Math.floor(e()*(n+1))));[t[n],t[r]]=[t[r],t[n]]}return t.slice(0,6)}function Ot({language:e,projectId:t,onOpenConversation:n}){let r=s(),[i,a]=(0,Q.useState)(!1),[o,c]=(0,Q.useState)(``),l=async e=>{a(!0),c(``);try{let i=await He({projectId:t,prompt:e});n?n(i):r(i)}catch(e){c(e instanceof Error?e.message:String(e))}finally{a(!1)}},u=e===`zh`,[d,f]=(0,Q.useState)(Dt),p=(0,$.jsxs)(`div`,{className:`mx-auto w-full max-w-3xl px-2 py-10 sm:px-6 md:py-20`,children:[(0,$.jsxs)(`div`,{className:`text-center`,children:[(0,$.jsx)(x,{className:`mx-auto size-10 text-fg-muted`,strokeWidth:1.3,"aria-hidden":!0}),(0,$.jsx)(`h2`,{className:`mt-4 text-xl font-semibold tracking-tight text-fg`,children:u?`安排任务`:`Schedule a task`}),(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:u?`说说你希望定期完成什么,我们一起安排好。`:`Tell us what you’d like done regularly. We’ll work out the details together.`})]}),(0,$.jsxs)(`div`,{className:`mb-3 mt-10 flex items-center justify-between text-xs text-fg-muted`,children:[(0,$.jsx)(`span`,{children:u?`也可以从这些想法开始`:`Or start with an idea`}),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>f(Dt()),className:`flex items-center gap-1.5 rounded-md px-2 py-1.5 hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,$.jsx)(R,{className:`size-3.5`,"aria-hidden":!0}),u?`换一组`:`More ideas`]})]}),(0,$.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:d.map(e=>(0,$.jsxs)(`button`,{type:`button`,disabled:i,onClick:()=>void l(u?e[5]:e[6]),className:`flex min-h-28 items-center gap-4 rounded-xl border border-dashed border-edge bg-surface-panel px-5 py-4 transition-colors hover:border-edge-strong hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,$.jsx)(`span`,{className:`shrink-0 text-2xl`,"aria-hidden":!0,children:e[0]}),(0,$.jsxs)(`span`,{className:`min-w-0`,children:[(0,$.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:u?e[1]:e[3]}),(0,$.jsx)(`span`,{className:`mt-1 block text-sm leading-5 text-fg-muted`,children:u?e[2]:e[4]})]})]},e[1]))}),(0,$.jsx)(`div`,{className:`mt-6 text-center`,children:(0,$.jsx)(`button`,{type:`button`,disabled:i,onClick:()=>void l(),className:`rounded-md px-3 py-2 text-sm text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:ring-2 focus-visible:ring-accent`,children:u?`说说你想安排的其他任务`:`Describe another task`})}),o?(0,$.jsx)(`p`,{role:`alert`,className:`mt-3 text-center text-sm text-danger`,children:o}):null]});return(0,$.jsx)(`section`,{"aria-label":u?`安排任务`:`Schedule a task`,children:p})}function kt(e){if(!e.trim())return null;try{return JSON.parse(e)}catch{return null}}function At(e){return typeof e.message==`string`&&e.message.trim()?e.message:typeof e.error==`string`&&e.error.trim()?e.error:e.error&&typeof e.error==`object`&&typeof e.error.message==`string`?e.error.message:`AI suggestion failed`}function jt(e,t={}){let n=kt(e.split(`
3
3
  `).filter(e=>e.startsWith(`data:`)).map(e=>e.slice(5).trimStart()).join(`
4
4
  `));if(!n)return null;if(n.type===`text_delta`&&typeof n.delta==`string`)return t.onDelta?.(n.delta),null;if(n.type===`thinking_delta`&&typeof n.delta==`string`)return t.onThinkingDelta?.(n.delta),null;if(n.type===`done`&&typeof n.text==`string`)return n.text;if(n.type===`error`)throw Error(At(n));return null}async function Mt(e,t={}){let n=await c(l(`/api/ai/text-assist`),{method:`POST`,headers:{Accept:`text/event-stream`},body:JSON.stringify(e)});if(!n.ok){let e=await n.json().catch(()=>({})),t=typeof e.error==`string`?e.error:e.error?.message;throw Error(t||`AI suggestion failed (${n.status})`)}if(!n.body){let e=await n.json().catch(()=>null);if(e?.text)return e;throw Error(`AI suggestion stream is empty`)}let r=n.body.getReader(),i=new TextDecoder,a=``,o=``,s=``;for(;;){let{done:e,value:n}=await r.read();if(n){a+=i.decode(n,{stream:!e});let r=a.split(/\r?\n\r?\n/);a=r.pop()??``;for(let e of r){let n=jt(e,{onDelta:e=>{o+=e,t.onDelta?.(e)},onThinkingDelta:e=>{s+=e,t.onThinkingDelta?.(e)}});n!==null&&(o=n)}}if(e)break}if(a.trim()){let e=jt(a,{onDelta:e=>{o+=e,t.onDelta?.(e)},onThinkingDelta:e=>{s+=e,t.onThinkingDelta?.(e)}});e!==null&&(o=e)}let u=o.trim();if(!u)throw Error(`AI returned an empty suggestion`);return{text:u,thinking:s.trim()||void 0}}function Nt(){let[e,t]=(0,Q.useState)(``),[n,r]=(0,Q.useState)(``),[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(null);return{suggestion:e,thinking:n,loading:i,error:o,generate:(0,Q.useCallback)(async e=>{a(!0),s(null),t(``),r(``);try{let n=await Mt(e,{onDelta:e=>{t(t=>t+e)},onThinkingDelta:e=>{r(t=>t+e)}});return t(n.text),r(n.thinking??``),n.text}catch(e){let t=e instanceof Error?e.message:`AI suggestion failed`;return s(t),null}finally{a(!1)}},[]),reset:(0,Q.useCallback)(()=>{t(``),r(``),s(null),a(!1)},[])}}var Pt=5;function Ft(e){return e.startsWith(`zh`)?{title:`AI 优化文案`,buttonTitle:`优化文案`,current:`当前内容`,suggestion:`AI 建议`,editedSuggestion:`审核并编辑建议`,thinking:`模型思考`,thinkingLoading:`思考中`,edit:`编辑`,preview:`预览`,loading:`正在生成建议...`,empty:`暂无内容`,generate:`生成建议`,regenerate:`重新生成`,applyCurrent:`应用当前内容`,replace:`替换`,append:`追加`,cancel:`取消`,close:`关闭`}:{title:`AI text assist`,buttonTitle:`Improve text`,current:`Current`,suggestion:`Suggestion`,editedSuggestion:`Review and edit suggestion`,thinking:`Model thinking`,thinkingLoading:`Thinking`,edit:`Edit`,preview:`Preview`,loading:`Generating suggestion...`,empty:`No content`,generate:`Generate suggestion`,regenerate:`Regenerate`,applyCurrent:`Apply current`,replace:`Replace`,append:`Append`,cancel:`Cancel`,close:`Close`}}function It(e){let t=(0,at.c)(245),{value:n,onApply:r,fieldId:i,fieldLabel:a,scenario:o,format:s,intent:c,locale:l,context:u,disabled:d,className:f,showLabel:y}=e,b=o===void 0?`generic.text`:o,x=s===void 0?`plain`:s,S=c===void 0?`improve`:c,w=y===void 0||y,[T,E]=(0,Q.useState)(!1),[D,ee]=(0,Q.useState)(n),[O,k]=(0,Q.useState)(`preview`),[j,M]=(0,Q.useState)(``),[N,P]=(0,Q.useState)(`edit`),[F,I]=(0,Q.useState)(!0),[L,ne]=(0,Q.useState)(!1),[re,ie]=(0,Q.useState)(null),ae=(0,Q.useRef)(null),z=(0,Q.useRef)(!0),{suggestion:ce,thinking:B,loading:V,error:H,generate:de,reset:fe}=Nt(),U;t[0]===l?U=t[1]:(U=Ft(l),t[0]=l,t[1]=U);let W=U,pe;t[2]!==V||t[3]!==B?(pe=V&&B.trim().length>0,t[2]=V,t[3]=B,t[4]=pe):pe=t[4];let me=pe,he,K;t[5]!==T||t[6]!==n?(he=()=>{T||ee(n)},K=[T,n],t[5]=T,t[6]=n,t[7]=he,t[8]=K):(he=t[7],K=t[8]),(0,Q.useEffect)(he,K);let ge,_e;t[9]===ce?(ge=t[10],_e=t[11]):(_e=()=>{M(ce)},ge=[ce],t[9]=ce,t[10]=ge,t[11]=_e),(0,Q.useEffect)(_e,ge);let ve,ye;t[12]===B?(ve=t[13],ye=t[14]):(ve=()=>{B.trim()&&I(!0)},ye=[B],t[12]=B,t[13]=ve,t[14]=ye),(0,Q.useEffect)(ve,ye);let be;t[15]!==me||t[16]!==F?(be=()=>{let e=ae.current;!e||!me||!F||z.current&&(e.scrollTop=e.scrollHeight)},t[15]=me,t[16]=F,t[17]=be):be=t[17];let xe;t[18]!==me||t[19]!==B||t[20]!==F?(xe=[me,B,F],t[18]=me,t[19]=B,t[20]=F,t[21]=xe):xe=t[21],(0,Q.useLayoutEffect)(be,xe);let Se;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(Se=()=>{let e=ae.current;if(!e)return;let t=e.scrollHeight-e.scrollTop-e.clientHeight;z.current=t<=Pt},t[22]=Se):Se=t[22];let Ce=Se,we;t[23]!==u||t[24]!==i||t[25]!==a||t[26]!==x||t[27]!==de||t[28]!==S||t[29]!==l||t[30]!==b?(we=async e=>{P(`edit`),I(!0),z.current=!0,await de({intent:S,scenario:b,input:e,locale:l,field:{id:i,label:a,format:x},context:u})},t[23]=u,t[24]=i,t[25]=a,t[26]=x,t[27]=de,t[28]=S,t[29]=l,t[30]=b,t[31]=we):we=t[31];let Te=we,J;t[32]!==fe||t[33]!==n?(J=e=>{ne(!!e.currentTarget.closest(`[role="dialog"]`)),ie(document.querySelector(`.app-main-surface`)),ee(n),k(`preview`),M(``),P(`edit`),I(!0),fe(),E(!0)},t[32]=fe,t[33]=n,t[34]=J):J=t[34];let Ee=J,De;t[35]!==D||t[36]!==Te?(De=async()=>{await Te(D)},t[35]=D,t[36]=Te,t[37]=De):De=t[37];let Y=De,Oe;t[38]!==fe||t[39]!==n?(Oe=()=>{E(!1),ee(n),k(`preview`),M(``),P(`edit`),I(!0),fe()},t[38]=fe,t[39]=n,t[40]=Oe):Oe=t[40];let X=Oe,ke;t[41]!==X||t[42]!==D||t[43]!==r?(ke=()=>{r(D),X()},t[41]=X,t[42]=D,t[43]=r,t[44]=ke):ke=t[44];let Z=ke,Ae;t[45]!==X||t[46]!==j||t[47]!==r?(Ae=()=>{j.trim()&&(r(j),X())},t[45]=X,t[46]=j,t[47]=r,t[48]=Ae):Ae=t[48];let je=Ae,Me;t[49]!==X||t[50]!==D||t[51]!==j||t[52]!==r?(Me=()=>{if(!j.trim())return;let e=D.trimEnd();r(e?`${e}\n\n${j}`:j),X()},t[49]=X,t[50]=D,t[51]=j,t[52]=r,t[53]=Me):Me=t[53];let Ne=Me,Pe;t[54]!==j||t[55]!==H||t[56]!==V?(Pe=!V&&!H&&j.trim().length>0,t[54]=j,t[55]=H,t[56]=V,t[57]=Pe):Pe=t[57];let Fe=Pe,Ie=D!==n,Le;t[58]!==j||t[59]!==H||t[60]!==B?(Le=j.trim().length>0||B.trim().length>0||!!H,t[58]=j,t[59]=H,t[60]=B,t[61]=Le):Le=t[61];let Re=Le,ze=!w&&`size-7 p-0`,Be;t[62]!==f||t[63]!==ze?(Be=ue(`h-7 gap-1 px-2 text-xs`,ze,f),t[62]=f,t[63]=ze,t[64]=Be):Be=t[64];let Ve=d||V,He;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(He=(0,$.jsx)(oe,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[65]=He):He=t[65];let Ue=w?W.buttonTitle:null,We;t[66]!==W.buttonTitle||t[67]!==Ee||t[68]!==Be||t[69]!==Ve||t[70]!==Ue?(We=(0,$.jsxs)(G,{type:`button`,variant:`ghost`,className:Be,title:W.buttonTitle,"aria-label":W.buttonTitle,disabled:Ve,onClick:Ee,children:[He,Ue]}),t[66]=W.buttonTitle,t[67]=Ee,t[68]=Be,t[69]=Ve,t[70]=Ue,t[71]=We):We=t[71];let Ge;t[72]===X?Ge=t[73]:(Ge=e=>e?E(!0):X(),t[72]=X,t[73]=Ge);let Ke=re??void 0,qe=L?`bg-transparent`:`bg-scrim`,Je;t[74]===qe?Je=t[75]:(Je=ue(`xopc-dialog-overlay absolute inset-0 z-[80]`,qe),t[74]=qe,t[75]=Je);let Ye;t[76]===Je?Ye=t[77]:(Ye=(0,$.jsx)(p,{className:Je}),t[76]=Je,t[77]=Ye);let Xe;t[78]===W.title?Xe=t[79]:(Xe=(0,$.jsx)(_,{className:`text-base font-semibold text-fg`,children:W.title}),t[78]=W.title,t[79]=Xe);let Ze;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(Ze=(0,$.jsx)(le,{className:`size-5`,strokeWidth:1.75}),t[80]=Ze):Ze=t[80];let Qe;t[81]===W.close?Qe=t[82]:(Qe=(0,$.jsx)(m,{asChild:!0,children:(0,$.jsx)(G,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":W.close,children:Ze})}),t[81]=W.close,t[82]=Qe);let $e;t[83]!==Xe||t[84]!==Qe?($e=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[Xe,Qe]}),t[83]=Xe,t[84]=Qe,t[85]=$e):$e=t[85];let et;t[86]===W.current?et=t[87]:(et=(0,$.jsx)(`div`,{className:`min-w-0 text-xs font-medium text-fg-muted`,children:W.current}),t[86]=W.current,t[87]=et);let tt=W.current,nt=O===`edit`,rt=O===`edit`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,it;t[88]===rt?it=t[89]:(it=ue(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,rt),t[88]=rt,t[89]=it);let ot,st;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(ot=()=>k(`edit`),st=(0,$.jsx)(se,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[90]=ot,t[91]=st):(ot=t[90],st=t[91]);let ct;t[92]!==W.edit||t[93]!==nt||t[94]!==it?(ct=(0,$.jsxs)(`button`,{"aria-pressed":nt,type:`button`,className:it,onClick:ot,children:[st,W.edit]}),t[92]=W.edit,t[93]=nt,t[94]=it,t[95]=ct):ct=t[95];let lt=O===`preview`,ut=O===`preview`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,dt;t[96]===ut?dt=t[97]:(dt=ue(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,ut),t[96]=ut,t[97]=dt);let ft,pt;t[98]===Symbol.for(`react.memo_cache_sentinel`)?(ft=()=>k(`preview`),pt=(0,$.jsx)(A,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[98]=ft,t[99]=pt):(ft=t[98],pt=t[99]);let mt;t[100]!==W.preview||t[101]!==lt||t[102]!==dt?(mt=(0,$.jsxs)(`button`,{"aria-pressed":lt,type:`button`,className:dt,onClick:ft,children:[pt,W.preview]}),t[100]=W.preview,t[101]=lt,t[102]=dt,t[103]=mt):mt=t[103];let ht;t[104]!==W.current||t[105]!==ct||t[106]!==mt?(ht=(0,$.jsxs)(q,{className:`flex shrink-0 items-center gap-1 rounded-lg border border-edge bg-surface-inset p-0.5`,role:`group`,"aria-label":tt,indicatorClassName:`rounded-md bg-surface-panel shadow-surface`,children:[ct,mt]}),t[104]=W.current,t[105]=ct,t[106]=mt,t[107]=ht):ht=t[107];let gt;t[108]!==et||t[109]!==ht?(gt=(0,$.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[et,ht]}),t[108]=et,t[109]=ht,t[110]=gt):gt=t[110];let _t;t[111]!==D||t[112]!==O||t[113]!==x||t[114]!==W.current||t[115]!==W.empty?(_t=O===`preview`?(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg`,children:x===`markdown`?(0,$.jsx)(te,{content:D||W.empty,compact:!0,className:`text-sm`}):(0,$.jsx)(`pre`,{className:`whitespace-pre-wrap text-sm leading-6 text-fg`,children:D||W.empty})}):(0,$.jsx)(`textarea`,{className:`min-h-0 flex-1 resize-none overflow-auto rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/25`,value:D,onChange:e=>ee(e.currentTarget.value),placeholder:W.empty,"aria-label":W.current}),t[111]=D,t[112]=O,t[113]=x,t[114]=W.current,t[115]=W.empty,t[116]=_t):_t=t[116];let vt;t[117]!==gt||t[118]!==_t?(vt=(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-col overflow-hidden`,children:[gt,_t]}),t[117]=gt,t[118]=_t,t[119]=vt):vt=t[119];let yt;t[120]===W.editedSuggestion?yt=t[121]:(yt=(0,$.jsx)(`span`,{children:W.editedSuggestion}),t[120]=W.editedSuggestion,t[121]=yt);let bt;t[122]!==W.loading||t[123]!==V?(bt=V?(0,$.jsx)(`span`,{className:`ml-2 font-normal`,children:W.loading}):null,t[122]=W.loading,t[123]=V,t[124]=bt):bt=t[124];let xt;t[125]!==yt||t[126]!==bt?(xt=(0,$.jsxs)(`div`,{className:`min-w-0 text-xs font-medium text-fg-muted`,children:[yt,bt]}),t[125]=yt,t[126]=bt,t[127]=xt):xt=t[127];let St=W.editedSuggestion,Ct=N===`edit`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,wt;t[128]===Ct?wt=t[129]:(wt=ue(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,Ct),t[128]=Ct,t[129]=wt);let Tt=N===`edit`,Et,Dt;t[130]===Symbol.for(`react.memo_cache_sentinel`)?(Et=()=>P(`edit`),Dt=(0,$.jsx)(se,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[130]=Et,t[131]=Dt):(Et=t[130],Dt=t[131]);let Ot;t[132]!==W.edit||t[133]!==wt||t[134]!==Tt?(Ot=(0,$.jsxs)(`button`,{type:`button`,className:wt,"aria-pressed":Tt,onClick:Et,children:[Dt,W.edit]}),t[132]=W.edit,t[133]=wt,t[134]=Tt,t[135]=Ot):Ot=t[135];let kt=N===`preview`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,At;t[136]===kt?At=t[137]:(At=ue(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,kt),t[136]=kt,t[137]=At);let jt=N===`preview`,Mt,It;t[138]===Symbol.for(`react.memo_cache_sentinel`)?(Mt=()=>P(`preview`),It=(0,$.jsx)(A,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[138]=Mt,t[139]=It):(Mt=t[138],It=t[139]);let zt;t[140]!==W.preview||t[141]!==At||t[142]!==jt?(zt=(0,$.jsxs)(`button`,{type:`button`,className:At,"aria-pressed":jt,onClick:Mt,children:[It,W.preview]}),t[140]=W.preview,t[141]=At,t[142]=jt,t[143]=zt):zt=t[143];let Bt;t[144]!==W.editedSuggestion||t[145]!==Ot||t[146]!==zt?(Bt=(0,$.jsxs)(q,{className:`flex shrink-0 items-center gap-1 rounded-lg border border-edge bg-surface-inset p-0.5`,role:`group`,"aria-label":St,indicatorClassName:`rounded-md bg-surface-panel shadow-surface`,children:[Ot,zt]}),t[144]=W.editedSuggestion,t[145]=Ot,t[146]=zt,t[147]=Bt):Bt=t[147];let Vt;t[148]!==xt||t[149]!==Bt?(Vt=(0,$.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[xt,Bt]}),t[148]=xt,t[149]=Bt,t[150]=Vt):Vt=t[150];let Ht=me?`opacity-100`:`pointer-events-none opacity-0`,Ut;t[151]===Ht?Ut=t[152]:(Ut=ue(`absolute inset-0 min-h-0 transition-opacity duration-200 ease-out motion-reduce:transition-none`,Ht),t[151]=Ht,t[152]=Ut);let Wt=!me,Gt;t[153]===Symbol.for(`react.memo_cache_sentinel`)?(Gt=()=>I(Lt),t[153]=Gt):Gt=t[153];let Kt;t[154]!==W.thinkingLoading||t[155]!==V?(Kt=V?(0,$.jsxs)(`span`,{className:`ml-1 font-normal`,children:[`· `,W.thinkingLoading]}):null,t[154]=W.thinkingLoading,t[155]=V,t[156]=Kt):Kt=t[156];let qt;t[157]!==W.thinking||t[158]!==Kt?(qt=(0,$.jsxs)(`span`,{className:`min-w-0 truncate`,children:[W.thinking,Kt]}),t[157]=W.thinking,t[158]=Kt,t[159]=qt):qt=t[159];let Jt=F&&`rotate-180`,Yt;t[160]===Jt?Yt=t[161]:(Yt=ue(`size-3.5 shrink-0 transition-transform`,Jt),t[160]=Jt,t[161]=Yt);let Xt;t[162]===Yt?Xt=t[163]:(Xt=(0,$.jsx)(C,{className:Yt,strokeWidth:1.75,"aria-hidden":!0}),t[162]=Yt,t[163]=Xt);let Zt;t[164]!==qt||t[165]!==Xt?(Zt=(0,$.jsxs)(`button`,{type:`button`,className:`flex shrink-0 items-center justify-between gap-2 px-2.5 py-2 text-left text-xs font-medium text-fg-muted hover:text-fg`,onClick:Gt,children:[qt,Xt]}),t[164]=qt,t[165]=Xt,t[166]=Zt):Zt=t[166];let Qt;t[167]!==B||t[168]!==F?(Qt=F?(0,$.jsx)(`pre`,{ref:ae,className:`min-h-0 flex-1 overflow-auto border-t border-edge px-2.5 py-2 whitespace-pre-wrap text-xs leading-5 text-fg-muted`,onScroll:Ce,children:B}):null,t[167]=B,t[168]=F,t[169]=Qt):Qt=t[169];let $t;t[170]!==Zt||t[171]!==Qt?($t=(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col rounded-lg border border-edge bg-surface-inset/70`,children:[Zt,Qt]}),t[170]=Zt,t[171]=Qt,t[172]=$t):$t=t[172];let en;t[173]!==Ut||t[174]!==Wt||t[175]!==$t?(en=(0,$.jsx)(`div`,{className:Ut,"aria-hidden":Wt,children:$t}),t[173]=Ut,t[174]=Wt,t[175]=$t,t[176]=en):en=t[176];let tn=me?`pointer-events-none opacity-0`:`opacity-100`,nn;t[177]===tn?nn=t[178]:(nn=ue(`absolute inset-0 min-h-0 transition-opacity duration-200 ease-out motion-reduce:transition-none`,tn),t[177]=tn,t[178]=nn);let rn;t[179]!==j||t[180]!==H||t[181]!==x||t[182]!==W.empty||t[183]!==W.loading||t[184]!==W.suggestion||t[185]!==V||t[186]!==N?(rn=H?(0,$.jsx)(`pre`,{className:`h-full min-h-0 overflow-auto whitespace-pre-wrap rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg-muted`,children:H}):N===`preview`?(0,$.jsx)(`div`,{className:`h-full min-h-0 overflow-auto rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg`,children:V&&!j.trim()?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:W.loading}):x===`markdown`?(0,$.jsx)(te,{content:j||W.empty,compact:!0,className:`text-sm`}):(0,$.jsx)(`pre`,{className:`whitespace-pre-wrap text-sm leading-6 text-fg`,children:j||W.empty})}):(0,$.jsx)(`textarea`,{className:`h-full min-h-0 w-full resize-none overflow-auto rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/25 disabled:text-fg-muted`,value:j,onChange:e=>M(e.currentTarget.value),disabled:V,placeholder:V?W.loading:W.empty,"aria-label":W.suggestion}),t[179]=j,t[180]=H,t[181]=x,t[182]=W.empty,t[183]=W.loading,t[184]=W.suggestion,t[185]=V,t[186]=N,t[187]=rn):rn=t[187];let an;t[188]!==nn||t[189]!==rn?(an=(0,$.jsx)(`div`,{className:nn,children:rn}),t[188]=nn,t[189]=rn,t[190]=an):an=t[190];let on;t[191]!==en||t[192]!==an?(on=(0,$.jsxs)(`div`,{className:`relative min-h-0 flex-1 overflow-hidden`,children:[en,an]}),t[191]=en,t[192]=an,t[193]=on):on=t[193];let sn;t[194]!==Vt||t[195]!==on?(sn=(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-col overflow-hidden`,children:[Vt,on]}),t[194]=Vt,t[195]=on,t[196]=sn):sn=t[196];let cn;t[197]!==vt||t[198]!==sn?(cn=(0,$.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-cols-1 gap-3 overflow-hidden p-4 md:grid-cols-2`,children:[vt,sn]}),t[197]=vt,t[198]=sn,t[199]=cn):cn=t[199];let ln;t[200]!==X||t[201]!==W.cancel?(ln=(0,$.jsx)(G,{type:`button`,variant:`secondary`,onClick:X,children:W.cancel}),t[200]=X,t[201]=W.cancel,t[202]=ln):ln=t[202];let un=!Ie,dn;t[203]!==Z||t[204]!==W.applyCurrent||t[205]!==un?(dn=(0,$.jsx)(G,{type:`button`,variant:`secondary`,disabled:un,onClick:Z,children:W.applyCurrent}),t[203]=Z,t[204]=W.applyCurrent,t[205]=un,t[206]=dn):dn=t[206];let fn;t[207]===Y?fn=t[208]:(fn=()=>void Y(),t[207]=Y,t[208]=fn);let pn;t[209]===Re?pn=t[210]:(pn=Re?(0,$.jsx)(R,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}):(0,$.jsx)(oe,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[209]=Re,t[210]=pn);let mn=Re?W.regenerate:W.generate,hn;t[211]!==V||t[212]!==pn||t[213]!==mn||t[214]!==fn?(hn=(0,$.jsxs)(G,{type:`button`,variant:`secondary`,disabled:V,onClick:fn,children:[pn,mn]}),t[211]=V,t[212]=pn,t[213]=mn,t[214]=fn,t[215]=hn):hn=t[215];let gn=!Fe,_n;t[216]!==Ne||t[217]!==W.append||t[218]!==gn?(_n=(0,$.jsx)(G,{type:`button`,variant:`secondary`,disabled:gn,onClick:Ne,children:W.append}),t[216]=Ne,t[217]=W.append,t[218]=gn,t[219]=_n):_n=t[219];let vn=!Fe,yn;t[220]!==je||t[221]!==W.replace||t[222]!==vn?(yn=(0,$.jsx)(G,{type:`button`,variant:`primary`,disabled:vn,onClick:je,children:W.replace}),t[220]=je,t[221]=W.replace,t[222]=vn,t[223]=yn):yn=t[223];let bn;t[224]!==hn||t[225]!==_n||t[226]!==yn||t[227]!==ln||t[228]!==dn?(bn=(0,$.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-4 py-3`,children:[ln,dn,hn,_n,yn]}),t[224]=hn,t[225]=_n,t[226]=yn,t[227]=ln,t[228]=dn,t[229]=bn):bn=t[229];let xn;t[230]!==bn||t[231]!==$e||t[232]!==cn?(xn=(0,$.jsx)(`div`,{className:`absolute inset-0 z-[80] flex items-center justify-center p-4 pointer-events-none`,children:(0,$.jsxs)(g,{className:`xopc-dialog-content-pane pointer-events-auto flex h-[min(78vh,38rem)] w-full max-w-4xl flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-popover outline-none`,onOpenAutoFocus:Rt,children:[$e,cn,bn]})}),t[230]=bn,t[231]=$e,t[232]=cn,t[233]=xn):xn=t[233];let Sn;t[234]!==xn||t[235]!==Ke||t[236]!==Ye?(Sn=(0,$.jsxs)(h,{container:Ke,children:[Ye,xn]}),t[234]=xn,t[235]=Ke,t[236]=Ye,t[237]=Sn):Sn=t[237];let Cn;t[238]!==T||t[239]!==Sn||t[240]!==Ge?(Cn=(0,$.jsx)(v,{open:T,onOpenChange:Ge,children:Sn}),t[238]=T,t[239]=Sn,t[240]=Ge,t[241]=Cn):Cn=t[241];let wn;return t[242]!==Cn||t[243]!==We?(wn=(0,$.jsxs)($.Fragment,{children:[We,Cn]}),t[242]=Cn,t[243]=We,t[244]=wn):wn=t[244],wn}function Lt(e){return!e}function Rt(e){return e.preventDefault()}function zt(e){return e.management!==void 0}function Bt(e){return[`reminder`,`brief`,`review`,`followUp`].map(t=>{let n=e.scenarios[t];return{...n,requiresProject:t===`followUp`,form:{...Pe,name:n.name,instruction:t===`reminder`?``:n.instruction,triggerMode:t===`reminder`?`once`:t===`review`?`weekly`:`daily`,time:t===`brief`?`08:30`:t===`review`?`17:00`:`09:00`,weekday:`5`,notificationPolicy:`all`}}})}var Vt=`w-full rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg focus-visible:outline-2 focus-visible:outline-accent`;function Ht(e){let t=(0,at.c)(99),{form:n,setForm:r,labels:i,projects:a,projectLocked:o,source:s,requiresProject:c}=e,l;t[0]===r?l=t[1]:(l=e=>r(t=>({...t,...e})),t[0]=r,t[1]=l);let u=l,d;t[2]!==i.experience.source||t[3]!==s?(d=(0,$.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[i.experience.source,`: `,s]}),t[2]=i.experience.source,t[3]=s,t[4]=d):d=t[4];let f;t[5]===u?f=t[6]:(f=e=>u({name:e.target.value}),t[5]=u,t[6]=f);let p;t[7]!==n.name||t[8]!==f?(p=(0,$.jsx)(`input`,{className:Vt,value:n.name,onChange:f}),t[7]=n.name,t[8]=f,t[9]=p):p=t[9];let m;t[10]!==i.form.name||t[11]!==p?(m=(0,$.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[i.form.name,p]}),t[10]=i.form.name,t[11]=p,t[12]=m):m=t[12];let h;t[13]===u?h=t[14]:(h=e=>u({instruction:e.target.value}),t[13]=u,t[14]=h);let g;t[15]!==n.instruction||t[16]!==h?(g=(0,$.jsx)(`textarea`,{className:Vt,rows:5,value:n.instruction,onChange:h}),t[15]=n.instruction,t[16]=h,t[17]=g):g=t[17];let _;t[18]!==i.info.task||t[19]!==g?(_=(0,$.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[i.info.task,g]}),t[18]=i.info.task,t[19]=g,t[20]=_):_=t[20];let v;t[21]!==n.projectId||t[22]!==i.form.noProject||t[23]!==i.form.project||t[24]!==o||t[25]!==a||t[26]!==u?(v=!o&&(0,$.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[i.form.project,(0,$.jsxs)(T,{className:Vt,value:n.projectId,onChange:e=>u({projectId:e.target.value}),children:[(0,$.jsx)(E,{value:``,children:i.form.noProject}),a.map(Ut)]})]}),t[21]=n.projectId,t[22]=i.form.noProject,t[23]=i.form.project,t[24]=o,t[25]=a,t[26]=u,t[27]=v):v=t[27];let y;t[28]!==n.projectId||t[29]!==i.experience.projectRequired||t[30]!==c?(y=c&&!n.projectId?(0,$.jsx)(`p`,{role:`status`,className:`text-sm text-fg-muted`,children:i.experience.projectRequired}):null,t[28]=n.projectId,t[29]=i.experience.projectRequired,t[30]=c,t[31]=y):y=t[31];let b;t[32]===u?b=t[33]:(b=e=>u({triggerMode:e.target.value}),t[32]=u,t[33]=b);let x;t[34]===i.trigger.once?x=t[35]:(x=(0,$.jsx)(E,{value:`once`,children:i.trigger.once}),t[34]=i.trigger.once,t[35]=x);let S;t[36]===i.trigger.daily?S=t[37]:(S=(0,$.jsx)(E,{value:`daily`,children:i.trigger.daily}),t[36]=i.trigger.daily,t[37]=S);let C;t[38]===i.trigger.weekly?C=t[39]:(C=(0,$.jsx)(E,{value:`weekly`,children:i.trigger.weekly}),t[38]=i.trigger.weekly,t[39]=C);let w;t[40]!==n.triggerMode||t[41]!==b||t[42]!==x||t[43]!==S||t[44]!==C?(w=(0,$.jsxs)(T,{className:Vt,value:n.triggerMode,onChange:b,children:[x,S,C]}),t[40]=n.triggerMode,t[41]=b,t[42]=x,t[43]=S,t[44]=C,t[45]=w):w=t[45];let D;t[46]!==i.form.trigger||t[47]!==w?(D=(0,$.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[i.form.trigger,w]}),t[46]=i.form.trigger,t[47]=w,t[48]=D):D=t[48];let ee;t[49]!==n.onceAt||t[50]!==n.time||t[51]!==n.triggerMode||t[52]!==i.form.onceAt||t[53]!==i.form.time||t[54]!==u?(ee=n.triggerMode===`once`?(0,$.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[i.form.onceAt,(0,$.jsx)(`input`,{type:`datetime-local`,className:Vt,value:n.onceAt,onChange:e=>u({onceAt:e.target.value})})]}):(0,$.jsxs)(`div`,{className:`grid gap-2 text-sm text-fg`,children:[(0,$.jsx)(`span`,{children:i.form.time}),(0,$.jsx)(qe,{value:n.time,onChange:e=>u({time:e}),ariaLabel:i.form.time})]}),t[49]=n.onceAt,t[50]=n.time,t[51]=n.triggerMode,t[52]=i.form.onceAt,t[53]=i.form.time,t[54]=u,t[55]=ee):ee=t[55];let O;t[56]!==n.triggerMode||t[57]!==n.weekday||t[58]!==i.form.day||t[59]!==i.weekdays||t[60]!==u?(O=n.triggerMode===`weekly`&&(0,$.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[i.form.day,(0,$.jsx)(T,{className:Vt,value:n.weekday,onChange:e=>u({weekday:e.target.value}),children:[`sunday`,`monday`,`tuesday`,`wednesday`,`thursday`,`friday`,`saturday`].map((e,t)=>(0,$.jsx)(E,{value:String(t),children:i.weekdays[e]},e))})]}),t[56]=n.triggerMode,t[57]=n.weekday,t[58]=i.form.day,t[59]=i.weekdays,t[60]=u,t[61]=O):O=t[61];let k;t[62]!==D||t[63]!==ee||t[64]!==O?(k=(0,$.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[D,ee,O]}),t[62]=D,t[63]=ee,t[64]=O,t[65]=k):k=t[65];let A;t[66]!==n.onceAt||t[67]!==n.triggerMode||t[68]!==i.experience.futureTime?(A=n.triggerMode===`once`&&n.onceAt&&new Date(n.onceAt).getTime()<=Date.now()?(0,$.jsx)(`p`,{role:`status`,className:`text-sm text-red-700 dark:text-red-300`,children:i.experience.futureTime}):null,t[66]=n.onceAt,t[67]=n.triggerMode,t[68]=i.experience.futureTime,t[69]=A):A=t[69];let j;t[70]===i.experience.scheduleNote?j=t[71]:(j=(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:i.experience.scheduleNote}),t[70]=i.experience.scheduleNote,t[71]=j);let M;t[72]===u?M=t[73]:(M=e=>u({notificationPolicy:e.target.value}),t[72]=u,t[73]=M);let N;t[74]===i.draft.notifyAll?N=t[75]:(N=(0,$.jsx)(E,{value:`all`,children:i.draft.notifyAll}),t[74]=i.draft.notifyAll,t[75]=N);let P;t[76]===i.draft.notifyAttention?P=t[77]:(P=(0,$.jsx)(E,{value:`attention`,children:i.draft.notifyAttention}),t[76]=i.draft.notifyAttention,t[77]=P);let F;t[78]===i.draft.notifyNone?F=t[79]:(F=(0,$.jsx)(E,{value:`none`,children:i.draft.notifyNone}),t[78]=i.draft.notifyNone,t[79]=F);let te;t[80]!==n.notificationPolicy||t[81]!==M||t[82]!==N||t[83]!==P||t[84]!==F?(te=(0,$.jsxs)(T,{className:Vt,value:n.notificationPolicy,onChange:M,children:[N,P,F]}),t[80]=n.notificationPolicy,t[81]=M,t[82]=N,t[83]=P,t[84]=F,t[85]=te):te=t[85];let I;t[86]!==i.draft.notifications||t[87]!==te?(I=(0,$.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[i.draft.notifications,te]}),t[86]=i.draft.notifications,t[87]=te,t[88]=I):I=t[88];let L;return t[89]!==y||t[90]!==k||t[91]!==d||t[92]!==A||t[93]!==j||t[94]!==I||t[95]!==m||t[96]!==_||t[97]!==v?(L=(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-5 overflow-y-auto px-5 py-4`,children:[d,m,_,v,y,k,A,j,I]}),t[89]=y,t[90]=k,t[91]=d,t[92]=A,t[93]=j,t[94]=I,t[95]=m,t[96]=_,t[97]=v,t[98]=L):L=t[98],L}function Ut(e){return(0,$.jsx)(E,{value:e.id,children:e.name},e.id)}var Wt=`xopc.automations.dismissedExecutionIssues`;function Gt(){if(typeof window>`u`)return{};try{let e=JSON.parse(window.localStorage.getItem(Wt)??`{}`);return!e||typeof e!=`object`||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(e=>typeof e[1]==`string`))}catch{return{}}}function Kt(e,t,n){return e?Ye(e,n):t.never}function qt(e,t){return e.kind===`system`?e.capability===`home.advisor.refresh`?`Home AI suggestions refresh`:e.capability===`memory.temporal_sweep`?`Memory temporal sweep`:e.capability===`memory.daily_reconciliation`?`Memory daily reconciliation`:`Memory weekly knowledge maintenance`:e.kind===`browser_automation`?`Browser automation: ${e.automationId}`:e.kind===`task_command`?t.action.taskWithId.replace(`{id}`,e.taskId):e.agentId?t.action.agentWithId.replace(`{id}`,e.agentId):t.action.agent}function Jt(e,t){return e===`browser_automation`?t.sources.browser:e===`task_command`?t.action.runTask:t.action.runAgent}function Yt(e){return e.safety?.mode??`auto_apply`}function Xt(e){return e===`succeeded`?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`failed`||e===`timeout`?`bg-red-500/10 text-red-700 dark:text-red-300`:e===`running`||e===`queued`||e===`cancelling`?`bg-blue-500/10 text-blue-700 dark:text-blue-300`:`bg-surface-hover text-fg-muted`}function Zt(e,t){if(e==null)return t.never;if(e<1e3)return`${e}ms`;let n=Math.round(e/1e3);return n<60?`${n}s`:`${Math.floor(n/60)}m ${n%60}s`}function Qt(e){return e.status===`running`||e.status===`queued`||e.status===`cancelling`}function $t(e){return e.status===`failed`||e.status===`timeout`}function en(e,t){return e.action.kind===`system`?qt(e.action,t):e.action.kind===`agent`?e.action.instruction:(e.action.kind,qt(e.action,t))}function tn(e){return e.description?.trim()??``}function nn(e){return Qt(e)?0:$t(e)?1:e.status===`succeeded`?2:3}function rn(e){return[...e].sort((e,t)=>{let n=nn(e)-nn(t);return n===0?t.createdAtMs-e.createdAtMs:n})}function an(){let e=(0,at.c)(6),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(`section`,{className:`grid grid-cols-2 gap-px overflow-hidden rounded-xl border border-edge-subtle bg-edge-subtle xl:grid-cols-4`,children:Array.from({length:4}).map(sn)}),e[0]=t):t=e[0];let n;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 space-y-2`,children:[(0,$.jsx)(V,{className:`h-4 w-36`}),(0,$.jsx)(V,{className:`h-3 w-56 max-w-full`})]}),(0,$.jsx)(V,{className:`h-7 w-20 rounded-full`})]}),e[1]=n):n=e[1];let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsxs)(`section`,{className:`rounded-xl bg-surface-panel p-4 shadow-surface`,children:[n,(0,$.jsx)(`div`,{className:`mt-4 grid gap-2`,children:Array.from({length:6}).map(on)})]}),e[2]=r):r=e[2];let i,a;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsx)(V,{className:`h-4 w-32`}),a=(0,$.jsx)(V,{className:`mt-4 h-24 rounded-lg`}),e[3]=i,e[4]=a):(i=e[3],a=e[4]);let o;return e[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4`,"aria-hidden":`true`,children:[t,(0,$.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-rows-[auto_minmax(0,1fr)] gap-3 md:grid-cols-[15rem_minmax(0,1fr)] md:grid-rows-1 lg:grid-cols-[17rem_minmax(0,1fr)]`,children:[r,(0,$.jsxs)(`section`,{className:`hidden rounded-xl bg-surface-panel p-4 shadow-surface xl:block`,children:[i,a,(0,$.jsxs)(`div`,{className:`mt-4 grid gap-2`,children:[(0,$.jsx)(V,{className:`h-12 rounded-lg`}),(0,$.jsx)(V,{className:`h-12 rounded-lg`}),(0,$.jsx)(V,{className:`h-12 rounded-lg`})]})]})]})]}),e[5]=o):o=e[5],o}function on(e,t){return(0,$.jsx)(`div`,{className:`rounded-lg bg-surface-base p-3`,children:(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(V,{className:`size-4 rounded-full`}),(0,$.jsx)(V,{className:`h-4 w-32`}),(0,$.jsx)(V,{className:`h-5 w-20 rounded-full`})]}),(0,$.jsx)(V,{className:`mt-3 h-4 w-full`}),(0,$.jsx)(V,{className:`mt-2 h-4 w-3/5`})]}),(0,$.jsx)(V,{className:`h-8 w-24 rounded-md`})]})},t)}function sn(e,t){return(0,$.jsxs)(`div`,{className:`flex min-h-12 items-center gap-2.5 bg-surface-base px-3 py-2.5`,children:[(0,$.jsx)(V,{className:`size-4 rounded-full`}),(0,$.jsx)(V,{className:`h-3 w-14`}),(0,$.jsx)(V,{className:`ml-auto h-4 w-10`})]},t)}function cn({projectId:e,embedded:t=!1,title:n,subtitle:r}){let i=d(e=>e.language),o=f(i),s=o.automations,c=o.productNavigation.sections[`automation-triggers`],l=o.cron,u=he(e=>e.setPageHeader),y=he(e=>e.clearPageHeader),[b,x]=a(),S=!t&&b.get(`view`)===`activity`,C=b.get(`run`)?.trim()??``,w=b.get(`view`)===`execution`&&!!C,T=b.get(`automation`)?.trim()??``,E=b.get(`new`)===`1`,ee=b.get(`setupChat`)??void 0,O=b.get(`draft`)?.trim()??``,k=b.get(`action`)?.trim()??``,A=b.get(`taskId`)?.trim()??``,j=b.get(`projectId`)?.trim()??``,M=e?.trim()||j,N=!!e?.trim(),P=b.get(`autogenerate`)===`1`,F=(0,Q.useRef)(``),te=b.get(`status`),I=te===`active`||te===`paused`||te===`completed`||te===`running`||te===`attention`?te:`all`,L=b.get(`ownership`)===`system`?`system`:`user`,ne=b.get(`source`),re=ne===`agent`||ne===`task_command`||ne===`browser_automation`?ne:`all`,R=b.get(`q`)??``,ae=e=>x(t=>{let n=new URLSearchParams(t);return e===`all`?n.delete(`status`):n.set(`status`,e),n.delete(`automation`),n}),z=e=>x(t=>{let n=new URLSearchParams(t);return e===`user`?n.delete(`ownership`):n.set(`ownership`,e),n.delete(`automation`),n}),oe=e=>x(t=>{let n=new URLSearchParams(t);return e?n.set(`q`,e):n.delete(`q`),n.delete(`automation`),n},{replace:!0}),se=e=>x(t=>{let n=new URLSearchParams(t);return e===`all`?n.delete(`source`):n.set(`source`,e),n.delete(`automation`),n}),ce=()=>x(e=>{let t=new URLSearchParams(e);return t.delete(`status`),t.delete(`source`),t.delete(`q`),t.delete(`automation`),t}),[V,de]=(0,Q.useState)(null),[fe,U]=(0,Q.useState)(!1),[q,_e]=(0,Q.useState)(`blank`),[ve,ye]=(0,Q.useState)(!1),[be,xe]=(0,Q.useState)(null),[Se,Ce]=(0,Q.useState)(null),[we,Te]=(0,Q.useState)(!1),[J,Ee]=(0,Q.useState)(Pe),[De,Y]=(0,Q.useState)(null),[Oe,ke]=(0,Q.useState)(null),[Z,Me]=(0,Q.useState)(!1),[Ie,Le]=(0,Q.useState)(null),[Be,He]=(0,Q.useState)(``),[We,Ke]=(0,Q.useState)(null),[qe,Je]=(0,Q.useState)(!1),[Ye,Xe]=(0,Q.useState)(!1),[Ze,$e]=(0,Q.useState)(M),[rt,it]=(0,Q.useState)(`new_session`),[at,ot]=(0,Q.useState)(`attention`),[ct,lt]=(0,Q.useState)(null),[ut,dt]=(0,Q.useState)(!1),[pt,mt]=(0,Q.useState)(!1),[ht,gt]=(0,Q.useState)(!1),[vt,bt]=(0,Q.useState)(null),[xt,St]=(0,Q.useState)(Gt),Ct=W([`automations`,M],()=>K.list(M?{projectId:M}:void 0),{keepPreviousData:!0,refreshInterval:15e3}),Tt=W([`automation-runs`,M],()=>K.runs(50,void 0,M?{projectId:M}:void 0),{keepPreviousData:!0,refreshInterval:1e4}),Et=W(M?`automations-global-system-source`:null,()=>K.list(),{keepPreviousData:!0,refreshInterval:15e3}),Dt=W(M?`automation-runs-global-system-source`:null,()=>K.runs(50),{keepPreviousData:!0,refreshInterval:1e4}),kt=W(Ie?[`automation-history`,Ie,M]:null,()=>K.runs(50,Ie,M?{projectId:M}:void 0),{refreshInterval:1e4}),At=W(Oe?`automation-run-events:${Oe}`:null,()=>K.runEvents(Oe),{refreshInterval:5e3}),jt=W(Oe?[`automation-exact-run`,Oe]:null,()=>K.getRun(Oe),{refreshInterval:3e3}),Mt=W(`automation-browser-automations`,()=>tt.list()),Nt=W(`automation-chat-agents`,me),Pt=W(`automation-tasks`,K.tasks),Ft=W(`automation-projects`,()=>H({sortBy:`name`,sortOrder:`asc`,limit:200})),It=Ct.isLoading&&!Ct.data||Tt.isLoading&&!Tt.data||!!M&&Et.isLoading&&!Et.data||!!M&&Dt.isLoading&&!Dt.data,Lt=!It&&(Ct.isLoading||Tt.isLoading||Et.isLoading||Dt.isLoading),Rt=Ct.data?.automations??[],Vt=M?Et.data?.automations??[]:Rt,Ut=(0,Q.useMemo)(()=>rn(Tt.data?.runs??[]),[Tt.data?.runs]),Kt=(0,Q.useMemo)(()=>M?rn(Dt.data?.runs??[]):Ut,[Dt.data?.runs,M,Ut]),qt=(0,Q.useMemo)(()=>Rt.filter(e=>!zt(e)),[Rt]),Jt=(0,Q.useMemo)(()=>Vt.filter(zt),[Vt]),Yt=(0,Q.useMemo)(()=>[...qt,...Jt],[Jt,qt]),Xt=(0,Q.useMemo)(()=>new Set(Jt.map(e=>e.id)),[Jt]),Zt=(0,Q.useMemo)(()=>Ut.filter(e=>!Xt.has(e.automationId)),[Ut,Xt]),$t=(0,Q.useMemo)(()=>Kt.filter(e=>Xt.has(e.automationId)),[Kt,Xt]),nn=(0,Q.useMemo)(()=>M?[...Ut,...$t]:Ut,[M,Ut,$t]),on=(0,Q.useMemo)(()=>jt.data?.run?.id===Oe?jt.data.run:nn.find(e=>e.id===Oe)??kt.data?.runs.find(e=>e.id===Oe)??null,[nn,Oe,kt.data,jt.data]),sn=(0,Q.useMemo)(()=>Yt.find(e=>e.id===Ie)??null,[Yt,Ie]),cn=(0,Q.useMemo)(()=>Yt.find(e=>e.id===Se)??null,[Yt,Se]),dn=(0,Q.useMemo)(()=>[...kt.data?.runs??nn].filter(e=>e.automationId===Ie).sort((e,t)=>t.createdAtMs-e.createdAtMs),[nn,Ie,kt.data]),fn=At.data?.events??[],pn=(0,Q.useMemo)(()=>Zt.filter(e=>!Qt(e)&&e.readAtMs==null),[Zt]),mn=R.trim().toLocaleLowerCase(),gn=L===`system`?Jt:qt,_n=L===`system`?$t:Zt,vn=(0,Q.useMemo)(()=>new Set(_n.filter(Qt).map(e=>e.automationId)),[_n]),xn=(0,Q.useMemo)(()=>gn.filter(e=>I===`attention`&&!Qe(e,_n)||I===`running`&&!vn.has(e.id)||I===`active`&&!e.enabled||I===`paused`&&(e.enabled||X(e))||I===`completed`&&!X(e)||re!==`all`&&e.action.kind!==re?!1:!mn||[e.name,tn(e),en(e,s),Ae(e.trigger,s,l,i)].some(e=>e.toLocaleLowerCase().includes(mn))),[l,I,s,i,mn,gn,_n,vn,re]),Sn=(0,Q.useMemo)(()=>(Mt.data?.automations??[]).filter(e=>e.enabled),[Mt.data]),Cn=Nt.data?.items??[],wn=(0,Q.useMemo)(()=>(Pt.data?.items??[]).map(e=>e.task),[Pt.data]),Tn=Ft.data?.items??[],En=(0,Q.useMemo)(()=>Sn.find(e=>e.id===J.browserAutomationId.trim())??null,[Sn,J.browserAutomationId]),Dn=!!cn?.management?.editable.includes(`trigger`),On=[`daily`,`weekly`,`interval`,`cron`].includes(J.triggerMode)&&(![`daily`,`weekly`].includes(J.triggerMode)||/^(?:[01]\d|2[0-3]):[0-5]\d$/.test(J.time))&&(J.triggerMode!==`interval`||ze(J.intervalValue,J.intervalUnit)>=6e4)&&(J.triggerMode!==`cron`||!!J.cronExpr.trim()),An=Dn?On:!!J.name.trim()&&(J.triggerMode!==`once`||Number.isFinite(new Date(J.onceAt).getTime())&&(!!cn||new Date(J.onceAt).getTime()>Date.now()))&&(![`daily`,`weekly`].includes(J.triggerMode)||/^(?:[01]\d|2[0-3]):[0-5]\d$/.test(J.time))&&(J.triggerMode!==`event`||!!J.eventType.trim()&&Fe(J.eventPayloadMatch))&&(J.actionMode===`browser_automation`?En!==null&&nt(En,J.browserAutomationInputs):J.actionMode===`task_command`?!!(J.taskId.trim()&&J.agentId.trim()):!!J.instruction.trim()),jn=!0;try{[`daily`,`weekly`,`cron`].includes(J.triggerMode)&&Ve(J)}catch{jn=!1}let Mn=An&&jn,Nn=(0,Q.useMemo)(()=>Bt(s),[s]),Pn=(0,Q.useMemo)(()=>qt.filter(e=>Qe(e,Zt)),[qt,Zt]),Fn=Pn.some(e=>{let t=et(e,Zt);return t!==null&&xt[e.id]!==t}),In=(0,Q.useCallback)(()=>{St(e=>{let t={...e};for(let e of Pn){let n=et(e,Zt);n&&(t[e.id]=n)}try{window.localStorage.setItem(Wt,JSON.stringify(t))}catch{}return t})},[Pn,Zt]);(0,Q.useEffect)(()=>{if(!Lt){if(E){Le(null);return}if(T){Le(T);return}if(xn.length===0){Le(null);return}Ie&&xn.some(e=>e.id===Ie)||Le(null)}},[T,xn,E,Lt,Ie]);let Ln=(0,Q.useCallback)(async()=>{await Promise.all([Ct.mutate(),Tt.mutate(),Et.mutate(),Dt.mutate(),kt.mutate(),At.mutate(),pe(e=>Array.isArray(e)&&e[0]===`automation-navigation-runs`)])},[Ct.mutate,Et.mutate,Dt.mutate,At.mutate,Tt.mutate,kt.mutate]),Rn=(0,Q.useCallback)(e=>{if(N){Le(null),ke(null);return}x(t=>{let n=new URLSearchParams(t);return e?n.set(`projectId`,e):n.delete(`projectId`),n.delete(`automation`),n.delete(`run`),n}),Le(null),ke(null)},[N,x]);(0,Q.useEffect)(()=>{N&&($e(M),Ee(e=>e.projectId===M?e:{...e,projectId:M}))},[M,N]);let zn=(0,Q.useCallback)(e=>{if(e===`blank`&&!A){ye(!0);return}if(Ce(null),Te(!1),Y(null),_e(e),U(!0),e===`blank`){Ee({...Pe,projectId:M});return}He(``),Ke(null),Xe(!1),$e(M),it(`new_session`),ot(`attention`)},[M,A]),Bn=e=>{de(e),Ee({...e.form,projectId:M}),Ce(null),Te(!1),Y(null),_e(`quick`),U(!0)},Vn=(0,Q.useCallback)(e=>{if(e.action.kind===`agent`&&!e.management){xe(e);return}Ee(Ge(e)),Ce(e.id),Te(!1),Le(null),_e(`blank`),U(!0)},[]),Hn=(0,Q.useCallback)(()=>{We&&(Ee({...Ge(We.automation),projectId:Ze,conversationMode:rt,notificationPolicy:at}),Ce(null),Te(!0),_e(`blank`))},[We,rt,at,Ze]),Un=(0,Q.useCallback)(async()=>{gt(!0),Y(null);try{await Ln()}catch(e){let t=e instanceof Error?e.message:String(e);Y(t)}finally{gt(!1)}},[s.feedback.actionFailed,Ln]);(0,Q.useEffect)(()=>{let e=Yt.find(e=>e.id===T);!e||!zt(e)||L===`system`||x(e=>{let t=new URLSearchParams(e);return t.set(`ownership`,`system`),t},{replace:!0})},[T,Yt,L,x]),(0,Q.useEffect)(()=>{k===`create`&&(zn(`blank`),A&&Ee(e=>({...e,actionMode:`task_command`,taskId:A,safetyMode:`auto_apply`})),x(e=>{let t=new URLSearchParams(e);return t.delete(`action`),t.delete(`taskId`),t},{replace:!0}))},[k,zn,x,A]),(0,Q.useEffect)(()=>{if(!O)return;let e=`${i}:${P?`auto`:`seed`}:${O}`;F.current!==e&&(F.current=e,He(O),Ke(null),Xe(!1),$e(M),_e(`draft`),U(!0),x(e=>{let t=new URLSearchParams(e);return t.delete(`draft`),t.delete(`autogenerate`),t},{replace:!0}),P&&(Y(null),Je(!0),K.draft({prompt:O,language:i}).then(e=>{Ke(e.draft),Xe(!1)}).catch(e=>{Y(e instanceof Error?e.message:String(e))}).finally(()=>{Je(!1)})))},[P,O,i,M,x]);let Wn=(0,Q.useCallback)(e=>{let t=Ut.find(t=>t.id===e)??kt.data?.runs.find(t=>t.id===e);if(!t||Qt(t)||t.readAtMs!=null)return;let n=Date.now();Tt.mutate(t=>t&&{...t,runs:t.runs.map(t=>t.id===e?{...t,readAtMs:n}:t)},!1),kt.mutate(t=>t&&{...t,runs:t.runs.map(t=>t.id===e?{...t,readAtMs:n}:t)},!1),K.markRunRead(e).catch(e=>{Y(e instanceof Error?e.message:String(e)),Tt.mutate(),kt.mutate()})},[Ut,Tt.mutate,kt.data,kt.mutate]),Gn=(0,Q.useCallback)(e=>{Wn(e),ke(e),Me(!0),x(t=>{let n=new URLSearchParams(t);return n.set(`run`,e),n},{replace:!0})},[Wn,x]),Kn=(0,Q.useCallback)(e=>{Le(e),ke(null),Me(!1),x(t=>{let n=new URLSearchParams(t);n.set(`automation`,e);for(let e of[`new`,`setupChat`,`chatDraft`,`run`,`view`])n.delete(e);return n})},[x]),qn=(0,Q.useCallback)(e=>{Me(!1),x(t=>{let n=new URLSearchParams(t);n.set(`automation`,e.automationId),n.set(`run`,e.id),n.set(`view`,`execution`);for(let e of[`new`,`setupChat`,`chatDraft`])n.delete(e);return n})},[x]);(0,Q.useEffect)(()=>{ke(C||null),Me(!!C&&!w)},[w,C]),(0,Q.useEffect)(()=>{C&&!w&&Wn(C)},[w,C,Wn]),(0,Q.useEffect)(()=>{lt(null),mt(!1)},[Oe]);async function Jn(){if(Y(null),J.triggerMode===`once`&&!cn&&new Date(J.onceAt).getTime()<=Date.now()){Y(s.experience.futureTime);return}if(!(!Mn||vt)&&!(q===`quick`&&V?.requiresProject&&!J.projectId)){if(we&&We){bt(`draft:edit`);try{let e=Re(J),{simulation:t}=await K.simulate(e);Ke({...We,automation:e,simulation:t}),$e(J.projectId),it(J.conversationMode),ot(J.notificationPolicy),Xe(!1),Te(!1),_e(`draft`)}catch(e){let t=e instanceof Error?e.message:String(e);Y(t)}finally{bt(null)}return}if(cn){let e=cn.id;await Yn(`automation:${e}:edit`,()=>K.update(e,{...Dn?{trigger:Ne(cn,{...J,instruction:`managed`}).trigger}:Ne(cn,J),expectedRevision:cn.updatedAtMs}))&&(U(!1),Ce(null),Le(e));return}bt(`automation:create`);try{let e=Re(J),{automation:t}=await K.create(e);Ee(Pe),U(!1),x(e=>{let n=new URLSearchParams(e);return n.delete(`status`),n.delete(`q`),n.delete(`run`),n.delete(`new`),n.set(`automation`,t.id),N||(t.projectId?n.set(`projectId`,t.projectId):n.delete(`projectId`)),n}),await Ln(),Le(t.id)}catch(e){let t=e instanceof Error?e.message:String(e);Y(t)}finally{bt(null)}}}async function Yn(e,t){Y(null),bt(e);try{return await t(),await Ln(),!0}catch(e){let t=e instanceof Error?e.message:String(e);return Y(t),!1}finally{bt(null)}}async function Xn(){await Yn(`runs:read-all`,()=>K.markAllRunsRead(M||void 0))}async function Zn(){let e=Be.trim();if(e){Y(null),Je(!0);try{let t=await K.draft({prompt:e,language:i});Ke(t.draft),Xe(!1)}catch(e){Y(e instanceof Error?e.message:String(e))}finally{Je(!1)}}}async function Qn(){if(!We)return;let e=``,t=``;await Yn(`draft:publish`,async()=>{let{automation:n}=await K.create({...We.automation,...Ze?{projectId:Ze}:{projectId:void 0},conversationMode:rt,delivery:{...We.automation.delivery,notificationPolicy:at}});Ke(null),He(``),Xe(!1),U(!1),ae(`all`),oe(``),e=n.id,t=n.projectId??``})&&e&&(Rn(t),Kn(e))}async function $n(){if(!We)return;let e=``,t=``,n=``;await Yn(`draft:test`,async()=>{let{automation:r}=await K.create({...We.automation,...Ze?{projectId:Ze}:{projectId:void 0},conversationMode:rt,delivery:{...We.automation.delivery,notificationPolicy:at},enabled:!1}),{run:i}=await K.runNow(r.id);e=r.id,t=r.projectId??``,n=i.id,Ke(null),He(``),Xe(!1),U(!1),ae(`all`),oe(``)})&&e&&n&&(Rn(t),Kn(e),Gn(n))}async function er(e){Y(null),dt(!0),lt(null),mt(!1);try{let t=await K.repairDraft(e.id,{language:i});lt(t.repair)}catch(e){Y(e instanceof Error?e.message:String(e))}finally{dt(!1)}}async function tr(e){ct&&await Yn(`run:${e.id}:repair`,async()=>{await K.update(e.automationId,ct.patch),lt(null),mt(!1)})}let nr=(0,Q.useMemo)(()=>(0,$.jsx)(ge,{className:`size-9 shrink-0 p-0`,loading:ht,label:s.refresh,onClick:Un}),[s.refresh,ht,Un]);return(0,Q.useLayoutEffect)(()=>{if(!t)return u({startExtra:null,main:(0,$.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:c}),end:nr}),()=>y()},[y,t,nr,c,u]),(0,$.jsxs)(`div`,{className:ue(`flex min-h-0 min-w-0 flex-1 flex-col`,t?`bg-transparent`:`bg-surface-panel`),children:[(0,$.jsxs)(`div`,{className:ue(`flex min-h-0 w-full flex-1 flex-col gap-4`,t?`py-1`:`px-4 pt-3 sm:px-9 lg:pt-4 xl:px-10`,!t&&(S?`overflow-y-auto`:`overflow-hidden`)),children:[t?(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3 rounded-xl border border-edge-subtle bg-surface-base px-4 py-3 shadow-surface`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(B,{className:`size-4 text-accent-fg`,"aria-hidden":!0}),(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n||s.title})]}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:r||s.subtitle})]}),nr]}):null,De||Ct.error||Tt.error||Et.error||Dt.error?(0,$.jsx)(`div`,{role:`alert`,className:`rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:De||s.feedback.actionFailed}):null,S?It?(0,$.jsx)(an,{}):(0,$.jsx)(hn,{runs:_n,ownership:L,labels:s,language:i,unreadCount:L===`user`?pn.length:0,loading:Lt||ht,onOwnershipChange:z,onRefresh:Un,onSelectRun:Gn}):(0,$.jsxs)($.Fragment,{children:[!It&&Fn&&L===`user`?(0,$.jsxs)(`div`,{className:`flex items-center rounded-lg border border-red-500/20 bg-red-500/5`,children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>ae(`attention`),className:`flex min-w-0 flex-1 items-center gap-3 rounded-l-lg px-4 py-3 text-left focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,$.jsx)(D,{className:`size-4 shrink-0 text-red-700 dark:text-red-300`,"aria-hidden":!0}),(0,$.jsxs)(`span`,{className:`min-w-0 text-sm text-fg`,children:[(0,$.jsxs)(`span`,{className:`font-medium`,children:[s.experience.executionIssues,` · `,Pn.length]}),(0,$.jsx)(`span`,{className:`ml-2 text-fg-muted`,children:s.experience.issuesDescription})]})]}),(0,$.jsx)(`button`,{type:`button`,onClick:In,className:`mr-2 rounded-md p-2 text-fg-muted hover:bg-red-500/10 hover:text-fg focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":s.close,title:s.close,children:(0,$.jsx)(le,{className:`size-4`,"aria-hidden":!0})})]}):null,It?(0,$.jsx)(an,{}):(0,$.jsxs)(_t,{language:i,busy:Lt,children:[(0,$.jsxs)(`aside`,{className:ue(`max-h-[28vh] min-h-0 min-w-0 flex-col overflow-hidden rounded-xl bg-surface-base md:flex md:h-full md:max-h-none`,w?`hidden`:`flex`),children:[(0,$.jsxs)(`div`,{className:`shrink-0 p-3`,children:[(0,$.jsx)(wt,{language:i,labels:s,filter:I,ownership:L,source:re,projectId:M,projects:Tn,projectLocked:N,query:R,unreadCount:L===`user`?pn.length:0,markReadBusy:vt===`runs:read-all`,onFilter:ae,onOwnership:z,onSource:se,onProject:Rn,onQuery:oe,onClear:()=>{ce(),z(`user`),N||Rn(``)},onMarkAllRead:()=>void Xn()}),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>ye(!0),className:`mt-2 flex w-full items-center gap-2 rounded-lg px-2 py-2 text-sm text-fg hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,$.jsx)(ie,{className:`size-4`,"aria-hidden":!0}),i===`zh`?`新建任务`:`New task`]})]}),T&&!xn.some(e=>e.id===T)?(0,$.jsxs)(`p`,{role:`status`,className:`px-3 pb-2 text-xs text-fg-muted`,children:[i===`zh`?`当前自动化不在筛选结果中。`:`The selected automation is outside these filters.`,(0,$.jsx)(`button`,{type:`button`,className:`ml-1 text-accent-fg underline`,onClick:ce,children:i===`zh`?`清除筛选`:`Clear filters`})]}):null,(0,$.jsx)(ft,{automations:xn,runs:_n,labels:s,cronLabels:l,language:i,selectedAutomationId:E?null:Ie,selectedRunId:w?C:void 0,selectedRun:w?on:null,projectId:M||void 0,executionSummaries:(L===`system`&&M?Et.data:Ct.data)?.executionSummaries,onSelectRun:qn,onOpenDetails:Kn,busy:vt!==null,onEdit:Vn,onAction:Yn})]}),w&&T?(0,$.jsx)(st,{automationId:T,runId:C,projectId:M||void 0,language:i,onBack:()=>Kn(T),onDetails:()=>Me(!0),onConfigure:e=>{K.openConfiguration({automationId:e.automationId,runId:e.id}).then(({conversationId:t})=>{Me(!1),x(n=>{let r=new URLSearchParams(n);return r.set(`automation`,e.automationId),r.set(`setupChat`,t),r.delete(`run`),r.delete(`view`),r})}).catch(e=>Y(e instanceof Error?e.message:String(e)))}},`${T}:${C}`):!E&&sn&&!sn.management&&sn.action.kind!==`system`?(0,$.jsx)(yt,{automation:sn,conversationId:ee,runs:dn,language:i,onSelectRun:Gn},sn.id):ee?(0,$.jsx)(yt,{conversationId:ee,runs:[],language:i,onSelectRun:Gn,onConfigured:Kn},ee):!E&&sn?(0,$.jsx)(bn,{automation:sn,runs:dn,runsLoading:kt.isLoading,runsError:kt.error?s.feedback.actionFailed:void 0,labels:s,cronLabels:l,language:i,projects:Tn,busyAction:vt,onEdit:Vn,onSelectRun:Gn,onAction:Yn},sn.id):(0,$.jsx)(`div`,{className:`min-h-0 overflow-y-auto`,children:(0,$.jsx)(Ot,{language:i,projectId:M,onOpenConversation:e=>{let t=new URL(e,window.location.origin),n=t.searchParams.get(`setupChat`);x(e=>{let r=new URLSearchParams(e);r.set(`new`,`1`),r.delete(`automation`),r.set(`setupChat`,n);let i=t.searchParams.get(`chatDraft`);return i?r.set(`chatDraft`,i):r.delete(`chatDraft`),r})}},M)})]})]})]}),ve?(0,$.jsx)(Ue,{language:i,projectId:M,onClose:()=>ye(!1),onCreated:e=>{z(`user`),ce(),Kn(e.id)}}):null,be?(0,$.jsx)(Ue,{automation:be,language:i,onClose:()=>xe(null)}):null,(0,$.jsx)(v,{open:fe,onOpenChange:e=>{U(e),e||(Ce(null),Te(!1))},children:(0,$.jsxs)(h,{children:[(0,$.jsx)(p,{className:`xopc-dialog-overlay fixed inset-0 z-65 bg-scrim backdrop-blur-[1px]`}),(0,$.jsxs)(g,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-66 flex h-[min(760px,calc(100vh-2rem))] w-[min(100%-2rem,64rem)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-popover outline-none`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-5 py-4`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(_,{className:`text-base font-semibold text-fg`,children:q===`draft`?s.draft.title:cn?s.editTitle:we?s.draft.editTitle:s.createTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:q===`draft`?s.draft.subtitle:s.form.createFlowHint})]}),(0,$.jsx)(m,{asChild:!0,children:(0,$.jsx)(G,{variant:`ghost`,"aria-label":s.close,children:(0,$.jsx)(le,{className:`size-4`})})})]}),De?(0,$.jsx)(`p`,{role:`alert`,className:`px-5 py-2 text-sm text-red-700 dark:text-red-300`,children:De}):null,q===`draft`?(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:(0,$.jsx)(un,{labels:s,prompt:Be,draft:We,loading:qe,approved:Ye,publishBusy:vt===`draft:publish`,testBusy:vt===`draft:test`,templates:Nn,projects:Tn,projectId:Ze,conversationMode:rt,notificationPolicy:at,onPromptChange:He,onGenerate:Zn,onEdit:Hn,onPublish:Qn,onTest:$n,onProjectChange:$e,onConversationModeChange:it,onNotificationPolicyChange:ot,projectLocked:N,onApprovedChange:Xe,onDiscard:()=>{Ke(null),Xe(!1)},onTemplateSelect:e=>{Bn(e),Ee({...e.form,projectId:Ze})},onOpenAdvanced:()=>{Ee({...Pe,projectId:Ze,conversationMode:rt,notificationPolicy:at}),_e(`blank`)}})}):(0,$.jsxs)($.Fragment,{children:[Dn?(0,$.jsx)(ln,{form:J,setForm:Ee,labels:s}):q===`quick`&&V?(0,$.jsx)(Ht,{form:J,setForm:Ee,labels:s,projects:Tn,projectLocked:N,source:V.source,requiresProject:V.requiresProject}):(0,$.jsx)(kn,{form:J,labels:s,setForm:Ee,projects:Tn,browserAutomations:Sn,selectedBrowserAutomation:En,browserAutomationsLoading:Mt.isLoading,agentOptions:Cn,agentsLoading:Nt.isLoading,defaultAgentId:Nt.data?.defaultId??``,taskOptions:wn,tasksLoading:Pt.isLoading,language:i,projectLocked:N}),Dn||q===`quick`?(0,$.jsx)(`div`,{className:`max-h-40 shrink-0 overflow-y-auto px-5 pb-4`,children:(0,$.jsx)(je,{form:J,onChange:e=>Ee(t=>({...t,...e})),language:i})}):null,(0,$.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2 border-t border-edge px-5 py-4`,children:[q===`quick`?(0,$.jsx)(G,{variant:`ghost`,onClick:()=>_e(`blank`),children:s.draft.advancedCreate}):null,we?(0,$.jsx)(G,{variant:`ghost`,onClick:()=>{Te(!1),_e(`draft`)},children:s.cancel}):(0,$.jsx)(m,{asChild:!0,children:(0,$.jsx)(G,{variant:`ghost`,children:s.cancel})}),(0,$.jsx)(G,{variant:`primary`,onClick:Jn,disabled:!Mn||!!vt||q===`quick`&&!!V?.requiresProject&&!J.projectId,children:vt===`automation:create`||vt===`draft:edit`||cn&&vt===`automation:${cn.id}:edit`?s.feedback.working:cn||we?s.save:s.experience.createEnabled})]})]})]})]})}),(0,$.jsx)(v,{open:Z&&!!on,onOpenChange:e=>{Me(e),!(e||w)&&x(e=>{let t=new URLSearchParams(e);return t.delete(`run`),t},{replace:!0})},children:(0,$.jsxs)(h,{children:[(0,$.jsx)(p,{className:`xopc-dialog-overlay fixed inset-0 z-65 bg-scrim backdrop-blur-[1px]`}),(0,$.jsxs)(g,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-66 flex h-[min(85vh,40rem)] w-[min(100%-2rem,32rem)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-popover outline-none`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,$.jsx)(_,{className:`truncate text-base font-semibold text-fg`,children:on?.automationName??s.dashboard.result}),(0,$.jsx)(m,{asChild:!0,children:(0,$.jsx)(G,{variant:`ghost`,"aria-label":s.close,children:(0,$.jsx)(le,{className:`size-4`})})})]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:(0,$.jsx)(yn,{className:`rounded-none border-0`,run:on,events:fn,labels:s,cronLabels:l,language:i,loading:At.isLoading,repairDraft:ct,repairLoading:ut,repairApproved:pt,busyAction:vt,onRepairApprovedChange:mt,onSuggestRepair:er,onApplyRepair:tr})})]})]})})]})}function ln(e){let t=(0,at.c)(48),{form:n,setForm:r,labels:i}=e,a;t[0]===r?a=t[1]:(a=e=>r(t=>({...t,...e})),t[0]=r,t[1]=a);let o=a,s;t[2]===i.form.trigger?s=t[3]:(s=(0,$.jsx)(Nn,{title:i.form.trigger}),t[2]=i.form.trigger,t[3]=s);let c;t[4]===o?c=t[5]:(c=e=>o({triggerMode:e.target.value}),t[4]=o,t[5]=c);let l;t[6]===i.trigger.daily?l=t[7]:(l=(0,$.jsx)(E,{value:`daily`,children:i.trigger.daily}),t[6]=i.trigger.daily,t[7]=l);let u;t[8]===i.trigger.weekly?u=t[9]:(u=(0,$.jsx)(E,{value:`weekly`,children:i.trigger.weekly}),t[8]=i.trigger.weekly,t[9]=u);let d;t[10]===i.trigger.interval?d=t[11]:(d=(0,$.jsx)(E,{value:`interval`,children:i.trigger.interval}),t[10]=i.trigger.interval,t[11]=d);let f;t[12]===i.trigger.customCron?f=t[13]:(f=(0,$.jsx)(E,{value:`cron`,children:i.trigger.customCron}),t[12]=i.trigger.customCron,t[13]=f);let p;t[14]!==n.triggerMode||t[15]!==i.form.trigger||t[16]!==c||t[17]!==l||t[18]!==u||t[19]!==d||t[20]!==f?(p=(0,$.jsxs)(T,{"aria-label":i.form.trigger,className:Mn,value:n.triggerMode,onChange:c,children:[l,u,d,f]}),t[14]=n.triggerMode,t[15]=i.form.trigger,t[16]=c,t[17]=l,t[18]=u,t[19]=d,t[20]=f,t[21]=p):p=t[21];let m;t[22]!==n.time||t[23]!==n.triggerMode||t[24]!==n.weekday||t[25]!==i.form.day||t[26]!==i.form.time||t[27]!==i.weekdays||t[28]!==o?(m=n.triggerMode===`daily`||n.triggerMode===`weekly`?(0,$.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[(0,$.jsx)(Z,{label:i.form.time,children:(0,$.jsx)(qe,{value:n.time,onChange:e=>o({time:e}),ariaLabel:i.form.time})}),n.triggerMode===`weekly`?(0,$.jsx)(Z,{label:i.form.day,children:(0,$.jsxs)(T,{className:Mn,value:n.weekday,onChange:e=>o({weekday:e.target.value}),children:[(0,$.jsx)(E,{value:`1`,children:i.weekdays.monday}),(0,$.jsx)(E,{value:`2`,children:i.weekdays.tuesday}),(0,$.jsx)(E,{value:`3`,children:i.weekdays.wednesday}),(0,$.jsx)(E,{value:`4`,children:i.weekdays.thursday}),(0,$.jsx)(E,{value:`5`,children:i.weekdays.friday}),(0,$.jsx)(E,{value:`6`,children:i.weekdays.saturday}),(0,$.jsx)(E,{value:`0`,children:i.weekdays.sunday})]})}):null]}):null,t[22]=n.time,t[23]=n.triggerMode,t[24]=n.weekday,t[25]=i.form.day,t[26]=i.form.time,t[27]=i.weekdays,t[28]=o,t[29]=m):m=t[29];let h;t[30]!==n.intervalUnit||t[31]!==n.intervalValue||t[32]!==n.triggerMode||t[33]!==i.form.intervalEvery||t[34]!==i.form.intervalUnits||t[35]!==o?(h=n.triggerMode===`interval`?(0,$.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-[minmax(0,1fr)_10rem]`,children:[(0,$.jsx)(Z,{label:i.form.intervalEvery,children:(0,$.jsx)(`input`,{className:Mn,type:`number`,min:`1`,value:n.intervalValue,onChange:e=>o({intervalValue:e.target.value})})}),(0,$.jsx)(Z,{label:i.form.intervalUnits.minute,children:(0,$.jsxs)(T,{className:Mn,value:n.intervalUnit,onChange:e=>o({intervalUnit:e.target.value}),children:[(0,$.jsx)(E,{value:`minute`,children:i.form.intervalUnits.minute}),(0,$.jsx)(E,{value:`hour`,children:i.form.intervalUnits.hour}),(0,$.jsx)(E,{value:`day`,children:i.form.intervalUnits.day}),(0,$.jsx)(E,{value:`week`,children:i.form.intervalUnits.week})]})})]}):null,t[30]=n.intervalUnit,t[31]=n.intervalValue,t[32]=n.triggerMode,t[33]=i.form.intervalEvery,t[34]=i.form.intervalUnits,t[35]=o,t[36]=h):h=t[36];let g;t[37]!==n.cronExpr||t[38]!==n.triggerMode||t[39]!==i.form.expression||t[40]!==o?(g=n.triggerMode===`cron`?(0,$.jsx)(`div`,{className:`mt-4`,children:(0,$.jsx)(Z,{label:i.form.expression,children:(0,$.jsx)(`input`,{className:Mn,value:n.cronExpr,onChange:e=>o({cronExpr:e.target.value})})})}):null,t[37]=n.cronExpr,t[38]=n.triggerMode,t[39]=i.form.expression,t[40]=o,t[41]=g):g=t[41];let _;return t[42]!==h||t[43]!==g||t[44]!==s||t[45]!==p||t[46]!==m?(_=(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[s,p,m,h,g]}),t[42]=h,t[43]=g,t[44]=s,t[45]=p,t[46]=m,t[47]=_):_=t[47],_}function un(e){let t=(0,at.c)(110),{labels:n,prompt:r,draft:i,loading:a,approved:o,publishBusy:s,testBusy:c,templates:l,projects:u,projectId:d,conversationMode:f,notificationPolicy:p,onPromptChange:m,onGenerate:h,onEdit:g,onPublish:_,onTest:v,onProjectChange:y,onConversationModeChange:b,onNotificationPolicyChange:x,onApprovedChange:S,onDiscard:C,onTemplateSelect:w,onOpenAdvanced:D,projectLocked:ee}=e,O=s!==void 0&&s,k=c!==void 0&&c,A=ee!==void 0&&ee,j=!!(i&&i.simulation.requiredConfirmations.length>0),M;t[0]!==i||t[1]!==n.draft.advancedCreate||t[2]!==n.draft.suggestions||t[3]!==n.draft.suggestionsDescription||t[4]!==n.experience||t[5]!==D||t[6]!==w||t[7]!==l?(M=i?null:(0,$.jsxs)(`div`,{className:`mb-5 border-b border-edge-subtle pb-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n.draft.suggestions}),(0,$.jsx)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:n.draft.suggestionsDescription})]}),(0,$.jsx)(G,{variant:`ghost`,onClick:D,children:n.draft.advancedCreate})]}),(0,$.jsx)(`div`,{className:`mt-3 grid gap-2 sm:grid-cols-2`,children:l.map(e=>(0,$.jsxs)(`button`,{type:`button`,className:`focus-visible:ring-2 focus-visible:ring-accent rounded-lg border border-edge-subtle bg-surface-panel p-3 text-left hover:bg-surface-hover`,onClick:()=>w(e),children:[(0,$.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:e.name}),(0,$.jsx)(`div`,{className:`mt-1 line-clamp-2 text-xs text-fg-muted`,children:e.description}),(0,$.jsxs)(`div`,{className:`mt-2 text-xs text-fg-muted`,children:[n.experience.source,`: `,e.source]})]},e.name))})]}),t[0]=i,t[1]=n.draft.advancedCreate,t[2]=n.draft.suggestions,t[3]=n.draft.suggestionsDescription,t[4]=n.experience,t[5]=D,t[6]=w,t[7]=l,t[8]=M):M=t[8];let N;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,$.jsx)(oe,{className:`size-4 text-accent`}),t[9]=N):N=t[9];let P;t[10]===n.draft.title?P=t[11]:(P=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[N,n.draft.title]}),t[10]=n.draft.title,t[11]=P);let F;t[12]===n.draft.subtitle?F=t[13]:(F=(0,$.jsx)(`div`,{className:`mt-1 text-sm text-fg-muted`,children:n.draft.subtitle}),t[12]=n.draft.subtitle,t[13]=F);let te;t[14]!==P||t[15]!==F?(te=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[P,F]}),t[14]=P,t[15]=F,t[16]=te):te=t[16];let I;t[17]!==a||t[18]!==r?(I=a||!r.trim(),t[17]=a,t[18]=r,t[19]=I):I=t[19];let L;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,$.jsx)(oe,{className:`size-4`}),t[20]=L):L=t[20];let ie=a?n.draft.generating:n.draft.generate,R;t[21]!==h||t[22]!==ie||t[23]!==I?(R=(0,$.jsxs)(G,{variant:`primary`,onClick:h,disabled:I,children:[L,ie]}),t[21]=h,t[22]=ie,t[23]=I,t[24]=R):R=t[24];let ae;t[25]!==R||t[26]!==te?(ae=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[te,R]}),t[25]=R,t[26]=te,t[27]=ae):ae=t[27];let z;t[28]===m?z=t[29]:(z=e=>m(e.target.value),t[28]=m,t[29]=z);let se;t[30]!==n.draft.placeholder||t[31]!==n.draft.title||t[32]!==r||t[33]!==z?(se=(0,$.jsx)(`textarea`,{"aria-label":n.draft.title,className:`mt-4 min-h-20 w-full resize-y rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none focus:border-accent`,value:r,onChange:z,placeholder:n.draft.placeholder}),t[30]=n.draft.placeholder,t[31]=n.draft.title,t[32]=r,t[33]=z,t[34]=se):se=t[34];let ce=A?`sm:grid-cols-2`:`sm:grid-cols-3`,le;t[35]===ce?le=t[36]:(le=ue(`mt-3 grid gap-3`,ce),t[35]=ce,t[36]=le);let B;t[37]!==n.draft.noProject||t[38]!==n.draft.project||t[39]!==y||t[40]!==d||t[41]!==A||t[42]!==u?(B=A?null:(0,$.jsx)(Z,{label:n.draft.project,children:(0,$.jsxs)(T,{className:Mn,value:d,onChange:e=>y(e.target.value),children:[(0,$.jsx)(E,{value:``,children:n.draft.noProject}),u.map(dn)]})}),t[37]=n.draft.noProject,t[38]=n.draft.project,t[39]=y,t[40]=d,t[41]=A,t[42]=u,t[43]=B):B=t[43];let V;t[44]===b?V=t[45]:(V=e=>b(e.target.value),t[44]=b,t[45]=V);let H;t[46]===n.draft.newConversation?H=t[47]:(H=(0,$.jsx)(E,{value:`new_session`,children:n.draft.newConversation}),t[46]=n.draft.newConversation,t[47]=H);let de;t[48]===n.draft.continuousConversation?de=t[49]:(de=(0,$.jsx)(E,{value:`continuous`,children:n.draft.continuousConversation}),t[48]=n.draft.continuousConversation,t[49]=de);let fe;t[50]!==f||t[51]!==V||t[52]!==H||t[53]!==de?(fe=(0,$.jsxs)(T,{className:Mn,value:f,onChange:V,children:[H,de]}),t[50]=f,t[51]=V,t[52]=H,t[53]=de,t[54]=fe):fe=t[54];let U;t[55]!==n.draft.conversation||t[56]!==fe?(U=(0,$.jsx)(Z,{label:n.draft.conversation,children:fe}),t[55]=n.draft.conversation,t[56]=fe,t[57]=U):U=t[57];let W;t[58]===x?W=t[59]:(W=e=>x(e.target.value),t[58]=x,t[59]=W);let pe;t[60]===n.draft.notifyAttention?pe=t[61]:(pe=(0,$.jsx)(E,{value:`attention`,children:n.draft.notifyAttention}),t[60]=n.draft.notifyAttention,t[61]=pe);let me;t[62]===n.draft.notifyAll?me=t[63]:(me=(0,$.jsx)(E,{value:`all`,children:n.draft.notifyAll}),t[62]=n.draft.notifyAll,t[63]=me);let he;t[64]===n.draft.notifyNone?he=t[65]:(he=(0,$.jsx)(E,{value:`none`,children:n.draft.notifyNone}),t[64]=n.draft.notifyNone,t[65]=he);let K;t[66]!==p||t[67]!==W||t[68]!==pe||t[69]!==me||t[70]!==he?(K=(0,$.jsxs)(T,{className:Mn,value:p,onChange:W,children:[pe,me,he]}),t[66]=p,t[67]=W,t[68]=pe,t[69]=me,t[70]=he,t[71]=K):K=t[71];let q;t[72]!==n.draft.notifications||t[73]!==K?(q=(0,$.jsx)(Z,{label:n.draft.notifications,children:K}),t[72]=n.draft.notifications,t[73]=K,t[74]=q):q=t[74];let ge;t[75]!==le||t[76]!==B||t[77]!==U||t[78]!==q?(ge=(0,$.jsxs)(`div`,{className:le,children:[B,U,q]}),t[75]=le,t[76]=B,t[77]=U,t[78]=q,t[79]=ge):ge=t[79];let _e;t[80]!==o||t[81]!==i||t[82]!==n.draft.approval||t[83]!==n.draft.assumptions||t[84]!==n.draft.discard||t[85]!==n.draft.edit||t[86]!==n.draft.publish||t[87]!==n.draft.review||t[88]!==n.draft.risks||t[89]!==n.draft.safety||t[90]!==n.draft.testOnce||t[91]!==n.draft.testing||t[92]!==n.feedback||t[93]!==n.info||t[94]!==n.none||t[95]!==S||t[96]!==C||t[97]!==g||t[98]!==_||t[99]!==v||t[100]!==O||t[101]!==j||t[102]!==k?(_e=i?(0,$.jsxs)(`div`,{className:`mt-4 grid gap-3 rounded-lg bg-surface-base p-4 lg:grid-cols-[1fr_1fr]`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:i.automation.name}),i.automation.description?(0,$.jsx)(`div`,{className:`mt-1 text-sm text-fg-muted`,children:i.automation.description}):null,(0,$.jsxs)(`div`,{className:`mt-3 grid gap-2 text-sm`,children:[(0,$.jsx)(Dn,{label:n.info.when,value:i.simulation.triggerSummary}),(0,$.jsx)(Dn,{label:n.info.run,value:i.simulation.actionSummary})]})]}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:`text-xs font-semibold uppercase text-fg-muted`,children:n.draft.review}),(0,$.jsx)(fn,{title:n.draft.safety,items:[...i.simulation.safetyNotes,...i.simulation.requiredConfirmations],empty:n.none}),(0,$.jsx)(fn,{title:n.draft.assumptions,items:i.assumptions,empty:n.none}),(0,$.jsx)(fn,{title:n.draft.risks,items:i.risks,empty:n.none}),j?(0,$.jsxs)(`label`,{className:`mt-4 flex items-start gap-2 text-sm text-fg`,children:[(0,$.jsx)(`input`,{className:`mt-1`,type:`checkbox`,checked:o,onChange:e=>S(e.target.checked)}),(0,$.jsx)(`span`,{children:n.draft.approval})]}):null,(0,$.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,$.jsx)(G,{variant:`ghost`,onClick:C,children:n.draft.discard}),(0,$.jsxs)(G,{variant:`secondary`,onClick:g,children:[(0,$.jsx)(ne,{className:`size-4`}),n.draft.edit]}),(0,$.jsxs)(G,{variant:`secondary`,onClick:v,disabled:k||O||j&&!o,children:[(0,$.jsx)(re,{className:`size-4`}),k?n.draft.testing:n.draft.testOnce]}),(0,$.jsx)(G,{variant:`primary`,onClick:_,disabled:O||j&&!o,children:O?n.feedback.working:n.draft.publish})]})]})]}):null,t[80]=o,t[81]=i,t[82]=n.draft.approval,t[83]=n.draft.assumptions,t[84]=n.draft.discard,t[85]=n.draft.edit,t[86]=n.draft.publish,t[87]=n.draft.review,t[88]=n.draft.risks,t[89]=n.draft.safety,t[90]=n.draft.testOnce,t[91]=n.draft.testing,t[92]=n.feedback,t[93]=n.info,t[94]=n.none,t[95]=S,t[96]=C,t[97]=g,t[98]=_,t[99]=v,t[100]=O,t[101]=j,t[102]=k,t[103]=_e):_e=t[103];let ve;return t[104]!==ae||t[105]!==se||t[106]!==ge||t[107]!==_e||t[108]!==M?(ve=(0,$.jsxs)(`section`,{className:`rounded-lg border border-edge-subtle bg-surface-base p-4 shadow-surface`,children:[M,ae,se,ge,_e]}),t[104]=ae,t[105]=se,t[106]=ge,t[107]=_e,t[108]=M,t[109]=ve):ve=t[109],ve}function dn(e){return(0,$.jsx)(E,{value:e.id,children:e.name},e.id)}function fn(e){let t=(0,at.c)(10),{title:n,items:r,empty:i}=e,a;t[0]===n?a=t[1]:(a=(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:n}),t[0]=n,t[1]=a);let o;t[2]!==i||t[3]!==r?(o=r.length>0?r.map(pn):(0,$.jsx)(`li`,{className:`text-fg-muted`,children:i}),t[2]=i,t[3]=r,t[4]=o):o=t[4];let s;t[5]===o?s=t[6]:(s=(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm text-fg`,children:o}),t[5]=o,t[6]=s);let c;return t[7]!==a||t[8]!==s?(c=(0,$.jsxs)(`div`,{className:`mt-3`,children:[a,s]}),t[7]=a,t[8]=s,t[9]=c):c=t[9],c}function pn(e){return(0,$.jsxs)(`li`,{children:[`- `,e]},e)}function mn(e){let t=(0,at.c)(25),{icon:n,label:r,value:i,tone:a,active:o,onClick:s}=e,c=a===void 0?`default`:a,l=c===`danger`?`text-red-600 dark:text-red-300`:`text-fg-subtle`,u;t[0]===l?u=t[1]:(u=ue(`shrink-0`,l),t[0]=l,t[1]=u);let d;t[2]!==n||t[3]!==u?(d=(0,$.jsx)(`span`,{className:u,children:n}),t[2]=n,t[3]=u,t[4]=d):d=t[4];let f;t[5]===r?f=t[6]:(f=(0,$.jsx)(`span`,{className:`truncate text-xs font-medium text-fg-muted`,children:r}),t[5]=r,t[6]=f);let p=c===`danger`?`text-red-700 dark:text-red-300`:`text-fg`,m;t[7]===p?m=t[8]:(m=ue(`ml-auto truncate text-sm font-semibold tabular-nums`,p),t[7]=p,t[8]=m);let h;t[9]!==m||t[10]!==i?(h=(0,$.jsx)(`span`,{className:m,children:i}),t[9]=m,t[10]=i,t[11]=h):h=t[11];let g;t[12]!==d||t[13]!==f||t[14]!==h?(g=(0,$.jsxs)($.Fragment,{children:[d,f,h]}),t[12]=d,t[13]=f,t[14]=h,t[15]=g):g=t[15];let _=g,v=o&&`bg-accent/8`,y=s&&`cursor-pointer hover:bg-surface-hover focus-visible:z-10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,b;t[16]!==v||t[17]!==y?(b=ue(`flex min-h-12 min-w-0 items-center gap-2.5 bg-surface-base px-3 py-2.5 text-left transition-colors`,v,y),t[16]=v,t[17]=y,t[18]=b):b=t[18];let x=b,S=`${r}: ${i}`,C;return t[19]!==S||t[20]!==o||t[21]!==x||t[22]!==_||t[23]!==s?(C=s?(0,$.jsx)(`button`,{type:`button`,className:x,onClick:s,"aria-label":S,"aria-pressed":o,children:_}):(0,$.jsx)(`div`,{className:x,"aria-label":S,children:_}),t[19]=S,t[20]=o,t[21]=x,t[22]=_,t[23]=s,t[24]=C):C=t[24],C}function hn(e){let t=(0,at.c)(74),{runs:n,ownership:r,labels:i,language:a,unreadCount:o,loading:s,onOwnershipChange:c,onRefresh:l,onSelectRun:u}=e,d;t[0]===n?d=t[1]:(d=n.filter(Qt),t[0]=n,t[1]=d);let f=d.length,p;t[2]===n?p=t[3]:(p=n.filter($t),t[2]=n,t[3]=p);let m=p.length,h;t[4]===i.dashboard.activity?h=t[5]:(h=(0,$.jsx)(`h2`,{id:`automation-activity-title`,className:`text-sm font-semibold text-fg`,children:i.dashboard.activity}),t[4]=i.dashboard.activity,t[5]=h);let g;t[6]===i.dashboard.activityDescription?g=t[7]:(g=(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:i.dashboard.activityDescription}),t[6]=i.dashboard.activityDescription,t[7]=g);let _;t[8]!==h||t[9]!==g?(_=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[h,g]}),t[8]=h,t[9]=g,t[10]=_):_=t[10];let v=i.filters.ownership,b=r===`user`&&`bg-surface-base text-fg shadow-sm`,x;t[11]===b?x=t[12]:(x=ue(`rounded-md px-2.5 py-1.5 text-xs font-medium text-fg-muted hover:text-fg`,b),t[11]=b,t[12]=x);let S;t[13]===c?S=t[14]:(S=()=>c(`user`),t[13]=c,t[14]=S);let C=r===`user`,w;t[15]!==i.filters.userManaged||t[16]!==C||t[17]!==x||t[18]!==S?(w=(0,$.jsx)(`button`,{type:`button`,className:x,onClick:S,"aria-pressed":C,children:i.filters.userManaged}),t[15]=i.filters.userManaged,t[16]=C,t[17]=x,t[18]=S,t[19]=w):w=t[19];let T=r===`system`&&`bg-surface-base text-fg shadow-sm`,E;t[20]===T?E=t[21]:(E=ue(`rounded-md px-2.5 py-1.5 text-xs font-medium text-fg-muted hover:text-fg`,T),t[20]=T,t[21]=E);let O;t[22]===c?O=t[23]:(O=()=>c(`system`),t[22]=c,t[23]=O);let k=r===`system`,A;t[24]!==i.system.title||t[25]!==E||t[26]!==O||t[27]!==k?(A=(0,$.jsx)(`button`,{type:`button`,className:E,onClick:O,"aria-pressed":k,children:i.system.title}),t[24]=i.system.title,t[25]=E,t[26]=O,t[27]=k,t[28]=A):A=t[28];let j;t[29]!==i.filters.ownership||t[30]!==w||t[31]!==A?(j=(0,$.jsxs)(q,{className:`flex rounded-lg bg-surface-panel p-0.5`,role:`group`,"aria-label":v,indicatorClassName:`rounded-md bg-surface-base shadow-sm`,children:[w,A]}),t[29]=i.filters.ownership,t[30]=w,t[31]=A,t[32]=j):j=t[32];let M;t[33]!==i.refresh||t[34]!==s||t[35]!==l?(M=(0,$.jsx)(ge,{className:`size-9 shrink-0 p-0`,loading:s,label:i.refresh,onClick:l}),t[33]=i.refresh,t[34]=s,t[35]=l,t[36]=M):M=t[36];let N;t[37]!==j||t[38]!==M?(N=(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[j,M]}),t[37]=j,t[38]=M,t[39]=N):N=t[39];let P;t[40]!==N||t[41]!==_?(P=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3 border-b border-edge-subtle px-4 py-3 sm:px-5`,children:[_,N]}),t[40]=N,t[41]=_,t[42]=P):P=t[42];let F;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,$.jsx)(y,{className:`size-4`,"aria-hidden":!0}),t[43]=F):F=t[43];let te=i.metrics.total,I=String(n.length),L;t[44]!==i.metrics.total||t[45]!==I?(L=(0,$.jsx)(mn,{icon:F,label:te,value:I}),t[44]=i.metrics.total,t[45]=I,t[46]=L):L=t[46];let ne;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,$.jsx)(re,{className:`size-4`,"aria-hidden":!0}),t[47]=ne):ne=t[47];let ie=i.metrics.running,R=String(f),ae;t[48]!==i.metrics.running||t[49]!==R?(ae=(0,$.jsx)(mn,{icon:ne,label:ie,value:R}),t[48]=i.metrics.running,t[49]=R,t[50]=ae):ae=t[50];let z;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,$.jsx)(D,{className:`size-4`,"aria-hidden":!0}),t[51]=z):z=t[51];let oe=i.dashboard.needsAttention,se=String(m),ce=m>0?`danger`:`default`,le;t[52]!==i.dashboard.needsAttention||t[53]!==se||t[54]!==ce?(le=(0,$.jsx)(mn,{icon:z,label:oe,value:se,tone:ce}),t[52]=i.dashboard.needsAttention,t[53]=se,t[54]=ce,t[55]=le):le=t[55];let B;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,$.jsx)(ee,{className:`size-4`,"aria-hidden":!0}),t[56]=B):B=t[56];let V=i.filters.unread,H=String(o),de;t[57]!==i.filters.unread||t[58]!==H?(de=(0,$.jsx)(mn,{icon:B,label:V,value:H}),t[57]=i.filters.unread,t[58]=H,t[59]=de):de=t[59];let fe;t[60]!==L||t[61]!==ae||t[62]!==le||t[63]!==de?(fe=(0,$.jsxs)(`div`,{className:`grid grid-cols-2 gap-px border-b border-edge-subtle bg-edge-subtle lg:grid-cols-4`,children:[L,ae,le,de]}),t[60]=L,t[61]=ae,t[62]=le,t[63]=de,t[64]=fe):fe=t[64];let U;t[65]!==i||t[66]!==a||t[67]!==u||t[68]!==n?(U=n.length===0?(0,$.jsx)(On,{className:`min-h-64 rounded-none border-0 shadow-none`,icon:(0,$.jsx)(y,{className:`size-5`}),title:i.empty.runs}):(0,$.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:n.map(e=>(0,$.jsxs)(`button`,{type:`button`,className:`flex w-full min-w-0 items-start gap-3 px-4 py-3 text-left hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent sm:px-5`,onClick:()=>u(e.id),children:[(0,$.jsx)(`span`,{className:ue(`mt-1.5 size-2 shrink-0 rounded-full`,Qt(e)?`bg-blue-500`:$t(e)?`bg-red-500`:`bg-emerald-500`),"aria-hidden":!0}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.automationName}),e.readAtMs==null&&!Qt(e)?(0,$.jsx)(`span`,{className:`size-2 shrink-0 rounded-full bg-blue-500`,children:(0,$.jsx)(`span`,{className:`sr-only`,children:i.filters.unread})}):null]}),(0,$.jsx)(`span`,{className:ue(`mt-1 line-clamp-2 block text-sm text-fg-muted`,e.error&&`text-red-700 dark:text-red-300`),children:e.error||e.summary||i.status[e.status]}),(0,$.jsx)(`span`,{className:`mt-1 block text-xs text-fg-subtle`,children:Kt(e.createdAtMs,i,a)})]}),(0,$.jsx)(`span`,{className:ue(`shrink-0 rounded-full px-2 py-0.5 text-xs`,Xt(e.status)),children:i.status[e.status]})]},e.id))}),t[65]=i,t[66]=a,t[67]=u,t[68]=n,t[69]=U):U=t[69];let W;return t[70]!==P||t[71]!==fe||t[72]!==U?(W=(0,$.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge-subtle bg-surface-base shadow-surface`,"aria-labelledby":`automation-activity-title`,children:[P,fe,U]}),t[70]=P,t[71]=fe,t[72]=U,t[73]=W):W=t[73],W}function gn(e,t){let n=t.events,r=e.data&&typeof e.data==`object`?e.data:{},i=typeof r.actionKind==`string`?r.actionKind:null,a=typeof r.status==`string`&&r.status in t.status?t.status[r.status]:null;switch(e.type){case`run.queued`:return e.message.toLowerCase().includes(`manual`)?n.manualQueued:e.message.toLowerCase().includes(`scheduled`)?n.scheduledQueued:n.eventQueued;case`run.started`:return n.runStarted;case`action.started`:return i?n.actionStarted.replace(`{kind}`,i):n.actionStartedFallback;case`action.completed`:return i?n.actionCompleted.replace(`{kind}`,i):n.actionCompletedFallback;case`action.failed`:return i?n.actionFailed.replace(`{kind}`,i):n.actionFailedFallback;case`run.completed`:return a?n.runCompleted.replace(`{status}`,a):n.runCompletedFallback;default:return e.message}}function _n(e){let t=(0,at.c)(17),{value:n,labels:r,title:i,defaultExpanded:a}=e,[o,s]=(0,Q.useState)(a!==void 0&&a),c;t[0]===n?c=t[1]:(c=JSON.stringify(n,null,2),t[0]=n,t[1]=c);let l=c,u;t[2]===l?u=t[3]:(u=l.split(`
5
5
  `),t[2]=l,t[3]=u);let d=u.length,f=l.length>720||d>18,p;t[4]!==f||t[5]!==l?(p=f?`${l.split(`