@xopcai/xopc 0.0.217 → 0.0.218

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (168) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/xopc.extension.json +1 -1
  3. package/dist/gateway/static/root/assets/{activity-store-D6trMTyZ.js → activity-store-DF2dYXG1.js} +1 -1
  4. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-CAQdFrcu.js → agent-avatar-dicebear-Dw9rF5o1.js} +1 -1
  5. package/dist/gateway/static/root/assets/{agents-C6q_vDzP.js → agents-Dj86bHkl.js} +1 -1
  6. package/dist/gateway/static/root/assets/{api-B9pZAyMB.js → api-_H0Bam-t.js} +1 -1
  7. package/dist/gateway/static/root/assets/{app-management-settings-panel-DRsTwFbF.js → app-management-settings-panel-D-M6GN-8.js} +1 -1
  8. package/dist/gateway/static/root/assets/{appearance-settings-B99NaPTf.js → appearance-settings-XDhmzdIc.js} +1 -1
  9. package/dist/gateway/static/root/assets/{apps-page-Dx66anqa.js → apps-page-sfO835uz.js} +1 -1
  10. package/dist/gateway/static/root/assets/{archive-plugin-BF0q7N24.js → archive-plugin-DZCOhXch.js} +1 -1
  11. package/dist/gateway/static/root/assets/{attachment-load-D1qmjGDo.js → attachment-load-Bjb0FH2B.js} +1 -1
  12. package/dist/gateway/static/root/assets/{automations-page-Ccu4yRFa.js → automations-page-D4N3ZDhu.js} +1 -1
  13. package/dist/gateway/static/root/assets/{automations-workspace-CHbA8d-P.js → automations-workspace-PptuZgoo.js} +1 -1
  14. package/dist/gateway/static/root/assets/{binary-plugins-DooqxEZz.js → binary-plugins-uXPt0s47.js} +1 -1
  15. package/dist/gateway/static/root/assets/{block-editor-Dqg9kvb9.js → block-editor-gukkIEro.js} +1 -1
  16. package/dist/gateway/static/root/assets/{browser-settings-page-CpRc-9Jy.js → browser-settings-page-BoCmzMFV.js} +1 -1
  17. package/dist/gateway/static/root/assets/{browser-workflow-inputs-CsIh8ySc.js → browser-workflow-inputs-DAhdS-XZ.js} +1 -1
  18. package/dist/gateway/static/root/assets/{browser-workflows-page-BXQFxT0p.js → browser-workflows-page-LKjYzXS_.js} +1 -1
  19. package/dist/gateway/static/root/assets/{capabilities-settings-panel-C89FGECN.js → capabilities-settings-panel-DhkJsU8Z.js} +2 -2
  20. package/dist/gateway/static/root/assets/{capability-presets-api-BX9U0FRh.js → capability-presets-api-BBUkH833.js} +1 -1
  21. package/dist/gateway/static/root/assets/{capability-presets-settings-panel-XT6WEz9E.js → capability-presets-settings-panel-Dm7T61fE.js} +1 -1
  22. package/dist/gateway/static/root/assets/{channel-recipient-api-CUBTQ0Bz.js → channel-recipient-api-E5mo8M3a.js} +1 -1
  23. package/dist/gateway/static/root/assets/{channels-settings-DhKk1oNT.js → channels-settings-dG6UFVqt.js} +1 -1
  24. package/dist/gateway/static/root/assets/channels-status-swr-DgJxfNyK.js +1 -0
  25. package/dist/gateway/static/root/assets/{chat-terminal-dock-CTbkTsc2.js → chat-terminal-dock-CT5yoSMD.js} +1 -1
  26. package/dist/gateway/static/root/assets/{connectors-page-BDn3HTzX.js → connectors-page-BC6Ft9SU.js} +1 -1
  27. package/dist/gateway/static/root/assets/{cron-expression-XzPZhzVM.js → cron-expression-BGNuaqvI.js} +1 -1
  28. package/dist/gateway/static/root/assets/date-picker-k7mkklMU.js +1 -0
  29. package/dist/gateway/static/root/assets/{dependency-picker-ndtb88_T.js → dependency-picker-DZVSgLXH.js} +1 -1
  30. package/dist/gateway/static/root/assets/{desktop-pet-DZjW-7Tw.js → desktop-pet-p9EZyGzV.js} +1 -1
  31. package/dist/gateway/static/root/assets/{desktop-pet-settings-C7BLs783.js → desktop-pet-settings-Bw4cCFzI.js} +1 -1
  32. package/dist/gateway/static/root/assets/{directory-picker-path-field-BWiap88p.js → directory-picker-path-field-Cbst7IXR.js} +1 -1
  33. package/dist/gateway/static/root/assets/{extension-debug-page-D7APnE3n.js → extension-debug-page-Cd4BMKm_.js} +1 -1
  34. package/dist/gateway/static/root/assets/{extension-page-BhV5hz70.js → extension-page-CzEGCkOa.js} +1 -1
  35. package/dist/gateway/static/root/assets/{extension-settings-page-BhbcGuiJ.js → extension-settings-page-C1PAKSy2.js} +1 -1
  36. package/dist/gateway/static/root/assets/{gateway-config-api-CUt9bIpL.js → gateway-config-api-Bch9vO6t.js} +1 -1
  37. package/dist/gateway/static/root/assets/{gateway-config-swr-BTH9HVUk.js → gateway-config-swr-DNrttVr2.js} +1 -1
  38. package/dist/gateway/static/root/assets/{gateway-settings-RafSECLG.js → gateway-settings-DkDxZFGG.js} +1 -1
  39. package/dist/gateway/static/root/assets/{gateway-startup-retry-DAEk_tnd.js → gateway-startup-retry-B1vD3vRb.js} +1 -1
  40. package/dist/gateway/static/root/assets/{heartbeat-settings-CwVPlPLB.js → heartbeat-settings-DXNMxy5b.js} +1 -1
  41. package/dist/gateway/static/root/assets/{home-page-CbdBcCwC.js → home-page-CYcpVFNT.js} +1 -1
  42. package/dist/gateway/static/root/assets/{image-generation-api-HqcQrSed.js → image-generation-api-BTR0Wk_k.js} +1 -1
  43. package/dist/gateway/static/root/assets/index-Dgb1R07E.css +2 -0
  44. package/dist/gateway/static/root/assets/{index-CMLkr37Y.js → index-DlOYwVFK.js} +49 -49
  45. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BG6lShzn.js → keyboard-shortcuts-settings-CYlS4RGA.js} +1 -1
  46. package/dist/gateway/static/root/assets/{local-app-workbench-page-DdaPtQ5M.js → local-app-workbench-page-BFrgPwGE.js} +2 -2
  47. package/dist/gateway/static/root/assets/{local-apps-page-vaz8ewe2.js → local-apps-page-CNppYVew.js} +1 -1
  48. package/dist/gateway/static/root/assets/{locale-store-De8wYkd7.js → locale-store-gf9Bg2gb.js} +1 -1
  49. package/dist/gateway/static/root/assets/{logs-page-CjxMHTQO.js → logs-page-CPweLw3k.js} +1 -1
  50. package/dist/gateway/static/root/assets/{management-settings-tqTGCHt0.js → management-settings-IYk9xLgt.js} +1 -1
  51. package/dist/gateway/static/root/assets/{markdown-split-BGx8Aao0.js → markdown-split-D8e6pRMH.js} +1 -1
  52. package/dist/gateway/static/root/assets/{markdown-view-ybRARsPs.js → markdown-view-D0fiJjBQ.js} +1 -1
  53. package/dist/gateway/static/root/assets/{media-plugins-xbM-SSP5.js → media-plugins-CCq6TtEf.js} +1 -1
  54. package/dist/gateway/static/root/assets/messages-B9WQcZ1V.js +3 -0
  55. package/dist/gateway/static/root/assets/{notes-api-D9CCwyWK.js → notes-api-BBtWnlUU.js} +1 -1
  56. package/dist/gateway/static/root/assets/{notes-page-CMNBbg6g.js → notes-page-BKe1xa3U.js} +1 -1
  57. package/dist/gateway/static/root/assets/{notes-workbench-V9C-8vSn.js → notes-workbench-wieRAd1y.js} +2 -2
  58. package/dist/gateway/static/root/assets/{page-tabs-e99j9S9K.js → page-tabs-Bsluqyfb.js} +1 -1
  59. package/dist/gateway/static/root/assets/{preview-open-alternatives-DW9MDOva.js → preview-open-alternatives-BrpTWv44.js} +1 -1
  60. package/dist/gateway/static/root/assets/{product-open-page-CZdzgPZW.js → product-open-page-DXe5iWI6.js} +1 -1
  61. package/dist/gateway/static/root/assets/{project-detail-page-DHmAUggu.js → project-detail-page-Cww6V7HJ.js} +1 -1
  62. package/dist/gateway/static/root/assets/{projects-page-D0EiN69Y.js → projects-page-D0LKhCCw.js} +1 -1
  63. package/dist/gateway/static/root/assets/{registry-api-DYmKEwiG.js → registry-api-xj5gOva_.js} +1 -1
  64. package/dist/gateway/static/root/assets/{remote-access-hub-BuAVFk2O.js → remote-access-hub-Sf4Pde6Z.js} +1 -1
  65. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-DQ12tLCL.js → runtime-tools-settings-panel-BJTvmBCA.js} +1 -1
  66. package/dist/gateway/static/root/assets/{schema-form-DNCDIkqC.js → schema-form-DvGBa_7R.js} +1 -1
  67. package/dist/gateway/static/root/assets/{sessions-page-hzlTfgOl.js → sessions-page-S5gvgfu5.js} +1 -1
  68. package/dist/gateway/static/root/assets/settings-advanced-gate-B3XvdEy8.js +1 -0
  69. package/dist/gateway/static/root/assets/{settings-form-section-z0JH53Fu.js → settings-form-section-CiGFtdD8.js} +1 -1
  70. package/dist/gateway/static/root/assets/{settings-loading-skeleton-xgo41cfo.js → settings-loading-skeleton-sbef7GTm.js} +1 -1
  71. package/dist/gateway/static/root/assets/{settings-page-8astk_1U.js → settings-page-BNGxxXZe.js} +1 -1
  72. package/dist/gateway/static/root/assets/{setup-status-panel-fZQfoJAk.js → setup-status-panel-CGU_Mxjr.js} +1 -1
  73. package/dist/gateway/static/root/assets/{share-preview-page-BBZV4AGy.js → share-preview-page-C1523ij3.js} +1 -1
  74. package/dist/gateway/static/root/assets/{shares-settings-B5dPMq3Y.js → shares-settings-k0UQ8WxO.js} +1 -1
  75. package/dist/gateway/static/root/assets/skill-reload-api-DQ1GvL1w.js +1 -0
  76. package/dist/gateway/static/root/assets/{skills-page-BSN2VaqR.js → skills-page-OuHd9GcN.js} +1 -1
  77. package/dist/gateway/static/root/assets/{skills-page.utils-HmoDhJVh.js → skills-page.utils-Ditgz7Vo.js} +1 -1
  78. package/dist/gateway/static/root/assets/{system-settings-panel-CSibO8vj.js → system-settings-panel-CERqCsz2.js} +1 -1
  79. package/dist/gateway/static/root/assets/tab-completion-input-D64VNmiA.js +1 -0
  80. package/dist/gateway/static/root/assets/tab-completion-input.utils-BP3NH_du.js +1 -0
  81. package/dist/gateway/static/root/assets/{task-detail-page-HCKZ11E8.js → task-detail-page-BnRNL2sn.js} +1 -1
  82. package/dist/gateway/static/root/assets/{theme-store-STx6jo38.js → theme-store-DgSjes3O.js} +1 -1
  83. package/dist/gateway/static/root/assets/{typed-models-lib-zrYg51t3.js → typed-models-lib-abEJNkCO.js} +1 -1
  84. package/dist/gateway/static/root/assets/{use-autosave-CqFVx92z.js → use-autosave-Bp_qFZkl.js} +1 -1
  85. package/dist/gateway/static/root/assets/user-context-page-Cnkaiky5.js +1 -0
  86. package/dist/gateway/static/root/assets/{voice-api-key-field-pYDiKKMo.js → voice-api-key-field-hbzDfErG.js} +1 -1
  87. package/dist/gateway/static/root/assets/{work-discovery-overlay-LJLw9zf0.js → work-discovery-overlay-DZVib-04.js} +1 -1
  88. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-D0WhQ3kI.js → workflow-run-setup-panel-C2RKay1p.js} +1 -1
  89. package/dist/gateway/static/root/assets/workflows-page-B_VlcKiK.js +5 -0
  90. package/dist/gateway/static/root/index.html +11 -11
  91. package/dist/package.js +1 -1
  92. package/dist/src/agent/agent-manager.js +4 -4
  93. package/dist/src/agent/background-review/prompts.d.ts +1 -1
  94. package/dist/src/agent/background-review/prompts.js +4 -1
  95. package/dist/src/agent/embedded/model-runtime.js +1 -1
  96. package/dist/src/agent/embedded/run-for-session.js +1 -1
  97. package/dist/src/agent/image/tool-model-config.js +1 -1
  98. package/dist/src/agent/ipc/inbox.js +1 -1
  99. package/dist/src/agent/memory/create-memory-manager.js +1 -1
  100. package/dist/src/agent/service.js +2 -2
  101. package/dist/src/agent/session/session-inspector.js +1 -1
  102. package/dist/src/agent/skills/hub-lock.js +1 -1
  103. package/dist/src/agent/tasks/task-judge-service.js +3 -3
  104. package/dist/src/agent-runtime/index.js +1 -1
  105. package/dist/src/agent-runtime/runtime-profile.js +1 -1
  106. package/dist/src/ai-assist/text-assist.js +1 -1
  107. package/dist/src/auth/credentials.js +2 -2
  108. package/dist/src/auth/profiles/store.js +1 -1
  109. package/dist/src/auth/sync-provider-auth.js +2 -2
  110. package/dist/src/browser/providers/browser-ext-install.js +1 -1
  111. package/dist/src/cli/commands/doctor/checks/provider-auth.js +1 -1
  112. package/dist/src/cli/commands/models.js +1 -1
  113. package/dist/src/config/agent-profile.js +1 -1
  114. package/dist/src/config/index.js +4 -4
  115. package/dist/src/config/loader.js +1 -1
  116. package/dist/src/config/models-json.js +1 -1
  117. package/dist/src/connectors/connected-source-ingestion.js +21 -4
  118. package/dist/src/connectors/connected-source-normalizers.js +51 -4
  119. package/dist/src/connectors/connected-source-understanding.d.ts +19 -0
  120. package/dist/src/connectors/connected-source-understanding.js +132 -0
  121. package/dist/src/connectors/content-enrichment.d.ts +1 -0
  122. package/dist/src/connectors/content-enrichment.js +11 -7
  123. package/dist/src/connectors/learning-coordinator.js +55 -4
  124. package/dist/src/connectors/learning-recipes.js +2 -2
  125. package/dist/src/document-understanding/extract.d.ts +1 -1
  126. package/dist/src/document-understanding/extract.js +54 -1
  127. package/dist/src/extensions/lockfile.js +1 -1
  128. package/dist/src/gateway/agents-admin.js +2 -2
  129. package/dist/src/gateway/file-path-classifier.js +1 -1
  130. package/dist/src/gateway/heartbeat/service.js +1 -1
  131. package/dist/src/gateway/hono/lib/config-payload.js +1 -1
  132. package/dist/src/gateway/hono/routes/models.js +1 -1
  133. package/dist/src/gateway/hono/routes/understanding-sources.js +25 -7
  134. package/dist/src/gateway/hono/routes/workflows.js +2 -2
  135. package/dist/src/gateway/rate-limit/buckets.d.ts +1 -1
  136. package/dist/src/gateway/rate-limit/buckets.js +2 -2
  137. package/dist/src/gateway/service/config-coordinator.js +1 -1
  138. package/dist/src/gateway/service.js +9 -9
  139. package/dist/src/heartbeat/index.js +1 -1
  140. package/dist/src/providers/auth-runtime/resolve-auth.js +1 -1
  141. package/dist/src/providers/index.js +2 -2
  142. package/dist/src/providers/model-registry.js +1 -1
  143. package/dist/src/providers/register-runtime-providers.js +1 -1
  144. package/dist/src/tui/tui-startup-resources.js +1 -1
  145. package/dist/src/tui/tui.js +1 -1
  146. package/dist/src/user-context/sources/catalog.js +9 -2
  147. package/dist/src/user-context/sources/local-source-contract.d.ts +1 -1
  148. package/dist/src/user-context/sources/local-source-contract.js +1 -0
  149. package/dist/src/user-context/understanding-writing.d.ts +1 -0
  150. package/dist/src/user-context/understanding-writing.js +4 -0
  151. package/dist/src/work-discovery/analyzer.d.ts +6 -0
  152. package/dist/src/work-discovery/analyzer.js +181 -57
  153. package/dist/src/work-discovery/index.js +1 -1
  154. package/dist/src/work-discovery/probe.js +20 -0
  155. package/dist/src/work-discovery/service.d.ts +9 -0
  156. package/dist/src/work-discovery/service.js +18 -6
  157. package/dist/src/work-discovery/types.d.ts +5 -0
  158. package/dist/src/workflows/service/workflow-run-service.js +1 -1
  159. package/package.json +3 -3
  160. package/dist/gateway/static/root/assets/channels-status-swr-CiwOOoVL.js +0 -1
  161. package/dist/gateway/static/root/assets/date-picker-BmZjs4Bq.js +0 -1
  162. package/dist/gateway/static/root/assets/index-AbNnQyKk.css +0 -2
  163. package/dist/gateway/static/root/assets/messages-VI9m1xJl.js +0 -3
  164. package/dist/gateway/static/root/assets/settings-advanced-gate-BlCoA_9h.js +0 -1
  165. package/dist/gateway/static/root/assets/skill-reload-api-i1PGf1V2.js +0 -1
  166. package/dist/gateway/static/root/assets/tab-completion-input-B-VsxKhC.js +0 -1
  167. package/dist/gateway/static/root/assets/user-context-page-CqG56cDS.js +0 -1
  168. package/dist/gateway/static/root/assets/workflows-page-DQAJzV5w.js +0 -5
