@xopcai/xopc 0.0.193 → 0.0.194

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 (105) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/feishu/src/outbound/media-load.js +1 -1
  3. package/dist/extensions/telegram/xopc.extension.json +1 -1
  4. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-DmNq0t2n.js → agent-avatar-dicebear-4ln7j-oZ.js} +1 -1
  5. package/dist/gateway/static/root/assets/{agents-BOo1rVn9.js → agents-C1Z-rurI.js} +1 -1
  6. package/dist/gateway/static/root/assets/{app-management-settings-panel-B3xStqSX.js → app-management-settings-panel-B0IMpHk8.js} +1 -1
  7. package/dist/gateway/static/root/assets/{appearance-settings-DglyenDq.js → appearance-settings-BG6ZGIUf.js} +1 -1
  8. package/dist/gateway/static/root/assets/{apps-page-DC9qPFTx.js → apps-page-CwsZENTk.js} +1 -1
  9. package/dist/gateway/static/root/assets/{archive-plugin-DvtcrBss.js → archive-plugin-BNpjG4FR.js} +1 -1
  10. package/dist/gateway/static/root/assets/{attachment-load-CALdq4xM.js → attachment-load-BK25C_hA.js} +1 -1
  11. package/dist/gateway/static/root/assets/{automations-page-BIGGKb0T.js → automations-page-BedezAfO.js} +1 -1
  12. package/dist/gateway/static/root/assets/{binary-plugins-GaVuvrDI.js → binary-plugins-fbFe6Jqc.js} +1 -1
  13. package/dist/gateway/static/root/assets/{block-editor-C2KrMYa_.js → block-editor-SQHwWg1e.js} +1 -1
  14. package/dist/gateway/static/root/assets/{browser-settings-page-CPW_E-xj.js → browser-settings-page-CC0_TfTy.js} +1 -1
  15. package/dist/gateway/static/root/assets/{browser-workflow-inputs-FfEEjhIS.js → browser-workflow-inputs-DuUQ_Ycz.js} +1 -1
  16. package/dist/gateway/static/root/assets/{browser-workflows-page-DFP9_UQk.js → browser-workflows-page-B8I2FmrM.js} +1 -1
  17. package/dist/gateway/static/root/assets/{capabilities-settings-panel-CsD8aGHU.js → capabilities-settings-panel-ditT6VRs.js} +1 -1
  18. package/dist/gateway/static/root/assets/{capability-presets-settings-panel-NCeyWH6Z.js → capability-presets-settings-panel-bNVds1ta.js} +1 -1
  19. package/dist/gateway/static/root/assets/{channels-settings-CknzwxNC.js → channels-settings-DhsWSbJ2.js} +1 -1
  20. package/dist/gateway/static/root/assets/{connectors-api-vaSrhPF8.js → connectors-api-Ne8mQrYN.js} +1 -1
  21. package/dist/gateway/static/root/assets/{connectors-page-DEGE7xp_.js → connectors-page-hZA9M1z_.js} +1 -1
  22. package/dist/gateway/static/root/assets/{cron-expression-BjFuXlGY.js → cron-expression-DtWb3YAh.js} +1 -1
  23. package/dist/gateway/static/root/assets/{dependency-picker-DOdkHdPv.js → dependency-picker-3vjdusik.js} +1 -1
  24. package/dist/gateway/static/root/assets/{desktop-pet-Dz-Yf8Uu.js → desktop-pet-NmW7VWdO.js} +1 -1
  25. package/dist/gateway/static/root/assets/{desktop-pet-settings-C8EHFEtd.js → desktop-pet-settings-DrdSI9lX.js} +1 -1
  26. package/dist/gateway/static/root/assets/{directory-picker-path-field-DKbfmZlZ.js → directory-picker-path-field-CG5XR1UD.js} +1 -1
  27. package/dist/gateway/static/root/assets/{extension-debug-page-Dq0xsr_e.js → extension-debug-page-RjIezQyy.js} +1 -1
  28. package/dist/gateway/static/root/assets/{extension-page-IgSLUyWP.js → extension-page-D9Elz9mr.js} +1 -1
  29. package/dist/gateway/static/root/assets/{extension-settings-page-VC-8Pjn2.js → extension-settings-page-BvVjqFvm.js} +1 -1
  30. package/dist/gateway/static/root/assets/{gateway-config-api-CH2R7yqo.js → gateway-config-api-C-rYVz-n.js} +1 -1
  31. package/dist/gateway/static/root/assets/{gateway-settings-DLQJWaBQ.js → gateway-settings-CLS25-gm.js} +1 -1
  32. package/dist/gateway/static/root/assets/{heartbeat-settings-43loWoGb.js → heartbeat-settings-DSgDxtwJ.js} +1 -1
  33. package/dist/gateway/static/root/assets/{home-page-DqvpI6LC.js → home-page-CDpUUelT.js} +1 -1
  34. package/dist/gateway/static/root/assets/{index-BpkdvHH0.js → index-Cb9y6tVR.js} +8 -8
  35. package/dist/gateway/static/root/assets/index-DtEVsSU1.css +1 -0
  36. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-DJDZes_8.js → keyboard-shortcuts-settings-RcHmSHYI.js} +1 -1
  37. package/dist/gateway/static/root/assets/{local-app-workbench-page-CvNQM6qm.js → local-app-workbench-page-DvzXo7dx.js} +1 -1
  38. package/dist/gateway/static/root/assets/{local-apps-page-C2ajOn1D.js → local-apps-page-s7PKLTvO.js} +1 -1
  39. package/dist/gateway/static/root/assets/{logs-page-BLm5yWqQ.js → logs-page-CNm5fu3L.js} +1 -1
  40. package/dist/gateway/static/root/assets/{management-settings--_eXnFVr.js → management-settings-CWUHBXje.js} +1 -1
  41. package/dist/gateway/static/root/assets/{markdown-split-iL2oi-x2.js → markdown-split-B-IuPr4L.js} +1 -1
  42. package/dist/gateway/static/root/assets/{media-plugins-BIbkLVpQ.js → media-plugins-CiejHVt4.js} +1 -1
  43. package/dist/gateway/static/root/assets/{notes-page-xFxaZ6gT.js → notes-page-BSJAwHqy.js} +1 -1
  44. package/dist/gateway/static/root/assets/{notes-workbench-PAftxL3V.js → notes-workbench-DTWRQ_EU.js} +2 -2
  45. package/dist/gateway/static/root/assets/{page-tabs-CROi9zm1.js → page-tabs-D6YJ6_l_.js} +1 -1
  46. package/dist/gateway/static/root/assets/{preview-open-alternatives-BwYcPjOM.js → preview-open-alternatives-Tw_G-6jb.js} +1 -1
  47. package/dist/gateway/static/root/assets/{product-open-page-BezeuVFd.js → product-open-page-BlB3QjTV.js} +1 -1
  48. package/dist/gateway/static/root/assets/{project-detail-page-CCdfZcw-.js → project-detail-page-DT7aWLWT.js} +1 -1
  49. package/dist/gateway/static/root/assets/{projects-page-DOG9zm5e.js → projects-page-B-i3U2fU.js} +1 -1
  50. package/dist/gateway/static/root/assets/{remote-access-hub-DQBFgveI.js → remote-access-hub-v-kXavTc.js} +1 -1
  51. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-Bs6tpSyX.js → runtime-tools-settings-panel-D59bftC7.js} +1 -1
  52. package/dist/gateway/static/root/assets/{schema-form-CWoSjz9s.js → schema-form-DyXqGA71.js} +1 -1
  53. package/dist/gateway/static/root/assets/{sessions-page-Db6L6M2H.js → sessions-page-tEfg1Pru.js} +1 -1
  54. package/dist/gateway/static/root/assets/settings-advanced-gate-tbguNxVJ.js +1 -0
  55. package/dist/gateway/static/root/assets/{settings-form-section-BJaMEHsX.js → settings-form-section-DZUGXwFO.js} +1 -1
  56. package/dist/gateway/static/root/assets/{settings-loading-skeleton-sn4k17x7.js → settings-loading-skeleton-Lz1ec5lN.js} +1 -1
  57. package/dist/gateway/static/root/assets/{settings-page-D2hfeFPX.js → settings-page-DLofKC7q.js} +1 -1
  58. package/dist/gateway/static/root/assets/{settings-page-layout-CLtUsWsu.js → settings-page-layout-BdkN2U81.js} +1 -1
  59. package/dist/gateway/static/root/assets/{setup-status-panel-UmQC_uZ1.js → setup-status-panel-DQgoV7gj.js} +1 -1
  60. package/dist/gateway/static/root/assets/{share-preview-page-BJ58AluH.js → share-preview-page-DrZVv8tB.js} +1 -1
  61. package/dist/gateway/static/root/assets/{shares-settings-BZKn6Fdc.js → shares-settings-I2bBkyDb.js} +1 -1
  62. package/dist/gateway/static/root/assets/{skill-reload-api-Cx3i24w_.js → skill-reload-api-gFdcImEc.js} +1 -1
  63. package/dist/gateway/static/root/assets/{skills-page-DjUllGtk.js → skills-page-zOD__-H5.js} +1 -1
  64. package/dist/gateway/static/root/assets/{skills-page.utils-CZYIuE26.js → skills-page.utils-ZDcx95iD.js} +1 -1
  65. package/dist/gateway/static/root/assets/{system-settings-panel-DUrgdQMk.js → system-settings-panel-BJhat70L.js} +1 -1
  66. package/dist/gateway/static/root/assets/{task-detail-page-BGG2cFe9.js → task-detail-page-DoyREaFj.js} +1 -1
  67. package/dist/gateway/static/root/assets/{typed-models-lib-CRNMvvFX.js → typed-models-lib-B1p3wMFK.js} +1 -1
  68. package/dist/gateway/static/root/assets/{use-autosave-Dle3-zdQ.js → use-autosave-Frcfbncl.js} +1 -1
  69. package/dist/gateway/static/root/assets/{user-context-page-BLLmw5S1.js → user-context-page-DniWcH92.js} +1 -1
  70. package/dist/gateway/static/root/assets/{voice-api-key-field-BrWH0dCl.js → voice-api-key-field-CSNOUNF4.js} +1 -1
  71. package/dist/gateway/static/root/assets/{work-discovery-overlay-BZ1l9CFM.js → work-discovery-overlay-DTJGssPz.js} +1 -1
  72. package/dist/gateway/static/root/assets/work-discovery-page-Bt2-fzHu.js +1 -0
  73. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-BK6e9yzK.js → workflow-run-setup-panel-D3uCmyag.js} +1 -1
  74. package/dist/gateway/static/root/assets/{workflows-page-Bp5JxQJa.js → workflows-page-Ba5fVQWY.js} +1 -1
  75. package/dist/gateway/static/root/index.html +2 -2
  76. package/dist/package.js +1 -1
  77. package/dist/src/agent/agent-manager.js +1 -1
  78. package/dist/src/agent/memory/create-memory-manager.js +1 -1
  79. package/dist/src/agent-runtime/index.js +1 -1
  80. package/dist/src/agent-runtime/runtime-profile.js +1 -1
  81. package/dist/src/cli/commands/channels.js +1 -1
  82. package/dist/src/cli/commands/connectors.js +1 -1
  83. package/dist/src/cli/commands/extension-marketplace.js +1 -1
  84. package/dist/src/cli/commands/gateway/lifecycle.js +1 -1
  85. package/dist/src/cli/commands/models.js +1 -1
  86. package/dist/src/cli/commands/onboard.js +1 -1
  87. package/dist/src/cli/commands/update.js +1 -1
  88. package/dist/src/config/agent-profile.js +1 -1
  89. package/dist/src/extensions/sdk/index.js +1 -1
  90. package/dist/src/gateway/agents-admin.js +1 -1
  91. package/dist/src/gateway/hono/routes/local-apps.js +1 -1
  92. package/dist/src/gateway/hono/routes/update.js +2 -2
  93. package/dist/src/gateway/index.js +1 -1
  94. package/dist/src/gateway/run-loop.js +1 -1
  95. package/dist/src/gateway/service.js +6 -6
  96. package/dist/src/infra/gateway-processes.js +1 -1
  97. package/dist/src/infra/update-restart.js +1 -1
  98. package/dist/src/infra/update-runner.js +2 -2
  99. package/dist/src/infra/update-startup.js +1 -1
  100. package/dist/src/tui/backends/gateway-realtime-backend.js +1 -1
  101. package/dist/src/work-discovery/analyzer.js +1 -2
  102. package/package.json +4 -4
  103. package/dist/gateway/static/root/assets/index-CFVjH-EK.css +0 -1
  104. package/dist/gateway/static/root/assets/settings-advanced-gate-CcO2bd6q.js +0 -1
  105. package/dist/gateway/static/root/assets/work-discovery-page-BnPF2vx7.js +0 -1
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./cn-JdwAhgNB.js";import{t as i}from"./messages-DQ5X6cXp.js";import{n as a}from"./locale-store-Bjvw7jtg.js";import{Al as o,An as s,At as c,Fo as l,On as u,Xs as d,cc as f,ds as p,gu as m,jn as h,kn as g}from"./index-BpkdvHH0.js";import{n as _,r as v}from"./settings-page-layout-CLtUsWsu.js";import{r as y,t as b}from"./settings-form-section-BJaMEHsX.js";var x=e(t(),1);async function S(e,t){let n=window.electronAPI?.system;if(!l()||!n?.requestNotifications)return`unsupported`;let r=await n.requestNotifications();if(r.status!==`granted`)return r.task===`opened-settings`||r.status===`denied`?`denied`:`default`;await n.setBehavior({notifyEnabled:!0});let i=await n.showEndpointNotification({title:e,body:t});return i.ok||await n.setBehavior({notifyEnabled:!1}),i.ok?`enabled`:`default`}var C=n();function w(){let e=i(a(e=>e.language)).systemSettings.browserNotify,[t,n]=(0,x.useState)(s),[r,o]=(0,x.useState)(null),[c,l]=(0,x.useState)(!1),d=async t=>{if(!t){n(h({enabled:!1})),o(null);return}l(!0);try{let t=await u();if(t!==`granted`){o(t===`unsupported`?e.unsupported:e.denied);return}n(h({enabled:!0})),o(await g(e.testTitle,e.testBody)?e.testShown:e.failed)}finally{l(!1)}},f=e=>{n(h(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)(m,{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:c||e!==`enabled`&&!t.enabled,checked:t[e],onChange:t=>{e===`enabled`?d(t.target.checked):f({[e]:t.target.checked})}})]},e))}),r?(0,C.jsx)(`p`,{className:`mt-3 text-sm text-fg-muted`,role:`status`,children:r}):null,(0,C.jsx)(`p`,{className:`mt-4 text-xs text-fg-muted`,children:e.limitation})]})]})}async function T(){if(typeof navigator>`u`||!navigator.mediaDevices?.getUserMedia)return!1;try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});for(let t of e.getTracks())t.stop();return!0}catch{return!1}}function E(e,t,n){return e.task===`opened-settings`?n.openedSettings:e.status===`granted`&&t?e.task===`already-granted`?n.alreadyGranted:n.granted:t?e.status===`denied`?n.denied:n.prompted:n.rendererDenied}function D(e,t){return e.task===`opened-settings`?t.openedSettings:e.status===`granted`?e.task===`already-granted`?t.alreadyGranted:t.granted:t.denied}function O(e,t){return e.task===`opened-settings`?t.openedSettings:e.status===`granted`?e.task===`already-granted`?t.alreadyGranted:t.granted:e.status===`denied`?t.denied:t.prompted}function k(e,t){return e.task===`opened-settings`?t.openedSettings:e.status===`granted`?e.task===`already-granted`?t.alreadyGranted:t.granted:e.status===`denied`?t.denied:t.prompted}var A=new Set([`microphone`,`accessibility`,`notifications`,`screen`]);function j(e,t,n){return t===`granted`?!1:e===`accessibility`&&(n===`darwin`||n===`win32`||n===`linux`)||e===`screen`&&(n===`darwin`||n===`win32`)||A.has(e)?t===`unknown`:!1}function M(e,t,n){return e===`accessibility`?!1:e===`screen`&&n===`linux`?!0:A.has(e)?t===`denied`:!0}var N=[{key:`fullDisk`,pane:`fullDisk`,platforms:[`darwin`]},{key:`screen`,pane:`screen`},{key:`microphone`,pane:`microphone`},{key:`accessibility`,pane:`accessibility`},{key:`automation`,pane:`automation`},{key:`notifications`,pane:`notifications`},{key:`location`,pane:`location`}];function P(e){return e===`linux`?N:N.filter(t=>!t.platforms||t.platforms.includes(e))}function F(e,t){let n=i(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=i(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=a(e=>e.language),t=i(e).systemSettings,[n,s]=(0,x.useReducer)(c,L),{behavior:u,perms:m,loadError:h,permFeedback:g,permBusy:A,refreshing:N}=n,R=typeof window<`u`?window.electronAPI?.system:void 0,z=(0,x.useCallback)(async e=>{if(R){s({type:`patch`,patch:{loadError:null}});try{s({type:`patch`,patch:{behavior:await R.getBehavior(),perms:await R.getPermissions({probe:e?.showRefreshFeedback}),...e?.showRefreshFeedback?{permFeedback:t.refreshDone}:{}}})}catch(t){s({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)){s({type:`patch`,patch:{refreshing:!0}});try{await z({showRefreshFeedback:!0})}finally{s({type:`patch`,patch:{refreshing:!1}})}}},[z,A,N]);if((0,x.useEffect)(()=>{let e=new Set([t.refreshDone,t.openSettingsDone,t.openSettingsFailed,t.desktopNotify.testShown]);if(!g||!e.has(g))return;let n=window.setTimeout(()=>{s({type:`patch`,patch:{permFeedback:null}})},3e3);return()=>window.clearTimeout(n)},[g,t.openSettingsDone,t.openSettingsFailed,t.refreshDone,t.desktopNotify.testShown]),(0,x.useEffect)(()=>{l()&&R&&z()},[R,z]),!l()||!R)return(0,C.jsx)(w,{});let V=async e=>{try{let{behavior:t}=await R.setBehavior(e);s({type:`patch`,patch:{behavior:t}})}catch(e){s({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}},H=async e=>{if(!e){await V({notifyEnabled:!1});return}s({type:`patch`,patch:{permBusy:!0,permFeedback:null}});try{let e=await S(t.desktopNotify.testTitle,t.desktopNotify.testBody);if(e===`unsupported`){s({type:`patch`,patch:{permFeedback:t.notificationsFeedback.unsupported}});return}if(e===`denied`){s({type:`patch`,patch:{permFeedback:t.desktopNotify.denied}});return}if(e==="default"){s({type:`patch`,patch:{permFeedback:t.notificationsFeedback.default}});return}await V({notifyEnabled:!0}),s({type:`patch`,patch:{perms:await R.getPermissions()}}),s({type:`patch`,patch:{permFeedback:t.desktopNotify.testShown}})}catch(e){s({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{s({type:`patch`,patch:{permBusy:!1}})}},U=async e=>{s({type:`patch`,patch:{permFeedback:null}}),s({type:`patch`,patch:{loadError:null}});try{(await R.openPrivacy(e)).ok?s({type:`patch`,patch:{permFeedback:t.openSettingsDone}}):s({type:`patch`,patch:{permFeedback:t.openSettingsFailed}})}catch(e){s({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}},W=async()=>{s({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),s({type:`patch`,patch:{loadError:null}});try{let e=await R.requestMicrophone(),n=await T();s({type:`patch`,patch:{perms:await R.getPermissions()}}),s({type:`patch`,patch:{permFeedback:E(e,n,t.permFeedback)}})}catch(e){s({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{s({type:`patch`,patch:{permBusy:!1}})}},G=async()=>{if(R.requestAccessibility){s({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),s({type:`patch`,patch:{loadError:null}});try{let e=await R.requestAccessibility();s({type:`patch`,patch:{perms:await R.getPermissions()}}),s({type:`patch`,patch:{permFeedback:D(e,t.accessibilityFeedback)}})}catch(e){s({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{s({type:`patch`,patch:{permBusy:!1}})}}},K=async()=>{if(R.requestNotifications){s({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),s({type:`patch`,patch:{loadError:null}});try{let e=await R.requestNotifications();s({type:`patch`,patch:{perms:await R.getPermissions()}}),s({type:`patch`,patch:{permFeedback:O(e,t.notificationsFeedback)}})}catch(e){s({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{s({type:`patch`,patch:{permBusy:!1}})}}},q=async()=>{if(R.requestScreen){s({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),s({type:`patch`,patch:{loadError:null}});try{let e=await R.requestScreen();s({type:`patch`,patch:{perms:await R.getPermissions()}}),s({type:`patch`,patch:{permFeedback:k(e,t.screenFeedback)}})}catch(e){s({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{s({type:`patch`,patch:{permBusy:!1}})}}},J=u?u.platform===`win32`?t.permissionsHintWin:u.platform===`linux`?t.permissionsHintLinux:u.platform===`darwin`?t.permissionsHintDarwin:t.permissionsHint:t.permissionsHint;return(0,C.jsxs)(v,{gap:`gap-6`,children:[(0,C.jsx)(_,{title:t.title}),h?(0,C.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:h}):null,g?(0,C.jsx)(`p`,{className:r(`text-sm`,g===t.refreshDone||g===t.openSettingsDone||g===t.permFeedback.granted||g===t.permFeedback.alreadyGranted||g===t.accessibilityFeedback.granted||g===t.accessibilityFeedback.alreadyGranted||g===t.notificationsFeedback.granted||g===t.notificationsFeedback.alreadyGranted||g===t.screenFeedback.granted||g===t.screenFeedback.alreadyGranted||g===t.desktopNotify.testShown?`text-emerald-600 dark:text-emerald-400`:`text-fg-muted`),role:`status`,"aria-live":`polite`,children:g}):null,(0,C.jsxs)(b,{children:[(0,C.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,C.jsx)(d,{className:`size-4 text-accent`,strokeWidth:1.75}),t.behaviorGroup]}),(0,C.jsxs)(`div`,{className:`space-y-2`,children:[(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.openAtLogin}),(0,C.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.openAtLoginDesc})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!u,checked:!!u?.openAtLogin,onChange:e=>{V({openAtLogin:e.target.checked})}})]}),(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.keepAwake}),(0,C.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.keepAwakeDesc})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!u,checked:!!u?.keepAwakePreferred,onChange:e=>{V({keepAwakePreferred:e.target.checked})}})]}),(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.notifyDesktop}),(0,C.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.notifyDesktopDesc})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!u||A,checked:!!u?.notifyEnabled,onChange:e=>{H(e.target.checked)}})]}),(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.notifySound}),(0,C.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.notifySoundDesc})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!u,checked:!!u?.notifySoundEnabled,onChange:e=>{V({notifySoundEnabled:e.target.checked})}})]})]})]}),u&&m?(0,C.jsxs)(`section`,{className:y(),children:[(0,C.jsxs)(`div`,{className:`mb-4 flex flex-col gap-1 sm:flex-row sm:items-center sm:justify-between`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.permissionsTitle}),(0,C.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:J}),u.platform===`darwin`&&!u.packaged?(0,C.jsx)(`p`,{className:`mt-1 text-xs text-amber-600 dark:text-amber-400`,children:t.permissionsHintDevDarwin}):null]}),(0,C.jsxs)(`button`,{type:`button`,disabled:N||A,"aria-busy":N,className:r(`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`,p.press),onClick:()=>void B(),children:[(0,C.jsx)(f,{className:r(`size-3.5`,N&&`animate-spin`),strokeWidth:1.75,"aria-hidden":!0}),N?t.refreshing:t.refresh]})]}),(0,C.jsx)(`ul`,{className:`space-y-3`,children:P(u.platform).map(({key:n,pane:i})=>{let a=F(e,m[n]),s=t.perm[n],c=m[n]===`unknown`?I(e,n,u.platform):null;return s?(0,C.jsxs)(`li`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,C.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:s.title}),(0,C.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:s.desc}),(0,C.jsx)(`p`,{className:`mt-1 text-xs font-medium ${a.className}`,children:a.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,m[n],u.platform)?(0,C.jsx)(`button`,{type:`button`,disabled:A,className:r(`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`,p.press),onClick:()=>void K(),children:t.requestAccess}):null,n===`microphone`&&j(n,m[n],u.platform)?(0,C.jsx)(`button`,{type:`button`,disabled:A,className:r(`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`,p.press),onClick:()=>void W(),children:t.requestAccess}):null,n===`accessibility`&&j(n,m[n],u.platform)?(0,C.jsx)(`button`,{type:`button`,disabled:A,className:r(`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`,p.press),onClick:()=>void G(),children:t.requestAccess}):null,n===`screen`&&j(n,m[n],u.platform)?(0,C.jsx)(`button`,{type:`button`,disabled:A,className:r(`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`,p.press),onClick:()=>void q(),children:t.requestAccess}):null,M(n,m[n],u.platform)?(0,C.jsxs)(`button`,{type:`button`,className:r(`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`,p.press),onClick:()=>void U(i),children:[t.openSettings,(0,C.jsx)(o,{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"./cn-JdwAhgNB.js";import{t as i}from"./messages-DQ5X6cXp.js";import{n as a}from"./locale-store-Bjvw7jtg.js";import{Al as o,An as s,At as c,Fo as l,On as u,Xs as d,cc as f,ds as p,gu as m,jn as h,kn as g}from"./index-Cb9y6tVR.js";import{n as _,r as v}from"./settings-page-layout-BdkN2U81.js";import{r as y,t as b}from"./settings-form-section-DZUGXwFO.js";var x=e(t(),1);async function S(e,t){let n=window.electronAPI?.system;if(!l()||!n?.requestNotifications)return`unsupported`;let r=await n.requestNotifications();if(r.status!==`granted`)return r.task===`opened-settings`||r.status===`denied`?`denied`:`default`;await n.setBehavior({notifyEnabled:!0});let i=await n.showEndpointNotification({title:e,body:t});return i.ok||await n.setBehavior({notifyEnabled:!1}),i.ok?`enabled`:`default`}var C=n();function w(){let e=i(a(e=>e.language)).systemSettings.browserNotify,[t,n]=(0,x.useState)(s),[r,o]=(0,x.useState)(null),[c,l]=(0,x.useState)(!1),d=async t=>{if(!t){n(h({enabled:!1})),o(null);return}l(!0);try{let t=await u();if(t!==`granted`){o(t===`unsupported`?e.unsupported:e.denied);return}n(h({enabled:!0})),o(await g(e.testTitle,e.testBody)?e.testShown:e.failed)}finally{l(!1)}},f=e=>{n(h(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)(m,{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:c||e!==`enabled`&&!t.enabled,checked:t[e],onChange:t=>{e===`enabled`?d(t.target.checked):f({[e]:t.target.checked})}})]},e))}),r?(0,C.jsx)(`p`,{className:`mt-3 text-sm text-fg-muted`,role:`status`,children:r}):null,(0,C.jsx)(`p`,{className:`mt-4 text-xs text-fg-muted`,children:e.limitation})]})]})}async function T(){if(typeof navigator>`u`||!navigator.mediaDevices?.getUserMedia)return!1;try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});for(let t of e.getTracks())t.stop();return!0}catch{return!1}}function E(e,t,n){return e.task===`opened-settings`?n.openedSettings:e.status===`granted`&&t?e.task===`already-granted`?n.alreadyGranted:n.granted:t?e.status===`denied`?n.denied:n.prompted:n.rendererDenied}function D(e,t){return e.task===`opened-settings`?t.openedSettings:e.status===`granted`?e.task===`already-granted`?t.alreadyGranted:t.granted:t.denied}function O(e,t){return e.task===`opened-settings`?t.openedSettings:e.status===`granted`?e.task===`already-granted`?t.alreadyGranted:t.granted:e.status===`denied`?t.denied:t.prompted}function k(e,t){return e.task===`opened-settings`?t.openedSettings:e.status===`granted`?e.task===`already-granted`?t.alreadyGranted:t.granted:e.status===`denied`?t.denied:t.prompted}var A=new Set([`microphone`,`accessibility`,`notifications`,`screen`]);function j(e,t,n){return t===`granted`?!1:e===`accessibility`&&(n===`darwin`||n===`win32`||n===`linux`)||e===`screen`&&(n===`darwin`||n===`win32`)||A.has(e)?t===`unknown`:!1}function M(e,t,n){return e===`accessibility`?!1:e===`screen`&&n===`linux`?!0:A.has(e)?t===`denied`:!0}var N=[{key:`fullDisk`,pane:`fullDisk`,platforms:[`darwin`]},{key:`screen`,pane:`screen`},{key:`microphone`,pane:`microphone`},{key:`accessibility`,pane:`accessibility`},{key:`automation`,pane:`automation`},{key:`notifications`,pane:`notifications`},{key:`location`,pane:`location`}];function P(e){return e===`linux`?N:N.filter(t=>!t.platforms||t.platforms.includes(e))}function F(e,t){let n=i(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=i(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=a(e=>e.language),t=i(e).systemSettings,[n,s]=(0,x.useReducer)(c,L),{behavior:u,perms:m,loadError:h,permFeedback:g,permBusy:A,refreshing:N}=n,R=typeof window<`u`?window.electronAPI?.system:void 0,z=(0,x.useCallback)(async e=>{if(R){s({type:`patch`,patch:{loadError:null}});try{s({type:`patch`,patch:{behavior:await R.getBehavior(),perms:await R.getPermissions({probe:e?.showRefreshFeedback}),...e?.showRefreshFeedback?{permFeedback:t.refreshDone}:{}}})}catch(t){s({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)){s({type:`patch`,patch:{refreshing:!0}});try{await z({showRefreshFeedback:!0})}finally{s({type:`patch`,patch:{refreshing:!1}})}}},[z,A,N]);if((0,x.useEffect)(()=>{let e=new Set([t.refreshDone,t.openSettingsDone,t.openSettingsFailed,t.desktopNotify.testShown]);if(!g||!e.has(g))return;let n=window.setTimeout(()=>{s({type:`patch`,patch:{permFeedback:null}})},3e3);return()=>window.clearTimeout(n)},[g,t.openSettingsDone,t.openSettingsFailed,t.refreshDone,t.desktopNotify.testShown]),(0,x.useEffect)(()=>{l()&&R&&z()},[R,z]),!l()||!R)return(0,C.jsx)(w,{});let V=async e=>{try{let{behavior:t}=await R.setBehavior(e);s({type:`patch`,patch:{behavior:t}})}catch(e){s({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}},H=async e=>{if(!e){await V({notifyEnabled:!1});return}s({type:`patch`,patch:{permBusy:!0,permFeedback:null}});try{let e=await S(t.desktopNotify.testTitle,t.desktopNotify.testBody);if(e===`unsupported`){s({type:`patch`,patch:{permFeedback:t.notificationsFeedback.unsupported}});return}if(e===`denied`){s({type:`patch`,patch:{permFeedback:t.desktopNotify.denied}});return}if(e==="default"){s({type:`patch`,patch:{permFeedback:t.notificationsFeedback.default}});return}await V({notifyEnabled:!0}),s({type:`patch`,patch:{perms:await R.getPermissions()}}),s({type:`patch`,patch:{permFeedback:t.desktopNotify.testShown}})}catch(e){s({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{s({type:`patch`,patch:{permBusy:!1}})}},U=async e=>{s({type:`patch`,patch:{permFeedback:null}}),s({type:`patch`,patch:{loadError:null}});try{(await R.openPrivacy(e)).ok?s({type:`patch`,patch:{permFeedback:t.openSettingsDone}}):s({type:`patch`,patch:{permFeedback:t.openSettingsFailed}})}catch(e){s({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}},W=async()=>{s({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),s({type:`patch`,patch:{loadError:null}});try{let e=await R.requestMicrophone(),n=await T();s({type:`patch`,patch:{perms:await R.getPermissions()}}),s({type:`patch`,patch:{permFeedback:E(e,n,t.permFeedback)}})}catch(e){s({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{s({type:`patch`,patch:{permBusy:!1}})}},G=async()=>{if(R.requestAccessibility){s({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),s({type:`patch`,patch:{loadError:null}});try{let e=await R.requestAccessibility();s({type:`patch`,patch:{perms:await R.getPermissions()}}),s({type:`patch`,patch:{permFeedback:D(e,t.accessibilityFeedback)}})}catch(e){s({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{s({type:`patch`,patch:{permBusy:!1}})}}},K=async()=>{if(R.requestNotifications){s({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),s({type:`patch`,patch:{loadError:null}});try{let e=await R.requestNotifications();s({type:`patch`,patch:{perms:await R.getPermissions()}}),s({type:`patch`,patch:{permFeedback:O(e,t.notificationsFeedback)}})}catch(e){s({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{s({type:`patch`,patch:{permBusy:!1}})}}},q=async()=>{if(R.requestScreen){s({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),s({type:`patch`,patch:{loadError:null}});try{let e=await R.requestScreen();s({type:`patch`,patch:{perms:await R.getPermissions()}}),s({type:`patch`,patch:{permFeedback:k(e,t.screenFeedback)}})}catch(e){s({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{s({type:`patch`,patch:{permBusy:!1}})}}},J=u?u.platform===`win32`?t.permissionsHintWin:u.platform===`linux`?t.permissionsHintLinux:u.platform===`darwin`?t.permissionsHintDarwin:t.permissionsHint:t.permissionsHint;return(0,C.jsxs)(v,{gap:`gap-6`,children:[(0,C.jsx)(_,{title:t.title}),h?(0,C.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:h}):null,g?(0,C.jsx)(`p`,{className:r(`text-sm`,g===t.refreshDone||g===t.openSettingsDone||g===t.permFeedback.granted||g===t.permFeedback.alreadyGranted||g===t.accessibilityFeedback.granted||g===t.accessibilityFeedback.alreadyGranted||g===t.notificationsFeedback.granted||g===t.notificationsFeedback.alreadyGranted||g===t.screenFeedback.granted||g===t.screenFeedback.alreadyGranted||g===t.desktopNotify.testShown?`text-emerald-600 dark:text-emerald-400`:`text-fg-muted`),role:`status`,"aria-live":`polite`,children:g}):null,(0,C.jsxs)(b,{children:[(0,C.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,C.jsx)(d,{className:`size-4 text-accent`,strokeWidth:1.75}),t.behaviorGroup]}),(0,C.jsxs)(`div`,{className:`space-y-2`,children:[(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.openAtLogin}),(0,C.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.openAtLoginDesc})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!u,checked:!!u?.openAtLogin,onChange:e=>{V({openAtLogin:e.target.checked})}})]}),(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.keepAwake}),(0,C.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.keepAwakeDesc})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!u,checked:!!u?.keepAwakePreferred,onChange:e=>{V({keepAwakePreferred:e.target.checked})}})]}),(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.notifyDesktop}),(0,C.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.notifyDesktopDesc})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!u||A,checked:!!u?.notifyEnabled,onChange:e=>{H(e.target.checked)}})]}),(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.notifySound}),(0,C.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.notifySoundDesc})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!u,checked:!!u?.notifySoundEnabled,onChange:e=>{V({notifySoundEnabled:e.target.checked})}})]})]})]}),u&&m?(0,C.jsxs)(`section`,{className:y(),children:[(0,C.jsxs)(`div`,{className:`mb-4 flex flex-col gap-1 sm:flex-row sm:items-center sm:justify-between`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.permissionsTitle}),(0,C.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:J}),u.platform===`darwin`&&!u.packaged?(0,C.jsx)(`p`,{className:`mt-1 text-xs text-amber-600 dark:text-amber-400`,children:t.permissionsHintDevDarwin}):null]}),(0,C.jsxs)(`button`,{type:`button`,disabled:N||A,"aria-busy":N,className:r(`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`,p.press),onClick:()=>void B(),children:[(0,C.jsx)(f,{className:r(`size-3.5`,N&&`animate-spin`),strokeWidth:1.75,"aria-hidden":!0}),N?t.refreshing:t.refresh]})]}),(0,C.jsx)(`ul`,{className:`space-y-3`,children:P(u.platform).map(({key:n,pane:i})=>{let a=F(e,m[n]),s=t.perm[n],c=m[n]===`unknown`?I(e,n,u.platform):null;return s?(0,C.jsxs)(`li`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,C.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:s.title}),(0,C.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:s.desc}),(0,C.jsx)(`p`,{className:`mt-1 text-xs font-medium ${a.className}`,children:a.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,m[n],u.platform)?(0,C.jsx)(`button`,{type:`button`,disabled:A,className:r(`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`,p.press),onClick:()=>void K(),children:t.requestAccess}):null,n===`microphone`&&j(n,m[n],u.platform)?(0,C.jsx)(`button`,{type:`button`,disabled:A,className:r(`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`,p.press),onClick:()=>void W(),children:t.requestAccess}):null,n===`accessibility`&&j(n,m[n],u.platform)?(0,C.jsx)(`button`,{type:`button`,disabled:A,className:r(`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`,p.press),onClick:()=>void G(),children:t.requestAccess}):null,n===`screen`&&j(n,m[n],u.platform)?(0,C.jsx)(`button`,{type:`button`,disabled:A,className:r(`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`,p.press),onClick:()=>void q(),children:t.requestAccess}):null,M(n,m[n],u.platform)?(0,C.jsxs)(`button`,{type:`button`,className:r(`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`,p.press),onClick:()=>void U(i),children:[t.openSettings,(0,C.jsx)(o,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0})]}):null]})]},n):null})})]}):null]})}export{R as SystemSettingsPanel};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{d as i,f as a,t as o}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{l as s,n as c}from"./locale-store-Bjvw7jtg.js";import{Al as l,Ao as u,Cc as d,Cl as f,Ct as p,Da as m,Jl as h,Jr as g,Kr as _,La as v,Mo as y,No as b,Oo as x,Po as S,Sn as C,Su as w,Tt as ee,Yr as te,Zr as ne,_c as T,_s as E,bi as re,bl as ie,bs as D,fu as ae,ht as oe,jl as se,jo as O,ko as k,pt as ce,ql as A,qr as le,rt as j,su as ue,tu as M,ua as de,xc as fe,xi as pe,yt as me}from"./index-BpkdvHH0.js";import{t as he}from"./dependency-picker-DOdkHdPv.js";var N=n(),P=e(t(),1),F=r();function I(e,t){return(t===`zh`?{backlog:`收集箱`,ready:`就绪`,active:`进行中`,review:`待验收`,closed:`已关闭`}:{backlog:`Backlog`,ready:`Ready`,active:`Active`,review:`Review`,closed:`Closed`})[e]}function ge(){let e=(0,N.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,F.jsxs)(`div`,{className:`space-y-4`,"aria-busy":!0,children:[(0,F.jsx)(m,{className:`h-32 rounded-2xl`}),(0,F.jsx)(m,{className:`h-52 rounded-2xl`}),(0,F.jsx)(m,{className:`h-40 rounded-2xl`})]}),e[0]=t):t=e[0],t}function L(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 R(e){let t=(0,N.c)(9),{items:n,empty:r,verificationByCriterion:i}=e;if(n.length===0){let e;return t[0]===r?e=t[1]:(e=(0,F.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,F.jsxs)(`li`,{className:`flex gap-2 text-sm leading-6 text-fg`,children:[(0,F.jsx)(t===`passed`?M:t===`failed`?h:A,{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,F.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,F.jsx)(`ul`,{className:`space-y-2`,children:a}),t[7]=a,t[8]=o),o}function z({taskId:e,presentation:t,backgroundPath:n}){let[r]=a(),i=c(e=>e.language),u=s(e=>e.token),m=(0,P.useMemo)(()=>ce(i),[i]),h=v(e=>e.setPageHeader),y=v(e=>e.clearPageHeader),[b,x]=(0,P.useState)(null),[S,D]=(0,P.useState)(null),[O,k]=(0,P.useState)(!1),[A,N]=(0,P.useState)([]),[z,B]=(0,P.useState)(null),[V,H]=(0,P.useState)(!1),[U,W]=(0,P.useState)([]),G=(0,P.useMemo)(()=>re(r.get(`returnTo`),`/`,[`/projects`,`/chat`,`/notes`,`/tasks`]),[r]);(0,P.useEffect)(()=>{let t=!0;return x(null),D(null),me(e).then(e=>{t&&x(e)}).catch(()=>{t&&D(m.taskNotFound)}),()=>{t=!1}},[m.taskNotFound,e,u]),(0,P.useEffect)(()=>{let t=b?.task.projectId,n=b?.dependencies??[];if(!t){B(null),N(n);return}B(null);let r=!0;return de(t).then(t=>{if(!r)return;B(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});N([...i.values()])}).catch(()=>{r&&(B(null),N(n))}),()=>{r=!1}},[b?.dependencies,b?.task.projectId,e]);let K=async t=>{if(b){k(!0),D(null);try{x(await oe(e,t,b.task.version))}catch{D(m.actionFailed)}finally{k(!1)}}},_e=async()=>{if(b){k(!0),D(null);try{x(await ee(e,U,b.task.version)),H(!1)}catch{D(m.dependencyUpdateFailed)}finally{k(!1)}}};if((0,P.useLayoutEffect)(()=>{if(t!==`modal`)return h({startExtra:(0,F.jsx)(o,{to:G,className:`flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover`,"aria-label":m.backToWork,children:(0,F.jsx)(w,{className:`size-4`})}),main:b?(0,F.jsxs)(`div`,{className:`min-w-0`,children:[(0,F.jsx)(`p`,{className:`truncate text-sm font-semibold text-fg`,children:z?`${z} / ${m.taskLabel}`:m.taskLabel}),(0,F.jsx)(`p`,{className:`text-xs text-fg-muted`,children:m.detailStatuses[L(b)]})]}):null,end:null}),y},[y,m.backToWork,m.detailStatuses,m.taskLabel,b,t,z,G,h]),S&&!b)return(0,F.jsx)(`div`,{className:t===`modal`?`p-5 text-sm text-danger`:`mx-auto max-w-3xl p-6 text-sm text-danger`,children:S});if(!b)return(0,F.jsx)(`div`,{className:t===`modal`?`p-5`:`mx-auto max-w-4xl p-4 sm:p-6`,children:(0,F.jsx)(ge,{})});let q=b.waits[0],J=q?.kind===`paused`?q:void 0,Y=b.receipts[0],ve=m.detailStatuses[L(b)],ye=m.detailStatusDescriptions[L(b)],X=b.task.body?.trim()||b.task.contract?.objective.trim(),be=b.task.delegateAgentId??b.task.ownerId,Z=new Map(Y?.verification.checks.map(e=>[e.criterion,e.status])),xe=b.allowedCommands.includes(`mark_ready`),Se=b.allowedCommands.includes(`start`),Ce=b.allowedCommands.includes(`add_wait`),we=b.task.phase===`review`&&b.allowedCommands.includes(`close`),Te=b.allowedCommands.includes(`reopen`),Ee=b.attention.some(e=>e.kind===`input_required`||e.kind===`approval_required`),Q=b.task.contract?.acceptanceCriteria??[],De=Q.filter(e=>Z.get(e)===`passed`).length,$=b.task.contract?.expectedOutputs??[],Oe=b.task.contract?.constraints??[],ke=b.task.contract?.approvalRequired??[],Ae=b.task.contract?.assumptions??[],je=b.task.contract?.risks??[],Me=e=>t===`modal`&&n?C(n,e):pe(`/tasks/${e}`,G);return(0,F.jsxs)(`div`,{className:t===`modal`?`space-y-4 p-5`:`mx-auto max-w-4xl space-y-4 p-4 pb-16 sm:p-6`,children:[(0,F.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-panel p-5`,children:[(0,F.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:[(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsx)(`span`,{className:`inline-flex rounded-full bg-accent-soft px-2.5 py-1 text-xs font-medium text-accent-fg`,children:ve}),(0,F.jsx)(`h1`,{className:`mt-3 text-xl font-semibold leading-7 text-fg`,children:b.task.title}),X&&X!==b.task.title?(0,F.jsx)(`p`,{className:`mt-2 whitespace-pre-wrap text-sm leading-6 text-fg-muted`,children:X}):null,(0,F.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-x-4 gap-y-2 text-xs text-fg-muted`,children:[z?(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,F.jsx)(ie,{className:`size-3.5`,"aria-hidden":!0}),z]}):null,(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,F.jsx)(f,{className:`size-3.5`,"aria-hidden":!0}),m.priorityLabels[b.task.priority]]}),(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,F.jsx)(ae,{className:`size-3.5`,"aria-hidden":!0}),be??m.unassigned]}),(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,F.jsx)(ue,{className:`size-3.5`,"aria-hidden":!0}),b.task.dueAt?j(b.task.dueAt,i):m.noDueDate]})]})]}),(0,F.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[xe?(0,F.jsxs)(E,{disabled:O,onClick:()=>void K({type:`mark_ready`}),children:[(0,F.jsx)(T,{className:`size-4`}),m.scheduleTask]}):null,J?(0,F.jsxs)(E,{disabled:O,onClick:()=>void K({type:`resolve_wait`,waitId:J.id}),children:[(0,F.jsx)(T,{className:`size-4`}),m.resumeTask]}):null,!q&&Se?(0,F.jsxs)(E,{disabled:O,onClick:()=>void K({type:`start`,executor:{kind:`agent`,agentId:b.task.delegateAgentId??`main`}}),children:[(0,F.jsx)(T,{className:`size-4`}),m.runTask]}):null,we?(0,F.jsxs)(E,{disabled:O,onClick:()=>void K({type:`close`,resolution:`done`}),children:[(0,F.jsx)(M,{className:`size-4`}),m.approveTask]}):null,Te?(0,F.jsxs)(E,{disabled:O,onClick:()=>void K({type:`reopen`,phase:`ready`}),children:[(0,F.jsx)(T,{className:`size-4`}),m.reopenTask]}):null,!q&&Ce?(0,F.jsxs)(E,{variant:`secondary`,disabled:O,onClick:()=>void K({type:`add_wait`,wait:{kind:`paused`,reason:`Paused by user`,condition:{}}}),children:[(0,F.jsx)(d,{className:`size-4`}),m.pauseTask]}):null,b.task.phase===`closed`?null:(0,F.jsxs)(te,{children:[(0,F.jsx)(ne,{asChild:!0,children:(0,F.jsx)(E,{type:`button`,variant:`ghost`,className:`size-9 p-0`,disabled:O,"aria-label":m.moreActions,children:(0,F.jsx)(se,{className:`size-4`,"aria-hidden":!0})})}),(0,F.jsx)(g,{children:(0,F.jsx)(_,{align:`end`,sideOffset:6,className:`z-[100] min-w-40 rounded-lg border border-edge bg-surface-panel p-1 shadow-lg`,children:(0,F.jsx)(le,{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 K({type:`close`,resolution:`cancelled`}),children:m.cancelTask})})})]})]})]}),S?(0,F.jsx)(`p`,{className:`mt-3 text-sm text-danger`,children:S}):null]}),(0,F.jsxs)(`section`,{className:`rounded-2xl border border-accent/20 bg-accent-soft/40 p-5`,children:[(0,F.jsx)(`h2`,{className:`font-medium text-fg`,children:m.statusSummary}),(0,F.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:ye}),(0,F.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:m.updatedAt.replace(`{{date}}`,j(b.task.updatedAt,i))})]}),b.attention.length>0?(0,F.jsxs)(`section`,{className:`rounded-2xl border border-warning/40 bg-warning/5 p-5`,children:[(0,F.jsx)(`h3`,{className:`font-medium text-fg`,children:Ee?m.needsAttention:m.waitingStatus}),(0,F.jsx)(`ul`,{className:`mt-3 space-y-2 text-sm text-fg-muted`,children:b.attention.map((e,t)=>(0,F.jsx)(`li`,{children:e.summary},`${e.kind}-${t}`))})]}):null,Y?(0,F.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-panel p-5`,children:[(0,F.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`h2`,{className:`font-medium text-fg`,children:m.latestResult}),(0,F.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg`,children:Y.summary})]}),(0,F.jsxs)(`span`,{className:`rounded-full bg-surface-hover px-2.5 py-1 text-xs text-fg-muted`,children:[m.receiptStatuses[Y.status],` · `,m.verificationStatuses[Y.verification.status]]})]}),Y.remainingWork.length>0?(0,F.jsxs)(`div`,{className:`mt-4`,children:[(0,F.jsx)(`h3`,{className:`text-xs font-medium text-fg-muted`,children:m.remainingWork}),(0,F.jsx)(`div`,{className:`mt-2`,children:(0,F.jsx)(R,{items:Y.remainingWork,empty:m.noRemainingWork})})]}):null,Y.nextAction?(0,F.jsxs)(`div`,{className:`mt-4 rounded-lg bg-surface-hover p-3`,children:[(0,F.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:m.nextAction}),(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:Y.nextAction})]}):null,(0,F.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2`,children:[(0,F.jsx)(E,{className:`px-2 py-1 text-xs`,variant:`secondary`,onClick:()=>void p(Y.runId,`helpful`),children:m.doneWell}),(0,F.jsx)(E,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>void p(Y.runId,`not_helpful`),children:m.needsFix}),Y.evidence.filter(e=>e.uri).map(e=>(0,F.jsxs)(`a`,{className:`ml-auto inline-flex items-center gap-1 text-xs text-accent hover:underline`,href:e.uri,children:[(0,F.jsx)(l,{className:`size-3`}),e.title]},`${e.title}-${e.uri}`))]}),b.receipts.length>1?(0,F.jsxs)(`details`,{className:`mt-4 border-t border-edge pt-4`,children:[(0,F.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted`,children:m.executionHistory.replace(`{{count}}`,String(b.receipts.length-1))}),(0,F.jsx)(`div`,{className:`mt-3 space-y-3`,children:b.receipts.slice(1).map(e=>(0,F.jsx)(`article`,{className:`rounded-lg bg-surface-hover p-3`,children:(0,F.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,F.jsx)(`p`,{className:`text-sm text-fg`,children:e.summary}),(0,F.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:m.receiptStatuses[e.status]})]})},e.runId))})]}):null]}):null,(0,F.jsxs)(`div`,{className:`grid items-start gap-4 lg:grid-cols-[minmax(0,2fr)_minmax(16rem,1fr)]`,children:[(0,F.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-panel p-5`,children:[(0,F.jsx)(`h2`,{className:`font-medium text-fg`,children:m.taskDefinition}),(0,F.jsxs)(`div`,{className:`mt-5`,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,F.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:m.successDefinition}),Q.length>0?(0,F.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:m.criteriaProgress.replace(`{{verified}}`,String(De)).replace(`{{total}}`,String(Q.length))}):null]}),(0,F.jsx)(`div`,{className:`mt-3`,children:(0,F.jsx)(R,{items:Q,empty:m.noDefinition,verificationByCriterion:Z})})]}),$.length>0?(0,F.jsxs)(`div`,{className:`mt-5 border-t border-edge pt-5`,children:[(0,F.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:m.expectedOutputs}),(0,F.jsx)(`div`,{className:`mt-3`,children:(0,F.jsx)(R,{items:$,empty:m.noDefinition})})]}):null,Oe.length>0?(0,F.jsxs)(`details`,{className:`mt-5 border-t border-edge pt-4`,children:[(0,F.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:m.constraints}),(0,F.jsx)(`div`,{className:`mt-3`,children:(0,F.jsx)(R,{items:Oe,empty:m.noDefinition})})]}):null,ke.length>0?(0,F.jsxs)(`details`,{className:`mt-4 border-t border-edge pt-4`,children:[(0,F.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:m.approvalRequired}),(0,F.jsx)(`div`,{className:`mt-3`,children:(0,F.jsx)(R,{items:ke,empty:m.noDefinition})})]}):null,Ae.length>0?(0,F.jsxs)(`details`,{className:`mt-4 border-t border-edge pt-4`,children:[(0,F.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:m.contextAssumptions}),(0,F.jsx)(`div`,{className:`mt-3`,children:(0,F.jsx)(R,{items:Ae,empty:m.noDefinition})})]}):null,je.length>0?(0,F.jsxs)(`details`,{className:`mt-4 border-t border-edge pt-4`,children:[(0,F.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:m.contextRisks}),(0,F.jsx)(`div`,{className:`mt-3`,children:(0,F.jsx)(R,{items:je,empty:m.noDefinition})})]}):null]}),(0,F.jsxs)(`div`,{className:`grid min-w-0 gap-4`,children:[(0,F.jsxs)(`section`,{className:`min-w-0 rounded-2xl border border-edge bg-surface-panel p-5`,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,F.jsx)(`h2`,{className:`font-medium text-fg`,children:m.taskRelations}),V?null:(0,F.jsxs)(E,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,onClick:()=>{W(b.dependencies.map(e=>e.id)),H(!0)},children:[(0,F.jsx)(fe,{className:`size-3.5`,"aria-hidden":!0}),m.editDependencies]})]}),V?(0,F.jsxs)(`div`,{className:`mt-4 grid gap-3`,children:[(0,F.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:m.dependenciesDescription}),(0,F.jsx)(he,{candidates:A,selectedIds:U,disabled:O,onChange:W,labels:{link:m.linkDependencies,linked:m.linkedDependencies,searchPlaceholder:m.dependencySearchPlaceholder,noMatches:m.noDependencyMatches,noCandidates:m.noDependencyCandidates,remove:m.removeDependency}}),(0,F.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,F.jsx)(E,{type:`button`,variant:`ghost`,disabled:O,onClick:()=>H(!1),children:m.cancelDependencyEdit}),(0,F.jsx)(E,{type:`button`,variant:`primary`,disabled:O,onClick:()=>void _e(),children:m.saveDependencies})]})]}):(0,F.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:m.dependencies}),b.dependencies.length>0?(0,F.jsx)(`div`,{className:`space-y-2`,children:b.dependencies.map(e=>(0,F.jsxs)(o,{to:Me(e.id),className:`block rounded-lg bg-surface-hover p-2.5 text-sm text-accent hover:underline`,children:[(0,F.jsx)(`span`,{className:`break-words`,children:e.title}),(0,F.jsx)(`span`,{className:`mt-1 block text-xs text-fg-subtle`,children:I(e.phase,i)})]},e.id))}):(0,F.jsx)(`p`,{className:`text-sm text-fg-subtle`,children:m.noDependencies})]}),(0,F.jsxs)(`div`,{className:`rounded-lg border border-accent/25 bg-accent-soft/40 p-3`,children:[(0,F.jsx)(`p`,{className:`text-xs font-medium text-accent`,children:m.currentTask}),(0,F.jsx)(`p`,{className:`mt-1 break-words text-sm text-fg`,children:b.task.title})]}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:m.dependents}),b.dependents.length>0?(0,F.jsx)(`div`,{className:`space-y-2`,children:b.dependents.map(e=>(0,F.jsxs)(o,{to:Me(e.id),className:`block rounded-lg bg-surface-hover p-2.5 text-sm text-accent hover:underline`,children:[(0,F.jsx)(`span`,{className:`break-words`,children:e.title}),(0,F.jsx)(`span`,{className:`mt-1 block text-xs text-fg-subtle`,children:I(e.phase,i)})]},e.id))}):(0,F.jsx)(`p`,{className:`text-sm text-fg-subtle`,children:m.noDependents})]})]})]}),b.context.length>0?(0,F.jsxs)(`section`,{className:`min-w-0 rounded-2xl border border-edge bg-surface-panel p-5`,children:[(0,F.jsx)(`h2`,{className:`font-medium text-fg`,children:m.contextUsed}),(0,F.jsx)(`ul`,{className:`mt-4 space-y-2`,children:b.context.map(e=>(0,F.jsxs)(`li`,{className:`min-w-0 rounded-lg bg-surface-hover p-2.5`,children:[(0,F.jsxs)(`span`,{className:`text-[11px] text-fg-subtle`,children:[m.contextRoleLabels[e.role],` · `,m.contextKindLabels[e.targetKind]]}),e.targetKind===`url`&&/^https?:\/\//.test(e.targetId)?(0,F.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,F.jsx)(`p`,{className:`mt-1 break-words text-sm text-fg`,children:e.title??e.targetId})]},e.id))})]}):null]})]})]})}function B(){let e=(0,N.c)(2),{taskId:t}=i(),n=t===void 0?``:t,r;return e[0]===n?r=e[1]:(r=(0,F.jsx)(z,{taskId:n,presentation:`page`}),e[0]=n,e[1]=r),r}function V(e){let t=(0,N.c)(23),{taskId:n,backgroundPath:r,onClose:i}=e,a=c(H),o;t[0]===i?o=t[1]:(o=e=>{e||i()},t[0]=i,t[1]=o);let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,F.jsx)(y,{className:`fixed inset-0 z-[80] bg-black/45 backdrop-blur-[1px]`}),t[2]=s):s=t[2];let l=a===`zh`?`任务详情`:`Task details`,d;t[3]===l?d=t[4]:(d=(0,F.jsx)(S,{className:`font-medium text-fg`,children:l}),t[3]=l,t[4]=d);let f=a===`zh`?`查看并操作任务详情`:`View and manage task details`,p;t[5]===f?p=t[6]:(p=(0,F.jsx)(O,{className:`sr-only`,children:f}),t[5]=f,t[6]=p);let m=a===`zh`?`关闭任务详情`:`Close task details`,h;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,F.jsx)(D,{className:`size-4`,"aria-hidden":!0}),t[7]=h):h=t[7];let g;t[8]===m?g=t[9]:(g=(0,F.jsx)(k,{className:`flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":m,children:h}),t[8]=m,t[9]=g);let _;t[10]!==d||t[11]!==p||t[12]!==g?(_=(0,F.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-3 border-b border-edge px-5 py-3.5`,children:[d,p,g]}),t[10]=d,t[11]=p,t[12]=g,t[13]=_):_=t[13];let v;t[14]!==r||t[15]!==n?(v=(0,F.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,F.jsx)(z,{taskId:n,presentation:`modal`,backgroundPath:r})}),t[14]=r,t[15]=n,t[16]=v):v=t[16];let C;t[17]!==_||t[18]!==v?(C=(0,F.jsxs)(b,{children:[s,(0,F.jsxs)(u,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(52rem,calc(100dvh-2rem))] w-[min(64rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-base shadow-float focus:outline-none`,children:[_,v]})]}),t[17]=_,t[18]=v,t[19]=C):C=t[19];let w;return t[20]!==o||t[21]!==C?(w=(0,F.jsx)(x,{open:!0,onOpenChange:o,children:C}),t[20]=o,t[21]=C,t[22]=w):w=t[22],w}function H(e){return e.language}export{V as TaskDetailModal,B 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,f as a,t as o}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{l as s,n as c}from"./locale-store-Bjvw7jtg.js";import{Al as l,Ao as u,Cc as d,Cl as f,Ct as p,Da as m,Jl as h,Jr as g,Kr as _,La as v,Mo as y,No as b,Oo as x,Po as S,Sn as C,Su as w,Tt as ee,Yr as te,Zr as ne,_c as T,_s as E,bi as re,bl as ie,bs as D,fu as ae,ht as oe,jl as se,jo as O,ko as k,pt as ce,ql as A,qr as le,rt as j,su as ue,tu as M,ua as de,xc as fe,xi as pe,yt as me}from"./index-Cb9y6tVR.js";import{t as he}from"./dependency-picker-3vjdusik.js";var N=n(),P=e(t(),1),F=r();function I(e,t){return(t===`zh`?{backlog:`收集箱`,ready:`就绪`,active:`进行中`,review:`待验收`,closed:`已关闭`}:{backlog:`Backlog`,ready:`Ready`,active:`Active`,review:`Review`,closed:`Closed`})[e]}function ge(){let e=(0,N.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,F.jsxs)(`div`,{className:`space-y-4`,"aria-busy":!0,children:[(0,F.jsx)(m,{className:`h-32 rounded-2xl`}),(0,F.jsx)(m,{className:`h-52 rounded-2xl`}),(0,F.jsx)(m,{className:`h-40 rounded-2xl`})]}),e[0]=t):t=e[0],t}function L(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 R(e){let t=(0,N.c)(9),{items:n,empty:r,verificationByCriterion:i}=e;if(n.length===0){let e;return t[0]===r?e=t[1]:(e=(0,F.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,F.jsxs)(`li`,{className:`flex gap-2 text-sm leading-6 text-fg`,children:[(0,F.jsx)(t===`passed`?M:t===`failed`?h:A,{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,F.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,F.jsx)(`ul`,{className:`space-y-2`,children:a}),t[7]=a,t[8]=o),o}function z({taskId:e,presentation:t,backgroundPath:n}){let[r]=a(),i=c(e=>e.language),u=s(e=>e.token),m=(0,P.useMemo)(()=>ce(i),[i]),h=v(e=>e.setPageHeader),y=v(e=>e.clearPageHeader),[b,x]=(0,P.useState)(null),[S,D]=(0,P.useState)(null),[O,k]=(0,P.useState)(!1),[A,N]=(0,P.useState)([]),[z,B]=(0,P.useState)(null),[V,H]=(0,P.useState)(!1),[U,W]=(0,P.useState)([]),G=(0,P.useMemo)(()=>re(r.get(`returnTo`),`/`,[`/projects`,`/chat`,`/notes`,`/tasks`]),[r]);(0,P.useEffect)(()=>{let t=!0;return x(null),D(null),me(e).then(e=>{t&&x(e)}).catch(()=>{t&&D(m.taskNotFound)}),()=>{t=!1}},[m.taskNotFound,e,u]),(0,P.useEffect)(()=>{let t=b?.task.projectId,n=b?.dependencies??[];if(!t){B(null),N(n);return}B(null);let r=!0;return de(t).then(t=>{if(!r)return;B(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});N([...i.values()])}).catch(()=>{r&&(B(null),N(n))}),()=>{r=!1}},[b?.dependencies,b?.task.projectId,e]);let K=async t=>{if(b){k(!0),D(null);try{x(await oe(e,t,b.task.version))}catch{D(m.actionFailed)}finally{k(!1)}}},_e=async()=>{if(b){k(!0),D(null);try{x(await ee(e,U,b.task.version)),H(!1)}catch{D(m.dependencyUpdateFailed)}finally{k(!1)}}};if((0,P.useLayoutEffect)(()=>{if(t!==`modal`)return h({startExtra:(0,F.jsx)(o,{to:G,className:`flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover`,"aria-label":m.backToWork,children:(0,F.jsx)(w,{className:`size-4`})}),main:b?(0,F.jsxs)(`div`,{className:`min-w-0`,children:[(0,F.jsx)(`p`,{className:`truncate text-sm font-semibold text-fg`,children:z?`${z} / ${m.taskLabel}`:m.taskLabel}),(0,F.jsx)(`p`,{className:`text-xs text-fg-muted`,children:m.detailStatuses[L(b)]})]}):null,end:null}),y},[y,m.backToWork,m.detailStatuses,m.taskLabel,b,t,z,G,h]),S&&!b)return(0,F.jsx)(`div`,{className:t===`modal`?`p-5 text-sm text-danger`:`mx-auto max-w-3xl p-6 text-sm text-danger`,children:S});if(!b)return(0,F.jsx)(`div`,{className:t===`modal`?`p-5`:`mx-auto max-w-4xl p-4 sm:p-6`,children:(0,F.jsx)(ge,{})});let q=b.waits[0],J=q?.kind===`paused`?q:void 0,Y=b.receipts[0],ve=m.detailStatuses[L(b)],ye=m.detailStatusDescriptions[L(b)],X=b.task.body?.trim()||b.task.contract?.objective.trim(),be=b.task.delegateAgentId??b.task.ownerId,Z=new Map(Y?.verification.checks.map(e=>[e.criterion,e.status])),xe=b.allowedCommands.includes(`mark_ready`),Se=b.allowedCommands.includes(`start`),Ce=b.allowedCommands.includes(`add_wait`),we=b.task.phase===`review`&&b.allowedCommands.includes(`close`),Te=b.allowedCommands.includes(`reopen`),Ee=b.attention.some(e=>e.kind===`input_required`||e.kind===`approval_required`),Q=b.task.contract?.acceptanceCriteria??[],De=Q.filter(e=>Z.get(e)===`passed`).length,$=b.task.contract?.expectedOutputs??[],Oe=b.task.contract?.constraints??[],ke=b.task.contract?.approvalRequired??[],Ae=b.task.contract?.assumptions??[],je=b.task.contract?.risks??[],Me=e=>t===`modal`&&n?C(n,e):pe(`/tasks/${e}`,G);return(0,F.jsxs)(`div`,{className:t===`modal`?`space-y-4 p-5`:`mx-auto max-w-4xl space-y-4 p-4 pb-16 sm:p-6`,children:[(0,F.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-panel p-5`,children:[(0,F.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:[(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsx)(`span`,{className:`inline-flex rounded-full bg-accent-soft px-2.5 py-1 text-xs font-medium text-accent-fg`,children:ve}),(0,F.jsx)(`h1`,{className:`mt-3 text-xl font-semibold leading-7 text-fg`,children:b.task.title}),X&&X!==b.task.title?(0,F.jsx)(`p`,{className:`mt-2 whitespace-pre-wrap text-sm leading-6 text-fg-muted`,children:X}):null,(0,F.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-x-4 gap-y-2 text-xs text-fg-muted`,children:[z?(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,F.jsx)(ie,{className:`size-3.5`,"aria-hidden":!0}),z]}):null,(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,F.jsx)(f,{className:`size-3.5`,"aria-hidden":!0}),m.priorityLabels[b.task.priority]]}),(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,F.jsx)(ae,{className:`size-3.5`,"aria-hidden":!0}),be??m.unassigned]}),(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,F.jsx)(ue,{className:`size-3.5`,"aria-hidden":!0}),b.task.dueAt?j(b.task.dueAt,i):m.noDueDate]})]})]}),(0,F.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[xe?(0,F.jsxs)(E,{disabled:O,onClick:()=>void K({type:`mark_ready`}),children:[(0,F.jsx)(T,{className:`size-4`}),m.scheduleTask]}):null,J?(0,F.jsxs)(E,{disabled:O,onClick:()=>void K({type:`resolve_wait`,waitId:J.id}),children:[(0,F.jsx)(T,{className:`size-4`}),m.resumeTask]}):null,!q&&Se?(0,F.jsxs)(E,{disabled:O,onClick:()=>void K({type:`start`,executor:{kind:`agent`,agentId:b.task.delegateAgentId??`main`}}),children:[(0,F.jsx)(T,{className:`size-4`}),m.runTask]}):null,we?(0,F.jsxs)(E,{disabled:O,onClick:()=>void K({type:`close`,resolution:`done`}),children:[(0,F.jsx)(M,{className:`size-4`}),m.approveTask]}):null,Te?(0,F.jsxs)(E,{disabled:O,onClick:()=>void K({type:`reopen`,phase:`ready`}),children:[(0,F.jsx)(T,{className:`size-4`}),m.reopenTask]}):null,!q&&Ce?(0,F.jsxs)(E,{variant:`secondary`,disabled:O,onClick:()=>void K({type:`add_wait`,wait:{kind:`paused`,reason:`Paused by user`,condition:{}}}),children:[(0,F.jsx)(d,{className:`size-4`}),m.pauseTask]}):null,b.task.phase===`closed`?null:(0,F.jsxs)(te,{children:[(0,F.jsx)(ne,{asChild:!0,children:(0,F.jsx)(E,{type:`button`,variant:`ghost`,className:`size-9 p-0`,disabled:O,"aria-label":m.moreActions,children:(0,F.jsx)(se,{className:`size-4`,"aria-hidden":!0})})}),(0,F.jsx)(g,{children:(0,F.jsx)(_,{align:`end`,sideOffset:6,className:`z-[100] min-w-40 rounded-lg border border-edge bg-surface-panel p-1 shadow-lg`,children:(0,F.jsx)(le,{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 K({type:`close`,resolution:`cancelled`}),children:m.cancelTask})})})]})]})]}),S?(0,F.jsx)(`p`,{className:`mt-3 text-sm text-danger`,children:S}):null]}),(0,F.jsxs)(`section`,{className:`rounded-2xl border border-accent/20 bg-accent-soft/40 p-5`,children:[(0,F.jsx)(`h2`,{className:`font-medium text-fg`,children:m.statusSummary}),(0,F.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:ye}),(0,F.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:m.updatedAt.replace(`{{date}}`,j(b.task.updatedAt,i))})]}),b.attention.length>0?(0,F.jsxs)(`section`,{className:`rounded-2xl border border-warning/40 bg-warning/5 p-5`,children:[(0,F.jsx)(`h3`,{className:`font-medium text-fg`,children:Ee?m.needsAttention:m.waitingStatus}),(0,F.jsx)(`ul`,{className:`mt-3 space-y-2 text-sm text-fg-muted`,children:b.attention.map((e,t)=>(0,F.jsx)(`li`,{children:e.summary},`${e.kind}-${t}`))})]}):null,Y?(0,F.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-panel p-5`,children:[(0,F.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`h2`,{className:`font-medium text-fg`,children:m.latestResult}),(0,F.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg`,children:Y.summary})]}),(0,F.jsxs)(`span`,{className:`rounded-full bg-surface-hover px-2.5 py-1 text-xs text-fg-muted`,children:[m.receiptStatuses[Y.status],` · `,m.verificationStatuses[Y.verification.status]]})]}),Y.remainingWork.length>0?(0,F.jsxs)(`div`,{className:`mt-4`,children:[(0,F.jsx)(`h3`,{className:`text-xs font-medium text-fg-muted`,children:m.remainingWork}),(0,F.jsx)(`div`,{className:`mt-2`,children:(0,F.jsx)(R,{items:Y.remainingWork,empty:m.noRemainingWork})})]}):null,Y.nextAction?(0,F.jsxs)(`div`,{className:`mt-4 rounded-lg bg-surface-hover p-3`,children:[(0,F.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:m.nextAction}),(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:Y.nextAction})]}):null,(0,F.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2`,children:[(0,F.jsx)(E,{className:`px-2 py-1 text-xs`,variant:`secondary`,onClick:()=>void p(Y.runId,`helpful`),children:m.doneWell}),(0,F.jsx)(E,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>void p(Y.runId,`not_helpful`),children:m.needsFix}),Y.evidence.filter(e=>e.uri).map(e=>(0,F.jsxs)(`a`,{className:`ml-auto inline-flex items-center gap-1 text-xs text-accent hover:underline`,href:e.uri,children:[(0,F.jsx)(l,{className:`size-3`}),e.title]},`${e.title}-${e.uri}`))]}),b.receipts.length>1?(0,F.jsxs)(`details`,{className:`mt-4 border-t border-edge pt-4`,children:[(0,F.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted`,children:m.executionHistory.replace(`{{count}}`,String(b.receipts.length-1))}),(0,F.jsx)(`div`,{className:`mt-3 space-y-3`,children:b.receipts.slice(1).map(e=>(0,F.jsx)(`article`,{className:`rounded-lg bg-surface-hover p-3`,children:(0,F.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,F.jsx)(`p`,{className:`text-sm text-fg`,children:e.summary}),(0,F.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:m.receiptStatuses[e.status]})]})},e.runId))})]}):null]}):null,(0,F.jsxs)(`div`,{className:`grid items-start gap-4 lg:grid-cols-[minmax(0,2fr)_minmax(16rem,1fr)]`,children:[(0,F.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-panel p-5`,children:[(0,F.jsx)(`h2`,{className:`font-medium text-fg`,children:m.taskDefinition}),(0,F.jsxs)(`div`,{className:`mt-5`,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,F.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:m.successDefinition}),Q.length>0?(0,F.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:m.criteriaProgress.replace(`{{verified}}`,String(De)).replace(`{{total}}`,String(Q.length))}):null]}),(0,F.jsx)(`div`,{className:`mt-3`,children:(0,F.jsx)(R,{items:Q,empty:m.noDefinition,verificationByCriterion:Z})})]}),$.length>0?(0,F.jsxs)(`div`,{className:`mt-5 border-t border-edge pt-5`,children:[(0,F.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:m.expectedOutputs}),(0,F.jsx)(`div`,{className:`mt-3`,children:(0,F.jsx)(R,{items:$,empty:m.noDefinition})})]}):null,Oe.length>0?(0,F.jsxs)(`details`,{className:`mt-5 border-t border-edge pt-4`,children:[(0,F.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:m.constraints}),(0,F.jsx)(`div`,{className:`mt-3`,children:(0,F.jsx)(R,{items:Oe,empty:m.noDefinition})})]}):null,ke.length>0?(0,F.jsxs)(`details`,{className:`mt-4 border-t border-edge pt-4`,children:[(0,F.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:m.approvalRequired}),(0,F.jsx)(`div`,{className:`mt-3`,children:(0,F.jsx)(R,{items:ke,empty:m.noDefinition})})]}):null,Ae.length>0?(0,F.jsxs)(`details`,{className:`mt-4 border-t border-edge pt-4`,children:[(0,F.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:m.contextAssumptions}),(0,F.jsx)(`div`,{className:`mt-3`,children:(0,F.jsx)(R,{items:Ae,empty:m.noDefinition})})]}):null,je.length>0?(0,F.jsxs)(`details`,{className:`mt-4 border-t border-edge pt-4`,children:[(0,F.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:m.contextRisks}),(0,F.jsx)(`div`,{className:`mt-3`,children:(0,F.jsx)(R,{items:je,empty:m.noDefinition})})]}):null]}),(0,F.jsxs)(`div`,{className:`grid min-w-0 gap-4`,children:[(0,F.jsxs)(`section`,{className:`min-w-0 rounded-2xl border border-edge bg-surface-panel p-5`,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,F.jsx)(`h2`,{className:`font-medium text-fg`,children:m.taskRelations}),V?null:(0,F.jsxs)(E,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,onClick:()=>{W(b.dependencies.map(e=>e.id)),H(!0)},children:[(0,F.jsx)(fe,{className:`size-3.5`,"aria-hidden":!0}),m.editDependencies]})]}),V?(0,F.jsxs)(`div`,{className:`mt-4 grid gap-3`,children:[(0,F.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:m.dependenciesDescription}),(0,F.jsx)(he,{candidates:A,selectedIds:U,disabled:O,onChange:W,labels:{link:m.linkDependencies,linked:m.linkedDependencies,searchPlaceholder:m.dependencySearchPlaceholder,noMatches:m.noDependencyMatches,noCandidates:m.noDependencyCandidates,remove:m.removeDependency}}),(0,F.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,F.jsx)(E,{type:`button`,variant:`ghost`,disabled:O,onClick:()=>H(!1),children:m.cancelDependencyEdit}),(0,F.jsx)(E,{type:`button`,variant:`primary`,disabled:O,onClick:()=>void _e(),children:m.saveDependencies})]})]}):(0,F.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:m.dependencies}),b.dependencies.length>0?(0,F.jsx)(`div`,{className:`space-y-2`,children:b.dependencies.map(e=>(0,F.jsxs)(o,{to:Me(e.id),className:`block rounded-lg bg-surface-hover p-2.5 text-sm text-accent hover:underline`,children:[(0,F.jsx)(`span`,{className:`break-words`,children:e.title}),(0,F.jsx)(`span`,{className:`mt-1 block text-xs text-fg-subtle`,children:I(e.phase,i)})]},e.id))}):(0,F.jsx)(`p`,{className:`text-sm text-fg-subtle`,children:m.noDependencies})]}),(0,F.jsxs)(`div`,{className:`rounded-lg border border-accent/25 bg-accent-soft/40 p-3`,children:[(0,F.jsx)(`p`,{className:`text-xs font-medium text-accent`,children:m.currentTask}),(0,F.jsx)(`p`,{className:`mt-1 break-words text-sm text-fg`,children:b.task.title})]}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:m.dependents}),b.dependents.length>0?(0,F.jsx)(`div`,{className:`space-y-2`,children:b.dependents.map(e=>(0,F.jsxs)(o,{to:Me(e.id),className:`block rounded-lg bg-surface-hover p-2.5 text-sm text-accent hover:underline`,children:[(0,F.jsx)(`span`,{className:`break-words`,children:e.title}),(0,F.jsx)(`span`,{className:`mt-1 block text-xs text-fg-subtle`,children:I(e.phase,i)})]},e.id))}):(0,F.jsx)(`p`,{className:`text-sm text-fg-subtle`,children:m.noDependents})]})]})]}),b.context.length>0?(0,F.jsxs)(`section`,{className:`min-w-0 rounded-2xl border border-edge bg-surface-panel p-5`,children:[(0,F.jsx)(`h2`,{className:`font-medium text-fg`,children:m.contextUsed}),(0,F.jsx)(`ul`,{className:`mt-4 space-y-2`,children:b.context.map(e=>(0,F.jsxs)(`li`,{className:`min-w-0 rounded-lg bg-surface-hover p-2.5`,children:[(0,F.jsxs)(`span`,{className:`text-[11px] text-fg-subtle`,children:[m.contextRoleLabels[e.role],` · `,m.contextKindLabels[e.targetKind]]}),e.targetKind===`url`&&/^https?:\/\//.test(e.targetId)?(0,F.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,F.jsx)(`p`,{className:`mt-1 break-words text-sm text-fg`,children:e.title??e.targetId})]},e.id))})]}):null]})]})]})}function B(){let e=(0,N.c)(2),{taskId:t}=i(),n=t===void 0?``:t,r;return e[0]===n?r=e[1]:(r=(0,F.jsx)(z,{taskId:n,presentation:`page`}),e[0]=n,e[1]=r),r}function V(e){let t=(0,N.c)(23),{taskId:n,backgroundPath:r,onClose:i}=e,a=c(H),o;t[0]===i?o=t[1]:(o=e=>{e||i()},t[0]=i,t[1]=o);let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,F.jsx)(y,{className:`fixed inset-0 z-[80] bg-black/45 backdrop-blur-[1px]`}),t[2]=s):s=t[2];let l=a===`zh`?`任务详情`:`Task details`,d;t[3]===l?d=t[4]:(d=(0,F.jsx)(S,{className:`font-medium text-fg`,children:l}),t[3]=l,t[4]=d);let f=a===`zh`?`查看并操作任务详情`:`View and manage task details`,p;t[5]===f?p=t[6]:(p=(0,F.jsx)(O,{className:`sr-only`,children:f}),t[5]=f,t[6]=p);let m=a===`zh`?`关闭任务详情`:`Close task details`,h;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,F.jsx)(D,{className:`size-4`,"aria-hidden":!0}),t[7]=h):h=t[7];let g;t[8]===m?g=t[9]:(g=(0,F.jsx)(k,{className:`flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":m,children:h}),t[8]=m,t[9]=g);let _;t[10]!==d||t[11]!==p||t[12]!==g?(_=(0,F.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-3 border-b border-edge px-5 py-3.5`,children:[d,p,g]}),t[10]=d,t[11]=p,t[12]=g,t[13]=_):_=t[13];let v;t[14]!==r||t[15]!==n?(v=(0,F.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,F.jsx)(z,{taskId:n,presentation:`modal`,backgroundPath:r})}),t[14]=r,t[15]=n,t[16]=v):v=t[16];let C;t[17]!==_||t[18]!==v?(C=(0,F.jsxs)(b,{children:[s,(0,F.jsxs)(u,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(52rem,calc(100dvh-2rem))] w-[min(64rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-base shadow-float focus:outline-none`,children:[_,v]})]}),t[17]=_,t[18]=v,t[19]=C):C=t[19];let w;return t[20]!==o||t[21]!==C?(w=(0,F.jsx)(x,{open:!0,onOpenChange:o,children:C}),t[20]=o,t[21]=C,t[22]=w):w=t[22],w}function H(e){return e.language}export{V as TaskDetailModal,B as TaskDetailPage};
@@ -1 +1 @@
1
- import{t as e}from"./cn-JdwAhgNB.js";import{gs as t,hs as n,ms as r}from"./index-BpkdvHH0.js";function i(){return e(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,t,`dark:border-edge`)}function a(){return e(n,r)}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{gs as t,hs as n,ms as r}from"./index-Cb9y6tVR.js";function i(){return e(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,t,`dark:border-edge`)}function a(){return e(n,r)}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"./cn-JdwAhgNB.js";import{n as o}from"./locale-store-Bjvw7jtg.js";import{ru as s,zc as c}from"./index-BpkdvHH0.js";var l=n(),u=r();function d(e){let t=(0,l.c)(21),{status:n,error:r,className:d}=e,p=o(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=a(`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)(c,{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)(s,{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"./cn-JdwAhgNB.js";import{n as o}from"./locale-store-Bjvw7jtg.js";import{ru as s,zc as c}from"./index-Cb9y6tVR.js";var l=n(),u=r();function d(e){let t=(0,l.c)(21),{status:n,error:r,className:d}=e,p=o(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=a(`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)(c,{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)(s,{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 +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{f as i,t as a}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{n as o}from"./locale-store-Bjvw7jtg.js";import{i as s}from"./vendor-swr-BIWyz7Rc.js";import{$a as c,Al as l,Da as u,Go as d,La as f,Ps as p,Qa as m,Qs as h,Wo as g,Yl as _,Za as v,_s as y,ao as b,co as x,cu as S,do as C,eo as w,fo as T,hc as E,io as D,kc as O,lo as k,lu as A,no as j,oo as M,pl as N,ro as P,so as F,to as I,uo as L,xc as R}from"./index-BpkdvHH0.js";import{n as z,t as B}from"./use-autosave-Dle3-zdQ.js";import{t as V}from"./page-tabs-CROi9zm1.js";import{a as H}from"./connectors-api-vaSrhPF8.js";var U=n(),W=e(t(),1),G=r(),K=new Set([`profile`,`understanding`,`collaboration`,`sources`,`dreaming`,`privacy`]),q=`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`,J={en:{title:`About You`,subtitle:`What xopc knows, why it knows it, and how it should work with you.`,profile:`Profile`,understanding:`Understanding`,collaboration:`Working agreement`,sources:`Sources`,dreaming:`Background review`,privacy:`Privacy`,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`,qualityNoData:`Not enough feedback yet`,emptyRules:`No working agreements yet.`,sourceExplicit:`You said this directly`,sourceInferred:`Inferred — may be wrong`,sourceObserved:`Observed across prior work`,sourcesHint:`Review every granted source, its access mode, retention, and last collection. Revoking stops future learning.`,manageSources:`Connect another source`,noSources:`No sources are authorized.`,connected:`Connected`,unavailable:`Needs attention`,revoke:`Revoke & remove derived`,refresh:`Refresh`,once:`One-time`,continuous:`Continuous`,localOnly:`Local only`,derivedOnly:`Derived understanding only`,focuses:`Current focuses`,focusHint:`Candidate focuses never activate until you confirm them.`,activate:`Activate`,pause:`Pause`,complete:`Complete`,noFocuses:`No focus candidates yet.`,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:`隐私`,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:`有效召回`,qualityNoData:`反馈数据还不足`,sourceExplicit:`由你直接告知`,sourceInferred:`推断内容,可能有误`,sourceObserved:`从过往工作中观察到`,sourcesHint:`查看每项授权的访问方式、保留策略和最近采集时间;撤销后将停止后续学习。`,manageSources:`连接其他来源`,noSources:`尚未授权任何来源。`,connected:`已连接`,unavailable:`需要处理`,revoke:`撤销并删除派生理解`,refresh:`立即更新`,once:`仅一次`,continuous:`持续更新`,localOnly:`仅本地处理`,derivedOnly:`仅保留派生理解`,focuses:`当前关注`,focusHint:`候选关注不会自动生效,只有你确认后才会启用。`,activate:`启用`,pause:`暂停`,complete:`完成`,noFocuses:`还没有候选关注。`,dreamingHint:`每天进行一次确定性复核,检查过期、矛盾证据和得到佐证的候选理解;推断内容不会自动生效。`,mode:`后台复核`,on:`开启并生成待审核项`,off:`关闭`,reviewTime:`每日复核时间`,evidenceThreshold:`所需支持证据数`,scanLimit:`每次最多检查`,lastRun:`最近一次复核`,neverRun:`尚未运行`,runCompleted:`已完成`,runFailed:`失败`,runRunning:`运行中`,runItems:`项`,privacyHint:`选择通用记忆服务如何处理敏感内容;结构化用户理解有独立且更严格的规则。`,sensitivePolicy:`敏感记忆写入`,policyDeny:`不保存`,policyConfirm:`保存前询问`,policyAllow:`相关时允许保存`,privacyWarning:`无论这里如何设置,秘密和受监管内容都不会保存为结构化用户理解。`,error:`无法加载用户上下文。`,retry:`重试`}},Y={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:`洞察`}},X={communication:{en:`Communication`,zh:`沟通`},execution:{en:`Execution`,zh:`执行`},boundary:{en:`Boundary`,zh:`边界`},routine:{en:`Routine`,zh:`习惯`},proactive:{en:`Proactive help`,zh:`主动协助`}};function Z(e){let t=(0,U.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,G.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 Q(e){let t=(0,U.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,G.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 ee(e){return JSON.stringify(e)}function te(e){let t=(0,U.c)(10),[n,r]=(0,W.useState)(e),i;t[0]===e?i=t[1]:(i=ee(e),t[0]=e,t[1]=i);let a=(0,W.useRef)(i),o;t[2]===e?o=t[3]:(o=ee(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=>ee(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,W.useEffect)(c,l);let u;return t[8]===n?u=t[9]:(u=[n,r],t[8]=n,t[9]=u),u}function ne(e){return{callName:e.callName,role:e.role,primaryGoal:e.primaryGoal,pronouns:e.pronouns,timezone:e.timezone,locale:e.locale}}function re(){let e=(0,U.c)(87),t=o(se),n=J[t],[r,a]=i(),c;if(e[0]!==r){let t=r.get(`tab`);c=t&&K.has(t)?t:`profile`,e[0]=r,e[1]=c}else c=e[1];let l=c,d=f(oe),p=f(ae),{data:m,error:g,isLoading:v,mutate:y}=s(`/api/you`,P),b;e[2]!==p||e[3]!==d||e[4]!==n.subtitle||e[5]!==n.title?(b=()=>(d({startExtra:null,main:(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h1`,{className:`text-base font-semibold text-fg`,children:n.title}),(0,G.jsx)(`p`,{className:`hidden text-xs text-fg-muted sm:block`,children:n.subtitle})]}),end:null}),p),e[2]=p,e[3]=d,e[4]=n.subtitle,e[5]=n.title,e[6]=b):b=e[6];let x;if(e[7]!==p||e[8]!==d||e[9]!==n?(x=[p,d,n],e[7]=p,e[8]=d,e[9]=n,e[10]=x):x=e[10],(0,W.useEffect)(b,x),v){let t;return e[11]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,G.jsxs)(`div`,{className:`space-y-4 p-4 sm:p-6`,children:[(0,G.jsx)(u,{className:`h-10 w-96 max-w-full`}),(0,G.jsx)(u,{className:`h-72 rounded-2xl`})]}),e[11]=t):t=e[11],t}if(g||!m){let t;e[12]===y?t=e[13]:(t=()=>void y(),e[12]=y,e[13]=t);let r;e[14]!==n.retry||e[15]!==t?(r=(0,G.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,G.jsx)(`div`,{className:`p-6`,children:(0,G.jsxs)(Q,{children:[n.error,` `,r]})}),e[17]=n.error,e[18]=r,e[19]=i):i=e[19],i}let C=n.title,w;e[20]===a?w=e[21]:(w=e=>a({tab:e}),e[20]=a,e[21]=w);let T;e[22]===n.profile?T=e[23]:(T={id:`profile`,label:n.profile,icon:_},e[22]=n.profile,e[23]=T);let E;e[24]!==m.understandings.length||e[25]!==n.understanding?(E={id:`understanding`,label:n.understanding,icon:A,count:m.understandings.length},e[24]=m.understandings.length,e[25]=n.understanding,e[26]=E):E=e[26];let D=n.collaboration,k;e[27]===m.rules?k=e[28]:(k=m.rules.filter(ie),e[27]=m.rules,e[28]=k);let j;e[29]!==n.collaboration||e[30]!==k.length?(j={id:`collaboration`,label:D,icon:N,count:k.length},e[29]=n.collaboration,e[30]=k.length,e[31]=j):j=e[31];let M;e[32]===n.sources?M=e[33]:(M={id:`sources`,label:n.sources,icon:S},e[32]=n.sources,e[33]=M);let F;e[34]===n.dreaming?F=e[35]:(F={id:`dreaming`,label:n.dreaming,icon:O},e[34]=n.dreaming,e[35]=F);let I;e[36]===n.privacy?I=e[37]:(I={id:`privacy`,label:n.privacy,icon:h},e[36]=n.privacy,e[37]=I);let L;e[38]!==M||e[39]!==F||e[40]!==I||e[41]!==T||e[42]!==E||e[43]!==j?(L=[T,E,j,M,F,I],e[38]=M,e[39]=F,e[40]=I,e[41]=T,e[42]=E,e[43]=j,e[44]=L):L=e[44];let R;e[45]!==n.title||e[46]!==L||e[47]!==w||e[48]!==l?(R=(0,G.jsx)(V,{ariaLabel:C,activeTab:l,onChange:w,items:L}),e[45]=n.title,e[46]=L,e[47]=w,e[48]=l,e[49]=R):R=e[49];let z;e[50]!==m.profile||e[51]!==t||e[52]!==y||e[53]!==n||e[54]!==l?(z=l===`profile`?(0,G.jsx)(ce,{profile:m.profile,language:t,t:n,onChanged:e=>y(t=>t&&{...t,profile:e},{revalidate:!1})}):null,e[50]=m.profile,e[51]=t,e[52]=y,e[53]=n,e[54]=l,e[55]=z):z=e[55];let B;e[56]!==m.quality||e[57]!==m.understandings||e[58]!==t||e[59]!==y||e[60]!==n||e[61]!==l?(B=l===`understanding`?(0,G.jsx)(ue,{items:m.understandings,quality:m.quality,language:t,t:n,onChanged:e=>e?y(t=>t&&{...t,understandings:t.understandings.map(t=>t.id===e.id?e:t)},{revalidate:!0}):y()}):null,e[56]=m.quality,e[57]=m.understandings,e[58]=t,e[59]=y,e[60]=n,e[61]=l,e[62]=B):B=e[62];let H;e[63]!==m.rules||e[64]!==t||e[65]!==y||e[66]!==n||e[67]!==l?(H=l===`collaboration`?(0,G.jsx)(_e,{rules:m.rules,language:t,t:n,onChanged:()=>y()}):null,e[63]=m.rules,e[64]=t,e[65]=y,e[66]=n,e[67]=l,e[68]=H):H=e[68];let q;e[69]!==n||e[70]!==l?(q=l===`sources`?(0,G.jsx)(be,{t:n}):null,e[69]=n,e[70]=l,e[71]=q):q=e[71];let Y;e[72]!==m.consolidation?.lastRun||e[73]!==n||e[74]!==l?(Y=l===`dreaming`?(0,G.jsx)(xe,{lastRun:m.consolidation?.lastRun??null,t:n}):null,e[72]=m.consolidation?.lastRun,e[73]=n,e[74]=l,e[75]=Y):Y=e[75];let X;e[76]!==n||e[77]!==l?(X=l===`privacy`?(0,G.jsx)(Ce,{t:n}):null,e[76]=n,e[77]=l,e[78]=X):X=e[78];let Z;return e[79]!==R||e[80]!==z||e[81]!==B||e[82]!==H||e[83]!==q||e[84]!==Y||e[85]!==X?(Z=(0,G.jsxs)(`div`,{className:`mx-auto w-full max-w-5xl space-y-5 p-4 sm:p-6`,children:[R,z,B,H,q,Y,X]}),e[79]=R,e[80]=z,e[81]=B,e[82]=H,e[83]=q,e[84]=Y,e[85]=X,e[86]=Z):Z=e[86],Z}function ie(e){return e.status===`active`}function ae(e){return e.clearPageHeader}function oe(e){return e.setPageHeader}function se(e){return e.language}function ce(e){let t=(0,U.c)(78),{profile:n,language:r,t:i,onChanged:a}=e,o;t[0]===n?o=t[1]:(o=ne(n),t[0]=n,t[1]=o);let s=o,[c,l]=te(s),u;t[2]===c?u=t[3]:(u=ee(c),t[2]=c,t[3]=u);let d;t[4]===s?d=t[5]:(d=ee(s),t[4]=s,t[5]=d);let f=u!==d,p;t[6]!==a||t[7]!==n?(p=async e=>{await a((await T({...e,accessibility:n.accessibility})).profile)},t[6]=a,t[7]=n,t[8]=p):p=t[8];let m;t[9]!==c||t[10]!==f||t[11]!==p?(m={value:c,dirty:f,delayMs:500,onSave:p},t[9]=c,t[10]=f,t[11]=p,t[12]=m):m=t[12];let h=B(m),g;t[13]!==c||t[14]!==l?(g=(e,t,n)=>(0,G.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[(0,G.jsx)(`span`,{className:`font-medium text-fg`,children:t}),(0,G.jsx)(`input`,{className:q,placeholder:n,value:c[e],onChange:t=>l(n=>({...n,[e]:t.target.value}))})]}),t[13]=c,t[14]=l,t[15]=g):g=t[15];let _=g,v=h.onBlurCapture,b;t[16]===i.profileHint?b=t[17]:(b=(0,G.jsx)(`p`,{className:`mb-5 text-sm leading-6 text-fg-muted`,children:i.profileHint}),t[16]=i.profileHint,t[17]=b);let x;t[18]!==_||t[19]!==i.callName||t[20]!==i.callNamePlaceholder?(x=_(`callName`,i.callName,i.callNamePlaceholder),t[18]=_,t[19]=i.callName,t[20]=i.callNamePlaceholder,t[21]=x):x=t[21];let S;t[22]!==_||t[23]!==i.role||t[24]!==i.rolePlaceholder?(S=_(`role`,i.role,i.rolePlaceholder),t[22]=_,t[23]=i.role,t[24]=i.rolePlaceholder,t[25]=S):S=t[25];let C;t[26]===i.primaryGoal?C=t[27]:(C=(0,G.jsx)(`span`,{className:`font-medium text-fg`,children:i.primaryGoal}),t[26]=i.primaryGoal,t[27]=C);let w;t[28]===l?w=t[29]:(w=e=>l(t=>({...t,primaryGoal:e.target.value})),t[28]=l,t[29]=w);let E;t[30]!==c.primaryGoal||t[31]!==i.primaryGoalPlaceholder||t[32]!==w?(E=(0,G.jsx)(`textarea`,{className:q,rows:3,placeholder:i.primaryGoalPlaceholder,value:c.primaryGoal,onChange:w}),t[30]=c.primaryGoal,t[31]=i.primaryGoalPlaceholder,t[32]=w,t[33]=E):E=t[33];let D;t[34]!==C||t[35]!==E?(D=(0,G.jsxs)(`label`,{className:`space-y-1.5 text-sm sm:col-span-2`,children:[C,E]}),t[34]=C,t[35]=E,t[36]=D):D=t[36];let O;t[37]!==_||t[38]!==r||t[39]!==i.pronouns||t[40]!==i.pronounsPlaceholder?(O=r===`en`?_(`pronouns`,i.pronouns,i.pronounsPlaceholder):null,t[37]=_,t[38]=r,t[39]=i.pronouns,t[40]=i.pronounsPlaceholder,t[41]=O):O=t[41];let k;t[42]===i.timezone?k=t[43]:(k=(0,G.jsx)(`span`,{className:`font-medium text-fg`,children:i.timezone}),t[42]=i.timezone,t[43]=k);let A;t[44]===l?A=t[45]:(A=e=>l(t=>({...t,timezone:e.target.value})),t[44]=l,t[45]=A);let j;t[46]!==c.timezone||t[47]!==A?(j=(0,G.jsx)(`input`,{className:`${q} min-w-0 flex-1`,value:c.timezone,onChange:A}),t[46]=c.timezone,t[47]=A,t[48]=j):j=t[48];let M;t[49]===l?M=t[50]:(M=()=>l(le),t[49]=l,t[50]=M);let N;t[51]!==i.detect||t[52]!==M?(N=(0,G.jsx)(y,{className:`shrink-0 whitespace-nowrap`,onClick:M,children:i.detect}),t[51]=i.detect,t[52]=M,t[53]=N):N=t[53];let P;t[54]!==j||t[55]!==N?(P=(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[j,N]}),t[54]=j,t[55]=N,t[56]=P):P=t[56];let F;t[57]!==k||t[58]!==P?(F=(0,G.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[k,P]}),t[57]=k,t[58]=P,t[59]=F):F=t[59];let I;t[60]!==_||t[61]!==i.locale?(I=_(`locale`,i.locale),t[60]=_,t[61]=i.locale,t[62]=I):I=t[62];let L;t[63]!==x||t[64]!==S||t[65]!==D||t[66]!==O||t[67]!==F||t[68]!==I?(L=(0,G.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[x,S,D,O,F,I]}),t[63]=x,t[64]=S,t[65]=D,t[66]=O,t[67]=F,t[68]=I,t[69]=L):L=t[69];let R;t[70]!==h.error||t[71]!==h.status?(R=(0,G.jsx)(`div`,{className:`mt-5 flex justify-end`,children:(0,G.jsx)(z,{status:h.status,error:h.error})}),t[70]=h.error,t[71]=h.status,t[72]=R):R=t[72];let V;return t[73]!==h.onBlurCapture||t[74]!==L||t[75]!==R||t[76]!==b?(V=(0,G.jsx)(Z,{children:(0,G.jsxs)(`div`,{onBlurCapture:v,children:[b,L,R]})}),t[73]=h.onBlurCapture,t[74]=L,t[75]=R,t[76]=b,t[77]=V):V=t[77],V}function le(e){return{...e,timezone:I()}}function ue(e){let t=(0,U.c)(54),{items:n,quality:r,language:i,t:a,onChanged:o}=e,[s,c]=(0,W.useState)(!1),[l,u]=(0,W.useState)(``),[f,p]=(0,W.useState)(`preference`),h;t[0]===n?h=t[1]:(h=n.filter(fe),t[0]=n,t[1]=h);let _=h,v;t[2]===n?v=t[3]:(v=n.filter(de),t[2]=n,t[3]=v);let b=v,x;t[4]!==f||t[5]!==o||t[6]!==l?(x=async e=>{e.preventDefault(),l.trim()&&(await m({statement:l,kind:f}),u(``),c(!1),await o())},t[4]=f,t[5]=o,t[6]=l,t[7]=x):x=t[7];let S=x,C;t[8]===a.understoodHint?C=t[9]:(C=(0,G.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=()=>c(!0),T=(0,G.jsx)(E,{className:`size-4`}),t[10]=w,t[11]=T):(w=t[10],T=t[11]);let D;t[12]===a.addUnderstanding?D=t[13]:(D=(0,G.jsxs)(y,{variant:`primary`,onClick:w,children:[T,a.addUnderstanding]}),t[12]=a.addUnderstanding,t[13]=D);let O;t[14]!==C||t[15]!==D?(O=(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[C,D]}),t[14]=C,t[15]=D,t[16]=O):O=t[16];let k;t[17]!==r||t[18]!==a?(k=(0,G.jsx)(pe,{quality:r,t:a}),t[17]=r,t[18]=a,t[19]=k):k=t[19];let A;t[20]===a?A=t[21]:(A=(0,G.jsx)(he,{t:a}),t[20]=a,t[21]=A);let j;t[22]!==s||t[23]!==f||t[24]!==i||t[25]!==l||t[26]!==S||t[27]!==a.add||t[28]!==a.cancel||t[29]!==a.statement?(j=s?(0,G.jsx)(Z,{children:(0,G.jsxs)(`form`,{className:`space-y-3`,onSubmit:S,children:[(0,G.jsx)(`textarea`,{autoFocus:!0,className:q,rows:3,placeholder:a.statement,value:l,onChange:e=>u(e.target.value)}),(0,G.jsx)(g,{value:f,onChange:e=>p(e.target.value),children:Object.entries(Y).map(e=>{let[t,n]=e;return(0,G.jsx)(d,{value:t,children:n[i]},t)})}),(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsx)(y,{type:`submit`,variant:`primary`,children:a.add}),(0,G.jsx)(y,{onClick:()=>c(!1),children:a.cancel})]})]})}):null,t[22]=s,t[23]=f,t[24]=i,t[25]=l,t[26]=S,t[27]=a.add,t[28]=a.cancel,t[29]=a.statement,t[30]=j):j=t[30];let M;t[31]!==i||t[32]!==o||t[33]!==b||t[34]!==a?(M=b.length?(0,G.jsxs)(`section`,{className:`space-y-3`,children:[(0,G.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[a.review,` · `,b.length]}),b.map(e=>(0,G.jsx)($,{item:e,language:i,t:a,onChanged:o},e.id))]}):null,t[31]=i,t[32]=o,t[33]=b,t[34]=a,t[35]=M):M=t[35];let N;t[36]!==_.length||t[37]!==a.active?(N=(0,G.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[a.active,` · `,_.length]}),t[36]=_.length,t[37]=a.active,t[38]=N):N=t[38];let P;t[39]!==_||t[40]!==i||t[41]!==o||t[42]!==a?(P=_.length?_.map(e=>(0,G.jsx)($,{item:e,language:i,t:a,onChanged:o},e.id)):(0,G.jsx)(Q,{children:a.emptyUnderstanding}),t[39]=_,t[40]=i,t[41]=o,t[42]=a,t[43]=P):P=t[43];let F;t[44]!==N||t[45]!==P?(F=(0,G.jsxs)(`section`,{className:`space-y-3`,children:[N,P]}),t[44]=N,t[45]=P,t[46]=F):F=t[46];let I;return t[47]!==A||t[48]!==j||t[49]!==M||t[50]!==F||t[51]!==O||t[52]!==k?(I=(0,G.jsxs)(`div`,{className:`space-y-5`,children:[O,k,A,j,M,F]}),t[47]=A,t[48]=j,t[49]=M,t[50]=F,t[51]=O,t[52]=k,t[53]=I):I=t[53],I}function de(e){return[`candidate`,`needs_review`,`stale`].includes(e.status)}function fe(e){return e.status===`active`}function pe(e){let t=(0,U.c)(32),{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;t[20]!==m||t[21]!==_||t[22]!==c||t[23]!==d?(v=[c,d,m,_],t[20]=m,t[21]=_,t[22]=c,t[23]=d,t[24]=v):v=t[24];let y=v,b;t[25]===r.qualityTitle?b=t[26]:(b=(0,G.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:r.qualityTitle}),t[25]=r.qualityTitle,t[26]=b);let x;t[27]===y?x=t[28]:(x=(0,G.jsx)(`div`,{className:`mt-3 grid grid-cols-2 gap-2 sm:grid-cols-4`,children:y.map(me)}),t[27]=y,t[28]=x);let S;return t[29]!==b||t[30]!==x?(S=(0,G.jsxs)(Z,{children:[b,x]}),t[29]=b,t[30]=x,t[31]=S):S=t[31],S}function me(e){let[t,n]=e;return(0,G.jsxs)(`div`,{className:`rounded-xl bg-surface-muted px-3 py-2.5`,children:[(0,G.jsx)(`p`,{className:`text-[11px] text-fg-subtle`,children:t}),(0,G.jsx)(`p`,{className:`mt-1 text-sm font-semibold text-fg`,children:n})]},t)}function $(e){let t=(0,U.c)(57),{item:n,language:r,t:i,onChanged:a}=e,[o,s]=(0,W.useState)(!1),[c,l]=(0,W.useState)(!1),[u,d]=te(n.statement),f=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 k(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]!==f||t[8]!==m||t[9]!==h?(g={value:u,dirty:f,enabled:o,delayMs:500,validate:m,onSave:h},t[5]=u,t[6]=o,t[7]=f,t[8]=m,t[9]=h,t[10]=g):g=t[10];let _=B(g),v=Y[n.kind][r],b;t[11]===v?b=t[12]:(b=(0,G.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:v}),t[11]=v,t[12]=b);let x=n.explicitness===`explicit`?i.sourceExplicit:n.explicitness===`observed`?i.sourceObserved:i.sourceInferred,S;t[13]===x?S=t[14]:(S=(0,G.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:x}),t[13]=x,t[14]=S);let C;t[15]!==b||t[16]!==S?(C=(0,G.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-center gap-2`,children:[b,S]}),t[15]=b,t[16]=S,t[17]=C):C=t[17];let T;t[18]!==u||t[19]!==o||t[20]!==d?(T=o?(0,G.jsx)(`textarea`,{autoFocus:!0,className:q,value:u,onChange:e=>d(e.target.value),rows:3}):(0,G.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:u}),t[18]=u,t[19]=o,t[20]=d,t[21]=T):T=t[21];let E;t[22]!==T||t[23]!==C?(E=(0,G.jsx)(`div`,{className:`flex items-start justify-between gap-3`,children:(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[C,T]})}),t[22]=T,t[23]=C,t[24]=E):E=t[24];let D;t[25]!==_||t[26]!==o||t[27]!==i.done||t[28]!==i.edit?(D=o?(0,G.jsx)(y,{variant:`ghost`,onClick:()=>{_.flush(),s(!1)},children:i.done}):(0,G.jsxs)(y,{variant:`ghost`,onClick:()=>s(!0),children:[(0,G.jsx)(R,{className:`size-3.5`}),i.edit]}),t[25]=_,t[26]=o,t[27]=i.done,t[28]=i.edit,t[29]=D):D=t[29];let O;t[30]!==n.id||t[31]!==n.status||t[32]!==a||t[33]!==i.confirm||t[34]!==i.reject?(O=n.status===`active`?null:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(y,{variant:`primary`,onClick:async()=>{await a((await k(n.id,{status:`active`})).understanding)},children:i.confirm}),(0,G.jsx)(y,{onClick:async()=>{await a((await k(n.id,{status:`rejected`})).understanding)},children:i.reject})]}),t[30]=n.id,t[31]=n.status,t[32]=a,t[33]=i.confirm,t[34]=i.reject,t[35]=O):O=t[35];let A;t[36]!==c||t[37]!==n.id||t[38]!==a?(A=async()=>{if(!c){l(!0);return}await w(n.id),l(!1),await a()},t[36]=c,t[37]=n.id,t[38]=a,t[39]=A):A=t[39];let j;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,G.jsx)(p,{className:`size-3.5`}),t[40]=j):j=t[40];let M=c?i.confirmDelete:i.delete,N;t[41]!==A||t[42]!==M?(N=(0,G.jsxs)(y,{variant:`ghost`,className:`text-danger`,onClick:A,children:[j,M]}),t[41]=A,t[42]=M,t[43]=N):N=t[43];let P;t[44]!==_.error||t[45]!==_.status||t[46]!==o?(P=o||_.status!==`idle`?(0,G.jsx)(z,{className:`ml-auto`,status:_.status,error:_.error}):null,t[44]=_.error,t[45]=_.status,t[46]=o,t[47]=P):P=t[47];let F;t[48]!==D||t[49]!==O||t[50]!==N||t[51]!==P?(F=(0,G.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2`,children:[D,O,N,P]}),t[48]=D,t[49]=O,t[50]=N,t[51]=P,t[52]=F):F=t[52];let I;return t[53]!==_.onBlurCapture||t[54]!==E||t[55]!==F?(I=(0,G.jsx)(Z,{children:(0,G.jsxs)(`div`,{onBlurCapture:_.onBlurCapture,children:[E,F]})}),t[53]=_.onBlurCapture,t[54]=E,t[55]=F,t[56]=I):I=t[56],I}function he(e){let t=(0,U.c)(20),{t:n}=e,{data:r,error:i,isLoading:a,mutate:o}=s(`you-focuses`,b);if(a){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,G.jsx)(u,{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,G.jsx)(Q,{children:n.error}),t[1]=n.error,t[2]=e),e}let c;if(t[3]!==r||t[4]!==o||t[5]!==n.activate||t[6]!==n.complete||t[7]!==n.focusHint||t[8]!==n.focuses||t[9]!==n.noFocuses||t[10]!==n.pause||t[11]!==n.reject){let e=(r??[]).filter(ge),i;t[13]===n.focuses?i=t[14]:(i=(0,G.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n.focuses}),t[13]=n.focuses,t[14]=i);let a;t[15]===n.focusHint?a=t[16]:(a=(0,G.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n.focusHint}),t[15]=n.focusHint,t[16]=a);let s;t[17]!==i||t[18]!==a?(s=(0,G.jsxs)(`div`,{children:[i,a]}),t[17]=i,t[18]=a,t[19]=s):s=t[19],c=(0,G.jsxs)(`section`,{className:`space-y-3`,children:[s,e.length?e.map(e=>(0,G.jsxs)(Z,{children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:e.title}),(0,G.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-[11px] text-fg-muted`,children:e.status})]}),(0,G.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:e.summary})]}),(0,G.jsxs)(`span`,{className:`text-xs tabular-nums text-fg-subtle`,children:[Math.round(e.confidence*100),`%`]})]}),(0,G.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[e.status===`active`?(0,G.jsx)(y,{onClick:async()=>{await C(e.id,`paused`),await o()},children:n.pause}):(0,G.jsx)(y,{variant:`primary`,onClick:async()=>{await C(e.id,`active`),await o()},children:n.activate}),(0,G.jsx)(y,{variant:`ghost`,onClick:async()=>{await C(e.id,`completed`),await o()},children:n.complete}),e.status===`candidate`?(0,G.jsx)(y,{variant:`ghost`,className:`text-danger`,onClick:async()=>{await C(e.id,`rejected`),await o()},children:n.reject}):null]})]},e.id)):(0,G.jsx)(Q,{children:n.noFocuses})]}),t[3]=r,t[4]=o,t[5]=n.activate,t[6]=n.complete,t[7]=n.focusHint,t[8]=n.focuses,t[9]=n.noFocuses,t[10]=n.pause,t[11]=n.reject,t[12]=c}else c=t[12];return c}function ge(e){return e.status!==`rejected`}function _e(e){let t=(0,U.c)(36),{rules:n,language:r,t:i,onChanged:a}=e,[o,s]=(0,W.useState)(!1),[l,u]=(0,W.useState)(``),[f,m]=(0,W.useState)(`communication`),[h,_]=(0,W.useState)(null),b;t[0]!==f||t[1]!==a||t[2]!==l?(b=async e=>{e.preventDefault(),l.trim()&&(await v({statement:l,category:f}),u(``),s(!1),await a())},t[0]=f,t[1]=a,t[2]=l,t[3]=b):b=t[3];let S=b,C;t[4]===i.rulesHint?C=t[5]:(C=(0,G.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:i.rulesHint}),t[4]=i.rulesHint,t[5]=C);let w,T;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(w=()=>s(!0),T=(0,G.jsx)(E,{className:`size-4`}),t[6]=w,t[7]=T):(w=t[6],T=t[7]);let D;t[8]===i.addRule?D=t[9]:(D=(0,G.jsxs)(y,{variant:`primary`,onClick:w,children:[T,i.addRule]}),t[8]=i.addRule,t[9]=D);let O;t[10]!==C||t[11]!==D?(O=(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[C,D]}),t[10]=C,t[11]=D,t[12]=O):O=t[12];let k;t[13]!==o||t[14]!==f||t[15]!==r||t[16]!==l||t[17]!==S||t[18]!==i.add||t[19]!==i.cancel||t[20]!==i.ruleStatement?(k=o?(0,G.jsx)(Z,{children:(0,G.jsxs)(`form`,{className:`space-y-3`,onSubmit:S,children:[(0,G.jsx)(`textarea`,{autoFocus:!0,className:q,rows:3,placeholder:i.ruleStatement,value:l,onChange:e=>u(e.target.value)}),(0,G.jsx)(g,{value:f,onChange:e=>m(e.target.value),children:Object.entries(X).map(e=>{let[t,n]=e;return(0,G.jsx)(d,{value:t,children:n[r]},t)})}),(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsx)(y,{type:`submit`,variant:`primary`,children:i.add}),(0,G.jsx)(y,{onClick:()=>s(!1),children:i.cancel})]})]})}):null,t[13]=o,t[14]=f,t[15]=r,t[16]=l,t[17]=S,t[18]=i.add,t[19]=i.cancel,t[20]=i.ruleStatement,t[21]=k):k=t[21];let A;t[22]!==h||t[23]!==r||t[24]!==a||t[25]!==n||t[26]!==i.confirmDelete||t[27]!==i.delete||t[28]!==i.disable||t[29]!==i.emptyRules||t[30]!==i.enable?(A=n.length?n.filter(ve).map(e=>(0,G.jsxs)(Z,{children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:X[e.category][r]}),(0,G.jsx)(`p`,{className:`mt-3 text-sm leading-6 ${e.status===`disabled`?`text-fg-subtle line-through`:`text-fg`}`,children:e.statement})]}),(0,G.jsxs)(`span`,{className:`text-xs tabular-nums text-fg-subtle`,children:[`P`,e.priority]})]}),(0,G.jsxs)(`div`,{className:`mt-4 flex gap-2`,children:[(0,G.jsx)(y,{variant:`ghost`,onClick:async()=>{await x(e.id,{status:e.status===`active`?`disabled`:`active`}),await a()},children:e.status===`active`?i.disable:i.enable}),(0,G.jsxs)(y,{variant:`ghost`,className:`text-danger`,onClick:async()=>{if(h!==e.id){_(e.id);return}await c(e.id),_(null),await a()},children:[(0,G.jsx)(p,{className:`size-3.5`}),h===e.id?i.confirmDelete:i.delete]})]})]},e.id)):(0,G.jsx)(Q,{children:i.emptyRules}),t[22]=h,t[23]=r,t[24]=a,t[25]=n,t[26]=i.confirmDelete,t[27]=i.delete,t[28]=i.disable,t[29]=i.emptyRules,t[30]=i.enable,t[31]=A):A=t[31];let j;return t[32]!==O||t[33]!==k||t[34]!==A?(j=(0,G.jsxs)(`div`,{className:`space-y-5`,children:[O,k,A]}),t[32]=O,t[33]=k,t[34]=A,t[35]=j):j=t[35],j}function ve(e){return e.status!==`archived`}async function ye(){let[e,t]=await Promise.all([j(),H()]);return{grants:e,connectors:t}}function be(e){let t=(0,U.c)(39),{t:n}=e,{data:r,error:i,isLoading:o,mutate:c}=s(`you-understanding-sources`,ye);if(o){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,G.jsx)(u,{className:`h-64 rounded-2xl`}),t[0]=e):e=t[0],e}if(i){let e;t[1]===c?e=t[2]:(e=()=>void c(),t[1]=c,t[2]=e);let r;t[3]!==n.retry||t[4]!==e?(r=(0,G.jsx)(`button`,{className:`text-accent hover:underline`,onClick:e,children:n.retry}),t[3]=n.retry,t[4]=e,t[5]=r):r=t[5];let i;return t[6]!==n.error||t[7]!==r?(i=(0,G.jsxs)(Q,{children:[n.error,` `,r]}),t[6]=n.error,t[7]=r,t[8]=i):i=t[8],i}let d;t[9]===r?.grants?d=t[10]:(d=r?.grants??[],t[9]=r?.grants,t[10]=d);let f=d,p;t[11]===r?.connectors?p=t[12]:(p=r?.connectors??[],t[11]=r?.connectors,t[12]=p);let m=p,h;t[13]===n.sourcesHint?h=t[14]:(h=(0,G.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:n.sourcesHint}),t[13]=n.sourcesHint,t[14]=h);let g;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,G.jsx)(l,{className:`size-4`}),t[15]=g):g=t[15];let _;t[16]===n.manageSources?_=t[17]:(_=(0,G.jsx)(y,{asChild:!0,variant:`primary`,children:(0,G.jsxs)(a,{to:`/connectors?understanding=1&returnTo=%2Fyou%3Ftab%3Dsources`,children:[n.manageSources,g]})}),t[16]=n.manageSources,t[17]=_);let v;t[18]!==h||t[19]!==_?(v=(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[h,_]}),t[18]=h,t[19]=_,t[20]=v):v=t[20];let b;t[21]!==f||t[22]!==c||t[23]!==n.continuous||t[24]!==n.derivedOnly||t[25]!==n.localOnly||t[26]!==n.noSources||t[27]!==n.once||t[28]!==n.refresh||t[29]!==n.revoke?(b=f.length?(0,G.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:f.map(e=>(0,G.jsx)(Z,{children:(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:e.displayName}),(0,G.jsxs)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:[e.accessMode===`continuous`?n.continuous:n.once,` · `,e.processingPolicy===`local_only`?n.localOnly:e.retentionPolicy===`derived_only`?n.derivedOnly:e.retentionPolicy]}),e.lastCollectedAt?(0,G.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:new Date(e.lastCollectedAt).toLocaleString()}):null]}),(0,G.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-1`,children:[e.accessMode===`continuous`?(0,G.jsx)(y,{variant:`ghost`,onClick:async()=>{await M(e.id),await c()},children:n.refresh}):null,(0,G.jsx)(y,{variant:`ghost`,className:`text-danger`,onClick:async()=>{await F(e.id),await c()},children:n.revoke})]})]})},e.id))}):(0,G.jsx)(Q,{children:n.noSources}),t[21]=f,t[22]=c,t[23]=n.continuous,t[24]=n.derivedOnly,t[25]=n.localOnly,t[26]=n.noSources,t[27]=n.once,t[28]=n.refresh,t[29]=n.revoke,t[30]=b):b=t[30];let x;t[31]!==m||t[32]!==n.connected||t[33]!==n.unavailable?(x=m.length?(0,G.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:m.map(e=>{let t=e.enabled&&(e.status===`connected`||e.connectionStatus===`connected`||e.authStatus===`connected`);return(0,G.jsx)(Z,{children:(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:e.displayName}),(0,G.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:e.connectorId})]}),(0,G.jsx)(`span`,{className:`shrink-0 rounded-full px-2 py-1 text-xs ${t?`bg-success-soft text-success`:`bg-warning-soft text-warning`}`,children:t?n.connected:n.unavailable})]})},e.instanceId)})}):null,t[31]=m,t[32]=n.connected,t[33]=n.unavailable,t[34]=x):x=t[34];let S;return t[35]!==v||t[36]!==b||t[37]!==x?(S=(0,G.jsxs)(`div`,{className:`space-y-5`,children:[v,b,x]}),t[35]=v,t[36]=b,t[37]=x,t[38]=S):S=t[38],S}function xe(e){let t=(0,U.c)(112),{lastRun:n,t:r}=e,{data:i,error:a,isLoading:o,mutate:c}=s(`you-context-settings`,D),l=i?.dreaming??null,[f,p]=te(l),m;t[0]!==f||t[1]!==l?(m=f&&l&&ee(f)!==ee(l),t[0]=f,t[1]=l,t[2]=m):m=t[2];let h=!!m,_;t[3]===c?_=t[4]:(_=async e=>{await L({dreaming:e}),await c()},t[3]=c,t[4]=_);let v;t[5]!==f||t[6]!==h||t[7]!==_?(v={value:f,dirty:h,delayMs:500,onSave:_},t[5]=f,t[6]=h,t[7]=_,t[8]=v):v=t[8];let b=B(v);if(a){let e;t[9]===c?e=t[10]:(e=()=>void c(),t[9]=c,t[10]=e);let n;t[11]!==r.retry||t[12]!==e?(n=(0,G.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,G.jsxs)(Q,{children:[r.error,` `,n]}),t[14]=r.error,t[15]=n,t[16]=i):i=t[16],i}if(o||!f){let e;return t[17]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,G.jsx)(u,{className:`h-72 rounded-2xl`}),t[17]=e):e=t[17],e}let x=n?.status===`completed`?r.runCompleted:n?.status===`failed`?r.runFailed:r.runRunning,S;t[18]===r.dreamingHint?S=t[19]:(S=(0,G.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:r.dreamingHint}),t[18]=r.dreamingHint,t[19]=S);let C=b.onBlurCapture,w;t[20]===r.mode?w=t[21]:(w=(0,G.jsx)(`span`,{className:`font-medium text-fg`,children:r.mode}),t[20]=r.mode,t[21]=w);let T;t[22]===p?T=t[23]:(T=e=>p(t=>t&&{...t,mode:e.target.value}),t[22]=p,t[23]=T);let E;t[24]===r.on?E=t[25]:(E=(0,G.jsx)(d,{value:`review`,children:r.on}),t[24]=r.on,t[25]=E);let O;t[26]===r.off?O=t[27]:(O=(0,G.jsx)(d,{value:`off`,children:r.off}),t[26]=r.off,t[27]=O);let k;t[28]!==f.mode||t[29]!==O||t[30]!==T||t[31]!==E?(k=(0,G.jsxs)(g,{value:f.mode,onChange:T,children:[E,O]}),t[28]=f.mode,t[29]=O,t[30]=T,t[31]=E,t[32]=k):k=t[32];let A;t[33]!==k||t[34]!==w?(A=(0,G.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[w,k]}),t[33]=k,t[34]=w,t[35]=A):A=t[35];let j;t[36]===r.reviewTime?j=t[37]:(j=(0,G.jsx)(`span`,{className:`font-medium text-fg`,children:r.reviewTime}),t[36]=r.reviewTime,t[37]=j);let M;t[38]===p?M=t[39]:(M=e=>p(t=>t&&{...t,schedule:{time:e.target.value}}),t[38]=p,t[39]=M);let N;t[40]!==f.schedule.time||t[41]!==M?(N=(0,G.jsx)(`input`,{type:`time`,className:q,value:f.schedule.time,onChange:M}),t[40]=f.schedule.time,t[41]=M,t[42]=N):N=t[42];let P;t[43]!==j||t[44]!==N?(P=(0,G.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[j,N]}),t[43]=j,t[44]=N,t[45]=P):P=t[45];let F;t[46]===r.timezone?F=t[47]:(F=(0,G.jsx)(`span`,{className:`font-medium text-fg`,children:r.timezone}),t[46]=r.timezone,t[47]=F);let R=f.timezone??``,V;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(V=I(),t[48]=V):V=t[48];let H;t[49]===p?H=t[50]:(H=e=>p(t=>t&&{...t,timezone:e.target.value||void 0}),t[49]=p,t[50]=H);let W;t[51]!==R||t[52]!==H?(W=(0,G.jsx)(`input`,{className:`${q} min-w-0 flex-1`,value:R,placeholder:V,onChange:H}),t[51]=R,t[52]=H,t[53]=W):W=t[53];let K;t[54]===p?K=t[55]:(K=()=>p(Se),t[54]=p,t[55]=K);let J;t[56]!==r.detect||t[57]!==K?(J=(0,G.jsx)(y,{className:`shrink-0 whitespace-nowrap`,onClick:K,children:r.detect}),t[56]=r.detect,t[57]=K,t[58]=J):J=t[58];let Y;t[59]!==W||t[60]!==J?(Y=(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[W,J]}),t[59]=W,t[60]=J,t[61]=Y):Y=t[61];let X;t[62]!==F||t[63]!==Y?(X=(0,G.jsxs)(`label`,{className:`space-y-1.5 text-sm sm:col-span-2`,children:[F,Y]}),t[62]=F,t[63]=Y,t[64]=X):X=t[64];let ne;t[65]===r.evidenceThreshold?ne=t[66]:(ne=(0,G.jsx)(`span`,{className:`font-medium text-fg`,children:r.evidenceThreshold}),t[65]=r.evidenceThreshold,t[66]=ne);let re;t[67]===p?re=t[68]:(re=e=>p(t=>t&&{...t,minEvidenceSources:Number(e.target.value)}),t[67]=p,t[68]=re);let ie;t[69]!==f.minEvidenceSources||t[70]!==re?(ie=(0,G.jsx)(`input`,{type:`number`,min:2,max:10,className:q,value:f.minEvidenceSources,onChange:re}),t[69]=f.minEvidenceSources,t[70]=re,t[71]=ie):ie=t[71];let ae;t[72]!==ne||t[73]!==ie?(ae=(0,G.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[ne,ie]}),t[72]=ne,t[73]=ie,t[74]=ae):ae=t[74];let oe;t[75]===r.scanLimit?oe=t[76]:(oe=(0,G.jsx)(`span`,{className:`font-medium text-fg`,children:r.scanLimit}),t[75]=r.scanLimit,t[76]=oe);let se;t[77]===p?se=t[78]:(se=e=>p(t=>t&&{...t,limit:Number(e.target.value)}),t[77]=p,t[78]=se);let ce;t[79]!==f.limit||t[80]!==se?(ce=(0,G.jsx)(`input`,{type:`number`,min:1,max:2e3,className:q,value:f.limit,onChange:se}),t[79]=f.limit,t[80]=se,t[81]=ce):ce=t[81];let le;t[82]!==oe||t[83]!==ce?(le=(0,G.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[oe,ce]}),t[82]=oe,t[83]=ce,t[84]=le):le=t[84];let ue;t[85]!==A||t[86]!==P||t[87]!==X||t[88]!==ae||t[89]!==le?(ue=(0,G.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[A,P,X,ae,le]}),t[85]=A,t[86]=P,t[87]=X,t[88]=ae,t[89]=le,t[90]=ue):ue=t[90];let de;t[91]!==b.error||t[92]!==b.status?(de=(0,G.jsx)(`div`,{className:`mt-5 flex justify-end`,children:(0,G.jsx)(z,{status:b.status,error:b.error})}),t[91]=b.error,t[92]=b.status,t[93]=de):de=t[93];let fe;t[94]!==b.onBlurCapture||t[95]!==ue||t[96]!==de?(fe=(0,G.jsx)(Z,{children:(0,G.jsxs)(`div`,{onBlurCapture:C,children:[ue,de]})}),t[94]=b.onBlurCapture,t[95]=ue,t[96]=de,t[97]=fe):fe=t[97];let pe;t[98]===r.lastRun?pe=t[99]:(pe=(0,G.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:r.lastRun}),t[98]=r.lastRun,t[99]=pe);let me;t[100]!==n||t[101]!==x||t[102]!==r.neverRun||t[103]!==r.runItems?(me=n?(0,G.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-sm text-fg-muted`,children:[(0,G.jsx)(`span`,{children:x}),(0,G.jsx)(`span`,{children:`·`}),(0,G.jsx)(`time`,{children:new Date(n.startedAt).toLocaleString()}),typeof n.metrics.scanned==`number`?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{children:`·`}),(0,G.jsxs)(`span`,{children:[String(n.metrics.scanned),` `,r.runItems]})]}):null]}):(0,G.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:r.neverRun}),t[100]=n,t[101]=x,t[102]=r.neverRun,t[103]=r.runItems,t[104]=me):me=t[104];let $;t[105]!==pe||t[106]!==me?($=(0,G.jsxs)(Z,{children:[pe,me]}),t[105]=pe,t[106]=me,t[107]=$):$=t[107];let he;return t[108]!==fe||t[109]!==$||t[110]!==S?(he=(0,G.jsxs)(`div`,{className:`space-y-5`,children:[S,fe,$]}),t[108]=fe,t[109]=$,t[110]=S,t[111]=he):he=t[111],he}function Se(e){return e&&{...e,timezone:I()}}function Ce(e){let t=(0,U.c)(49),{t:n}=e,{data:r,error:i,isLoading:a,mutate:o}=s(`you-context-settings`,D),c=r?.privacy.sensitiveWritePolicy??null,[l,f]=te(c),p=!!(l&&c&&l!==c),m;t[0]===o?m=t[1]:(m=async e=>{await L({privacy:{sensitiveWritePolicy:e}}),await o()},t[0]=o,t[1]=m);let h;t[2]!==l||t[3]!==p||t[4]!==m?(h={value:l,dirty:p,delayMs:350,onSave:m},t[2]=l,t[3]=p,t[4]=m,t[5]=h):h=t[5];let _=B(h);if(i){let e;t[6]===o?e=t[7]:(e=()=>void o(),t[6]=o,t[7]=e);let r;t[8]!==n.retry||t[9]!==e?(r=(0,G.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,G.jsxs)(Q,{children:[n.error,` `,r]}),t[11]=n.error,t[12]=r,t[13]=i):i=t[13],i}if(a||!l){let e;return t[14]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,G.jsx)(u,{className:`h-56 rounded-2xl`}),t[14]=e):e=t[14],e}let v;t[15]===n.privacyHint?v=t[16]:(v=(0,G.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:n.privacyHint}),t[15]=n.privacyHint,t[16]=v);let y;t[17]===n.sensitivePolicy?y=t[18]:(y=(0,G.jsx)(`span`,{className:`font-medium text-fg`,children:n.sensitivePolicy}),t[17]=n.sensitivePolicy,t[18]=y);let b;t[19]===f?b=t[20]:(b=e=>f(e.target.value),t[19]=f,t[20]=b);let x;t[21]===n.policyDeny?x=t[22]:(x=(0,G.jsx)(d,{value:`deny`,children:n.policyDeny}),t[21]=n.policyDeny,t[22]=x);let S;t[23]===n.policyConfirm?S=t[24]:(S=(0,G.jsx)(d,{value:`confirm`,children:n.policyConfirm}),t[23]=n.policyConfirm,t[24]=S);let C;t[25]===n.policyAllow?C=t[26]:(C=(0,G.jsx)(d,{value:`allow`,children:n.policyAllow}),t[25]=n.policyAllow,t[26]=C);let w;t[27]!==l||t[28]!==b||t[29]!==x||t[30]!==S||t[31]!==C?(w=(0,G.jsxs)(g,{value:l,onChange:b,children:[x,S,C]}),t[27]=l,t[28]=b,t[29]=x,t[30]=S,t[31]=C,t[32]=w):w=t[32];let T;t[33]!==w||t[34]!==y?(T=(0,G.jsxs)(`label`,{className:`block max-w-xl space-y-1.5 text-sm`,children:[y,w]}),t[33]=w,t[34]=y,t[35]=T):T=t[35];let E;t[36]===n.privacyWarning?E=t[37]:(E=(0,G.jsx)(`p`,{className:`mt-3 max-w-2xl text-xs leading-5 text-fg-subtle`,children:n.privacyWarning}),t[36]=n.privacyWarning,t[37]=E);let O;t[38]!==_.error||t[39]!==_.status?(O=(0,G.jsx)(`div`,{className:`mt-5 flex justify-end`,children:(0,G.jsx)(z,{status:_.status,error:_.error})}),t[38]=_.error,t[39]=_.status,t[40]=O):O=t[40];let k;t[41]!==_.onBlurCapture||t[42]!==T||t[43]!==E||t[44]!==O?(k=(0,G.jsx)(Z,{children:(0,G.jsxs)(`div`,{onBlurCapture:_.onBlurCapture,children:[T,E,O]})}),t[41]=_.onBlurCapture,t[42]=T,t[43]=E,t[44]=O,t[45]=k):k=t[45];let A;return t[46]!==k||t[47]!==v?(A=(0,G.jsxs)(`div`,{className:`space-y-5`,children:[v,k]}),t[46]=k,t[47]=v,t[48]=A):A=t[48],A}export{re as UserContextPage};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i,t as a}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{n as o}from"./locale-store-Bjvw7jtg.js";import{i as s}from"./vendor-swr-BIWyz7Rc.js";import{$a as c,Al as l,Da as u,Go as d,La as f,Ps as p,Qa as m,Qs as h,Wo as g,Yl as _,Za as v,_s as y,ao as b,co as x,cu as S,do as C,eo as w,fo as T,hc as E,io as D,kc as O,lo as k,lu as A,no as j,oo as M,pl as N,ro as P,so as F,to as I,uo as L,xc as R}from"./index-Cb9y6tVR.js";import{n as z,t as B}from"./use-autosave-Frcfbncl.js";import{t as V}from"./page-tabs-D6YJ6_l_.js";import{a as H}from"./connectors-api-Ne8mQrYN.js";var U=n(),W=e(t(),1),G=r(),K=new Set([`profile`,`understanding`,`collaboration`,`sources`,`dreaming`,`privacy`]),q=`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`,J={en:{title:`About You`,subtitle:`What xopc knows, why it knows it, and how it should work with you.`,profile:`Profile`,understanding:`Understanding`,collaboration:`Working agreement`,sources:`Sources`,dreaming:`Background review`,privacy:`Privacy`,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`,qualityNoData:`Not enough feedback yet`,emptyRules:`No working agreements yet.`,sourceExplicit:`You said this directly`,sourceInferred:`Inferred — may be wrong`,sourceObserved:`Observed across prior work`,sourcesHint:`Review every granted source, its access mode, retention, and last collection. Revoking stops future learning.`,manageSources:`Connect another source`,noSources:`No sources are authorized.`,connected:`Connected`,unavailable:`Needs attention`,revoke:`Revoke & remove derived`,refresh:`Refresh`,once:`One-time`,continuous:`Continuous`,localOnly:`Local only`,derivedOnly:`Derived understanding only`,focuses:`Current focuses`,focusHint:`Candidate focuses never activate until you confirm them.`,activate:`Activate`,pause:`Pause`,complete:`Complete`,noFocuses:`No focus candidates yet.`,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:`隐私`,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:`有效召回`,qualityNoData:`反馈数据还不足`,sourceExplicit:`由你直接告知`,sourceInferred:`推断内容,可能有误`,sourceObserved:`从过往工作中观察到`,sourcesHint:`查看每项授权的访问方式、保留策略和最近采集时间;撤销后将停止后续学习。`,manageSources:`连接其他来源`,noSources:`尚未授权任何来源。`,connected:`已连接`,unavailable:`需要处理`,revoke:`撤销并删除派生理解`,refresh:`立即更新`,once:`仅一次`,continuous:`持续更新`,localOnly:`仅本地处理`,derivedOnly:`仅保留派生理解`,focuses:`当前关注`,focusHint:`候选关注不会自动生效,只有你确认后才会启用。`,activate:`启用`,pause:`暂停`,complete:`完成`,noFocuses:`还没有候选关注。`,dreamingHint:`每天进行一次确定性复核,检查过期、矛盾证据和得到佐证的候选理解;推断内容不会自动生效。`,mode:`后台复核`,on:`开启并生成待审核项`,off:`关闭`,reviewTime:`每日复核时间`,evidenceThreshold:`所需支持证据数`,scanLimit:`每次最多检查`,lastRun:`最近一次复核`,neverRun:`尚未运行`,runCompleted:`已完成`,runFailed:`失败`,runRunning:`运行中`,runItems:`项`,privacyHint:`选择通用记忆服务如何处理敏感内容;结构化用户理解有独立且更严格的规则。`,sensitivePolicy:`敏感记忆写入`,policyDeny:`不保存`,policyConfirm:`保存前询问`,policyAllow:`相关时允许保存`,privacyWarning:`无论这里如何设置,秘密和受监管内容都不会保存为结构化用户理解。`,error:`无法加载用户上下文。`,retry:`重试`}},Y={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:`洞察`}},X={communication:{en:`Communication`,zh:`沟通`},execution:{en:`Execution`,zh:`执行`},boundary:{en:`Boundary`,zh:`边界`},routine:{en:`Routine`,zh:`习惯`},proactive:{en:`Proactive help`,zh:`主动协助`}};function Z(e){let t=(0,U.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,G.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 Q(e){let t=(0,U.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,G.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 ee(e){return JSON.stringify(e)}function te(e){let t=(0,U.c)(10),[n,r]=(0,W.useState)(e),i;t[0]===e?i=t[1]:(i=ee(e),t[0]=e,t[1]=i);let a=(0,W.useRef)(i),o;t[2]===e?o=t[3]:(o=ee(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=>ee(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,W.useEffect)(c,l);let u;return t[8]===n?u=t[9]:(u=[n,r],t[8]=n,t[9]=u),u}function ne(e){return{callName:e.callName,role:e.role,primaryGoal:e.primaryGoal,pronouns:e.pronouns,timezone:e.timezone,locale:e.locale}}function re(){let e=(0,U.c)(87),t=o(se),n=J[t],[r,a]=i(),c;if(e[0]!==r){let t=r.get(`tab`);c=t&&K.has(t)?t:`profile`,e[0]=r,e[1]=c}else c=e[1];let l=c,d=f(oe),p=f(ae),{data:m,error:g,isLoading:v,mutate:y}=s(`/api/you`,P),b;e[2]!==p||e[3]!==d||e[4]!==n.subtitle||e[5]!==n.title?(b=()=>(d({startExtra:null,main:(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h1`,{className:`text-base font-semibold text-fg`,children:n.title}),(0,G.jsx)(`p`,{className:`hidden text-xs text-fg-muted sm:block`,children:n.subtitle})]}),end:null}),p),e[2]=p,e[3]=d,e[4]=n.subtitle,e[5]=n.title,e[6]=b):b=e[6];let x;if(e[7]!==p||e[8]!==d||e[9]!==n?(x=[p,d,n],e[7]=p,e[8]=d,e[9]=n,e[10]=x):x=e[10],(0,W.useEffect)(b,x),v){let t;return e[11]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,G.jsxs)(`div`,{className:`space-y-4 p-4 sm:p-6`,children:[(0,G.jsx)(u,{className:`h-10 w-96 max-w-full`}),(0,G.jsx)(u,{className:`h-72 rounded-2xl`})]}),e[11]=t):t=e[11],t}if(g||!m){let t;e[12]===y?t=e[13]:(t=()=>void y(),e[12]=y,e[13]=t);let r;e[14]!==n.retry||e[15]!==t?(r=(0,G.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,G.jsx)(`div`,{className:`p-6`,children:(0,G.jsxs)(Q,{children:[n.error,` `,r]})}),e[17]=n.error,e[18]=r,e[19]=i):i=e[19],i}let C=n.title,w;e[20]===a?w=e[21]:(w=e=>a({tab:e}),e[20]=a,e[21]=w);let T;e[22]===n.profile?T=e[23]:(T={id:`profile`,label:n.profile,icon:_},e[22]=n.profile,e[23]=T);let E;e[24]!==m.understandings.length||e[25]!==n.understanding?(E={id:`understanding`,label:n.understanding,icon:A,count:m.understandings.length},e[24]=m.understandings.length,e[25]=n.understanding,e[26]=E):E=e[26];let D=n.collaboration,k;e[27]===m.rules?k=e[28]:(k=m.rules.filter(ie),e[27]=m.rules,e[28]=k);let j;e[29]!==n.collaboration||e[30]!==k.length?(j={id:`collaboration`,label:D,icon:N,count:k.length},e[29]=n.collaboration,e[30]=k.length,e[31]=j):j=e[31];let M;e[32]===n.sources?M=e[33]:(M={id:`sources`,label:n.sources,icon:S},e[32]=n.sources,e[33]=M);let F;e[34]===n.dreaming?F=e[35]:(F={id:`dreaming`,label:n.dreaming,icon:O},e[34]=n.dreaming,e[35]=F);let I;e[36]===n.privacy?I=e[37]:(I={id:`privacy`,label:n.privacy,icon:h},e[36]=n.privacy,e[37]=I);let L;e[38]!==M||e[39]!==F||e[40]!==I||e[41]!==T||e[42]!==E||e[43]!==j?(L=[T,E,j,M,F,I],e[38]=M,e[39]=F,e[40]=I,e[41]=T,e[42]=E,e[43]=j,e[44]=L):L=e[44];let R;e[45]!==n.title||e[46]!==L||e[47]!==w||e[48]!==l?(R=(0,G.jsx)(V,{ariaLabel:C,activeTab:l,onChange:w,items:L}),e[45]=n.title,e[46]=L,e[47]=w,e[48]=l,e[49]=R):R=e[49];let z;e[50]!==m.profile||e[51]!==t||e[52]!==y||e[53]!==n||e[54]!==l?(z=l===`profile`?(0,G.jsx)(ce,{profile:m.profile,language:t,t:n,onChanged:e=>y(t=>t&&{...t,profile:e},{revalidate:!1})}):null,e[50]=m.profile,e[51]=t,e[52]=y,e[53]=n,e[54]=l,e[55]=z):z=e[55];let B;e[56]!==m.quality||e[57]!==m.understandings||e[58]!==t||e[59]!==y||e[60]!==n||e[61]!==l?(B=l===`understanding`?(0,G.jsx)(ue,{items:m.understandings,quality:m.quality,language:t,t:n,onChanged:e=>e?y(t=>t&&{...t,understandings:t.understandings.map(t=>t.id===e.id?e:t)},{revalidate:!0}):y()}):null,e[56]=m.quality,e[57]=m.understandings,e[58]=t,e[59]=y,e[60]=n,e[61]=l,e[62]=B):B=e[62];let H;e[63]!==m.rules||e[64]!==t||e[65]!==y||e[66]!==n||e[67]!==l?(H=l===`collaboration`?(0,G.jsx)(_e,{rules:m.rules,language:t,t:n,onChanged:()=>y()}):null,e[63]=m.rules,e[64]=t,e[65]=y,e[66]=n,e[67]=l,e[68]=H):H=e[68];let q;e[69]!==n||e[70]!==l?(q=l===`sources`?(0,G.jsx)(be,{t:n}):null,e[69]=n,e[70]=l,e[71]=q):q=e[71];let Y;e[72]!==m.consolidation?.lastRun||e[73]!==n||e[74]!==l?(Y=l===`dreaming`?(0,G.jsx)(xe,{lastRun:m.consolidation?.lastRun??null,t:n}):null,e[72]=m.consolidation?.lastRun,e[73]=n,e[74]=l,e[75]=Y):Y=e[75];let X;e[76]!==n||e[77]!==l?(X=l===`privacy`?(0,G.jsx)(Ce,{t:n}):null,e[76]=n,e[77]=l,e[78]=X):X=e[78];let Z;return e[79]!==R||e[80]!==z||e[81]!==B||e[82]!==H||e[83]!==q||e[84]!==Y||e[85]!==X?(Z=(0,G.jsxs)(`div`,{className:`mx-auto w-full max-w-5xl space-y-5 p-4 sm:p-6`,children:[R,z,B,H,q,Y,X]}),e[79]=R,e[80]=z,e[81]=B,e[82]=H,e[83]=q,e[84]=Y,e[85]=X,e[86]=Z):Z=e[86],Z}function ie(e){return e.status===`active`}function ae(e){return e.clearPageHeader}function oe(e){return e.setPageHeader}function se(e){return e.language}function ce(e){let t=(0,U.c)(78),{profile:n,language:r,t:i,onChanged:a}=e,o;t[0]===n?o=t[1]:(o=ne(n),t[0]=n,t[1]=o);let s=o,[c,l]=te(s),u;t[2]===c?u=t[3]:(u=ee(c),t[2]=c,t[3]=u);let d;t[4]===s?d=t[5]:(d=ee(s),t[4]=s,t[5]=d);let f=u!==d,p;t[6]!==a||t[7]!==n?(p=async e=>{await a((await T({...e,accessibility:n.accessibility})).profile)},t[6]=a,t[7]=n,t[8]=p):p=t[8];let m;t[9]!==c||t[10]!==f||t[11]!==p?(m={value:c,dirty:f,delayMs:500,onSave:p},t[9]=c,t[10]=f,t[11]=p,t[12]=m):m=t[12];let h=B(m),g;t[13]!==c||t[14]!==l?(g=(e,t,n)=>(0,G.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[(0,G.jsx)(`span`,{className:`font-medium text-fg`,children:t}),(0,G.jsx)(`input`,{className:q,placeholder:n,value:c[e],onChange:t=>l(n=>({...n,[e]:t.target.value}))})]}),t[13]=c,t[14]=l,t[15]=g):g=t[15];let _=g,v=h.onBlurCapture,b;t[16]===i.profileHint?b=t[17]:(b=(0,G.jsx)(`p`,{className:`mb-5 text-sm leading-6 text-fg-muted`,children:i.profileHint}),t[16]=i.profileHint,t[17]=b);let x;t[18]!==_||t[19]!==i.callName||t[20]!==i.callNamePlaceholder?(x=_(`callName`,i.callName,i.callNamePlaceholder),t[18]=_,t[19]=i.callName,t[20]=i.callNamePlaceholder,t[21]=x):x=t[21];let S;t[22]!==_||t[23]!==i.role||t[24]!==i.rolePlaceholder?(S=_(`role`,i.role,i.rolePlaceholder),t[22]=_,t[23]=i.role,t[24]=i.rolePlaceholder,t[25]=S):S=t[25];let C;t[26]===i.primaryGoal?C=t[27]:(C=(0,G.jsx)(`span`,{className:`font-medium text-fg`,children:i.primaryGoal}),t[26]=i.primaryGoal,t[27]=C);let w;t[28]===l?w=t[29]:(w=e=>l(t=>({...t,primaryGoal:e.target.value})),t[28]=l,t[29]=w);let E;t[30]!==c.primaryGoal||t[31]!==i.primaryGoalPlaceholder||t[32]!==w?(E=(0,G.jsx)(`textarea`,{className:q,rows:3,placeholder:i.primaryGoalPlaceholder,value:c.primaryGoal,onChange:w}),t[30]=c.primaryGoal,t[31]=i.primaryGoalPlaceholder,t[32]=w,t[33]=E):E=t[33];let D;t[34]!==C||t[35]!==E?(D=(0,G.jsxs)(`label`,{className:`space-y-1.5 text-sm sm:col-span-2`,children:[C,E]}),t[34]=C,t[35]=E,t[36]=D):D=t[36];let O;t[37]!==_||t[38]!==r||t[39]!==i.pronouns||t[40]!==i.pronounsPlaceholder?(O=r===`en`?_(`pronouns`,i.pronouns,i.pronounsPlaceholder):null,t[37]=_,t[38]=r,t[39]=i.pronouns,t[40]=i.pronounsPlaceholder,t[41]=O):O=t[41];let k;t[42]===i.timezone?k=t[43]:(k=(0,G.jsx)(`span`,{className:`font-medium text-fg`,children:i.timezone}),t[42]=i.timezone,t[43]=k);let A;t[44]===l?A=t[45]:(A=e=>l(t=>({...t,timezone:e.target.value})),t[44]=l,t[45]=A);let j;t[46]!==c.timezone||t[47]!==A?(j=(0,G.jsx)(`input`,{className:`${q} min-w-0 flex-1`,value:c.timezone,onChange:A}),t[46]=c.timezone,t[47]=A,t[48]=j):j=t[48];let M;t[49]===l?M=t[50]:(M=()=>l(le),t[49]=l,t[50]=M);let N;t[51]!==i.detect||t[52]!==M?(N=(0,G.jsx)(y,{className:`shrink-0 whitespace-nowrap`,onClick:M,children:i.detect}),t[51]=i.detect,t[52]=M,t[53]=N):N=t[53];let P;t[54]!==j||t[55]!==N?(P=(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[j,N]}),t[54]=j,t[55]=N,t[56]=P):P=t[56];let F;t[57]!==k||t[58]!==P?(F=(0,G.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[k,P]}),t[57]=k,t[58]=P,t[59]=F):F=t[59];let I;t[60]!==_||t[61]!==i.locale?(I=_(`locale`,i.locale),t[60]=_,t[61]=i.locale,t[62]=I):I=t[62];let L;t[63]!==x||t[64]!==S||t[65]!==D||t[66]!==O||t[67]!==F||t[68]!==I?(L=(0,G.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[x,S,D,O,F,I]}),t[63]=x,t[64]=S,t[65]=D,t[66]=O,t[67]=F,t[68]=I,t[69]=L):L=t[69];let R;t[70]!==h.error||t[71]!==h.status?(R=(0,G.jsx)(`div`,{className:`mt-5 flex justify-end`,children:(0,G.jsx)(z,{status:h.status,error:h.error})}),t[70]=h.error,t[71]=h.status,t[72]=R):R=t[72];let V;return t[73]!==h.onBlurCapture||t[74]!==L||t[75]!==R||t[76]!==b?(V=(0,G.jsx)(Z,{children:(0,G.jsxs)(`div`,{onBlurCapture:v,children:[b,L,R]})}),t[73]=h.onBlurCapture,t[74]=L,t[75]=R,t[76]=b,t[77]=V):V=t[77],V}function le(e){return{...e,timezone:I()}}function ue(e){let t=(0,U.c)(54),{items:n,quality:r,language:i,t:a,onChanged:o}=e,[s,c]=(0,W.useState)(!1),[l,u]=(0,W.useState)(``),[f,p]=(0,W.useState)(`preference`),h;t[0]===n?h=t[1]:(h=n.filter(fe),t[0]=n,t[1]=h);let _=h,v;t[2]===n?v=t[3]:(v=n.filter(de),t[2]=n,t[3]=v);let b=v,x;t[4]!==f||t[5]!==o||t[6]!==l?(x=async e=>{e.preventDefault(),l.trim()&&(await m({statement:l,kind:f}),u(``),c(!1),await o())},t[4]=f,t[5]=o,t[6]=l,t[7]=x):x=t[7];let S=x,C;t[8]===a.understoodHint?C=t[9]:(C=(0,G.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=()=>c(!0),T=(0,G.jsx)(E,{className:`size-4`}),t[10]=w,t[11]=T):(w=t[10],T=t[11]);let D;t[12]===a.addUnderstanding?D=t[13]:(D=(0,G.jsxs)(y,{variant:`primary`,onClick:w,children:[T,a.addUnderstanding]}),t[12]=a.addUnderstanding,t[13]=D);let O;t[14]!==C||t[15]!==D?(O=(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[C,D]}),t[14]=C,t[15]=D,t[16]=O):O=t[16];let k;t[17]!==r||t[18]!==a?(k=(0,G.jsx)(pe,{quality:r,t:a}),t[17]=r,t[18]=a,t[19]=k):k=t[19];let A;t[20]===a?A=t[21]:(A=(0,G.jsx)(he,{t:a}),t[20]=a,t[21]=A);let j;t[22]!==s||t[23]!==f||t[24]!==i||t[25]!==l||t[26]!==S||t[27]!==a.add||t[28]!==a.cancel||t[29]!==a.statement?(j=s?(0,G.jsx)(Z,{children:(0,G.jsxs)(`form`,{className:`space-y-3`,onSubmit:S,children:[(0,G.jsx)(`textarea`,{autoFocus:!0,className:q,rows:3,placeholder:a.statement,value:l,onChange:e=>u(e.target.value)}),(0,G.jsx)(g,{value:f,onChange:e=>p(e.target.value),children:Object.entries(Y).map(e=>{let[t,n]=e;return(0,G.jsx)(d,{value:t,children:n[i]},t)})}),(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsx)(y,{type:`submit`,variant:`primary`,children:a.add}),(0,G.jsx)(y,{onClick:()=>c(!1),children:a.cancel})]})]})}):null,t[22]=s,t[23]=f,t[24]=i,t[25]=l,t[26]=S,t[27]=a.add,t[28]=a.cancel,t[29]=a.statement,t[30]=j):j=t[30];let M;t[31]!==i||t[32]!==o||t[33]!==b||t[34]!==a?(M=b.length?(0,G.jsxs)(`section`,{className:`space-y-3`,children:[(0,G.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[a.review,` · `,b.length]}),b.map(e=>(0,G.jsx)($,{item:e,language:i,t:a,onChanged:o},e.id))]}):null,t[31]=i,t[32]=o,t[33]=b,t[34]=a,t[35]=M):M=t[35];let N;t[36]!==_.length||t[37]!==a.active?(N=(0,G.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[a.active,` · `,_.length]}),t[36]=_.length,t[37]=a.active,t[38]=N):N=t[38];let P;t[39]!==_||t[40]!==i||t[41]!==o||t[42]!==a?(P=_.length?_.map(e=>(0,G.jsx)($,{item:e,language:i,t:a,onChanged:o},e.id)):(0,G.jsx)(Q,{children:a.emptyUnderstanding}),t[39]=_,t[40]=i,t[41]=o,t[42]=a,t[43]=P):P=t[43];let F;t[44]!==N||t[45]!==P?(F=(0,G.jsxs)(`section`,{className:`space-y-3`,children:[N,P]}),t[44]=N,t[45]=P,t[46]=F):F=t[46];let I;return t[47]!==A||t[48]!==j||t[49]!==M||t[50]!==F||t[51]!==O||t[52]!==k?(I=(0,G.jsxs)(`div`,{className:`space-y-5`,children:[O,k,A,j,M,F]}),t[47]=A,t[48]=j,t[49]=M,t[50]=F,t[51]=O,t[52]=k,t[53]=I):I=t[53],I}function de(e){return[`candidate`,`needs_review`,`stale`].includes(e.status)}function fe(e){return e.status===`active`}function pe(e){let t=(0,U.c)(32),{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;t[20]!==m||t[21]!==_||t[22]!==c||t[23]!==d?(v=[c,d,m,_],t[20]=m,t[21]=_,t[22]=c,t[23]=d,t[24]=v):v=t[24];let y=v,b;t[25]===r.qualityTitle?b=t[26]:(b=(0,G.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:r.qualityTitle}),t[25]=r.qualityTitle,t[26]=b);let x;t[27]===y?x=t[28]:(x=(0,G.jsx)(`div`,{className:`mt-3 grid grid-cols-2 gap-2 sm:grid-cols-4`,children:y.map(me)}),t[27]=y,t[28]=x);let S;return t[29]!==b||t[30]!==x?(S=(0,G.jsxs)(Z,{children:[b,x]}),t[29]=b,t[30]=x,t[31]=S):S=t[31],S}function me(e){let[t,n]=e;return(0,G.jsxs)(`div`,{className:`rounded-xl bg-surface-muted px-3 py-2.5`,children:[(0,G.jsx)(`p`,{className:`text-[11px] text-fg-subtle`,children:t}),(0,G.jsx)(`p`,{className:`mt-1 text-sm font-semibold text-fg`,children:n})]},t)}function $(e){let t=(0,U.c)(57),{item:n,language:r,t:i,onChanged:a}=e,[o,s]=(0,W.useState)(!1),[c,l]=(0,W.useState)(!1),[u,d]=te(n.statement),f=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 k(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]!==f||t[8]!==m||t[9]!==h?(g={value:u,dirty:f,enabled:o,delayMs:500,validate:m,onSave:h},t[5]=u,t[6]=o,t[7]=f,t[8]=m,t[9]=h,t[10]=g):g=t[10];let _=B(g),v=Y[n.kind][r],b;t[11]===v?b=t[12]:(b=(0,G.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:v}),t[11]=v,t[12]=b);let x=n.explicitness===`explicit`?i.sourceExplicit:n.explicitness===`observed`?i.sourceObserved:i.sourceInferred,S;t[13]===x?S=t[14]:(S=(0,G.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:x}),t[13]=x,t[14]=S);let C;t[15]!==b||t[16]!==S?(C=(0,G.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-center gap-2`,children:[b,S]}),t[15]=b,t[16]=S,t[17]=C):C=t[17];let T;t[18]!==u||t[19]!==o||t[20]!==d?(T=o?(0,G.jsx)(`textarea`,{autoFocus:!0,className:q,value:u,onChange:e=>d(e.target.value),rows:3}):(0,G.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:u}),t[18]=u,t[19]=o,t[20]=d,t[21]=T):T=t[21];let E;t[22]!==T||t[23]!==C?(E=(0,G.jsx)(`div`,{className:`flex items-start justify-between gap-3`,children:(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[C,T]})}),t[22]=T,t[23]=C,t[24]=E):E=t[24];let D;t[25]!==_||t[26]!==o||t[27]!==i.done||t[28]!==i.edit?(D=o?(0,G.jsx)(y,{variant:`ghost`,onClick:()=>{_.flush(),s(!1)},children:i.done}):(0,G.jsxs)(y,{variant:`ghost`,onClick:()=>s(!0),children:[(0,G.jsx)(R,{className:`size-3.5`}),i.edit]}),t[25]=_,t[26]=o,t[27]=i.done,t[28]=i.edit,t[29]=D):D=t[29];let O;t[30]!==n.id||t[31]!==n.status||t[32]!==a||t[33]!==i.confirm||t[34]!==i.reject?(O=n.status===`active`?null:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(y,{variant:`primary`,onClick:async()=>{await a((await k(n.id,{status:`active`})).understanding)},children:i.confirm}),(0,G.jsx)(y,{onClick:async()=>{await a((await k(n.id,{status:`rejected`})).understanding)},children:i.reject})]}),t[30]=n.id,t[31]=n.status,t[32]=a,t[33]=i.confirm,t[34]=i.reject,t[35]=O):O=t[35];let A;t[36]!==c||t[37]!==n.id||t[38]!==a?(A=async()=>{if(!c){l(!0);return}await w(n.id),l(!1),await a()},t[36]=c,t[37]=n.id,t[38]=a,t[39]=A):A=t[39];let j;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,G.jsx)(p,{className:`size-3.5`}),t[40]=j):j=t[40];let M=c?i.confirmDelete:i.delete,N;t[41]!==A||t[42]!==M?(N=(0,G.jsxs)(y,{variant:`ghost`,className:`text-danger`,onClick:A,children:[j,M]}),t[41]=A,t[42]=M,t[43]=N):N=t[43];let P;t[44]!==_.error||t[45]!==_.status||t[46]!==o?(P=o||_.status!==`idle`?(0,G.jsx)(z,{className:`ml-auto`,status:_.status,error:_.error}):null,t[44]=_.error,t[45]=_.status,t[46]=o,t[47]=P):P=t[47];let F;t[48]!==D||t[49]!==O||t[50]!==N||t[51]!==P?(F=(0,G.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2`,children:[D,O,N,P]}),t[48]=D,t[49]=O,t[50]=N,t[51]=P,t[52]=F):F=t[52];let I;return t[53]!==_.onBlurCapture||t[54]!==E||t[55]!==F?(I=(0,G.jsx)(Z,{children:(0,G.jsxs)(`div`,{onBlurCapture:_.onBlurCapture,children:[E,F]})}),t[53]=_.onBlurCapture,t[54]=E,t[55]=F,t[56]=I):I=t[56],I}function he(e){let t=(0,U.c)(20),{t:n}=e,{data:r,error:i,isLoading:a,mutate:o}=s(`you-focuses`,b);if(a){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,G.jsx)(u,{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,G.jsx)(Q,{children:n.error}),t[1]=n.error,t[2]=e),e}let c;if(t[3]!==r||t[4]!==o||t[5]!==n.activate||t[6]!==n.complete||t[7]!==n.focusHint||t[8]!==n.focuses||t[9]!==n.noFocuses||t[10]!==n.pause||t[11]!==n.reject){let e=(r??[]).filter(ge),i;t[13]===n.focuses?i=t[14]:(i=(0,G.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n.focuses}),t[13]=n.focuses,t[14]=i);let a;t[15]===n.focusHint?a=t[16]:(a=(0,G.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n.focusHint}),t[15]=n.focusHint,t[16]=a);let s;t[17]!==i||t[18]!==a?(s=(0,G.jsxs)(`div`,{children:[i,a]}),t[17]=i,t[18]=a,t[19]=s):s=t[19],c=(0,G.jsxs)(`section`,{className:`space-y-3`,children:[s,e.length?e.map(e=>(0,G.jsxs)(Z,{children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:e.title}),(0,G.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-[11px] text-fg-muted`,children:e.status})]}),(0,G.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:e.summary})]}),(0,G.jsxs)(`span`,{className:`text-xs tabular-nums text-fg-subtle`,children:[Math.round(e.confidence*100),`%`]})]}),(0,G.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[e.status===`active`?(0,G.jsx)(y,{onClick:async()=>{await C(e.id,`paused`),await o()},children:n.pause}):(0,G.jsx)(y,{variant:`primary`,onClick:async()=>{await C(e.id,`active`),await o()},children:n.activate}),(0,G.jsx)(y,{variant:`ghost`,onClick:async()=>{await C(e.id,`completed`),await o()},children:n.complete}),e.status===`candidate`?(0,G.jsx)(y,{variant:`ghost`,className:`text-danger`,onClick:async()=>{await C(e.id,`rejected`),await o()},children:n.reject}):null]})]},e.id)):(0,G.jsx)(Q,{children:n.noFocuses})]}),t[3]=r,t[4]=o,t[5]=n.activate,t[6]=n.complete,t[7]=n.focusHint,t[8]=n.focuses,t[9]=n.noFocuses,t[10]=n.pause,t[11]=n.reject,t[12]=c}else c=t[12];return c}function ge(e){return e.status!==`rejected`}function _e(e){let t=(0,U.c)(36),{rules:n,language:r,t:i,onChanged:a}=e,[o,s]=(0,W.useState)(!1),[l,u]=(0,W.useState)(``),[f,m]=(0,W.useState)(`communication`),[h,_]=(0,W.useState)(null),b;t[0]!==f||t[1]!==a||t[2]!==l?(b=async e=>{e.preventDefault(),l.trim()&&(await v({statement:l,category:f}),u(``),s(!1),await a())},t[0]=f,t[1]=a,t[2]=l,t[3]=b):b=t[3];let S=b,C;t[4]===i.rulesHint?C=t[5]:(C=(0,G.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:i.rulesHint}),t[4]=i.rulesHint,t[5]=C);let w,T;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(w=()=>s(!0),T=(0,G.jsx)(E,{className:`size-4`}),t[6]=w,t[7]=T):(w=t[6],T=t[7]);let D;t[8]===i.addRule?D=t[9]:(D=(0,G.jsxs)(y,{variant:`primary`,onClick:w,children:[T,i.addRule]}),t[8]=i.addRule,t[9]=D);let O;t[10]!==C||t[11]!==D?(O=(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[C,D]}),t[10]=C,t[11]=D,t[12]=O):O=t[12];let k;t[13]!==o||t[14]!==f||t[15]!==r||t[16]!==l||t[17]!==S||t[18]!==i.add||t[19]!==i.cancel||t[20]!==i.ruleStatement?(k=o?(0,G.jsx)(Z,{children:(0,G.jsxs)(`form`,{className:`space-y-3`,onSubmit:S,children:[(0,G.jsx)(`textarea`,{autoFocus:!0,className:q,rows:3,placeholder:i.ruleStatement,value:l,onChange:e=>u(e.target.value)}),(0,G.jsx)(g,{value:f,onChange:e=>m(e.target.value),children:Object.entries(X).map(e=>{let[t,n]=e;return(0,G.jsx)(d,{value:t,children:n[r]},t)})}),(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsx)(y,{type:`submit`,variant:`primary`,children:i.add}),(0,G.jsx)(y,{onClick:()=>s(!1),children:i.cancel})]})]})}):null,t[13]=o,t[14]=f,t[15]=r,t[16]=l,t[17]=S,t[18]=i.add,t[19]=i.cancel,t[20]=i.ruleStatement,t[21]=k):k=t[21];let A;t[22]!==h||t[23]!==r||t[24]!==a||t[25]!==n||t[26]!==i.confirmDelete||t[27]!==i.delete||t[28]!==i.disable||t[29]!==i.emptyRules||t[30]!==i.enable?(A=n.length?n.filter(ve).map(e=>(0,G.jsxs)(Z,{children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:X[e.category][r]}),(0,G.jsx)(`p`,{className:`mt-3 text-sm leading-6 ${e.status===`disabled`?`text-fg-subtle line-through`:`text-fg`}`,children:e.statement})]}),(0,G.jsxs)(`span`,{className:`text-xs tabular-nums text-fg-subtle`,children:[`P`,e.priority]})]}),(0,G.jsxs)(`div`,{className:`mt-4 flex gap-2`,children:[(0,G.jsx)(y,{variant:`ghost`,onClick:async()=>{await x(e.id,{status:e.status===`active`?`disabled`:`active`}),await a()},children:e.status===`active`?i.disable:i.enable}),(0,G.jsxs)(y,{variant:`ghost`,className:`text-danger`,onClick:async()=>{if(h!==e.id){_(e.id);return}await c(e.id),_(null),await a()},children:[(0,G.jsx)(p,{className:`size-3.5`}),h===e.id?i.confirmDelete:i.delete]})]})]},e.id)):(0,G.jsx)(Q,{children:i.emptyRules}),t[22]=h,t[23]=r,t[24]=a,t[25]=n,t[26]=i.confirmDelete,t[27]=i.delete,t[28]=i.disable,t[29]=i.emptyRules,t[30]=i.enable,t[31]=A):A=t[31];let j;return t[32]!==O||t[33]!==k||t[34]!==A?(j=(0,G.jsxs)(`div`,{className:`space-y-5`,children:[O,k,A]}),t[32]=O,t[33]=k,t[34]=A,t[35]=j):j=t[35],j}function ve(e){return e.status!==`archived`}async function ye(){let[e,t]=await Promise.all([j(),H()]);return{grants:e,connectors:t}}function be(e){let t=(0,U.c)(39),{t:n}=e,{data:r,error:i,isLoading:o,mutate:c}=s(`you-understanding-sources`,ye);if(o){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,G.jsx)(u,{className:`h-64 rounded-2xl`}),t[0]=e):e=t[0],e}if(i){let e;t[1]===c?e=t[2]:(e=()=>void c(),t[1]=c,t[2]=e);let r;t[3]!==n.retry||t[4]!==e?(r=(0,G.jsx)(`button`,{className:`text-accent hover:underline`,onClick:e,children:n.retry}),t[3]=n.retry,t[4]=e,t[5]=r):r=t[5];let i;return t[6]!==n.error||t[7]!==r?(i=(0,G.jsxs)(Q,{children:[n.error,` `,r]}),t[6]=n.error,t[7]=r,t[8]=i):i=t[8],i}let d;t[9]===r?.grants?d=t[10]:(d=r?.grants??[],t[9]=r?.grants,t[10]=d);let f=d,p;t[11]===r?.connectors?p=t[12]:(p=r?.connectors??[],t[11]=r?.connectors,t[12]=p);let m=p,h;t[13]===n.sourcesHint?h=t[14]:(h=(0,G.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:n.sourcesHint}),t[13]=n.sourcesHint,t[14]=h);let g;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,G.jsx)(l,{className:`size-4`}),t[15]=g):g=t[15];let _;t[16]===n.manageSources?_=t[17]:(_=(0,G.jsx)(y,{asChild:!0,variant:`primary`,children:(0,G.jsxs)(a,{to:`/connectors?understanding=1&returnTo=%2Fyou%3Ftab%3Dsources`,children:[n.manageSources,g]})}),t[16]=n.manageSources,t[17]=_);let v;t[18]!==h||t[19]!==_?(v=(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[h,_]}),t[18]=h,t[19]=_,t[20]=v):v=t[20];let b;t[21]!==f||t[22]!==c||t[23]!==n.continuous||t[24]!==n.derivedOnly||t[25]!==n.localOnly||t[26]!==n.noSources||t[27]!==n.once||t[28]!==n.refresh||t[29]!==n.revoke?(b=f.length?(0,G.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:f.map(e=>(0,G.jsx)(Z,{children:(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:e.displayName}),(0,G.jsxs)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:[e.accessMode===`continuous`?n.continuous:n.once,` · `,e.processingPolicy===`local_only`?n.localOnly:e.retentionPolicy===`derived_only`?n.derivedOnly:e.retentionPolicy]}),e.lastCollectedAt?(0,G.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:new Date(e.lastCollectedAt).toLocaleString()}):null]}),(0,G.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-1`,children:[e.accessMode===`continuous`?(0,G.jsx)(y,{variant:`ghost`,onClick:async()=>{await M(e.id),await c()},children:n.refresh}):null,(0,G.jsx)(y,{variant:`ghost`,className:`text-danger`,onClick:async()=>{await F(e.id),await c()},children:n.revoke})]})]})},e.id))}):(0,G.jsx)(Q,{children:n.noSources}),t[21]=f,t[22]=c,t[23]=n.continuous,t[24]=n.derivedOnly,t[25]=n.localOnly,t[26]=n.noSources,t[27]=n.once,t[28]=n.refresh,t[29]=n.revoke,t[30]=b):b=t[30];let x;t[31]!==m||t[32]!==n.connected||t[33]!==n.unavailable?(x=m.length?(0,G.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:m.map(e=>{let t=e.enabled&&(e.status===`connected`||e.connectionStatus===`connected`||e.authStatus===`connected`);return(0,G.jsx)(Z,{children:(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:e.displayName}),(0,G.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:e.connectorId})]}),(0,G.jsx)(`span`,{className:`shrink-0 rounded-full px-2 py-1 text-xs ${t?`bg-success-soft text-success`:`bg-warning-soft text-warning`}`,children:t?n.connected:n.unavailable})]})},e.instanceId)})}):null,t[31]=m,t[32]=n.connected,t[33]=n.unavailable,t[34]=x):x=t[34];let S;return t[35]!==v||t[36]!==b||t[37]!==x?(S=(0,G.jsxs)(`div`,{className:`space-y-5`,children:[v,b,x]}),t[35]=v,t[36]=b,t[37]=x,t[38]=S):S=t[38],S}function xe(e){let t=(0,U.c)(112),{lastRun:n,t:r}=e,{data:i,error:a,isLoading:o,mutate:c}=s(`you-context-settings`,D),l=i?.dreaming??null,[f,p]=te(l),m;t[0]!==f||t[1]!==l?(m=f&&l&&ee(f)!==ee(l),t[0]=f,t[1]=l,t[2]=m):m=t[2];let h=!!m,_;t[3]===c?_=t[4]:(_=async e=>{await L({dreaming:e}),await c()},t[3]=c,t[4]=_);let v;t[5]!==f||t[6]!==h||t[7]!==_?(v={value:f,dirty:h,delayMs:500,onSave:_},t[5]=f,t[6]=h,t[7]=_,t[8]=v):v=t[8];let b=B(v);if(a){let e;t[9]===c?e=t[10]:(e=()=>void c(),t[9]=c,t[10]=e);let n;t[11]!==r.retry||t[12]!==e?(n=(0,G.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,G.jsxs)(Q,{children:[r.error,` `,n]}),t[14]=r.error,t[15]=n,t[16]=i):i=t[16],i}if(o||!f){let e;return t[17]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,G.jsx)(u,{className:`h-72 rounded-2xl`}),t[17]=e):e=t[17],e}let x=n?.status===`completed`?r.runCompleted:n?.status===`failed`?r.runFailed:r.runRunning,S;t[18]===r.dreamingHint?S=t[19]:(S=(0,G.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:r.dreamingHint}),t[18]=r.dreamingHint,t[19]=S);let C=b.onBlurCapture,w;t[20]===r.mode?w=t[21]:(w=(0,G.jsx)(`span`,{className:`font-medium text-fg`,children:r.mode}),t[20]=r.mode,t[21]=w);let T;t[22]===p?T=t[23]:(T=e=>p(t=>t&&{...t,mode:e.target.value}),t[22]=p,t[23]=T);let E;t[24]===r.on?E=t[25]:(E=(0,G.jsx)(d,{value:`review`,children:r.on}),t[24]=r.on,t[25]=E);let O;t[26]===r.off?O=t[27]:(O=(0,G.jsx)(d,{value:`off`,children:r.off}),t[26]=r.off,t[27]=O);let k;t[28]!==f.mode||t[29]!==O||t[30]!==T||t[31]!==E?(k=(0,G.jsxs)(g,{value:f.mode,onChange:T,children:[E,O]}),t[28]=f.mode,t[29]=O,t[30]=T,t[31]=E,t[32]=k):k=t[32];let A;t[33]!==k||t[34]!==w?(A=(0,G.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[w,k]}),t[33]=k,t[34]=w,t[35]=A):A=t[35];let j;t[36]===r.reviewTime?j=t[37]:(j=(0,G.jsx)(`span`,{className:`font-medium text-fg`,children:r.reviewTime}),t[36]=r.reviewTime,t[37]=j);let M;t[38]===p?M=t[39]:(M=e=>p(t=>t&&{...t,schedule:{time:e.target.value}}),t[38]=p,t[39]=M);let N;t[40]!==f.schedule.time||t[41]!==M?(N=(0,G.jsx)(`input`,{type:`time`,className:q,value:f.schedule.time,onChange:M}),t[40]=f.schedule.time,t[41]=M,t[42]=N):N=t[42];let P;t[43]!==j||t[44]!==N?(P=(0,G.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[j,N]}),t[43]=j,t[44]=N,t[45]=P):P=t[45];let F;t[46]===r.timezone?F=t[47]:(F=(0,G.jsx)(`span`,{className:`font-medium text-fg`,children:r.timezone}),t[46]=r.timezone,t[47]=F);let R=f.timezone??``,V;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(V=I(),t[48]=V):V=t[48];let H;t[49]===p?H=t[50]:(H=e=>p(t=>t&&{...t,timezone:e.target.value||void 0}),t[49]=p,t[50]=H);let W;t[51]!==R||t[52]!==H?(W=(0,G.jsx)(`input`,{className:`${q} min-w-0 flex-1`,value:R,placeholder:V,onChange:H}),t[51]=R,t[52]=H,t[53]=W):W=t[53];let K;t[54]===p?K=t[55]:(K=()=>p(Se),t[54]=p,t[55]=K);let J;t[56]!==r.detect||t[57]!==K?(J=(0,G.jsx)(y,{className:`shrink-0 whitespace-nowrap`,onClick:K,children:r.detect}),t[56]=r.detect,t[57]=K,t[58]=J):J=t[58];let Y;t[59]!==W||t[60]!==J?(Y=(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[W,J]}),t[59]=W,t[60]=J,t[61]=Y):Y=t[61];let X;t[62]!==F||t[63]!==Y?(X=(0,G.jsxs)(`label`,{className:`space-y-1.5 text-sm sm:col-span-2`,children:[F,Y]}),t[62]=F,t[63]=Y,t[64]=X):X=t[64];let ne;t[65]===r.evidenceThreshold?ne=t[66]:(ne=(0,G.jsx)(`span`,{className:`font-medium text-fg`,children:r.evidenceThreshold}),t[65]=r.evidenceThreshold,t[66]=ne);let re;t[67]===p?re=t[68]:(re=e=>p(t=>t&&{...t,minEvidenceSources:Number(e.target.value)}),t[67]=p,t[68]=re);let ie;t[69]!==f.minEvidenceSources||t[70]!==re?(ie=(0,G.jsx)(`input`,{type:`number`,min:2,max:10,className:q,value:f.minEvidenceSources,onChange:re}),t[69]=f.minEvidenceSources,t[70]=re,t[71]=ie):ie=t[71];let ae;t[72]!==ne||t[73]!==ie?(ae=(0,G.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[ne,ie]}),t[72]=ne,t[73]=ie,t[74]=ae):ae=t[74];let oe;t[75]===r.scanLimit?oe=t[76]:(oe=(0,G.jsx)(`span`,{className:`font-medium text-fg`,children:r.scanLimit}),t[75]=r.scanLimit,t[76]=oe);let se;t[77]===p?se=t[78]:(se=e=>p(t=>t&&{...t,limit:Number(e.target.value)}),t[77]=p,t[78]=se);let ce;t[79]!==f.limit||t[80]!==se?(ce=(0,G.jsx)(`input`,{type:`number`,min:1,max:2e3,className:q,value:f.limit,onChange:se}),t[79]=f.limit,t[80]=se,t[81]=ce):ce=t[81];let le;t[82]!==oe||t[83]!==ce?(le=(0,G.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[oe,ce]}),t[82]=oe,t[83]=ce,t[84]=le):le=t[84];let ue;t[85]!==A||t[86]!==P||t[87]!==X||t[88]!==ae||t[89]!==le?(ue=(0,G.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[A,P,X,ae,le]}),t[85]=A,t[86]=P,t[87]=X,t[88]=ae,t[89]=le,t[90]=ue):ue=t[90];let de;t[91]!==b.error||t[92]!==b.status?(de=(0,G.jsx)(`div`,{className:`mt-5 flex justify-end`,children:(0,G.jsx)(z,{status:b.status,error:b.error})}),t[91]=b.error,t[92]=b.status,t[93]=de):de=t[93];let fe;t[94]!==b.onBlurCapture||t[95]!==ue||t[96]!==de?(fe=(0,G.jsx)(Z,{children:(0,G.jsxs)(`div`,{onBlurCapture:C,children:[ue,de]})}),t[94]=b.onBlurCapture,t[95]=ue,t[96]=de,t[97]=fe):fe=t[97];let pe;t[98]===r.lastRun?pe=t[99]:(pe=(0,G.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:r.lastRun}),t[98]=r.lastRun,t[99]=pe);let me;t[100]!==n||t[101]!==x||t[102]!==r.neverRun||t[103]!==r.runItems?(me=n?(0,G.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-sm text-fg-muted`,children:[(0,G.jsx)(`span`,{children:x}),(0,G.jsx)(`span`,{children:`·`}),(0,G.jsx)(`time`,{children:new Date(n.startedAt).toLocaleString()}),typeof n.metrics.scanned==`number`?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{children:`·`}),(0,G.jsxs)(`span`,{children:[String(n.metrics.scanned),` `,r.runItems]})]}):null]}):(0,G.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:r.neverRun}),t[100]=n,t[101]=x,t[102]=r.neverRun,t[103]=r.runItems,t[104]=me):me=t[104];let $;t[105]!==pe||t[106]!==me?($=(0,G.jsxs)(Z,{children:[pe,me]}),t[105]=pe,t[106]=me,t[107]=$):$=t[107];let he;return t[108]!==fe||t[109]!==$||t[110]!==S?(he=(0,G.jsxs)(`div`,{className:`space-y-5`,children:[S,fe,$]}),t[108]=fe,t[109]=$,t[110]=S,t[111]=he):he=t[111],he}function Se(e){return e&&{...e,timezone:I()}}function Ce(e){let t=(0,U.c)(49),{t:n}=e,{data:r,error:i,isLoading:a,mutate:o}=s(`you-context-settings`,D),c=r?.privacy.sensitiveWritePolicy??null,[l,f]=te(c),p=!!(l&&c&&l!==c),m;t[0]===o?m=t[1]:(m=async e=>{await L({privacy:{sensitiveWritePolicy:e}}),await o()},t[0]=o,t[1]=m);let h;t[2]!==l||t[3]!==p||t[4]!==m?(h={value:l,dirty:p,delayMs:350,onSave:m},t[2]=l,t[3]=p,t[4]=m,t[5]=h):h=t[5];let _=B(h);if(i){let e;t[6]===o?e=t[7]:(e=()=>void o(),t[6]=o,t[7]=e);let r;t[8]!==n.retry||t[9]!==e?(r=(0,G.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,G.jsxs)(Q,{children:[n.error,` `,r]}),t[11]=n.error,t[12]=r,t[13]=i):i=t[13],i}if(a||!l){let e;return t[14]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,G.jsx)(u,{className:`h-56 rounded-2xl`}),t[14]=e):e=t[14],e}let v;t[15]===n.privacyHint?v=t[16]:(v=(0,G.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:n.privacyHint}),t[15]=n.privacyHint,t[16]=v);let y;t[17]===n.sensitivePolicy?y=t[18]:(y=(0,G.jsx)(`span`,{className:`font-medium text-fg`,children:n.sensitivePolicy}),t[17]=n.sensitivePolicy,t[18]=y);let b;t[19]===f?b=t[20]:(b=e=>f(e.target.value),t[19]=f,t[20]=b);let x;t[21]===n.policyDeny?x=t[22]:(x=(0,G.jsx)(d,{value:`deny`,children:n.policyDeny}),t[21]=n.policyDeny,t[22]=x);let S;t[23]===n.policyConfirm?S=t[24]:(S=(0,G.jsx)(d,{value:`confirm`,children:n.policyConfirm}),t[23]=n.policyConfirm,t[24]=S);let C;t[25]===n.policyAllow?C=t[26]:(C=(0,G.jsx)(d,{value:`allow`,children:n.policyAllow}),t[25]=n.policyAllow,t[26]=C);let w;t[27]!==l||t[28]!==b||t[29]!==x||t[30]!==S||t[31]!==C?(w=(0,G.jsxs)(g,{value:l,onChange:b,children:[x,S,C]}),t[27]=l,t[28]=b,t[29]=x,t[30]=S,t[31]=C,t[32]=w):w=t[32];let T;t[33]!==w||t[34]!==y?(T=(0,G.jsxs)(`label`,{className:`block max-w-xl space-y-1.5 text-sm`,children:[y,w]}),t[33]=w,t[34]=y,t[35]=T):T=t[35];let E;t[36]===n.privacyWarning?E=t[37]:(E=(0,G.jsx)(`p`,{className:`mt-3 max-w-2xl text-xs leading-5 text-fg-subtle`,children:n.privacyWarning}),t[36]=n.privacyWarning,t[37]=E);let O;t[38]!==_.error||t[39]!==_.status?(O=(0,G.jsx)(`div`,{className:`mt-5 flex justify-end`,children:(0,G.jsx)(z,{status:_.status,error:_.error})}),t[38]=_.error,t[39]=_.status,t[40]=O):O=t[40];let k;t[41]!==_.onBlurCapture||t[42]!==T||t[43]!==E||t[44]!==O?(k=(0,G.jsx)(Z,{children:(0,G.jsxs)(`div`,{onBlurCapture:_.onBlurCapture,children:[T,E,O]})}),t[41]=_.onBlurCapture,t[42]=T,t[43]=E,t[44]=O,t[45]=k):k=t[45];let A;return t[46]!==k||t[47]!==v?(A=(0,G.jsxs)(`div`,{className:`space-y-5`,children:[v,k]}),t[46]=k,t[47]=v,t[48]=A):A=t[48],A}export{re 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-Bjvw7jtg.js";import{cs as o,po as s}from"./index-BpkdvHH0.js";e();var c=t();async function l(e,t){return(await a(i(`/api/voice/tts-voices?${new URLSearchParams({provider:e,model:t}).toString()}`))).payload?.voices??[]}function u(){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 d(){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 f(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function p(e){return typeof e==`string`&&e.trim().length>0?e.trim():`xopc-local`}function m(e){let t=u();if(!f(e))return t;let n=p(e.provider),r=t.fallback??{enabled:!1,order:[`xopc-local`]};if(f(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??{},...f(e.providers)?Object.fromEntries(Object.entries(e.providers).map(([e,t])=>[e,f(t)?{...t}:{}])):{}};return{enabled:!!e.enabled,provider:n,providers:i,fallback:r}}function h(e){return typeof e==`string`&&e.trim().length>0?e.trim():`edge`}function g(e){let t=d();if(!f(e))return t;let n=h(e.provider),r=e.trigger===`off`||e.trigger===`always`||e.trigger===`inbound`||e.trigger===`tagged`?e.trigger:`inbound`,i={...t.providers??{},...f(e.providers)?Object.fromEntries(Object.entries(e.providers).map(([e,t])=>[e,f(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 _(e){return{...e}}function v(e){return{...e}}function y(e){let t=f(e)?e:{},n=f(t.voice)?t.voice:{},r=f(n.input)?n.input:{},i=f(r.refinement)?r.refinement:{},a=i.mode===`punctuation`||i.mode===`light`||i.mode===`custom`?i.mode:`off`;return{stt:m(t.stt),tts:g(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 b(){return y((await a(i(`/api/config`))).payload?.config??{})}async function x(e){await a(i(`/api/config`),{method:`PATCH`,body:JSON.stringify({stt:_(e.stt),tts:v(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`)),s()}async function S(){let e=await a(i(`/api/voice/models`));if(!e.payload?.models)throw Error(`Missing voice models payload`);return e.payload.models}async function C(){let e=await a(i(`/api/voice/providers`));if(!e.payload?.providers)throw Error(`Missing voice providers payload`);return e.payload}async function w(){let e=await a(i(`/api/voice/stt-providers`));if(!e.payload?.providers)throw Error(`Missing STT providers payload`);return e.payload}async function T(){let e=await a(i(`/api/voice/local/status`));if(!e.payload)throw Error(`Missing local voice status payload`);return e.payload}async function E(e){await a(i(`/api/voice/local/models/${encodeURIComponent(e)}/install`),{method:`POST`,body:`{}`})}async function D(e){await a(i(`/api/voice/local/models/${encodeURIComponent(e)}`),{method:`DELETE`})}async function O(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 k(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 A=n();function j(e){let t=(0,c.c)(15),{kind:n,providerId:i,fieldId:a,value:s,onChange:l,labels:u,placeholder:d,className:f}=e,p=d===void 0?`sk-...`:d,m;t[0]!==n||t[1]!==i?(m=()=>k({kind:n,provider:i}).then(M),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]!==s?(_=(0,A.jsx)(o,{id:a,value:s,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]=s,t[11]=_):_=t[11];let v;return t[12]!==g||t[13]!==_?(v=(0,A.jsx)(`div`,{className:g,children:_}),t[12]=g,t[13]=_,t[14]=v):v=t[14],v}function M(e){return e.apiKey??null}export{C as a,E as c,D as d,O as f,S as i,y as l,T as n,b as o,l as r,w as s,j as t,x 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-Bjvw7jtg.js";import{cs as o,po as s}from"./index-Cb9y6tVR.js";e();var c=t();async function l(e,t){return(await a(i(`/api/voice/tts-voices?${new URLSearchParams({provider:e,model:t}).toString()}`))).payload?.voices??[]}function u(){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 d(){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 f(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function p(e){return typeof e==`string`&&e.trim().length>0?e.trim():`xopc-local`}function m(e){let t=u();if(!f(e))return t;let n=p(e.provider),r=t.fallback??{enabled:!1,order:[`xopc-local`]};if(f(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??{},...f(e.providers)?Object.fromEntries(Object.entries(e.providers).map(([e,t])=>[e,f(t)?{...t}:{}])):{}};return{enabled:!!e.enabled,provider:n,providers:i,fallback:r}}function h(e){return typeof e==`string`&&e.trim().length>0?e.trim():`edge`}function g(e){let t=d();if(!f(e))return t;let n=h(e.provider),r=e.trigger===`off`||e.trigger===`always`||e.trigger===`inbound`||e.trigger===`tagged`?e.trigger:`inbound`,i={...t.providers??{},...f(e.providers)?Object.fromEntries(Object.entries(e.providers).map(([e,t])=>[e,f(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 _(e){return{...e}}function v(e){return{...e}}function y(e){let t=f(e)?e:{},n=f(t.voice)?t.voice:{},r=f(n.input)?n.input:{},i=f(r.refinement)?r.refinement:{},a=i.mode===`punctuation`||i.mode===`light`||i.mode===`custom`?i.mode:`off`;return{stt:m(t.stt),tts:g(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 b(){return y((await a(i(`/api/config`))).payload?.config??{})}async function x(e){await a(i(`/api/config`),{method:`PATCH`,body:JSON.stringify({stt:_(e.stt),tts:v(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`)),s()}async function S(){let e=await a(i(`/api/voice/models`));if(!e.payload?.models)throw Error(`Missing voice models payload`);return e.payload.models}async function C(){let e=await a(i(`/api/voice/providers`));if(!e.payload?.providers)throw Error(`Missing voice providers payload`);return e.payload}async function w(){let e=await a(i(`/api/voice/stt-providers`));if(!e.payload?.providers)throw Error(`Missing STT providers payload`);return e.payload}async function T(){let e=await a(i(`/api/voice/local/status`));if(!e.payload)throw Error(`Missing local voice status payload`);return e.payload}async function E(e){await a(i(`/api/voice/local/models/${encodeURIComponent(e)}/install`),{method:`POST`,body:`{}`})}async function D(e){await a(i(`/api/voice/local/models/${encodeURIComponent(e)}`),{method:`DELETE`})}async function O(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 k(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 A=n();function j(e){let t=(0,c.c)(15),{kind:n,providerId:i,fieldId:a,value:s,onChange:l,labels:u,placeholder:d,className:f}=e,p=d===void 0?`sk-...`:d,m;t[0]!==n||t[1]!==i?(m=()=>k({kind:n,provider:i}).then(M),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]!==s?(_=(0,A.jsx)(o,{id:a,value:s,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]=s,t[11]=_):_=t[11];let v;return t[12]!==g||t[13]!==_?(v=(0,A.jsx)(`div`,{className:g,children:_}),t[12]=g,t[13]=_,t[14]=v):v=t[14],v}function M(e){return e.apiKey??null}export{C as a,E as c,D as d,O as f,S as i,y as l,T as n,b as o,l as r,w as s,j as t,x 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"./messages-DQ5X6cXp.js";import{n as a}from"./locale-store-Bjvw7jtg.js";import{Ao as o,Mo as s,No as c,Oo as l,Po as u,Ra as d,_s as f,bs as p,jo as m,vs as h}from"./index-BpkdvHH0.js";import{WorkDiscoveryPage as g}from"./work-discovery-page-BnPF2vx7.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=a(C),w=d(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=i(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)(s,{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)(h,{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)(u,{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)(m,{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)(p,{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)(f,{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)(g,{embedded:!0,onRequestClose:N})}),t[31]=N,t[32]=J);let Y;t[33]!==q||t[34]!==J?(Y=(0,y.jsxs)(c,{children:[z,(0,y.jsx)(o,{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)(l,{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"./messages-DQ5X6cXp.js";import{n as a}from"./locale-store-Bjvw7jtg.js";import{Ao as o,Mo as s,No as c,Oo as l,Po as u,Ra as d,_s as f,bs as p,jo as m,vs as h}from"./index-Cb9y6tVR.js";import{WorkDiscoveryPage as g}from"./work-discovery-page-Bt2-fzHu.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=a(C),w=d(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=i(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)(s,{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)(h,{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)(u,{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)(m,{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)(p,{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)(f,{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)(g,{embedded:!0,onRequestClose:N})}),t[31]=N,t[32]=J);let Y;t[33]!==q||t[34]!==J?(Y=(0,y.jsxs)(c,{children:[z,(0,y.jsx)(o,{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)(l,{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};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{f as r,l as i}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as a}from"./check-DUBLcKHA.js";import{t as o}from"./cn-JdwAhgNB.js";import{t as ee}from"./messages-DQ5X6cXp.js";import{n as te}from"./locale-store-Bjvw7jtg.js";import{Ba as ne,Da as s,Dt as re,Ga as ie,Ha as ae,Ja as c,Ka as oe,Qs as l,Ra as u,Tl as se,Ua as d,Va as ce,Wa as le,Wl as ue,Xa as de,Ya as f,_s as p,bs as m,hl as fe,iu as pe,jt as me,ou as he,qa as ge,vs as _e,yl as h,za as ve,zc as g}from"./index-Cb9y6tVR.js";var _=e(t(),1),v=new Set([`completed`,`failed`,`canceled`]);function ye(){return new Promise(e=>window.setTimeout(e,1200))}async function be(e,t){let n=[],r=t.wait??ye;for(let i=0;i<e.length&&!t.shouldStop?.();i+=1){let a=e[i];if(a)try{await t.grantDirectory(a.rootPath);let o=await t.startRun(a.rootPath);for(t.onRun(o,i,e.length);!v.has(o.status)&&!t.shouldStop?.();)await r(),o=await t.fetchRun(o.id),t.onRun(o,i,e.length);if(n.push(o),o.status===`canceled`||t.shouldStop?.())break}catch(e){if(t.onError?.(e,a,i),t.shouldStop?.())break}}return n}var y=new Set([`local-recent-files`,`chromium-bookmarks`,`apple-notes`,`apple-calendar`,`apple-reminders`]);function xe(e){return new Set(e.filter(e=>e.availability===`available`&&y.has(e.id)).map(e=>e.id))}var b=n(),Se=[`folder_structure`,`recent_progress`,`next_steps`];function x(e){return e instanceof Error?e.message:String(e)}function Ce({embedded:e=!1,onRequestClose:t}={}){let n=te(e=>e.language),v=ee(n).onboarding.workDiscovery,ye=ee(n).chat.workingDirectory,y=i(),[Ce]=r(),we=e||Ce.get(`new`)===`1`,[S,C]=(0,_.useState)(`loading`),[w,T]=(0,_.useState)(null),[E,D]=(0,_.useState)(null),[O,k]=(0,_.useState)(!1),[A,j]=(0,_.useState)(null),[Te,M]=(0,_.useState)(!1),[N,P]=(0,_.useState)(``),[F,I]=(0,_.useState)(!1),[L,R]=(0,_.useState)(()=>new Set),[z,Ee]=(0,_.useState)([]),[B,V]=(0,_.useState)(()=>new Set),[De,H]=(0,_.useState)([]),[Oe,ke]=(0,_.useState)(!1),[U,W]=(0,_.useState)({current:0,total:0}),[Ae,je]=(0,_.useState)([]),[G,Me]=(0,_.useState)(()=>new Set),K=(0,_.useRef)(!1),Ne=e=>{Me(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})};(0,_.useEffect)(()=>{let e=!1;return window.electronAPI?.understandingSources?.catalog().then(t=>{e||(je(t),Me(xe(t)))}),()=>{e=!0}},[]);let q=(0,_.useCallback)(e=>{u.getState().updateDirectoryRun(e),D(e),e.status===`completed`?(R(new Set(e.result?.profileCandidates?.filter(e=>e.status===`pending`).map(e=>e.id)??[])),C(e.feedback?.recognitionDecision===`confirmed`?`recommendation`:`recognition`)):e.status===`failed`||e.status===`canceled`?C(`error`):C(`running`)},[]),Pe=async()=>{k(!0),j(null);try{let e=await ne();if(!e.length){j(v.noCandidates);return}Ee(e),V(new Set([e[0].rootPath])),C(`candidates`)}catch(e){j(x(e))}finally{k(!1)}},Fe=e=>{V(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},Ie=(0,_.useCallback)((e,t,n)=>{u.getState().updateDirectoryRun(e),D(e),W({current:t+1,total:n}),H(n=>{let r=[...n];return r[t]=e,r}),C(`running`)},[]),Le=(0,_.useCallback)(e=>{H(t=>t.map(t=>t?.id===e.id?e:t))},[]),Re=async()=>{let e=z.filter(e=>B.has(e.rootPath));if(!e.length)return;k(!0),j(null),H([]),W({current:1,total:e.length}),ke(!0),K.current=!1;let t=!1;try{let n=await be(e,{grantDirectory:le,startRun:c,fetchRun:d,shouldStop:()=>K.current,onRun:(e,n,r)=>{Ie(e,n,r),t||(t=!0,u.getState().collectSources(e.id,[...G]))},onError:(t,n,r)=>{W({current:r+1,total:e.length}),j(v.folderAnalysisFailed.replace(`{{folder}}`,n.displayName).replace(`{{error}}`,x(t)))}});if(K.current)return;let r=n.find(e=>e.status===`completed`)??n.at(-1);r?q(r):C(`candidates`)}catch(e){j(x(e)),C(`candidates`)}finally{ke(!1),k(!1)}},J=me({onPicked:(0,_.useCallback)(async e=>{k(!0),j(null);try{T(await ie(e)),C(`consent`)}catch(e){j(x(e)),C(`intro`)}finally{k(!1)}},[])});(0,_.useEffect)(()=>{let e=!1;return ae().then(async({enabled:n,state:r})=>{if(!e){if(!n){t?t():y(`/chat`,{replace:!0});return}if(!we&&r.activeRunId)try{let t=await d(r.activeRunId);e||q(t);return}catch{}e||C(`intro`)}}).catch(t=>{e||(j(x(t)),C(`intro`))}),()=>{e=!0}},[q,y,t,we]),(0,_.useEffect)(()=>{if(!E||S!==`running`||Oe)return;let e=!1,t=async()=>{try{let t=await d(E.id);e||q(t)}catch{}},n=window.setInterval(()=>void t(),1200),r=e=>{let n=e.detail;(!n?.runId||n.runId===E.id)&&t()};for(let e of[`work-discovery-progress`,`work-discovery-completed`,`work-discovery-failed`,`work-discovery-canceled`])window.addEventListener(e,r);return()=>{e=!0,window.clearInterval(n);for(let e of[`work-discovery-progress`,`work-discovery-completed`,`work-discovery-failed`,`work-discovery-canceled`])window.removeEventListener(e,r)}},[q,Oe,S,E]);let ze=async()=>{k(!0);try{await ce()}finally{t?t():y(`/chat`,{replace:!0})}},Be=async()=>{if(w){k(!0),j(null),H([]),W({current:0,total:0});try{await le(w.canonicalRootPath);let e=await c(w.canonicalRootPath);q(e),u.getState().collectSources(e.id,[...G])}catch(e){j(x(e)),C(`consent`)}finally{k(!1)}}},Y=(e,t)=>{let n=t?`?draft=${encodeURIComponent(t)}`:``;y(`/chat/${encodeURIComponent(e)}${n}`)},Ve=e=>{D(e),M(!1),I(!1),R(new Set(e.result?.profileCandidates?.filter(e=>e.status===`pending`).map(e=>e.id)??[])),e.status===`completed`?C(e.feedback?.recognitionDecision===`confirmed`?`recommendation`:`recognition`):e.status===`failed`||e.status===`canceled`?C(`error`):C(`running`)},He=async()=>{E&&(K.current=!0,q(await ve(E.id)))},X=async(e,t)=>{if(!E)return;await ge(E.id,e.id).catch(()=>{});let r=t?`${n===`zh`?`先帮我评估这个方向,不要修改文件:`:`First assess this direction without changing files:`}\n\n${e.actionPrompt}`:e.actionPrompt;Y(E.sessionKey,r)},Ue=async()=>{if(E){k(!0),j(null);try{let e=E.result?.profileCandidates??[],t=await f((e.length>0?await de(E.id,e.map(e=>({id:e.id,status:L.has(e.id)?`accepted`:`rejected`}))):E).id,`confirmed`);D(t),Le(t),C(`recommendation`)}catch(e){j(x(e))}finally{k(!1)}}},Z=async e=>{if(!(!E||!N.trim())){k(!0),j(null);try{let t=await f(E.id,e,N.trim());D(t),Y(t.sessionKey,N.trim())}catch(e){j(x(e)),k(!1)}}},We=async()=>{if(E){k(!0);try{Y((await f(E.id,`dismissed`)).sessionKey)}catch(e){j(x(e)),k(!1)}}},Q=E?.result?.suggestions.find(e=>e.id===E.result?.primarySuggestionId)??E?.result?.suggestions[0],Ge=E?.result?.suggestions.filter(e=>e.id!==Q?.id)??[],Ke=e=>e===`command`?v.riskCommand:e===`file_write`?v.riskFileWrite:v.riskAnalysis,qe=De.filter(e=>e?.status===`completed`),Je=e&&S===`candidates`,$=qe.length>1?(0,b.jsxs)(`div`,{className:`mt-6 rounded-xl border border-edge bg-surface-panel p-2`,children:[(0,b.jsx)(`p`,{className:`px-2 pb-2 text-xs font-medium text-fg-muted`,children:v.analysisResults}),(0,b.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:qe.map(e=>{let t=z.find(t=>t.rootPath===e.rootPath)?.displayName??e.rootPath.split(/[\\/]/).filter(Boolean).at(-1)??e.rootPath;return(0,b.jsx)(`button`,{type:`button`,className:`rounded-lg px-3 py-2 text-sm font-medium transition ${e.id===E?.id?`bg-accent text-white`:`bg-surface-muted text-fg hover:bg-surface-hover`}`,onClick:()=>Ve(e),children:t},e.id)})})]}):null;return(0,b.jsxs)(`div`,{className:e?`flex h-full min-h-0 flex-1 flex-col overflow-hidden bg-surface-base`:`flex min-h-full flex-1 flex-col bg-surface-base`,children:[(0,b.jsxs)(`main`,{className:e?`mx-auto flex h-full min-h-0 w-full max-w-[40rem] flex-1 flex-col px-5 py-7 sm:px-8 sm:py-9 ${Je?`overflow-hidden`:`overflow-y-auto [scrollbar-gutter:stable]`}`:`mx-auto flex w-full max-w-[40rem] flex-1 flex-col px-5 py-10 sm:px-8 sm:py-16`,children:[e?null:(0,b.jsx)(`div`,{className:`mb-10 flex items-center justify-center`,children:(0,b.jsx)(_e,{className:`size-11`})}),S===`loading`?(0,b.jsxs)(`div`,{className:`mx-auto flex min-h-[26rem] w-full max-w-md flex-col items-center`,"aria-busy":!0,children:[(0,b.jsx)(s,{className:`h-8 w-64 max-w-full`}),(0,b.jsx)(s,{className:`mt-4 h-4 w-full max-w-sm`}),(0,b.jsx)(s,{className:`mt-2 h-4 w-4/5 max-w-xs`}),(0,b.jsx)(s,{className:`mt-10 h-12 w-full rounded-xl`}),(0,b.jsx)(s,{className:`mt-3 h-11 w-full rounded-xl`}),(0,b.jsx)(s,{className:`mt-5 h-4 w-3/5 max-w-56`})]}):null,S===`intro`?(0,b.jsxs)(`section`,{className:`flex flex-1 flex-col text-center`,"aria-labelledby":`work-discovery-title`,children:[(0,b.jsxs)(`div`,{className:`mx-auto max-w-[36rem]`,children:[(0,b.jsx)(`h1`,{id:`work-discovery-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:v.title}),(0,b.jsx)(`p`,{className:`mx-auto mt-3 max-w-[34rem] text-[0.95rem] leading-7 text-fg-muted`,children:v.subtitle})]}),(0,b.jsxs)(`div`,{className:`mx-auto mt-9 w-full max-w-md`,children:[Ae.length?(0,b.jsxs)(`div`,{className:`mb-5 rounded-xl border border-edge bg-surface-panel p-3 text-left`,children:[(0,b.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:v.localSourcesTitle}),(0,b.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:v.localSourcesSubtitle}),(0,b.jsx)(`div`,{className:`mt-3 grid grid-cols-2 gap-2 sm:grid-cols-3`,children:Ae.map(e=>{let t=G.has(e.id);return(0,b.jsxs)(`button`,{type:`button`,className:o(`flex min-h-16 flex-col items-center justify-center gap-1 rounded-lg border px-2 py-2 text-xs font-medium transition-colors`,t?`border-accent/40 bg-accent-soft text-accent-fg`:`border-edge bg-surface-base text-fg-muted hover:bg-surface-hover hover:text-fg`),"aria-pressed":t,onClick:()=>Ne(e.id),children:[(0,b.jsx)(`span`,{className:o(`flex size-4 items-center justify-center rounded-full border`,t?`border-accent bg-accent text-white`:`border-edge`),children:t?(0,b.jsx)(a,{className:`size-3`,"aria-hidden":!0}):null}),e.displayName]},e.id)})})]}):null,(0,b.jsxs)(p,{type:`button`,className:`h-12 w-full gap-2 bg-accent text-white hover:bg-accent-hover`,onClick:()=>void Pe(),disabled:O||J.picking,children:[O?(0,b.jsx)(g,{className:`size-4 animate-spin`}):(0,b.jsx)(l,{className:`size-4`}),v.quickScan]}),(0,b.jsxs)(p,{type:`button`,variant:`secondary`,className:`mt-3 h-11 w-full gap-2`,onClick:J.pick,disabled:O||J.picking,children:[J.picking?(0,b.jsx)(g,{className:`size-4 animate-spin`}):(0,b.jsx)(h,{className:`size-4`}),v.chooseFolderManually]}),(0,b.jsxs)(`div`,{className:`mt-4 flex items-start justify-center gap-2 text-xs leading-5 text-fg-muted`,children:[(0,b.jsx)(l,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`}),(0,b.jsx)(`span`,{children:v.quickScanNote})]}),(0,b.jsx)(`button`,{type:`button`,className:`mt-4 text-sm font-medium text-accent-fg hover:underline`,onClick:()=>y(`/connectors?understanding=1&returnTo=%2Fonboarding%2Fworkspace`),children:v.connectCloudSource}),A?(0,b.jsx)(`p`,{className:`mt-4 text-sm text-danger`,role:`alert`,children:A}):null]}),(0,b.jsx)(`button`,{type:`button`,className:`mx-auto mt-auto pt-10 text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>void ze(),disabled:O,children:v.skip})]}):null,S===`candidates`?(0,b.jsxs)(`section`,{className:e?`flex h-full min-h-0 flex-col`:void 0,"aria-labelledby":`work-discovery-candidates-title`,children:[(0,b.jsxs)(`div`,{className:e?`shrink-0 text-center`:`text-center`,children:[(0,b.jsx)(`h1`,{id:`work-discovery-candidates-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:v.candidatesTitle}),(0,b.jsx)(`p`,{className:`mt-3 text-[0.95rem] leading-7 text-fg-muted`,children:v.candidatesSubtitle})]}),(0,b.jsx)(`div`,{className:e?`mt-5 min-h-0 flex-1 space-y-2 overflow-y-auto overscroll-contain pr-1 [scrollbar-gutter:stable]`:`mt-7 space-y-2`,children:z.map((e,t)=>{let n=B.has(e.rootPath);return(0,b.jsxs)(`button`,{type:`button`,"aria-pressed":n,className:`flex w-full items-start gap-3 rounded-xl border p-4 text-left transition ${n?`border-accent bg-accent-soft/45`:`border-edge bg-surface-panel hover:border-edge-strong`}`,onClick:()=>Fe(e.rootPath),children:[(0,b.jsx)(`span`,{className:`mt-0.5 flex size-5 shrink-0 items-center justify-center rounded-md border ${n?`border-accent bg-accent text-white`:`border-edge bg-surface-base text-transparent`}`,children:(0,b.jsx)(a,{className:`size-3.5`})}),(0,b.jsx)(h,{className:`mt-0.5 size-5 shrink-0 text-accent-fg`}),(0,b.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,b.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,b.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.displayName}),t===0?(0,b.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[0.7rem] font-medium text-accent-fg`,children:v.recommendedCandidate}):null]}),(0,b.jsx)(`span`,{className:`mt-1 block truncate font-mono text-xs text-fg-muted`,children:e.rootPath}),(0,b.jsxs)(`span`,{className:`mt-2 flex flex-wrap gap-x-3 gap-y-1 text-xs text-fg-muted`,children:[(0,b.jsx)(`span`,{children:e.projectKind===`coding`?v.codingProject:e.projectKind===`general`?v.generalProject:v.unknownProject}),e.branch?(0,b.jsx)(`span`,{children:v.branchValue.replace(`{{branch}}`,e.branch)}):null,e.changedFileCount>0?(0,b.jsx)(`span`,{children:v.changedFiles.replace(`{{count}}`,String(e.changedFileCount))}):null]})]})]},e.id)})}),(0,b.jsxs)(`div`,{className:e?`shrink-0 border-t border-edge-subtle pt-4`:void 0,children:[(0,b.jsxs)(`div`,{className:`${e?``:`mt-5 `}flex items-start gap-2 rounded-xl border border-edge-subtle bg-surface-panel px-4 py-3 text-xs leading-5 text-fg-muted`,children:[(0,b.jsx)(l,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`}),(0,b.jsx)(`span`,{children:v.multiFolderPrivacyNote})]}),A?(0,b.jsx)(`p`,{className:`mt-3 text-sm text-danger`,role:`alert`,children:A}):null,(0,b.jsxs)(`div`,{className:`${e?`mt-4`:`mt-7`} flex flex-col gap-3 sm:flex-row-reverse`,children:[(0,b.jsxs)(p,{type:`button`,className:`h-11 flex-1 bg-accent text-white hover:bg-accent-hover`,disabled:O||B.size===0,onClick:()=>void Re(),children:[O?(0,b.jsx)(g,{className:`mr-2 size-4 animate-spin`}):null,v.analyzeSelected.replace(`{{count}}`,String(B.size))]}),(0,b.jsx)(p,{type:`button`,variant:`secondary`,className:`h-11 flex-1`,disabled:O,onClick:J.pick,children:v.chooseFolderManually})]}),(0,b.jsx)(`button`,{type:`button`,className:`${e?`mt-3`:`mt-6`} mx-auto block text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>C(`intro`),children:v.back})]})]}):null,S===`consent`&&w?(0,b.jsxs)(`section`,{"aria-labelledby":`work-discovery-consent-title`,children:[(0,b.jsxs)(`div`,{className:`text-center`,children:[(0,b.jsx)(`h1`,{id:`work-discovery-consent-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:v.selectedTitle}),(0,b.jsx)(`p`,{className:`mt-3 text-[0.95rem] leading-7 text-fg-muted`,children:v.selectedSubtitle})]}),(0,b.jsxs)(`div`,{className:`mt-8 overflow-hidden rounded-xl border border-edge bg-surface-panel`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-edge-subtle px-4 py-3.5`,children:[(0,b.jsx)(h,{className:`size-5 shrink-0 text-accent-fg`}),(0,b.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,b.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:w.displayName}),(0,b.jsx)(`p`,{className:`truncate font-mono text-xs text-fg-muted`,children:w.canonicalRootPath})]}),(0,b.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2.5 py-1 text-xs font-medium text-accent-fg`,children:w.projectKind===`coding`?v.codingProject:w.projectKind===`general`?v.generalProject:v.unknownProject})]}),(0,b.jsxs)(`div`,{className:`grid gap-3 border-b border-edge-subtle bg-surface-base/60 p-4 sm:grid-cols-2`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:v.localFingerprint}),(0,b.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:w.fingerprint.branch?v.branchValue.replace(`{{branch}}`,w.fingerprint.branch):v.noGitBranch})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:v.recentActivity}),(0,b.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:v.changedFiles.replace(`{{count}}`,String(w.fingerprint.changedFileCount))})]}),w.fingerprint.recentAreas.length>0?(0,b.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,b.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:v.recentAreas}),(0,b.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:w.fingerprint.recentAreas.map(e=>(0,b.jsx)(`code`,{className:`rounded-md bg-surface-muted px-2 py-1 text-xs text-fg`,children:e},e))})]}):null]}),(0,b.jsxs)(`div`,{className:`divide-y divide-edge-subtle px-4`,children:[(0,b.jsxs)(`div`,{className:`flex gap-3 py-4`,children:[(0,b.jsx)(se,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:v.willRead}),(0,b.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:v.willReadValue})]})]}),(0,b.jsxs)(`div`,{className:`flex gap-3 py-4`,children:[(0,b.jsx)(m,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:v.willIgnore}),(0,b.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:v.willIgnoreValue})]})]}),(0,b.jsxs)(`div`,{className:`flex gap-3 py-4`,children:[(0,b.jsx)(l,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`}),(0,b.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:w.remoteModel?v.providerDisclosure.replace(`{{provider}}`,w.provider):v.localDisclosure})]})]})]}),A?(0,b.jsx)(`p`,{className:`mt-4 text-sm text-danger`,role:`alert`,children:A}):null,(0,b.jsxs)(`div`,{className:`mt-7 flex flex-col gap-3 sm:flex-row-reverse`,children:[(0,b.jsxs)(p,{type:`button`,className:`h-11 flex-1 bg-accent text-white hover:bg-accent-hover`,disabled:O,onClick:()=>void Be(),children:[O?(0,b.jsx)(g,{className:`mr-2 size-4 animate-spin`}):null,v.startAnalysis]}),(0,b.jsx)(p,{type:`button`,variant:`secondary`,className:`h-11 flex-1`,disabled:O,onClick:J.pick,children:v.changeFolder})]}),(0,b.jsx)(`button`,{type:`button`,className:`mx-auto mt-6 block text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>void ze(),children:v.skip})]}):null,S===`running`&&E?(0,b.jsxs)(`section`,{"aria-labelledby":`work-discovery-running-title`,"aria-live":`polite`,children:[(0,b.jsxs)(`div`,{className:`text-center`,children:[(0,b.jsx)(`h1`,{id:`work-discovery-running-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:v.analyzingTitle}),(0,b.jsx)(`p`,{className:`mt-3 text-[0.95rem] leading-7 text-fg-muted`,children:v.analyzingSubtitle}),U.total>1?(0,b.jsx)(`p`,{className:`mt-2 text-sm font-medium text-accent-fg`,children:v.analyzingFolderProgress.replace(`{{current}}`,String(U.current)).replace(`{{total}}`,String(U.total))}):null]}),(0,b.jsx)(`div`,{className:`mt-9 rounded-xl border border-edge bg-surface-panel px-5 py-2`,children:Se.map((e,t)=>{let n=Math.max(0,Se.indexOf(E.stage??`folder_structure`)),r=t<n,i=t===n;return(0,b.jsxs)(`div`,{className:`flex items-center gap-4 border-b border-edge-subtle py-4 last:border-b-0`,children:[(0,b.jsx)(`span`,{className:`flex size-7 items-center justify-center rounded-full ${r?`bg-accent text-white`:i?`bg-accent-soft text-accent-fg`:`bg-surface-muted text-fg-subtle`}`,children:r?(0,b.jsx)(a,{className:`size-4`}):i?(0,b.jsx)(g,{className:`size-4 animate-spin motion-reduce:animate-none`}):(0,b.jsx)(`span`,{className:`size-1.5 rounded-full bg-current`})}),(0,b.jsx)(`span`,{className:i||r?`text-sm font-medium text-fg`:`text-sm text-fg-muted`,children:v.stages[e]})]},e)})}),(0,b.jsx)(`p`,{className:`mt-4 truncate text-center font-mono text-xs text-fg-muted`,children:E.rootPath}),(0,b.jsxs)(`div`,{className:`mx-auto mt-7 flex max-w-md flex-col gap-3`,children:[(0,b.jsx)(p,{type:`button`,variant:`secondary`,className:`h-11 w-full`,onClick:()=>y(`/chat`),children:v.continueInBackground}),(0,b.jsx)(`button`,{type:`button`,className:`mx-auto text-sm text-fg-muted hover:text-danger hover:underline`,onClick:()=>void He(),children:v.cancelAnalysis})]})]}):null,S===`recognition`&&E?.result?(0,b.jsxs)(`section`,{"aria-labelledby":`work-discovery-recognition-title`,children:[(0,b.jsxs)(`div`,{className:`text-center`,children:[(0,b.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.16em] text-accent-fg`,children:v.recognitionEyebrow}),(0,b.jsx)(`h1`,{id:`work-discovery-recognition-title`,className:`mt-2 text-2xl font-semibold tracking-tight text-fg`,children:E.result.lowConfidence?v.lowConfidenceTitle:v.recognitionTitle})]}),$,(0,b.jsxs)(`div`,{className:`mt-7 rounded-2xl border border-accent/25 bg-gradient-to-br from-accent-soft/45 via-surface-panel to-surface-panel p-5 sm:p-6`,children:[(0,b.jsx)(`p`,{className:`text-base font-medium leading-7 text-fg`,children:E.result.projectSummary}),(0,b.jsx)(`p`,{className:`mt-3 text-sm leading-6 text-fg-muted`,children:E.result.currentState}),!E.result.lowConfidence&&Q?.evidence.length?(0,b.jsx)(`ul`,{className:`mt-5 space-y-2 border-t border-edge-subtle pt-4`,children:Q.evidence.slice(0,3).map((e,t)=>(0,b.jsxs)(`li`,{className:`flex gap-2 text-xs leading-5 text-fg-muted`,children:[(0,b.jsx)(fe,{className:`mt-0.5 size-3.5 shrink-0 text-accent-fg`}),(0,b.jsxs)(`span`,{children:[e.path?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`code`,{className:`font-mono text-fg`,children:e.path}),`: `]}):null,e.observation]})]},`${Q.id}-recognition-${t}`))}):null]}),E.result.workThreads?.length?(0,b.jsxs)(`div`,{className:`mt-5 rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,b.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:v.workThreadsTitle}),(0,b.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:v.workThreadsSubtitle}),(0,b.jsx)(`div`,{className:`mt-3 divide-y divide-edge-subtle`,children:E.result.workThreads.map(e=>(0,b.jsxs)(`div`,{className:`py-3 first:pt-0 last:pb-0`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[0.7rem] font-medium text-accent-fg`,children:e.horizon===`current`?v.workThreadCurrent:e.horizon===`ongoing`?v.workThreadOngoing:v.workThreadLongTerm}),(0,b.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:e.title})]}),(0,b.jsx)(`p`,{className:`mt-1.5 text-xs leading-5 text-fg-muted`,children:e.summary})]},e.id))})]}):null,E.result.profileCandidates?.length?(0,b.jsxs)(`div`,{className:`mt-5 rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,b.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:v.profileCandidatesTitle}),(0,b.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:v.profileCandidatesSubtitle}),(0,b.jsx)(`div`,{className:`mt-3 space-y-2`,children:E.result.profileCandidates.map(e=>(0,b.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3 rounded-lg px-2 py-2 hover:bg-surface-muted`,children:[(0,b.jsx)(`input`,{type:`checkbox`,className:`mt-0.5 size-4 rounded border-edge accent-accent`,checked:L.has(e.id),onChange:()=>R(t=>{let n=new Set(t);return n.has(e.id)?n.delete(e.id):n.add(e.id),n})}),(0,b.jsx)(`span`,{className:`text-sm leading-5 text-fg`,children:e.statement})]},e.id))})]}):null,E.result.lowConfidence?(0,b.jsxs)(`div`,{className:`mt-5`,children:[(0,b.jsx)(`p`,{className:`text-sm font-medium leading-6 text-fg`,children:E.result.contextQuestion}),(0,b.jsx)(`textarea`,{value:N,onChange:e=>P(e.target.value),placeholder:v.correctionPlaceholder,className:`mt-3 min-h-24 w-full resize-y rounded-xl border border-edge bg-surface-panel px-3 py-2.5 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/15`}),(0,b.jsx)(p,{className:`mt-3 w-full bg-accent text-white hover:bg-accent-hover`,disabled:O||!N.trim(),onClick:()=>void Z(`different_goal`),children:v.continueWithCorrection})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`div`,{className:`mt-6 flex flex-col gap-3 sm:flex-row-reverse`,children:[(0,b.jsxs)(p,{className:`h-11 flex-1 bg-accent text-white hover:bg-accent-hover`,disabled:O,onClick:()=>void Ue(),children:[O?(0,b.jsx)(g,{className:`size-4 animate-spin`}):(0,b.jsx)(a,{className:`size-4`}),v.confirmUnderstanding]}),(0,b.jsx)(p,{variant:`secondary`,className:`h-11 flex-1`,disabled:O,onClick:()=>M(e=>!e),children:v.notQuiteRight})]}),Te?(0,b.jsxs)(`div`,{className:`mt-4 rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,b.jsx)(`label`,{className:`text-sm font-medium text-fg`,htmlFor:`work-discovery-correction`,children:v.correctionLabel}),(0,b.jsx)(`textarea`,{id:`work-discovery-correction`,value:N,onChange:e=>P(e.target.value),placeholder:v.correctionPlaceholder,className:`mt-2 min-h-24 w-full resize-y rounded-lg border border-edge bg-surface-base px-3 py-2.5 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/15`}),(0,b.jsxs)(`div`,{className:`mt-3 flex flex-wrap justify-end gap-2`,children:[(0,b.jsx)(p,{variant:`ghost`,disabled:O||!N.trim(),onClick:()=>void Z(`different_goal`),children:v.differentGoal}),(0,b.jsx)(p,{variant:`primary`,disabled:O||!N.trim(),onClick:()=>void Z(`corrected`),children:v.useCorrection})]})]}):null]}),A?(0,b.jsx)(`p`,{className:`mt-4 text-sm text-danger`,role:`alert`,children:A}):null,(0,b.jsx)(`button`,{type:`button`,disabled:O,className:`mx-auto mt-6 block text-sm text-fg-muted hover:text-fg hover:underline disabled:opacity-60`,onClick:()=>void We(),children:v.openConversation})]}):null,S===`recommendation`&&E?.result&&Q?(0,b.jsxs)(`section`,{"aria-labelledby":`work-discovery-recommendation-title`,children:[(0,b.jsxs)(`div`,{className:`text-center`,children:[(0,b.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.16em] text-accent-fg`,children:v.understandingConfirmed}),(0,b.jsx)(`h1`,{id:`work-discovery-recommendation-title`,className:`mt-2 text-2xl font-semibold tracking-tight text-fg`,children:v.primaryRecommendationTitle})]}),$,(0,b.jsx)(`article`,{className:`mt-7 rounded-2xl border border-accent/30 bg-surface-panel p-5 sm:p-6`,children:(0,b.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,b.jsx)(`div`,{className:`flex size-9 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-accent-fg`,children:(0,b.jsx)(pe,{className:`size-5`})}),(0,b.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,b.jsx)(`h2`,{className:`text-lg font-semibold text-fg`,children:Q.title}),(0,b.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:Q.rationale}),(0,b.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2 text-xs`,children:[(0,b.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-full bg-surface-muted px-2.5 py-1 text-fg-muted`,children:[(0,b.jsx)(ue,{className:`size-3.5`}),v.estimatedMinutes.replace(`{{count}}`,String(Q.estimatedMinutes))]}),(0,b.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2.5 py-1 text-fg-muted`,children:Ke(Q.risk)})]}),(0,b.jsxs)(`div`,{className:`mt-4 rounded-xl bg-surface-base px-4 py-3`,children:[(0,b.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:v.expectedTask}),(0,b.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg`,children:Q.expectedTask})]}),(0,b.jsxs)(`div`,{className:`mt-5 flex flex-wrap gap-2`,children:[(0,b.jsx)(p,{className:`h-10 bg-accent px-4 text-white hover:bg-accent-hover`,onClick:()=>void X(Q,!1),children:v.startRecommendedAction}),(0,b.jsx)(p,{className:`h-10 px-4`,variant:`secondary`,onClick:()=>void X(Q,!0),children:v.explainFirst})]})]})]})}),Ge.length>0?(0,b.jsxs)(`div`,{className:`mt-5 border-t border-edge-subtle pt-4`,children:[(0,b.jsxs)(`button`,{type:`button`,className:`flex w-full items-center justify-between py-2 text-sm font-medium text-fg-muted hover:text-fg`,onClick:()=>I(e=>!e),children:[v.otherDirections,(0,b.jsx)(he,{className:`size-4 transition-transform ${F?`rotate-180`:``}`})]}),F?(0,b.jsx)(`div`,{className:`mt-2 divide-y divide-edge-subtle rounded-xl border border-edge bg-surface-panel px-4`,children:Ge.map(e=>(0,b.jsxs)(`button`,{type:`button`,className:`flex w-full items-start gap-3 py-4 text-left`,onClick:()=>void X(e,!0),children:[(0,b.jsx)(pe,{className:`mt-0.5 size-4 shrink-0 text-fg-subtle`}),(0,b.jsxs)(`span`,{children:[(0,b.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.title}),(0,b.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:e.expectedTask})]})]},e.id))}):null]}):null,(0,b.jsxs)(`div`,{className:`mt-6 flex flex-wrap items-center justify-center gap-x-5 gap-y-3`,children:[(0,b.jsx)(`button`,{type:`button`,className:`text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>Y(E.sessionKey),children:v.doSomethingElse}),(0,b.jsx)(`button`,{type:`button`,className:`text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>{M(!0),C(`recognition`)},children:v.correctUnderstanding})]})]}):null,S===`error`&&E?(0,b.jsxs)(`section`,{className:`text-center`,"aria-labelledby":`work-discovery-error-title`,children:[(0,b.jsx)(`div`,{className:`mx-auto flex size-11 items-center justify-center rounded-xl bg-danger-soft text-danger`,children:(0,b.jsx)(m,{className:`size-5`})}),(0,b.jsx)(`h1`,{id:`work-discovery-error-title`,className:`mt-5 text-2xl font-semibold tracking-tight text-fg`,children:v.errorTitle}),(0,b.jsx)(`p`,{className:`mx-auto mt-3 max-w-lg text-sm leading-6 text-fg-muted`,children:E.errorMessage}),(0,b.jsxs)(`div`,{className:`mx-auto mt-7 flex max-w-md flex-col gap-3 sm:flex-row-reverse`,children:[(0,b.jsx)(p,{className:`h-11 flex-1 bg-accent text-white hover:bg-accent-hover`,onClick:()=>void oe(E.id).then(q),children:v.retry}),(0,b.jsx)(p,{variant:`secondary`,className:`h-11 flex-1`,onClick:()=>{D(null),T(null),C(`intro`)},children:v.chooseDifferent})]}),(0,b.jsx)(`button`,{type:`button`,className:`mt-6 text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>Y(E.sessionKey),children:v.openConversation})]}):null]}),J.hasNativePicker?null:(0,b.jsx)(re,{open:J.modalOpen,onOpenChange:J.setModalOpen,initialAbsolutePath:w?.canonicalRootPath,onConfirm:J.confirmPick,wd:ye})]})}export{Ce as WorkDiscoveryPage};