@xopcai/xopc 0.0.213 → 0.0.214
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.
- package/README.md +39 -60
- package/README.zh-CN.md +39 -61
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{activity-store-Xw-pOm9A.js → activity-store-k-mNF_Dq.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-Ca1bciiK.js → agent-avatar-dicebear-B5VyiQ_K.js} +1 -1
- package/dist/gateway/static/root/assets/{agents-DD3TqNrC.js → agents-DM2l0hCI.js} +1 -1
- package/dist/gateway/static/root/assets/{api-CZK-lRew.js → api-BjN2udFQ.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-BLFIG09j.js → app-management-settings-panel-Bbul18ij.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-BsTWUq1i.js → appearance-settings-Bvvzgp00.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-cJkDKn72.js → apps-page-BWd2KUkp.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-B9LsFfEx.js → archive-plugin-DjGVsAgd.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-CsWiFfmN.js → attachment-load-BCuUeuuO.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-CbjU2e75.js → automations-page-Doof8nA6.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-workspace-C4xyo0c4.js → automations-workspace-B2eTpWQN.js} +1 -1
- package/dist/gateway/static/root/assets/{binary-plugins-DbqhT_JB.js → binary-plugins-B7WFf-lc.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-BGpHwxZ5.js → block-editor-CVwIwyUT.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-settings-page-CrhpQl-e.js → browser-settings-page-D6ua52QD.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-BXlon_hL.js → browser-workflow-inputs-Coz8pWzP.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-B3BBDM_r.js → browser-workflows-page-8a3hnSXE.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-settings-panel-B9MoPW9u.js → capabilities-settings-panel-DfTpgo4L.js} +1 -1
- package/dist/gateway/static/root/assets/{capability-presets-api-BqvMm6UW.js → capability-presets-api-BF3G84qe.js} +1 -1
- package/dist/gateway/static/root/assets/{capability-presets-settings-panel-BmwldV9R.js → capability-presets-settings-panel-DkjsA_Yn.js} +1 -1
- package/dist/gateway/static/root/assets/{channel-recipient-api-9uca5kDa.js → channel-recipient-api-8Uz95P40.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-settings-CwLqWcy_.js → channels-settings-Cv3pT5iN.js} +1 -1
- package/dist/gateway/static/root/assets/channels-status-swr-NfU9X-P5.js +1 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-DJjYT3WX.js → chat-terminal-dock-BYds3un1.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-api-XCLfuDrN.js → connectors-api-Cj4deNtI.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-CVkGtcMS.js → connectors-page-CL6PMerr.js} +1 -1
- package/dist/gateway/static/root/assets/{cron-expression-DzQN7zBR.js → cron-expression-DjBh0ZL4.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-B-r5O5qd.js → date-picker-3cIzKCZU.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-Ch2XBU2s.js → dependency-picker-VZFStrz_.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-BdjX8jde.js → desktop-pet-CRNQ4CKZ.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-CzjjgMMn.js → desktop-pet-settings-CJBeLcbV.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-BCTgGTk4.js → directory-picker-path-field-Dbq9_c33.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-6OGgOucD.js → extension-debug-page-CSFZfcz5.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-Cf6MUfCF.js → extension-page-W8vZ3Nl0.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-pSY_ZvQZ.js → extension-settings-page-D5zYR65b.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-CFJMng9v.js → gateway-config-api-BnA56bxn.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-DpiY6aub.js → gateway-config-swr-l2w9ecXl.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-aQYxNePf.js → gateway-settings-CCOOGd8A.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-BZ_6ChP4.js → gateway-startup-retry-XUzMGmLZ.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-CI33q9i1.js → heartbeat-settings-AutxO-ec.js} +1 -1
- package/dist/gateway/static/root/assets/{home-page-CAIaWs6r.js → home-page-BMpQAeHr.js} +1 -1
- package/dist/gateway/static/root/assets/{image-generation-api-DPndEWOU.js → image-generation-api-CDoOrDMq.js} +1 -1
- package/dist/gateway/static/root/assets/{index-BhstAl5i.js → index-BIBAmAjw.js} +17 -17
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-CbLJRGXR.js → keyboard-shortcuts-settings-Bcc08kso.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-BqFnCaKT.js → local-app-workbench-page-ctXGGgj1.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-Crf6c3SK.js → local-apps-page-CuwtmiCt.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-BYSRjM6g.js → locale-store-BIOMAhmR.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-BpfLQWex.js → logs-page-Vq-wDYVv.js} +1 -1
- package/dist/gateway/static/root/assets/{management-settings-mxyYWKgM.js → management-settings-gQwyJgL4.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-split-kZaPrUTM.js → markdown-split-DLSvtLDY.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-DlsczsQ1.js → markdown-view-BMDQYc6E.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-Dk67jaG6.js → media-plugins-DFdpMglM.js} +1 -1
- package/dist/gateway/static/root/assets/messages-CbbZKEfO.js +3 -0
- package/dist/gateway/static/root/assets/{notes-api-DaeeQw8A.js → notes-api-lKPk0Voa.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-CQDzw8fX.js → notes-page-BBhONbU4.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-workbench-BYiROmRJ.js → notes-workbench-CCFrzDRT.js} +2 -2
- package/dist/gateway/static/root/assets/{page-tabs-C4UkhX2U.js → page-tabs-DoQq4tt6.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-nzcjh6y0.js → preview-open-alternatives-BtJkAYOs.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-3FvW5cHm.js → product-open-page-ClyG8t4A.js} +1 -1
- package/dist/gateway/static/root/assets/{project-detail-page-p45i1sMj.js → project-detail-page-CVeA23NS.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-Y9yXB4DX.js → projects-page-DFj-bwa5.js} +1 -1
- package/dist/gateway/static/root/assets/{registry-api-Bu6OGEY2.js → registry-api-BFwvRxBn.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-CNsGY0VS.js → remote-access-hub-BgIrBYNz.js} +1 -1
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-CVqPSfUb.js → runtime-tools-settings-panel-DdTZPRU5.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-Dz6eZpqv.js → schema-form-C3Q03Hyv.js} +1 -1
- package/dist/gateway/static/root/assets/{sessions-page-BAtpgb1t.js → sessions-page-wfBSuhmo.js} +1 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-4zV9nthi.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-BaWFAZv4.js → settings-form-section-DdrNtxul.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-BWmdZfNg.js → settings-loading-skeleton-BFvEfK7v.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-Btcb-Dc8.js → settings-page-B8iNNrLN.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-BNllZUFP.js → setup-status-panel-DEBPLh04.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-CGzY3S0N.js → share-preview-page-CrsscJs3.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-CncwbTHY.js → shares-settings-Cpd3s8-P.js} +1 -1
- package/dist/gateway/static/root/assets/skill-reload-api-BrDL4HAN.js +1 -0
- package/dist/gateway/static/root/assets/{skills-page-Bi2IWpU0.js → skills-page-B1sTkjZH.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page.utils-BancvwN2.js → skills-page.utils-CIcb0h3E.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-CihjIzWx.js → system-settings-panel-MAl91hH_.js} +1 -1
- package/dist/gateway/static/root/assets/{task-detail-page-SSNFtY-d.js → task-detail-page-C5wgYuvF.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-D1_t_31B.js → theme-store-BrbF9cgL.js} +1 -1
- package/dist/gateway/static/root/assets/{typed-models-lib-C2LhiQq5.js → typed-models-lib-Peglr65V.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-tf_8rxAK.js → use-autosave-C10PZ1OV.js} +1 -1
- package/dist/gateway/static/root/assets/{user-context-page-BnPTFEar.js → user-context-page-DsAfqOJy.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-api-key-field-DN-y7Zfe.js → voice-api-key-field-bdYmX3ph.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-bqqH4aZ9.js → work-discovery-overlay-BI4wbLTm.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-2H33iXOB.js → workflow-run-setup-panel-CfmwGYkr.js} +1 -1
- package/dist/gateway/static/root/assets/{workflows-page-BnfxRf1q.js → workflows-page-D7tjtD97.js} +1 -1
- package/dist/gateway/static/root/index.html +10 -10
- package/dist/package.js +1 -1
- package/dist/src/agent/agent-manager.js +4 -4
- package/dist/src/agent/embedded/model-runtime.js +1 -1
- package/dist/src/agent/embedded/run-for-session.js +1 -1
- package/dist/src/agent/image/tool-model-config.js +1 -1
- package/dist/src/agent/ipc/inbox.js +1 -1
- package/dist/src/agent/memory/create-memory-manager.js +1 -1
- package/dist/src/agent/service.js +2 -2
- package/dist/src/agent/session/session-inspector.js +1 -1
- package/dist/src/agent/skills/hub-lock.js +1 -1
- package/dist/src/agent/tasks/task-judge-service.js +3 -3
- package/dist/src/agent-runtime/index.js +1 -1
- package/dist/src/agent-runtime/runtime-profile.js +1 -1
- package/dist/src/ai-assist/text-assist.js +1 -1
- package/dist/src/auth/credentials.js +2 -2
- package/dist/src/auth/profiles/store.js +1 -1
- package/dist/src/auth/sync-provider-auth.js +2 -2
- package/dist/src/browser/providers/browser-ext-install.js +1 -1
- package/dist/src/cli/commands/agent.js +2 -2
- package/dist/src/cli/commands/doctor/checks/provider-auth.js +1 -1
- package/dist/src/cli/commands/gateway/lifecycle.js +1 -1
- package/dist/src/cli/commands/models.js +2 -2
- package/dist/src/cli/commands/onboard.js +1 -1
- package/dist/src/cli/commands/profile.js +1 -1
- package/dist/src/cli/commands/tunnel.js +1 -1
- package/dist/src/cli/commands/update.js +1 -1
- package/dist/src/cli/extension-cli-register.js +1 -1
- package/dist/src/config/index.js +5 -5
- package/dist/src/config/loader.js +1 -1
- package/dist/src/config/models-json.js +1 -1
- package/dist/src/connectors/composio-managed-client.d.ts +1 -1
- package/dist/src/connectors/composio-session-types.d.ts +91 -0
- package/dist/src/connectors/composio-session-types.js +1 -0
- package/dist/src/connectors/composio-sessions.d.ts +2 -91
- package/dist/src/extensions/lockfile.js +1 -1
- package/dist/src/gateway/agents-admin.js +1 -1
- package/dist/src/gateway/file-path-classifier.js +1 -1
- package/dist/src/gateway/heartbeat/service.js +1 -1
- package/dist/src/gateway/hono/lib/config-payload.js +1 -1
- package/dist/src/gateway/hono/routes/models.js +1 -1
- package/dist/src/gateway/hono/routes/session-input-handler.d.ts +2 -2
- package/dist/src/gateway/run-loop.js +1 -1
- package/dist/src/gateway/service/config-coordinator.js +1 -1
- package/dist/src/gateway/service.js +9 -9
- package/dist/src/heartbeat/index.js +1 -1
- package/dist/src/providers/auth-runtime/resolve-auth.js +1 -1
- package/dist/src/providers/index.js +2 -2
- package/dist/src/providers/model-registry.js +1 -1
- package/dist/src/providers/register-runtime-providers.js +1 -1
- package/dist/src/runtime-tools/manager.js +41 -22
- package/dist/src/tui/tui-startup-resources.js +1 -1
- package/dist/src/tui/tui.js +1 -1
- package/dist/src/work-discovery/analyzer.js +16 -4
- package/dist/src/work-discovery/types.d.ts +1 -0
- package/dist/src/workflows/service/workflow-run-service.js +1 -1
- package/package.json +17 -17
- package/dist/gateway/static/root/assets/channels-status-swr-DeBw3du9.js +0 -1
- package/dist/gateway/static/root/assets/messages-DyM8OOVG.js +0 -3
- package/dist/gateway/static/root/assets/settings-advanced-gate-pgBQ21Oe.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-CcW2dhSW.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./external-link-DjqjBmc3.js";import{t as i}from"./cn-JdwAhgNB.js";import{t as a}from"./messages-DyM8OOVG.js";import{n as o}from"./locale-store-BYSRjM6g.js";import{Xr as s,_o as c,cn as l,gl as u,ln as d,ms as f,ns as p,on as m,ro as h,sn as g}from"./index-BhstAl5i.js";import{n as _,r as v}from"./settings-page-layout-BRQNel6r.js";import{r as y,t as b}from"./settings-form-section-BaWFAZv4.js";var x=e(t(),1);async function S(e,t){let n=window.electronAPI?.system;if(!h()||!n?.requestNotifications)return`unsupported`;let r=await n.requestNotifications();if(r.status!==`granted`)return r.task===`opened-settings`||r.status===`denied`?`denied`:`default`;await n.setBehavior({notifyEnabled:!0});let i=await n.showEndpointNotification({title:e,body:t});return i.ok||await n.setBehavior({notifyEnabled:!1}),i.ok?`enabled`:`default`}var C=n();function w(){let e=a(o(e=>e.language)).systemSettings.browserNotify,[t,n]=(0,x.useState)(l),[r,i]=(0,x.useState)(null),[s,c]=(0,x.useState)(!1),f=async t=>{if(!t){n(d({enabled:!1})),i(null);return}c(!0);try{let t=await m();if(t!==`granted`){i(t===`unsupported`?e.unsupported:e.denied);return}n(d({enabled:!0})),i(await g(e.testTitle,e.testBody)?e.testShown:e.failed)}finally{c(!1)}},p=e=>{n(d(e))};return(0,C.jsxs)(v,{gap:`gap-6`,children:[(0,C.jsx)(_,{title:e.pageTitle}),(0,C.jsxs)(b,{children:[(0,C.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,C.jsx)(u,{className:`size-4 text-accent`,strokeWidth:1.75}),e.title]}),(0,C.jsx)(`p`,{className:`mb-4 text-sm text-fg-muted`,children:e.description}),(0,C.jsx)(`div`,{className:`space-y-2`,children:[[`enabled`,e.enabled,e.enabledDesc],[`completed`,e.completed,e.completedDesc],[`failed`,e.failedRuns,e.failedRunsDesc]].map(([e,n,r])=>(0,C.jsxs)(`label`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,C.jsxs)(`span`,{children:[(0,C.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:n}),(0,C.jsx)(`span`,{className:`block text-xs text-fg-muted`,children:r})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:s||e!==`enabled`&&!t.enabled,checked:t[e],onChange:t=>{e===`enabled`?f(t.target.checked):p({[e]:t.target.checked})}})]},e))}),r?(0,C.jsx)(`p`,{className:`mt-3 text-sm text-fg-muted`,role:`status`,children:r}):null,(0,C.jsx)(`p`,{className:`mt-4 text-xs text-fg-muted`,children:e.limitation})]})]})}async function T(){if(typeof navigator>`u`||!navigator.mediaDevices?.getUserMedia)return!1;try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});for(let t of e.getTracks())t.stop();return!0}catch{return!1}}function E(e,t,n){return e.task===`opened-settings`?n.openedSettings:e.status===`granted`&&t?e.task===`already-granted`?n.alreadyGranted:n.granted:t?e.status===`denied`?n.denied:n.prompted:n.rendererDenied}function D(e,t){return e.task===`opened-settings`?t.openedSettings:e.status===`granted`?e.task===`already-granted`?t.alreadyGranted:t.granted:t.denied}function O(e,t){return e.task===`opened-settings`?t.openedSettings:e.status===`granted`?e.task===`already-granted`?t.alreadyGranted:t.granted:e.status===`denied`?t.denied:t.prompted}function k(e,t){return e.task===`opened-settings`?t.openedSettings:e.status===`granted`?e.task===`already-granted`?t.alreadyGranted:t.granted:e.status===`denied`?t.denied:t.prompted}var A=new Set([`microphone`,`accessibility`,`notifications`,`screen`]);function j(e,t,n){return t===`granted`?!1:e===`accessibility`&&(n===`darwin`||n===`win32`||n===`linux`)||e===`screen`&&(n===`darwin`||n===`win32`)||A.has(e)?t===`unknown`:!1}function M(e,t,n){return e===`accessibility`?!1:e===`screen`&&n===`linux`?!0:A.has(e)?t===`denied`:!0}var N=[{key:`fullDisk`,pane:`fullDisk`,platforms:[`darwin`]},{key:`screen`,pane:`screen`},{key:`microphone`,pane:`microphone`},{key:`accessibility`,pane:`accessibility`},{key:`automation`,pane:`automation`},{key:`notifications`,pane:`notifications`},{key:`location`,pane:`location`}];function P(e){return e===`linux`?N:N.filter(t=>!t.platforms||t.platforms.includes(e))}function F(e,t){let n=a(e).systemSettings.status;return t===`granted`?{label:n.granted,className:`text-emerald-600 dark:text-emerald-400`}:t===`denied`?{label:n.denied,className:`text-amber-600 dark:text-amber-400`}:{label:n.unknown,className:`text-fg-muted`}}function I(e,t,n){let r=a(e).systemSettings.permUnknown?.[t];return r?n===`darwin`&&r.darwin?r.darwin:n===`win32`&&r.win32?r.win32:n===`linux`&&r.linux?r.linux:null:null}var L={behavior:null,perms:null,loadError:null,permFeedback:null,permBusy:!1,refreshing:!1};function R(){let e=o(e=>e.language),t=a(e).systemSettings,[n,l]=(0,x.useReducer)(s,L),{behavior:u,perms:d,loadError:m,permFeedback:g,permBusy:A,refreshing:N}=n,R=typeof window<`u`?window.electronAPI?.system:void 0,z=(0,x.useCallback)(async e=>{if(R){l({type:`patch`,patch:{loadError:null}});try{l({type:`patch`,patch:{behavior:await R.getBehavior(),perms:await R.getPermissions({probe:e?.showRefreshFeedback}),...e?.showRefreshFeedback?{permFeedback:t.refreshDone}:{}}})}catch(t){l({type:`patch`,patch:{loadError:t instanceof Error?t.message:String(t),...e?.showRefreshFeedback?{permFeedback:null}:{}}})}}},[R,t.refreshDone]),B=(0,x.useCallback)(async()=>{if(!(N||A)){l({type:`patch`,patch:{refreshing:!0}});try{await z({showRefreshFeedback:!0})}finally{l({type:`patch`,patch:{refreshing:!1}})}}},[z,A,N]);if((0,x.useEffect)(()=>{let e=new Set([t.refreshDone,t.openSettingsDone,t.openSettingsFailed,t.desktopNotify.testShown]);if(!g||!e.has(g))return;let n=window.setTimeout(()=>{l({type:`patch`,patch:{permFeedback:null}})},3e3);return()=>window.clearTimeout(n)},[g,t.openSettingsDone,t.openSettingsFailed,t.refreshDone,t.desktopNotify.testShown]),(0,x.useEffect)(()=>{h()&&R&&z()},[R,z]),!h()||!R)return(0,C.jsx)(w,{});let V=async e=>{try{let{behavior:t}=await R.setBehavior(e);l({type:`patch`,patch:{behavior:t}})}catch(e){l({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}},H=async e=>{if(!e){await V({notifyEnabled:!1});return}l({type:`patch`,patch:{permBusy:!0,permFeedback:null}});try{let e=await S(t.desktopNotify.testTitle,t.desktopNotify.testBody);if(e===`unsupported`){l({type:`patch`,patch:{permFeedback:t.notificationsFeedback.unsupported}});return}if(e===`denied`){l({type:`patch`,patch:{permFeedback:t.desktopNotify.denied}});return}if(e==="default"){l({type:`patch`,patch:{permFeedback:t.notificationsFeedback.default}});return}await V({notifyEnabled:!0}),l({type:`patch`,patch:{perms:await R.getPermissions()}}),l({type:`patch`,patch:{permFeedback:t.desktopNotify.testShown}})}catch(e){l({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{l({type:`patch`,patch:{permBusy:!1}})}},U=async e=>{l({type:`patch`,patch:{permFeedback:null}}),l({type:`patch`,patch:{loadError:null}});try{(await R.openPrivacy(e)).ok?l({type:`patch`,patch:{permFeedback:t.openSettingsDone}}):l({type:`patch`,patch:{permFeedback:t.openSettingsFailed}})}catch(e){l({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}},W=async()=>{l({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),l({type:`patch`,patch:{loadError:null}});try{let e=await R.requestMicrophone(),n=await T();l({type:`patch`,patch:{perms:await R.getPermissions()}}),l({type:`patch`,patch:{permFeedback:E(e,n,t.permFeedback)}})}catch(e){l({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{l({type:`patch`,patch:{permBusy:!1}})}},G=async()=>{if(R.requestAccessibility){l({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),l({type:`patch`,patch:{loadError:null}});try{let e=await R.requestAccessibility();l({type:`patch`,patch:{perms:await R.getPermissions()}}),l({type:`patch`,patch:{permFeedback:D(e,t.accessibilityFeedback)}})}catch(e){l({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{l({type:`patch`,patch:{permBusy:!1}})}}},K=async()=>{if(R.requestNotifications){l({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),l({type:`patch`,patch:{loadError:null}});try{let e=await R.requestNotifications();l({type:`patch`,patch:{perms:await R.getPermissions()}}),l({type:`patch`,patch:{permFeedback:O(e,t.notificationsFeedback)}})}catch(e){l({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{l({type:`patch`,patch:{permBusy:!1}})}}},q=async()=>{if(R.requestScreen){l({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),l({type:`patch`,patch:{loadError:null}});try{let e=await R.requestScreen();l({type:`patch`,patch:{perms:await R.getPermissions()}}),l({type:`patch`,patch:{permFeedback:k(e,t.screenFeedback)}})}catch(e){l({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{l({type:`patch`,patch:{permBusy:!1}})}}},J=u?u.platform===`win32`?t.permissionsHintWin:u.platform===`linux`?t.permissionsHintLinux:u.platform===`darwin`?t.permissionsHintDarwin:t.permissionsHint:t.permissionsHint;return(0,C.jsxs)(v,{gap:`gap-6`,children:[(0,C.jsx)(_,{title:t.title}),m?(0,C.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:m}):null,g?(0,C.jsx)(`p`,{className:i(`text-sm`,g===t.refreshDone||g===t.openSettingsDone||g===t.permFeedback.granted||g===t.permFeedback.alreadyGranted||g===t.accessibilityFeedback.granted||g===t.accessibilityFeedback.alreadyGranted||g===t.notificationsFeedback.granted||g===t.notificationsFeedback.alreadyGranted||g===t.screenFeedback.granted||g===t.screenFeedback.alreadyGranted||g===t.desktopNotify.testShown?`text-emerald-600 dark:text-emerald-400`:`text-fg-muted`),role:`status`,"aria-live":`polite`,children:g}):null,(0,C.jsxs)(b,{children:[(0,C.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,C.jsx)(p,{className:`size-4 text-accent`,strokeWidth:1.75}),t.behaviorGroup]}),(0,C.jsxs)(`div`,{className:`space-y-2`,children:[(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.openAtLogin}),(0,C.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.openAtLoginDesc})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!u,checked:!!u?.openAtLogin,onChange:e=>{V({openAtLogin:e.target.checked})}})]}),(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.keepAwake}),(0,C.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.keepAwakeDesc})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!u,checked:!!u?.keepAwakePreferred,onChange:e=>{V({keepAwakePreferred:e.target.checked})}})]}),(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.notifyDesktop}),(0,C.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.notifyDesktopDesc})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!u||A,checked:!!u?.notifyEnabled,onChange:e=>{H(e.target.checked)}})]}),(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.notifySound}),(0,C.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.notifySoundDesc})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!u,checked:!!u?.notifySoundEnabled,onChange:e=>{V({notifySoundEnabled:e.target.checked})}})]})]})]}),u&&d?(0,C.jsxs)(`section`,{className:y(),children:[(0,C.jsxs)(`div`,{className:`mb-4 flex flex-col gap-1 sm:flex-row sm:items-center sm:justify-between`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.permissionsTitle}),(0,C.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:J}),u.platform===`darwin`&&!u.packaged?(0,C.jsx)(`p`,{className:`mt-1 text-xs text-amber-600 dark:text-amber-400`,children:t.permissionsHintDevDarwin}):null]}),(0,C.jsxs)(`button`,{type:`button`,disabled:N||A,"aria-busy":N,className:i(`mt-2 inline-flex max-w-full items-center justify-center gap-1.5 rounded-lg border border-edge bg-surface-panel px-3 py-1.5 text-sm font-medium text-fg transition-colors hover:bg-surface-hover disabled:opacity-50 sm:mt-0`,c.press),onClick:()=>void B(),children:[(0,C.jsx)(f,{className:i(`size-3.5`,N&&`animate-spin`),strokeWidth:1.75,"aria-hidden":!0}),N?t.refreshing:t.refresh]})]}),(0,C.jsx)(`ul`,{className:`space-y-3`,children:P(u.platform).map(({key:n,pane:a})=>{let o=F(e,d[n]),s=t.perm[n],l=d[n]===`unknown`?I(e,n,u.platform):null;return s?(0,C.jsxs)(`li`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,C.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:s.title}),(0,C.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:s.desc}),(0,C.jsx)(`p`,{className:`mt-1 text-xs font-medium ${o.className}`,children:o.label}),l?(0,C.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:l}):null]}),(0,C.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[n===`notifications`&&j(n,d[n],u.platform)?(0,C.jsx)(`button`,{type:`button`,disabled:A,className:i(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,c.press),onClick:()=>void K(),children:t.requestAccess}):null,n===`microphone`&&j(n,d[n],u.platform)?(0,C.jsx)(`button`,{type:`button`,disabled:A,className:i(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,c.press),onClick:()=>void W(),children:t.requestAccess}):null,n===`accessibility`&&j(n,d[n],u.platform)?(0,C.jsx)(`button`,{type:`button`,disabled:A,className:i(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,c.press),onClick:()=>void G(),children:t.requestAccess}):null,n===`screen`&&j(n,d[n],u.platform)?(0,C.jsx)(`button`,{type:`button`,disabled:A,className:i(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,c.press),onClick:()=>void q(),children:t.requestAccess}):null,M(n,d[n],u.platform)?(0,C.jsxs)(`button`,{type:`button`,className:i(`inline-flex items-center gap-1.5 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover`,c.press),onClick:()=>void U(a),children:[t.openSettings,(0,C.jsx)(r,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0})]}):null]})]},n):null})})]}):null]})}export{R as SystemSettingsPanel};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./external-link-DjqjBmc3.js";import{t as i}from"./cn-JdwAhgNB.js";import{t as a}from"./messages-CbbZKEfO.js";import{n as o}from"./locale-store-BIOMAhmR.js";import{Xr as s,_o as c,cn as l,gl as u,ln as d,ms as f,ns as p,on as m,ro as h,sn as g}from"./index-BIBAmAjw.js";import{n as _,r as v}from"./settings-page-layout-BRQNel6r.js";import{r as y,t as b}from"./settings-form-section-DdrNtxul.js";var x=e(t(),1);async function S(e,t){let n=window.electronAPI?.system;if(!h()||!n?.requestNotifications)return`unsupported`;let r=await n.requestNotifications();if(r.status!==`granted`)return r.task===`opened-settings`||r.status===`denied`?`denied`:`default`;await n.setBehavior({notifyEnabled:!0});let i=await n.showEndpointNotification({title:e,body:t});return i.ok||await n.setBehavior({notifyEnabled:!1}),i.ok?`enabled`:`default`}var C=n();function w(){let e=a(o(e=>e.language)).systemSettings.browserNotify,[t,n]=(0,x.useState)(l),[r,i]=(0,x.useState)(null),[s,c]=(0,x.useState)(!1),f=async t=>{if(!t){n(d({enabled:!1})),i(null);return}c(!0);try{let t=await m();if(t!==`granted`){i(t===`unsupported`?e.unsupported:e.denied);return}n(d({enabled:!0})),i(await g(e.testTitle,e.testBody)?e.testShown:e.failed)}finally{c(!1)}},p=e=>{n(d(e))};return(0,C.jsxs)(v,{gap:`gap-6`,children:[(0,C.jsx)(_,{title:e.pageTitle}),(0,C.jsxs)(b,{children:[(0,C.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,C.jsx)(u,{className:`size-4 text-accent`,strokeWidth:1.75}),e.title]}),(0,C.jsx)(`p`,{className:`mb-4 text-sm text-fg-muted`,children:e.description}),(0,C.jsx)(`div`,{className:`space-y-2`,children:[[`enabled`,e.enabled,e.enabledDesc],[`completed`,e.completed,e.completedDesc],[`failed`,e.failedRuns,e.failedRunsDesc]].map(([e,n,r])=>(0,C.jsxs)(`label`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,C.jsxs)(`span`,{children:[(0,C.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:n}),(0,C.jsx)(`span`,{className:`block text-xs text-fg-muted`,children:r})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:s||e!==`enabled`&&!t.enabled,checked:t[e],onChange:t=>{e===`enabled`?f(t.target.checked):p({[e]:t.target.checked})}})]},e))}),r?(0,C.jsx)(`p`,{className:`mt-3 text-sm text-fg-muted`,role:`status`,children:r}):null,(0,C.jsx)(`p`,{className:`mt-4 text-xs text-fg-muted`,children:e.limitation})]})]})}async function T(){if(typeof navigator>`u`||!navigator.mediaDevices?.getUserMedia)return!1;try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});for(let t of e.getTracks())t.stop();return!0}catch{return!1}}function E(e,t,n){return e.task===`opened-settings`?n.openedSettings:e.status===`granted`&&t?e.task===`already-granted`?n.alreadyGranted:n.granted:t?e.status===`denied`?n.denied:n.prompted:n.rendererDenied}function D(e,t){return e.task===`opened-settings`?t.openedSettings:e.status===`granted`?e.task===`already-granted`?t.alreadyGranted:t.granted:t.denied}function O(e,t){return e.task===`opened-settings`?t.openedSettings:e.status===`granted`?e.task===`already-granted`?t.alreadyGranted:t.granted:e.status===`denied`?t.denied:t.prompted}function k(e,t){return e.task===`opened-settings`?t.openedSettings:e.status===`granted`?e.task===`already-granted`?t.alreadyGranted:t.granted:e.status===`denied`?t.denied:t.prompted}var A=new Set([`microphone`,`accessibility`,`notifications`,`screen`]);function j(e,t,n){return t===`granted`?!1:e===`accessibility`&&(n===`darwin`||n===`win32`||n===`linux`)||e===`screen`&&(n===`darwin`||n===`win32`)||A.has(e)?t===`unknown`:!1}function M(e,t,n){return e===`accessibility`?!1:e===`screen`&&n===`linux`?!0:A.has(e)?t===`denied`:!0}var N=[{key:`fullDisk`,pane:`fullDisk`,platforms:[`darwin`]},{key:`screen`,pane:`screen`},{key:`microphone`,pane:`microphone`},{key:`accessibility`,pane:`accessibility`},{key:`automation`,pane:`automation`},{key:`notifications`,pane:`notifications`},{key:`location`,pane:`location`}];function P(e){return e===`linux`?N:N.filter(t=>!t.platforms||t.platforms.includes(e))}function F(e,t){let n=a(e).systemSettings.status;return t===`granted`?{label:n.granted,className:`text-emerald-600 dark:text-emerald-400`}:t===`denied`?{label:n.denied,className:`text-amber-600 dark:text-amber-400`}:{label:n.unknown,className:`text-fg-muted`}}function I(e,t,n){let r=a(e).systemSettings.permUnknown?.[t];return r?n===`darwin`&&r.darwin?r.darwin:n===`win32`&&r.win32?r.win32:n===`linux`&&r.linux?r.linux:null:null}var L={behavior:null,perms:null,loadError:null,permFeedback:null,permBusy:!1,refreshing:!1};function R(){let e=o(e=>e.language),t=a(e).systemSettings,[n,l]=(0,x.useReducer)(s,L),{behavior:u,perms:d,loadError:m,permFeedback:g,permBusy:A,refreshing:N}=n,R=typeof window<`u`?window.electronAPI?.system:void 0,z=(0,x.useCallback)(async e=>{if(R){l({type:`patch`,patch:{loadError:null}});try{l({type:`patch`,patch:{behavior:await R.getBehavior(),perms:await R.getPermissions({probe:e?.showRefreshFeedback}),...e?.showRefreshFeedback?{permFeedback:t.refreshDone}:{}}})}catch(t){l({type:`patch`,patch:{loadError:t instanceof Error?t.message:String(t),...e?.showRefreshFeedback?{permFeedback:null}:{}}})}}},[R,t.refreshDone]),B=(0,x.useCallback)(async()=>{if(!(N||A)){l({type:`patch`,patch:{refreshing:!0}});try{await z({showRefreshFeedback:!0})}finally{l({type:`patch`,patch:{refreshing:!1}})}}},[z,A,N]);if((0,x.useEffect)(()=>{let e=new Set([t.refreshDone,t.openSettingsDone,t.openSettingsFailed,t.desktopNotify.testShown]);if(!g||!e.has(g))return;let n=window.setTimeout(()=>{l({type:`patch`,patch:{permFeedback:null}})},3e3);return()=>window.clearTimeout(n)},[g,t.openSettingsDone,t.openSettingsFailed,t.refreshDone,t.desktopNotify.testShown]),(0,x.useEffect)(()=>{h()&&R&&z()},[R,z]),!h()||!R)return(0,C.jsx)(w,{});let V=async e=>{try{let{behavior:t}=await R.setBehavior(e);l({type:`patch`,patch:{behavior:t}})}catch(e){l({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}},H=async e=>{if(!e){await V({notifyEnabled:!1});return}l({type:`patch`,patch:{permBusy:!0,permFeedback:null}});try{let e=await S(t.desktopNotify.testTitle,t.desktopNotify.testBody);if(e===`unsupported`){l({type:`patch`,patch:{permFeedback:t.notificationsFeedback.unsupported}});return}if(e===`denied`){l({type:`patch`,patch:{permFeedback:t.desktopNotify.denied}});return}if(e==="default"){l({type:`patch`,patch:{permFeedback:t.notificationsFeedback.default}});return}await V({notifyEnabled:!0}),l({type:`patch`,patch:{perms:await R.getPermissions()}}),l({type:`patch`,patch:{permFeedback:t.desktopNotify.testShown}})}catch(e){l({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{l({type:`patch`,patch:{permBusy:!1}})}},U=async e=>{l({type:`patch`,patch:{permFeedback:null}}),l({type:`patch`,patch:{loadError:null}});try{(await R.openPrivacy(e)).ok?l({type:`patch`,patch:{permFeedback:t.openSettingsDone}}):l({type:`patch`,patch:{permFeedback:t.openSettingsFailed}})}catch(e){l({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}},W=async()=>{l({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),l({type:`patch`,patch:{loadError:null}});try{let e=await R.requestMicrophone(),n=await T();l({type:`patch`,patch:{perms:await R.getPermissions()}}),l({type:`patch`,patch:{permFeedback:E(e,n,t.permFeedback)}})}catch(e){l({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{l({type:`patch`,patch:{permBusy:!1}})}},G=async()=>{if(R.requestAccessibility){l({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),l({type:`patch`,patch:{loadError:null}});try{let e=await R.requestAccessibility();l({type:`patch`,patch:{perms:await R.getPermissions()}}),l({type:`patch`,patch:{permFeedback:D(e,t.accessibilityFeedback)}})}catch(e){l({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{l({type:`patch`,patch:{permBusy:!1}})}}},K=async()=>{if(R.requestNotifications){l({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),l({type:`patch`,patch:{loadError:null}});try{let e=await R.requestNotifications();l({type:`patch`,patch:{perms:await R.getPermissions()}}),l({type:`patch`,patch:{permFeedback:O(e,t.notificationsFeedback)}})}catch(e){l({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{l({type:`patch`,patch:{permBusy:!1}})}}},q=async()=>{if(R.requestScreen){l({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),l({type:`patch`,patch:{loadError:null}});try{let e=await R.requestScreen();l({type:`patch`,patch:{perms:await R.getPermissions()}}),l({type:`patch`,patch:{permFeedback:k(e,t.screenFeedback)}})}catch(e){l({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{l({type:`patch`,patch:{permBusy:!1}})}}},J=u?u.platform===`win32`?t.permissionsHintWin:u.platform===`linux`?t.permissionsHintLinux:u.platform===`darwin`?t.permissionsHintDarwin:t.permissionsHint:t.permissionsHint;return(0,C.jsxs)(v,{gap:`gap-6`,children:[(0,C.jsx)(_,{title:t.title}),m?(0,C.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:m}):null,g?(0,C.jsx)(`p`,{className:i(`text-sm`,g===t.refreshDone||g===t.openSettingsDone||g===t.permFeedback.granted||g===t.permFeedback.alreadyGranted||g===t.accessibilityFeedback.granted||g===t.accessibilityFeedback.alreadyGranted||g===t.notificationsFeedback.granted||g===t.notificationsFeedback.alreadyGranted||g===t.screenFeedback.granted||g===t.screenFeedback.alreadyGranted||g===t.desktopNotify.testShown?`text-emerald-600 dark:text-emerald-400`:`text-fg-muted`),role:`status`,"aria-live":`polite`,children:g}):null,(0,C.jsxs)(b,{children:[(0,C.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,C.jsx)(p,{className:`size-4 text-accent`,strokeWidth:1.75}),t.behaviorGroup]}),(0,C.jsxs)(`div`,{className:`space-y-2`,children:[(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.openAtLogin}),(0,C.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.openAtLoginDesc})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!u,checked:!!u?.openAtLogin,onChange:e=>{V({openAtLogin:e.target.checked})}})]}),(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.keepAwake}),(0,C.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.keepAwakeDesc})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!u,checked:!!u?.keepAwakePreferred,onChange:e=>{V({keepAwakePreferred:e.target.checked})}})]}),(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.notifyDesktop}),(0,C.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.notifyDesktopDesc})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!u||A,checked:!!u?.notifyEnabled,onChange:e=>{H(e.target.checked)}})]}),(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.notifySound}),(0,C.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.notifySoundDesc})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!u,checked:!!u?.notifySoundEnabled,onChange:e=>{V({notifySoundEnabled:e.target.checked})}})]})]})]}),u&&d?(0,C.jsxs)(`section`,{className:y(),children:[(0,C.jsxs)(`div`,{className:`mb-4 flex flex-col gap-1 sm:flex-row sm:items-center sm:justify-between`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.permissionsTitle}),(0,C.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:J}),u.platform===`darwin`&&!u.packaged?(0,C.jsx)(`p`,{className:`mt-1 text-xs text-amber-600 dark:text-amber-400`,children:t.permissionsHintDevDarwin}):null]}),(0,C.jsxs)(`button`,{type:`button`,disabled:N||A,"aria-busy":N,className:i(`mt-2 inline-flex max-w-full items-center justify-center gap-1.5 rounded-lg border border-edge bg-surface-panel px-3 py-1.5 text-sm font-medium text-fg transition-colors hover:bg-surface-hover disabled:opacity-50 sm:mt-0`,c.press),onClick:()=>void B(),children:[(0,C.jsx)(f,{className:i(`size-3.5`,N&&`animate-spin`),strokeWidth:1.75,"aria-hidden":!0}),N?t.refreshing:t.refresh]})]}),(0,C.jsx)(`ul`,{className:`space-y-3`,children:P(u.platform).map(({key:n,pane:a})=>{let o=F(e,d[n]),s=t.perm[n],l=d[n]===`unknown`?I(e,n,u.platform):null;return s?(0,C.jsxs)(`li`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,C.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:s.title}),(0,C.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:s.desc}),(0,C.jsx)(`p`,{className:`mt-1 text-xs font-medium ${o.className}`,children:o.label}),l?(0,C.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:l}):null]}),(0,C.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[n===`notifications`&&j(n,d[n],u.platform)?(0,C.jsx)(`button`,{type:`button`,disabled:A,className:i(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,c.press),onClick:()=>void K(),children:t.requestAccess}):null,n===`microphone`&&j(n,d[n],u.platform)?(0,C.jsx)(`button`,{type:`button`,disabled:A,className:i(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,c.press),onClick:()=>void W(),children:t.requestAccess}):null,n===`accessibility`&&j(n,d[n],u.platform)?(0,C.jsx)(`button`,{type:`button`,disabled:A,className:i(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,c.press),onClick:()=>void G(),children:t.requestAccess}):null,n===`screen`&&j(n,d[n],u.platform)?(0,C.jsx)(`button`,{type:`button`,disabled:A,className:i(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,c.press),onClick:()=>void q(),children:t.requestAccess}):null,M(n,d[n],u.platform)?(0,C.jsxs)(`button`,{type:`button`,className:i(`inline-flex items-center gap-1.5 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover`,c.press),onClick:()=>void U(a),children:[t.openSettings,(0,C.jsx)(r,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0})]}):null]})]},n):null})})]}):null]})}export{R as SystemSettingsPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{d as i,p as a,t as o}from"./chunk-KS7C4IRE-BaASWQor.js";import{n as s,r as c}from"./popover-select-BzdnTy3h.js";import{t as l}from"./external-link-DjqjBmc3.js";import{f as u,t as d,u as f}from"./markdown-view-DlsczsQ1.js";import{t as p}from"./x-B_N4OPjy.js";import{t as m}from"./cn-JdwAhgNB.js";import{t as h}from"./button-CSEbl4zT.js";import{l as g,n as _}from"./locale-store-BYSRjM6g.js";import{i as v,n as ee,o as te,r as ne,s as re,t as y}from"./dist-BPoKqzeH.js";import{$c as ie,$r as ae,Ca as b,Gc as x,H as S,I as oe,J as C,Ji as w,K as se,Kc as T,Os as ce,P as le,Rs as E,Sl as ue,Ss as D,X as O,Z as de,bc as fe,ca as k,ei as A,in as pe,ir as j,jc as me,la as M,n as N,nn as he,nr as ge,nt as _e,or as P,rn as F,rr as I,sr as ve,tr as L,xc as ye,zr as be}from"./index-BhstAl5i.js";import{t as xe}from"./date-picker-B-r5O5qd.js";import{t as R}from"./dependency-picker-Ch2XBU2s.js";var z=e(t(),1),B=n();function Se(e,t,n,r){return!!(e&&t!==e.version&&n!==e.value&&r!==n)}function Ce(e,t){let n={...e.task};t.title!==void 0&&(n.title=t.title),t.priority!==void 0&&(n.priority=t.priority);for(let e of[`body`,`projectId`,`milestoneId`,`parentTaskId`,`dueAt`,`ownerId`]){let r=t[e];r!==void 0&&(r===null?delete n[e]:Object.assign(n,{[e]:r}))}return n.version+=1,n.updatedAt=Date.now(),{...e,task:n}}var V=r();function we(e,t){return(t===`zh`?{backlog:`待规划`,ready:`就绪`,active:`进行中`,review:`待验收`,closed:`已完成`}:{backlog:`Backlog`,ready:`Ready`,active:`Active`,review:`Review`,closed:`Completed`})[e]}function Te(){let e=(0,B.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,V.jsxs)(`div`,{className:`space-y-4`,"aria-busy":!0,children:[(0,V.jsx)(M,{className:`h-32 rounded-2xl`}),(0,V.jsx)(M,{className:`h-52 rounded-2xl`}),(0,V.jsx)(M,{className:`h-40 rounded-2xl`})]}),e[0]=t):t=e[0],t}function Ee(e){if(e===void 0)return``;let t=new Date(e);return new Date(t.getTime()-t.getTimezoneOffset()*6e4).toISOString().slice(0,10)}function De(e){return e?new Date(`${e}T23:59:59.999`).getTime():null}var Oe=[`backlog`,`ready`,`active`,`review`,`closed`],ke=[`low`,`normal`,`high`,`critical`],Ae=(0,z.memo)(function(e){let t=(0,B.c)(20),{value:n,disabled:r,canMove:i,canApprove:a,canReopen:o,language:l,label:u,onChange:d}=e,f;t[0]!==a||t[1]!==i||t[2]!==o||t[3]!==n?(f=e=>e!==n&&(e===`closed`?!a:n===`closed`?!o:!i),t[0]=a,t[1]=i,t[2]=o,t[3]=n,t[4]=f):f=t[4];let p=f,m;t[5]===u?m=t[6]:(m=(0,V.jsx)(`span`,{children:u}),t[5]=u,t[6]=m);let h;t[7]===d?h=t[8]:(h=e=>d(e.target.value),t[7]=d,t[8]=h);let g;t[9]!==l||t[10]!==p?(g=Oe.map(e=>(0,V.jsx)(c,{value:e,disabled:p(e),children:we(e,l)},e)),t[9]=l,t[10]=p,t[11]=g):g=t[11];let _;t[12]!==r||t[13]!==h||t[14]!==g||t[15]!==n?(_=(0,V.jsx)(s,{triggerClassName:`border-0 bg-surface-hover shadow-none focus-visible:ring-2 focus-visible:ring-accent/30`,contentClassName:`border-0`,value:n,disabled:r,onChange:h,children:g}),t[12]=r,t[13]=h,t[14]=g,t[15]=n,t[16]=_):_=t[16];let v;return t[17]!==m||t[18]!==_?(v=(0,V.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[m,_]}),t[17]=m,t[18]=_,t[19]=v):v=t[19],v}),je=(0,z.memo)(function(e){let t=(0,B.c)(14),{value:n,disabled:r,label:i,labels:a,onChange:o}=e,l;t[0]===i?l=t[1]:(l=(0,V.jsx)(`span`,{children:i}),t[0]=i,t[1]=l);let u;t[2]===o?u=t[3]:(u=e=>o(e.target.value),t[2]=o,t[3]=u);let d;t[4]===a?d=t[5]:(d=ke.map(e=>(0,V.jsx)(c,{value:e,children:a[e]},e)),t[4]=a,t[5]=d);let f;t[6]!==r||t[7]!==u||t[8]!==d||t[9]!==n?(f=(0,V.jsx)(s,{triggerClassName:`border-0 bg-surface-hover shadow-none focus-visible:ring-2 focus-visible:ring-accent/30`,contentClassName:`border-0`,value:n,disabled:r,onChange:u,children:d}),t[6]=r,t[7]=u,t[8]=d,t[9]=n,t[10]=f):f=t[10];let p;return t[11]!==l||t[12]!==f?(p=(0,V.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[l,f]}),t[11]=l,t[12]=f,t[13]=p):p=t[13],p}),Me=(0,z.memo)(function(e){let t=(0,B.c)(10),{value:n,disabled:r,label:i,onChange:a}=e,o;t[0]===i?o=t[1]:(o=(0,V.jsx)(`span`,{children:i}),t[0]=i,t[1]=o);let s;t[2]!==r||t[3]!==i||t[4]!==a||t[5]!==n?(s=(0,V.jsx)(xe,{disabled:r,value:n,onChange:a,ariaLabel:i}),t[2]=r,t[3]=i,t[4]=a,t[5]=n,t[6]=s):s=t[6];let c;return t[7]!==o||t[8]!==s?(c=(0,V.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[o,s]}),t[7]=o,t[8]=s,t[9]=c):c=t[9],c}),Ne=(0,z.memo)(function(e){let t=(0,B.c)(17),{value:n,disabled:r,label:i,unassignedLabel:a,agents:o,onChange:l}=e,u;t[0]===i?u=t[1]:(u=(0,V.jsx)(`span`,{children:i}),t[0]=i,t[1]=u);let d;t[2]===l?d=t[3]:(d=e=>l(e.target.value),t[2]=l,t[3]=d);let f;t[4]===a?f=t[5]:(f=(0,V.jsx)(c,{value:``,disabled:!0,children:a}),t[4]=a,t[5]=f);let p;t[6]===o?p=t[7]:(p=o.map(Ye),t[6]=o,t[7]=p);let m;t[8]!==r||t[9]!==d||t[10]!==f||t[11]!==p||t[12]!==n?(m=(0,V.jsxs)(s,{triggerClassName:`border-0 bg-surface-hover shadow-none focus-visible:ring-2 focus-visible:ring-accent/30`,contentClassName:`border-0`,value:n,disabled:r,onChange:d,children:[f,p]}),t[8]=r,t[9]=d,t[10]=f,t[11]=p,t[12]=n,t[13]=m):m=t[13];let h;return t[14]!==u||t[15]!==m?(h=(0,V.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[u,m]}),t[14]=u,t[15]=m,t[16]=h):h=t[16],h}),Pe=(0,z.memo)(function(e){let t=(0,B.c)(8),{candidates:n,selected:r,disabled:i,labels:a,onChange:o}=e,s;t[0]===r?s=t[1]:(s=r.map(Xe),t[0]=r,t[1]=s);let c;return t[2]!==n||t[3]!==i||t[4]!==a||t[5]!==o||t[6]!==s?(c=(0,V.jsx)(R,{borderless:!0,candidates:n,selectedIds:s,disabled:i,onChange:o,labels:a}),t[2]=n,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c):c=t[7],c},(e,t)=>e.disabled===t.disabled&&e.labels===t.labels&&e.onChange===t.onChange&&e.candidates.length===t.candidates.length&&e.candidates.every((e,n)=>e.id===t.candidates[n]?.id&&e.title===t.candidates[n]?.title)&&e.selected.length===t.selected.length&&e.selected.every((e,n)=>e.id===t.selected[n]?.id&&e.title===t.selected[n]?.title)),Fe=`xopc.taskDetail.chatPanelPercent`,Ie=42;function Le(e,t){let n=Math.max(30,352/Math.max(t,1)*100),r=Math.min(60,(t-480)/Math.max(t,1)*100);return r<n?Ie:Math.min(r,Math.max(n,e))}function Re(){try{let e=Number(window.localStorage.getItem(Fe));return Number.isFinite(e)&&e>=30&&e<=60?e:Ie}catch{return Ie}}function ze(e){return e.task.phase===`closed`?e.task.resolution===`done`?`completed`:`ended`:e.attention.some(e=>e.kind===`input_required`||e.kind===`approval_required`)?`needsUser`:e.operationalState===`idle`?e.task.phase===`backlog`?`captured`:e.task.phase===`ready`?`ready`:e.task.phase===`review`?`review`:`paused`:e.operationalState}function H(e){let t=(0,B.c)(9),{items:n,empty:r,verificationByCriterion:i}=e;if(n.length===0){let e;return t[0]===r?e=t[1]:(e=(0,V.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:r}),t[0]=r,t[1]=e),e}let a;if(t[2]!==n||t[3]!==i){let e;t[5]===i?e=t[6]:(e=e=>{let t=i?.get(e)??`unverified`;return(0,V.jsxs)(`li`,{className:`flex gap-2 text-sm leading-6 text-fg`,children:[(0,V.jsx)(t===`passed`?ie:t===`failed`?T:x,{className:t===`passed`?`mt-1 size-4 shrink-0 text-success`:t===`failed`?`mt-1 size-4 shrink-0 text-danger`:`mt-1 size-4 shrink-0 text-fg-subtle`}),(0,V.jsx)(`span`,{children:e})]},e)},t[5]=i,t[6]=e),a=n.map(e),t[2]=n,t[3]=i,t[4]=a}else a=t[4];let o;return t[7]===a?o=t[8]:(o=(0,V.jsx)(`ul`,{className:`space-y-2`,children:a}),t[7]=a,t[8]=o),o}function U({taskId:e,presentation:t,backgroundPath:n}){let[r]=a(),i=_(e=>e.language),s=g(e=>e.token),c=(0,z.useMemo)(()=>de(i),[i]),p=b(e=>e.setPageHeader),v=b(e=>e.clearPageHeader),ee=A(e=>e.open),te=A(e=>e.sessionKeyOverride),ne=A(e=>e.openForSession),re=ve(e=>e.setOpen),{data:y,error:ae,mutate:x,lastChange:T,conversationLoading:pe,conversationError:M}=le(e),[xe,R]=(0,z.useState)(null),[B,we]=(0,z.useState)(()=>new Set),[Oe,ke]=(0,z.useState)([]),[U,Be]=(0,z.useState)(null),[Ve,He]=(0,z.useState)([]),[Ue,W]=(0,z.useState)(!1),[We,Ge]=(0,z.useState)(``),[Ke,G]=(0,z.useState)(!1),[qe,Je]=(0,z.useState)(``),[K,Ye]=(0,z.useState)(Re),[Xe,Ze]=(0,z.useState)(!1),Qe=(0,z.useRef)(null),$e=(0,z.useRef)(!1),et=(0,z.useRef)(!1),tt=(0,z.useRef)(``),nt=(0,z.useRef)(null),rt=(0,z.useRef)(null),it=(0,z.useRef)(null),at=(0,z.useRef)(y),[ot,q]=(0,z.useState)(null),[st,ct]=(0,z.useState)(null),lt=(0,z.useMemo)(()=>({link:c.linkDependencies,linked:c.linkedDependencies,searchPlaceholder:c.dependencySearchPlaceholder,noMatches:c.noDependencyMatches,noCandidates:c.noDependencyCandidates,remove:c.removeDependency}),[c.dependencySearchPlaceholder,c.linkDependencies,c.linkedDependencies,c.noDependencyCandidates,c.noDependencyMatches,c.removeDependency]),ut=y?.dependencies.map(e=>`${e.id}:${e.title}`).join(`\0`)??``,dt=(0,z.useMemo)(()=>f(r.get(`returnTo`),`/`,[`/projects`,`/chat`,`/notes`,`/tasks`]),[r]);at.current=y;let J=(0,z.useCallback)((e,t)=>{we(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r})},[]);(0,z.useEffect)(()=>{R(null),q(null),W(!1),G(!1),ct(null)},[e]),(0,z.useEffect)(()=>{let e=!0;return k().then(t=>{e&&He(t.items)}).catch(()=>void 0),()=>{e=!1}},[s]),(0,z.useEffect)(()=>{if(!T||T.source===`user`)return;ct(T);let e=window.setTimeout(()=>ct(null),3500);return()=>window.clearTimeout(e)},[T]),(0,z.useEffect)(()=>{let t=y?.task.projectId,n=y?.dependencies??[];if(!t){it.current=null,Be(null),ke(n);return}it.current!==t&&(it.current=t,Be(null));let r=!0;return w(t).then(t=>{if(!r)return;Be(t.project.name);let i=new Map;for(let r of[...t.tasks,...n])r.id!==e&&i.set(r.id,{id:r.id,title:r.title});ke([...i.values()])}).catch(()=>{r&&ke(n)}),()=>{r=!1}},[ut,y?.task.projectId,e]);let Y=(0,z.useCallback)(async(t,n=`command`)=>{let r=at.current;if(r){J(n,!0),R(null);try{await x(await oe(e,t,r.task.version),{revalidate:!1})}catch{R(c.actionFailed)}finally{J(n,!1)}}},[c.actionFailed,x,J,e]),X=(0,z.useCallback)(async(t,n)=>{let r=at.current;if(!r)return!1;n&&J(n,!0),R(null);try{return await x(C(e,t,r.task.version),{optimisticData:Ce(r,t),populateCache:!0,revalidate:!1,rollbackOnError:!0}),!0}catch{return R(c.actionFailed),!1}finally{n&&J(n,!1)}},[c.actionFailed,x,J,e]),ft=async()=>{if(!y)return;if($e.current){$e.current=!1;return}let e=We.trim(),t=nt.current;if(Se(t,y.task.version,y.task.title,e)){q(`title`);return}if(!e||e===y.task.title){Ge(y.task.title),W(!1);return}await X({title:e})&&(q(null),W(!1))},pt=async()=>{if(!y)return;if(et.current){et.current=!1;return}let e=qe.trim(),t=rt.current;if(Se(t,y.task.version,y.task.body??``,e)){q(`description`);return}if(qe===tt.current||e===(y.task.body??``).trim()){G(!1);return}await X({body:e||null})&&(q(null),G(!1))},mt=(0,z.useCallback)(async e=>{let t=at.current;if(!(!t||e===t.task.phase)){if(t.task.phase===`closed`){await Y({type:`reopen`,phase:e===`closed`?`ready`:e},`phase`);return}if(e===`closed`){await Y({type:`close`,resolution:`done`},`phase`);return}await Y({type:`move`,phase:e},`phase`)}},[Y]),ht=(0,z.useCallback)(e=>{X({priority:e},`priority`)},[X]),gt=(0,z.useCallback)(e=>{X({dueAt:De(e)},`dueAt`)},[X]),_t=(0,z.useCallback)(e=>{Ye(e);try{window.localStorage.setItem(Fe,String(e))}catch{}},[]),vt=(0,z.useCallback)(e=>{if(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`&&e.key!==`Home`)return;e.preventDefault();let t=Qe.current?.clientWidth??0;_t(Le(e.key===`Home`?Ie:K+(e.key===`ArrowLeft`?2:-2),t))},[K,_t]),yt=(0,z.useCallback)(e=>{if(!window.matchMedia(`(min-width: 1024px)`).matches)return;let t=Qe.current;if(!t)return;e.preventDefault();let n=e.currentTarget,r=e.pointerId;n.setPointerCapture(r),Ze(!0);let i=K,a=0,o=()=>{a=0,t.style.setProperty(`--task-chat-panel-width`,`${i}%`)},s=e=>{let n=t.getBoundingClientRect();i=Le((n.right-e.clientX)/n.width*100,n.width),a===0&&(a=window.requestAnimationFrame(o))},c=()=>{a!==0&&(window.cancelAnimationFrame(a),o());try{n.releasePointerCapture(r)}catch{}Ze(!1),_t(i),window.removeEventListener(`pointermove`,s),window.removeEventListener(`pointerup`,c),window.removeEventListener(`pointercancel`,c)};window.addEventListener(`pointermove`,s),window.addEventListener(`pointerup`,c),window.addEventListener(`pointercancel`,c)},[K,_t]),bt=(0,z.useCallback)(async t=>{let n=at.current;if(n){J(`dependencies`,!0),R(null);try{await x(await O(e,t,n.task.version),{revalidate:!1})}catch{R(c.dependencyUpdateFailed)}finally{J(`dependencies`,!1)}}},[c.dependencyUpdateFailed,x,J,e]),xt=(0,z.useCallback)(async t=>{let n=at.current;if(!(!n||!t||t===n.conversation.currentExecutorAgentId)){J(`delegateAgentId`,!0),R(null);try{await x(await S(e,t,n.task.version),{revalidate:!1})}catch{R(c.actionFailed)}finally{J(`delegateAgentId`,!1)}}},[c.actionFailed,x,J,e]);if((0,z.useLayoutEffect)(()=>{if(t!==`modal`)return p({startExtra:(0,V.jsx)(o,{to:dt,className:`flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover`,"aria-label":c.backToWork,children:(0,V.jsx)(ue,{className:`size-4`})}),main:y?(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`p`,{className:`truncate text-sm font-semibold text-fg`,children:U?`${U} / ${c.taskLabel}`:c.taskLabel}),(0,V.jsx)(`p`,{className:`text-xs text-fg-muted`,children:c.detailStatuses[ze(y)]})]}):null,end:null}),v},[v,c.backToWork,c.detailStatuses,c.taskLabel,y,t,U,dt,p]),ae&&!y)return(0,V.jsx)(`div`,{className:t===`modal`?`p-5 text-sm text-danger`:`mx-auto max-w-3xl p-6 text-sm text-danger`,children:c.taskNotFound});if(!y)return(0,V.jsx)(`div`,{className:t===`modal`?`p-5`:`mx-auto max-w-4xl p-4 sm:p-6`,children:(0,V.jsx)(Te,{})});let St=y.waits[0],Ct=St?.kind===`paused`?St:void 0,Z=y.receipts[0],wt=c.detailStatuses[ze(y)],Tt=c.detailStatusDescriptions[ze(y)],Et=y.task.body?.trim()||y.task.contract?.objective.trim(),Dt=new Map(Z?.verification.checks.map(e=>[e.criterion,e.status])),Ot=y.allowedCommands.includes(`mark_ready`),kt=y.allowedCommands.includes(`start`),At=y.allowedCommands.includes(`add_wait`),jt=y.task.phase===`review`&&y.allowedCommands.includes(`close`),Mt=y.allowedCommands.includes(`reopen`),Q=y.conversation.activeSessionKey,Nt=y.conversation.currentExecutorAgentId??y.task.delegateAgentId??y.task.ownerId,Pt=Ve.find(e=>e.id===Nt),Ft=!!(Q&&ee&&te===Q),It=y.attention.some(e=>e.kind===`input_required`||e.kind===`approval_required`),Lt=y.task.contract?.acceptanceCriteria??[],Rt=Lt.filter(e=>Dt.get(e)===`passed`).length,zt=y.task.contract?.expectedOutputs??[],Bt=y.task.contract?.constraints??[],Vt=y.task.contract?.approvalRequired??[],Ht=y.task.contract?.assumptions??[],Ut=y.task.contract?.risks??[],$=(...e)=>!!st?.changedFields.some(t=>e.includes(t)),Wt=e=>t===`modal`&&n?F(n,e):u(`/tasks/${e}`,dt),Gt=y.allowedCommands.includes(`move`),Kt=B.has(`command`),qt=(0,V.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[Ot?(0,V.jsxs)(h,{variant:`primary`,disabled:Kt,onClick:()=>void Y({type:`mark_ready`}),children:[(0,V.jsx)(D,{className:`size-4`}),c.scheduleTask]}):null,Ct?(0,V.jsxs)(h,{variant:`primary`,disabled:Kt,onClick:()=>void Y({type:`resolve_wait`,waitId:Ct.id}),children:[(0,V.jsx)(D,{className:`size-4`}),c.resumeTask]}):null,!St&&kt&&Nt?(0,V.jsxs)(h,{variant:`primary`,disabled:Kt,onClick:()=>void Y({type:`start`,executor:{kind:`agent`,agentId:Nt}}),children:[(0,V.jsx)(D,{className:`size-4`}),c.runTask]}):null,jt?(0,V.jsxs)(h,{variant:`primary`,disabled:Kt,onClick:()=>void Y({type:`close`,resolution:`done`}),children:[(0,V.jsx)(ie,{className:`size-4`}),c.approveTask]}):null,Mt?(0,V.jsxs)(h,{variant:`primary`,disabled:Kt,onClick:()=>void Y({type:`reopen`,phase:`ready`}),children:[(0,V.jsx)(D,{className:`size-4`}),c.reopenTask]}):null,!St&&At?(0,V.jsxs)(h,{variant:`secondary`,className:`border-0 bg-surface-hover shadow-none`,disabled:Kt,onClick:()=>void Y({type:`add_wait`,wait:{kind:`paused`,reason:`Paused by user`,condition:{}}}),children:[(0,V.jsx)(ce,{className:`size-4`}),c.pauseTask]}):null,y.task.phase===`closed`?null:(0,V.jsxs)(j,{children:[(0,V.jsx)(P,{asChild:!0,children:(0,V.jsx)(h,{type:`button`,variant:`ghost`,className:`size-9 p-0`,disabled:Kt,"aria-label":c.moreActions,children:(0,V.jsx)(me,{className:`size-4`,"aria-hidden":!0})})}),(0,V.jsx)(I,{children:(0,V.jsx)(L,{align:`end`,sideOffset:6,className:`z-[100] min-w-40 rounded-lg border border-edge bg-surface-panel p-1 shadow-popover`,children:(0,V.jsx)(ge,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-danger outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:()=>void Y({type:`close`,resolution:`cancelled`}),children:c.cancelTask})})})]})]});return(0,V.jsxs)(`div`,{ref:Qe,className:`${t===`modal`?`flex h-full min-h-0 flex-col lg:flex-row`:`flex min-h-[calc(100dvh-8rem)] flex-col overflow-hidden lg:flex-row`} ${Xe?`lg:cursor-col-resize lg:select-none`:``}`,style:{"--task-chat-panel-width":`${K}%`},children:[(0,V.jsxs)(`section`,{className:`task-detail-scroll min-w-0 flex-1 overflow-y-auto overscroll-contain p-5 sm:p-6`,children:[(0,V.jsxs)(`header`,{className:m(`px-4 pb-5`,$(`title`)&&`task-detail-live-update`),children:[(0,V.jsx)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:(0,V.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:[U?(0,V.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,V.jsx)(ye,{className:`size-3.5`,"aria-hidden":!0}),U]}):null,(0,V.jsx)(`span`,{children:`/`}),(0,V.jsx)(`span`,{children:c.taskLabel}),st?(0,V.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent-fg`,role:`status`,children:st.source===`agent`?i===`zh`?`Agent 刚刚更新`:`Updated by Agent`:i===`zh`?`执行结果已同步`:`Execution result synced`}):null]}),Ue?(0,V.jsx)(`input`,{autoFocus:!0,"data-task-inline-editor":!0,value:We,onChange:e=>Ge(e.target.value),onBlur:()=>void ft(),onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur(),e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),$e.current=!0,Ge(y.task.title),W(!1),queueMicrotask(()=>{$e.current=!1}))},className:`mt-3 w-full max-w-3xl rounded-lg bg-surface-hover px-3 py-2 text-2xl font-semibold leading-8 text-fg outline-none ring-2 ring-accent/30 focus:ring-accent/60`}):(0,V.jsx)(`button`,{type:`button`,className:`mt-3 block max-w-3xl rounded-lg text-left outline-none hover:bg-surface-hover focus-visible:bg-surface-hover`,onClick:()=>{nt.current={value:y.task.title,version:y.task.version},q(null),Ge(y.task.title),W(!0)},children:(0,V.jsx)(`h1`,{className:`text-2xl font-semibold leading-8 text-fg`,children:y.task.title})}),ot===`title`?(0,V.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-warning`,role:`alert`,children:[(0,V.jsx)(`span`,{children:i===`zh`?`Agent 在你编辑期间更新了标题。`:`The Agent updated the title while you were editing.`}),(0,V.jsx)(`button`,{type:`button`,className:`rounded-md bg-surface-hover px-2 py-1 text-fg`,onClick:()=>{Ge(y.task.title),q(null),W(!1)},children:i===`zh`?`使用 Agent 版本`:`Use Agent version`}),(0,V.jsx)(`button`,{type:`button`,className:`rounded-md bg-accent-soft px-2 py-1 text-accent-fg`,onClick:()=>void X({title:We.trim()}).then(e=>{e&&(q(null),W(!1))}),children:i===`zh`?`保留我的修改`:`Keep my changes`})]}):null]})}),xe?(0,V.jsx)(`p`,{className:`mt-3 text-sm text-danger`,children:xe}):null]}),(0,V.jsxs)(`div`,{className:`mt-5 flex flex-col gap-5`,children:[(0,V.jsxs)(`main`,{className:`order-2 min-w-0 space-y-5`,children:[(0,V.jsxs)(`section`,{className:m(`rounded-xl bg-surface-panel p-4`,$(`body`)&&`task-detail-live-update`),children:[(0,V.jsx)(`h2`,{className:`font-medium text-fg`,children:c.taskDescription}),Ke?(0,V.jsx)(`textarea`,{autoFocus:!0,"data-task-inline-editor":!0,rows:6,value:qe,onChange:e=>Je(e.target.value),onBlur:()=>void pt(),onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),et.current=!0,Je(y.task.body??y.task.contract?.objective??``),G(!1),queueMicrotask(()=>{et.current=!1}))},className:`mt-3 w-full resize-y rounded-lg bg-surface-hover px-3 py-2 text-sm leading-6 text-fg outline-none ring-2 ring-accent/20 focus:ring-accent/50`}):(0,V.jsx)(`button`,{type:`button`,className:`-mx-1 mt-2 block w-[calc(100%+0.5rem)] rounded-lg px-1 py-1 text-left outline-none hover:bg-surface-hover focus-visible:bg-surface-hover`,onClick:()=>{let e=y.task.body??y.task.contract?.objective??``;tt.current=e,rt.current={value:y.task.body??``,version:y.task.version},q(null),Je(e),G(!0)},children:(0,V.jsx)(`span`,{className:`whitespace-pre-wrap text-sm leading-6 text-fg-muted`,children:Et&&Et!==y.task.title?Et:c.noTaskDescription})}),ot===`description`?(0,V.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-warning`,role:`alert`,children:[(0,V.jsx)(`span`,{children:i===`zh`?`Agent 在你编辑期间更新了描述。`:`The Agent updated the description while you were editing.`}),(0,V.jsx)(`button`,{type:`button`,className:`rounded-md bg-surface-hover px-2 py-1 text-fg`,onClick:()=>{Je(y.task.body??``),q(null),G(!1)},children:i===`zh`?`使用 Agent 版本`:`Use Agent version`}),(0,V.jsx)(`button`,{type:`button`,className:`rounded-md bg-accent-soft px-2 py-1 text-accent-fg`,onClick:()=>void X({body:qe.trim()||null}).then(e=>{e&&(q(null),G(!1))}),children:i===`zh`?`保留我的修改`:`Keep my changes`})]}):null]}),y.attention.length>0?(0,V.jsxs)(`section`,{className:m(`rounded-xl bg-warning/10 p-4`,$(`attention`)&&`task-detail-live-update`),children:[(0,V.jsx)(`h3`,{className:`font-medium text-fg`,children:It?c.needsAttention:c.waitingStatus}),(0,V.jsx)(`ul`,{className:`mt-3 space-y-2 text-sm text-fg-muted`,children:y.attention.map((e,t)=>(0,V.jsx)(`li`,{children:e.summary},`${e.kind}-${t}`))})]}):null,(0,V.jsxs)(`section`,{className:m(`rounded-xl bg-surface-panel p-4`,$(`contract`)&&`task-detail-live-update`),children:[(0,V.jsx)(`h2`,{className:`font-medium text-fg`,children:c.taskDefinition}),(0,V.jsxs)(`div`,{className:`mt-5`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,V.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:c.successDefinition}),Lt.length>0?(0,V.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:c.criteriaProgress.replace(`{{verified}}`,String(Rt)).replace(`{{total}}`,String(Lt.length))}):null]}),(0,V.jsx)(`div`,{className:`mt-3`,children:(0,V.jsx)(H,{items:Lt,empty:c.noDefinition,verificationByCriterion:Dt})})]}),zt.length>0?(0,V.jsxs)(`div`,{className:`mt-5 rounded-lg bg-surface-hover p-4`,children:[(0,V.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:c.expectedOutputs}),(0,V.jsx)(`div`,{className:`mt-3`,children:(0,V.jsx)(H,{items:zt,empty:c.noDefinition})})]}):null,Bt.length>0?(0,V.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,V.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:c.constraints}),(0,V.jsx)(`div`,{className:`mt-3`,children:(0,V.jsx)(H,{items:Bt,empty:c.noDefinition})})]}):null,Vt.length>0?(0,V.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,V.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:c.approvalRequired}),(0,V.jsx)(`div`,{className:`mt-3`,children:(0,V.jsx)(H,{items:Vt,empty:c.noDefinition})})]}):null,Ht.length>0?(0,V.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,V.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:c.contextAssumptions}),(0,V.jsx)(`div`,{className:`mt-3`,children:(0,V.jsx)(H,{items:Ht,empty:c.noDefinition})})]}):null,Ut.length>0?(0,V.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,V.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:c.contextRisks}),(0,V.jsx)(`div`,{className:`mt-3`,children:(0,V.jsx)(H,{items:Ut,empty:c.noDefinition})})]}):null]}),Z?(0,V.jsxs)(`section`,{className:m(`rounded-xl bg-surface-panel p-4`,$(`runs`,`receipts`)&&`task-detail-live-update`),children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,V.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,V.jsx)(`h2`,{className:`font-medium text-fg`,children:c.latestResult}),(0,V.jsx)(d,{content:Z.summary,compact:!0,className:`mt-2 text-sm leading-6 text-fg`,openHttpLinksInNewTab:!0})]}),(0,V.jsxs)(`span`,{className:`rounded-full bg-surface-hover px-2.5 py-1 text-xs text-fg-muted`,children:[c.receiptStatuses[Z.status],` · `,c.verificationStatuses[Z.verification.status]]})]}),Z.remainingWork.length>0?(0,V.jsxs)(`div`,{className:`mt-4`,children:[(0,V.jsx)(`h3`,{className:`text-xs font-medium text-fg-muted`,children:c.remainingWork}),(0,V.jsx)(`div`,{className:`mt-2`,children:(0,V.jsx)(H,{items:Z.remainingWork,empty:c.noRemainingWork})})]}):null,Z.nextAction?(0,V.jsxs)(`div`,{className:`mt-4 rounded-lg bg-surface-hover p-3`,children:[(0,V.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:c.nextAction}),(0,V.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:Z.nextAction})]}):null,(0,V.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2`,children:[(0,V.jsx)(h,{className:`border-0 bg-surface-hover px-2 py-1 text-xs shadow-none`,variant:`secondary`,onClick:()=>void se(Z.runId,`helpful`),children:c.doneWell}),(0,V.jsx)(h,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>void se(Z.runId,`not_helpful`),children:c.needsFix}),Z.evidence.filter(e=>e.uri).map(e=>(0,V.jsxs)(`a`,{className:`ml-auto inline-flex items-center gap-1 text-xs text-accent hover:underline`,href:e.uri,children:[(0,V.jsx)(l,{className:`size-3`}),e.title]},`${e.title}-${e.uri}`))]}),y.receipts.length>1?(0,V.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,V.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted`,children:c.executionHistory.replace(`{{count}}`,String(y.receipts.length-1))}),(0,V.jsx)(`div`,{className:`mt-3 space-y-3`,children:y.receipts.slice(1).map(e=>(0,V.jsx)(`article`,{className:`rounded-lg bg-surface-active p-3`,children:(0,V.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,V.jsx)(`p`,{className:`text-sm text-fg`,children:e.summary}),(0,V.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:c.receiptStatuses[e.status]})]})},e.runId))})]}):null]}):null,y.context.length>0?(0,V.jsxs)(`section`,{className:m(`rounded-xl bg-surface-panel p-4`,$(`context`)&&`task-detail-live-update`),children:[(0,V.jsx)(`h2`,{className:`font-medium text-fg`,children:c.contextUsed}),(0,V.jsx)(`ul`,{className:`mt-4 grid gap-2 sm:grid-cols-2`,children:y.context.map(e=>(0,V.jsxs)(`li`,{className:`min-w-0 rounded-lg bg-surface-hover p-2.5`,children:[(0,V.jsxs)(`span`,{className:`text-[11px] text-fg-subtle`,children:[c.contextRoleLabels[e.role],` · `,c.contextKindLabels[e.targetKind]]}),e.targetKind===`url`&&/^https?:\/\//.test(e.targetId)?(0,V.jsx)(`a`,{className:`mt-1 block break-all text-sm text-accent hover:underline`,href:e.targetId,target:`_blank`,rel:`noreferrer`,children:e.title??e.targetId}):(0,V.jsx)(`p`,{className:`mt-1 break-words text-sm text-fg`,children:e.title??e.targetId})]},e.id))})]}):null]}),(0,V.jsxs)(`aside`,{className:`order-1 min-w-0 space-y-4`,children:[(0,V.jsxs)(`section`,{className:m(`rounded-xl bg-surface-subtle p-4`,$(`phase`,`resolution`,`priority`,`dueAt`,`delegateAgentId`)&&`task-detail-live-update`),children:[(0,V.jsx)(`h2`,{className:`font-medium text-fg`,children:c.taskProperties}),(0,V.jsxs)(`div`,{className:`mt-4 grid gap-4 sm:grid-cols-2`,children:[(0,V.jsx)(Ae,{value:y.task.phase,disabled:B.has(`phase`),canMove:Gt,canApprove:jt,canReopen:Mt,language:i,label:c.taskPhase,onChange:mt}),(0,V.jsx)(je,{value:y.task.priority,disabled:B.has(`priority`),label:c.priority,labels:c.priorityLabels,onChange:ht}),(0,V.jsx)(Me,{value:Ee(y.task.dueAt),disabled:B.has(`dueAt`),label:c.dueDate,onChange:gt}),(0,V.jsx)(Ne,{value:y.conversation.currentExecutorAgentId??``,disabled:B.has(`delegateAgentId`),label:c.executorLabel,unassignedLabel:c.unassigned,agents:Ve,onChange:xt}),U?(0,V.jsxs)(`div`,{className:`grid gap-1 text-xs text-fg-muted`,children:[(0,V.jsx)(`span`,{children:c.projectLabel}),(0,V.jsxs)(`span`,{className:`flex items-center gap-1.5 rounded-lg bg-surface-hover px-3 py-2 text-sm text-fg`,children:[(0,V.jsx)(ye,{className:`size-3.5`}),U]})]}):null]}),(0,V.jsxs)(`div`,{className:`mt-4 rounded-lg bg-surface-hover p-3 text-xs leading-5 text-fg-subtle`,children:[(0,V.jsx)(`p`,{children:wt}),(0,V.jsx)(`p`,{children:Tt}),(0,V.jsx)(`p`,{className:`mt-2`,children:c.updatedAt.replace(`{{date}}`,be(y.task.updatedAt,i))})]})]}),(0,V.jsxs)(`section`,{className:m(`rounded-xl bg-surface-panel p-4`,$(`dependencies`)&&`task-detail-live-update`),children:[(0,V.jsx)(`h2`,{className:`font-medium text-fg`,children:c.taskRelations}),(0,V.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:c.dependencies}),(0,V.jsx)(Pe,{candidates:Oe,selected:y.dependencies,disabled:B.has(`dependencies`),labels:lt,onChange:bt})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:c.dependents}),y.dependents.length>0?(0,V.jsx)(`div`,{className:`space-y-1.5`,children:y.dependents.map(e=>(0,V.jsx)(o,{to:Wt(e.id),className:`block rounded-lg bg-surface-hover p-2.5 text-sm text-accent hover:underline`,children:e.title},e.id))}):(0,V.jsx)(`p`,{className:`text-sm text-fg-subtle`,children:c.noDependents})]})]})]})]})]})]}),(0,V.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":i===`zh`?`调整任务信息和 Agent 对话的宽度`:`Resize task details and Agent chat`,"aria-valuemin":30,"aria-valuemax":60,"aria-valuenow":Math.round(K),tabIndex:0,onPointerDown:yt,onKeyDown:vt,onDoubleClick:()=>_t(Ie),className:`group hidden w-2 shrink-0 cursor-col-resize touch-none items-stretch justify-center bg-surface-panel outline-none transition-colors hover:bg-surface-hover focus-visible:bg-surface-hover lg:flex ${Xe?`bg-surface-hover`:``}`,children:(0,V.jsx)(`div`,{className:`my-3 w-px rounded-full bg-edge-strong/70 transition-colors group-hover:bg-accent group-focus-visible:bg-accent`})}),(0,V.jsxs)(`aside`,{className:`flex min-h-[34rem] min-w-0 flex-col bg-surface-panel lg:min-h-0 lg:w-[var(--task-chat-panel-width)] lg:shrink-0`,children:[(0,V.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-3 bg-surface-subtle px-4 py-3.5`,children:[(0,V.jsx)(`div`,{className:`min-w-0`,children:(0,V.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[Nt?(0,V.jsx)(_e,{agentId:Nt,avatar:Pt?.avatar,size:28,className:`shrink-0`}):null,(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:i===`zh`?`Agent 执行与对话`:`Agent execution and chat`}),(0,V.jsxs)(`p`,{className:`mt-0.5 truncate text-xs text-fg-muted`,children:[Pt?.name??Nt??c.unassigned,` · `,wt]})]})]})}),(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[qt,Q&&t!==`modal`?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(h,{type:`button`,variant:`ghost`,className:m(`h-8 shrink-0 px-2 text-xs`,Ft&&`bg-surface-hover text-fg`),"aria-label":i===`zh`?`项目文件`:`Project files`,"aria-pressed":Ft,onClick:()=>{re(Q,!1),ne(Q)},children:[(0,V.jsx)(fe,{className:`size-3.5`,"aria-hidden":!0}),i===`zh`?`文件`:`Files`]}),(0,V.jsx)(h,{asChild:!0,variant:`ghost`,className:`h-8 shrink-0 px-2 text-xs`,children:(0,V.jsxs)(o,{to:he(e),children:[(0,V.jsx)(l,{className:`size-3.5`}),i===`zh`?`全屏`:`Full screen`]})})]}):null]})]}),Q?(0,V.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,V.jsx)(N,{embedded:!0,sessionKey:Q,taskId:e})}):pe?(0,V.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,V.jsxs)(`div`,{className:`max-w-xs`,children:[(0,V.jsx)(E,{className:`mx-auto size-8 animate-pulse text-fg-subtle`}),(0,V.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:i===`zh`?`正在创建任务会话`:`Creating task conversation`})]})}):M?(0,V.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,V.jsxs)(`div`,{className:`max-w-xs`,children:[(0,V.jsx)(E,{className:`mx-auto size-8 text-danger`}),(0,V.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:i===`zh`?`任务会话创建失败`:`Could not create task conversation`}),(0,V.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:M instanceof Error?M.message:String(M)})]})}):(0,V.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,V.jsxs)(`div`,{className:`max-w-xs`,children:[(0,V.jsx)(E,{className:`mx-auto size-8 text-fg-subtle`}),(0,V.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:i===`zh`?`等待任务会话`:`Waiting for a task conversation`}),(0,V.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:i===`zh`?`安排或开始任务后,Agent 的执行过程和持续对话会显示在这里。`:`Schedule or start the task to see the agent run and continue the conversation here.`})]})})]})]})}function Be(){let e=(0,B.c)(2),{taskId:t}=i(),n=t===void 0?``:t,r;return e[0]===n?r=e[1]:(r=(0,V.jsx)(U,{taskId:n,presentation:`page`}),e[0]=n,e[1]=r),r}function Ve(e){let t=(0,B.c)(54),{taskId:n,backgroundPath:r,onClose:i}=e,a=_(K),{data:s}=le(n),c=s?.conversation.activeSessionKey??null,u=A(Je),d=A(qe),f=A(G),h=A(Ke),g=ve(Ge),ie=ae(We),b=ae(W),x=u?d:0,S;t[0]!==i||t[1]!==b?(S=e=>{e||(b(null),i())},t[0]=i,t[1]=b,t[2]=S):S=t[2];let oe=a===`zh`?`关闭任务详情`:`Close task details`,C;t[3]!==i||t[4]!==b?(C=()=>{b(null),i()},t[3]=i,t[4]=b,t[5]=C):C=t[5];let w;t[6]!==oe||t[7]!==C?(w=(0,V.jsx)(`button`,{type:`button`,tabIndex:-1,"data-task-modal-backdrop":!0,className:`fixed inset-0 z-[80] bg-black/45 backdrop-blur-[1px]`,"aria-label":oe,onClick:C}),t[6]=oe,t[7]=C,t[8]=w):w=t[8];let se=u?`true`:`false`,T=`${x/2}px`,ce=`${x}px`,E;t[9]!==T||t[10]!==ce?(E={"--task-detail-workspace-offset":T,"--task-detail-workspace-width":ce},t[9]=T,t[10]=ce,t[11]=E):E=t[11];let ue=E,D=a===`zh`?`任务详情`:`Task details`,O;t[12]===D?O=t[13]:(O=(0,V.jsx)(re,{className:`font-medium text-fg`,children:D}),t[12]=D,t[13]=O);let de=a===`zh`?`查看并操作任务详情`:`View and manage task details`,k;t[14]===de?k=t[15]:(k=(0,V.jsx)(v,{className:`sr-only`,children:de}),t[14]=de,t[15]=k);let j;t[16]!==c||t[17]!==a||t[18]!==h||t[19]!==g||t[20]!==n||t[21]!==u||t[22]!==f?(j=c?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`button`,{type:`button`,className:m(`flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,u&&f===c&&`bg-surface-hover text-fg`),"aria-label":a===`zh`?`项目文件`:`Project files`,title:a===`zh`?`项目文件`:`Project files`,"aria-pressed":u&&f===c,onClick:()=>{g(c,!1),h(c)},children:(0,V.jsx)(fe,{className:`size-4`,"aria-hidden":!0})}),(0,V.jsx)(o,{to:he(n),className:`flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":a===`zh`?`全屏打开对话`:`Open chat full screen`,title:a===`zh`?`全屏打开对话`:`Open chat full screen`,children:(0,V.jsx)(l,{className:`size-4`,"aria-hidden":!0})})]}):null,t[16]=c,t[17]=a,t[18]=h,t[19]=g,t[20]=n,t[21]=u,t[22]=f,t[23]=j):j=t[23];let me=a===`zh`?`关闭任务详情`:`Close task details`,M;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,V.jsx)(p,{className:`size-4`,"aria-hidden":!0}),t[24]=M):M=t[24];let N;t[25]===me?N=t[26]:(N=(0,V.jsx)(ee,{className:`flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":me,children:M}),t[25]=me,t[26]=N);let ge;t[27]!==j||t[28]!==N?(ge=(0,V.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[j,N]}),t[27]=j,t[28]=N,t[29]=ge):ge=t[29];let _e;t[30]!==O||t[31]!==k||t[32]!==ge?(_e=(0,V.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-3 bg-surface-panel px-5 py-3.5`,children:[O,k,ge]}),t[30]=O,t[31]=k,t[32]=ge,t[33]=_e):_e=t[33];let P;t[34]!==r||t[35]!==n?(P=(0,V.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,V.jsx)(U,{taskId:n,presentation:`modal`,backgroundPath:r})}),t[34]=r,t[35]=n,t[36]=P):P=t[36];let F;t[37]!==_e||t[38]!==P||t[39]!==se||t[40]!==ue?(F=(0,V.jsxs)(ne,{className:`task-detail-modal-content fixed top-1/2 z-[90] flex h-[min(54rem,calc(100dvh-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl bg-surface-base shadow-float focus:outline-none`,"data-workspace-panel-open":se,style:ue,onEscapeKeyDown:Ue,onInteractOutside:He,children:[_e,P]}),t[37]=_e,t[38]=P,t[39]=se,t[40]=ue,t[41]=F):F=t[41];let I;t[42]!==ie||t[43]!==u||t[44]!==d||t[45]!==f?(I=ie?(0,V.jsx)(`div`,{className:`fixed inset-y-0 left-0 z-[100] flex min-h-0 min-w-0 overflow-hidden bg-surface-panel transition-[right] duration-200 ease-out motion-reduce:transition-none`,style:{right:u?d:0},children:(0,V.jsx)(pe,{allowOutsideChat:!0,sessionKey:f??void 0})}):null,t[42]=ie,t[43]=u,t[44]=d,t[45]=f,t[46]=I):I=t[46];let L;t[47]!==F||t[48]!==I||t[49]!==w?(L=(0,V.jsxs)(te,{children:[w,F,I]}),t[47]=F,t[48]=I,t[49]=w,t[50]=L):L=t[50];let ye;return t[51]!==S||t[52]!==L?(ye=(0,V.jsx)(y,{modal:!1,open:!0,onOpenChange:S,children:L}),t[51]=S,t[52]=L,t[53]=ye):ye=t[53],ye}function He(e){let t=e.detail.originalEvent.target;t instanceof Element&&t.closest(`#app-workspace-panel, [data-task-modal-backdrop]`)&&e.preventDefault()}function Ue(e){let t=e.target;t instanceof HTMLElement&&t.closest(`[data-task-inline-editor]`)&&e.preventDefault()}function W(e){return e.setPath}function We(e){return e.path}function Ge(e){return e.setOpen}function Ke(e){return e.openForSession}function G(e){return e.sessionKeyOverride}function qe(e){return e.widthPx}function Je(e){return e.open}function K(e){return e.language}function Ye(e){return(0,V.jsx)(c,{value:e.id,children:e.name||e.id},e.id)}function Xe(e){return e.id}export{Ve as TaskDetailModal,Be as TaskDetailPage};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{d as i,p as a,t as o}from"./chunk-KS7C4IRE-BaASWQor.js";import{n as s,r as c}from"./popover-select-BzdnTy3h.js";import{t as l}from"./external-link-DjqjBmc3.js";import{f as u,t as d,u as f}from"./markdown-view-BMDQYc6E.js";import{t as p}from"./x-B_N4OPjy.js";import{t as m}from"./cn-JdwAhgNB.js";import{t as h}from"./button-CSEbl4zT.js";import{l as g,n as _}from"./locale-store-BIOMAhmR.js";import{i as v,n as ee,o as te,r as ne,s as re,t as y}from"./dist-BPoKqzeH.js";import{$c as ie,$r as ae,Ca as b,Gc as x,H as S,I as oe,J as C,Ji as w,K as se,Kc as T,Os as ce,P as le,Rs as E,Sl as ue,Ss as D,X as O,Z as de,bc as fe,ca as k,ei as A,in as pe,ir as j,jc as me,la as M,n as N,nn as he,nr as ge,nt as _e,or as P,rn as F,rr as I,sr as ve,tr as L,xc as ye,zr as be}from"./index-BIBAmAjw.js";import{t as xe}from"./date-picker-3cIzKCZU.js";import{t as R}from"./dependency-picker-VZFStrz_.js";var z=e(t(),1),B=n();function Se(e,t,n,r){return!!(e&&t!==e.version&&n!==e.value&&r!==n)}function Ce(e,t){let n={...e.task};t.title!==void 0&&(n.title=t.title),t.priority!==void 0&&(n.priority=t.priority);for(let e of[`body`,`projectId`,`milestoneId`,`parentTaskId`,`dueAt`,`ownerId`]){let r=t[e];r!==void 0&&(r===null?delete n[e]:Object.assign(n,{[e]:r}))}return n.version+=1,n.updatedAt=Date.now(),{...e,task:n}}var V=r();function we(e,t){return(t===`zh`?{backlog:`待规划`,ready:`就绪`,active:`进行中`,review:`待验收`,closed:`已完成`}:{backlog:`Backlog`,ready:`Ready`,active:`Active`,review:`Review`,closed:`Completed`})[e]}function Te(){let e=(0,B.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,V.jsxs)(`div`,{className:`space-y-4`,"aria-busy":!0,children:[(0,V.jsx)(M,{className:`h-32 rounded-2xl`}),(0,V.jsx)(M,{className:`h-52 rounded-2xl`}),(0,V.jsx)(M,{className:`h-40 rounded-2xl`})]}),e[0]=t):t=e[0],t}function Ee(e){if(e===void 0)return``;let t=new Date(e);return new Date(t.getTime()-t.getTimezoneOffset()*6e4).toISOString().slice(0,10)}function De(e){return e?new Date(`${e}T23:59:59.999`).getTime():null}var Oe=[`backlog`,`ready`,`active`,`review`,`closed`],ke=[`low`,`normal`,`high`,`critical`],Ae=(0,z.memo)(function(e){let t=(0,B.c)(20),{value:n,disabled:r,canMove:i,canApprove:a,canReopen:o,language:l,label:u,onChange:d}=e,f;t[0]!==a||t[1]!==i||t[2]!==o||t[3]!==n?(f=e=>e!==n&&(e===`closed`?!a:n===`closed`?!o:!i),t[0]=a,t[1]=i,t[2]=o,t[3]=n,t[4]=f):f=t[4];let p=f,m;t[5]===u?m=t[6]:(m=(0,V.jsx)(`span`,{children:u}),t[5]=u,t[6]=m);let h;t[7]===d?h=t[8]:(h=e=>d(e.target.value),t[7]=d,t[8]=h);let g;t[9]!==l||t[10]!==p?(g=Oe.map(e=>(0,V.jsx)(c,{value:e,disabled:p(e),children:we(e,l)},e)),t[9]=l,t[10]=p,t[11]=g):g=t[11];let _;t[12]!==r||t[13]!==h||t[14]!==g||t[15]!==n?(_=(0,V.jsx)(s,{triggerClassName:`border-0 bg-surface-hover shadow-none focus-visible:ring-2 focus-visible:ring-accent/30`,contentClassName:`border-0`,value:n,disabled:r,onChange:h,children:g}),t[12]=r,t[13]=h,t[14]=g,t[15]=n,t[16]=_):_=t[16];let v;return t[17]!==m||t[18]!==_?(v=(0,V.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[m,_]}),t[17]=m,t[18]=_,t[19]=v):v=t[19],v}),je=(0,z.memo)(function(e){let t=(0,B.c)(14),{value:n,disabled:r,label:i,labels:a,onChange:o}=e,l;t[0]===i?l=t[1]:(l=(0,V.jsx)(`span`,{children:i}),t[0]=i,t[1]=l);let u;t[2]===o?u=t[3]:(u=e=>o(e.target.value),t[2]=o,t[3]=u);let d;t[4]===a?d=t[5]:(d=ke.map(e=>(0,V.jsx)(c,{value:e,children:a[e]},e)),t[4]=a,t[5]=d);let f;t[6]!==r||t[7]!==u||t[8]!==d||t[9]!==n?(f=(0,V.jsx)(s,{triggerClassName:`border-0 bg-surface-hover shadow-none focus-visible:ring-2 focus-visible:ring-accent/30`,contentClassName:`border-0`,value:n,disabled:r,onChange:u,children:d}),t[6]=r,t[7]=u,t[8]=d,t[9]=n,t[10]=f):f=t[10];let p;return t[11]!==l||t[12]!==f?(p=(0,V.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[l,f]}),t[11]=l,t[12]=f,t[13]=p):p=t[13],p}),Me=(0,z.memo)(function(e){let t=(0,B.c)(10),{value:n,disabled:r,label:i,onChange:a}=e,o;t[0]===i?o=t[1]:(o=(0,V.jsx)(`span`,{children:i}),t[0]=i,t[1]=o);let s;t[2]!==r||t[3]!==i||t[4]!==a||t[5]!==n?(s=(0,V.jsx)(xe,{disabled:r,value:n,onChange:a,ariaLabel:i}),t[2]=r,t[3]=i,t[4]=a,t[5]=n,t[6]=s):s=t[6];let c;return t[7]!==o||t[8]!==s?(c=(0,V.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[o,s]}),t[7]=o,t[8]=s,t[9]=c):c=t[9],c}),Ne=(0,z.memo)(function(e){let t=(0,B.c)(17),{value:n,disabled:r,label:i,unassignedLabel:a,agents:o,onChange:l}=e,u;t[0]===i?u=t[1]:(u=(0,V.jsx)(`span`,{children:i}),t[0]=i,t[1]=u);let d;t[2]===l?d=t[3]:(d=e=>l(e.target.value),t[2]=l,t[3]=d);let f;t[4]===a?f=t[5]:(f=(0,V.jsx)(c,{value:``,disabled:!0,children:a}),t[4]=a,t[5]=f);let p;t[6]===o?p=t[7]:(p=o.map(Ye),t[6]=o,t[7]=p);let m;t[8]!==r||t[9]!==d||t[10]!==f||t[11]!==p||t[12]!==n?(m=(0,V.jsxs)(s,{triggerClassName:`border-0 bg-surface-hover shadow-none focus-visible:ring-2 focus-visible:ring-accent/30`,contentClassName:`border-0`,value:n,disabled:r,onChange:d,children:[f,p]}),t[8]=r,t[9]=d,t[10]=f,t[11]=p,t[12]=n,t[13]=m):m=t[13];let h;return t[14]!==u||t[15]!==m?(h=(0,V.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[u,m]}),t[14]=u,t[15]=m,t[16]=h):h=t[16],h}),Pe=(0,z.memo)(function(e){let t=(0,B.c)(8),{candidates:n,selected:r,disabled:i,labels:a,onChange:o}=e,s;t[0]===r?s=t[1]:(s=r.map(Xe),t[0]=r,t[1]=s);let c;return t[2]!==n||t[3]!==i||t[4]!==a||t[5]!==o||t[6]!==s?(c=(0,V.jsx)(R,{borderless:!0,candidates:n,selectedIds:s,disabled:i,onChange:o,labels:a}),t[2]=n,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c):c=t[7],c},(e,t)=>e.disabled===t.disabled&&e.labels===t.labels&&e.onChange===t.onChange&&e.candidates.length===t.candidates.length&&e.candidates.every((e,n)=>e.id===t.candidates[n]?.id&&e.title===t.candidates[n]?.title)&&e.selected.length===t.selected.length&&e.selected.every((e,n)=>e.id===t.selected[n]?.id&&e.title===t.selected[n]?.title)),Fe=`xopc.taskDetail.chatPanelPercent`,Ie=42;function Le(e,t){let n=Math.max(30,352/Math.max(t,1)*100),r=Math.min(60,(t-480)/Math.max(t,1)*100);return r<n?Ie:Math.min(r,Math.max(n,e))}function Re(){try{let e=Number(window.localStorage.getItem(Fe));return Number.isFinite(e)&&e>=30&&e<=60?e:Ie}catch{return Ie}}function ze(e){return e.task.phase===`closed`?e.task.resolution===`done`?`completed`:`ended`:e.attention.some(e=>e.kind===`input_required`||e.kind===`approval_required`)?`needsUser`:e.operationalState===`idle`?e.task.phase===`backlog`?`captured`:e.task.phase===`ready`?`ready`:e.task.phase===`review`?`review`:`paused`:e.operationalState}function H(e){let t=(0,B.c)(9),{items:n,empty:r,verificationByCriterion:i}=e;if(n.length===0){let e;return t[0]===r?e=t[1]:(e=(0,V.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:r}),t[0]=r,t[1]=e),e}let a;if(t[2]!==n||t[3]!==i){let e;t[5]===i?e=t[6]:(e=e=>{let t=i?.get(e)??`unverified`;return(0,V.jsxs)(`li`,{className:`flex gap-2 text-sm leading-6 text-fg`,children:[(0,V.jsx)(t===`passed`?ie:t===`failed`?T:x,{className:t===`passed`?`mt-1 size-4 shrink-0 text-success`:t===`failed`?`mt-1 size-4 shrink-0 text-danger`:`mt-1 size-4 shrink-0 text-fg-subtle`}),(0,V.jsx)(`span`,{children:e})]},e)},t[5]=i,t[6]=e),a=n.map(e),t[2]=n,t[3]=i,t[4]=a}else a=t[4];let o;return t[7]===a?o=t[8]:(o=(0,V.jsx)(`ul`,{className:`space-y-2`,children:a}),t[7]=a,t[8]=o),o}function U({taskId:e,presentation:t,backgroundPath:n}){let[r]=a(),i=_(e=>e.language),s=g(e=>e.token),c=(0,z.useMemo)(()=>de(i),[i]),p=b(e=>e.setPageHeader),v=b(e=>e.clearPageHeader),ee=A(e=>e.open),te=A(e=>e.sessionKeyOverride),ne=A(e=>e.openForSession),re=ve(e=>e.setOpen),{data:y,error:ae,mutate:x,lastChange:T,conversationLoading:pe,conversationError:M}=le(e),[xe,R]=(0,z.useState)(null),[B,we]=(0,z.useState)(()=>new Set),[Oe,ke]=(0,z.useState)([]),[U,Be]=(0,z.useState)(null),[Ve,He]=(0,z.useState)([]),[Ue,W]=(0,z.useState)(!1),[We,Ge]=(0,z.useState)(``),[Ke,G]=(0,z.useState)(!1),[qe,Je]=(0,z.useState)(``),[K,Ye]=(0,z.useState)(Re),[Xe,Ze]=(0,z.useState)(!1),Qe=(0,z.useRef)(null),$e=(0,z.useRef)(!1),et=(0,z.useRef)(!1),tt=(0,z.useRef)(``),nt=(0,z.useRef)(null),rt=(0,z.useRef)(null),it=(0,z.useRef)(null),at=(0,z.useRef)(y),[ot,q]=(0,z.useState)(null),[st,ct]=(0,z.useState)(null),lt=(0,z.useMemo)(()=>({link:c.linkDependencies,linked:c.linkedDependencies,searchPlaceholder:c.dependencySearchPlaceholder,noMatches:c.noDependencyMatches,noCandidates:c.noDependencyCandidates,remove:c.removeDependency}),[c.dependencySearchPlaceholder,c.linkDependencies,c.linkedDependencies,c.noDependencyCandidates,c.noDependencyMatches,c.removeDependency]),ut=y?.dependencies.map(e=>`${e.id}:${e.title}`).join(`\0`)??``,dt=(0,z.useMemo)(()=>f(r.get(`returnTo`),`/`,[`/projects`,`/chat`,`/notes`,`/tasks`]),[r]);at.current=y;let J=(0,z.useCallback)((e,t)=>{we(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r})},[]);(0,z.useEffect)(()=>{R(null),q(null),W(!1),G(!1),ct(null)},[e]),(0,z.useEffect)(()=>{let e=!0;return k().then(t=>{e&&He(t.items)}).catch(()=>void 0),()=>{e=!1}},[s]),(0,z.useEffect)(()=>{if(!T||T.source===`user`)return;ct(T);let e=window.setTimeout(()=>ct(null),3500);return()=>window.clearTimeout(e)},[T]),(0,z.useEffect)(()=>{let t=y?.task.projectId,n=y?.dependencies??[];if(!t){it.current=null,Be(null),ke(n);return}it.current!==t&&(it.current=t,Be(null));let r=!0;return w(t).then(t=>{if(!r)return;Be(t.project.name);let i=new Map;for(let r of[...t.tasks,...n])r.id!==e&&i.set(r.id,{id:r.id,title:r.title});ke([...i.values()])}).catch(()=>{r&&ke(n)}),()=>{r=!1}},[ut,y?.task.projectId,e]);let Y=(0,z.useCallback)(async(t,n=`command`)=>{let r=at.current;if(r){J(n,!0),R(null);try{await x(await oe(e,t,r.task.version),{revalidate:!1})}catch{R(c.actionFailed)}finally{J(n,!1)}}},[c.actionFailed,x,J,e]),X=(0,z.useCallback)(async(t,n)=>{let r=at.current;if(!r)return!1;n&&J(n,!0),R(null);try{return await x(C(e,t,r.task.version),{optimisticData:Ce(r,t),populateCache:!0,revalidate:!1,rollbackOnError:!0}),!0}catch{return R(c.actionFailed),!1}finally{n&&J(n,!1)}},[c.actionFailed,x,J,e]),ft=async()=>{if(!y)return;if($e.current){$e.current=!1;return}let e=We.trim(),t=nt.current;if(Se(t,y.task.version,y.task.title,e)){q(`title`);return}if(!e||e===y.task.title){Ge(y.task.title),W(!1);return}await X({title:e})&&(q(null),W(!1))},pt=async()=>{if(!y)return;if(et.current){et.current=!1;return}let e=qe.trim(),t=rt.current;if(Se(t,y.task.version,y.task.body??``,e)){q(`description`);return}if(qe===tt.current||e===(y.task.body??``).trim()){G(!1);return}await X({body:e||null})&&(q(null),G(!1))},mt=(0,z.useCallback)(async e=>{let t=at.current;if(!(!t||e===t.task.phase)){if(t.task.phase===`closed`){await Y({type:`reopen`,phase:e===`closed`?`ready`:e},`phase`);return}if(e===`closed`){await Y({type:`close`,resolution:`done`},`phase`);return}await Y({type:`move`,phase:e},`phase`)}},[Y]),ht=(0,z.useCallback)(e=>{X({priority:e},`priority`)},[X]),gt=(0,z.useCallback)(e=>{X({dueAt:De(e)},`dueAt`)},[X]),_t=(0,z.useCallback)(e=>{Ye(e);try{window.localStorage.setItem(Fe,String(e))}catch{}},[]),vt=(0,z.useCallback)(e=>{if(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`&&e.key!==`Home`)return;e.preventDefault();let t=Qe.current?.clientWidth??0;_t(Le(e.key===`Home`?Ie:K+(e.key===`ArrowLeft`?2:-2),t))},[K,_t]),yt=(0,z.useCallback)(e=>{if(!window.matchMedia(`(min-width: 1024px)`).matches)return;let t=Qe.current;if(!t)return;e.preventDefault();let n=e.currentTarget,r=e.pointerId;n.setPointerCapture(r),Ze(!0);let i=K,a=0,o=()=>{a=0,t.style.setProperty(`--task-chat-panel-width`,`${i}%`)},s=e=>{let n=t.getBoundingClientRect();i=Le((n.right-e.clientX)/n.width*100,n.width),a===0&&(a=window.requestAnimationFrame(o))},c=()=>{a!==0&&(window.cancelAnimationFrame(a),o());try{n.releasePointerCapture(r)}catch{}Ze(!1),_t(i),window.removeEventListener(`pointermove`,s),window.removeEventListener(`pointerup`,c),window.removeEventListener(`pointercancel`,c)};window.addEventListener(`pointermove`,s),window.addEventListener(`pointerup`,c),window.addEventListener(`pointercancel`,c)},[K,_t]),bt=(0,z.useCallback)(async t=>{let n=at.current;if(n){J(`dependencies`,!0),R(null);try{await x(await O(e,t,n.task.version),{revalidate:!1})}catch{R(c.dependencyUpdateFailed)}finally{J(`dependencies`,!1)}}},[c.dependencyUpdateFailed,x,J,e]),xt=(0,z.useCallback)(async t=>{let n=at.current;if(!(!n||!t||t===n.conversation.currentExecutorAgentId)){J(`delegateAgentId`,!0),R(null);try{await x(await S(e,t,n.task.version),{revalidate:!1})}catch{R(c.actionFailed)}finally{J(`delegateAgentId`,!1)}}},[c.actionFailed,x,J,e]);if((0,z.useLayoutEffect)(()=>{if(t!==`modal`)return p({startExtra:(0,V.jsx)(o,{to:dt,className:`flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover`,"aria-label":c.backToWork,children:(0,V.jsx)(ue,{className:`size-4`})}),main:y?(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`p`,{className:`truncate text-sm font-semibold text-fg`,children:U?`${U} / ${c.taskLabel}`:c.taskLabel}),(0,V.jsx)(`p`,{className:`text-xs text-fg-muted`,children:c.detailStatuses[ze(y)]})]}):null,end:null}),v},[v,c.backToWork,c.detailStatuses,c.taskLabel,y,t,U,dt,p]),ae&&!y)return(0,V.jsx)(`div`,{className:t===`modal`?`p-5 text-sm text-danger`:`mx-auto max-w-3xl p-6 text-sm text-danger`,children:c.taskNotFound});if(!y)return(0,V.jsx)(`div`,{className:t===`modal`?`p-5`:`mx-auto max-w-4xl p-4 sm:p-6`,children:(0,V.jsx)(Te,{})});let St=y.waits[0],Ct=St?.kind===`paused`?St:void 0,Z=y.receipts[0],wt=c.detailStatuses[ze(y)],Tt=c.detailStatusDescriptions[ze(y)],Et=y.task.body?.trim()||y.task.contract?.objective.trim(),Dt=new Map(Z?.verification.checks.map(e=>[e.criterion,e.status])),Ot=y.allowedCommands.includes(`mark_ready`),kt=y.allowedCommands.includes(`start`),At=y.allowedCommands.includes(`add_wait`),jt=y.task.phase===`review`&&y.allowedCommands.includes(`close`),Mt=y.allowedCommands.includes(`reopen`),Q=y.conversation.activeSessionKey,Nt=y.conversation.currentExecutorAgentId??y.task.delegateAgentId??y.task.ownerId,Pt=Ve.find(e=>e.id===Nt),Ft=!!(Q&&ee&&te===Q),It=y.attention.some(e=>e.kind===`input_required`||e.kind===`approval_required`),Lt=y.task.contract?.acceptanceCriteria??[],Rt=Lt.filter(e=>Dt.get(e)===`passed`).length,zt=y.task.contract?.expectedOutputs??[],Bt=y.task.contract?.constraints??[],Vt=y.task.contract?.approvalRequired??[],Ht=y.task.contract?.assumptions??[],Ut=y.task.contract?.risks??[],$=(...e)=>!!st?.changedFields.some(t=>e.includes(t)),Wt=e=>t===`modal`&&n?F(n,e):u(`/tasks/${e}`,dt),Gt=y.allowedCommands.includes(`move`),Kt=B.has(`command`),qt=(0,V.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[Ot?(0,V.jsxs)(h,{variant:`primary`,disabled:Kt,onClick:()=>void Y({type:`mark_ready`}),children:[(0,V.jsx)(D,{className:`size-4`}),c.scheduleTask]}):null,Ct?(0,V.jsxs)(h,{variant:`primary`,disabled:Kt,onClick:()=>void Y({type:`resolve_wait`,waitId:Ct.id}),children:[(0,V.jsx)(D,{className:`size-4`}),c.resumeTask]}):null,!St&&kt&&Nt?(0,V.jsxs)(h,{variant:`primary`,disabled:Kt,onClick:()=>void Y({type:`start`,executor:{kind:`agent`,agentId:Nt}}),children:[(0,V.jsx)(D,{className:`size-4`}),c.runTask]}):null,jt?(0,V.jsxs)(h,{variant:`primary`,disabled:Kt,onClick:()=>void Y({type:`close`,resolution:`done`}),children:[(0,V.jsx)(ie,{className:`size-4`}),c.approveTask]}):null,Mt?(0,V.jsxs)(h,{variant:`primary`,disabled:Kt,onClick:()=>void Y({type:`reopen`,phase:`ready`}),children:[(0,V.jsx)(D,{className:`size-4`}),c.reopenTask]}):null,!St&&At?(0,V.jsxs)(h,{variant:`secondary`,className:`border-0 bg-surface-hover shadow-none`,disabled:Kt,onClick:()=>void Y({type:`add_wait`,wait:{kind:`paused`,reason:`Paused by user`,condition:{}}}),children:[(0,V.jsx)(ce,{className:`size-4`}),c.pauseTask]}):null,y.task.phase===`closed`?null:(0,V.jsxs)(j,{children:[(0,V.jsx)(P,{asChild:!0,children:(0,V.jsx)(h,{type:`button`,variant:`ghost`,className:`size-9 p-0`,disabled:Kt,"aria-label":c.moreActions,children:(0,V.jsx)(me,{className:`size-4`,"aria-hidden":!0})})}),(0,V.jsx)(I,{children:(0,V.jsx)(L,{align:`end`,sideOffset:6,className:`z-[100] min-w-40 rounded-lg border border-edge bg-surface-panel p-1 shadow-popover`,children:(0,V.jsx)(ge,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-danger outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:()=>void Y({type:`close`,resolution:`cancelled`}),children:c.cancelTask})})})]})]});return(0,V.jsxs)(`div`,{ref:Qe,className:`${t===`modal`?`flex h-full min-h-0 flex-col lg:flex-row`:`flex min-h-[calc(100dvh-8rem)] flex-col overflow-hidden lg:flex-row`} ${Xe?`lg:cursor-col-resize lg:select-none`:``}`,style:{"--task-chat-panel-width":`${K}%`},children:[(0,V.jsxs)(`section`,{className:`task-detail-scroll min-w-0 flex-1 overflow-y-auto overscroll-contain p-5 sm:p-6`,children:[(0,V.jsxs)(`header`,{className:m(`px-4 pb-5`,$(`title`)&&`task-detail-live-update`),children:[(0,V.jsx)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:(0,V.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:[U?(0,V.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,V.jsx)(ye,{className:`size-3.5`,"aria-hidden":!0}),U]}):null,(0,V.jsx)(`span`,{children:`/`}),(0,V.jsx)(`span`,{children:c.taskLabel}),st?(0,V.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent-fg`,role:`status`,children:st.source===`agent`?i===`zh`?`Agent 刚刚更新`:`Updated by Agent`:i===`zh`?`执行结果已同步`:`Execution result synced`}):null]}),Ue?(0,V.jsx)(`input`,{autoFocus:!0,"data-task-inline-editor":!0,value:We,onChange:e=>Ge(e.target.value),onBlur:()=>void ft(),onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur(),e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),$e.current=!0,Ge(y.task.title),W(!1),queueMicrotask(()=>{$e.current=!1}))},className:`mt-3 w-full max-w-3xl rounded-lg bg-surface-hover px-3 py-2 text-2xl font-semibold leading-8 text-fg outline-none ring-2 ring-accent/30 focus:ring-accent/60`}):(0,V.jsx)(`button`,{type:`button`,className:`mt-3 block max-w-3xl rounded-lg text-left outline-none hover:bg-surface-hover focus-visible:bg-surface-hover`,onClick:()=>{nt.current={value:y.task.title,version:y.task.version},q(null),Ge(y.task.title),W(!0)},children:(0,V.jsx)(`h1`,{className:`text-2xl font-semibold leading-8 text-fg`,children:y.task.title})}),ot===`title`?(0,V.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-warning`,role:`alert`,children:[(0,V.jsx)(`span`,{children:i===`zh`?`Agent 在你编辑期间更新了标题。`:`The Agent updated the title while you were editing.`}),(0,V.jsx)(`button`,{type:`button`,className:`rounded-md bg-surface-hover px-2 py-1 text-fg`,onClick:()=>{Ge(y.task.title),q(null),W(!1)},children:i===`zh`?`使用 Agent 版本`:`Use Agent version`}),(0,V.jsx)(`button`,{type:`button`,className:`rounded-md bg-accent-soft px-2 py-1 text-accent-fg`,onClick:()=>void X({title:We.trim()}).then(e=>{e&&(q(null),W(!1))}),children:i===`zh`?`保留我的修改`:`Keep my changes`})]}):null]})}),xe?(0,V.jsx)(`p`,{className:`mt-3 text-sm text-danger`,children:xe}):null]}),(0,V.jsxs)(`div`,{className:`mt-5 flex flex-col gap-5`,children:[(0,V.jsxs)(`main`,{className:`order-2 min-w-0 space-y-5`,children:[(0,V.jsxs)(`section`,{className:m(`rounded-xl bg-surface-panel p-4`,$(`body`)&&`task-detail-live-update`),children:[(0,V.jsx)(`h2`,{className:`font-medium text-fg`,children:c.taskDescription}),Ke?(0,V.jsx)(`textarea`,{autoFocus:!0,"data-task-inline-editor":!0,rows:6,value:qe,onChange:e=>Je(e.target.value),onBlur:()=>void pt(),onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),et.current=!0,Je(y.task.body??y.task.contract?.objective??``),G(!1),queueMicrotask(()=>{et.current=!1}))},className:`mt-3 w-full resize-y rounded-lg bg-surface-hover px-3 py-2 text-sm leading-6 text-fg outline-none ring-2 ring-accent/20 focus:ring-accent/50`}):(0,V.jsx)(`button`,{type:`button`,className:`-mx-1 mt-2 block w-[calc(100%+0.5rem)] rounded-lg px-1 py-1 text-left outline-none hover:bg-surface-hover focus-visible:bg-surface-hover`,onClick:()=>{let e=y.task.body??y.task.contract?.objective??``;tt.current=e,rt.current={value:y.task.body??``,version:y.task.version},q(null),Je(e),G(!0)},children:(0,V.jsx)(`span`,{className:`whitespace-pre-wrap text-sm leading-6 text-fg-muted`,children:Et&&Et!==y.task.title?Et:c.noTaskDescription})}),ot===`description`?(0,V.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-warning`,role:`alert`,children:[(0,V.jsx)(`span`,{children:i===`zh`?`Agent 在你编辑期间更新了描述。`:`The Agent updated the description while you were editing.`}),(0,V.jsx)(`button`,{type:`button`,className:`rounded-md bg-surface-hover px-2 py-1 text-fg`,onClick:()=>{Je(y.task.body??``),q(null),G(!1)},children:i===`zh`?`使用 Agent 版本`:`Use Agent version`}),(0,V.jsx)(`button`,{type:`button`,className:`rounded-md bg-accent-soft px-2 py-1 text-accent-fg`,onClick:()=>void X({body:qe.trim()||null}).then(e=>{e&&(q(null),G(!1))}),children:i===`zh`?`保留我的修改`:`Keep my changes`})]}):null]}),y.attention.length>0?(0,V.jsxs)(`section`,{className:m(`rounded-xl bg-warning/10 p-4`,$(`attention`)&&`task-detail-live-update`),children:[(0,V.jsx)(`h3`,{className:`font-medium text-fg`,children:It?c.needsAttention:c.waitingStatus}),(0,V.jsx)(`ul`,{className:`mt-3 space-y-2 text-sm text-fg-muted`,children:y.attention.map((e,t)=>(0,V.jsx)(`li`,{children:e.summary},`${e.kind}-${t}`))})]}):null,(0,V.jsxs)(`section`,{className:m(`rounded-xl bg-surface-panel p-4`,$(`contract`)&&`task-detail-live-update`),children:[(0,V.jsx)(`h2`,{className:`font-medium text-fg`,children:c.taskDefinition}),(0,V.jsxs)(`div`,{className:`mt-5`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,V.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:c.successDefinition}),Lt.length>0?(0,V.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:c.criteriaProgress.replace(`{{verified}}`,String(Rt)).replace(`{{total}}`,String(Lt.length))}):null]}),(0,V.jsx)(`div`,{className:`mt-3`,children:(0,V.jsx)(H,{items:Lt,empty:c.noDefinition,verificationByCriterion:Dt})})]}),zt.length>0?(0,V.jsxs)(`div`,{className:`mt-5 rounded-lg bg-surface-hover p-4`,children:[(0,V.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:c.expectedOutputs}),(0,V.jsx)(`div`,{className:`mt-3`,children:(0,V.jsx)(H,{items:zt,empty:c.noDefinition})})]}):null,Bt.length>0?(0,V.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,V.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:c.constraints}),(0,V.jsx)(`div`,{className:`mt-3`,children:(0,V.jsx)(H,{items:Bt,empty:c.noDefinition})})]}):null,Vt.length>0?(0,V.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,V.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:c.approvalRequired}),(0,V.jsx)(`div`,{className:`mt-3`,children:(0,V.jsx)(H,{items:Vt,empty:c.noDefinition})})]}):null,Ht.length>0?(0,V.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,V.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:c.contextAssumptions}),(0,V.jsx)(`div`,{className:`mt-3`,children:(0,V.jsx)(H,{items:Ht,empty:c.noDefinition})})]}):null,Ut.length>0?(0,V.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,V.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:c.contextRisks}),(0,V.jsx)(`div`,{className:`mt-3`,children:(0,V.jsx)(H,{items:Ut,empty:c.noDefinition})})]}):null]}),Z?(0,V.jsxs)(`section`,{className:m(`rounded-xl bg-surface-panel p-4`,$(`runs`,`receipts`)&&`task-detail-live-update`),children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,V.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,V.jsx)(`h2`,{className:`font-medium text-fg`,children:c.latestResult}),(0,V.jsx)(d,{content:Z.summary,compact:!0,className:`mt-2 text-sm leading-6 text-fg`,openHttpLinksInNewTab:!0})]}),(0,V.jsxs)(`span`,{className:`rounded-full bg-surface-hover px-2.5 py-1 text-xs text-fg-muted`,children:[c.receiptStatuses[Z.status],` · `,c.verificationStatuses[Z.verification.status]]})]}),Z.remainingWork.length>0?(0,V.jsxs)(`div`,{className:`mt-4`,children:[(0,V.jsx)(`h3`,{className:`text-xs font-medium text-fg-muted`,children:c.remainingWork}),(0,V.jsx)(`div`,{className:`mt-2`,children:(0,V.jsx)(H,{items:Z.remainingWork,empty:c.noRemainingWork})})]}):null,Z.nextAction?(0,V.jsxs)(`div`,{className:`mt-4 rounded-lg bg-surface-hover p-3`,children:[(0,V.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:c.nextAction}),(0,V.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:Z.nextAction})]}):null,(0,V.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2`,children:[(0,V.jsx)(h,{className:`border-0 bg-surface-hover px-2 py-1 text-xs shadow-none`,variant:`secondary`,onClick:()=>void se(Z.runId,`helpful`),children:c.doneWell}),(0,V.jsx)(h,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>void se(Z.runId,`not_helpful`),children:c.needsFix}),Z.evidence.filter(e=>e.uri).map(e=>(0,V.jsxs)(`a`,{className:`ml-auto inline-flex items-center gap-1 text-xs text-accent hover:underline`,href:e.uri,children:[(0,V.jsx)(l,{className:`size-3`}),e.title]},`${e.title}-${e.uri}`))]}),y.receipts.length>1?(0,V.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,V.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted`,children:c.executionHistory.replace(`{{count}}`,String(y.receipts.length-1))}),(0,V.jsx)(`div`,{className:`mt-3 space-y-3`,children:y.receipts.slice(1).map(e=>(0,V.jsx)(`article`,{className:`rounded-lg bg-surface-active p-3`,children:(0,V.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,V.jsx)(`p`,{className:`text-sm text-fg`,children:e.summary}),(0,V.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:c.receiptStatuses[e.status]})]})},e.runId))})]}):null]}):null,y.context.length>0?(0,V.jsxs)(`section`,{className:m(`rounded-xl bg-surface-panel p-4`,$(`context`)&&`task-detail-live-update`),children:[(0,V.jsx)(`h2`,{className:`font-medium text-fg`,children:c.contextUsed}),(0,V.jsx)(`ul`,{className:`mt-4 grid gap-2 sm:grid-cols-2`,children:y.context.map(e=>(0,V.jsxs)(`li`,{className:`min-w-0 rounded-lg bg-surface-hover p-2.5`,children:[(0,V.jsxs)(`span`,{className:`text-[11px] text-fg-subtle`,children:[c.contextRoleLabels[e.role],` · `,c.contextKindLabels[e.targetKind]]}),e.targetKind===`url`&&/^https?:\/\//.test(e.targetId)?(0,V.jsx)(`a`,{className:`mt-1 block break-all text-sm text-accent hover:underline`,href:e.targetId,target:`_blank`,rel:`noreferrer`,children:e.title??e.targetId}):(0,V.jsx)(`p`,{className:`mt-1 break-words text-sm text-fg`,children:e.title??e.targetId})]},e.id))})]}):null]}),(0,V.jsxs)(`aside`,{className:`order-1 min-w-0 space-y-4`,children:[(0,V.jsxs)(`section`,{className:m(`rounded-xl bg-surface-subtle p-4`,$(`phase`,`resolution`,`priority`,`dueAt`,`delegateAgentId`)&&`task-detail-live-update`),children:[(0,V.jsx)(`h2`,{className:`font-medium text-fg`,children:c.taskProperties}),(0,V.jsxs)(`div`,{className:`mt-4 grid gap-4 sm:grid-cols-2`,children:[(0,V.jsx)(Ae,{value:y.task.phase,disabled:B.has(`phase`),canMove:Gt,canApprove:jt,canReopen:Mt,language:i,label:c.taskPhase,onChange:mt}),(0,V.jsx)(je,{value:y.task.priority,disabled:B.has(`priority`),label:c.priority,labels:c.priorityLabels,onChange:ht}),(0,V.jsx)(Me,{value:Ee(y.task.dueAt),disabled:B.has(`dueAt`),label:c.dueDate,onChange:gt}),(0,V.jsx)(Ne,{value:y.conversation.currentExecutorAgentId??``,disabled:B.has(`delegateAgentId`),label:c.executorLabel,unassignedLabel:c.unassigned,agents:Ve,onChange:xt}),U?(0,V.jsxs)(`div`,{className:`grid gap-1 text-xs text-fg-muted`,children:[(0,V.jsx)(`span`,{children:c.projectLabel}),(0,V.jsxs)(`span`,{className:`flex items-center gap-1.5 rounded-lg bg-surface-hover px-3 py-2 text-sm text-fg`,children:[(0,V.jsx)(ye,{className:`size-3.5`}),U]})]}):null]}),(0,V.jsxs)(`div`,{className:`mt-4 rounded-lg bg-surface-hover p-3 text-xs leading-5 text-fg-subtle`,children:[(0,V.jsx)(`p`,{children:wt}),(0,V.jsx)(`p`,{children:Tt}),(0,V.jsx)(`p`,{className:`mt-2`,children:c.updatedAt.replace(`{{date}}`,be(y.task.updatedAt,i))})]})]}),(0,V.jsxs)(`section`,{className:m(`rounded-xl bg-surface-panel p-4`,$(`dependencies`)&&`task-detail-live-update`),children:[(0,V.jsx)(`h2`,{className:`font-medium text-fg`,children:c.taskRelations}),(0,V.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:c.dependencies}),(0,V.jsx)(Pe,{candidates:Oe,selected:y.dependencies,disabled:B.has(`dependencies`),labels:lt,onChange:bt})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:c.dependents}),y.dependents.length>0?(0,V.jsx)(`div`,{className:`space-y-1.5`,children:y.dependents.map(e=>(0,V.jsx)(o,{to:Wt(e.id),className:`block rounded-lg bg-surface-hover p-2.5 text-sm text-accent hover:underline`,children:e.title},e.id))}):(0,V.jsx)(`p`,{className:`text-sm text-fg-subtle`,children:c.noDependents})]})]})]})]})]})]}),(0,V.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":i===`zh`?`调整任务信息和 Agent 对话的宽度`:`Resize task details and Agent chat`,"aria-valuemin":30,"aria-valuemax":60,"aria-valuenow":Math.round(K),tabIndex:0,onPointerDown:yt,onKeyDown:vt,onDoubleClick:()=>_t(Ie),className:`group hidden w-2 shrink-0 cursor-col-resize touch-none items-stretch justify-center bg-surface-panel outline-none transition-colors hover:bg-surface-hover focus-visible:bg-surface-hover lg:flex ${Xe?`bg-surface-hover`:``}`,children:(0,V.jsx)(`div`,{className:`my-3 w-px rounded-full bg-edge-strong/70 transition-colors group-hover:bg-accent group-focus-visible:bg-accent`})}),(0,V.jsxs)(`aside`,{className:`flex min-h-[34rem] min-w-0 flex-col bg-surface-panel lg:min-h-0 lg:w-[var(--task-chat-panel-width)] lg:shrink-0`,children:[(0,V.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-3 bg-surface-subtle px-4 py-3.5`,children:[(0,V.jsx)(`div`,{className:`min-w-0`,children:(0,V.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[Nt?(0,V.jsx)(_e,{agentId:Nt,avatar:Pt?.avatar,size:28,className:`shrink-0`}):null,(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:i===`zh`?`Agent 执行与对话`:`Agent execution and chat`}),(0,V.jsxs)(`p`,{className:`mt-0.5 truncate text-xs text-fg-muted`,children:[Pt?.name??Nt??c.unassigned,` · `,wt]})]})]})}),(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[qt,Q&&t!==`modal`?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(h,{type:`button`,variant:`ghost`,className:m(`h-8 shrink-0 px-2 text-xs`,Ft&&`bg-surface-hover text-fg`),"aria-label":i===`zh`?`项目文件`:`Project files`,"aria-pressed":Ft,onClick:()=>{re(Q,!1),ne(Q)},children:[(0,V.jsx)(fe,{className:`size-3.5`,"aria-hidden":!0}),i===`zh`?`文件`:`Files`]}),(0,V.jsx)(h,{asChild:!0,variant:`ghost`,className:`h-8 shrink-0 px-2 text-xs`,children:(0,V.jsxs)(o,{to:he(e),children:[(0,V.jsx)(l,{className:`size-3.5`}),i===`zh`?`全屏`:`Full screen`]})})]}):null]})]}),Q?(0,V.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,V.jsx)(N,{embedded:!0,sessionKey:Q,taskId:e})}):pe?(0,V.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,V.jsxs)(`div`,{className:`max-w-xs`,children:[(0,V.jsx)(E,{className:`mx-auto size-8 animate-pulse text-fg-subtle`}),(0,V.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:i===`zh`?`正在创建任务会话`:`Creating task conversation`})]})}):M?(0,V.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,V.jsxs)(`div`,{className:`max-w-xs`,children:[(0,V.jsx)(E,{className:`mx-auto size-8 text-danger`}),(0,V.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:i===`zh`?`任务会话创建失败`:`Could not create task conversation`}),(0,V.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:M instanceof Error?M.message:String(M)})]})}):(0,V.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,V.jsxs)(`div`,{className:`max-w-xs`,children:[(0,V.jsx)(E,{className:`mx-auto size-8 text-fg-subtle`}),(0,V.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:i===`zh`?`等待任务会话`:`Waiting for a task conversation`}),(0,V.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:i===`zh`?`安排或开始任务后,Agent 的执行过程和持续对话会显示在这里。`:`Schedule or start the task to see the agent run and continue the conversation here.`})]})})]})]})}function Be(){let e=(0,B.c)(2),{taskId:t}=i(),n=t===void 0?``:t,r;return e[0]===n?r=e[1]:(r=(0,V.jsx)(U,{taskId:n,presentation:`page`}),e[0]=n,e[1]=r),r}function Ve(e){let t=(0,B.c)(54),{taskId:n,backgroundPath:r,onClose:i}=e,a=_(K),{data:s}=le(n),c=s?.conversation.activeSessionKey??null,u=A(Je),d=A(qe),f=A(G),h=A(Ke),g=ve(Ge),ie=ae(We),b=ae(W),x=u?d:0,S;t[0]!==i||t[1]!==b?(S=e=>{e||(b(null),i())},t[0]=i,t[1]=b,t[2]=S):S=t[2];let oe=a===`zh`?`关闭任务详情`:`Close task details`,C;t[3]!==i||t[4]!==b?(C=()=>{b(null),i()},t[3]=i,t[4]=b,t[5]=C):C=t[5];let w;t[6]!==oe||t[7]!==C?(w=(0,V.jsx)(`button`,{type:`button`,tabIndex:-1,"data-task-modal-backdrop":!0,className:`fixed inset-0 z-[80] bg-black/45 backdrop-blur-[1px]`,"aria-label":oe,onClick:C}),t[6]=oe,t[7]=C,t[8]=w):w=t[8];let se=u?`true`:`false`,T=`${x/2}px`,ce=`${x}px`,E;t[9]!==T||t[10]!==ce?(E={"--task-detail-workspace-offset":T,"--task-detail-workspace-width":ce},t[9]=T,t[10]=ce,t[11]=E):E=t[11];let ue=E,D=a===`zh`?`任务详情`:`Task details`,O;t[12]===D?O=t[13]:(O=(0,V.jsx)(re,{className:`font-medium text-fg`,children:D}),t[12]=D,t[13]=O);let de=a===`zh`?`查看并操作任务详情`:`View and manage task details`,k;t[14]===de?k=t[15]:(k=(0,V.jsx)(v,{className:`sr-only`,children:de}),t[14]=de,t[15]=k);let j;t[16]!==c||t[17]!==a||t[18]!==h||t[19]!==g||t[20]!==n||t[21]!==u||t[22]!==f?(j=c?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`button`,{type:`button`,className:m(`flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,u&&f===c&&`bg-surface-hover text-fg`),"aria-label":a===`zh`?`项目文件`:`Project files`,title:a===`zh`?`项目文件`:`Project files`,"aria-pressed":u&&f===c,onClick:()=>{g(c,!1),h(c)},children:(0,V.jsx)(fe,{className:`size-4`,"aria-hidden":!0})}),(0,V.jsx)(o,{to:he(n),className:`flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":a===`zh`?`全屏打开对话`:`Open chat full screen`,title:a===`zh`?`全屏打开对话`:`Open chat full screen`,children:(0,V.jsx)(l,{className:`size-4`,"aria-hidden":!0})})]}):null,t[16]=c,t[17]=a,t[18]=h,t[19]=g,t[20]=n,t[21]=u,t[22]=f,t[23]=j):j=t[23];let me=a===`zh`?`关闭任务详情`:`Close task details`,M;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,V.jsx)(p,{className:`size-4`,"aria-hidden":!0}),t[24]=M):M=t[24];let N;t[25]===me?N=t[26]:(N=(0,V.jsx)(ee,{className:`flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":me,children:M}),t[25]=me,t[26]=N);let ge;t[27]!==j||t[28]!==N?(ge=(0,V.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[j,N]}),t[27]=j,t[28]=N,t[29]=ge):ge=t[29];let _e;t[30]!==O||t[31]!==k||t[32]!==ge?(_e=(0,V.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-3 bg-surface-panel px-5 py-3.5`,children:[O,k,ge]}),t[30]=O,t[31]=k,t[32]=ge,t[33]=_e):_e=t[33];let P;t[34]!==r||t[35]!==n?(P=(0,V.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,V.jsx)(U,{taskId:n,presentation:`modal`,backgroundPath:r})}),t[34]=r,t[35]=n,t[36]=P):P=t[36];let F;t[37]!==_e||t[38]!==P||t[39]!==se||t[40]!==ue?(F=(0,V.jsxs)(ne,{className:`task-detail-modal-content fixed top-1/2 z-[90] flex h-[min(54rem,calc(100dvh-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl bg-surface-base shadow-float focus:outline-none`,"data-workspace-panel-open":se,style:ue,onEscapeKeyDown:Ue,onInteractOutside:He,children:[_e,P]}),t[37]=_e,t[38]=P,t[39]=se,t[40]=ue,t[41]=F):F=t[41];let I;t[42]!==ie||t[43]!==u||t[44]!==d||t[45]!==f?(I=ie?(0,V.jsx)(`div`,{className:`fixed inset-y-0 left-0 z-[100] flex min-h-0 min-w-0 overflow-hidden bg-surface-panel transition-[right] duration-200 ease-out motion-reduce:transition-none`,style:{right:u?d:0},children:(0,V.jsx)(pe,{allowOutsideChat:!0,sessionKey:f??void 0})}):null,t[42]=ie,t[43]=u,t[44]=d,t[45]=f,t[46]=I):I=t[46];let L;t[47]!==F||t[48]!==I||t[49]!==w?(L=(0,V.jsxs)(te,{children:[w,F,I]}),t[47]=F,t[48]=I,t[49]=w,t[50]=L):L=t[50];let ye;return t[51]!==S||t[52]!==L?(ye=(0,V.jsx)(y,{modal:!1,open:!0,onOpenChange:S,children:L}),t[51]=S,t[52]=L,t[53]=ye):ye=t[53],ye}function He(e){let t=e.detail.originalEvent.target;t instanceof Element&&t.closest(`#app-workspace-panel, [data-task-modal-backdrop]`)&&e.preventDefault()}function Ue(e){let t=e.target;t instanceof HTMLElement&&t.closest(`[data-task-inline-editor]`)&&e.preventDefault()}function W(e){return e.setPath}function We(e){return e.path}function Ge(e){return e.setOpen}function Ke(e){return e.openForSession}function G(e){return e.sessionKeyOverride}function qe(e){return e.widthPx}function Je(e){return e.open}function K(e){return e.language}function Ye(e){return(0,V.jsx)(c,{value:e.id,children:e.name||e.id},e.id)}function Xe(e){return e.id}export{Ve as TaskDetailModal,Be as TaskDetailPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e}from"./locale-store-
|
|
1
|
+
import{p as e}from"./locale-store-BIOMAhmR.js";import{t}from"./middleware-Pd0e8Igk.js";var n=`default`,r={light:{default:`#ffffff`,emerald:`#f0fdf4`,mono:`#ffffff`,clay:`#fffaf0`},dark:{default:`#0a0a0a`,emerald:`#000000`,mono:`#101010`,clay:`#0a1a1a`}};function i(e,t){let n=document.head;if(!n)return;let i=n.querySelector(`meta[name="theme-color"][data-xopc-theme-color="true"]`);i||(i=document.createElement(`meta`),i.setAttribute(`name`,`theme-color`),i.setAttribute(`data-xopc-theme-color`,`true`),n.appendChild(i)),i.setAttribute(`content`,r[e][t])}function a(){return globalThis.matchMedia?.(`(prefers-color-scheme: dark)`).matches??!1}function o(e){return e===`system`?a()?`dark`:`light`:e}function s(){return globalThis.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches??!1}function c(e){return e===`cal`?`mono`:e==="default"||e===`emerald`||e===`mono`||e===`clay`?e:n}function l(e,t,n){let r=document.documentElement,a=()=>{r.classList.toggle(`dark`,e===`dark`),r.dataset.theme=e,r.dataset.colorScheme=t,i(e,t)},o=document;n&&!s()&&typeof o.startViewTransition==`function`?o.startViewTransition(a):a()}function u(){try{let e=localStorage.getItem(`xopc-web-theme`),t=`system`,r=n;if(e){let n=JSON.parse(e);n.state?.preference&&(t=n.state.preference),n.state&&`colorScheme`in n.state&&(r=c(n.state.colorScheme))}l(o(t),r,!1)}catch{l(o(`system`),`default`,!1)}}var d=e(t((e,t)=>({preference:`system`,colorScheme:n,resolved:o(`system`),setPreference:n=>{let r=o(n),{resolved:i,colorScheme:a}=t();l(r,a,r!==i),e({preference:n,resolved:r})},setColorScheme:n=>{let{resolved:r}=t();l(r,n,!0),e({colorScheme:n})}}),{name:`xopc-web-theme`,merge:(e,t)=>{let n=e??{};return{...t,...n,colorScheme:c(n.colorScheme)}}}));function f(){let{preference:e,colorScheme:t}=d.getState(),n=o(e);l(n,t,!1),d.setState({resolved:n})}function p(){let e=globalThis.matchMedia?.(`(prefers-color-scheme: dark)`);if(!e)return()=>{};let t=()=>{let{preference:e,colorScheme:t}=d.getState();if(e!==`system`)return;let n=o(`system`),r=d.getState().resolved;l(n,t,n!==r),d.setState({resolved:n})};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)}export{d as i,p as n,f as r,u as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./cn-JdwAhgNB.js";import{So as t,bo as n,xo as r}from"./index-
|
|
1
|
+
import{t as e}from"./cn-JdwAhgNB.js";import{So as t,bo as n,xo as r}from"./index-BIBAmAjw.js";function i(){return e(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,t,`dark:border-edge`)}function a(){return e(r,n)}var o=`h-auto shrink-0 px-2.5 py-1.5 text-xs font-medium`,s=/^[a-z][a-z0-9_-]{0,63}$/;function c(e){let t=e.trim(),n=t.indexOf(`/`);return n>0&&n<t.length-1}function l(e){let t=e&&typeof e==`object`&&!Array.isArray(e)&&`roles`in e?Object.entries(e.roles??{}).map(([e,t])=>({id:e,...t&&typeof t==`object`&&!Array.isArray(t)?t:{}})):e;if(!Array.isArray(t))return[];let n=[];for(let e of t){if(!e||typeof e!=`object`||Array.isArray(e))continue;let t=e,r=typeof t.id==`string`?t.id.trim():``,i=typeof t.model==`string`?t.model.trim():``;if(!r||!i)continue;let a=typeof t.description==`string`?t.description.trim():``,o=Array.isArray(t.fallbacks)?t.fallbacks.filter(e=>typeof e==`string`).map(e=>e.trim()).filter(Boolean):[];n.push({id:r,model:i,fallbacks:o,description:a})}return n}function u(e,t){let n=new Set([t.toLowerCase()]),r=[];for(let t of e){let e=t.trim(),i=e.toLowerCase();!e||!c(e)||n.has(i)||(n.add(i),r.push(e))}return r}function d(e){let t=new Map;for(let n of e){let e=n.id.trim(),r=n.model.trim();if(!e||!s.test(e)||!r||!c(r))continue;let i=n.description.trim(),a=u(n.fallbacks??[],r);t.set(e,{model:r,...a.length>0?{fallbacks:a}:{},...i?{description:i}:{}})}return t.size===0?null:{roles:Object.fromEntries(t.entries())}}function f(e,t){let n=new Set;for(let r of e){let e=r.id.trim(),i=r.model.trim(),a=r.fallbacks??[];if(!(!e&&!i&&!r.description.trim()&&a.every(e=>!e.trim()))){if(!e||!s.test(e))return t.invalidId;if(n.has(e))return t.duplicateId;if(n.add(e),!i||!c(i)||a.some(e=>e.trim()&&!c(e)))return t.invalidModel}}return null}function p(e){return e.length===0?`—`:e.map(e=>`${e.id} -> ${e.model}${e.fallbacks?.length?` (+${e.fallbacks.length})`:``}`).join(`, `)}function m(e){return(e??[]).map(e=>({id:e.id,model:e.model,fallbacks:e.fallbacks??[],description:e.description?.trim()??``}))}export{f as a,a as c,m as i,p as n,o,l as r,i as s,d as t};
|
package/dist/gateway/static/root/assets/{use-autosave-tf_8rxAK.js → use-autosave-C10PZ1OV.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./check-DUBLcKHA.js";import{t as a}from"./loader-circle-CifKLtgG.js";import{t as o}from"./cn-JdwAhgNB.js";import{n as s}from"./locale-store-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./check-DUBLcKHA.js";import{t as a}from"./loader-circle-CifKLtgG.js";import{t as o}from"./cn-JdwAhgNB.js";import{n as s}from"./locale-store-BIOMAhmR.js";import{tl as c}from"./index-BIBAmAjw.js";var l=n(),u=r();function d(e){let t=(0,l.c)(21),{status:n,error:r,className:d}=e,p=s(f)===`zh`,m=n===`saving`?p?`正在保存…`:`Saving…`:n===`saved`?p?`已自动保存`:`Saved automatically`:n===`error`?r||(p?`自动保存失败`:`Autosave failed`):n===`dirty`?p?`编辑中,将自动保存`:`Editing — autosave pending`:p?`自动保存`:`Autosave`,h=n===`error`?`text-danger`:n===`saved`?`text-success`:`text-fg-subtle`,g;t[0]!==d||t[1]!==h?(g=o(`inline-flex min-w-0 items-center gap-1.5 text-xs`,h,d),t[0]=d,t[1]=h,t[2]=g):g=t[2];let _;t[3]===n?_=t[4]:(_=n===`saving`?(0,u.jsx)(a,{className:`size-3.5 shrink-0 animate-spin`,"aria-hidden":!0}):null,t[3]=n,t[4]=_);let v;t[5]===n?v=t[6]:(v=n===`saved`?(0,u.jsx)(i,{className:`size-3.5 shrink-0`,"aria-hidden":!0}):null,t[5]=n,t[6]=v);let y;t[7]===n?y=t[8]:(y=n===`error`?(0,u.jsx)(c,{className:`size-3.5 shrink-0`,"aria-hidden":!0}):null,t[7]=n,t[8]=y);let b;t[9]===n?b=t[10]:(b=n===`dirty`?(0,u.jsx)(`span`,{className:`size-1.5 shrink-0 rounded-full bg-current`,"aria-hidden":!0}):null,t[9]=n,t[10]=b);let x;t[11]===m?x=t[12]:(x=(0,u.jsx)(`span`,{className:`truncate`,children:m}),t[11]=m,t[12]=x);let S;return t[13]!==m||t[14]!==g||t[15]!==_||t[16]!==v||t[17]!==y||t[18]!==b||t[19]!==x?(S=(0,u.jsxs)(`span`,{className:g,role:`status`,"aria-live":`polite`,title:m,children:[_,v,y,b,x]}),t[13]=m,t[14]=g,t[15]=_,t[16]=v,t[17]=y,t[18]=b,t[19]=x,t[20]=S):S=t[20],S}function f(e){return e.language}var p=e(t(),1);function m({value:e,dirty:t,onSave:n,enabled:r=!0,delayMs:i=700,validate:a,serialize:o=JSON.stringify}){let[s,c]=(0,p.useState)(`idle`),[l,u]=(0,p.useState)(null),d=(0,p.useRef)(e),f=(0,p.useRef)(n),m=(0,p.useRef)(a),h=(0,p.useRef)(o),g=(0,p.useRef)(null),_=(0,p.useRef)(!1),v=(0,p.useRef)(null),y=(0,p.useRef)(null),b=(0,p.useRef)(null),x=(0,p.useRef)(!0);d.current=e,f.current=n,m.current=a,h.current=o;let S=(0,p.useCallback)(()=>{g.current!==null&&(window.clearTimeout(g.current),g.current=null)},[]),C=(0,p.useCallback)(async e=>{S();let t=h.current(e);b.current=t;let n=m.current?.(e)??null;if(n){u(n),c(`error`);return}if(_.current){v.current=e;return}_.current=!0,u(null),c(`saving`);try{await f.current(e),y.current=t,x.current&&c(`saved`)}catch(e){x.current&&(u(e instanceof Error?e.message:String(e)),c(`error`))}finally{_.current=!1;let e=v.current;v.current=null,e&&h.current(e)!==y.current&&C(e)}},[S]),w=(0,p.useCallback)(()=>{let e=d.current;!r||!t||e===null||C(e)},[t,r,C]),T=(0,p.useCallback)(e=>{let t=e??d.current;!r||t===null||C(t)},[r,C]);return(0,p.useEffect)(()=>{if(!r||!t||e===null){S(),!t&&s===`dirty`&&c(`idle`);return}let n=o(e);if(n!==y.current&&!(s===`error`&&n===b.current))return c(e=>e===`saving`?e:`dirty`),S(),g.current=window.setTimeout(()=>void C(e),i),S},[S,i,t,r,C,o,s,e]),(0,p.useEffect)(()=>(x.current=!0,()=>{x.current=!1,S()}),[S]),{status:s,error:l,flush:w,saveNow:T,retry:w,onBlurCapture:w}}export{d as n,m as t};
|