@@ -1 +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-VI9m1xJl.js";import{n as o}from"./locale-store-De8wYkd7.js";import{t as s}from"./electron-env-DH5wF8X8.js";import{Ai as c,Bn as l,Fs as u,Hn as d,Jl as f,Un as p,Vn as m,Xo as h,qs as g}from"./index-CMLkr37Y.js";import{n as _,r as v}from"./settings-page-layout-BRQNel6r.js";import{r as y,t as b}from"./settings-form-section-z0JH53Fu.js";var x=e(t(),1);async function S(e,t){let n=window.electronAPI?.system;if(!s()||!n?.requestNotifications)return`unsupported`;let r=await n.requestNotifications();if(r.status!==`granted`)return r.outcome===`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)(d),[r,i]=(0,x.useState)(null),[s,c]=(0,x.useState)(!1),u=async t=>{if(!t){n(p({enabled:!1})),i(null);return}c(!0);try{let t=await l();if(t!==`granted`){i(t===`unsupported`?e.unsupported:e.denied);return}n(p({enabled:!0})),i(await m(e.testTitle,e.testBody)?e.testShown:e.failed)}finally{c(!1)}},h=e=>{n(p(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)(f,{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`?u(t.target.checked):h({[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.outcome===`opened-settings`?n.openedSettings:e.status===`granted`&&t?e.outcome===`already-granted`?n.alreadyGranted:n.granted:t?e.status===`denied`?n.denied:n.prompted:n.rendererDenied}function D(e,t){return e.outcome===`opened-settings`?t.openedSettings:e.status===`granted`?e.outcome===`already-granted`?t.alreadyGranted:t.granted:t.denied}function O(e,t){return e.outcome===`opened-settings`?t.openedSettings:e.status===`granted`?e.outcome===`already-granted`?t.alreadyGranted:t.granted:e.status===`denied`?t.denied:t.prompted}function k(e,t){return e.outcome===`opened-settings`?t.openedSettings:e.status===`granted`?e.outcome===`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)(c,L),{behavior:d,perms:f,loadError:p,permFeedback:m,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(!m||!e.has(m))return;let n=window.setTimeout(()=>{l({type:`patch`,patch:{permFeedback:null}})},3e3);return()=>window.clearTimeout(n)},[m,t.openSettingsDone,t.openSettingsFailed,t.refreshDone,t.desktopNotify.testShown]),(0,x.useEffect)(()=>{s()&&R&&z()},[R,z]),!s()||!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=e.outcome===`opened-settings`||e.status===`denied`?!1: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=d?d.platform===`win32`?t.permissionsHintWin:d.platform===`linux`?t.permissionsHintLinux:d.platform===`darwin`?t.permissionsHintDarwin:t.permissionsHint:t.permissionsHint;return(0,C.jsxs)(v,{gap:`gap-6`,children:[(0,C.jsx)(_,{title:t.title}),p?(0,C.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:p}):null,m?(0,C.jsx)(`p`,{className:i(`text-sm`,m===t.refreshDone||m===t.openSettingsDone||m===t.permFeedback.granted||m===t.permFeedback.alreadyGranted||m===t.accessibilityFeedback.granted||m===t.accessibilityFeedback.alreadyGranted||m===t.notificationsFeedback.granted||m===t.notificationsFeedback.alreadyGranted||m===t.screenFeedback.granted||m===t.screenFeedback.alreadyGranted||m===t.desktopNotify.testShown?`text-emerald-600 dark:text-emerald-400`:`text-fg-muted`),role:`status`,"aria-live":`polite`,children:m}):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)(u,{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:!d,checked:!!d?.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:!d,checked:!!d?.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:!d||A,checked:!!d?.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:!d,checked:!!d?.notifySoundEnabled,onChange:e=>{V({notifySoundEnabled:e.target.checked})}})]})]})]}),d&&f?(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}),d.platform===`darwin`&&!d.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`,h.press),onClick:()=>void B(),children:[(0,C.jsx)(g,{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(d.platform).map(({key:n,pane:a})=>{let o=F(e,f[n]),s=t.perm[n],c=f[n]===`unknown`?I(e,n,d.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}),c?(0,C.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:c}):null]}),(0,C.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[n===`notifications`&&j(n,f[n],d.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`,h.press),onClick:()=>void K(),children:t.requestAccess}):null,n===`microphone`&&j(n,f[n],d.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`,h.press),onClick:()=>void W(),children:t.requestAccess}):null,n===`accessibility`&&j(n,f[n],d.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`,h.press),onClick:()=>void G(),children:t.requestAccess}):null,n===`screen`&&j(n,f[n],d.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`,h.press),onClick:()=>void q(),children:t.requestAccess}):null,M(n,f[n],d.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`,h.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-B9WQcZ1V.js";import{n as o}from"./locale-store-gf9Bg2gb.js";import{t as s}from"./electron-env-DH5wF8X8.js";import{Ai as c,Bn as l,Fs as u,Hn as d,Jl as f,Un as p,Vn as m,Xo as h,qs as g}from"./index-DlOYwVFK.js";import{n as _,r as v}from"./settings-page-layout-BRQNel6r.js";import{r as y,t as b}from"./settings-form-section-CiGFtdD8.js";var x=e(t(),1);async function S(e,t){let n=window.electronAPI?.system;if(!s()||!n?.requestNotifications)return`unsupported`;let r=await n.requestNotifications();if(r.status!==`granted`)return r.outcome===`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)(d),[r,i]=(0,x.useState)(null),[s,c]=(0,x.useState)(!1),u=async t=>{if(!t){n(p({enabled:!1})),i(null);return}c(!0);try{let t=await l();if(t!==`granted`){i(t===`unsupported`?e.unsupported:e.denied);return}n(p({enabled:!0})),i(await m(e.testTitle,e.testBody)?e.testShown:e.failed)}finally{c(!1)}},h=e=>{n(p(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)(f,{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`?u(t.target.checked):h({[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.outcome===`opened-settings`?n.openedSettings:e.status===`granted`&&t?e.outcome===`already-granted`?n.alreadyGranted:n.granted:t?e.status===`denied`?n.denied:n.prompted:n.rendererDenied}function D(e,t){return e.outcome===`opened-settings`?t.openedSettings:e.status===`granted`?e.outcome===`already-granted`?t.alreadyGranted:t.granted:t.denied}function O(e,t){return e.outcome===`opened-settings`?t.openedSettings:e.status===`granted`?e.outcome===`already-granted`?t.alreadyGranted:t.granted:e.status===`denied`?t.denied:t.prompted}function k(e,t){return e.outcome===`opened-settings`?t.openedSettings:e.status===`granted`?e.outcome===`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)(c,L),{behavior:d,perms:f,loadError:p,permFeedback:m,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(!m||!e.has(m))return;let n=window.setTimeout(()=>{l({type:`patch`,patch:{permFeedback:null}})},3e3);return()=>window.clearTimeout(n)},[m,t.openSettingsDone,t.openSettingsFailed,t.refreshDone,t.desktopNotify.testShown]),(0,x.useEffect)(()=>{s()&&R&&z()},[R,z]),!s()||!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=e.outcome===`opened-settings`||e.status===`denied`?!1: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=d?d.platform===`win32`?t.permissionsHintWin:d.platform===`linux`?t.permissionsHintLinux:d.platform===`darwin`?t.permissionsHintDarwin:t.permissionsHint:t.permissionsHint;return(0,C.jsxs)(v,{gap:`gap-6`,children:[(0,C.jsx)(_,{title:t.title}),p?(0,C.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:p}):null,m?(0,C.jsx)(`p`,{className:i(`text-sm`,m===t.refreshDone||m===t.openSettingsDone||m===t.permFeedback.granted||m===t.permFeedback.alreadyGranted||m===t.accessibilityFeedback.granted||m===t.accessibilityFeedback.alreadyGranted||m===t.notificationsFeedback.granted||m===t.notificationsFeedback.alreadyGranted||m===t.screenFeedback.granted||m===t.screenFeedback.alreadyGranted||m===t.desktopNotify.testShown?`text-emerald-600 dark:text-emerald-400`:`text-fg-muted`),role:`status`,"aria-live":`polite`,children:m}):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)(u,{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:!d,checked:!!d?.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:!d,checked:!!d?.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:!d||A,checked:!!d?.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:!d,checked:!!d?.notifySoundEnabled,onChange:e=>{V({notifySoundEnabled:e.target.checked})}})]})]})]}),d&&f?(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}),d.platform===`darwin`&&!d.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`,h.press),onClick:()=>void B(),children:[(0,C.jsx)(g,{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(d.platform).map(({key:n,pane:a})=>{let o=F(e,f[n]),s=t.perm[n],c=f[n]===`unknown`?I(e,n,d.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}),c?(0,C.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:c}):null]}),(0,C.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[n===`notifications`&&j(n,f[n],d.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`,h.press),onClick:()=>void K(),children:t.requestAccess}):null,n===`microphone`&&j(n,f[n],d.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`,h.press),onClick:()=>void W(),children:t.requestAccess}):null,n===`accessibility`&&j(n,f[n],d.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`,h.press),onClick:()=>void G(),children:t.requestAccess}):null,n===`screen`&&j(n,f[n],d.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`,h.press),onClick:()=>void q(),children:t.requestAccess}):null,M(n,f[n],d.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`,h.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};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";var i=n(),a=e(t(),1),o=r();function s(e,t){return t?.trim()?e?e.split(/\s+/).includes(`Tab`)?e:`${e} Tab`:`Tab`:e}function c(e,t){return e.key===`Tab`&&!e.shiftKey&&!e.metaKey&&!e.ctrlKey&&!e.altKey&&!e.nativeEvent.isComposing&&!e.currentTarget.disabled&&!e.currentTarget.readOnly&&!e.currentTarget.value.trim()&&!!t?.trim()}function l(e,t,n,r){r?.(e),!(e.defaultPrevented||!c(e,t))&&(e.preventDefault(),n(t))}var u=(0,a.forwardRef)(function(e,t){let n=(0,i.c)(18),r,a,c,u,d;n[0]===e?(r=n[1],a=n[2],c=n[3],u=n[4],d=n[5]):({suggestion:d,onAcceptSuggestion:r,onKeyDown:a,"aria-keyshortcuts":u,...c}=e,n[0]=e,n[1]=r,n[2]=a,n[3]=c,n[4]=u,n[5]=d);let f;n[6]!==u||n[7]!==d?(f=s(u,d),n[6]=u,n[7]=d,n[8]=f):f=n[8];let p;n[9]!==r||n[10]!==a||n[11]!==d?(p=e=>l(e,d,r,a),n[9]=r,n[10]=a,n[11]=d,n[12]=p):p=n[12];let m;return n[13]!==c||n[14]!==t||n[15]!==f||n[16]!==p?(m=(0,o.jsx)(`input`,{...c,ref:t,"aria-keyshortcuts":f,onKeyDown:p}),n[13]=c,n[14]=t,n[15]=f,n[16]=p,n[17]=m):m=n[17],m}),d=(0,a.forwardRef)(function(e,t){let n=(0,i.c)(18),r,a,c,u,d;n[0]===e?(r=n[1],a=n[2],c=n[3],u=n[4],d=n[5]):({suggestion:d,onAcceptSuggestion:r,onKeyDown:a,"aria-keyshortcuts":u,...c}=e,n[0]=e,n[1]=r,n[2]=a,n[3]=c,n[4]=u,n[5]=d);let f;n[6]!==u||n[7]!==d?(f=s(u,d),n[6]=u,n[7]=d,n[8]=f):f=n[8];let p;n[9]!==r||n[10]!==a||n[11]!==d?(p=e=>l(e,d,r,a),n[9]=r,n[10]=a,n[11]=d,n[12]=p):p=n[12];let m;return n[13]!==c||n[14]!==t||n[15]!==f||n[16]!==p?(m=(0,o.jsx)(`textarea`,{...c,ref:t,"aria-keyshortcuts":f,onKeyDown:p}),n[13]=c,n[14]=t,n[15]=f,n[16]=p,n[17]=m):m=n[17],m});export{d as n,u as t};
@@ -0,0 +1 @@
1
+ function e(e){return e.replace(/^(?:例如\s*[::]?|for example\s*[::]?|e\.g\.\s*)/i,``).replace(/…$/,``).trim()}export{e as t};
@@ -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"./circle-check-C23XjkUj.js";import{t as u}from"./external-link-DjqjBmc3.js";import{f as d,t as f,u as p}from"./markdown-view-ybRARsPs.js";import{t as m}from"./x-B_N4OPjy.js";import{t as h}from"./cn-JdwAhgNB.js";import{t as g}from"./button-CSEbl4zT.js";import{l as _,n as ee}from"./locale-store-De8wYkd7.js";import{i as te,n as ne,o as re,r as ie,s as ae,t as v}from"./dist-BPoKqzeH.js";import{$c as oe,Br as y,Fr as se,H as b,Ha as ce,I as x,In as le,Ir as S,J as ue,K as de,Ln as fe,Lr as pe,Ni as me,Oa as he,P as ge,Pi as C,Rn as w,Rr as _e,Tl as T,Ua as E,Vr as ve,X as D,Z as O,_c as ye,el as be,eu as k,n as A,nt as j,ro as M,sc as N,tc as P,ul as F,wl as I,yi as xe}from"./index-CMLkr37Y.js";import{t as Se}from"./date-picker-BmZjs4Bq.js";import{t as L}from"./dependency-picker-ndtb88_T.js";var R=e(t(),1),z=n();function Ce(e,t,n,r){return!!(e&&t!==e.version&&n!==e.value&&r!==n)}function we(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 B=r();function Te(e,t){return(t===`zh`?{backlog:`待规划`,ready:`就绪`,active:`进行中`,review:`待验收`,closed:`已完成`}:{backlog:`Backlog`,ready:`Ready`,active:`Active`,review:`Review`,closed:`Completed`})[e]}function Ee(){let e=(0,z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,B.jsxs)(`div`,{className:`space-y-4`,"aria-busy":!0,children:[(0,B.jsx)(E,{className:`h-32 rounded-2xl`}),(0,B.jsx)(E,{className:`h-52 rounded-2xl`}),(0,B.jsx)(E,{className:`h-40 rounded-2xl`})]}),e[0]=t):t=e[0],t}function De(e){if(e===void 0)return``;let t=new Date(e);return new Date(t.getTime()-t.getTimezoneOffset()*6e4).toISOString().slice(0,10)}function Oe(e){return e?new Date(`${e}T23:59:59.999`).getTime():null}var ke=[`backlog`,`ready`,`active`,`review`,`closed`],Ae=[`low`,`normal`,`high`,`critical`],je=(0,R.memo)(function(e){let t=(0,z.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,B.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=ke.map(e=>(0,B.jsx)(c,{value:e,disabled:p(e),children:Te(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,B.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 ee;return t[17]!==m||t[18]!==_?(ee=(0,B.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[m,_]}),t[17]=m,t[18]=_,t[19]=ee):ee=t[19],ee}),Me=(0,R.memo)(function(e){let t=(0,z.c)(14),{value:n,disabled:r,label:i,labels:a,onChange:o}=e,l;t[0]===i?l=t[1]:(l=(0,B.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=Ae.map(e=>(0,B.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,B.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,B.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}),Ne=(0,R.memo)(function(e){let t=(0,z.c)(10),{value:n,disabled:r,label:i,onChange:a}=e,o;t[0]===i?o=t[1]:(o=(0,B.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,B.jsx)(Se,{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,B.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}),Pe=(0,R.memo)(function(e){let t=(0,z.c)(17),{value:n,disabled:r,label:i,unassignedLabel:a,agents:o,onChange:l}=e,u;t[0]===i?u=t[1]:(u=(0,B.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,B.jsx)(c,{value:``,disabled:!0,children:a}),t[4]=a,t[5]=f);let p;t[6]===o?p=t[7]:(p=o.map(Xe),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,B.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,B.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}),Fe=(0,R.memo)(function(e){let t=(0,z.c)(8),{candidates:n,selected:r,disabled:i,labels:a,onChange:o}=e,s;t[0]===r?s=t[1]:(s=r.map(Ze),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,B.jsx)(L,{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)),Ie=`xopc.taskDetail.chatPanelPercent`,Le=42;function Re(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?Le:Math.min(r,Math.max(n,e))}function ze(){try{let e=Number(window.localStorage.getItem(Ie));return Number.isFinite(e)&&e>=30&&e<=60?e:Le}catch{return Le}}function Be(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 V(e){let t=(0,z.c)(9),{items:n,empty:r,verificationByCriterion:i}=e;if(n.length===0){let e;return t[0]===r?e=t[1]:(e=(0,B.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,B.jsxs)(`li`,{className:`flex gap-2 text-sm leading-6 text-fg`,children:[(0,B.jsx)(t===`passed`?l:t===`failed`?T:I,{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,B.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,B.jsx)(`ul`,{className:`space-y-2`,children:a}),t[7]=a,t[8]=o),o}function H({taskId:e,presentation:t,backgroundPath:n}){let[r]=a(),i=ee(e=>e.language),s=_(e=>e.token),c=(0,R.useMemo)(()=>O(i),[i]),m=M(e=>e.setPageHeader),te=M(e=>e.clearPageHeader),ne=C(e=>e.open),re=C(e=>e.sessionKeyOverride),ie=C(e=>e.openForSession),ae=ve(e=>e.setOpen),{data:v,error:me,mutate:w,lastChange:T,conversationLoading:E,conversationError:I}=ge(e),[Se,L]=(0,R.useState)(null),[z,Te]=(0,R.useState)(()=>new Set),[ke,Ae]=(0,R.useState)([]),[H,Ve]=(0,R.useState)(null),[He,Ue]=(0,R.useState)([]),[We,U]=(0,R.useState)(!1),[Ge,Ke]=(0,R.useState)(``),[qe,W]=(0,R.useState)(!1),[Je,Ye]=(0,R.useState)(``),[G,Xe]=(0,R.useState)(ze),[Ze,Qe]=(0,R.useState)(!1),$e=(0,R.useRef)(null),et=(0,R.useRef)(!1),tt=(0,R.useRef)(!1),nt=(0,R.useRef)(``),rt=(0,R.useRef)(null),it=(0,R.useRef)(null),at=(0,R.useRef)(null),ot=(0,R.useRef)(v),[st,K]=(0,R.useState)(null),[ct,lt]=(0,R.useState)(null),ut=(0,R.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]),dt=v?.dependencies.map(e=>`${e.id}:${e.title}`).join(`\0`)??``,ft=(0,R.useMemo)(()=>p(r.get(`returnTo`),`/`,[`/projects`,`/chat`,`/notes`,`/tasks`]),[r]);ot.current=v;let q=(0,R.useCallback)((e,t)=>{Te(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r})},[]);(0,R.useEffect)(()=>{L(null),K(null),U(!1),W(!1),lt(null)},[e]),(0,R.useEffect)(()=>{let e=!0;return ce().then(t=>{e&&Ue(t.items)}).catch(()=>void 0),()=>{e=!1}},[s]),(0,R.useEffect)(()=>{if(!T||T.source===`user`)return;lt(T);let e=window.setTimeout(()=>lt(null),3500);return()=>window.clearTimeout(e)},[T]),(0,R.useEffect)(()=>{let t=v?.task.projectId,n=v?.dependencies??[];if(!t){at.current=null,Ve(null),Ae(n);return}at.current!==t&&(at.current=t,Ve(null));let r=!0;return he(t).then(t=>{if(!r)return;Ve(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});Ae([...i.values()])}).catch(()=>{r&&Ae(n)}),()=>{r=!1}},[dt,v?.task.projectId,e]);let J=(0,R.useCallback)(async(t,n=`command`)=>{let r=ot.current;if(r){q(n,!0),L(null);try{await w(await x(e,t,r.task.version),{revalidate:!1})}catch{L(c.actionFailed)}finally{q(n,!1)}}},[c.actionFailed,w,q,e]),Y=(0,R.useCallback)(async(t,n)=>{let r=ot.current;if(!r)return!1;n&&q(n,!0),L(null);try{return await w(ue(e,t,r.task.version),{optimisticData:we(r,t),populateCache:!0,revalidate:!1,rollbackOnError:!0}),!0}catch{return L(c.actionFailed),!1}finally{n&&q(n,!1)}},[c.actionFailed,w,q,e]),pt=async()=>{if(!v)return;if(et.current){et.current=!1;return}let e=Ge.trim(),t=rt.current;if(Ce(t,v.task.version,v.task.title,e)){K(`title`);return}if(!e||e===v.task.title){Ke(v.task.title),U(!1);return}await Y({title:e})&&(K(null),U(!1))},mt=async()=>{if(!v)return;if(tt.current){tt.current=!1;return}let e=Je.trim(),t=it.current;if(Ce(t,v.task.version,v.task.body??``,e)){K(`description`);return}if(Je===nt.current||e===(v.task.body??``).trim()){W(!1);return}await Y({body:e||null})&&(K(null),W(!1))},ht=(0,R.useCallback)(async e=>{let t=ot.current;if(!(!t||e===t.task.phase)){if(t.task.phase===`closed`){await J({type:`reopen`,phase:e===`closed`?`ready`:e},`phase`);return}if(e===`closed`){await J({type:`close`,resolution:`done`},`phase`);return}await J({type:`move`,phase:e},`phase`)}},[J]),gt=(0,R.useCallback)(e=>{Y({priority:e},`priority`)},[Y]),_t=(0,R.useCallback)(e=>{Y({dueAt:Oe(e)},`dueAt`)},[Y]),vt=(0,R.useCallback)(e=>{Xe(e);try{window.localStorage.setItem(Ie,String(e))}catch{}},[]),yt=(0,R.useCallback)(e=>{if(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`&&e.key!==`Home`)return;e.preventDefault();let t=$e.current?.clientWidth??0;vt(Re(e.key===`Home`?Le:G+(e.key===`ArrowLeft`?2:-2),t))},[G,vt]),bt=(0,R.useCallback)(e=>{if(!window.matchMedia(`(min-width: 1024px)`).matches)return;let t=$e.current;if(!t)return;e.preventDefault();let n=e.currentTarget,r=e.pointerId;n.setPointerCapture(r),Qe(!0);let i=G,a=0,o=()=>{a=0,t.style.setProperty(`--task-chat-panel-width`,`${i}%`)},s=e=>{let n=t.getBoundingClientRect();i=Re((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{}Qe(!1),vt(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)},[G,vt]),xt=(0,R.useCallback)(async t=>{let n=ot.current;if(n){q(`dependencies`,!0),L(null);try{await w(await D(e,t,n.task.version),{revalidate:!1})}catch{L(c.dependencyUpdateFailed)}finally{q(`dependencies`,!1)}}},[c.dependencyUpdateFailed,w,q,e]),St=(0,R.useCallback)(async t=>{let n=ot.current;if(!(!n||!t||t===n.conversation.currentExecutorAgentId)){q(`delegateAgentId`,!0),L(null);try{await w(await b(e,t,n.task.version),{revalidate:!1})}catch{L(c.actionFailed)}finally{q(`delegateAgentId`,!1)}}},[c.actionFailed,w,q,e]);if((0,R.useLayoutEffect)(()=>{if(t!==`modal`)return m({startExtra:(0,B.jsx)(o,{to:ft,className:`flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover`,"aria-label":c.backToWork,children:(0,B.jsx)(k,{className:`size-4`})}),main:v?(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsx)(`p`,{className:`truncate text-sm font-semibold text-fg`,children:H?`${H} / ${c.taskLabel}`:c.taskLabel}),(0,B.jsx)(`p`,{className:`text-xs text-fg-muted`,children:c.detailStatuses[Be(v)]})]}):null,end:null}),te},[te,c.backToWork,c.detailStatuses,c.taskLabel,v,t,H,ft,m]),me&&!v)return(0,B.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(!v)return(0,B.jsx)(`div`,{className:t===`modal`?`p-5`:`mx-auto max-w-4xl p-4 sm:p-6`,children:(0,B.jsx)(Ee,{})});let Ct=v.waits[0],wt=Ct?.kind===`paused`?Ct:void 0,X=v.receipts[0],Tt=c.detailStatuses[Be(v)],Et=c.detailStatusDescriptions[Be(v)],Dt=v.task.body?.trim()||v.task.contract?.objective.trim(),Ot=new Map(X?.verification.checks.map(e=>[e.criterion,e.status])),kt=v.allowedCommands.includes(`mark_ready`),At=v.allowedCommands.includes(`start`),jt=v.allowedCommands.includes(`add_wait`),Mt=v.task.phase===`review`&&v.allowedCommands.includes(`close`),Nt=v.allowedCommands.includes(`reopen`),Z=v.conversation.activeSessionKey,Pt=v.conversation.currentExecutorAgentId??v.task.delegateAgentId??v.task.ownerId,Ft=He.find(e=>e.id===Pt),It=!!(Z&&ne&&re===Z),Lt=v.attention.some(e=>e.kind===`input_required`||e.kind===`approval_required`),Rt=v.task.contract?.acceptanceCriteria??[],zt=Rt.filter(e=>Ot.get(e)===`passed`).length,Bt=v.task.contract?.expectedOutputs??[],Vt=v.task.contract?.constraints??[],Ht=v.task.contract?.approvalRequired??[],Ut=v.task.contract?.assumptions??[],Wt=v.task.contract?.risks??[],Q=(...e)=>!!ct?.changedFields.some(t=>e.includes(t)),Gt=e=>t===`modal`&&n?fe(n,e):d(`/tasks/${e}`,ft),Kt=v.allowedCommands.includes(`move`),$=z.has(`command`),qt=(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[kt?(0,B.jsxs)(g,{variant:`primary`,disabled:$,onClick:()=>void J({type:`mark_ready`}),children:[(0,B.jsx)(P,{className:`size-4`}),c.scheduleTask]}):null,wt?(0,B.jsxs)(g,{variant:`primary`,disabled:$,onClick:()=>void J({type:`resolve_wait`,waitId:wt.id}),children:[(0,B.jsx)(P,{className:`size-4`}),c.resumeTask]}):null,!Ct&&At&&Pt?(0,B.jsxs)(g,{variant:`primary`,disabled:$,onClick:()=>void J({type:`start`,executor:{kind:`agent`,agentId:Pt}}),children:[(0,B.jsx)(P,{className:`size-4`}),c.runTask]}):null,Mt?(0,B.jsxs)(g,{variant:`primary`,disabled:$,onClick:()=>void J({type:`close`,resolution:`done`}),children:[(0,B.jsx)(l,{className:`size-4`}),c.approveTask]}):null,Nt?(0,B.jsxs)(g,{variant:`primary`,disabled:$,onClick:()=>void J({type:`reopen`,phase:`ready`}),children:[(0,B.jsx)(P,{className:`size-4`}),c.reopenTask]}):null,!Ct&&jt?(0,B.jsxs)(g,{variant:`secondary`,className:`border-0 bg-surface-hover shadow-none`,disabled:$,onClick:()=>void J({type:`add_wait`,wait:{kind:`paused`,reason:`Paused by user`,condition:{}}}),children:[(0,B.jsx)(N,{className:`size-4`}),c.pauseTask]}):null,v.task.phase===`closed`?null:(0,B.jsxs)(_e,{children:[(0,B.jsx)(y,{asChild:!0,children:(0,B.jsx)(g,{type:`button`,variant:`ghost`,className:`size-9 p-0`,disabled:$,"aria-label":c.moreActions,children:(0,B.jsx)(F,{className:`size-4`,"aria-hidden":!0})})}),(0,B.jsx)(pe,{children:(0,B.jsx)(se,{align:`end`,sideOffset:6,className:`z-[100] min-w-40 rounded-lg border border-edge bg-surface-panel p-1 shadow-popover`,children:(0,B.jsx)(S,{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 J({type:`close`,resolution:`cancelled`}),children:c.cancelTask})})})]})]});return(0,B.jsxs)(`div`,{ref:$e,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`} ${Ze?`lg:cursor-col-resize lg:select-none`:``}`,style:{"--task-chat-panel-width":`${G}%`},children:[(0,B.jsxs)(`section`,{className:`task-detail-scroll min-w-0 flex-1 overflow-y-auto overscroll-contain p-5 sm:p-6`,children:[(0,B.jsxs)(`header`,{className:h(`px-4 pb-5`,Q(`title`)&&`task-detail-live-update`),children:[(0,B.jsx)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:(0,B.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:[H?(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,B.jsx)(be,{className:`size-3.5`,"aria-hidden":!0}),H]}):null,(0,B.jsx)(`span`,{children:`/`}),(0,B.jsx)(`span`,{children:c.taskLabel}),ct?(0,B.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent-fg`,role:`status`,children:ct.source===`agent`?i===`zh`?`Agent 刚刚更新`:`Updated by Agent`:i===`zh`?`执行结果已同步`:`Execution result synced`}):null]}),We?(0,B.jsx)(`input`,{autoFocus:!0,"data-task-inline-editor":!0,value:Ge,onChange:e=>Ke(e.target.value),onBlur:()=>void pt(),onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur(),e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),et.current=!0,Ke(v.task.title),U(!1),queueMicrotask(()=>{et.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,B.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:()=>{rt.current={value:v.task.title,version:v.task.version},K(null),Ke(v.task.title),U(!0)},children:(0,B.jsx)(`h1`,{className:`text-2xl font-semibold leading-8 text-fg`,children:v.task.title})}),st===`title`?(0,B.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-warning`,role:`alert`,children:[(0,B.jsx)(`span`,{children:i===`zh`?`Agent 在你编辑期间更新了标题。`:`The Agent updated the title while you were editing.`}),(0,B.jsx)(`button`,{type:`button`,className:`rounded-md bg-surface-hover px-2 py-1 text-fg`,onClick:()=>{Ke(v.task.title),K(null),U(!1)},children:i===`zh`?`使用 Agent 版本`:`Use Agent version`}),(0,B.jsx)(`button`,{type:`button`,className:`rounded-md bg-accent-soft px-2 py-1 text-accent-fg`,onClick:()=>void Y({title:Ge.trim()}).then(e=>{e&&(K(null),U(!1))}),children:i===`zh`?`保留我的修改`:`Keep my changes`})]}):null]})}),Se?(0,B.jsx)(`p`,{className:`mt-3 text-sm text-danger`,children:Se}):null]}),(0,B.jsxs)(`div`,{className:`mt-5 flex flex-col gap-5`,children:[(0,B.jsxs)(`main`,{className:`order-2 min-w-0 space-y-5`,children:[(0,B.jsxs)(`section`,{className:h(`rounded-xl bg-surface-panel p-4`,Q(`body`)&&`task-detail-live-update`),children:[(0,B.jsx)(`h2`,{className:`font-medium text-fg`,children:c.taskDescription}),qe?(0,B.jsx)(`textarea`,{autoFocus:!0,"data-task-inline-editor":!0,rows:6,value:Je,onChange:e=>Ye(e.target.value),onBlur:()=>void mt(),onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),tt.current=!0,Ye(v.task.body??v.task.contract?.objective??``),W(!1),queueMicrotask(()=>{tt.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,B.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=v.task.body??v.task.contract?.objective??``;nt.current=e,it.current={value:v.task.body??``,version:v.task.version},K(null),Ye(e),W(!0)},children:(0,B.jsx)(`span`,{className:`whitespace-pre-wrap text-sm leading-6 text-fg-muted`,children:Dt&&Dt!==v.task.title?Dt:c.noTaskDescription})}),st===`description`?(0,B.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-warning`,role:`alert`,children:[(0,B.jsx)(`span`,{children:i===`zh`?`Agent 在你编辑期间更新了描述。`:`The Agent updated the description while you were editing.`}),(0,B.jsx)(`button`,{type:`button`,className:`rounded-md bg-surface-hover px-2 py-1 text-fg`,onClick:()=>{Ye(v.task.body??``),K(null),W(!1)},children:i===`zh`?`使用 Agent 版本`:`Use Agent version`}),(0,B.jsx)(`button`,{type:`button`,className:`rounded-md bg-accent-soft px-2 py-1 text-accent-fg`,onClick:()=>void Y({body:Je.trim()||null}).then(e=>{e&&(K(null),W(!1))}),children:i===`zh`?`保留我的修改`:`Keep my changes`})]}):null]}),v.attention.length>0?(0,B.jsxs)(`section`,{className:h(`rounded-xl bg-warning/10 p-4`,Q(`attention`)&&`task-detail-live-update`),children:[(0,B.jsx)(`h3`,{className:`font-medium text-fg`,children:Lt?c.needsAttention:c.waitingStatus}),(0,B.jsx)(`ul`,{className:`mt-3 space-y-2 text-sm text-fg-muted`,children:v.attention.map((e,t)=>(0,B.jsx)(`li`,{children:e.summary},`${e.kind}-${t}`))})]}):null,(0,B.jsxs)(`section`,{className:h(`rounded-xl bg-surface-panel p-4`,Q(`contract`)&&`task-detail-live-update`),children:[(0,B.jsx)(`h2`,{className:`font-medium text-fg`,children:c.taskDefinition}),(0,B.jsxs)(`div`,{className:`mt-5`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,B.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:c.successDefinition}),Rt.length>0?(0,B.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:c.criteriaProgress.replace(`{{verified}}`,String(zt)).replace(`{{total}}`,String(Rt.length))}):null]}),(0,B.jsx)(`div`,{className:`mt-3`,children:(0,B.jsx)(V,{items:Rt,empty:c.noDefinition,verificationByCriterion:Ot})})]}),Bt.length>0?(0,B.jsxs)(`div`,{className:`mt-5 rounded-lg bg-surface-hover p-4`,children:[(0,B.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:c.expectedOutputs}),(0,B.jsx)(`div`,{className:`mt-3`,children:(0,B.jsx)(V,{items:Bt,empty:c.noDefinition})})]}):null,Vt.length>0?(0,B.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,B.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:c.constraints}),(0,B.jsx)(`div`,{className:`mt-3`,children:(0,B.jsx)(V,{items:Vt,empty:c.noDefinition})})]}):null,Ht.length>0?(0,B.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,B.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:c.approvalRequired}),(0,B.jsx)(`div`,{className:`mt-3`,children:(0,B.jsx)(V,{items:Ht,empty:c.noDefinition})})]}):null,Ut.length>0?(0,B.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,B.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:c.contextAssumptions}),(0,B.jsx)(`div`,{className:`mt-3`,children:(0,B.jsx)(V,{items:Ut,empty:c.noDefinition})})]}):null,Wt.length>0?(0,B.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,B.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:c.contextRisks}),(0,B.jsx)(`div`,{className:`mt-3`,children:(0,B.jsx)(V,{items:Wt,empty:c.noDefinition})})]}):null]}),X?(0,B.jsxs)(`section`,{className:h(`rounded-xl bg-surface-panel p-4`,Q(`runs`,`receipts`)&&`task-detail-live-update`),children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,B.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,B.jsx)(`h2`,{className:`font-medium text-fg`,children:c.latestResult}),(0,B.jsx)(f,{content:X.summary,compact:!0,className:`mt-2 text-sm leading-6 text-fg`,openHttpLinksInNewTab:!0})]}),(0,B.jsxs)(`span`,{className:`rounded-full bg-surface-hover px-2.5 py-1 text-xs text-fg-muted`,children:[c.receiptStatuses[X.status],` · `,c.verificationStatuses[X.verification.status]]})]}),X.remainingWork.length>0?(0,B.jsxs)(`div`,{className:`mt-4`,children:[(0,B.jsx)(`h3`,{className:`text-xs font-medium text-fg-muted`,children:c.remainingWork}),(0,B.jsx)(`div`,{className:`mt-2`,children:(0,B.jsx)(V,{items:X.remainingWork,empty:c.noRemainingWork})})]}):null,X.nextAction?(0,B.jsxs)(`div`,{className:`mt-4 rounded-lg bg-surface-hover p-3`,children:[(0,B.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:c.nextAction}),(0,B.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:X.nextAction})]}):null,(0,B.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2`,children:[(0,B.jsx)(g,{className:`border-0 bg-surface-hover px-2 py-1 text-xs shadow-none`,variant:`secondary`,onClick:()=>void de(X.runId,`helpful`),children:c.doneWell}),(0,B.jsx)(g,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>void de(X.runId,`not_helpful`),children:c.needsFix}),X.evidence.filter(e=>e.uri).map(e=>(0,B.jsxs)(`a`,{className:`ml-auto inline-flex items-center gap-1 text-xs text-accent hover:underline`,href:e.uri,children:[(0,B.jsx)(u,{className:`size-3`}),e.title]},`${e.title}-${e.uri}`))]}),v.receipts.length>1?(0,B.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,B.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted`,children:c.executionHistory.replace(`{{count}}`,String(v.receipts.length-1))}),(0,B.jsx)(`div`,{className:`mt-3 space-y-3`,children:v.receipts.slice(1).map(e=>(0,B.jsx)(`article`,{className:`rounded-lg bg-surface-active p-3`,children:(0,B.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,B.jsx)(`p`,{className:`text-sm text-fg`,children:e.summary}),(0,B.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:c.receiptStatuses[e.status]})]})},e.runId))})]}):null]}):null,v.context.length>0?(0,B.jsxs)(`section`,{className:h(`rounded-xl bg-surface-panel p-4`,Q(`context`)&&`task-detail-live-update`),children:[(0,B.jsx)(`h2`,{className:`font-medium text-fg`,children:c.contextUsed}),(0,B.jsx)(`ul`,{className:`mt-4 grid gap-2 sm:grid-cols-2`,children:v.context.map(e=>(0,B.jsxs)(`li`,{className:`min-w-0 rounded-lg bg-surface-hover p-2.5`,children:[(0,B.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,B.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,B.jsx)(`p`,{className:`mt-1 break-words text-sm text-fg`,children:e.title??e.targetId})]},e.id))})]}):null]}),(0,B.jsxs)(`aside`,{className:`order-1 min-w-0 space-y-4`,children:[(0,B.jsxs)(`section`,{className:h(`rounded-xl bg-surface-subtle p-4`,Q(`phase`,`resolution`,`priority`,`dueAt`,`delegateAgentId`)&&`task-detail-live-update`),children:[(0,B.jsx)(`h2`,{className:`font-medium text-fg`,children:c.taskProperties}),(0,B.jsxs)(`div`,{className:`mt-4 grid gap-4 sm:grid-cols-2`,children:[(0,B.jsx)(je,{value:v.task.phase,disabled:z.has(`phase`),canMove:Kt,canApprove:Mt,canReopen:Nt,language:i,label:c.taskPhase,onChange:ht}),(0,B.jsx)(Me,{value:v.task.priority,disabled:z.has(`priority`),label:c.priority,labels:c.priorityLabels,onChange:gt}),(0,B.jsx)(Ne,{value:De(v.task.dueAt),disabled:z.has(`dueAt`),label:c.dueDate,onChange:_t}),(0,B.jsx)(Pe,{value:v.conversation.currentExecutorAgentId??``,disabled:z.has(`delegateAgentId`),label:c.executorLabel,unassignedLabel:c.unassigned,agents:He,onChange:St}),H?(0,B.jsxs)(`div`,{className:`grid gap-1 text-xs text-fg-muted`,children:[(0,B.jsx)(`span`,{children:c.projectLabel}),(0,B.jsxs)(`span`,{className:`flex items-center gap-1.5 rounded-lg bg-surface-hover px-3 py-2 text-sm text-fg`,children:[(0,B.jsx)(be,{className:`size-3.5`}),H]})]}):null]}),(0,B.jsxs)(`div`,{className:`mt-4 rounded-lg bg-surface-hover p-3 text-xs leading-5 text-fg-subtle`,children:[(0,B.jsx)(`p`,{children:Tt}),(0,B.jsx)(`p`,{children:Et}),(0,B.jsx)(`p`,{className:`mt-2`,children:c.updatedAt.replace(`{{date}}`,xe(v.task.updatedAt,i))})]})]}),(0,B.jsxs)(`section`,{className:h(`rounded-xl bg-surface-panel p-4`,Q(`dependencies`)&&`task-detail-live-update`),children:[(0,B.jsx)(`h2`,{className:`font-medium text-fg`,children:c.taskRelations}),(0,B.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:c.dependencies}),(0,B.jsx)(Fe,{candidates:ke,selected:v.dependencies,disabled:z.has(`dependencies`),labels:ut,onChange:xt})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:c.dependents}),v.dependents.length>0?(0,B.jsx)(`div`,{className:`space-y-1.5`,children:v.dependents.map(e=>(0,B.jsx)(o,{to:Gt(e.id),className:`block rounded-lg bg-surface-hover p-2.5 text-sm text-accent hover:underline`,children:e.title},e.id))}):(0,B.jsx)(`p`,{className:`text-sm text-fg-subtle`,children:c.noDependents})]})]})]})]})]})]}),(0,B.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(G),tabIndex:0,onPointerDown:bt,onKeyDown:yt,onDoubleClick:()=>vt(Le),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 ${Ze?`bg-surface-hover`:``}`,children:(0,B.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,B.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,B.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-3 bg-surface-subtle px-4 py-3.5`,children:[(0,B.jsx)(`div`,{className:`min-w-0`,children:(0,B.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[Pt?(0,B.jsx)(j,{agentId:Pt,avatar:Ft?.avatar,size:28,className:`shrink-0`}):null,(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:i===`zh`?`Agent 执行与对话`:`Agent execution and chat`}),(0,B.jsxs)(`p`,{className:`mt-0.5 truncate text-xs text-fg-muted`,children:[Ft?.name??Pt??c.unassigned,` · `,Tt]})]})]})}),(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[qt,Z&&t!==`modal`?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(g,{type:`button`,variant:`ghost`,className:h(`h-8 shrink-0 px-2 text-xs`,It&&`bg-surface-hover text-fg`),"aria-label":i===`zh`?`项目文件`:`Project files`,"aria-pressed":It,onClick:()=>{ae(Z,!1),ie(Z)},children:[(0,B.jsx)(oe,{className:`size-3.5`,"aria-hidden":!0}),i===`zh`?`文件`:`Files`]}),(0,B.jsx)(g,{asChild:!0,variant:`ghost`,className:`h-8 shrink-0 px-2 text-xs`,children:(0,B.jsxs)(o,{to:le(e),children:[(0,B.jsx)(u,{className:`size-3.5`}),i===`zh`?`全屏`:`Full screen`]})})]}):null]})]}),Z?(0,B.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,B.jsx)(A,{embedded:!0,sessionKey:Z,taskId:e})}):E?(0,B.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,B.jsxs)(`div`,{className:`max-w-xs`,children:[(0,B.jsx)(ye,{className:`mx-auto size-8 animate-pulse text-fg-subtle`}),(0,B.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:i===`zh`?`正在创建任务会话`:`Creating task conversation`})]})}):I?(0,B.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,B.jsxs)(`div`,{className:`max-w-xs`,children:[(0,B.jsx)(ye,{className:`mx-auto size-8 text-danger`}),(0,B.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:i===`zh`?`任务会话创建失败`:`Could not create task conversation`}),(0,B.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:I instanceof Error?I.message:String(I)})]})}):(0,B.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,B.jsxs)(`div`,{className:`max-w-xs`,children:[(0,B.jsx)(ye,{className:`mx-auto size-8 text-fg-subtle`}),(0,B.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:i===`zh`?`等待任务会话`:`Waiting for a task conversation`}),(0,B.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 Ve(){let e=(0,z.c)(2),{taskId:t}=i(),n=t===void 0?``:t,r;return e[0]===n?r=e[1]:(r=(0,B.jsx)(H,{taskId:n,presentation:`page`}),e[0]=n,e[1]=r),r}function He(e){let t=(0,z.c)(54),{taskId:n,backgroundPath:r,onClose:i}=e,a=ee(G),{data:s}=ge(n),c=s?.conversation.activeSessionKey??null,l=C(Ye),d=C(Je),f=C(W),p=C(qe),g=ve(Ke),_=me(Ge),y=me(U),se=l?d:0,b;t[0]!==i||t[1]!==y?(b=e=>{e||(y(null),i())},t[0]=i,t[1]=y,t[2]=b):b=t[2];let ce=a===`zh`?`关闭任务详情`:`Close task details`,x;t[3]!==i||t[4]!==y?(x=()=>{y(null),i()},t[3]=i,t[4]=y,t[5]=x):x=t[5];let S;t[6]!==ce||t[7]!==x?(S=(0,B.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":ce,onClick:x}),t[6]=ce,t[7]=x,t[8]=S):S=t[8];let ue=l?`true`:`false`,de=`${se/2}px`,fe=`${se}px`,pe;t[9]!==de||t[10]!==fe?(pe={"--task-detail-workspace-offset":de,"--task-detail-workspace-width":fe},t[9]=de,t[10]=fe,t[11]=pe):pe=t[11];let he=pe,_e=a===`zh`?`任务详情`:`Task details`,T;t[12]===_e?T=t[13]:(T=(0,B.jsx)(ae,{className:`font-medium text-fg`,children:_e}),t[12]=_e,t[13]=T);let E=a===`zh`?`查看并操作任务详情`:`View and manage task details`,D;t[14]===E?D=t[15]:(D=(0,B.jsx)(te,{className:`sr-only`,children:E}),t[14]=E,t[15]=D);let O;t[16]!==c||t[17]!==a||t[18]!==p||t[19]!==g||t[20]!==n||t[21]!==l||t[22]!==f?(O=c?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`button`,{type:`button`,className:h(`flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,l&&f===c&&`bg-surface-hover text-fg`),"aria-label":a===`zh`?`项目文件`:`Project files`,title:a===`zh`?`项目文件`:`Project files`,"aria-pressed":l&&f===c,onClick:()=>{g(c,!1),p(c)},children:(0,B.jsx)(oe,{className:`size-4`,"aria-hidden":!0})}),(0,B.jsx)(o,{to:le(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,B.jsx)(u,{className:`size-4`,"aria-hidden":!0})})]}):null,t[16]=c,t[17]=a,t[18]=p,t[19]=g,t[20]=n,t[21]=l,t[22]=f,t[23]=O):O=t[23];let ye=a===`zh`?`关闭任务详情`:`Close task details`,be;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(be=(0,B.jsx)(m,{className:`size-4`,"aria-hidden":!0}),t[24]=be):be=t[24];let k;t[25]===ye?k=t[26]:(k=(0,B.jsx)(ne,{className:`flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":ye,children:be}),t[25]=ye,t[26]=k);let A;t[27]!==O||t[28]!==k?(A=(0,B.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[O,k]}),t[27]=O,t[28]=k,t[29]=A):A=t[29];let j;t[30]!==T||t[31]!==D||t[32]!==A?(j=(0,B.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-3 bg-surface-panel px-5 py-3.5`,children:[T,D,A]}),t[30]=T,t[31]=D,t[32]=A,t[33]=j):j=t[33];let M;t[34]!==r||t[35]!==n?(M=(0,B.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,B.jsx)(H,{taskId:n,presentation:`modal`,backgroundPath:r})}),t[34]=r,t[35]=n,t[36]=M):M=t[36];let N;t[37]!==j||t[38]!==M||t[39]!==ue||t[40]!==he?(N=(0,B.jsxs)(ie,{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":ue,style:he,onEscapeKeyDown:We,onInteractOutside:Ue,children:[j,M]}),t[37]=j,t[38]=M,t[39]=ue,t[40]=he,t[41]=N):N=t[41];let P;t[42]!==_||t[43]!==l||t[44]!==d||t[45]!==f?(P=_?(0,B.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:l?d:0},children:(0,B.jsx)(w,{allowOutsideChat:!0,sessionKey:f??void 0})}):null,t[42]=_,t[43]=l,t[44]=d,t[45]=f,t[46]=P):P=t[46];let F;t[47]!==N||t[48]!==P||t[49]!==S?(F=(0,B.jsxs)(re,{children:[S,N,P]}),t[47]=N,t[48]=P,t[49]=S,t[50]=F):F=t[50];let I;return t[51]!==b||t[52]!==F?(I=(0,B.jsx)(v,{modal:!1,open:!0,onOpenChange:b,children:F}),t[51]=b,t[52]=F,t[53]=I):I=t[53],I}function Ue(e){let t=e.detail.originalEvent.target;t instanceof Element&&t.closest(`#app-workspace-panel, [data-task-modal-backdrop]`)&&e.preventDefault()}function We(e){let t=e.target;t instanceof HTMLElement&&t.closest(`[data-task-inline-editor]`)&&e.preventDefault()}function U(e){return e.setPath}function Ge(e){return e.path}function Ke(e){return e.setOpen}function qe(e){return e.openForSession}function W(e){return e.sessionKeyOverride}function Je(e){return e.widthPx}function Ye(e){return e.open}function G(e){return e.language}function Xe(e){return(0,B.jsx)(c,{value:e.id,children:e.name||e.id},e.id)}function Ze(e){return e.id}export{He as TaskDetailModal,Ve 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"./circle-check-C23XjkUj.js";import{t as u}from"./external-link-DjqjBmc3.js";import{f as d,t as f,u as p}from"./markdown-view-D0fiJjBQ.js";import{t as m}from"./x-B_N4OPjy.js";import{t as h}from"./cn-JdwAhgNB.js";import{t as g}from"./button-CSEbl4zT.js";import{l as _,n as ee}from"./locale-store-gf9Bg2gb.js";import{i as te,n as ne,o as re,r as ie,s as ae,t as v}from"./dist-BPoKqzeH.js";import{$c as oe,Br as y,Fr as se,H as b,Ha as ce,I as x,In as le,Ir as S,J as ue,K as de,Ln as fe,Lr as pe,Ni as me,Oa as he,P as ge,Pi as C,Rn as w,Rr as _e,Tl as T,Ua as E,Vr as ve,X as D,Z as O,_c as ye,el as be,eu as k,n as A,nt as j,ro as M,sc as N,tc as P,ul as F,wl as I,yi as xe}from"./index-DlOYwVFK.js";import{t as Se}from"./date-picker-k7mkklMU.js";import{t as L}from"./dependency-picker-DZVSgLXH.js";var R=e(t(),1),z=n();function Ce(e,t,n,r){return!!(e&&t!==e.version&&n!==e.value&&r!==n)}function we(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 B=r();function Te(e,t){return(t===`zh`?{backlog:`待规划`,ready:`就绪`,active:`进行中`,review:`待验收`,closed:`已完成`}:{backlog:`Backlog`,ready:`Ready`,active:`Active`,review:`Review`,closed:`Completed`})[e]}function Ee(){let e=(0,z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,B.jsxs)(`div`,{className:`space-y-4`,"aria-busy":!0,children:[(0,B.jsx)(E,{className:`h-32 rounded-2xl`}),(0,B.jsx)(E,{className:`h-52 rounded-2xl`}),(0,B.jsx)(E,{className:`h-40 rounded-2xl`})]}),e[0]=t):t=e[0],t}function De(e){if(e===void 0)return``;let t=new Date(e);return new Date(t.getTime()-t.getTimezoneOffset()*6e4).toISOString().slice(0,10)}function Oe(e){return e?new Date(`${e}T23:59:59.999`).getTime():null}var ke=[`backlog`,`ready`,`active`,`review`,`closed`],Ae=[`low`,`normal`,`high`,`critical`],je=(0,R.memo)(function(e){let t=(0,z.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,B.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=ke.map(e=>(0,B.jsx)(c,{value:e,disabled:p(e),children:Te(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,B.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 ee;return t[17]!==m||t[18]!==_?(ee=(0,B.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[m,_]}),t[17]=m,t[18]=_,t[19]=ee):ee=t[19],ee}),Me=(0,R.memo)(function(e){let t=(0,z.c)(14),{value:n,disabled:r,label:i,labels:a,onChange:o}=e,l;t[0]===i?l=t[1]:(l=(0,B.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=Ae.map(e=>(0,B.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,B.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,B.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}),Ne=(0,R.memo)(function(e){let t=(0,z.c)(10),{value:n,disabled:r,label:i,onChange:a}=e,o;t[0]===i?o=t[1]:(o=(0,B.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,B.jsx)(Se,{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,B.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}),Pe=(0,R.memo)(function(e){let t=(0,z.c)(17),{value:n,disabled:r,label:i,unassignedLabel:a,agents:o,onChange:l}=e,u;t[0]===i?u=t[1]:(u=(0,B.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,B.jsx)(c,{value:``,disabled:!0,children:a}),t[4]=a,t[5]=f);let p;t[6]===o?p=t[7]:(p=o.map(Xe),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,B.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,B.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}),Fe=(0,R.memo)(function(e){let t=(0,z.c)(8),{candidates:n,selected:r,disabled:i,labels:a,onChange:o}=e,s;t[0]===r?s=t[1]:(s=r.map(Ze),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,B.jsx)(L,{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)),Ie=`xopc.taskDetail.chatPanelPercent`,Le=42;function Re(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?Le:Math.min(r,Math.max(n,e))}function ze(){try{let e=Number(window.localStorage.getItem(Ie));return Number.isFinite(e)&&e>=30&&e<=60?e:Le}catch{return Le}}function Be(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 V(e){let t=(0,z.c)(9),{items:n,empty:r,verificationByCriterion:i}=e;if(n.length===0){let e;return t[0]===r?e=t[1]:(e=(0,B.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,B.jsxs)(`li`,{className:`flex gap-2 text-sm leading-6 text-fg`,children:[(0,B.jsx)(t===`passed`?l:t===`failed`?T:I,{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,B.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,B.jsx)(`ul`,{className:`space-y-2`,children:a}),t[7]=a,t[8]=o),o}function H({taskId:e,presentation:t,backgroundPath:n}){let[r]=a(),i=ee(e=>e.language),s=_(e=>e.token),c=(0,R.useMemo)(()=>O(i),[i]),m=M(e=>e.setPageHeader),te=M(e=>e.clearPageHeader),ne=C(e=>e.open),re=C(e=>e.sessionKeyOverride),ie=C(e=>e.openForSession),ae=ve(e=>e.setOpen),{data:v,error:me,mutate:w,lastChange:T,conversationLoading:E,conversationError:I}=ge(e),[Se,L]=(0,R.useState)(null),[z,Te]=(0,R.useState)(()=>new Set),[ke,Ae]=(0,R.useState)([]),[H,Ve]=(0,R.useState)(null),[He,Ue]=(0,R.useState)([]),[We,U]=(0,R.useState)(!1),[Ge,Ke]=(0,R.useState)(``),[qe,W]=(0,R.useState)(!1),[Je,Ye]=(0,R.useState)(``),[G,Xe]=(0,R.useState)(ze),[Ze,Qe]=(0,R.useState)(!1),$e=(0,R.useRef)(null),et=(0,R.useRef)(!1),tt=(0,R.useRef)(!1),nt=(0,R.useRef)(``),rt=(0,R.useRef)(null),it=(0,R.useRef)(null),at=(0,R.useRef)(null),ot=(0,R.useRef)(v),[st,K]=(0,R.useState)(null),[ct,lt]=(0,R.useState)(null),ut=(0,R.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]),dt=v?.dependencies.map(e=>`${e.id}:${e.title}`).join(`\0`)??``,ft=(0,R.useMemo)(()=>p(r.get(`returnTo`),`/`,[`/projects`,`/chat`,`/notes`,`/tasks`]),[r]);ot.current=v;let q=(0,R.useCallback)((e,t)=>{Te(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r})},[]);(0,R.useEffect)(()=>{L(null),K(null),U(!1),W(!1),lt(null)},[e]),(0,R.useEffect)(()=>{let e=!0;return ce().then(t=>{e&&Ue(t.items)}).catch(()=>void 0),()=>{e=!1}},[s]),(0,R.useEffect)(()=>{if(!T||T.source===`user`)return;lt(T);let e=window.setTimeout(()=>lt(null),3500);return()=>window.clearTimeout(e)},[T]),(0,R.useEffect)(()=>{let t=v?.task.projectId,n=v?.dependencies??[];if(!t){at.current=null,Ve(null),Ae(n);return}at.current!==t&&(at.current=t,Ve(null));let r=!0;return he(t).then(t=>{if(!r)return;Ve(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});Ae([...i.values()])}).catch(()=>{r&&Ae(n)}),()=>{r=!1}},[dt,v?.task.projectId,e]);let J=(0,R.useCallback)(async(t,n=`command`)=>{let r=ot.current;if(r){q(n,!0),L(null);try{await w(await x(e,t,r.task.version),{revalidate:!1})}catch{L(c.actionFailed)}finally{q(n,!1)}}},[c.actionFailed,w,q,e]),Y=(0,R.useCallback)(async(t,n)=>{let r=ot.current;if(!r)return!1;n&&q(n,!0),L(null);try{return await w(ue(e,t,r.task.version),{optimisticData:we(r,t),populateCache:!0,revalidate:!1,rollbackOnError:!0}),!0}catch{return L(c.actionFailed),!1}finally{n&&q(n,!1)}},[c.actionFailed,w,q,e]),pt=async()=>{if(!v)return;if(et.current){et.current=!1;return}let e=Ge.trim(),t=rt.current;if(Ce(t,v.task.version,v.task.title,e)){K(`title`);return}if(!e||e===v.task.title){Ke(v.task.title),U(!1);return}await Y({title:e})&&(K(null),U(!1))},mt=async()=>{if(!v)return;if(tt.current){tt.current=!1;return}let e=Je.trim(),t=it.current;if(Ce(t,v.task.version,v.task.body??``,e)){K(`description`);return}if(Je===nt.current||e===(v.task.body??``).trim()){W(!1);return}await Y({body:e||null})&&(K(null),W(!1))},ht=(0,R.useCallback)(async e=>{let t=ot.current;if(!(!t||e===t.task.phase)){if(t.task.phase===`closed`){await J({type:`reopen`,phase:e===`closed`?`ready`:e},`phase`);return}if(e===`closed`){await J({type:`close`,resolution:`done`},`phase`);return}await J({type:`move`,phase:e},`phase`)}},[J]),gt=(0,R.useCallback)(e=>{Y({priority:e},`priority`)},[Y]),_t=(0,R.useCallback)(e=>{Y({dueAt:Oe(e)},`dueAt`)},[Y]),vt=(0,R.useCallback)(e=>{Xe(e);try{window.localStorage.setItem(Ie,String(e))}catch{}},[]),yt=(0,R.useCallback)(e=>{if(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`&&e.key!==`Home`)return;e.preventDefault();let t=$e.current?.clientWidth??0;vt(Re(e.key===`Home`?Le:G+(e.key===`ArrowLeft`?2:-2),t))},[G,vt]),bt=(0,R.useCallback)(e=>{if(!window.matchMedia(`(min-width: 1024px)`).matches)return;let t=$e.current;if(!t)return;e.preventDefault();let n=e.currentTarget,r=e.pointerId;n.setPointerCapture(r),Qe(!0);let i=G,a=0,o=()=>{a=0,t.style.setProperty(`--task-chat-panel-width`,`${i}%`)},s=e=>{let n=t.getBoundingClientRect();i=Re((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{}Qe(!1),vt(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)},[G,vt]),xt=(0,R.useCallback)(async t=>{let n=ot.current;if(n){q(`dependencies`,!0),L(null);try{await w(await D(e,t,n.task.version),{revalidate:!1})}catch{L(c.dependencyUpdateFailed)}finally{q(`dependencies`,!1)}}},[c.dependencyUpdateFailed,w,q,e]),St=(0,R.useCallback)(async t=>{let n=ot.current;if(!(!n||!t||t===n.conversation.currentExecutorAgentId)){q(`delegateAgentId`,!0),L(null);try{await w(await b(e,t,n.task.version),{revalidate:!1})}catch{L(c.actionFailed)}finally{q(`delegateAgentId`,!1)}}},[c.actionFailed,w,q,e]);if((0,R.useLayoutEffect)(()=>{if(t!==`modal`)return m({startExtra:(0,B.jsx)(o,{to:ft,className:`flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover`,"aria-label":c.backToWork,children:(0,B.jsx)(k,{className:`size-4`})}),main:v?(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsx)(`p`,{className:`truncate text-sm font-semibold text-fg`,children:H?`${H} / ${c.taskLabel}`:c.taskLabel}),(0,B.jsx)(`p`,{className:`text-xs text-fg-muted`,children:c.detailStatuses[Be(v)]})]}):null,end:null}),te},[te,c.backToWork,c.detailStatuses,c.taskLabel,v,t,H,ft,m]),me&&!v)return(0,B.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(!v)return(0,B.jsx)(`div`,{className:t===`modal`?`p-5`:`mx-auto max-w-4xl p-4 sm:p-6`,children:(0,B.jsx)(Ee,{})});let Ct=v.waits[0],wt=Ct?.kind===`paused`?Ct:void 0,X=v.receipts[0],Tt=c.detailStatuses[Be(v)],Et=c.detailStatusDescriptions[Be(v)],Dt=v.task.body?.trim()||v.task.contract?.objective.trim(),Ot=new Map(X?.verification.checks.map(e=>[e.criterion,e.status])),kt=v.allowedCommands.includes(`mark_ready`),At=v.allowedCommands.includes(`start`),jt=v.allowedCommands.includes(`add_wait`),Mt=v.task.phase===`review`&&v.allowedCommands.includes(`close`),Nt=v.allowedCommands.includes(`reopen`),Z=v.conversation.activeSessionKey,Pt=v.conversation.currentExecutorAgentId??v.task.delegateAgentId??v.task.ownerId,Ft=He.find(e=>e.id===Pt),It=!!(Z&&ne&&re===Z),Lt=v.attention.some(e=>e.kind===`input_required`||e.kind===`approval_required`),Rt=v.task.contract?.acceptanceCriteria??[],zt=Rt.filter(e=>Ot.get(e)===`passed`).length,Bt=v.task.contract?.expectedOutputs??[],Vt=v.task.contract?.constraints??[],Ht=v.task.contract?.approvalRequired??[],Ut=v.task.contract?.assumptions??[],Wt=v.task.contract?.risks??[],Q=(...e)=>!!ct?.changedFields.some(t=>e.includes(t)),Gt=e=>t===`modal`&&n?fe(n,e):d(`/tasks/${e}`,ft),Kt=v.allowedCommands.includes(`move`),$=z.has(`command`),qt=(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[kt?(0,B.jsxs)(g,{variant:`primary`,disabled:$,onClick:()=>void J({type:`mark_ready`}),children:[(0,B.jsx)(P,{className:`size-4`}),c.scheduleTask]}):null,wt?(0,B.jsxs)(g,{variant:`primary`,disabled:$,onClick:()=>void J({type:`resolve_wait`,waitId:wt.id}),children:[(0,B.jsx)(P,{className:`size-4`}),c.resumeTask]}):null,!Ct&&At&&Pt?(0,B.jsxs)(g,{variant:`primary`,disabled:$,onClick:()=>void J({type:`start`,executor:{kind:`agent`,agentId:Pt}}),children:[(0,B.jsx)(P,{className:`size-4`}),c.runTask]}):null,Mt?(0,B.jsxs)(g,{variant:`primary`,disabled:$,onClick:()=>void J({type:`close`,resolution:`done`}),children:[(0,B.jsx)(l,{className:`size-4`}),c.approveTask]}):null,Nt?(0,B.jsxs)(g,{variant:`primary`,disabled:$,onClick:()=>void J({type:`reopen`,phase:`ready`}),children:[(0,B.jsx)(P,{className:`size-4`}),c.reopenTask]}):null,!Ct&&jt?(0,B.jsxs)(g,{variant:`secondary`,className:`border-0 bg-surface-hover shadow-none`,disabled:$,onClick:()=>void J({type:`add_wait`,wait:{kind:`paused`,reason:`Paused by user`,condition:{}}}),children:[(0,B.jsx)(N,{className:`size-4`}),c.pauseTask]}):null,v.task.phase===`closed`?null:(0,B.jsxs)(_e,{children:[(0,B.jsx)(y,{asChild:!0,children:(0,B.jsx)(g,{type:`button`,variant:`ghost`,className:`size-9 p-0`,disabled:$,"aria-label":c.moreActions,children:(0,B.jsx)(F,{className:`size-4`,"aria-hidden":!0})})}),(0,B.jsx)(pe,{children:(0,B.jsx)(se,{align:`end`,sideOffset:6,className:`z-[100] min-w-40 rounded-lg border border-edge bg-surface-panel p-1 shadow-popover`,children:(0,B.jsx)(S,{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 J({type:`close`,resolution:`cancelled`}),children:c.cancelTask})})})]})]});return(0,B.jsxs)(`div`,{ref:$e,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`} ${Ze?`lg:cursor-col-resize lg:select-none`:``}`,style:{"--task-chat-panel-width":`${G}%`},children:[(0,B.jsxs)(`section`,{className:`task-detail-scroll min-w-0 flex-1 overflow-y-auto overscroll-contain p-5 sm:p-6`,children:[(0,B.jsxs)(`header`,{className:h(`px-4 pb-5`,Q(`title`)&&`task-detail-live-update`),children:[(0,B.jsx)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:(0,B.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:[H?(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,B.jsx)(be,{className:`size-3.5`,"aria-hidden":!0}),H]}):null,(0,B.jsx)(`span`,{children:`/`}),(0,B.jsx)(`span`,{children:c.taskLabel}),ct?(0,B.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent-fg`,role:`status`,children:ct.source===`agent`?i===`zh`?`Agent 刚刚更新`:`Updated by Agent`:i===`zh`?`执行结果已同步`:`Execution result synced`}):null]}),We?(0,B.jsx)(`input`,{autoFocus:!0,"data-task-inline-editor":!0,value:Ge,onChange:e=>Ke(e.target.value),onBlur:()=>void pt(),onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur(),e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),et.current=!0,Ke(v.task.title),U(!1),queueMicrotask(()=>{et.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,B.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:()=>{rt.current={value:v.task.title,version:v.task.version},K(null),Ke(v.task.title),U(!0)},children:(0,B.jsx)(`h1`,{className:`text-2xl font-semibold leading-8 text-fg`,children:v.task.title})}),st===`title`?(0,B.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-warning`,role:`alert`,children:[(0,B.jsx)(`span`,{children:i===`zh`?`Agent 在你编辑期间更新了标题。`:`The Agent updated the title while you were editing.`}),(0,B.jsx)(`button`,{type:`button`,className:`rounded-md bg-surface-hover px-2 py-1 text-fg`,onClick:()=>{Ke(v.task.title),K(null),U(!1)},children:i===`zh`?`使用 Agent 版本`:`Use Agent version`}),(0,B.jsx)(`button`,{type:`button`,className:`rounded-md bg-accent-soft px-2 py-1 text-accent-fg`,onClick:()=>void Y({title:Ge.trim()}).then(e=>{e&&(K(null),U(!1))}),children:i===`zh`?`保留我的修改`:`Keep my changes`})]}):null]})}),Se?(0,B.jsx)(`p`,{className:`mt-3 text-sm text-danger`,children:Se}):null]}),(0,B.jsxs)(`div`,{className:`mt-5 flex flex-col gap-5`,children:[(0,B.jsxs)(`main`,{className:`order-2 min-w-0 space-y-5`,children:[(0,B.jsxs)(`section`,{className:h(`rounded-xl bg-surface-panel p-4`,Q(`body`)&&`task-detail-live-update`),children:[(0,B.jsx)(`h2`,{className:`font-medium text-fg`,children:c.taskDescription}),qe?(0,B.jsx)(`textarea`,{autoFocus:!0,"data-task-inline-editor":!0,rows:6,value:Je,onChange:e=>Ye(e.target.value),onBlur:()=>void mt(),onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),tt.current=!0,Ye(v.task.body??v.task.contract?.objective??``),W(!1),queueMicrotask(()=>{tt.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,B.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=v.task.body??v.task.contract?.objective??``;nt.current=e,it.current={value:v.task.body??``,version:v.task.version},K(null),Ye(e),W(!0)},children:(0,B.jsx)(`span`,{className:`whitespace-pre-wrap text-sm leading-6 text-fg-muted`,children:Dt&&Dt!==v.task.title?Dt:c.noTaskDescription})}),st===`description`?(0,B.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-warning`,role:`alert`,children:[(0,B.jsx)(`span`,{children:i===`zh`?`Agent 在你编辑期间更新了描述。`:`The Agent updated the description while you were editing.`}),(0,B.jsx)(`button`,{type:`button`,className:`rounded-md bg-surface-hover px-2 py-1 text-fg`,onClick:()=>{Ye(v.task.body??``),K(null),W(!1)},children:i===`zh`?`使用 Agent 版本`:`Use Agent version`}),(0,B.jsx)(`button`,{type:`button`,className:`rounded-md bg-accent-soft px-2 py-1 text-accent-fg`,onClick:()=>void Y({body:Je.trim()||null}).then(e=>{e&&(K(null),W(!1))}),children:i===`zh`?`保留我的修改`:`Keep my changes`})]}):null]}),v.attention.length>0?(0,B.jsxs)(`section`,{className:h(`rounded-xl bg-warning/10 p-4`,Q(`attention`)&&`task-detail-live-update`),children:[(0,B.jsx)(`h3`,{className:`font-medium text-fg`,children:Lt?c.needsAttention:c.waitingStatus}),(0,B.jsx)(`ul`,{className:`mt-3 space-y-2 text-sm text-fg-muted`,children:v.attention.map((e,t)=>(0,B.jsx)(`li`,{children:e.summary},`${e.kind}-${t}`))})]}):null,(0,B.jsxs)(`section`,{className:h(`rounded-xl bg-surface-panel p-4`,Q(`contract`)&&`task-detail-live-update`),children:[(0,B.jsx)(`h2`,{className:`font-medium text-fg`,children:c.taskDefinition}),(0,B.jsxs)(`div`,{className:`mt-5`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,B.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:c.successDefinition}),Rt.length>0?(0,B.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:c.criteriaProgress.replace(`{{verified}}`,String(zt)).replace(`{{total}}`,String(Rt.length))}):null]}),(0,B.jsx)(`div`,{className:`mt-3`,children:(0,B.jsx)(V,{items:Rt,empty:c.noDefinition,verificationByCriterion:Ot})})]}),Bt.length>0?(0,B.jsxs)(`div`,{className:`mt-5 rounded-lg bg-surface-hover p-4`,children:[(0,B.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:c.expectedOutputs}),(0,B.jsx)(`div`,{className:`mt-3`,children:(0,B.jsx)(V,{items:Bt,empty:c.noDefinition})})]}):null,Vt.length>0?(0,B.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,B.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:c.constraints}),(0,B.jsx)(`div`,{className:`mt-3`,children:(0,B.jsx)(V,{items:Vt,empty:c.noDefinition})})]}):null,Ht.length>0?(0,B.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,B.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:c.approvalRequired}),(0,B.jsx)(`div`,{className:`mt-3`,children:(0,B.jsx)(V,{items:Ht,empty:c.noDefinition})})]}):null,Ut.length>0?(0,B.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,B.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:c.contextAssumptions}),(0,B.jsx)(`div`,{className:`mt-3`,children:(0,B.jsx)(V,{items:Ut,empty:c.noDefinition})})]}):null,Wt.length>0?(0,B.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,B.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:c.contextRisks}),(0,B.jsx)(`div`,{className:`mt-3`,children:(0,B.jsx)(V,{items:Wt,empty:c.noDefinition})})]}):null]}),X?(0,B.jsxs)(`section`,{className:h(`rounded-xl bg-surface-panel p-4`,Q(`runs`,`receipts`)&&`task-detail-live-update`),children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,B.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,B.jsx)(`h2`,{className:`font-medium text-fg`,children:c.latestResult}),(0,B.jsx)(f,{content:X.summary,compact:!0,className:`mt-2 text-sm leading-6 text-fg`,openHttpLinksInNewTab:!0})]}),(0,B.jsxs)(`span`,{className:`rounded-full bg-surface-hover px-2.5 py-1 text-xs text-fg-muted`,children:[c.receiptStatuses[X.status],` · `,c.verificationStatuses[X.verification.status]]})]}),X.remainingWork.length>0?(0,B.jsxs)(`div`,{className:`mt-4`,children:[(0,B.jsx)(`h3`,{className:`text-xs font-medium text-fg-muted`,children:c.remainingWork}),(0,B.jsx)(`div`,{className:`mt-2`,children:(0,B.jsx)(V,{items:X.remainingWork,empty:c.noRemainingWork})})]}):null,X.nextAction?(0,B.jsxs)(`div`,{className:`mt-4 rounded-lg bg-surface-hover p-3`,children:[(0,B.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:c.nextAction}),(0,B.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:X.nextAction})]}):null,(0,B.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2`,children:[(0,B.jsx)(g,{className:`border-0 bg-surface-hover px-2 py-1 text-xs shadow-none`,variant:`secondary`,onClick:()=>void de(X.runId,`helpful`),children:c.doneWell}),(0,B.jsx)(g,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>void de(X.runId,`not_helpful`),children:c.needsFix}),X.evidence.filter(e=>e.uri).map(e=>(0,B.jsxs)(`a`,{className:`ml-auto inline-flex items-center gap-1 text-xs text-accent hover:underline`,href:e.uri,children:[(0,B.jsx)(u,{className:`size-3`}),e.title]},`${e.title}-${e.uri}`))]}),v.receipts.length>1?(0,B.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,B.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted`,children:c.executionHistory.replace(`{{count}}`,String(v.receipts.length-1))}),(0,B.jsx)(`div`,{className:`mt-3 space-y-3`,children:v.receipts.slice(1).map(e=>(0,B.jsx)(`article`,{className:`rounded-lg bg-surface-active p-3`,children:(0,B.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,B.jsx)(`p`,{className:`text-sm text-fg`,children:e.summary}),(0,B.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:c.receiptStatuses[e.status]})]})},e.runId))})]}):null]}):null,v.context.length>0?(0,B.jsxs)(`section`,{className:h(`rounded-xl bg-surface-panel p-4`,Q(`context`)&&`task-detail-live-update`),children:[(0,B.jsx)(`h2`,{className:`font-medium text-fg`,children:c.contextUsed}),(0,B.jsx)(`ul`,{className:`mt-4 grid gap-2 sm:grid-cols-2`,children:v.context.map(e=>(0,B.jsxs)(`li`,{className:`min-w-0 rounded-lg bg-surface-hover p-2.5`,children:[(0,B.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,B.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,B.jsx)(`p`,{className:`mt-1 break-words text-sm text-fg`,children:e.title??e.targetId})]},e.id))})]}):null]}),(0,B.jsxs)(`aside`,{className:`order-1 min-w-0 space-y-4`,children:[(0,B.jsxs)(`section`,{className:h(`rounded-xl bg-surface-subtle p-4`,Q(`phase`,`resolution`,`priority`,`dueAt`,`delegateAgentId`)&&`task-detail-live-update`),children:[(0,B.jsx)(`h2`,{className:`font-medium text-fg`,children:c.taskProperties}),(0,B.jsxs)(`div`,{className:`mt-4 grid gap-4 sm:grid-cols-2`,children:[(0,B.jsx)(je,{value:v.task.phase,disabled:z.has(`phase`),canMove:Kt,canApprove:Mt,canReopen:Nt,language:i,label:c.taskPhase,onChange:ht}),(0,B.jsx)(Me,{value:v.task.priority,disabled:z.has(`priority`),label:c.priority,labels:c.priorityLabels,onChange:gt}),(0,B.jsx)(Ne,{value:De(v.task.dueAt),disabled:z.has(`dueAt`),label:c.dueDate,onChange:_t}),(0,B.jsx)(Pe,{value:v.conversation.currentExecutorAgentId??``,disabled:z.has(`delegateAgentId`),label:c.executorLabel,unassignedLabel:c.unassigned,agents:He,onChange:St}),H?(0,B.jsxs)(`div`,{className:`grid gap-1 text-xs text-fg-muted`,children:[(0,B.jsx)(`span`,{children:c.projectLabel}),(0,B.jsxs)(`span`,{className:`flex items-center gap-1.5 rounded-lg bg-surface-hover px-3 py-2 text-sm text-fg`,children:[(0,B.jsx)(be,{className:`size-3.5`}),H]})]}):null]}),(0,B.jsxs)(`div`,{className:`mt-4 rounded-lg bg-surface-hover p-3 text-xs leading-5 text-fg-subtle`,children:[(0,B.jsx)(`p`,{children:Tt}),(0,B.jsx)(`p`,{children:Et}),(0,B.jsx)(`p`,{className:`mt-2`,children:c.updatedAt.replace(`{{date}}`,xe(v.task.updatedAt,i))})]})]}),(0,B.jsxs)(`section`,{className:h(`rounded-xl bg-surface-panel p-4`,Q(`dependencies`)&&`task-detail-live-update`),children:[(0,B.jsx)(`h2`,{className:`font-medium text-fg`,children:c.taskRelations}),(0,B.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:c.dependencies}),(0,B.jsx)(Fe,{candidates:ke,selected:v.dependencies,disabled:z.has(`dependencies`),labels:ut,onChange:xt})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:c.dependents}),v.dependents.length>0?(0,B.jsx)(`div`,{className:`space-y-1.5`,children:v.dependents.map(e=>(0,B.jsx)(o,{to:Gt(e.id),className:`block rounded-lg bg-surface-hover p-2.5 text-sm text-accent hover:underline`,children:e.title},e.id))}):(0,B.jsx)(`p`,{className:`text-sm text-fg-subtle`,children:c.noDependents})]})]})]})]})]})]}),(0,B.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(G),tabIndex:0,onPointerDown:bt,onKeyDown:yt,onDoubleClick:()=>vt(Le),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 ${Ze?`bg-surface-hover`:``}`,children:(0,B.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,B.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,B.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-3 bg-surface-subtle px-4 py-3.5`,children:[(0,B.jsx)(`div`,{className:`min-w-0`,children:(0,B.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[Pt?(0,B.jsx)(j,{agentId:Pt,avatar:Ft?.avatar,size:28,className:`shrink-0`}):null,(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:i===`zh`?`Agent 执行与对话`:`Agent execution and chat`}),(0,B.jsxs)(`p`,{className:`mt-0.5 truncate text-xs text-fg-muted`,children:[Ft?.name??Pt??c.unassigned,` · `,Tt]})]})]})}),(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[qt,Z&&t!==`modal`?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(g,{type:`button`,variant:`ghost`,className:h(`h-8 shrink-0 px-2 text-xs`,It&&`bg-surface-hover text-fg`),"aria-label":i===`zh`?`项目文件`:`Project files`,"aria-pressed":It,onClick:()=>{ae(Z,!1),ie(Z)},children:[(0,B.jsx)(oe,{className:`size-3.5`,"aria-hidden":!0}),i===`zh`?`文件`:`Files`]}),(0,B.jsx)(g,{asChild:!0,variant:`ghost`,className:`h-8 shrink-0 px-2 text-xs`,children:(0,B.jsxs)(o,{to:le(e),children:[(0,B.jsx)(u,{className:`size-3.5`}),i===`zh`?`全屏`:`Full screen`]})})]}):null]})]}),Z?(0,B.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,B.jsx)(A,{embedded:!0,sessionKey:Z,taskId:e})}):E?(0,B.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,B.jsxs)(`div`,{className:`max-w-xs`,children:[(0,B.jsx)(ye,{className:`mx-auto size-8 animate-pulse text-fg-subtle`}),(0,B.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:i===`zh`?`正在创建任务会话`:`Creating task conversation`})]})}):I?(0,B.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,B.jsxs)(`div`,{className:`max-w-xs`,children:[(0,B.jsx)(ye,{className:`mx-auto size-8 text-danger`}),(0,B.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:i===`zh`?`任务会话创建失败`:`Could not create task conversation`}),(0,B.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:I instanceof Error?I.message:String(I)})]})}):(0,B.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,B.jsxs)(`div`,{className:`max-w-xs`,children:[(0,B.jsx)(ye,{className:`mx-auto size-8 text-fg-subtle`}),(0,B.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:i===`zh`?`等待任务会话`:`Waiting for a task conversation`}),(0,B.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 Ve(){let e=(0,z.c)(2),{taskId:t}=i(),n=t===void 0?``:t,r;return e[0]===n?r=e[1]:(r=(0,B.jsx)(H,{taskId:n,presentation:`page`}),e[0]=n,e[1]=r),r}function He(e){let t=(0,z.c)(54),{taskId:n,backgroundPath:r,onClose:i}=e,a=ee(G),{data:s}=ge(n),c=s?.conversation.activeSessionKey??null,l=C(Ye),d=C(Je),f=C(W),p=C(qe),g=ve(Ke),_=me(Ge),y=me(U),se=l?d:0,b;t[0]!==i||t[1]!==y?(b=e=>{e||(y(null),i())},t[0]=i,t[1]=y,t[2]=b):b=t[2];let ce=a===`zh`?`关闭任务详情`:`Close task details`,x;t[3]!==i||t[4]!==y?(x=()=>{y(null),i()},t[3]=i,t[4]=y,t[5]=x):x=t[5];let S;t[6]!==ce||t[7]!==x?(S=(0,B.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":ce,onClick:x}),t[6]=ce,t[7]=x,t[8]=S):S=t[8];let ue=l?`true`:`false`,de=`${se/2}px`,fe=`${se}px`,pe;t[9]!==de||t[10]!==fe?(pe={"--task-detail-workspace-offset":de,"--task-detail-workspace-width":fe},t[9]=de,t[10]=fe,t[11]=pe):pe=t[11];let he=pe,_e=a===`zh`?`任务详情`:`Task details`,T;t[12]===_e?T=t[13]:(T=(0,B.jsx)(ae,{className:`font-medium text-fg`,children:_e}),t[12]=_e,t[13]=T);let E=a===`zh`?`查看并操作任务详情`:`View and manage task details`,D;t[14]===E?D=t[15]:(D=(0,B.jsx)(te,{className:`sr-only`,children:E}),t[14]=E,t[15]=D);let O;t[16]!==c||t[17]!==a||t[18]!==p||t[19]!==g||t[20]!==n||t[21]!==l||t[22]!==f?(O=c?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`button`,{type:`button`,className:h(`flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,l&&f===c&&`bg-surface-hover text-fg`),"aria-label":a===`zh`?`项目文件`:`Project files`,title:a===`zh`?`项目文件`:`Project files`,"aria-pressed":l&&f===c,onClick:()=>{g(c,!1),p(c)},children:(0,B.jsx)(oe,{className:`size-4`,"aria-hidden":!0})}),(0,B.jsx)(o,{to:le(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,B.jsx)(u,{className:`size-4`,"aria-hidden":!0})})]}):null,t[16]=c,t[17]=a,t[18]=p,t[19]=g,t[20]=n,t[21]=l,t[22]=f,t[23]=O):O=t[23];let ye=a===`zh`?`关闭任务详情`:`Close task details`,be;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(be=(0,B.jsx)(m,{className:`size-4`,"aria-hidden":!0}),t[24]=be):be=t[24];let k;t[25]===ye?k=t[26]:(k=(0,B.jsx)(ne,{className:`flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":ye,children:be}),t[25]=ye,t[26]=k);let A;t[27]!==O||t[28]!==k?(A=(0,B.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[O,k]}),t[27]=O,t[28]=k,t[29]=A):A=t[29];let j;t[30]!==T||t[31]!==D||t[32]!==A?(j=(0,B.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-3 bg-surface-panel px-5 py-3.5`,children:[T,D,A]}),t[30]=T,t[31]=D,t[32]=A,t[33]=j):j=t[33];let M;t[34]!==r||t[35]!==n?(M=(0,B.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,B.jsx)(H,{taskId:n,presentation:`modal`,backgroundPath:r})}),t[34]=r,t[35]=n,t[36]=M):M=t[36];let N;t[37]!==j||t[38]!==M||t[39]!==ue||t[40]!==he?(N=(0,B.jsxs)(ie,{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":ue,style:he,onEscapeKeyDown:We,onInteractOutside:Ue,children:[j,M]}),t[37]=j,t[38]=M,t[39]=ue,t[40]=he,t[41]=N):N=t[41];let P;t[42]!==_||t[43]!==l||t[44]!==d||t[45]!==f?(P=_?(0,B.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:l?d:0},children:(0,B.jsx)(w,{allowOutsideChat:!0,sessionKey:f??void 0})}):null,t[42]=_,t[43]=l,t[44]=d,t[45]=f,t[46]=P):P=t[46];let F;t[47]!==N||t[48]!==P||t[49]!==S?(F=(0,B.jsxs)(re,{children:[S,N,P]}),t[47]=N,t[48]=P,t[49]=S,t[50]=F):F=t[50];let I;return t[51]!==b||t[52]!==F?(I=(0,B.jsx)(v,{modal:!1,open:!0,onOpenChange:b,children:F}),t[51]=b,t[52]=F,t[53]=I):I=t[53],I}function Ue(e){let t=e.detail.originalEvent.target;t instanceof Element&&t.closest(`#app-workspace-panel, [data-task-modal-backdrop]`)&&e.preventDefault()}function We(e){let t=e.target;t instanceof HTMLElement&&t.closest(`[data-task-inline-editor]`)&&e.preventDefault()}function U(e){return e.setPath}function Ge(e){return e.path}function Ke(e){return e.setOpen}function qe(e){return e.openForSession}function W(e){return e.sessionKeyOverride}function Je(e){return e.widthPx}function Ye(e){return e.open}function G(e){return e.language}function Xe(e){return(0,B.jsx)(c,{value:e.id,children:e.name||e.id},e.id)}function Ze(e){return e.id}export{He as TaskDetailModal,Ve as TaskDetailPage};
@@ -1 +1 @@
1
- import{p as e}from"./locale-store-De8wYkd7.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
+ import{p as e}from"./locale-store-gf9Bg2gb.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{$o as t,es as n,ts as r}from"./index-CMLkr37Y.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`,r,`dark:border-edge`)}function a(){return e(n,t)}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};
1
+ import{t as e}from"./cn-JdwAhgNB.js";import{$o as t,es as n,ts as r}from"./index-DlOYwVFK.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`,r,`dark:border-edge`)}function a(){return e(n,t)}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};
@@ -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-De8wYkd7.js";import{Nl as c}from"./index-CMLkr37Y.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};
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-gf9Bg2gb.js";import{Nl as c}from"./index-DlOYwVFK.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};
@@ -0,0 +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{p as i,t as a}from"./chunk-KS7C4IRE-BaASWQor.js";import{n as o,r as s}from"./popover-select-BzdnTy3h.js";import{t as c}from"./external-link-DjqjBmc3.js";import{t as l}from"./loader-circle-CifKLtgG.js";import{t as u}from"./plus-Q2yW6OE7.js";import{t as d}from"./x-B_N4OPjy.js";import{t as f}from"./button-CSEbl4zT.js";import{n as p}from"./locale-store-gf9Bg2gb.js";import{a as m,i as h,n as g,o as _,r as v,s as y,t as b}from"./dist-BPoKqzeH.js";import{i as x}from"./vendor-swr-BIWyz7Rc.js";import{Bl as S,Bs as C,Co as w,El as T,Fl as E,Jc as D,Ls as O,Ms as k,Pl as A,Ql as j,So as M,St as N,Ua as P,_o as F,ac as I,ao as L,bc as R,bo as z,co as B,do as V,fo as H,fs as U,go as W,ho as G,lo as K,mo as ee,oo as te,pc as q,pl as J,po as Y,ro as X,so as ne,uo as re,vo as ie,vs as ae,vt as oe,xo as se,xt as ce,yo as le,zl as ue}from"./index-DlOYwVFK.js";import{n as de,t as fe}from"./use-autosave-Bp_qFZkl.js";import{t as pe}from"./tab-completion-input-D64VNmiA.js";import{t as me}from"./page-tabs-Bsluqyfb.js";var Z=n(),Q=e(t(),1),$=r(),he=new Set([`profile`,`understanding`,`collaboration`,`sources`,`dreaming`,`privacy`]),ge=`w-full rounded-xl border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent/60 focus:ring-2 focus:ring-accent/20`,_e={en:{title:`You`,subtitle:`A living portrait, shaped together by you and xopc.`,profile:`Your portrait`,understanding:`Shared understanding`,collaboration:`Working together`,sources:`Sources`,dreaming:`Background review`,privacy:`Privacy`,portraitEyebrow:`YOU × XOPC`,portraitIntro:`This is how xopc currently understands you. It grows through your conversations and work — and you always have the final say.`,maintainedTogether:`Shaped together`,youDecide:`You decide what stays`,editProfile:`Edit basics`,talkAboutMe:`Add through conversation`,roleMissing:`Add what you do`,direction:`What matters now`,directionEmpty:`Add a direction so xopc can help keep important work moving.`,portraitUnderstanding:`What xopc understands`,portraitUnderstandingHint:`Confirmed context xopc can use across conversations.`,portraitRules:`How we work together`,portraitRulesHint:`The agreements xopc should follow when helping you.`,reviewWaiting:`waiting for your review`,seeAll:`See all`,addFirstUnderstanding:`Nothing confirmed yet. Tell xopc what matters to you, or review a suggestion when one appears.`,addFirstRule:`No working agreements yet. Add one to make collaboration feel more like yours.`,portraitControl:`How this portrait evolves`,portraitControlHint:`Manage where understanding comes from, how it is reviewed, and what is never retained.`,portraitLearn:`Learn how this portrait is formed`,advanced:`Portrait controls`,backToPortrait:`Back to your portrait`,controlSourcesHint:`See which conversations, connections, and explicit details shape xopc’s understanding.`,controlReviewHint:`Choose how xopc proposes updates and which changes require your confirmation.`,controlPrivacyHint:`Set the boundaries for sensitive content and long-term retention.`,controlTrust:`Inferred understanding is never activated automatically. You can review, correct, or remove it at any time.`,profileHint:`Facts you provide directly. These are available across conversations.`,done:`Done`,required:`This field cannot be empty.`,callName:`What should xopc call you?`,callNamePlaceholder:`For example: Alex, Joyce, or Dr. Chen`,role:`Your role`,rolePlaceholder:`For example: product designer, founder, or engineer`,primaryGoal:`What are you mainly trying to achieve?`,primaryGoalPlaceholder:`The outcome you want xopc to optimize for`,pronouns:`Pronouns (optional)`,pronounsPlaceholder:`For example: she/her, he/him, they/them`,timezone:`Timezone`,locale:`Language / locale`,detect:`Use this device`,understoodHint:`Reviewable beliefs learned from your conversations and work. Inferences stay pending until confirmed.`,addUnderstanding:`Add understanding`,statement:`What should xopc understand?`,kind:`Type`,add:`Add`,cancel:`Cancel`,active:`Active`,review:`Needs review`,confirm:`Confirm`,reject:`Wrong`,edit:`Edit`,delete:`Delete`,confirmDelete:`Delete now`,rulesHint:`Explicit instructions for how xopc should collaborate with you. Rules outrank inferred understanding.`,addRule:`Add rule`,ruleStatement:`How should xopc work with you?`,category:`Category`,disable:`Disable`,enable:`Enable`,emptyUnderstanding:`Nothing here yet. Tell xopc something explicitly, or confirm a suggestion after it learns one.`,qualityTitle:`Learning quality`,qualityActive:`Confirmed`,qualityPending:`Pending review`,qualityAcceptance:`30-day acceptance`,qualityRecall:`Helpful recall`,qualitySourceCoverage:`Source coverage`,qualityBootstrapTime:`Median first sync`,qualityNoData:`Not enough feedback yet`,emptyRules:`No working agreements yet.`,sourceExplicit:`You said this directly`,sourceInferred:`Inferred — may be wrong`,sourceObserved:`Observed across prior work`,sourcesHint:`Review every granted source, its latest learning result, access mode, and retention. Revoking stops future learning.`,manageSources:`Connect another source`,authorizedSources:`Authorized sources`,connectorsTitle:`Connectors`,openConnector:`Open connector`,noSources:`No sources are authorized.`,noConnectors:`No connectors are installed.`,connected:`Connected`,unavailable:`Needs attention`,revoke:`Revoke source`,revokeHint:`Revoke this source and remove its derived understanding`,confirmRevoke:`Confirm revoke`,revoking:`Revoking…`,revokeDone:`Source revoked and derived understanding removed.`,refresh:`Update`,refreshing:`Updating…`,refreshStarted:`Update started.`,actionFailed:`Action failed`,once:`One-time`,continuous:`Continuous`,localOnly:`Local only`,derivedOnly:`Derived understanding only`,sourceQueued:`Queued`,sourceRunning:`Learning`,sourceCompleted:`Learned`,sourcePartial:`Partially learned`,sourceFailed:`Learning failed`,sourceNotRun:`Not collected yet`,sourceItems:`items reviewed`,sourceCandidates:`candidates formed`,sourceAccountUnavailable:`The connected account is unavailable. Reconnect it and try again.`,sourceSyncFailed:`This source could not be synchronized. Try updating it again.`,sourceAnalysisFailed:`Content was collected, but deeper understanding could not be completed. Try again later.`,focuses:`Current focuses`,focusHint:`Candidate focuses never activate until you confirm them.`,activate:`Activate`,pause:`Pause`,complete:`Complete`,noFocuses:`No focus candidates yet.`,focusCandidate:`Suggested`,focusActive:`Active`,focusPaused:`Paused`,focusCompleted:`Completed`,confidence:`Confidence`,confidenceHigh:`High`,confidenceMedium:`Medium`,confidenceLow:`Low`,contentReadTitle:`Additional deeper reading`,contentReadHint:`These items still need content to add useful context. Select up to 5 for one bounded read.`,readSelected:`Read selected`,reading:`Reading…`,contentReadDone:`Selected content was read and indexed.`,dreamingHint:`A deterministic daily review checks expiry, contradictory evidence, and corroborated candidates. It never auto-activates an inference.`,mode:`Background review`,on:`On — propose for review`,off:`Off`,reviewTime:`Daily review time`,evidenceThreshold:`Supporting evidence required`,scanLimit:`Maximum items per run`,lastRun:`Last review`,neverRun:`Not run yet`,runCompleted:`Completed`,runFailed:`Failed`,runRunning:`Running`,runItems:`items`,privacyHint:`Choose how generic memory providers handle sensitive content. Structured user understanding applies stricter rules of its own.`,sensitivePolicy:`Sensitive memory writes`,policyDeny:`Do not store`,policyConfirm:`Ask before storing`,policyAllow:`Store when relevant`,privacyWarning:`Secret and regulated content is never stored as structured user understanding, regardless of this setting.`,error:`Could not load your context.`,retry:`Try again`},zh:{title:`你`,subtitle:`一份由你和 xopc 共同塑造、持续生长的画像。`,profile:`你的画像`,understanding:`共同理解`,collaboration:`协作方式`,sources:`数据来源`,dreaming:`后台复核`,privacy:`隐私`,portraitEyebrow:`YOU × XOPC`,portraitIntro:`这是 xopc 此刻对你的理解。它会在对话与共事中逐渐丰富,而你始终拥有最终决定权。`,maintainedTogether:`由你与 xopc 共同维护`,youDecide:`你决定什么被保留`,editProfile:`编辑基本信息`,talkAboutMe:`在对话中补充`,roleMissing:`补充你的角色`,direction:`此刻重要的事`,directionEmpty:`写下你此刻的方向,让 xopc 帮你持续推动真正重要的事。`,portraitUnderstanding:`xopc 对你的理解`,portraitUnderstandingHint:`已经确认、可以在不同对话中帮助你的上下文。`,portraitRules:`我们如何一起工作`,portraitRulesHint:`xopc 在帮助你时应该遵循的约定。`,reviewWaiting:`条等待你确认`,seeAll:`查看全部`,addFirstUnderstanding:`还没有已确认的理解。你可以直接告诉 xopc 什么对你重要,或在它形成建议后确认。`,addFirstRule:`还没有协作约定。添加后,xopc 会更像你熟悉的搭档。`,portraitControl:`这份画像如何更新`,portraitControlHint:`管理理解从哪里来、如何复核,以及哪些内容永远不会被保留。`,portraitLearn:`了解这份画像如何形成`,advanced:`画像管理`,backToPortrait:`返回你的画像`,controlSourcesHint:`查看哪些对话、连接与明确告知的内容塑造了 xopc 的理解。`,controlReviewHint:`决定 xopc 如何提出更新,以及哪些变化需要你确认。`,controlPrivacyHint:`设定敏感内容与长期保留的边界。`,controlTrust:`推断出的理解不会自动生效。你可以随时复核、修正或删除。`,profileHint:`由你直接提供的事实,会在不同对话中使用。`,done:`完成`,required:`此项不能为空。`,callName:`希望 xopc 如何称呼你?`,callNamePlaceholder:`例如:Mic、Joyce、张老师`,role:`你的角色`,rolePlaceholder:`例如:产品设计师、创业者、工程师`,primaryGoal:`你目前最想达成什么?`,primaryGoalPlaceholder:`希望 xopc 优先帮助你实现的结果`,pronouns:`代词(可选)`,pronounsPlaceholder:`例如:she/her、he/him、they/them`,timezone:`时区`,locale:`语言 / 地区`,detect:`使用本机时区`,understoodHint:`从对话和工作中形成、可复核的理解。推断内容在你确认前保持待审核。`,addUnderstanding:`添加理解`,statement:`希望 xopc 了解什么?`,kind:`类型`,add:`添加`,cancel:`取消`,active:`使用中`,review:`待审核`,confirm:`确认`,reject:`不正确`,edit:`编辑`,delete:`删除`,confirmDelete:`确认删除`,rulesHint:`你明确设定的协作方式。协作约定的优先级高于推断出的理解。`,addRule:`添加约定`,ruleStatement:`希望 xopc 如何与你协作?`,category:`类别`,disable:`停用`,enable:`启用`,emptyUnderstanding:`还没有内容。你可以直接告诉 xopc,或在它学到建议后进行确认。`,emptyRules:`还没有协作约定。`,qualityTitle:`学习质量`,qualityActive:`已确认`,qualityPending:`待审核`,qualityAcceptance:`30 天采纳率`,qualityRecall:`有效召回`,qualitySourceCoverage:`来源覆盖率`,qualityBootstrapTime:`首次同步中位耗时`,qualityNoData:`反馈数据还不足`,sourceExplicit:`由你直接告知`,sourceInferred:`推断内容,可能有误`,sourceObserved:`从过往工作中观察到`,sourcesHint:`查看每项授权最近一次学习结果、访问方式与保留策略;撤销后将停止后续学习。`,manageSources:`连接其他来源`,authorizedSources:`已授权数据来源`,connectorsTitle:`连接器`,openConnector:`打开连接器`,noSources:`尚未授权任何来源。`,noConnectors:`尚未安装连接器。`,connected:`已连接`,unavailable:`需要处理`,revoke:`撤销来源`,revokeHint:`撤销此来源并删除由它产生的理解`,confirmRevoke:`确认撤销`,revoking:`正在撤销…`,revokeDone:`已撤销来源并删除派生理解。`,refresh:`更新`,refreshing:`正在更新…`,refreshStarted:`更新任务已开始。`,actionFailed:`操作失败`,once:`仅一次`,continuous:`持续更新`,localOnly:`仅本地处理`,derivedOnly:`仅保留派生理解`,sourceQueued:`等待中`,sourceRunning:`正在理解`,sourceCompleted:`理解完成`,sourcePartial:`部分完成`,sourceFailed:`理解失败`,sourceNotRun:`尚未采集`,sourceItems:`项已检查`,sourceCandidates:`项候选理解`,sourceAccountUnavailable:`连接的账号不可用,请重新连接后重试。`,sourceSyncFailed:`该来源同步失败,请再次更新。`,sourceAnalysisFailed:`内容已采集,但深入理解未完成,请稍后重试。`,focuses:`当前关注`,focusHint:`候选关注不会自动生效,只有你确认后才会启用。`,activate:`启用`,pause:`暂停`,complete:`完成`,noFocuses:`还没有候选关注。`,focusCandidate:`待确认`,focusActive:`进行中`,focusPaused:`已暂停`,focusCompleted:`已完成`,confidence:`置信度`,confidenceHigh:`高`,confidenceMedium:`中`,confidenceLow:`低`,contentReadTitle:`补充深入读取`,contentReadHint:`这些条目还需要正文才能形成有用上下文。你可以选择最多 5 项进行一次有界读取。`,readSelected:`读取所选内容`,reading:`正在读取…`,contentReadDone:`已读取并索引所选内容。`,dreamingHint:`每天进行一次确定性复核,检查过期、矛盾证据和得到佐证的候选理解;推断内容不会自动生效。`,mode:`后台复核`,on:`开启并生成待审核项`,off:`关闭`,reviewTime:`每日复核时间`,evidenceThreshold:`所需支持证据数`,scanLimit:`每次最多检查`,lastRun:`最近一次复核`,neverRun:`尚未运行`,runCompleted:`已完成`,runFailed:`失败`,runRunning:`运行中`,runItems:`项`,privacyHint:`选择通用记忆服务如何处理敏感内容;结构化用户理解有独立且更严格的规则。`,sensitivePolicy:`敏感记忆写入`,policyDeny:`不保存`,policyConfirm:`保存前询问`,policyAllow:`相关时允许保存`,privacyWarning:`无论这里如何设置,秘密和受监管内容都不会保存为结构化用户理解。`,error:`无法加载用户上下文。`,retry:`重试`}},ve={preference:{en:`Preference`,zh:`偏好`},boundary:{en:`Boundary`,zh:`边界`},relationship:{en:`Relationship`,zh:`关系`},routine:{en:`Routine`,zh:`习惯`},current_state:{en:`Current state`,zh:`当前状态`},long_term_goal:{en:`Long-term goal`,zh:`长期目标`},project_context:{en:`Project context`,zh:`项目背景`},task_lesson:{en:`Task lesson`,zh:`任务经验`},derived_insight:{en:`Insight`,zh:`洞察`}},ye={communication:{en:`Communication`,zh:`沟通`},execution:{en:`Execution`,zh:`执行`},boundary:{en:`Boundary`,zh:`边界`},routine:{en:`Routine`,zh:`习惯`},proactive:{en:`Proactive help`,zh:`主动协助`}};function be(e){let t=(0,Z.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,$.jsx)(`section`,{className:`rounded-2xl border border-edge bg-surface-panel p-4 sm:p-5`,children:n}),t[0]=n,t[1]=r),r}function xe(e){let t=(0,Z.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,$.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge px-5 py-10 text-center text-sm text-fg-muted`,children:n}),t[0]=n,t[1]=r),r}function Se(e){let t=(0,Z.c)(33),{open:n,onOpenChange:r,title:i,description:a,submitLabel:o,cancelLabel:s,submitDisabled:c,onSubmit:l,children:u}=e,p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(m,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),t[0]=p):p=t[0];let x;t[1]===i?x=t[2]:(x=(0,$.jsx)(y,{className:`text-base font-semibold text-fg`,children:i}),t[1]=i,t[2]=x);let S;t[3]===a?S=t[4]:(S=(0,$.jsx)(h,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:a}),t[3]=a,t[4]=S);let C;t[5]!==x||t[6]!==S?(C=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[x,S]}),t[5]=x,t[6]=S,t[7]=C):C=t[7];let w;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,$.jsx)(d,{className:`size-4`}),t[8]=w):w=t[8];let T;t[9]===s?T=t[10]:(T=(0,$.jsx)(g,{asChild:!0,children:(0,$.jsx)(f,{type:`button`,variant:`ghost`,className:`size-8 shrink-0 p-0`,"aria-label":s,children:w})}),t[9]=s,t[10]=T);let E;t[11]!==C||t[12]!==T?(E=(0,$.jsxs)(`header`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge px-5 py-4`,children:[C,T]}),t[11]=C,t[12]=T,t[13]=E):E=t[13];let D;t[14]===u?D=t[15]:(D=(0,$.jsx)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-5`,children:u}),t[14]=u,t[15]=D);let O;t[16]===s?O=t[17]:(O=(0,$.jsx)(g,{asChild:!0,children:(0,$.jsx)(f,{type:`button`,children:s})}),t[16]=s,t[17]=O);let k;t[18]!==c||t[19]!==o?(k=(0,$.jsx)(f,{type:`submit`,variant:`primary`,disabled:c,children:o}),t[18]=c,t[19]=o,t[20]=k):k=t[20];let A;t[21]!==k||t[22]!==O?(A=(0,$.jsxs)(`footer`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-3`,children:[O,k]}),t[21]=k,t[22]=O,t[23]=A):A=t[23];let j;t[24]!==l||t[25]!==A||t[26]!==E||t[27]!==D?(j=(0,$.jsxs)(_,{children:[p,(0,$.jsx)(v,{className:`fixed left-1/2 top-1/2 z-[90] h-[min(30rem,calc(100vh-2rem))] w-[min(36rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`,children:(0,$.jsxs)(`form`,{className:`flex h-full min-h-0 flex-col`,onSubmit:l,children:[E,D,A]})})]}),t[24]=l,t[25]=A,t[26]=E,t[27]=D,t[28]=j):j=t[28];let M;return t[29]!==r||t[30]!==n||t[31]!==j?(M=(0,$.jsx)(b,{open:n,onOpenChange:r,children:j}),t[29]=r,t[30]=n,t[31]=j,t[32]=M):M=t[32],M}function Ce(e){return JSON.stringify(e)}function we(e){let t=(0,Z.c)(10),[n,r]=(0,Q.useState)(e),i;t[0]===e?i=t[1]:(i=Ce(e),t[0]=e,t[1]=i);let a=(0,Q.useRef)(i),o;t[2]===e?o=t[3]:(o=Ce(e),t[2]=e,t[3]=o);let s=o,c,l;t[4]!==e||t[5]!==s?(c=()=>{if(s===a.current)return;let t=a.current;a.current=s,r(n=>Ce(n)===t?e:n)},l=[e,s],t[4]=e,t[5]=s,t[6]=c,t[7]=l):(c=t[6],l=t[7]),(0,Q.useEffect)(c,l);let u;return t[8]===n?u=t[9]:(u=[n,r],t[8]=n,t[9]=u),u}function Te(e){return{callName:e.callName,role:e.role,primaryGoal:e.primaryGoal,pronouns:e.pronouns,timezone:e.timezone,locale:e.locale}}function Ee(){let e=(0,Z.c)(68),t=p(Ae),n=_e[t],[r,a]=i(),o;if(e[0]!==r){let t=r.get(`tab`);o=t&&he.has(t)?t:`profile`,e[0]=r,e[1]=o}else o=e[1];let s=o,c=X(ke),l=X(Oe),{data:u,error:d,isLoading:m,mutate:h}=x(`/api/you`,Y),g;e[2]!==l||e[3]!==c||e[4]!==n.subtitle||e[5]!==n.title?(g=()=>(c({startExtra:null,main:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h1`,{className:`text-base font-semibold text-fg`,children:n.title}),(0,$.jsx)(`p`,{className:`hidden text-xs text-fg-muted sm:block`,children:n.subtitle})]}),end:null}),l),e[2]=l,e[3]=c,e[4]=n.subtitle,e[5]=n.title,e[6]=g):g=e[6];let _;if(e[7]!==l||e[8]!==c||e[9]!==n?(_=[l,c,n],e[7]=l,e[8]=c,e[9]=n,e[10]=_):_=e[10],(0,Q.useEffect)(g,_),m){let t;return e[11]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`div`,{className:`space-y-4 p-4 sm:p-6`,children:[(0,$.jsx)(P,{className:`h-10 w-96 max-w-full`}),(0,$.jsx)(P,{className:`h-72 rounded-2xl`})]}),e[11]=t):t=e[11],t}if(d||!u){let t;e[12]===h?t=e[13]:(t=()=>void h(),e[12]=h,e[13]=t);let r;e[14]!==n.retry||e[15]!==t?(r=(0,$.jsx)(`button`,{className:`text-accent hover:underline`,onClick:t,children:n.retry}),e[14]=n.retry,e[15]=t,e[16]=r):r=e[16];let i;return e[17]!==n.error||e[18]!==r?(i=(0,$.jsx)(`div`,{className:`p-6`,children:(0,$.jsxs)(xe,{children:[n.error,` `,r]})}),e[17]=n.error,e[18]=r,e[19]=i):i=e[19],i}let v=s===`sources`||s===`dreaming`||s===`privacy`,y;e[20]!==v||e[21]!==u||e[22]!==a||e[23]!==n.advanced||e[24]!==n.backToPortrait||e[25]!==n.collaboration||e[26]!==n.profile||e[27]!==n.title||e[28]!==n.understanding||e[29]!==s?(y=v?(0,$.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-edge pb-4`,children:[(0,$.jsxs)(f,{variant:`ghost`,className:`-ml-2`,onClick:()=>a({tab:`profile`}),children:[(0,$.jsx)(E,{className:`size-4`}),n.backToPortrait]}),(0,$.jsx)(`span`,{className:`h-4 w-px bg-edge`,"aria-hidden":`true`}),(0,$.jsx)(`span`,{className:`text-sm font-medium text-fg-muted`,children:n.advanced})]}):(0,$.jsx)(me,{ariaLabel:n.title,activeTab:s,onChange:e=>a({tab:e}),items:[{id:`profile`,label:n.profile,icon:T},{id:`understanding`,label:n.understanding,icon:S,count:u.understandings.filter(De).length||void 0},{id:`collaboration`,label:n.collaboration,icon:D}]}),e[20]=v,e[21]=u,e[22]=a,e[23]=n.advanced,e[24]=n.backToPortrait,e[25]=n.collaboration,e[26]=n.profile,e[27]=n.title,e[28]=n.understanding,e[29]=s,e[30]=y):y=e[30];let b;e[31]!==u||e[32]!==t||e[33]!==h||e[34]!==a||e[35]!==n||e[36]!==s?(b=s===`profile`?(0,$.jsx)(je,{data:u,language:t,t:n,onNavigate:e=>a({tab:e}),onProfileChanged:e=>h(t=>t&&{...t,profile:e},{revalidate:!1})}):null,e[31]=u,e[32]=t,e[33]=h,e[34]=a,e[35]=n,e[36]=s,e[37]=b):b=e[37];let C;e[38]!==u||e[39]!==t||e[40]!==h||e[41]!==n||e[42]!==s?(C=s===`understanding`?(0,$.jsx)(Be,{items:u.understandings,quality:u.quality,language:t,t:n,onChanged:e=>e?h(t=>t&&{...t,understandings:t.understandings.map(t=>t.id===e.id?e:t)},{revalidate:!0}):h()}):null,e[38]=u,e[39]=t,e[40]=h,e[41]=n,e[42]=s,e[43]=C):C=e[43];let w;e[44]!==u||e[45]!==t||e[46]!==h||e[47]!==n||e[48]!==s?(w=s===`collaboration`?(0,$.jsx)(Je,{rules:u.rules,language:t,t:n,onChanged:()=>h()}):null,e[44]=u,e[45]=t,e[46]=h,e[47]=n,e[48]=s,e[49]=w):w=e[49];let O;e[50]!==n||e[51]!==s?(O=s===`sources`?(0,$.jsx)(Ze,{t:n}):null,e[50]=n,e[51]=s,e[52]=O):O=e[52];let k;e[53]!==u||e[54]!==n||e[55]!==s?(k=s===`dreaming`?(0,$.jsx)(Qe,{lastRun:u.consolidation?.lastRun??null,t:n}):null,e[53]=u,e[54]=n,e[55]=s,e[56]=k):k=e[56];let A;e[57]!==n||e[58]!==s?(A=s===`privacy`?(0,$.jsx)(et,{t:n}):null,e[57]=n,e[58]=s,e[59]=A):A=e[59];let j;return e[60]!==y||e[61]!==b||e[62]!==C||e[63]!==w||e[64]!==O||e[65]!==k||e[66]!==A?(j=(0,$.jsxs)(`div`,{className:`mx-auto w-full max-w-6xl space-y-5 p-4 sm:p-6 lg:py-8`,children:[y,b,C,w,O,k,A]}),e[60]=y,e[61]=b,e[62]=C,e[63]=w,e[64]=O,e[65]=k,e[66]=A,e[67]=j):j=e[67],j}function De(e){return[`candidate`,`needs_review`,`stale`].includes(e.status)}function Oe(e){return e.clearPageHeader}function ke(e){return e.setPageHeader}function Ae(e){return e.language}function je(e){let t=(0,Z.c)(176),{data:n,language:r,t:i,onNavigate:o,onProfileChanged:s}=e,[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(!1),p,m,h,g,_,v,y,b,x,w;if(t[0]!==n.profile.callName||t[1]!==n.profile.primaryGoal||t[2]!==n.profile.role||t[3]!==n.rules||t[4]!==n.understandings||t[5]!==r||t[6]!==o||t[7]!==i.addFirstRule||t[8]!==i.addFirstUnderstanding||t[9]!==i.advanced||t[10]!==i.direction||t[11]!==i.directionEmpty||t[12]!==i.editProfile||t[13]!==i.maintainedTogether||t[14]!==i.portraitEyebrow||t[15]!==i.portraitIntro||t[16]!==i.portraitRules||t[17]!==i.portraitRulesHint||t[18]!==i.portraitUnderstanding||t[19]!==i.portraitUnderstandingHint||t[20]!==i.reviewWaiting||t[21]!==i.roleMissing||t[22]!==i.seeAll||t[23]!==i.talkAboutMe||t[24]!==i.youDecide){let e=n.understandings.filter(Pe),s;t[35]===n.understandings?s=t[36]:(s=n.understandings.filter(Ne),t[35]=n.understandings,t[36]=s);let c=s,u=n.rules.filter(Me),C,T;t[37]!==n.profile.callName||t[38]!==r?(C=n.profile.callName.trim()||(r===`zh`?`你`:`You`),T=[...C][0]?.toLocaleUpperCase()??`Y`,t[37]=n.profile.callName,t[38]=r,t[39]=C,t[40]=T):(C=t[39],T=t[40]);let E=T;x=`space-y-5`;let M;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,$.jsx)(`div`,{className:`absolute inset-x-0 top-0 h-px bg-gradient-to-r from-transparent via-accent/40 to-transparent`,"aria-hidden":`true`}),t[41]=M):M=t[41];let N;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,$.jsx)(k,{className:`size-3.5`}),t[42]=N):N=t[42];let P;t[43]===i.portraitEyebrow?P=t[44]:(P=(0,$.jsxs)(`div`,{className:`mb-7 flex items-center gap-2 text-[11px] font-semibold tracking-[0.18em] text-accent`,children:[N,i.portraitEyebrow]}),t[43]=i.portraitEyebrow,t[44]=P);let F;t[45]===E?F=t[46]:(F=(0,$.jsx)(`div`,{className:`flex size-16 shrink-0 items-center justify-center rounded-2xl border border-edge bg-surface-muted text-2xl font-semibold text-fg sm:size-20 sm:text-3xl`,children:E}),t[45]=E,t[46]=F);let I;t[47]===C?I=t[48]:(I=(0,$.jsx)(`h2`,{className:`truncate text-2xl font-semibold tracking-tight text-fg sm:text-3xl`,children:C}),t[47]=C,t[48]=I);let L;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(L=()=>l(!0),t[49]=L):L=t[49];let z;t[50]!==n.profile.role||t[51]!==i.roleMissing?(z=n.profile.role.trim()||i.roleMissing,t[50]=n.profile.role,t[51]=i.roleMissing,t[52]=z):z=t[52];let B;t[53]===z?B=t[54]:(B=(0,$.jsx)(`button`,{className:`mt-1 text-left text-sm text-fg-muted transition-colors hover:text-accent`,onClick:L,children:z}),t[53]=z,t[54]=B);let V;t[55]!==I||t[56]!==B?(V=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[I,B]}),t[55]=I,t[56]=B,t[57]=V):V=t[57];let H;t[58]!==F||t[59]!==V?(H=(0,$.jsxs)(`div`,{className:`flex items-center gap-4`,children:[F,V]}),t[58]=F,t[59]=V,t[60]=H):H=t[60];let W;t[61]===i.portraitIntro?W=t[62]:(W=(0,$.jsx)(`p`,{className:`mt-7 max-w-2xl text-base leading-7 text-fg-muted`,children:i.portraitIntro}),t[61]=i.portraitIntro,t[62]=W);let G;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,$.jsx)(`span`,{className:`size-1.5 rounded-full bg-success`}),t[63]=G):G=t[63];let K;t[64]===i.maintainedTogether?K=t[65]:(K=(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[G,i.maintainedTogether]}),t[64]=i.maintainedTogether,t[65]=K);let ee,te;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(ee=()=>d(!0),te=(0,$.jsx)(O,{className:`size-3.5`}),t[66]=ee,t[67]=te):(ee=t[66],te=t[67]);let q;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,$.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),t[68]=q):q=t[68];let J;t[69]===i.advanced?J=t[70]:(J=(0,$.jsx)(`span`,{className:`font-medium text-accent`,children:i.advanced}),t[69]=i.advanced,t[70]=J);let Y;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,$.jsx)(A,{className:`size-3`}),t[71]=Y):Y=t[71];let X;t[72]!==i.youDecide||t[73]!==J?(X=(0,$.jsxs)(`button`,{className:`inline-flex items-center gap-1.5 rounded-md transition-colors hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/30`,onClick:ee,children:[te,i.youDecide,q,J,Y]}),t[72]=i.youDecide,t[73]=J,t[74]=X):X=t[74];let ne;t[75]!==K||t[76]!==X?(ne=(0,$.jsxs)(`div`,{className:`mt-6 flex flex-wrap items-center gap-x-5 gap-y-2 text-xs text-fg-subtle`,children:[K,X]}),t[75]=K,t[76]=X,t[77]=ne):ne=t[77];let re;t[78]!==P||t[79]!==H||t[80]!==W||t[81]!==ne?(re=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[P,H,W,ne]}),t[78]=P,t[79]=H,t[80]=W,t[81]=ne,t[82]=re):re=t[82];let ie;t[83]===i.direction?ie=t[84]:(ie=(0,$.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.12em] text-fg-subtle`,children:i.direction}),t[83]=i.direction,t[84]=ie);let ae=`mt-4 text-base leading-7 ${n.profile.primaryGoal.trim()?`text-fg`:`text-fg-muted`}`,oe;t[85]!==n.profile.primaryGoal||t[86]!==i.directionEmpty?(oe=n.profile.primaryGoal.trim()||i.directionEmpty,t[85]=n.profile.primaryGoal,t[86]=i.directionEmpty,t[87]=oe):oe=t[87];let se;t[88]!==ae||t[89]!==oe?(se=(0,$.jsx)(`p`,{className:ae,children:oe}),t[88]=ae,t[89]=oe,t[90]=se):se=t[90];let ce;t[91]!==ie||t[92]!==se?(ce=(0,$.jsxs)(`div`,{children:[ie,se]}),t[91]=ie,t[92]=se,t[93]=ce):ce=t[93];let le;t[94]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,$.jsx)(R,{className:`size-4`}),t[94]=le):le=t[94];let ue;t[95]===i.talkAboutMe?ue=t[96]:(ue=(0,$.jsx)(f,{variant:`primary`,asChild:!0,children:(0,$.jsxs)(a,{to:`/chat/new`,children:[le,i.talkAboutMe]})}),t[95]=i.talkAboutMe,t[96]=ue);let de,fe;t[97]===Symbol.for(`react.memo_cache_sentinel`)?(de=()=>l(!0),fe=(0,$.jsx)(U,{className:`size-4`}),t[97]=de,t[98]=fe):(de=t[97],fe=t[98]);let pe;t[99]===i.editProfile?pe=t[100]:(pe=(0,$.jsxs)(f,{onClick:de,children:[fe,i.editProfile]}),t[99]=i.editProfile,t[100]=pe);let me;t[101]!==ue||t[102]!==pe?(me=(0,$.jsxs)(`div`,{className:`mt-8 flex flex-wrap gap-2`,children:[ue,pe]}),t[101]=ue,t[102]=pe,t[103]=me):me=t[103];let Z;t[104]!==ce||t[105]!==me?(Z=(0,$.jsxs)(`div`,{className:`flex flex-col justify-between rounded-2xl border border-edge bg-surface-base/70 p-5 sm:p-6`,children:[ce,me]}),t[104]=ce,t[105]=me,t[106]=Z):Z=t[106],t[107]!==re||t[108]!==Z?(w=(0,$.jsxs)(`section`,{className:`relative overflow-hidden rounded-3xl border border-edge bg-surface-panel`,children:[M,(0,$.jsxs)(`div`,{className:`grid gap-8 px-5 py-7 sm:px-8 sm:py-9 lg:grid-cols-[minmax(0,1fr)_20rem] lg:gap-12 lg:px-10 lg:py-11`,children:[re,Z]})]}),t[107]=re,t[108]=Z,t[109]=w):w=t[109],y=`grid gap-5 lg:grid-cols-2`;let Q;t[110]===Symbol.for(`react.memo_cache_sentinel`)?(Q=(0,$.jsx)(S,{className:`size-4`}),t[110]=Q):Q=t[110];let he;t[111]===o?he=t[112]:(he=()=>o(`understanding`),t[111]=o,t[112]=he);let ge;t[113]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,$.jsx)(A,{className:`size-3.5`}),t[113]=ge):ge=t[113];let _e;t[114]!==i.seeAll||t[115]!==he?(_e=(0,$.jsxs)(`button`,{className:`inline-flex items-center gap-1 text-xs font-medium text-accent hover:underline`,onClick:he,children:[i.seeAll,ge]}),t[114]=i.seeAll,t[115]=he,t[116]=_e):_e=t[116];let be;t[117]!==o||t[118]!==c.length||t[119]!==i.reviewWaiting?(be=c.length?(0,$.jsxs)(`button`,{className:`mb-4 flex w-full items-center justify-between rounded-xl border border-accent/20 bg-accent-soft px-3 py-2.5 text-left text-xs text-accent transition-colors hover:border-accent/40`,onClick:()=>o(`understanding`),children:[(0,$.jsxs)(`span`,{children:[(0,$.jsx)(k,{className:`mr-1.5 inline size-3.5`}),c.length,` `,i.reviewWaiting]}),(0,$.jsx)(j,{className:`size-3.5`})]}):null,t[117]=o,t[118]=c.length,t[119]=i.reviewWaiting,t[120]=be):be=t[120];let xe=e.length?(0,$.jsx)(`div`,{className:`space-y-1`,children:e.slice(0,4).map(e=>(0,$.jsxs)(`div`,{className:`group flex gap-3 rounded-xl px-2 py-2.5 transition-colors hover:bg-surface-hover`,children:[(0,$.jsx)(`span`,{className:`mt-2 size-1.5 shrink-0 rounded-full bg-accent/70`}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:e.statement}),(0,$.jsx)(`p`,{className:`mt-0.5 text-[11px] text-fg-subtle`,children:ve[e.kind][r]})]})]},e.id))}):(0,$.jsx)(`p`,{className:`py-5 text-sm leading-6 text-fg-muted`,children:i.addFirstUnderstanding});t[121]!==i.portraitUnderstanding||t[122]!==i.portraitUnderstandingHint||t[123]!==_e||t[124]!==be||t[125]!==xe?(b=(0,$.jsxs)(Fe,{icon:Q,title:i.portraitUnderstanding,description:i.portraitUnderstandingHint,action:_e,children:[be,xe]}),t[121]=i.portraitUnderstanding,t[122]=i.portraitUnderstandingHint,t[123]=_e,t[124]=be,t[125]=xe,t[126]=b):b=t[126],p=Fe,t[127]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(D,{className:`size-4`}),t[127]=m):m=t[127],h=i.portraitRules,g=i.portraitRulesHint;let Se;t[128]===o?Se=t[129]:(Se=()=>o(`collaboration`),t[128]=o,t[129]=Se);let Ce;t[130]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=(0,$.jsx)(A,{className:`size-3.5`}),t[130]=Ce):Ce=t[130],t[131]!==i.seeAll||t[132]!==Se?(_=(0,$.jsxs)(`button`,{className:`inline-flex items-center gap-1 text-xs font-medium text-accent hover:underline`,onClick:Se,children:[i.seeAll,Ce]}),t[131]=i.seeAll,t[132]=Se,t[133]=_):_=t[133],v=u.length?(0,$.jsx)(`div`,{className:`space-y-1`,children:u.slice(0,4).map(e=>(0,$.jsxs)(`div`,{className:`flex gap-3 rounded-xl px-2 py-2.5 transition-colors hover:bg-surface-hover`,children:[(0,$.jsx)(`span`,{className:`mt-2 size-1.5 shrink-0 rounded-full bg-fg-subtle`}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:e.statement}),(0,$.jsx)(`p`,{className:`mt-0.5 text-[11px] text-fg-subtle`,children:ye[e.category][r]})]})]},e.id))}):(0,$.jsx)(`p`,{className:`py-5 text-sm leading-6 text-fg-muted`,children:i.addFirstRule}),t[0]=n.profile.callName,t[1]=n.profile.primaryGoal,t[2]=n.profile.role,t[3]=n.rules,t[4]=n.understandings,t[5]=r,t[6]=o,t[7]=i.addFirstRule,t[8]=i.addFirstUnderstanding,t[9]=i.advanced,t[10]=i.direction,t[11]=i.directionEmpty,t[12]=i.editProfile,t[13]=i.maintainedTogether,t[14]=i.portraitEyebrow,t[15]=i.portraitIntro,t[16]=i.portraitRules,t[17]=i.portraitRulesHint,t[18]=i.portraitUnderstanding,t[19]=i.portraitUnderstandingHint,t[20]=i.reviewWaiting,t[21]=i.roleMissing,t[22]=i.seeAll,t[23]=i.talkAboutMe,t[24]=i.youDecide,t[25]=p,t[26]=m,t[27]=h,t[28]=g,t[29]=_,t[30]=v,t[31]=y,t[32]=b,t[33]=x,t[34]=w}else p=t[25],m=t[26],h=t[27],g=t[28],_=t[29],v=t[30],y=t[31],b=t[32],x=t[33],w=t[34];let T;t[134]!==p||t[135]!==m||t[136]!==h||t[137]!==g||t[138]!==_||t[139]!==v?(T=(0,$.jsx)(p,{icon:m,title:h,description:g,action:_,children:v}),t[134]=p,t[135]=m,t[136]=h,t[137]=g,t[138]=_,t[139]=v,t[140]=T):T=t[140];let E;t[141]!==T||t[142]!==y||t[143]!==b?(E=(0,$.jsxs)(`div`,{className:y,children:[b,T]}),t[141]=T,t[142]=y,t[143]=b,t[144]=E):E=t[144];let M;t[145]===Symbol.for(`react.memo_cache_sentinel`)?(M=()=>d(!0),t[145]=M):M=t[145];let N;t[146]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,$.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-xl bg-surface-muted text-fg-muted`,children:(0,$.jsx)(C,{className:`size-4`})}),t[146]=N):N=t[146];let P;t[147]===i.portraitLearn?P=t[148]:(P=(0,$.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:i.portraitLearn}),t[147]=i.portraitLearn,t[148]=P);let F;t[149]===i.portraitControlHint?F=t[150]:(F=(0,$.jsx)(`span`,{className:`mt-0.5 block text-xs leading-5 text-fg-muted`,children:i.portraitControlHint}),t[149]=i.portraitControlHint,t[150]=F);let I;t[151]!==P||t[152]!==F?(I=(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[P,F]}),t[151]=P,t[152]=F,t[153]=I):I=t[153];let L;t[154]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,$.jsx)(A,{className:`size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5`}),t[154]=L):L=t[154];let z;t[155]===I?z=t[156]:(z=(0,$.jsxs)(`button`,{className:`group flex w-full items-center gap-4 rounded-2xl border border-edge bg-surface-panel px-5 py-4 text-left transition-colors hover:bg-surface-hover sm:px-6`,onClick:M,children:[N,I,L]}),t[155]=I,t[156]=z);let B;t[157]!==n.profile||t[158]!==c||t[159]!==r||t[160]!==s||t[161]!==i?(B=(0,$.jsx)(Le,{open:c,onOpenChange:l,profile:n.profile,language:r,t:i,onChanged:s}),t[157]=n.profile,t[158]=c,t[159]=r,t[160]=s,t[161]=i,t[162]=B):B=t[162];let V;t[163]===o?V=t[164]:(V=e=>{d(!1),o(e)},t[163]=o,t[164]=V);let H;t[165]!==u||t[166]!==i||t[167]!==V?(H=(0,$.jsx)(Ie,{open:u,onOpenChange:d,t:i,onNavigate:V}),t[165]=u,t[166]=i,t[167]=V,t[168]=H):H=t[168];let W;return t[169]!==E||t[170]!==z||t[171]!==B||t[172]!==H||t[173]!==x||t[174]!==w?(W=(0,$.jsxs)(`div`,{className:x,children:[w,E,z,B,H]}),t[169]=E,t[170]=z,t[171]=B,t[172]=H,t[173]=x,t[174]=w,t[175]=W):W=t[175],W}function Me(e){return e.status===`active`}function Ne(e){return[`candidate`,`needs_review`,`stale`].includes(e.status)}function Pe(e){return e.status===`active`}function Fe(e){let t=(0,Z.c)(20),{icon:n,title:r,description:i,action:a,children:o}=e,s;t[0]===n?s=t[1]:(s=(0,$.jsx)(`span`,{className:`mt-0.5 flex size-8 shrink-0 items-center justify-center rounded-xl bg-surface-muted text-fg-muted`,children:n}),t[0]=n,t[1]=s);let c;t[2]===r?c=t[3]:(c=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:r}),t[2]=r,t[3]=c);let l;t[4]!==a||t[5]!==c?(l=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[c,a]}),t[4]=a,t[5]=c,t[6]=l):l=t[6];let u;t[7]===i?u=t[8]:(u=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:i}),t[7]=i,t[8]=u);let d;t[9]!==l||t[10]!==u?(d=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[l,u]}),t[9]=l,t[10]=u,t[11]=d):d=t[11];let f;t[12]!==s||t[13]!==d?(f=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[s,d]}),t[12]=s,t[13]=d,t[14]=f):f=t[14];let p;t[15]===o?p=t[16]:(p=(0,$.jsx)(`div`,{className:`mt-4 border-t border-edge pt-3`,children:o}),t[15]=o,t[16]=p);let m;return t[17]!==f||t[18]!==p?(m=(0,$.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-panel p-5 sm:p-6`,children:[f,p]}),t[17]=f,t[18]=p,t[19]=m):m=t[19],m}function Ie(e){let t=(0,Z.c)(47),{open:n,onOpenChange:r,t:i,onNavigate:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsx)(ue,{className:`size-4`}),t[0]=o):o=t[0];let s;t[1]!==i.controlSourcesHint||t[2]!==i.sources?(s={tab:`sources`,icon:o,label:i.sources,description:i.controlSourcesHint},t[1]=i.controlSourcesHint,t[2]=i.sources,t[3]=s):s=t[3];let c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(q,{className:`size-4`}),t[4]=c):c=t[4];let l;t[5]!==i.controlReviewHint||t[6]!==i.dreaming?(l={tab:`dreaming`,icon:c,label:i.dreaming,description:i.controlReviewHint},t[5]=i.controlReviewHint,t[6]=i.dreaming,t[7]=l):l=t[7];let u;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,$.jsx)(O,{className:`size-4`}),t[8]=u):u=t[8];let p;t[9]!==i.controlPrivacyHint||t[10]!==i.privacy?(p={tab:`privacy`,icon:u,label:i.privacy,description:i.controlPrivacyHint},t[9]=i.controlPrivacyHint,t[10]=i.privacy,t[11]=p):p=t[11];let x;t[12]!==s||t[13]!==l||t[14]!==p?(x=[s,l,p],t[12]=s,t[13]=l,t[14]=p,t[15]=x):x=t[15];let S=x,w;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,$.jsx)(m,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),t[16]=w):w=t[16];let T;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,$.jsx)(`div`,{className:`mb-3 flex size-9 items-center justify-center rounded-xl bg-accent-soft text-accent`,children:(0,$.jsx)(C,{className:`size-4`})}),t[17]=T):T=t[17];let E;t[18]===i.portraitControl?E=t[19]:(E=(0,$.jsx)(y,{className:`text-lg font-semibold tracking-tight text-fg`,children:i.portraitControl}),t[18]=i.portraitControl,t[19]=E);let D;t[20]===i.portraitControlHint?D=t[21]:(D=(0,$.jsx)(h,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:i.portraitControlHint}),t[20]=i.portraitControlHint,t[21]=D);let k;t[22]!==E||t[23]!==D?(k=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[T,E,D]}),t[22]=E,t[23]=D,t[24]=k):k=t[24];let j;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,$.jsx)(d,{className:`size-4`}),t[25]=j):j=t[25];let M;t[26]===i.cancel?M=t[27]:(M=(0,$.jsx)(g,{asChild:!0,children:(0,$.jsx)(f,{variant:`ghost`,className:`size-8 shrink-0 p-0`,"aria-label":i.cancel,children:j})}),t[26]=i.cancel,t[27]=M);let N;t[28]!==k||t[29]!==M?(N=(0,$.jsxs)(`header`,{className:`flex shrink-0 items-start justify-between gap-4 border-b border-edge px-5 py-5 sm:px-6 sm:py-6`,children:[k,M]}),t[28]=k,t[29]=M,t[30]=N):N=t[30];let P;t[31]!==S||t[32]!==a?(P=(0,$.jsx)(`div`,{className:`space-y-3`,children:S.map(e=>(0,$.jsxs)(`button`,{className:`group flex w-full items-start gap-4 rounded-2xl border border-edge bg-surface-base p-4 text-left transition-colors hover:border-edge-strong hover:bg-surface-hover`,onClick:()=>a(e.tab),children:[(0,$.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-xl bg-surface-muted text-fg-muted transition-colors group-hover:text-accent`,children:e.icon}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.label}),(0,$.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:e.description})]}),(0,$.jsx)(A,{className:`mt-2.5 size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5`})]},e.tab))}),t[31]=S,t[32]=a,t[33]=P):P=t[33];let F;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,$.jsx)(O,{className:`mt-0.5 size-4 shrink-0 text-success`}),t[34]=F):F=t[34];let I;t[35]===i.controlTrust?I=t[36]:(I=(0,$.jsxs)(`div`,{className:`mt-6 flex gap-3 rounded-2xl bg-surface-muted p-4`,children:[F,(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:i.controlTrust})]}),t[35]=i.controlTrust,t[36]=I);let L;t[37]!==P||t[38]!==I?(L=(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-4 sm:p-6`,children:[P,I]}),t[37]=P,t[38]=I,t[39]=L):L=t[39];let R;t[40]!==N||t[41]!==L?(R=(0,$.jsxs)(_,{children:[w,(0,$.jsx)(v,{className:`fixed inset-y-0 right-0 z-[90] h-full w-[min(30rem,100vw)] overflow-hidden border-l border-edge bg-surface-panel shadow-popover outline-none sm:rounded-l-2xl`,children:(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[N,L]})})]}),t[40]=N,t[41]=L,t[42]=R):R=t[42];let z;return t[43]!==r||t[44]!==n||t[45]!==R?(z=(0,$.jsx)(b,{open:n,onOpenChange:r,children:R}),t[43]=r,t[44]=n,t[45]=R,t[46]=z):z=t[46],z}function Le(e){let t=(0,Z.c)(26),{open:n,onOpenChange:r,profile:i,language:a,t:o,onChanged:s}=e,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(m,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),t[0]=c):c=t[0];let l;t[1]===o.editProfile?l=t[2]:(l=(0,$.jsx)(y,{className:`text-base font-semibold text-fg`,children:o.editProfile}),t[1]=o.editProfile,t[2]=l);let u;t[3]===o.profileHint?u=t[4]:(u=(0,$.jsx)(h,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:o.profileHint}),t[3]=o.profileHint,t[4]=u);let p;t[5]!==l||t[6]!==u?(p=(0,$.jsxs)(`div`,{children:[l,u]}),t[5]=l,t[6]=u,t[7]=p):p=t[7];let x;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,$.jsx)(d,{className:`size-4`}),t[8]=x):x=t[8];let S;t[9]===o.cancel?S=t[10]:(S=(0,$.jsx)(g,{asChild:!0,children:(0,$.jsx)(f,{variant:`ghost`,className:`size-8 shrink-0 p-0`,"aria-label":o.cancel,children:x})}),t[9]=o.cancel,t[10]=S);let C;t[11]!==p||t[12]!==S?(C=(0,$.jsxs)(`header`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge px-5 py-4 sm:px-6`,children:[p,S]}),t[11]=p,t[12]=S,t[13]=C):C=t[13];let w;t[14]!==a||t[15]!==s||t[16]!==i||t[17]!==o?(w=(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5 sm:p-6`,children:(0,$.jsx)(Re,{profile:i,language:a,t:o,onChanged:s,bare:!0})}),t[14]=a,t[15]=s,t[16]=i,t[17]=o,t[18]=w):w=t[18];let T;t[19]!==C||t[20]!==w?(T=(0,$.jsxs)(_,{children:[c,(0,$.jsx)(v,{className:`fixed left-1/2 top-1/2 z-[90] h-[min(42rem,calc(100vh-2rem))] w-[min(44rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`,children:(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[C,w]})})]}),t[19]=C,t[20]=w,t[21]=T):T=t[21];let E;return t[22]!==r||t[23]!==n||t[24]!==T?(E=(0,$.jsx)(b,{open:n,onOpenChange:r,children:T}),t[22]=r,t[23]=n,t[24]=T,t[25]=E):E=t[25],E}function Re(e){let t=(0,Z.c)(80),{profile:n,language:r,t:i,onChanged:a,bare:o}=e,s=o===void 0?!1:o,c;t[0]===n?c=t[1]:(c=Te(n),t[0]=n,t[1]=c);let l=c,[u,d]=we(l),p;t[2]===u?p=t[3]:(p=Ce(u),t[2]=u,t[3]=p);let m;t[4]===l?m=t[5]:(m=Ce(l),t[4]=l,t[5]=m);let h=p!==m,g;t[6]!==a||t[7]!==n?(g=async e=>{await a((await w({...e,accessibility:n.accessibility})).profile)},t[6]=a,t[7]=n,t[8]=g):g=t[8];let _;t[9]!==u||t[10]!==h||t[11]!==g?(_={value:u,dirty:h,delayMs:500,onSave:g},t[9]=u,t[10]=h,t[11]=g,t[12]=_):_=t[12];let v=fe(_),y;t[13]!==u||t[14]!==d?(y=(e,t,n)=>(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:t}),(0,$.jsx)(`input`,{className:ge,placeholder:n,value:u[e],onChange:t=>d(n=>({...n,[e]:t.target.value}))})]}),t[13]=u,t[14]=d,t[15]=y):y=t[15];let b=y,x=v.onBlurCapture,S;t[16]!==b||t[17]!==i.callName||t[18]!==i.callNamePlaceholder?(S=b(`callName`,i.callName,i.callNamePlaceholder),t[16]=b,t[17]=i.callName,t[18]=i.callNamePlaceholder,t[19]=S):S=t[19];let C;t[20]!==b||t[21]!==i.role||t[22]!==i.rolePlaceholder?(C=b(`role`,i.role,i.rolePlaceholder),t[20]=b,t[21]=i.role,t[22]=i.rolePlaceholder,t[23]=C):C=t[23];let T;t[24]===i.primaryGoal?T=t[25]:(T=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:i.primaryGoal}),t[24]=i.primaryGoal,t[25]=T);let E;t[26]===d?E=t[27]:(E=e=>d(t=>({...t,primaryGoal:e.target.value})),t[26]=d,t[27]=E);let D;t[28]!==u.primaryGoal||t[29]!==i.primaryGoalPlaceholder||t[30]!==E?(D=(0,$.jsx)(`textarea`,{className:ge,rows:3,placeholder:i.primaryGoalPlaceholder,value:u.primaryGoal,onChange:E}),t[28]=u.primaryGoal,t[29]=i.primaryGoalPlaceholder,t[30]=E,t[31]=D):D=t[31];let O;t[32]!==T||t[33]!==D?(O=(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm sm:col-span-2`,children:[T,D]}),t[32]=T,t[33]=D,t[34]=O):O=t[34];let k;t[35]!==b||t[36]!==r||t[37]!==i.pronouns||t[38]!==i.pronounsPlaceholder?(k=r===`en`?b(`pronouns`,i.pronouns,i.pronounsPlaceholder):null,t[35]=b,t[36]=r,t[37]=i.pronouns,t[38]=i.pronounsPlaceholder,t[39]=k):k=t[39];let A;t[40]===i.timezone?A=t[41]:(A=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:i.timezone}),t[40]=i.timezone,t[41]=A);let j;t[42]===d?j=t[43]:(j=e=>d(t=>({...t,timezone:e.target.value})),t[42]=d,t[43]=j);let M;t[44]!==u.timezone||t[45]!==j?(M=(0,$.jsx)(`input`,{className:`${ge} min-w-0 flex-1`,value:u.timezone,onChange:j}),t[44]=u.timezone,t[45]=j,t[46]=M):M=t[46];let N;t[47]===d?N=t[48]:(N=()=>d(ze),t[47]=d,t[48]=N);let P;t[49]!==i.detect||t[50]!==N?(P=(0,$.jsx)(f,{className:`shrink-0 whitespace-nowrap`,onClick:N,children:i.detect}),t[49]=i.detect,t[50]=N,t[51]=P):P=t[51];let F;t[52]!==M||t[53]!==P?(F=(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[M,P]}),t[52]=M,t[53]=P,t[54]=F):F=t[54];let I;t[55]!==A||t[56]!==F?(I=(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[A,F]}),t[55]=A,t[56]=F,t[57]=I):I=t[57];let L;t[58]!==b||t[59]!==i.locale?(L=b(`locale`,i.locale),t[58]=b,t[59]=i.locale,t[60]=L):L=t[60];let R;t[61]!==S||t[62]!==C||t[63]!==O||t[64]!==k||t[65]!==I||t[66]!==L?(R=(0,$.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[S,C,O,k,I,L]}),t[61]=S,t[62]=C,t[63]=O,t[64]=k,t[65]=I,t[66]=L,t[67]=R):R=t[67];let z;t[68]!==v.error||t[69]!==v.status?(z=(0,$.jsx)(`div`,{className:`mt-5 flex justify-end`,children:(0,$.jsx)(de,{status:v.status,error:v.error})}),t[68]=v.error,t[69]=v.status,t[70]=z):z=t[70];let B;t[71]!==v.onBlurCapture||t[72]!==R||t[73]!==z?(B=(0,$.jsxs)(`div`,{onBlurCapture:x,children:[R,z]}),t[71]=v.onBlurCapture,t[72]=R,t[73]=z,t[74]=B):B=t[74];let V=B;if(s)return V;let H;t[75]===i.profileHint?H=t[76]:(H=(0,$.jsx)(`p`,{className:`mb-5 text-sm leading-6 text-fg-muted`,children:i.profileHint}),t[75]=i.profileHint,t[76]=H);let U;return t[77]!==V||t[78]!==H?(U=(0,$.jsxs)(be,{children:[H,V]}),t[77]=V,t[78]=H,t[79]=U):U=t[79],U}function ze(e){return{...e,timezone:re()}}function Be(e){let t=(0,Z.c)(78),{items:n,quality:r,language:i,t:a,onChanged:c}=e,[l,d]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(``),[h,g]=(0,Q.useState)(`preference`),_;t[0]===n?_=t[1]:(_=n.filter(He),t[0]=n,t[1]=_);let v=_,y;t[2]===n?y=t[3]:(y=n.filter(Ve),t[2]=n,t[3]=y);let b=y,x;t[4]!==h||t[5]!==c||t[6]!==p?(x=async e=>{e.preventDefault(),p.trim()&&(await te({statement:p,kind:h}),m(``),d(!1),await c())},t[4]=h,t[5]=c,t[6]=p,t[7]=x):x=t[7];let S=x,C;t[8]===a.understoodHint?C=t[9]:(C=(0,$.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:a.understoodHint}),t[8]=a.understoodHint,t[9]=C);let w,T;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(w=()=>d(!0),T=(0,$.jsx)(u,{className:`size-4`}),t[10]=w,t[11]=T):(w=t[10],T=t[11]);let E;t[12]===a.addUnderstanding?E=t[13]:(E=(0,$.jsxs)(f,{variant:`primary`,onClick:w,children:[T,a.addUnderstanding]}),t[12]=a.addUnderstanding,t[13]=E);let D;t[14]!==C||t[15]!==E?(D=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[C,E]}),t[14]=C,t[15]=E,t[16]=D):D=t[16];let O=a.addUnderstanding,k=a.understoodHint,A=a.add,j=a.cancel,M;t[17]===p?M=t[18]:(M=p.trim(),t[17]=p,t[18]=M);let N=!M,P;t[19]===a.statement?P=t[20]:(P=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:a.statement}),t[19]=a.statement,t[20]=P);let F;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(F=e=>m(e.target.value),t[21]=F):F=t[21];let I;t[22]!==p||t[23]!==a.statement?(I=(0,$.jsx)(`textarea`,{autoFocus:!0,className:ge,rows:4,placeholder:a.statement,value:p,onChange:F}),t[22]=p,t[23]=a.statement,t[24]=I):I=t[24];let L;t[25]!==P||t[26]!==I?(L=(0,$.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[P,I]}),t[25]=P,t[26]=I,t[27]=L):L=t[27];let R;t[28]===a.kind?R=t[29]:(R=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:a.kind}),t[28]=a.kind,t[29]=R);let z,B;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(z=e=>g(e.target.value),B=Object.entries(ve),t[30]=z,t[31]=B):(z=t[30],B=t[31]);let V;t[32]===i?V=t[33]:(V=B.map(e=>{let[t,n]=e;return(0,$.jsx)(s,{value:t,children:n[i]},t)}),t[32]=i,t[33]=V);let H;t[34]!==h||t[35]!==V?(H=(0,$.jsx)(o,{value:h,onChange:z,children:V}),t[34]=h,t[35]=V,t[36]=H):H=t[36];let U;t[37]!==R||t[38]!==H?(U=(0,$.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[R,H]}),t[37]=R,t[38]=H,t[39]=U):U=t[39];let W;t[40]!==l||t[41]!==S||t[42]!==a.add||t[43]!==a.addUnderstanding||t[44]!==a.cancel||t[45]!==a.understoodHint||t[46]!==N||t[47]!==L||t[48]!==U?(W=(0,$.jsxs)(Se,{open:l,onOpenChange:d,title:O,description:k,submitLabel:A,cancelLabel:j,submitDisabled:N,onSubmit:S,children:[L,U]}),t[40]=l,t[41]=S,t[42]=a.add,t[43]=a.addUnderstanding,t[44]=a.cancel,t[45]=a.understoodHint,t[46]=N,t[47]=L,t[48]=U,t[49]=W):W=t[49];let G;t[50]!==r||t[51]!==a?(G=(0,$.jsx)(Ue,{quality:r,t:a}),t[50]=r,t[51]=a,t[52]=G):G=t[52];let K;t[53]===a?K=t[54]:(K=(0,$.jsx)(Ke,{t:a}),t[53]=a,t[54]=K);let ee;t[55]!==i||t[56]!==c||t[57]!==b||t[58]!==a?(ee=b.length?(0,$.jsxs)(`section`,{className:`space-y-2`,children:[(0,$.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[a.review,` · `,b.length]}),(0,$.jsx)(`div`,{className:`divide-y divide-edge overflow-hidden rounded-2xl border border-edge bg-surface-panel`,children:b.map(e=>(0,$.jsx)(Ge,{item:e,language:i,t:a,onChanged:c},e.id))})]}):null,t[55]=i,t[56]=c,t[57]=b,t[58]=a,t[59]=ee):ee=t[59];let q;t[60]!==v.length||t[61]!==a.active?(q=(0,$.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[a.active,` · `,v.length]}),t[60]=v.length,t[61]=a.active,t[62]=q):q=t[62];let J;t[63]!==v||t[64]!==i||t[65]!==c||t[66]!==a?(J=v.length?(0,$.jsx)(`div`,{className:`divide-y divide-edge overflow-hidden rounded-2xl border border-edge bg-surface-panel`,children:v.map(e=>(0,$.jsx)(Ge,{item:e,language:i,t:a,onChanged:c},e.id))}):(0,$.jsx)(xe,{children:a.emptyUnderstanding}),t[63]=v,t[64]=i,t[65]=c,t[66]=a,t[67]=J):J=t[67];let Y;t[68]!==q||t[69]!==J?(Y=(0,$.jsxs)(`section`,{className:`space-y-2`,children:[q,J]}),t[68]=q,t[69]=J,t[70]=Y):Y=t[70];let X;return t[71]!==W||t[72]!==G||t[73]!==K||t[74]!==ee||t[75]!==Y||t[76]!==D?(X=(0,$.jsxs)(`div`,{className:`space-y-5`,children:[D,W,G,K,ee,Y]}),t[71]=W,t[72]=G,t[73]=K,t[74]=ee,t[75]=Y,t[76]=D,t[77]=X):X=t[77],X}function Ve(e){return[`candidate`,`needs_review`,`stale`].includes(e.status)}function He(e){return e.status===`active`}function Ue(e){let t=(0,Z.c)(46),{quality:n,t:r}=e,i;t[0]===r.qualityNoData?i=t[1]:(i=e=>e==null?r.qualityNoData:`${Math.round(e*100)}%`,t[0]=r.qualityNoData,t[1]=i);let a=i,o=r.qualityActive,s=String(n.records.active),c;t[2]!==r.qualityActive||t[3]!==s?(c=[o,s],t[2]=r.qualityActive,t[3]=s,t[4]=c):c=t[4];let l=r.qualityPending,u=String(n.records.candidate+n.records.needsReview),d;t[5]!==r.qualityPending||t[6]!==u?(d=[l,u],t[5]=r.qualityPending,t[6]=u,t[7]=d):d=t[7];let f=r.qualityAcceptance,p;t[8]!==n.decisions.acceptanceRate||t[9]!==a?(p=a(n.decisions.acceptanceRate),t[8]=n.decisions.acceptanceRate,t[9]=a,t[10]=p):p=t[10];let m;t[11]!==r.qualityAcceptance||t[12]!==p?(m=[f,p],t[11]=r.qualityAcceptance,t[12]=p,t[13]=m):m=t[13];let h=r.qualityRecall,g;t[14]!==n.recall.helpfulRate||t[15]!==a?(g=a(n.recall.helpfulRate),t[14]=n.recall.helpfulRate,t[15]=a,t[16]=g):g=t[16];let _;t[17]!==r.qualityRecall||t[18]!==g?(_=[h,g],t[17]=r.qualityRecall,t[18]=g,t[19]=_):_=t[19];let v=r.qualitySourceCoverage,y;t[20]!==n.quickUnderstanding.sourceCoverage||t[21]!==a?(y=a(n.quickUnderstanding.sourceCoverage),t[20]=n.quickUnderstanding.sourceCoverage,t[21]=a,t[22]=y):y=t[22];let b;t[23]!==r.qualitySourceCoverage||t[24]!==y?(b=[v,y],t[23]=r.qualitySourceCoverage,t[24]=y,t[25]=b):b=t[25];let x;t[26]!==n.quickUnderstanding.medianBootstrapDurationMs||t[27]!==r.qualityNoData?(x=n.quickUnderstanding.medianBootstrapDurationMs==null?r.qualityNoData:`${(n.quickUnderstanding.medianBootstrapDurationMs/1e3).toFixed(1)}s`,t[26]=n.quickUnderstanding.medianBootstrapDurationMs,t[27]=r.qualityNoData,t[28]=x):x=t[28];let S;t[29]!==r.qualityBootstrapTime||t[30]!==x?(S=[r.qualityBootstrapTime,x],t[29]=r.qualityBootstrapTime,t[30]=x,t[31]=S):S=t[31];let C;t[32]!==m||t[33]!==_||t[34]!==b||t[35]!==S||t[36]!==c||t[37]!==d?(C=[c,d,m,_,b,S],t[32]=m,t[33]=_,t[34]=b,t[35]=S,t[36]=c,t[37]=d,t[38]=C):C=t[38];let w=C,T;t[39]===r.qualityTitle?T=t[40]:(T=(0,$.jsx)(`h2`,{className:`text-xs font-medium text-fg-muted`,children:r.qualityTitle}),t[39]=r.qualityTitle,t[40]=T);let E;t[41]===w?E=t[42]:(E=w.map(We),t[41]=w,t[42]=E);let D;return t[43]!==T||t[44]!==E?(D=(0,$.jsxs)(`section`,{className:`flex flex-wrap items-center gap-x-5 gap-y-2 rounded-xl bg-surface-muted px-3 py-2.5`,children:[T,E]}),t[43]=T,t[44]=E,t[45]=D):D=t[45],D}function We(e){let[t,n]=e;return(0,$.jsxs)(`div`,{className:`flex items-baseline gap-1.5 text-xs`,children:[(0,$.jsx)(`span`,{className:`text-fg-subtle`,children:t}),(0,$.jsx)(`span`,{className:`font-semibold text-fg`,children:n})]},t)}function Ge(e){let t=(0,Z.c)(60),{item:n,language:r,t:i,onChanged:a}=e,[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(!1),[u,d]=we(n.statement),p=u!==n.statement,m;t[0]===i.required?m=t[1]:(m=e=>e.trim()?null:i.required,t[0]=i.required,t[1]=m);let h;t[2]!==n.id||t[3]!==a?(h=async e=>{await a((await z(n.id,{statement:e})).understanding)},t[2]=n.id,t[3]=a,t[4]=h):h=t[4];let g;t[5]!==u||t[6]!==o||t[7]!==p||t[8]!==m||t[9]!==h?(g={value:u,dirty:p,enabled:o,delayMs:500,validate:m,onSave:h},t[5]=u,t[6]=o,t[7]=p,t[8]=m,t[9]=h,t[10]=g):g=t[10];let _=fe(g),v;t[11]!==u||t[12]!==o||t[13]!==d?(v=o?(0,$.jsx)(`textarea`,{autoFocus:!0,className:ge,value:u,onChange:e=>d(e.target.value),rows:3}):(0,$.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:u}),t[11]=u,t[12]=o,t[13]=d,t[14]=v):v=t[14];let y=ve[n.kind][r],b;t[15]===y?b=t[16]:(b=(0,$.jsx)(`span`,{children:y}),t[15]=y,t[16]=b);let x;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,$.jsx)(`span`,{children:`·`}),t[17]=x):x=t[17];let S=n.explicitness===`explicit`?i.sourceExplicit:n.explicitness===`observed`?i.sourceObserved:i.sourceInferred,C;t[18]===S?C=t[19]:(C=(0,$.jsx)(`span`,{children:S}),t[18]=S,t[19]=C);let w;t[20]!==C||t[21]!==b?(w=(0,$.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-2 text-[11px] text-fg-subtle`,children:[b,x,C]}),t[20]=C,t[21]=b,t[22]=w):w=t[22];let T;t[23]!==w||t[24]!==v?(T=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[v,w]}),t[23]=w,t[24]=v,t[25]=T):T=t[25];let E;t[26]!==_||t[27]!==o||t[28]!==i.done||t[29]!==i.edit?(E=o?(0,$.jsx)(f,{variant:`ghost`,onClick:()=>{_.flush(),s(!1)},children:i.done}):(0,$.jsxs)(f,{variant:`ghost`,onClick:()=>s(!0),children:[(0,$.jsx)(I,{className:`size-3.5`}),i.edit]}),t[26]=_,t[27]=o,t[28]=i.done,t[29]=i.edit,t[30]=E):E=t[30];let D;t[31]!==n.id||t[32]!==n.status||t[33]!==a||t[34]!==i.confirm||t[35]!==i.reject?(D=n.status===`active`?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(f,{variant:`primary`,onClick:async()=>{await a((await z(n.id,{status:`active`})).understanding)},children:i.confirm}),(0,$.jsx)(f,{onClick:async()=>{await a((await z(n.id,{status:`rejected`})).understanding)},children:i.reject})]}),t[31]=n.id,t[32]=n.status,t[33]=a,t[34]=i.confirm,t[35]=i.reject,t[36]=D):D=t[36];let O;t[37]!==c||t[38]!==n.id||t[39]!==a?(O=async()=>{if(!c){l(!0);return}await B(n.id),l(!1),await a()},t[37]=c,t[38]=n.id,t[39]=a,t[40]=O):O=t[40];let k;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,$.jsx)(ae,{className:`size-3.5`}),t[41]=k):k=t[41];let A=c?i.confirmDelete:i.delete,j;t[42]!==O||t[43]!==A?(j=(0,$.jsxs)(f,{variant:`ghost`,className:`text-danger`,onClick:O,children:[k,A]}),t[42]=O,t[43]=A,t[44]=j):j=t[44];let M;t[45]!==E||t[46]!==D||t[47]!==j?(M=(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-1 sm:justify-end`,children:[E,D,j]}),t[45]=E,t[46]=D,t[47]=j,t[48]=M):M=t[48];let N;t[49]!==T||t[50]!==M?(N=(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-start sm:gap-4`,children:[T,M]}),t[49]=T,t[50]=M,t[51]=N):N=t[51];let P;t[52]!==_.error||t[53]!==_.status||t[54]!==o?(P=o||_.status!==`idle`?(0,$.jsx)(de,{className:`mt-2`,status:_.status,error:_.error}):null,t[52]=_.error,t[53]=_.status,t[54]=o,t[55]=P):P=t[55];let F;return t[56]!==_.onBlurCapture||t[57]!==N||t[58]!==P?(F=(0,$.jsx)(`article`,{className:`px-4 py-3 sm:px-5`,children:(0,$.jsxs)(`div`,{onBlurCapture:_.onBlurCapture,children:[N,P]})}),t[56]=_.onBlurCapture,t[57]=N,t[58]=P,t[59]=F):F=t[59],F}function Ke(e){let t=(0,Z.c)(35),{t:n}=e,{data:r,error:i,isLoading:a,mutate:o}=x(`you-focuses`,G),[s,c]=(0,Q.useState)(null);if(a){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(P,{className:`h-40 rounded-2xl`}),t[0]=e):e=t[0],e}if(i){let e;return t[1]===n.error?e=t[2]:(e=(0,$.jsx)(xe,{children:n.error}),t[1]=n.error,t[2]=e),e}let l;if(t[3]!==r||t[4]!==s||t[5]!==o||t[6]!==n.activate||t[7]!==n.complete||t[8]!==n.confidence||t[9]!==n.confidenceHigh||t[10]!==n.confidenceLow||t[11]!==n.confidenceMedium||t[12]!==n.confirmDelete||t[13]!==n.delete||t[14]!==n.focusActive||t[15]!==n.focusCandidate||t[16]!==n.focusCompleted||t[17]!==n.focusHint||t[18]!==n.focusPaused||t[19]!==n.focuses||t[20]!==n.noFocuses||t[21]!==n.pause||t[22]!==n.reject){let e=(r??[]).filter(qe),i;t[24]!==n.focusActive||t[25]!==n.focusCandidate||t[26]!==n.focusCompleted||t[27]!==n.focusPaused?(i=e=>e===`candidate`?n.focusCandidate:e===`active`?n.focusActive:e===`paused`?n.focusPaused:n.focusCompleted,t[24]=n.focusActive,t[25]=n.focusCandidate,t[26]=n.focusCompleted,t[27]=n.focusPaused,t[28]=i):i=t[28];let a=i,u;t[29]!==n.confidenceHigh||t[30]!==n.confidenceLow||t[31]!==n.confidenceMedium?(u=e=>e>=.85?n.confidenceHigh:e>=.65?n.confidenceMedium:n.confidenceLow,t[29]=n.confidenceHigh,t[30]=n.confidenceLow,t[31]=n.confidenceMedium,t[32]=u):u=t[32];let d=u,p;t[33]===n.focusHint?p=t[34]:(p=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n.focusHint}),t[33]=n.focusHint,t[34]=p),l=(0,$.jsxs)(`section`,{className:`space-y-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[n.focuses,` · `,e.length]}),p]}),e.length?(0,$.jsx)(`div`,{className:`divide-y divide-edge overflow-hidden rounded-2xl border border-edge bg-surface-panel`,children:e.map(e=>(0,$.jsxs)(`article`,{className:`flex flex-col gap-3 px-4 py-3 sm:flex-row sm:items-center sm:px-5`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:e.title}),(0,$.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-[11px] text-fg-muted`,children:a(e.status)}),(0,$.jsxs)(`span`,{className:`text-[11px] text-fg-subtle`,children:[n.confidence,` · `,d(e.confidence)]})]}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-5 text-fg-muted`,children:e.summary})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-1 sm:justify-end`,children:[e.status===`active`?(0,$.jsx)(f,{onClick:async()=>{await M(e.id,`paused`),await o()},children:n.pause}):(0,$.jsx)(f,{variant:`primary`,onClick:async()=>{await M(e.id,`active`),await o()},children:n.activate}),(0,$.jsx)(f,{variant:`ghost`,onClick:async()=>{await M(e.id,`completed`),await o()},children:n.complete}),e.status===`candidate`?(0,$.jsx)(f,{variant:`ghost`,className:`text-danger`,onClick:async()=>{await M(e.id,`rejected`),await o()},children:n.reject}):null,(0,$.jsxs)(f,{variant:`ghost`,className:`text-danger`,onClick:async()=>{if(s!==e.id){c(e.id);return}await K(e.id),c(null),await o()},children:[(0,$.jsx)(ae,{className:`size-3.5`}),s===e.id?n.confirmDelete:n.delete]})]})]},e.id))}):(0,$.jsx)(xe,{children:n.noFocuses})]}),t[3]=r,t[4]=s,t[5]=o,t[6]=n.activate,t[7]=n.complete,t[8]=n.confidence,t[9]=n.confidenceHigh,t[10]=n.confidenceLow,t[11]=n.confidenceMedium,t[12]=n.confirmDelete,t[13]=n.delete,t[14]=n.focusActive,t[15]=n.focusCandidate,t[16]=n.focusCompleted,t[17]=n.focusHint,t[18]=n.focusPaused,t[19]=n.focuses,t[20]=n.noFocuses,t[21]=n.pause,t[22]=n.reject,t[23]=l}else l=t[23];return l}function qe(e){return e.status!==`rejected`}function Je(e){let t=(0,Z.c)(80),{rules:n,language:r,t:i,onChanged:a}=e,[c,l]=(0,Q.useState)(!1),[d,p]=(0,Q.useState)(``),[m,h]=(0,Q.useState)(`communication`),[g,_]=(0,Q.useState)(null),v,y,b,x,S,C;if(t[0]!==c||t[1]!==m||t[2]!==g||t[3]!==r||t[4]!==a||t[5]!==n||t[6]!==d||t[7]!==i.add||t[8]!==i.addRule||t[9]!==i.cancel||t[10]!==i.category||t[11]!==i.collaboration||t[12]!==i.confirmDelete||t[13]!==i.delete||t[14]!==i.disable||t[15]!==i.emptyRules||t[16]!==i.enable||t[17]!==i.ruleStatement||t[18]!==i.rulesHint){let e=n.filter(Ye),w;t[25]!==m||t[26]!==a||t[27]!==d?(w=async e=>{e.preventDefault(),d.trim()&&(await L({statement:d,category:m}),p(``),l(!1),await a())},t[25]=m,t[26]=a,t[27]=d,t[28]=w):w=t[28];let T=w;x=`space-y-5`;let E;t[29]===i.rulesHint?E=t[30]:(E=(0,$.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:i.rulesHint}),t[29]=i.rulesHint,t[30]=E);let D,O;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(O=()=>l(!0),D=(0,$.jsx)(u,{className:`size-4`}),t[31]=D,t[32]=O):(D=t[31],O=t[32]);let k;t[33]===i.addRule?k=t[34]:(k=(0,$.jsxs)(f,{variant:`primary`,onClick:O,children:[D,i.addRule]}),t[33]=i.addRule,t[34]=k),t[35]!==k||t[36]!==E?(S=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[E,k]}),t[35]=k,t[36]=E,t[37]=S):S=t[37];let A=i.addRule,j=i.rulesHint,M=i.add,N=i.cancel,P;t[38]===d?P=t[39]:(P=d.trim(),t[38]=d,t[39]=P);let F=!P,I;t[40]===i.ruleStatement?I=t[41]:(I=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:i.ruleStatement}),t[40]=i.ruleStatement,t[41]=I);let R;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(R=e=>p(e.target.value),t[42]=R):R=t[42];let z;t[43]!==d||t[44]!==i.ruleStatement?(z=(0,$.jsx)(`textarea`,{autoFocus:!0,className:ge,rows:4,placeholder:i.ruleStatement,value:d,onChange:R}),t[43]=d,t[44]=i.ruleStatement,t[45]=z):z=t[45];let B;t[46]!==I||t[47]!==z?(B=(0,$.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[I,z]}),t[46]=I,t[47]=z,t[48]=B):B=t[48];let V;t[49]===i.category?V=t[50]:(V=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:i.category}),t[49]=i.category,t[50]=V);let H,U;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(H=e=>h(e.target.value),U=Object.entries(ye),t[51]=H,t[52]=U):(H=t[51],U=t[52]);let W;t[53]===r?W=t[54]:(W=U.map(e=>{let[t,n]=e;return(0,$.jsx)(s,{value:t,children:n[r]},t)}),t[53]=r,t[54]=W);let G;t[55]!==m||t[56]!==W?(G=(0,$.jsx)(o,{value:m,onChange:H,children:W}),t[55]=m,t[56]=W,t[57]=G):G=t[57];let K;t[58]!==V||t[59]!==G?(K=(0,$.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[V,G]}),t[58]=V,t[59]=G,t[60]=K):K=t[60],t[61]!==c||t[62]!==T||t[63]!==i.add||t[64]!==i.addRule||t[65]!==i.cancel||t[66]!==i.rulesHint||t[67]!==F||t[68]!==B||t[69]!==K?(C=(0,$.jsxs)(Se,{open:c,onOpenChange:l,title:A,description:j,submitLabel:M,cancelLabel:N,submitDisabled:F,onSubmit:T,children:[B,K]}),t[61]=c,t[62]=T,t[63]=i.add,t[64]=i.addRule,t[65]=i.cancel,t[66]=i.rulesHint,t[67]=F,t[68]=B,t[69]=K,t[70]=C):C=t[70],v=`space-y-2`,y=(0,$.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[i.collaboration,` · `,e.length]}),b=e.length?(0,$.jsx)(`div`,{className:`divide-y divide-edge overflow-hidden rounded-2xl border border-edge bg-surface-panel`,children:e.map(e=>(0,$.jsxs)(`article`,{className:`flex flex-col gap-2 px-4 py-3 sm:flex-row sm:items-start sm:gap-4 sm:px-5`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`p`,{className:`text-sm leading-6 ${e.status===`disabled`?`text-fg-subtle line-through`:`text-fg`}`,children:e.statement}),(0,$.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-2 text-[11px] text-fg-subtle`,children:[(0,$.jsx)(`span`,{children:ye[e.category][r]}),(0,$.jsx)(`span`,{children:`·`}),(0,$.jsxs)(`span`,{children:[`P`,e.priority]}),e.status===`disabled`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{children:`·`}),(0,$.jsx)(`span`,{children:i.disable})]}):null]})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-1 sm:justify-end`,children:[(0,$.jsx)(f,{variant:`ghost`,onClick:async()=>{await le(e.id,{status:e.status===`active`?`disabled`:`active`}),await a()},children:e.status===`active`?i.disable:i.enable}),(0,$.jsxs)(f,{variant:`ghost`,className:`text-danger`,onClick:async()=>{if(g!==e.id){_(e.id);return}await ne(e.id),_(null),await a()},children:[(0,$.jsx)(ae,{className:`size-3.5`}),g===e.id?i.confirmDelete:i.delete]})]})]},e.id))}):(0,$.jsx)(xe,{children:i.emptyRules}),t[0]=c,t[1]=m,t[2]=g,t[3]=r,t[4]=a,t[5]=n,t[6]=d,t[7]=i.add,t[8]=i.addRule,t[9]=i.cancel,t[10]=i.category,t[11]=i.collaboration,t[12]=i.confirmDelete,t[13]=i.delete,t[14]=i.disable,t[15]=i.emptyRules,t[16]=i.enable,t[17]=i.ruleStatement,t[18]=i.rulesHint,t[19]=v,t[20]=y,t[21]=b,t[22]=x,t[23]=S,t[24]=C}else v=t[19],y=t[20],b=t[21],x=t[22],S=t[23],C=t[24];let w;t[71]!==v||t[72]!==y||t[73]!==b?(w=(0,$.jsxs)(`section`,{className:v,children:[y,b]}),t[71]=v,t[72]=y,t[73]=b,t[74]=w):w=t[74];let T;return t[75]!==x||t[76]!==S||t[77]!==C||t[78]!==w?(T=(0,$.jsxs)(`div`,{className:x,children:[S,C,w]}),t[75]=x,t[76]=S,t[77]=C,t[78]=w,t[79]=T):T=t[79],T}function Ye(e){return e.status!==`archived`}async function Xe(){let[e,t,n]=await Promise.all([H(),N(),ce()]);return{...e,connectors:t,catalog:n}}function Ze({t:e}){let{data:t,error:n,isLoading:r,mutate:i}=x(`you-understanding-sources`,Xe,{refreshInterval:5e3}),{data:o=[],mutate:s}=x(`you-connected-content-candidates`,V),[u,d]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)([]),[_,v]=(0,Q.useState)(!1),[y,b]=(0,Q.useState)(null);if(r)return(0,$.jsx)(P,{className:`h-64 rounded-2xl`});if(n)return(0,$.jsxs)(xe,{children:[e.error,` `,(0,$.jsx)(`button`,{className:`text-accent hover:underline`,onClick:()=>void i(),children:e.retry})]});let S=t?.grants??[],C=t?.connectors??[],w=new Map((t?.catalog??[]).map(e=>[e.id,e])),T=t?.latestRuns??{},E=t=>t?t.status===`completed`?e.sourceCompleted:t.status===`partial`?e.sourcePartial:t.status===`failed`||t.status===`canceled`?e.sourceFailed:t.status===`running`?e.sourceRunning:e.sourceQueued:e.sourceNotRun,D=e=>e?e.status===`completed`?`bg-success-soft text-success`:e.status===`partial`?`bg-warning-soft text-warning`:e.status===`failed`||e.status===`canceled`?`bg-danger/10 text-danger`:`bg-accent-soft text-accent-fg`:`bg-surface-muted text-fg-muted`,O=t=>t===`connected_account_unavailable`?e.sourceAccountUnavailable:t===`connected_source_sync_failed`?e.sourceSyncFailed:t===`connected_source_analysis_failed`?e.sourceAnalysisFailed:t,k=e=>{let t=e.displayName.trim().toLocaleLowerCase(),n=C.find(e=>e.displayName.trim().toLocaleLowerCase()===t);return n?w.get(n.connectorId):[...w.values()].find(n=>n.displayName.trim().toLocaleLowerCase()===t||e.sourceKey.toLocaleLowerCase().includes(n.id.toLocaleLowerCase()))},j=t=>`${e.actionFailed}: ${t instanceof Error?t.message:String(t)}`,M=async t=>{b(null),m(null),d({grantId:t.id,kind:`refresh`});try{await F(t.id),await i().catch(()=>void 0),b({tone:`success`,message:`${t.displayName}: ${e.refreshStarted}`})}catch(e){b({tone:`error`,message:j(e)})}finally{d(null)}},N=async t=>{if(p!==t.id){m(t.id),b(null);return}d({grantId:t.id,kind:`revoke`});try{await ie(t.id),await i().catch(()=>void 0),m(null),b({tone:`success`,message:`${t.displayName}: ${e.revokeDone}`})}catch(e){b({tone:`error`,message:j(e)})}finally{d(null)}},I=async()=>{if(h.length){v(!0),b(null);try{let t=await W(h);t.result.failed.length?b({tone:`error`,message:t.result.failed.map(e=>e.error).join(`; `)}):b({tone:`success`,message:e.contentReadDone}),g([]),await s()}catch(e){b({tone:`error`,message:j(e)})}finally{v(!1)}}};return(0,$.jsxs)(`div`,{className:`space-y-5`,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,$.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:e.sourcesHint}),(0,$.jsx)(f,{asChild:!0,variant:`primary`,children:(0,$.jsxs)(a,{to:`/connectors?understanding=1&returnTo=%2Fyou%3Ftab%3Dsources`,children:[e.manageSources,(0,$.jsx)(c,{className:`size-4`})]})})]}),y?(0,$.jsx)(`p`,{role:`status`,"aria-live":`polite`,className:`rounded-xl px-3 py-2 text-sm ${y.tone===`success`?`bg-success-soft text-success`:`bg-danger/10 text-danger`}`,children:y.message}):null,(0,$.jsxs)(`section`,{className:`space-y-2`,children:[(0,$.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[e.authorizedSources,` · `,S.length]}),S.length?(0,$.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:S.map(t=>{let n=k(t),r=T[t.id],i=typeof r?.metadata.candidatesCreated==`number`?r.metadata.candidatesCreated:0,a=O(r?.errorMessage??(typeof r?.metadata.semanticError==`string`?r.metadata.semanticError:void 0));return(0,$.jsxs)(`article`,{className:`flex min-h-28 items-start gap-3 rounded-2xl border border-edge bg-surface-panel p-4`,children:[n?(0,$.jsx)(oe,{connector:n,size:`sm`}):(0,$.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg border border-edge bg-surface-base`,children:(0,$.jsx)(J,{className:`size-4 text-fg-muted`})}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,$.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:t.displayName}),(0,$.jsx)(`span`,{className:`shrink-0 rounded-full px-2 py-0.5 text-[11px] ${D(r)}`,children:E(r)})]}),(0,$.jsxs)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:[t.accessMode===`continuous`?e.continuous:e.once,` · `,t.processingPolicy===`local_only`?e.localOnly:t.retentionPolicy===`derived_only`?e.derivedOnly:t.retentionPolicy]}),r?(0,$.jsxs)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:[r.itemsSeen,` `,e.sourceItems,i?` · ${i} ${e.sourceCandidates}`:``,` · `,new Date(r.completedAt??r.startedAt).toLocaleString()]}):t.lastCollectedAt?(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:new Date(t.lastCollectedAt).toLocaleString()}):null,a?(0,$.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-danger`,title:a,children:a}):null]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-1`,children:[t.accessMode===`continuous`?(0,$.jsx)(f,{variant:`ghost`,disabled:u!==null,"aria-busy":u?.grantId===t.id&&u.kind===`refresh`,onClick:()=>void M(t),children:u?.grantId===t.id&&u.kind===`refresh`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(l,{className:`size-4 animate-spin`}),e.refreshing]}):e.refresh}):null,(0,$.jsx)(f,{variant:`ghost`,className:`text-danger`,title:e.revokeHint,"aria-label":`${e.revoke}: ${t.displayName}`,disabled:u!==null,"aria-busy":u?.grantId===t.id&&u.kind===`revoke`,onClick:()=>void N(t),children:u?.grantId===t.id&&u.kind===`revoke`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(l,{className:`size-4 animate-spin`}),e.revoking]}):p===t.id?e.confirmRevoke:e.revoke})]})]},t.id)})}):(0,$.jsx)(xe,{children:e.noSources})]}),o.length?(0,$.jsxs)(`section`,{className:`space-y-2`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.contentReadTitle}),(0,$.jsx)(`p`,{className:`mt-1 max-w-2xl text-xs leading-5 text-fg-muted`,children:e.contentReadHint})]}),(0,$.jsx)(f,{variant:`primary`,disabled:!h.length||_,onClick:()=>void I(),children:_?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(l,{className:`size-4 animate-spin`}),e.reading]}):`${e.readSelected} · ${h.length}`})]}),(0,$.jsx)(`div`,{className:`divide-y divide-edge overflow-hidden rounded-2xl border border-edge bg-surface-panel`,children:o.map(e=>{let t=h.includes(e.sourceItemId),n=h.length>=5&&!t;return(0,$.jsxs)(`label`,{className:`flex items-center gap-3 px-4 py-3 ${n?`opacity-50`:`cursor-pointer hover:bg-surface-hover`}`,children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`size-4 rounded border-edge accent-[var(--color-accent)]`,checked:t,disabled:n||_,onChange:t=>g(n=>t.target.checked?[...n,e.sourceItemId]:n.filter(t=>t!==e.sourceItemId))}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`p`,{className:`truncate text-sm text-fg`,children:e.title}),(0,$.jsxs)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:[e.toolkit===`gmail`?`Gmail`:`Google Drive`,e.occurredAt?` · ${new Date(e.occurredAt).toLocaleDateString()}`:``]})]})]},e.sourceItemId)})})]}):null,(0,$.jsxs)(`section`,{className:`space-y-2`,children:[(0,$.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[e.connectorsTitle,` · `,C.length]}),C.length?(0,$.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:C.map(t=>{let n=t.enabled&&(t.status===`connected`||t.connectionStatus===`connected`||t.authStatus===`connected`),r=w.get(t.connectorId);return(0,$.jsxs)(a,{to:`/connectors?tab=connected&instance=${encodeURIComponent(t.instanceId)}`,"aria-label":`${e.openConnector}: ${t.displayName}`,className:`group flex min-h-24 items-center gap-3 rounded-2xl border border-edge bg-surface-panel p-4 transition-colors hover:border-edge-strong hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,children:[(0,$.jsx)(oe,{connector:r??{displayName:t.displayName}}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:t.displayName}),(0,$.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:t.connectorId})]}),(0,$.jsx)(`span`,{className:`shrink-0 rounded-full px-2 py-1 text-xs ${n?`bg-success-soft text-success`:`bg-warning-soft text-warning`}`,children:n?e.connected:e.unavailable}),(0,$.jsx)(A,{className:`size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5`})]},t.instanceId)})}):(0,$.jsx)(xe,{children:e.noConnectors})]})]})}function Qe(e){let t=(0,Z.c)(115),{lastRun:n,t:r}=e,{data:i,error:a,isLoading:c,mutate:l}=x(`you-context-settings`,ee),u=i?.dreaming??null,[d,p]=we(u),m;t[0]!==d||t[1]!==u?(m=d&&u&&Ce(d)!==Ce(u),t[0]=d,t[1]=u,t[2]=m):m=t[2];let h=!!m,g;t[3]===l?g=t[4]:(g=async e=>{await se({dreaming:e}),await l()},t[3]=l,t[4]=g);let _;t[5]!==d||t[6]!==h||t[7]!==g?(_={value:d,dirty:h,delayMs:500,onSave:g},t[5]=d,t[6]=h,t[7]=g,t[8]=_):_=t[8];let v=fe(_);if(a){let e;t[9]===l?e=t[10]:(e=()=>void l(),t[9]=l,t[10]=e);let n;t[11]!==r.retry||t[12]!==e?(n=(0,$.jsx)(`button`,{className:`text-accent hover:underline`,onClick:e,children:r.retry}),t[11]=r.retry,t[12]=e,t[13]=n):n=t[13];let i;return t[14]!==r.error||t[15]!==n?(i=(0,$.jsxs)(xe,{children:[r.error,` `,n]}),t[14]=r.error,t[15]=n,t[16]=i):i=t[16],i}if(c||!d){let e;return t[17]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(P,{className:`h-72 rounded-2xl`}),t[17]=e):e=t[17],e}let y=n?.status===`completed`?r.runCompleted:n?.status===`failed`?r.runFailed:r.runRunning,b;t[18]===r.dreamingHint?b=t[19]:(b=(0,$.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:r.dreamingHint}),t[18]=r.dreamingHint,t[19]=b);let S=v.onBlurCapture,C;t[20]===r.mode?C=t[21]:(C=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:r.mode}),t[20]=r.mode,t[21]=C);let w;t[22]===p?w=t[23]:(w=e=>p(t=>t&&{...t,mode:e.target.value}),t[22]=p,t[23]=w);let T;t[24]===r.on?T=t[25]:(T=(0,$.jsx)(s,{value:`review`,children:r.on}),t[24]=r.on,t[25]=T);let E;t[26]===r.off?E=t[27]:(E=(0,$.jsx)(s,{value:`off`,children:r.off}),t[26]=r.off,t[27]=E);let D;t[28]!==d.mode||t[29]!==E||t[30]!==w||t[31]!==T?(D=(0,$.jsxs)(o,{value:d.mode,onChange:w,children:[T,E]}),t[28]=d.mode,t[29]=E,t[30]=w,t[31]=T,t[32]=D):D=t[32];let O;t[33]!==D||t[34]!==C?(O=(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[C,D]}),t[33]=D,t[34]=C,t[35]=O):O=t[35];let k;t[36]===r.reviewTime?k=t[37]:(k=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:r.reviewTime}),t[36]=r.reviewTime,t[37]=k);let A;t[38]===p?A=t[39]:(A=e=>p(t=>t&&{...t,schedule:{time:e.target.value}}),t[38]=p,t[39]=A);let j;t[40]!==d.schedule.time||t[41]!==A?(j=(0,$.jsx)(`input`,{type:`time`,className:ge,value:d.schedule.time,onChange:A}),t[40]=d.schedule.time,t[41]=A,t[42]=j):j=t[42];let M;t[43]!==k||t[44]!==j?(M=(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[k,j]}),t[43]=k,t[44]=j,t[45]=M):M=t[45];let N;t[46]===r.timezone?N=t[47]:(N=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:r.timezone}),t[46]=r.timezone,t[47]=N);let F=d.timezone??``,I,L;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(I=re(),L=re(),t[48]=I,t[49]=L):(I=t[48],L=t[49]);let R,z;t[50]===p?(R=t[51],z=t[52]):(R=e=>p(t=>t&&{...t,timezone:e}),z=e=>p(t=>t&&{...t,timezone:e.target.value||void 0}),t[50]=p,t[51]=R,t[52]=z);let B;t[53]!==F||t[54]!==R||t[55]!==z?(B=(0,$.jsx)(pe,{className:`${ge} min-w-0 flex-1`,value:F,placeholder:I,suggestion:L,onAcceptSuggestion:R,onChange:z}),t[53]=F,t[54]=R,t[55]=z,t[56]=B):B=t[56];let V;t[57]===p?V=t[58]:(V=()=>p($e),t[57]=p,t[58]=V);let H;t[59]!==r.detect||t[60]!==V?(H=(0,$.jsx)(f,{className:`shrink-0 whitespace-nowrap`,onClick:V,children:r.detect}),t[59]=r.detect,t[60]=V,t[61]=H):H=t[61];let U;t[62]!==B||t[63]!==H?(U=(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[B,H]}),t[62]=B,t[63]=H,t[64]=U):U=t[64];let W;t[65]!==N||t[66]!==U?(W=(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm sm:col-span-2`,children:[N,U]}),t[65]=N,t[66]=U,t[67]=W):W=t[67];let G;t[68]===r.evidenceThreshold?G=t[69]:(G=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:r.evidenceThreshold}),t[68]=r.evidenceThreshold,t[69]=G);let K;t[70]===p?K=t[71]:(K=e=>p(t=>t&&{...t,minEvidenceSources:Number(e.target.value)}),t[70]=p,t[71]=K);let te;t[72]!==d.minEvidenceSources||t[73]!==K?(te=(0,$.jsx)(`input`,{type:`number`,min:2,max:10,className:ge,value:d.minEvidenceSources,onChange:K}),t[72]=d.minEvidenceSources,t[73]=K,t[74]=te):te=t[74];let q;t[75]!==G||t[76]!==te?(q=(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[G,te]}),t[75]=G,t[76]=te,t[77]=q):q=t[77];let J;t[78]===r.scanLimit?J=t[79]:(J=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:r.scanLimit}),t[78]=r.scanLimit,t[79]=J);let Y;t[80]===p?Y=t[81]:(Y=e=>p(t=>t&&{...t,limit:Number(e.target.value)}),t[80]=p,t[81]=Y);let X;t[82]!==d.limit||t[83]!==Y?(X=(0,$.jsx)(`input`,{type:`number`,min:1,max:2e3,className:ge,value:d.limit,onChange:Y}),t[82]=d.limit,t[83]=Y,t[84]=X):X=t[84];let ne;t[85]!==J||t[86]!==X?(ne=(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[J,X]}),t[85]=J,t[86]=X,t[87]=ne):ne=t[87];let ie;t[88]!==O||t[89]!==M||t[90]!==W||t[91]!==q||t[92]!==ne?(ie=(0,$.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[O,M,W,q,ne]}),t[88]=O,t[89]=M,t[90]=W,t[91]=q,t[92]=ne,t[93]=ie):ie=t[93];let ae;t[94]!==v.error||t[95]!==v.status?(ae=(0,$.jsx)(`div`,{className:`mt-5 flex justify-end`,children:(0,$.jsx)(de,{status:v.status,error:v.error})}),t[94]=v.error,t[95]=v.status,t[96]=ae):ae=t[96];let oe;t[97]!==v.onBlurCapture||t[98]!==ie||t[99]!==ae?(oe=(0,$.jsx)(be,{children:(0,$.jsxs)(`div`,{onBlurCapture:S,children:[ie,ae]})}),t[97]=v.onBlurCapture,t[98]=ie,t[99]=ae,t[100]=oe):oe=t[100];let ce;t[101]===r.lastRun?ce=t[102]:(ce=(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:r.lastRun}),t[101]=r.lastRun,t[102]=ce);let le;t[103]!==n||t[104]!==y||t[105]!==r.neverRun||t[106]!==r.runItems?(le=n?(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-sm text-fg-muted`,children:[(0,$.jsx)(`span`,{children:y}),(0,$.jsx)(`span`,{children:`·`}),(0,$.jsx)(`time`,{children:new Date(n.startedAt).toLocaleString()}),typeof n.metrics.scanned==`number`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{children:`·`}),(0,$.jsxs)(`span`,{children:[String(n.metrics.scanned),` `,r.runItems]})]}):null]}):(0,$.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:r.neverRun}),t[103]=n,t[104]=y,t[105]=r.neverRun,t[106]=r.runItems,t[107]=le):le=t[107];let ue;t[108]!==ce||t[109]!==le?(ue=(0,$.jsxs)(be,{children:[ce,le]}),t[108]=ce,t[109]=le,t[110]=ue):ue=t[110];let me;return t[111]!==oe||t[112]!==ue||t[113]!==b?(me=(0,$.jsxs)(`div`,{className:`space-y-5`,children:[b,oe,ue]}),t[111]=oe,t[112]=ue,t[113]=b,t[114]=me):me=t[114],me}function $e(e){return e&&{...e,timezone:re()}}function et(e){let t=(0,Z.c)(49),{t:n}=e,{data:r,error:i,isLoading:a,mutate:c}=x(`you-context-settings`,ee),l=r?.privacy.sensitiveWritePolicy??null,[u,d]=we(l),f=!!(u&&l&&u!==l),p;t[0]===c?p=t[1]:(p=async e=>{await se({privacy:{sensitiveWritePolicy:e}}),await c()},t[0]=c,t[1]=p);let m;t[2]!==u||t[3]!==f||t[4]!==p?(m={value:u,dirty:f,delayMs:350,onSave:p},t[2]=u,t[3]=f,t[4]=p,t[5]=m):m=t[5];let h=fe(m);if(i){let e;t[6]===c?e=t[7]:(e=()=>void c(),t[6]=c,t[7]=e);let r;t[8]!==n.retry||t[9]!==e?(r=(0,$.jsx)(`button`,{className:`text-accent hover:underline`,onClick:e,children:n.retry}),t[8]=n.retry,t[9]=e,t[10]=r):r=t[10];let i;return t[11]!==n.error||t[12]!==r?(i=(0,$.jsxs)(xe,{children:[n.error,` `,r]}),t[11]=n.error,t[12]=r,t[13]=i):i=t[13],i}if(a||!u){let e;return t[14]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(P,{className:`h-56 rounded-2xl`}),t[14]=e):e=t[14],e}let g;t[15]===n.privacyHint?g=t[16]:(g=(0,$.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:n.privacyHint}),t[15]=n.privacyHint,t[16]=g);let _;t[17]===n.sensitivePolicy?_=t[18]:(_=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:n.sensitivePolicy}),t[17]=n.sensitivePolicy,t[18]=_);let v;t[19]===d?v=t[20]:(v=e=>d(e.target.value),t[19]=d,t[20]=v);let y;t[21]===n.policyDeny?y=t[22]:(y=(0,$.jsx)(s,{value:`deny`,children:n.policyDeny}),t[21]=n.policyDeny,t[22]=y);let b;t[23]===n.policyConfirm?b=t[24]:(b=(0,$.jsx)(s,{value:`confirm`,children:n.policyConfirm}),t[23]=n.policyConfirm,t[24]=b);let S;t[25]===n.policyAllow?S=t[26]:(S=(0,$.jsx)(s,{value:`allow`,children:n.policyAllow}),t[25]=n.policyAllow,t[26]=S);let C;t[27]!==u||t[28]!==v||t[29]!==y||t[30]!==b||t[31]!==S?(C=(0,$.jsxs)(o,{value:u,onChange:v,children:[y,b,S]}),t[27]=u,t[28]=v,t[29]=y,t[30]=b,t[31]=S,t[32]=C):C=t[32];let w;t[33]!==C||t[34]!==_?(w=(0,$.jsxs)(`label`,{className:`block max-w-xl space-y-1.5 text-sm`,children:[_,C]}),t[33]=C,t[34]=_,t[35]=w):w=t[35];let T;t[36]===n.privacyWarning?T=t[37]:(T=(0,$.jsx)(`p`,{className:`mt-3 max-w-2xl text-xs leading-5 text-fg-subtle`,children:n.privacyWarning}),t[36]=n.privacyWarning,t[37]=T);let E;t[38]!==h.error||t[39]!==h.status?(E=(0,$.jsx)(`div`,{className:`mt-5 flex justify-end`,children:(0,$.jsx)(de,{status:h.status,error:h.error})}),t[38]=h.error,t[39]=h.status,t[40]=E):E=t[40];let D;t[41]!==h.onBlurCapture||t[42]!==w||t[43]!==T||t[44]!==E?(D=(0,$.jsx)(be,{children:(0,$.jsxs)(`div`,{onBlurCapture:h.onBlurCapture,children:[w,T,E]})}),t[41]=h.onBlurCapture,t[42]=w,t[43]=T,t[44]=E,t[45]=D):D=t[45];let O;return t[46]!==D||t[47]!==g?(O=(0,$.jsxs)(`div`,{className:`space-y-5`,children:[g,D]}),t[46]=D,t[47]=g,t[48]=O):O=t[48],O}export{Ee as UserContextPage};
@@ -1 +1 @@
1
- import"./rolldown-runtime-aKtaBQYM.js";import{a as e,n as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./cn-JdwAhgNB.js";import{r as i,s as a}from"./locale-store-De8wYkd7.js";import{n as o}from"./gateway-config-swr-BTH9HVUk.js";import{qo as s}from"./index-CMLkr37Y.js";e();var c=t(),l=`xopc-local-voice-model-install-started`;async function u(e,t){return(await a(i(`/api/voice/tts-voices?${new URLSearchParams({provider:e,model:t}).toString()}`))).payload?.voices??[]}function d(){return{enabled:!0,provider:`xopc-local`,providers:{"xopc-local":{model:`sensevoice-small`},alibaba:{model:`qwen-audio-3.0-asr-flash`},openai:{model:`gpt-4o-mini-transcribe`},groq:{model:`whisper-large-v3-turbo`}},fallback:{enabled:!1,order:[`xopc-local`]}}}function f(){return{enabled:!0,provider:`edge`,trigger:`inbound`,maxTextLength:512,timeoutMs:6e4,providers:{alibaba:{model:`qwen-tts`,voice:`Cherry`},openai:{model:`tts-1`,voice:`alloy`},edge:{voice:`zh-CN-XiaoxiaoNeural`,lang:`zh-CN`},minimax:{model:`speech-2.8-hd`,voice:`male-qn-qingse`},"tts-local-cli":{command:``,outputFormat:`wav`}}}}function p(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function m(e){return typeof e==`string`&&e.trim().length>0?e.trim():`xopc-local`}function h(e){let t=d();if(!p(e))return t;let n=m(e.provider),r=t.fallback??{enabled:!1,order:[`xopc-local`]};if(p(e.fallback)){let t=Array.isArray(e.fallback.order)?e.fallback.order.filter(e=>typeof e==`string`&&e.trim().length>0):r.order;r={enabled:typeof e.fallback.enabled==`boolean`?e.fallback.enabled:r.enabled,order:t.length?t:r.order}}let i={...t.providers??{},...p(e.providers)?Object.fromEntries(Object.entries(e.providers).map(([e,t])=>[e,p(t)?{...t}:{}])):{}};return{enabled:!!e.enabled,provider:n,providers:i,fallback:r}}function g(e){return typeof e==`string`&&e.trim().length>0?e.trim():`edge`}function _(e){let t=f();if(!p(e))return t;let n=g(e.provider),r=e.trigger===`off`||e.trigger===`always`||e.trigger===`inbound`||e.trigger===`tagged`?e.trigger:`inbound`,i={...t.providers??{},...p(e.providers)?Object.fromEntries(Object.entries(e.providers).map(([e,t])=>[e,p(t)?{...t}:{}])):{}};return{enabled:!!e.enabled,provider:n,trigger:r,maxTextLength:typeof e.maxTextLength==`number`&&Number.isFinite(e.maxTextLength)?e.maxTextLength:t.maxTextLength,timeoutMs:typeof e.timeoutMs==`number`&&Number.isFinite(e.timeoutMs)?e.timeoutMs:t.timeoutMs,providers:i}}function v(e){return{...e}}function y(e){return{...e}}function b(e){let t=p(e)?e:{},n=p(t.voice)?t.voice:{},r=p(n.input)?n.input:{},i=p(r.refinement)?r.refinement:{},a=i.mode===`punctuation`||i.mode===`light`||i.mode===`custom`?i.mode:`off`;return{stt:h(t.stt),tts:_(t.tts),voice:{languageMode:n.languageMode===`manual`?`manual`:`auto`,language:n.language===`zh`?`zh`:`en`,input:{refinement:{mode:a,...typeof i.model==`string`&&i.model.trim()?{model:i.model.trim()}:{},...typeof i.customInstruction==`string`?{customInstruction:i.customInstruction}:{}}}}}}async function x(){return b((await a(i(`/api/config`))).payload?.config??{})}async function S(e){await a(i(`/api/config`),{method:`PATCH`,body:JSON.stringify({stt:v(e.stt),tts:y(e.tts),voice:e.voice})}),e.voice.languageMode===`auto`&&await a(i(`/api/voice/language`),{method:`POST`,body:JSON.stringify({language:e.voice.language})}),typeof window<`u`&&window.dispatchEvent(new Event(`voice-config-changed`)),o()}async function C(){let e=await a(i(`/api/voice/models`));if(!e.payload?.models)throw Error(`Missing voice models payload`);return e.payload.models}async function w(){let e=await a(i(`/api/voice/providers`));if(!e.payload?.providers)throw Error(`Missing voice providers payload`);return e.payload}async function T(){let e=await a(i(`/api/voice/stt-providers`));if(!e.payload?.providers)throw Error(`Missing STT providers payload`);return e.payload}async function E(){let e=await a(i(`/api/voice/local/status`));if(!e.payload)throw Error(`Missing local voice status payload`);return e.payload}async function D(e){await a(i(`/api/voice/local/models/${encodeURIComponent(e)}/install`),{method:`POST`,body:`{}`})}async function O(e){await a(i(`/api/voice/local/models/${encodeURIComponent(e)}`),{method:`DELETE`})}async function k(e){let t=await a(i(`/api/voice/tts-test`),{method:`POST`,body:JSON.stringify(e)});if(t.ok===!1){let e=typeof t.error==`string`?t.error:t.error?.message;throw Error(e||`TTS test failed`)}if(!t.payload||typeof t.payload.audio!=`string`||!t.payload.audio.trim())throw Error(`TTS test returned no audio. Check the selected voice engine and try again.`);return t.payload}async function A(e){let t=await a(i(`/api/voice/reveal-api-key`),{method:`POST`,body:JSON.stringify(e)});if(!t.payload)throw Error(`Missing reveal payload`);return t.payload}var j=n();function M(e){let t=(0,c.c)(15),{kind:n,providerId:i,fieldId:a,value:o,onChange:l,labels:u,placeholder:d,className:f}=e,p=d===void 0?`sk-...`:d,m;t[0]!==n||t[1]!==i?(m=()=>A({kind:n,provider:i}).then(N),t[0]=n,t[1]=i,t[2]=m):m=t[2];let h=m,g;t[3]===f?g=t[4]:(g=r(`flex min-w-0 flex-col gap-1.5`,f),t[3]=f,t[4]=g);let _;t[5]!==a||t[6]!==u||t[7]!==l||t[8]!==p||t[9]!==h||t[10]!==o?(_=(0,j.jsx)(s,{id:a,value:o,onChange:l,placeholder:p,labels:u,reveal:h,loadFailedLabel:u.loadFailed,maskedHelp:u.maskedHelp,notInConfigFile:u.notInConfigFile,inputClassName:`text-xs`}),t[5]=a,t[6]=u,t[7]=l,t[8]=p,t[9]=h,t[10]=o,t[11]=_):_=t[11];let v;return t[12]!==g||t[13]!==_?(v=(0,j.jsx)(`div`,{className:g,children:_}),t[12]=g,t[13]=_,t[14]=v):v=t[14],v}function N(e){return e.apiKey??null}export{C as a,T as c,S as d,O as f,u as i,D as l,l as n,w as o,k as p,E as r,x as s,M as t,b as u};
1
+ import"./rolldown-runtime-aKtaBQYM.js";import{a as e,n as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./cn-JdwAhgNB.js";import{r as i,s as a}from"./locale-store-gf9Bg2gb.js";import{n as o}from"./gateway-config-swr-DNrttVr2.js";import{qo as s}from"./index-DlOYwVFK.js";e();var c=t(),l=`xopc-local-voice-model-install-started`;async function u(e,t){return(await a(i(`/api/voice/tts-voices?${new URLSearchParams({provider:e,model:t}).toString()}`))).payload?.voices??[]}function d(){return{enabled:!0,provider:`xopc-local`,providers:{"xopc-local":{model:`sensevoice-small`},alibaba:{model:`qwen-audio-3.0-asr-flash`},openai:{model:`gpt-4o-mini-transcribe`},groq:{model:`whisper-large-v3-turbo`}},fallback:{enabled:!1,order:[`xopc-local`]}}}function f(){return{enabled:!0,provider:`edge`,trigger:`inbound`,maxTextLength:512,timeoutMs:6e4,providers:{alibaba:{model:`qwen-tts`,voice:`Cherry`},openai:{model:`tts-1`,voice:`alloy`},edge:{voice:`zh-CN-XiaoxiaoNeural`,lang:`zh-CN`},minimax:{model:`speech-2.8-hd`,voice:`male-qn-qingse`},"tts-local-cli":{command:``,outputFormat:`wav`}}}}function p(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function m(e){return typeof e==`string`&&e.trim().length>0?e.trim():`xopc-local`}function h(e){let t=d();if(!p(e))return t;let n=m(e.provider),r=t.fallback??{enabled:!1,order:[`xopc-local`]};if(p(e.fallback)){let t=Array.isArray(e.fallback.order)?e.fallback.order.filter(e=>typeof e==`string`&&e.trim().length>0):r.order;r={enabled:typeof e.fallback.enabled==`boolean`?e.fallback.enabled:r.enabled,order:t.length?t:r.order}}let i={...t.providers??{},...p(e.providers)?Object.fromEntries(Object.entries(e.providers).map(([e,t])=>[e,p(t)?{...t}:{}])):{}};return{enabled:!!e.enabled,provider:n,providers:i,fallback:r}}function g(e){return typeof e==`string`&&e.trim().length>0?e.trim():`edge`}function _(e){let t=f();if(!p(e))return t;let n=g(e.provider),r=e.trigger===`off`||e.trigger===`always`||e.trigger===`inbound`||e.trigger===`tagged`?e.trigger:`inbound`,i={...t.providers??{},...p(e.providers)?Object.fromEntries(Object.entries(e.providers).map(([e,t])=>[e,p(t)?{...t}:{}])):{}};return{enabled:!!e.enabled,provider:n,trigger:r,maxTextLength:typeof e.maxTextLength==`number`&&Number.isFinite(e.maxTextLength)?e.maxTextLength:t.maxTextLength,timeoutMs:typeof e.timeoutMs==`number`&&Number.isFinite(e.timeoutMs)?e.timeoutMs:t.timeoutMs,providers:i}}function v(e){return{...e}}function y(e){return{...e}}function b(e){let t=p(e)?e:{},n=p(t.voice)?t.voice:{},r=p(n.input)?n.input:{},i=p(r.refinement)?r.refinement:{},a=i.mode===`punctuation`||i.mode===`light`||i.mode===`custom`?i.mode:`off`;return{stt:h(t.stt),tts:_(t.tts),voice:{languageMode:n.languageMode===`manual`?`manual`:`auto`,language:n.language===`zh`?`zh`:`en`,input:{refinement:{mode:a,...typeof i.model==`string`&&i.model.trim()?{model:i.model.trim()}:{},...typeof i.customInstruction==`string`?{customInstruction:i.customInstruction}:{}}}}}}async function x(){return b((await a(i(`/api/config`))).payload?.config??{})}async function S(e){await a(i(`/api/config`),{method:`PATCH`,body:JSON.stringify({stt:v(e.stt),tts:y(e.tts),voice:e.voice})}),e.voice.languageMode===`auto`&&await a(i(`/api/voice/language`),{method:`POST`,body:JSON.stringify({language:e.voice.language})}),typeof window<`u`&&window.dispatchEvent(new Event(`voice-config-changed`)),o()}async function C(){let e=await a(i(`/api/voice/models`));if(!e.payload?.models)throw Error(`Missing voice models payload`);return e.payload.models}async function w(){let e=await a(i(`/api/voice/providers`));if(!e.payload?.providers)throw Error(`Missing voice providers payload`);return e.payload}async function T(){let e=await a(i(`/api/voice/stt-providers`));if(!e.payload?.providers)throw Error(`Missing STT providers payload`);return e.payload}async function E(){let e=await a(i(`/api/voice/local/status`));if(!e.payload)throw Error(`Missing local voice status payload`);return e.payload}async function D(e){await a(i(`/api/voice/local/models/${encodeURIComponent(e)}/install`),{method:`POST`,body:`{}`})}async function O(e){await a(i(`/api/voice/local/models/${encodeURIComponent(e)}`),{method:`DELETE`})}async function k(e){let t=await a(i(`/api/voice/tts-test`),{method:`POST`,body:JSON.stringify(e)});if(t.ok===!1){let e=typeof t.error==`string`?t.error:t.error?.message;throw Error(e||`TTS test failed`)}if(!t.payload||typeof t.payload.audio!=`string`||!t.payload.audio.trim())throw Error(`TTS test returned no audio. Check the selected voice engine and try again.`);return t.payload}async function A(e){let t=await a(i(`/api/voice/reveal-api-key`),{method:`POST`,body:JSON.stringify(e)});if(!t.payload)throw Error(`Missing reveal payload`);return t.payload}var j=n();function M(e){let t=(0,c.c)(15),{kind:n,providerId:i,fieldId:a,value:o,onChange:l,labels:u,placeholder:d,className:f}=e,p=d===void 0?`sk-...`:d,m;t[0]!==n||t[1]!==i?(m=()=>A({kind:n,provider:i}).then(N),t[0]=n,t[1]=i,t[2]=m):m=t[2];let h=m,g;t[3]===f?g=t[4]:(g=r(`flex min-w-0 flex-col gap-1.5`,f),t[3]=f,t[4]=g);let _;t[5]!==a||t[6]!==u||t[7]!==l||t[8]!==p||t[9]!==h||t[10]!==o?(_=(0,j.jsx)(s,{id:a,value:o,onChange:l,placeholder:p,labels:u,reveal:h,loadFailedLabel:u.loadFailed,maskedHelp:u.maskedHelp,notInConfigFile:u.notInConfigFile,inputClassName:`text-xs`}),t[5]=a,t[6]=u,t[7]=l,t[8]=p,t[9]=h,t[10]=o,t[11]=_):_=t[11];let v;return t[12]!==g||t[13]!==_?(v=(0,j.jsx)(`div`,{className:g,children:_}),t[12]=g,t[13]=_,t[14]=v):v=t[14],v}function N(e){return e.apiKey??null}export{C as a,T as c,S as d,O as f,u as i,D as l,l as n,w as o,k as p,E as r,x as s,M as t,b as u};
@@ -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"./x-B_N4OPjy.js";import{t as a}from"./button-CSEbl4zT.js";import{t as o}from"./messages-VI9m1xJl.js";import{n as s}from"./locale-store-De8wYkd7.js";import{a as c,i as l,o as u,r as d,s as f,t as p}from"./dist-BPoKqzeH.js";import{io as m,mt as h,ns as g}from"./index-CMLkr37Y.js";var _=n(),v=e(t(),1),y=r(),b=180;function x(e){let t=(0,_.c)(40),{requestedOpen:n,onExited:r}=e,x=s(C),w=m(S),[T,E]=(0,v.useState)(!0),D=(0,v.useRef)(!1),O=(0,v.useRef)(null),k;t[0]===x?k=t[1]:(k=o(x),t[0]=x,t[1]=k);let A=k.onboarding.workDiscovery,j=w?x===`zh`?`在后台继续`:`Continue in background`:x===`zh`?`稍后再说`:`Maybe later`,M;t[2]===r?M=t[3]:(M=()=>{if(D.current)return;D.current=!0,E(!1);let e=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?0:b;O.current=window.setTimeout(r,e)},t[2]=r,t[3]=M);let N=M,P,F;t[4]!==N||t[5]!==n?(P=()=>{n||N()},F=[N,n],t[4]=N,t[5]=n,t[6]=P,t[7]=F):(P=t[6],F=t[7]),(0,v.useEffect)(P,F);let I,L;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(I=()=>()=>{O.current!==null&&window.clearTimeout(O.current)},L=[],t[8]=I,t[9]=L):(I=t[8],L=t[9]),(0,v.useEffect)(I,L);let R;t[10]===N?R=t[11]:(R=e=>{e||N()},t[10]=N,t[11]=R);let z;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,y.jsx)(c,{className:`xopc-dialog-overlay fixed inset-0 z-[75] bg-scrim backdrop-blur-[1px]`}),t[12]=z):z=t[12];let B;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,y.jsx)(g,{className:`size-7 shrink-0`,"aria-hidden":!0}),t[13]=B):B=t[13];let V;t[14]===A.title?V=t[15]:(V=(0,y.jsx)(f,{className:`truncate text-sm font-semibold text-fg`,children:A.title}),t[14]=A.title,t[15]=V);let H;t[16]===A.subtitle?H=t[17]:(H=(0,y.jsx)(l,{className:`sr-only`,children:A.subtitle}),t[16]=A.subtitle,t[17]=H);let U;t[18]!==V||t[19]!==H?(U=(0,y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[B,V,H]}),t[18]=V,t[19]=H,t[20]=U):U=t[20];let W;t[21]===j?W=t[22]:(W=(0,y.jsx)(`span`,{className:`hidden text-xs sm:inline`,children:j}),t[21]=j,t[22]=W);let G;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,y.jsx)(i,{className:`size-4`,"aria-hidden":!0}),t[23]=G):G=t[23];let K;t[24]!==j||t[25]!==N||t[26]!==W?(K=(0,y.jsxs)(a,{type:`button`,variant:`ghost`,className:`h-9 shrink-0 gap-1.5 px-2.5 text-fg-muted`,title:j,"aria-label":j,onClick:N,children:[W,G]}),t[24]=j,t[25]=N,t[26]=W,t[27]=K):K=t[27];let q;t[28]!==U||t[29]!==K?(q=(0,y.jsxs)(`header`,{className:`flex h-14 shrink-0 items-center justify-between gap-4 border-b border-edge bg-surface-panel px-4 sm:px-5`,children:[U,K]}),t[28]=U,t[29]=K,t[30]=q):q=t[30];let J;t[31]===N?J=t[32]:(J=(0,y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,y.jsx)(h,{embedded:!0,onRequestClose:N})}),t[31]=N,t[32]=J);let Y;t[33]!==q||t[34]!==J?(Y=(0,y.jsxs)(u,{children:[z,(0,y.jsx)(d,{className:`xopc-work-discovery-dialog pointer-events-none fixed inset-0 z-[76] flex items-center justify-center p-3 outline-none sm:p-6`,children:(0,y.jsxs)(`section`,{className:`xopc-work-discovery-panel pointer-events-auto flex h-[min(47.5rem,calc(100dvh-1.5rem))] w-[min(45rem,calc(100vw-1.5rem))] flex-col overflow-hidden rounded-2xl border border-edge bg-surface-base shadow-float sm:h-[min(47.5rem,calc(100dvh-3rem))] sm:w-[min(45rem,calc(100vw-3rem))]`,children:[q,J]})})]}),t[33]=q,t[34]=J,t[35]=Y):Y=t[35];let X;return t[36]!==T||t[37]!==Y||t[38]!==R?(X=(0,y.jsx)(p,{open:T,onOpenChange:R,children:Y}),t[36]=T,t[37]=Y,t[38]=R,t[39]=X):X=t[39],X}function S(e){return e.status===`running`}function C(e){return e.language}export{x as WorkDiscoveryOverlay};
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"./x-B_N4OPjy.js";import{t as a}from"./button-CSEbl4zT.js";import{t as o}from"./messages-B9WQcZ1V.js";import{n as s}from"./locale-store-gf9Bg2gb.js";import{a as c,i as l,o as u,r as d,s as f,t as p}from"./dist-BPoKqzeH.js";import{io as m,mt as h,ns as g}from"./index-DlOYwVFK.js";var _=n(),v=e(t(),1),y=r(),b=180;function x(e){let t=(0,_.c)(40),{requestedOpen:n,onExited:r}=e,x=s(C),w=m(S),[T,E]=(0,v.useState)(!0),D=(0,v.useRef)(!1),O=(0,v.useRef)(null),k;t[0]===x?k=t[1]:(k=o(x),t[0]=x,t[1]=k);let A=k.onboarding.workDiscovery,j=w?x===`zh`?`在后台继续`:`Continue in background`:x===`zh`?`稍后再说`:`Maybe later`,M;t[2]===r?M=t[3]:(M=()=>{if(D.current)return;D.current=!0,E(!1);let e=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?0:b;O.current=window.setTimeout(r,e)},t[2]=r,t[3]=M);let N=M,P,F;t[4]!==N||t[5]!==n?(P=()=>{n||N()},F=[N,n],t[4]=N,t[5]=n,t[6]=P,t[7]=F):(P=t[6],F=t[7]),(0,v.useEffect)(P,F);let I,L;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(I=()=>()=>{O.current!==null&&window.clearTimeout(O.current)},L=[],t[8]=I,t[9]=L):(I=t[8],L=t[9]),(0,v.useEffect)(I,L);let R;t[10]===N?R=t[11]:(R=e=>{e||N()},t[10]=N,t[11]=R);let z;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,y.jsx)(c,{className:`xopc-dialog-overlay fixed inset-0 z-[75] bg-scrim backdrop-blur-[1px]`}),t[12]=z):z=t[12];let B;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,y.jsx)(g,{className:`size-7 shrink-0`,"aria-hidden":!0}),t[13]=B):B=t[13];let V;t[14]===A.title?V=t[15]:(V=(0,y.jsx)(f,{className:`truncate text-sm font-semibold text-fg`,children:A.title}),t[14]=A.title,t[15]=V);let H;t[16]===A.subtitle?H=t[17]:(H=(0,y.jsx)(l,{className:`sr-only`,children:A.subtitle}),t[16]=A.subtitle,t[17]=H);let U;t[18]!==V||t[19]!==H?(U=(0,y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[B,V,H]}),t[18]=V,t[19]=H,t[20]=U):U=t[20];let W;t[21]===j?W=t[22]:(W=(0,y.jsx)(`span`,{className:`hidden text-xs sm:inline`,children:j}),t[21]=j,t[22]=W);let G;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,y.jsx)(i,{className:`size-4`,"aria-hidden":!0}),t[23]=G):G=t[23];let K;t[24]!==j||t[25]!==N||t[26]!==W?(K=(0,y.jsxs)(a,{type:`button`,variant:`ghost`,className:`h-9 shrink-0 gap-1.5 px-2.5 text-fg-muted`,title:j,"aria-label":j,onClick:N,children:[W,G]}),t[24]=j,t[25]=N,t[26]=W,t[27]=K):K=t[27];let q;t[28]!==U||t[29]!==K?(q=(0,y.jsxs)(`header`,{className:`flex h-14 shrink-0 items-center justify-between gap-4 border-b border-edge bg-surface-panel px-4 sm:px-5`,children:[U,K]}),t[28]=U,t[29]=K,t[30]=q):q=t[30];let J;t[31]===N?J=t[32]:(J=(0,y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,y.jsx)(h,{embedded:!0,onRequestClose:N})}),t[31]=N,t[32]=J);let Y;t[33]!==q||t[34]!==J?(Y=(0,y.jsxs)(u,{children:[z,(0,y.jsx)(d,{className:`xopc-work-discovery-dialog pointer-events-none fixed inset-0 z-[76] flex items-center justify-center p-3 outline-none sm:p-6`,children:(0,y.jsxs)(`section`,{className:`xopc-work-discovery-panel pointer-events-auto flex h-[min(47.5rem,calc(100dvh-1.5rem))] w-[min(45rem,calc(100vw-1.5rem))] flex-col overflow-hidden rounded-2xl border border-edge bg-surface-base shadow-float sm:h-[min(47.5rem,calc(100dvh-3rem))] sm:w-[min(45rem,calc(100vw-3rem))]`,children:[q,J]})})]}),t[33]=q,t[34]=J,t[35]=Y):Y=t[35];let X;return t[36]!==T||t[37]!==Y||t[38]!==R?(X=(0,y.jsx)(p,{open:T,onOpenChange:R,children:Y}),t[36]=T,t[37]=Y,t[38]=R,t[39]=X):X=t[39],X}function S(e){return e.status===`running`}function C(e){return e.language}export{x as WorkDiscoveryOverlay};