@xopcai/xopc 0.0.190 → 0.0.191

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 (104) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/xopc.extension.json +1 -1
  3. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-9vAbkroX.js → agent-avatar-dicebear-DvEkT222.js} +1 -1
  4. package/dist/gateway/static/root/assets/{agents-D1t4SfMQ.js → agents-CXyivfqY.js} +1 -1
  5. package/dist/gateway/static/root/assets/{app-management-settings-panel-DkFeIdBf.js → app-management-settings-panel-COpP_pKN.js} +1 -1
  6. package/dist/gateway/static/root/assets/{appearance-settings-Bxs8Fpaj.js → appearance-settings-DTVNUEDq.js} +1 -1
  7. package/dist/gateway/static/root/assets/{apps-page-Cgrgu5OW.js → apps-page-DsE67BSO.js} +1 -1
  8. package/dist/gateway/static/root/assets/{archive-plugin-Ch2RmLCC.js → archive-plugin-IpX6VA0o.js} +1 -1
  9. package/dist/gateway/static/root/assets/{attachment-load-BhMQM_Ky.js → attachment-load-CKVFNUi1.js} +1 -1
  10. package/dist/gateway/static/root/assets/{automations-page-CtJxstKh.js → automations-page-D0TVev47.js} +1 -1
  11. package/dist/gateway/static/root/assets/{binary-plugins-D6CqlymH.js → binary-plugins-BrfvfOS4.js} +1 -1
  12. package/dist/gateway/static/root/assets/{block-editor-ClL6HEg9.js → block-editor-D9sEfg32.js} +1 -1
  13. package/dist/gateway/static/root/assets/{browser-settings-page-DW99iDmD.js → browser-settings-page-DpZzq8j2.js} +1 -1
  14. package/dist/gateway/static/root/assets/{browser-workflow-inputs-BYy48VhN.js → browser-workflow-inputs-BixZ5lCR.js} +1 -1
  15. package/dist/gateway/static/root/assets/{browser-workflows-page-zgLibuMH.js → browser-workflows-page-YEFuodJI.js} +1 -1
  16. package/dist/gateway/static/root/assets/{capabilities-settings-panel-CHUrT9EB.js → capabilities-settings-panel-B9Cmcuff.js} +2 -2
  17. package/dist/gateway/static/root/assets/{capability-presets-settings-panel-Cycrv0YV.js → capability-presets-settings-panel-C_EpuQtk.js} +1 -1
  18. package/dist/gateway/static/root/assets/{channels-settings-V96gPUAU.js → channels-settings-CvzD5qSv.js} +1 -1
  19. package/dist/gateway/static/root/assets/{connectors-api-DS9ED-EL.js → connectors-api-BMMqC0_9.js} +1 -1
  20. package/dist/gateway/static/root/assets/{connectors-page-BhlyQoQI.js → connectors-page-BKrm7tJ9.js} +1 -1
  21. package/dist/gateway/static/root/assets/{cron-expression-CkgsvhtW.js → cron-expression-Bm8koRoD.js} +1 -1
  22. package/dist/gateway/static/root/assets/{desktop-pet-Cv8rGhYW.js → desktop-pet-CMG3mcaJ.js} +1 -1
  23. package/dist/gateway/static/root/assets/{desktop-pet-settings-CIeJdwfV.js → desktop-pet-settings-D8aaPb0x.js} +1 -1
  24. package/dist/gateway/static/root/assets/{directory-picker-path-field-D8jXEiAY.js → directory-picker-path-field-C95yW03b.js} +1 -1
  25. package/dist/gateway/static/root/assets/{extension-debug-page-CCZ9u6TZ.js → extension-debug-page-DsG7Z9lV.js} +1 -1
  26. package/dist/gateway/static/root/assets/{extension-page-CV36ILRG.js → extension-page-CUAXEbAt.js} +1 -1
  27. package/dist/gateway/static/root/assets/{extension-settings-page-IyQrSILY.js → extension-settings-page-CsR7QOJo.js} +1 -1
  28. package/dist/gateway/static/root/assets/{gateway-config-api-D4_r5iJM.js → gateway-config-api-DL70Nakc.js} +1 -1
  29. package/dist/gateway/static/root/assets/{gateway-settings-CYlntpBH.js → gateway-settings-BgDxQ08c.js} +1 -1
  30. package/dist/gateway/static/root/assets/{heartbeat-settings-D4SyWob8.js → heartbeat-settings-BX7q55uZ.js} +1 -1
  31. package/dist/gateway/static/root/assets/{home-page-B2Kagoh8.js → home-page-C08Nen5T.js} +1 -1
  32. package/dist/gateway/static/root/assets/{index-CYT5DOzr.js → index-B-_CEvIX.js} +7 -7
  33. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BMhCuVBZ.js → keyboard-shortcuts-settings-Dt6wS5zW.js} +1 -1
  34. package/dist/gateway/static/root/assets/{local-app-workbench-page-BHYbFjqy.js → local-app-workbench-page-BQVC0tWq.js} +1 -1
  35. package/dist/gateway/static/root/assets/{local-apps-page-ijIe7_y2.js → local-apps-page-DcD3-N00.js} +1 -1
  36. package/dist/gateway/static/root/assets/{logs-page-IIn8Tess.js → logs-page-D6yvW-E4.js} +1 -1
  37. package/dist/gateway/static/root/assets/{management-settings--V_fovKD.js → management-settings-B6EVkJQy.js} +1 -1
  38. package/dist/gateway/static/root/assets/{markdown-split-Dt9-in6W.js → markdown-split-CHUjCnBh.js} +1 -1
  39. package/dist/gateway/static/root/assets/{media-plugins-B3pj_iO0.js → media-plugins-DRrtI2O0.js} +1 -1
  40. package/dist/gateway/static/root/assets/{notes-page-DZ366lIT.js → notes-page-fermYvpI.js} +1 -1
  41. package/dist/gateway/static/root/assets/{notes-workbench-S2sBVOLw.js → notes-workbench-BVCwabjq.js} +2 -2
  42. package/dist/gateway/static/root/assets/{page-tabs-C5ge434C.js → page-tabs-BO262zuu.js} +1 -1
  43. package/dist/gateway/static/root/assets/{preview-open-alternatives-BFa9DgSV.js → preview-open-alternatives-yZYTy-2e.js} +1 -1
  44. package/dist/gateway/static/root/assets/{product-open-page-Dc9CcWdu.js → product-open-page-Dgy8XWhR.js} +1 -1
  45. package/dist/gateway/static/root/assets/{project-detail-page-BilzoCJ7.js → project-detail-page-CS4Ujor7.js} +1 -1
  46. package/dist/gateway/static/root/assets/{projects-page-BoQUyacP.js → projects-page-DMtPC8c4.js} +1 -1
  47. package/dist/gateway/static/root/assets/{remote-access-hub-DUyUaCRF.js → remote-access-hub-BpfHZT88.js} +1 -1
  48. package/dist/gateway/static/root/assets/{schema-form-B84DckWe.js → schema-form-DdE4gtw_.js} +1 -1
  49. package/dist/gateway/static/root/assets/{sessions-page-Dzxlq1F0.js → sessions-page-BZkyrJBM.js} +1 -1
  50. package/dist/gateway/static/root/assets/settings-advanced-gate-DQlK0A4l.js +1 -0
  51. package/dist/gateway/static/root/assets/{settings-form-section-Dp9itvdy.js → settings-form-section-CiYU8AvV.js} +1 -1
  52. package/dist/gateway/static/root/assets/{settings-loading-skeleton-CCtlhoy7.js → settings-loading-skeleton-Bv03cWib.js} +1 -1
  53. package/dist/gateway/static/root/assets/{settings-page-DQmMKf8r.js → settings-page-C-LdINFj.js} +1 -1
  54. package/dist/gateway/static/root/assets/{settings-page-layout-EQIOJa_L.js → settings-page-layout-t_Ox1slk.js} +1 -1
  55. package/dist/gateway/static/root/assets/{setup-status-panel-Cwi-SPja.js → setup-status-panel-HRG_lK4_.js} +1 -1
  56. package/dist/gateway/static/root/assets/{share-preview-page-C4_B2jvf.js → share-preview-page-DF8gW6bo.js} +1 -1
  57. package/dist/gateway/static/root/assets/{shares-settings-CkyuGlZK.js → shares-settings-v_iLhxxa.js} +1 -1
  58. package/dist/gateway/static/root/assets/{skill-reload-api-BJCePQK5.js → skill-reload-api-S-bjtsXX.js} +1 -1
  59. package/dist/gateway/static/root/assets/{skills-page-BYWLfmJi.js → skills-page-BiNBfaX5.js} +1 -1
  60. package/dist/gateway/static/root/assets/{skills-page.utils-Jhm24i4h.js → skills-page.utils-DlnGtvAH.js} +1 -1
  61. package/dist/gateway/static/root/assets/{system-settings-panel-Dpx2ags2.js → system-settings-panel-Bv7GXFc6.js} +1 -1
  62. package/dist/gateway/static/root/assets/{task-detail-page-DLAdxI6e.js → task-detail-page-BhQcOpnx.js} +1 -1
  63. package/dist/gateway/static/root/assets/{typed-models-lib-DULmTHUB.js → typed-models-lib-4XBsLEuv.js} +1 -1
  64. package/dist/gateway/static/root/assets/{use-autosave-BrjVk5VH.js → use-autosave-BN2QgFGn.js} +1 -1
  65. package/dist/gateway/static/root/assets/{user-context-page-9AAFpGAL.js → user-context-page-PtcY7BoJ.js} +1 -1
  66. package/dist/gateway/static/root/assets/{voice-api-key-field-BISTPfq_.js → voice-api-key-field-DnhJtC5l.js} +1 -1
  67. package/dist/gateway/static/root/assets/{work-discovery-overlay-Wr-uF7VA.js → work-discovery-overlay-nmEAafFl.js} +1 -1
  68. package/dist/gateway/static/root/assets/{work-discovery-page-BWds95sL.js → work-discovery-page-C5Kwe_bc.js} +1 -1
  69. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-DHqHP8_6.js → workflow-run-setup-panel-BnNWBDwz.js} +1 -1
  70. package/dist/gateway/static/root/assets/{workflows-page-0b4_DFHr.js → workflows-page-Z_qzaohv.js} +1 -1
  71. package/dist/gateway/static/root/index.html +1 -1
  72. package/dist/package.js +1 -1
  73. package/dist/src/agent/image/generation/openai-images-provider.d.ts +1 -1
  74. package/dist/src/agent/image/generation/openai-images-provider.js +1 -1
  75. package/dist/src/agent/image/generation/provider-registry.d.ts +2 -0
  76. package/dist/src/agent/image/generation/provider-registry.js +20 -10
  77. package/dist/src/agent/image/generation/providers/xopc-cloud.d.ts +2 -0
  78. package/dist/src/agent/image/generation/providers/xopc-cloud.js +74 -0
  79. package/dist/src/agent/image/generation/types.d.ts +2 -2
  80. package/dist/src/cli/commands/gateway/lifecycle.js +1 -1
  81. package/dist/src/cli/commands/onboard/model.d.ts +3 -0
  82. package/dist/src/cli/commands/onboard/model.js +19 -4
  83. package/dist/src/cli/commands/update.js +1 -1
  84. package/dist/src/config/agent-profile.js +1 -1
  85. package/dist/src/gateway/agents-admin.js +1 -1
  86. package/dist/src/gateway/hono/routes/local-apps.js +1 -1
  87. package/dist/src/gateway/hono/routes/models.js +9 -8
  88. package/dist/src/gateway/hono/routes/update.js +2 -2
  89. package/dist/src/gateway/index.js +1 -1
  90. package/dist/src/gateway/run-loop.js +1 -1
  91. package/dist/src/gateway/service.js +5 -5
  92. package/dist/src/infra/gateway-processes.js +1 -1
  93. package/dist/src/infra/update-restart.js +1 -1
  94. package/dist/src/infra/update-runner.js +2 -2
  95. package/dist/src/infra/update-startup.js +1 -1
  96. package/dist/src/providers/model-catalog-store.d.ts +15 -0
  97. package/dist/src/providers/model-catalog-store.js +14 -1
  98. package/dist/src/providers/model-catalog-sync-service.js +6 -0
  99. package/dist/src/providers/model-registry.js +4 -4
  100. package/dist/src/providers/register-runtime-providers.js +4 -4
  101. package/dist/src/providers/xopc-cloud-model-source.js +55 -8
  102. package/dist/src/tui/backends/gateway-realtime-backend.js +1 -1
  103. package/package.json +3 -3
  104. package/dist/gateway/static/root/assets/settings-advanced-gate-TzwlZxU6.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-B4XqB8I6.js";import{n as a}from"./locale-store-deR2zRaE.js";import{Ws as o,as as s,ko as c,kt as l,nc as u,ni as d,ti as f,xl as p}from"./index-CYT5DOzr.js";import{n as m,r as h}from"./settings-page-layout-EQIOJa_L.js";import{r as g,t as _}from"./settings-form-section-Dp9itvdy.js";var v=e(t(),1),y=n();async function b(){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 x(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 S(e,t){return e.task===`opened-settings`?t.openedSettings:e.status===`granted`?e.task===`already-granted`?t.alreadyGranted:t.granted:t.denied}function C(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 w(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 T=new Set([`microphone`,`accessibility`,`notifications`,`screen`]);function E(e,t,n){return t===`granted`?!1:e===`accessibility`&&(n===`darwin`||n===`win32`||n===`linux`)||e===`screen`&&(n===`darwin`||n===`win32`)||T.has(e)?t===`unknown`:!1}function D(e,t,n){return e===`accessibility`?!1:e===`screen`&&n===`linux`?!0:T.has(e)?t===`denied`:!0}var O=[{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 k(e){return e===`linux`?O:O.filter(t=>!t.platforms||t.platforms.includes(e))}function A(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 j(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 M={behavior:null,perms:null,loadError:null,permFeedback:null,permBusy:!1,refreshing:!1};function N(){let e=a(e=>e.language),t=i(e).systemSettings,[n,T]=(0,v.useReducer)(l,M),{behavior:O,perms:N,loadError:P,permFeedback:F,permBusy:I,refreshing:L}=n,R=typeof window<`u`?window.electronAPI?.system:void 0,z=(0,v.useCallback)(async e=>{if(R){T({type:`patch`,patch:{loadError:null}});try{T({type:`patch`,patch:{behavior:await R.getBehavior(),perms:await R.getPermissions({probe:e?.showRefreshFeedback}),...e?.showRefreshFeedback?{permFeedback:t.refreshDone}:{}}})}catch(t){T({type:`patch`,patch:{loadError:t instanceof Error?t.message:String(t),...e?.showRefreshFeedback?{permFeedback:null}:{}}})}}},[R,t.refreshDone]),B=(0,v.useCallback)(async()=>{if(!(L||I)){T({type:`patch`,patch:{refreshing:!0}});try{await z({showRefreshFeedback:!0})}finally{T({type:`patch`,patch:{refreshing:!1}})}}},[z,I,L]);if((0,v.useEffect)(()=>{let e=new Set([t.refreshDone,t.openSettingsDone,t.openSettingsFailed,t.desktopNotify.testShown]);if(!F||!e.has(F))return;let n=window.setTimeout(()=>{T({type:`patch`,patch:{permFeedback:null}})},3e3);return()=>window.clearTimeout(n)},[F,t.openSettingsDone,t.openSettingsFailed,t.refreshDone,t.desktopNotify.testShown]),(0,v.useEffect)(()=>{c()&&R&&z()},[R,z]),!c()||!R)return(0,y.jsxs)(h,{gap:`gap-3`,children:[(0,y.jsx)(m,{title:t.title}),(0,y.jsxs)(`div`,{className:g(),children:[(0,y.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.desktopOnlyTitle}),(0,y.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.desktopOnlyBody})]})]});let V=async e=>{try{let{behavior:t}=await R.setBehavior(e);T({type:`patch`,patch:{behavior:t}}),(e.notifyEnabled!==void 0||e.notifySoundEnabled!==void 0)&&f()}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}},H=async e=>{if(!e){await V({notifyEnabled:!1});return}T({type:`patch`,patch:{permBusy:!0,permFeedback:null}});try{let e=await d(t.desktopNotify.testTitle,t.desktopNotify.testBody);if(e===`unsupported`){T({type:`patch`,patch:{permFeedback:t.notificationsFeedback.unsupported}});return}if(e===`denied`){T({type:`patch`,patch:{permFeedback:t.desktopNotify.denied}});return}if(e==="default"){T({type:`patch`,patch:{permFeedback:t.notificationsFeedback.default}});return}await V({notifyEnabled:!0}),T({type:`patch`,patch:{perms:await R.getPermissions()}}),T({type:`patch`,patch:{permFeedback:t.desktopNotify.testShown}})}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{T({type:`patch`,patch:{permBusy:!1}})}},U=async e=>{T({type:`patch`,patch:{permFeedback:null}}),T({type:`patch`,patch:{loadError:null}});try{(await R.openPrivacy(e)).ok?T({type:`patch`,patch:{permFeedback:t.openSettingsDone}}):T({type:`patch`,patch:{permFeedback:t.openSettingsFailed}})}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}},W=async()=>{T({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),T({type:`patch`,patch:{loadError:null}});try{let e=await R.requestMicrophone(),n=await b();T({type:`patch`,patch:{perms:await R.getPermissions()}}),T({type:`patch`,patch:{permFeedback:x(e,n,t.permFeedback)}})}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{T({type:`patch`,patch:{permBusy:!1}})}},G=async()=>{if(R.requestAccessibility){T({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),T({type:`patch`,patch:{loadError:null}});try{let e=await R.requestAccessibility();T({type:`patch`,patch:{perms:await R.getPermissions()}}),T({type:`patch`,patch:{permFeedback:S(e,t.accessibilityFeedback)}})}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{T({type:`patch`,patch:{permBusy:!1}})}}},K=async()=>{if(R.requestNotifications){T({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),T({type:`patch`,patch:{loadError:null}});try{let e=await R.requestNotifications();T({type:`patch`,patch:{perms:await R.getPermissions()}}),T({type:`patch`,patch:{permFeedback:C(e,t.notificationsFeedback)}})}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{T({type:`patch`,patch:{permBusy:!1}})}}},q=async()=>{if(R.requestScreen){T({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),T({type:`patch`,patch:{loadError:null}});try{let e=await R.requestScreen();T({type:`patch`,patch:{perms:await R.getPermissions()}}),T({type:`patch`,patch:{permFeedback:w(e,t.screenFeedback)}})}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{T({type:`patch`,patch:{permBusy:!1}})}}},J=O?O.platform===`win32`?t.permissionsHintWin:O.platform===`linux`?t.permissionsHintLinux:O.platform===`darwin`?t.permissionsHintDarwin:t.permissionsHint:t.permissionsHint;return(0,y.jsxs)(h,{gap:`gap-6`,children:[(0,y.jsx)(m,{title:t.title}),P?(0,y.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:P}):null,F?(0,y.jsx)(`p`,{className:r(`text-sm`,F===t.refreshDone||F===t.openSettingsDone||F===t.permFeedback.granted||F===t.permFeedback.alreadyGranted||F===t.accessibilityFeedback.granted||F===t.accessibilityFeedback.alreadyGranted||F===t.notificationsFeedback.granted||F===t.notificationsFeedback.alreadyGranted||F===t.screenFeedback.granted||F===t.screenFeedback.alreadyGranted||F===t.desktopNotify.testShown?`text-emerald-600 dark:text-emerald-400`:`text-fg-muted`),role:`status`,"aria-live":`polite`,children:F}):null,(0,y.jsxs)(_,{children:[(0,y.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,y.jsx)(o,{className:`size-4 text-accent`,strokeWidth:1.75}),t.behaviorGroup]}),(0,y.jsxs)(`div`,{className:`space-y-2`,children:[(0,y.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,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.openAtLogin}),(0,y.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.openAtLoginDesc})]}),(0,y.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!O,checked:!!O?.openAtLogin,onChange:e=>{V({openAtLogin:e.target.checked})}})]}),(0,y.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,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.keepAwake}),(0,y.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.keepAwakeDesc})]}),(0,y.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!O,checked:!!O?.keepAwakePreferred,onChange:e=>{V({keepAwakePreferred:e.target.checked})}})]}),(0,y.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,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.notifyDesktop}),(0,y.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.notifyDesktopDesc})]}),(0,y.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!O||I,checked:!!O?.notifyEnabled,onChange:e=>{H(e.target.checked)}})]}),(0,y.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,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.notifySound}),(0,y.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.notifySoundDesc})]}),(0,y.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!O,checked:!!O?.notifySoundEnabled,onChange:e=>{V({notifySoundEnabled:e.target.checked})}})]})]})]}),O&&N?(0,y.jsxs)(`section`,{className:g(),children:[(0,y.jsxs)(`div`,{className:`mb-4 flex flex-col gap-1 sm:flex-row sm:items-center sm:justify-between`,children:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.permissionsTitle}),(0,y.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:J}),O.platform===`darwin`&&!O.packaged?(0,y.jsx)(`p`,{className:`mt-1 text-xs text-amber-600 dark:text-amber-400`,children:t.permissionsHintDevDarwin}):null]}),(0,y.jsxs)(`button`,{type:`button`,disabled:L||I,"aria-busy":L,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`,s.press),onClick:()=>void B(),children:[(0,y.jsx)(u,{className:r(`size-3.5`,L&&`animate-spin`),strokeWidth:1.75,"aria-hidden":!0}),L?t.refreshing:t.refresh]})]}),(0,y.jsx)(`ul`,{className:`space-y-3`,children:k(O.platform).map(({key:n,pane:i})=>{let a=A(e,N[n]),o=t.perm[n],c=N[n]===`unknown`?j(e,n,O.platform):null;return o?(0,y.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,y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,y.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:o.title}),(0,y.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:o.desc}),(0,y.jsx)(`p`,{className:`mt-1 text-xs font-medium ${a.className}`,children:a.label}),c?(0,y.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:c}):null]}),(0,y.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[n===`notifications`&&E(n,N[n],O.platform)?(0,y.jsx)(`button`,{type:`button`,disabled:I,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`,s.press),onClick:()=>void K(),children:t.requestAccess}):null,n===`microphone`&&E(n,N[n],O.platform)?(0,y.jsx)(`button`,{type:`button`,disabled:I,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`,s.press),onClick:()=>void W(),children:t.requestAccess}):null,n===`accessibility`&&E(n,N[n],O.platform)?(0,y.jsx)(`button`,{type:`button`,disabled:I,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`,s.press),onClick:()=>void G(),children:t.requestAccess}):null,n===`screen`&&E(n,N[n],O.platform)?(0,y.jsx)(`button`,{type:`button`,disabled:I,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`,s.press),onClick:()=>void q(),children:t.requestAccess}):null,D(n,N[n],O.platform)?(0,y.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`,s.press),onClick:()=>void U(i),children:[t.openSettings,(0,y.jsx)(p,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0})]}):null]})]},n):null})})]}):null]})}export{N 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-B4XqB8I6.js";import{n as a}from"./locale-store-deR2zRaE.js";import{Ws as o,as as s,ko as c,kt as l,nc as u,ni as d,ti as f,xl as p}from"./index-B-_CEvIX.js";import{n as m,r as h}from"./settings-page-layout-t_Ox1slk.js";import{r as g,t as _}from"./settings-form-section-CiYU8AvV.js";var v=e(t(),1),y=n();async function b(){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 x(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 S(e,t){return e.task===`opened-settings`?t.openedSettings:e.status===`granted`?e.task===`already-granted`?t.alreadyGranted:t.granted:t.denied}function C(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 w(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 T=new Set([`microphone`,`accessibility`,`notifications`,`screen`]);function E(e,t,n){return t===`granted`?!1:e===`accessibility`&&(n===`darwin`||n===`win32`||n===`linux`)||e===`screen`&&(n===`darwin`||n===`win32`)||T.has(e)?t===`unknown`:!1}function D(e,t,n){return e===`accessibility`?!1:e===`screen`&&n===`linux`?!0:T.has(e)?t===`denied`:!0}var O=[{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 k(e){return e===`linux`?O:O.filter(t=>!t.platforms||t.platforms.includes(e))}function A(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 j(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 M={behavior:null,perms:null,loadError:null,permFeedback:null,permBusy:!1,refreshing:!1};function N(){let e=a(e=>e.language),t=i(e).systemSettings,[n,T]=(0,v.useReducer)(l,M),{behavior:O,perms:N,loadError:P,permFeedback:F,permBusy:I,refreshing:L}=n,R=typeof window<`u`?window.electronAPI?.system:void 0,z=(0,v.useCallback)(async e=>{if(R){T({type:`patch`,patch:{loadError:null}});try{T({type:`patch`,patch:{behavior:await R.getBehavior(),perms:await R.getPermissions({probe:e?.showRefreshFeedback}),...e?.showRefreshFeedback?{permFeedback:t.refreshDone}:{}}})}catch(t){T({type:`patch`,patch:{loadError:t instanceof Error?t.message:String(t),...e?.showRefreshFeedback?{permFeedback:null}:{}}})}}},[R,t.refreshDone]),B=(0,v.useCallback)(async()=>{if(!(L||I)){T({type:`patch`,patch:{refreshing:!0}});try{await z({showRefreshFeedback:!0})}finally{T({type:`patch`,patch:{refreshing:!1}})}}},[z,I,L]);if((0,v.useEffect)(()=>{let e=new Set([t.refreshDone,t.openSettingsDone,t.openSettingsFailed,t.desktopNotify.testShown]);if(!F||!e.has(F))return;let n=window.setTimeout(()=>{T({type:`patch`,patch:{permFeedback:null}})},3e3);return()=>window.clearTimeout(n)},[F,t.openSettingsDone,t.openSettingsFailed,t.refreshDone,t.desktopNotify.testShown]),(0,v.useEffect)(()=>{c()&&R&&z()},[R,z]),!c()||!R)return(0,y.jsxs)(h,{gap:`gap-3`,children:[(0,y.jsx)(m,{title:t.title}),(0,y.jsxs)(`div`,{className:g(),children:[(0,y.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.desktopOnlyTitle}),(0,y.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.desktopOnlyBody})]})]});let V=async e=>{try{let{behavior:t}=await R.setBehavior(e);T({type:`patch`,patch:{behavior:t}}),(e.notifyEnabled!==void 0||e.notifySoundEnabled!==void 0)&&f()}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}},H=async e=>{if(!e){await V({notifyEnabled:!1});return}T({type:`patch`,patch:{permBusy:!0,permFeedback:null}});try{let e=await d(t.desktopNotify.testTitle,t.desktopNotify.testBody);if(e===`unsupported`){T({type:`patch`,patch:{permFeedback:t.notificationsFeedback.unsupported}});return}if(e===`denied`){T({type:`patch`,patch:{permFeedback:t.desktopNotify.denied}});return}if(e==="default"){T({type:`patch`,patch:{permFeedback:t.notificationsFeedback.default}});return}await V({notifyEnabled:!0}),T({type:`patch`,patch:{perms:await R.getPermissions()}}),T({type:`patch`,patch:{permFeedback:t.desktopNotify.testShown}})}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{T({type:`patch`,patch:{permBusy:!1}})}},U=async e=>{T({type:`patch`,patch:{permFeedback:null}}),T({type:`patch`,patch:{loadError:null}});try{(await R.openPrivacy(e)).ok?T({type:`patch`,patch:{permFeedback:t.openSettingsDone}}):T({type:`patch`,patch:{permFeedback:t.openSettingsFailed}})}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}},W=async()=>{T({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),T({type:`patch`,patch:{loadError:null}});try{let e=await R.requestMicrophone(),n=await b();T({type:`patch`,patch:{perms:await R.getPermissions()}}),T({type:`patch`,patch:{permFeedback:x(e,n,t.permFeedback)}})}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{T({type:`patch`,patch:{permBusy:!1}})}},G=async()=>{if(R.requestAccessibility){T({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),T({type:`patch`,patch:{loadError:null}});try{let e=await R.requestAccessibility();T({type:`patch`,patch:{perms:await R.getPermissions()}}),T({type:`patch`,patch:{permFeedback:S(e,t.accessibilityFeedback)}})}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{T({type:`patch`,patch:{permBusy:!1}})}}},K=async()=>{if(R.requestNotifications){T({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),T({type:`patch`,patch:{loadError:null}});try{let e=await R.requestNotifications();T({type:`patch`,patch:{perms:await R.getPermissions()}}),T({type:`patch`,patch:{permFeedback:C(e,t.notificationsFeedback)}})}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{T({type:`patch`,patch:{permBusy:!1}})}}},q=async()=>{if(R.requestScreen){T({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),T({type:`patch`,patch:{loadError:null}});try{let e=await R.requestScreen();T({type:`patch`,patch:{perms:await R.getPermissions()}}),T({type:`patch`,patch:{permFeedback:w(e,t.screenFeedback)}})}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{T({type:`patch`,patch:{permBusy:!1}})}}},J=O?O.platform===`win32`?t.permissionsHintWin:O.platform===`linux`?t.permissionsHintLinux:O.platform===`darwin`?t.permissionsHintDarwin:t.permissionsHint:t.permissionsHint;return(0,y.jsxs)(h,{gap:`gap-6`,children:[(0,y.jsx)(m,{title:t.title}),P?(0,y.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:P}):null,F?(0,y.jsx)(`p`,{className:r(`text-sm`,F===t.refreshDone||F===t.openSettingsDone||F===t.permFeedback.granted||F===t.permFeedback.alreadyGranted||F===t.accessibilityFeedback.granted||F===t.accessibilityFeedback.alreadyGranted||F===t.notificationsFeedback.granted||F===t.notificationsFeedback.alreadyGranted||F===t.screenFeedback.granted||F===t.screenFeedback.alreadyGranted||F===t.desktopNotify.testShown?`text-emerald-600 dark:text-emerald-400`:`text-fg-muted`),role:`status`,"aria-live":`polite`,children:F}):null,(0,y.jsxs)(_,{children:[(0,y.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,y.jsx)(o,{className:`size-4 text-accent`,strokeWidth:1.75}),t.behaviorGroup]}),(0,y.jsxs)(`div`,{className:`space-y-2`,children:[(0,y.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,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.openAtLogin}),(0,y.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.openAtLoginDesc})]}),(0,y.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!O,checked:!!O?.openAtLogin,onChange:e=>{V({openAtLogin:e.target.checked})}})]}),(0,y.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,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.keepAwake}),(0,y.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.keepAwakeDesc})]}),(0,y.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!O,checked:!!O?.keepAwakePreferred,onChange:e=>{V({keepAwakePreferred:e.target.checked})}})]}),(0,y.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,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.notifyDesktop}),(0,y.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.notifyDesktopDesc})]}),(0,y.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!O||I,checked:!!O?.notifyEnabled,onChange:e=>{H(e.target.checked)}})]}),(0,y.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,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.notifySound}),(0,y.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.notifySoundDesc})]}),(0,y.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!O,checked:!!O?.notifySoundEnabled,onChange:e=>{V({notifySoundEnabled:e.target.checked})}})]})]})]}),O&&N?(0,y.jsxs)(`section`,{className:g(),children:[(0,y.jsxs)(`div`,{className:`mb-4 flex flex-col gap-1 sm:flex-row sm:items-center sm:justify-between`,children:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.permissionsTitle}),(0,y.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:J}),O.platform===`darwin`&&!O.packaged?(0,y.jsx)(`p`,{className:`mt-1 text-xs text-amber-600 dark:text-amber-400`,children:t.permissionsHintDevDarwin}):null]}),(0,y.jsxs)(`button`,{type:`button`,disabled:L||I,"aria-busy":L,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`,s.press),onClick:()=>void B(),children:[(0,y.jsx)(u,{className:r(`size-3.5`,L&&`animate-spin`),strokeWidth:1.75,"aria-hidden":!0}),L?t.refreshing:t.refresh]})]}),(0,y.jsx)(`ul`,{className:`space-y-3`,children:k(O.platform).map(({key:n,pane:i})=>{let a=A(e,N[n]),o=t.perm[n],c=N[n]===`unknown`?j(e,n,O.platform):null;return o?(0,y.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,y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,y.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:o.title}),(0,y.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:o.desc}),(0,y.jsx)(`p`,{className:`mt-1 text-xs font-medium ${a.className}`,children:a.label}),c?(0,y.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:c}):null]}),(0,y.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[n===`notifications`&&E(n,N[n],O.platform)?(0,y.jsx)(`button`,{type:`button`,disabled:I,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`,s.press),onClick:()=>void K(),children:t.requestAccess}):null,n===`microphone`&&E(n,N[n],O.platform)?(0,y.jsx)(`button`,{type:`button`,disabled:I,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`,s.press),onClick:()=>void W(),children:t.requestAccess}):null,n===`accessibility`&&E(n,N[n],O.platform)?(0,y.jsx)(`button`,{type:`button`,disabled:I,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`,s.press),onClick:()=>void G(),children:t.requestAccess}):null,n===`screen`&&E(n,N[n],O.platform)?(0,y.jsx)(`button`,{type:`button`,disabled:I,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`,s.press),onClick:()=>void q(),children:t.requestAccess}):null,D(n,N[n],O.platform)?(0,y.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`,s.press),onClick:()=>void U(i),children:[t.openSettings,(0,y.jsx)(p,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0})]}):null]})]},n):null})})]}):null]})}export{N 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-deR2zRaE.js";import{Ba as l,Ct as u,Kl as d,Mi as f,Xa as p,_c as m,dc as h,ds as g,fu as _,ht as v,ji as y,ms as b,pt as x,rt as S,xl as C,yt as w}from"./index-CYT5DOzr.js";var T=n(),E=e(t(),1),D=r();function O(e,t){return(t===`zh`?{backlog:`收集箱`,ready:`就绪`,active:`进行中`,review:`待验收`,closed:`已关闭`}:{backlog:`Backlog`,ready:`Ready`,active:`Active`,review:`Review`,closed:`Closed`})[e]}function k(){let e=(0,T.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,D.jsxs)(`div`,{className:`space-y-4`,"aria-busy":!0,children:[(0,D.jsx)(l,{className:`h-32 rounded-2xl`}),(0,D.jsx)(l,{className:`h-52 rounded-2xl`}),(0,D.jsx)(l,{className:`h-40 rounded-2xl`})]}),e[0]=t):t=e[0],t}function A(e){let t=(0,T.c)(6),{items:n,empty:r}=e;if(n.length===0){let e;return t[0]===r?e=t[1]:(e=(0,D.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:r}),t[0]=r,t[1]=e),e}let i;t[2]===n?i=t[3]:(i=n.map(j),t[2]=n,t[3]=i);let a;return t[4]===i?a=t[5]:(a=(0,D.jsx)(`ul`,{className:`space-y-2`,children:i}),t[4]=i,t[5]=a),a}function j(e){return(0,D.jsxs)(`li`,{className:`flex gap-2 text-sm leading-6 text-fg`,children:[(0,D.jsx)(d,{className:`mt-1 size-4 shrink-0 text-success`}),(0,D.jsx)(`span`,{children:e})]},e)}function M(){let{taskId:e=``}=i(),[t]=a(),n=c(e=>e.language),r=s(e=>e.token),l=(0,E.useMemo)(()=>x(n),[n]),d=p(e=>e.setPageHeader),T=p(e=>e.clearPageHeader),[j,M]=(0,E.useState)(null),[N,P]=(0,E.useState)(null),[F,I]=(0,E.useState)(!1),L=(0,E.useMemo)(()=>y(t.get(`returnTo`),`/`,[`/projects`,`/chat`,`/notes`,`/tasks`]),[t]);(0,E.useEffect)(()=>{let t=!0;return M(null),P(null),w(e).then(e=>{t&&M(e)}).catch(()=>{t&&P(l.taskNotFound)}),()=>{t=!1}},[l.taskNotFound,e,r]);let R=async t=>{if(j){I(!0),P(null);try{M(await v(e,t,j.task.version))}catch{P(l.actionFailed)}finally{I(!1)}}};if((0,E.useLayoutEffect)(()=>(d({startExtra:(0,D.jsx)(o,{to:L,className:`flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover`,"aria-label":l.backToWork,children:(0,D.jsx)(_,{className:`size-4`})}),main:j?(0,D.jsxs)(`div`,{className:`min-w-0`,children:[(0,D.jsx)(`h1`,{className:`truncate text-base font-semibold text-fg`,children:j.task.title}),(0,D.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[O(j.task.phase,n),` · `,j.operationalState]})]}):null,end:null}),T),[T,l.backToWork,j,n,L,d]),N&&!j)return(0,D.jsx)(`div`,{className:`mx-auto max-w-3xl p-6 text-sm text-danger`,children:N});if(!j)return(0,D.jsx)(`div`,{className:`mx-auto max-w-4xl p-4 sm:p-6`,children:(0,D.jsx)(k,{})});let z=j.waits[0],B=j.receipts[0],V=j.allowedCommands.includes(`start`),H=j.allowedCommands.includes(`add_wait`);return(0,D.jsxs)(`main`,{className:`mx-auto max-w-4xl space-y-4 p-4 pb-16 sm:p-6`,children:[(0,D.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-panel p-5`,children:[(0,D.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:[(0,D.jsxs)(`div`,{className:`min-w-0`,children:[(0,D.jsxs)(`p`,{className:`text-xs font-medium text-accent`,children:[O(j.task.phase,n),` · `,j.operationalState]}),(0,D.jsx)(`h2`,{className:`mt-2 text-xl font-semibold text-fg`,children:j.task.title}),j.task.body?(0,D.jsx)(`p`,{className:`mt-2 whitespace-pre-wrap text-sm leading-6 text-fg-muted`,children:j.task.body}):null]}),j.task.phase===`closed`?null:(0,D.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[z?(0,D.jsxs)(g,{disabled:F,onClick:()=>void R({type:`resolve_wait`,waitId:z.id}),children:[(0,D.jsx)(h,{className:`size-4`}),l.resumeTask]}):null,!z&&V?(0,D.jsxs)(g,{disabled:F,onClick:()=>void R({type:`start`,executor:{kind:`agent`,agentId:j.task.delegateAgentId??`main`}}),children:[(0,D.jsx)(h,{className:`size-4`}),l.runTask]}):null,!z&&H?(0,D.jsxs)(g,{variant:`secondary`,disabled:F,onClick:()=>void R({type:`add_wait`,wait:{kind:`paused`,reason:`Paused by user`,condition:{}}}),children:[(0,D.jsx)(m,{className:`size-4`}),l.pauseTask]}):null,(0,D.jsxs)(g,{variant:`ghost`,disabled:F,onClick:()=>void R({type:`close`,resolution:`cancelled`}),children:[(0,D.jsx)(b,{className:`size-4`}),l.cancelTask]})]})]}),j.task.dueAt?(0,D.jsx)(`p`,{className:`mt-4 text-xs text-fg-muted`,children:S(j.task.dueAt)}):null,N?(0,D.jsx)(`p`,{className:`mt-3 text-sm text-danger`,children:N}):null]}),j.attention.length>0?(0,D.jsxs)(`section`,{className:`rounded-2xl border border-warning/40 bg-warning/5 p-5`,children:[(0,D.jsx)(`h3`,{className:`font-medium text-fg`,children:l.needsAttention}),(0,D.jsx)(`ul`,{className:`mt-3 space-y-2 text-sm text-fg-muted`,children:j.attention.map((e,t)=>(0,D.jsx)(`li`,{children:e.summary},`${e.kind}-${t}`))})]}):null,(0,D.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,D.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-panel p-5`,children:[(0,D.jsx)(`h3`,{className:`font-medium text-fg`,children:l.successDefinition}),(0,D.jsx)(`div`,{className:`mt-4`,children:(0,D.jsx)(A,{items:j.task.contract?.acceptanceCriteria??[],empty:l.noDefinition})})]}),(0,D.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-panel p-5`,children:[(0,D.jsx)(`h3`,{className:`font-medium text-fg`,children:l.expectedOutputs}),(0,D.jsx)(`div`,{className:`mt-4`,children:(0,D.jsx)(A,{items:j.task.contract?.expectedOutputs??[],empty:l.noDefinition})})]})]}),j.dependencies.length>0||j.dependents.length>0?(0,D.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-panel p-5`,children:[(0,D.jsx)(`h3`,{className:`font-medium text-fg`,children:l.taskRelations}),(0,D.jsxs)(`div`,{className:`mt-4 grid gap-4 sm:grid-cols-2`,children:[(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:l.dependencies}),j.dependencies.map(e=>(0,D.jsxs)(o,{to:f(`/tasks/${e.id}`,L),className:`block text-sm text-accent hover:underline`,children:[e.title,` · `,O(e.phase,n)]},e.id))]}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:l.dependents}),j.dependents.map(e=>(0,D.jsxs)(o,{to:f(`/tasks/${e.id}`,L),className:`block text-sm text-accent hover:underline`,children:[e.title,` · `,O(e.phase,n)]},e.id))]})]})]}):null,(0,D.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-panel p-5`,children:[(0,D.jsx)(`h3`,{className:`font-medium text-fg`,children:l.executionReceipts}),j.receipts.length===0?(0,D.jsx)(`p`,{className:`mt-4 text-sm text-fg-muted`,children:l.noReceipts}):(0,D.jsx)(`div`,{className:`mt-4 space-y-4`,children:j.receipts.map(e=>(0,D.jsxs)(`article`,{className:`border-t border-edge pt-4 first:border-0 first:pt-0`,children:[(0,D.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,D.jsx)(`p`,{className:`font-medium text-fg`,children:e.summary}),(0,D.jsxs)(`span`,{className:`text-xs text-fg-muted`,children:[e.status,` · `,e.verification.status]})]}),e.nextAction?(0,D.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:e.nextAction}):null,(0,D.jsxs)(`div`,{className:`mt-3 flex gap-2`,children:[(0,D.jsx)(g,{className:`px-2 py-1 text-xs`,variant:`secondary`,onClick:()=>void u(e.runId,`helpful`),children:l.doneWell}),(0,D.jsx)(g,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>void u(e.runId,`not_helpful`),children:l.needsFix}),e.evidence[0]?.uri?(0,D.jsxs)(`a`,{className:`ml-auto inline-flex items-center gap-1 text-xs text-accent`,href:e.evidence[0].uri,children:[(0,D.jsx)(C,{className:`size-3`}),l.evidenceDetails]}):null]})]},e.runId))})]}),B?.needsUser?(0,D.jsx)(`p`,{className:`text-sm text-warning`,children:B.nextAction??l.noDecisionNeeded}):null]})}export{M 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-deR2zRaE.js";import{Ba as l,Ct as u,Kl as d,Mi as f,Xa as p,_c as m,dc as h,ds as g,fu as _,ht as v,ji as y,ms as b,pt as x,rt as S,xl as C,yt as w}from"./index-B-_CEvIX.js";var T=n(),E=e(t(),1),D=r();function O(e,t){return(t===`zh`?{backlog:`收集箱`,ready:`就绪`,active:`进行中`,review:`待验收`,closed:`已关闭`}:{backlog:`Backlog`,ready:`Ready`,active:`Active`,review:`Review`,closed:`Closed`})[e]}function k(){let e=(0,T.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,D.jsxs)(`div`,{className:`space-y-4`,"aria-busy":!0,children:[(0,D.jsx)(l,{className:`h-32 rounded-2xl`}),(0,D.jsx)(l,{className:`h-52 rounded-2xl`}),(0,D.jsx)(l,{className:`h-40 rounded-2xl`})]}),e[0]=t):t=e[0],t}function A(e){let t=(0,T.c)(6),{items:n,empty:r}=e;if(n.length===0){let e;return t[0]===r?e=t[1]:(e=(0,D.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:r}),t[0]=r,t[1]=e),e}let i;t[2]===n?i=t[3]:(i=n.map(j),t[2]=n,t[3]=i);let a;return t[4]===i?a=t[5]:(a=(0,D.jsx)(`ul`,{className:`space-y-2`,children:i}),t[4]=i,t[5]=a),a}function j(e){return(0,D.jsxs)(`li`,{className:`flex gap-2 text-sm leading-6 text-fg`,children:[(0,D.jsx)(d,{className:`mt-1 size-4 shrink-0 text-success`}),(0,D.jsx)(`span`,{children:e})]},e)}function M(){let{taskId:e=``}=i(),[t]=a(),n=c(e=>e.language),r=s(e=>e.token),l=(0,E.useMemo)(()=>x(n),[n]),d=p(e=>e.setPageHeader),T=p(e=>e.clearPageHeader),[j,M]=(0,E.useState)(null),[N,P]=(0,E.useState)(null),[F,I]=(0,E.useState)(!1),L=(0,E.useMemo)(()=>y(t.get(`returnTo`),`/`,[`/projects`,`/chat`,`/notes`,`/tasks`]),[t]);(0,E.useEffect)(()=>{let t=!0;return M(null),P(null),w(e).then(e=>{t&&M(e)}).catch(()=>{t&&P(l.taskNotFound)}),()=>{t=!1}},[l.taskNotFound,e,r]);let R=async t=>{if(j){I(!0),P(null);try{M(await v(e,t,j.task.version))}catch{P(l.actionFailed)}finally{I(!1)}}};if((0,E.useLayoutEffect)(()=>(d({startExtra:(0,D.jsx)(o,{to:L,className:`flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover`,"aria-label":l.backToWork,children:(0,D.jsx)(_,{className:`size-4`})}),main:j?(0,D.jsxs)(`div`,{className:`min-w-0`,children:[(0,D.jsx)(`h1`,{className:`truncate text-base font-semibold text-fg`,children:j.task.title}),(0,D.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[O(j.task.phase,n),` · `,j.operationalState]})]}):null,end:null}),T),[T,l.backToWork,j,n,L,d]),N&&!j)return(0,D.jsx)(`div`,{className:`mx-auto max-w-3xl p-6 text-sm text-danger`,children:N});if(!j)return(0,D.jsx)(`div`,{className:`mx-auto max-w-4xl p-4 sm:p-6`,children:(0,D.jsx)(k,{})});let z=j.waits[0],B=j.receipts[0],V=j.allowedCommands.includes(`start`),H=j.allowedCommands.includes(`add_wait`);return(0,D.jsxs)(`main`,{className:`mx-auto max-w-4xl space-y-4 p-4 pb-16 sm:p-6`,children:[(0,D.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-panel p-5`,children:[(0,D.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:[(0,D.jsxs)(`div`,{className:`min-w-0`,children:[(0,D.jsxs)(`p`,{className:`text-xs font-medium text-accent`,children:[O(j.task.phase,n),` · `,j.operationalState]}),(0,D.jsx)(`h2`,{className:`mt-2 text-xl font-semibold text-fg`,children:j.task.title}),j.task.body?(0,D.jsx)(`p`,{className:`mt-2 whitespace-pre-wrap text-sm leading-6 text-fg-muted`,children:j.task.body}):null]}),j.task.phase===`closed`?null:(0,D.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[z?(0,D.jsxs)(g,{disabled:F,onClick:()=>void R({type:`resolve_wait`,waitId:z.id}),children:[(0,D.jsx)(h,{className:`size-4`}),l.resumeTask]}):null,!z&&V?(0,D.jsxs)(g,{disabled:F,onClick:()=>void R({type:`start`,executor:{kind:`agent`,agentId:j.task.delegateAgentId??`main`}}),children:[(0,D.jsx)(h,{className:`size-4`}),l.runTask]}):null,!z&&H?(0,D.jsxs)(g,{variant:`secondary`,disabled:F,onClick:()=>void R({type:`add_wait`,wait:{kind:`paused`,reason:`Paused by user`,condition:{}}}),children:[(0,D.jsx)(m,{className:`size-4`}),l.pauseTask]}):null,(0,D.jsxs)(g,{variant:`ghost`,disabled:F,onClick:()=>void R({type:`close`,resolution:`cancelled`}),children:[(0,D.jsx)(b,{className:`size-4`}),l.cancelTask]})]})]}),j.task.dueAt?(0,D.jsx)(`p`,{className:`mt-4 text-xs text-fg-muted`,children:S(j.task.dueAt)}):null,N?(0,D.jsx)(`p`,{className:`mt-3 text-sm text-danger`,children:N}):null]}),j.attention.length>0?(0,D.jsxs)(`section`,{className:`rounded-2xl border border-warning/40 bg-warning/5 p-5`,children:[(0,D.jsx)(`h3`,{className:`font-medium text-fg`,children:l.needsAttention}),(0,D.jsx)(`ul`,{className:`mt-3 space-y-2 text-sm text-fg-muted`,children:j.attention.map((e,t)=>(0,D.jsx)(`li`,{children:e.summary},`${e.kind}-${t}`))})]}):null,(0,D.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,D.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-panel p-5`,children:[(0,D.jsx)(`h3`,{className:`font-medium text-fg`,children:l.successDefinition}),(0,D.jsx)(`div`,{className:`mt-4`,children:(0,D.jsx)(A,{items:j.task.contract?.acceptanceCriteria??[],empty:l.noDefinition})})]}),(0,D.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-panel p-5`,children:[(0,D.jsx)(`h3`,{className:`font-medium text-fg`,children:l.expectedOutputs}),(0,D.jsx)(`div`,{className:`mt-4`,children:(0,D.jsx)(A,{items:j.task.contract?.expectedOutputs??[],empty:l.noDefinition})})]})]}),j.dependencies.length>0||j.dependents.length>0?(0,D.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-panel p-5`,children:[(0,D.jsx)(`h3`,{className:`font-medium text-fg`,children:l.taskRelations}),(0,D.jsxs)(`div`,{className:`mt-4 grid gap-4 sm:grid-cols-2`,children:[(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:l.dependencies}),j.dependencies.map(e=>(0,D.jsxs)(o,{to:f(`/tasks/${e.id}`,L),className:`block text-sm text-accent hover:underline`,children:[e.title,` · `,O(e.phase,n)]},e.id))]}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:l.dependents}),j.dependents.map(e=>(0,D.jsxs)(o,{to:f(`/tasks/${e.id}`,L),className:`block text-sm text-accent hover:underline`,children:[e.title,` · `,O(e.phase,n)]},e.id))]})]})]}):null,(0,D.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-panel p-5`,children:[(0,D.jsx)(`h3`,{className:`font-medium text-fg`,children:l.executionReceipts}),j.receipts.length===0?(0,D.jsx)(`p`,{className:`mt-4 text-sm text-fg-muted`,children:l.noReceipts}):(0,D.jsx)(`div`,{className:`mt-4 space-y-4`,children:j.receipts.map(e=>(0,D.jsxs)(`article`,{className:`border-t border-edge pt-4 first:border-0 first:pt-0`,children:[(0,D.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,D.jsx)(`p`,{className:`font-medium text-fg`,children:e.summary}),(0,D.jsxs)(`span`,{className:`text-xs text-fg-muted`,children:[e.status,` · `,e.verification.status]})]}),e.nextAction?(0,D.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:e.nextAction}):null,(0,D.jsxs)(`div`,{className:`mt-3 flex gap-2`,children:[(0,D.jsx)(g,{className:`px-2 py-1 text-xs`,variant:`secondary`,onClick:()=>void u(e.runId,`helpful`),children:l.doneWell}),(0,D.jsx)(g,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>void u(e.runId,`not_helpful`),children:l.needsFix}),e.evidence[0]?.uri?(0,D.jsxs)(`a`,{className:`ml-auto inline-flex items-center gap-1 text-xs text-accent`,href:e.evidence[0].uri,children:[(0,D.jsx)(C,{className:`size-3`}),l.evidenceDetails]}):null]})]},e.runId))})]}),B?.needsUser?(0,D.jsx)(`p`,{className:`text-sm text-warning`,children:B.nextAction??l.noDecisionNeeded}):null]})}export{M as TaskDetailPage};
@@ -1 +1 @@
1
- import{t as e}from"./cn-JdwAhgNB.js";import{cs as t,ls as n,us as r}from"./index-CYT5DOzr.js";function i(){return e(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,r,`dark:border-edge`)}function a(){return e(n,t)}var o=`h-auto shrink-0 px-2.5 py-1.5 text-xs font-medium`,s=/^[a-z][a-z0-9_-]{0,63}$/;function c(e){let t=e.trim(),n=t.indexOf(`/`);return n>0&&n<t.length-1}function l(e){let t=e&&typeof e==`object`&&!Array.isArray(e)&&`roles`in e?Object.entries(e.roles??{}).map(([e,t])=>({id:e,...t&&typeof t==`object`&&!Array.isArray(t)?t:{}})):e;if(!Array.isArray(t))return[];let n=[];for(let e of t){if(!e||typeof e!=`object`||Array.isArray(e))continue;let t=e,r=typeof t.id==`string`?t.id.trim():``,i=typeof t.model==`string`?t.model.trim():``;if(!r||!i)continue;let a=typeof t.description==`string`?t.description.trim():``,o=Array.isArray(t.fallbacks)?t.fallbacks.filter(e=>typeof e==`string`).map(e=>e.trim()).filter(Boolean):[];n.push({id:r,model:i,fallbacks:o,description:a})}return n}function u(e,t){let n=new Set([t.toLowerCase()]),r=[];for(let t of e){let e=t.trim(),i=e.toLowerCase();!e||!c(e)||n.has(i)||(n.add(i),r.push(e))}return r}function d(e){let t=new Map;for(let n of e){let e=n.id.trim(),r=n.model.trim();if(!e||!s.test(e)||!r||!c(r))continue;let i=n.description.trim(),a=u(n.fallbacks??[],r);t.set(e,{model:r,...a.length>0?{fallbacks:a}:{},...i?{description:i}:{}})}return t.size===0?null:{roles:Object.fromEntries(t.entries())}}function f(e,t){let n=new Set;for(let r of e){let e=r.id.trim(),i=r.model.trim(),a=r.fallbacks??[];if(!(!e&&!i&&!r.description.trim()&&a.every(e=>!e.trim()))){if(!e||!s.test(e))return t.invalidId;if(n.has(e))return t.duplicateId;if(n.add(e),!i||!c(i)||a.some(e=>e.trim()&&!c(e)))return t.invalidModel}}return null}function p(e){return e.length===0?`—`:e.map(e=>`${e.id} -> ${e.model}${e.fallbacks?.length?` (+${e.fallbacks.length})`:``}`).join(`, `)}function m(e){return(e??[]).map(e=>({id:e.id,model:e.model,fallbacks:e.fallbacks??[],description:e.description?.trim()??``}))}export{f as a,a as c,m as i,p as n,o,l as r,i as s,d as t};
1
+ import{t as e}from"./cn-JdwAhgNB.js";import{cs as t,ls as n,us as r}from"./index-B-_CEvIX.js";function i(){return e(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,r,`dark:border-edge`)}function a(){return e(n,t)}var o=`h-auto shrink-0 px-2.5 py-1.5 text-xs font-medium`,s=/^[a-z][a-z0-9_-]{0,63}$/;function c(e){let t=e.trim(),n=t.indexOf(`/`);return n>0&&n<t.length-1}function l(e){let t=e&&typeof e==`object`&&!Array.isArray(e)&&`roles`in e?Object.entries(e.roles??{}).map(([e,t])=>({id:e,...t&&typeof t==`object`&&!Array.isArray(t)?t:{}})):e;if(!Array.isArray(t))return[];let n=[];for(let e of t){if(!e||typeof e!=`object`||Array.isArray(e))continue;let t=e,r=typeof t.id==`string`?t.id.trim():``,i=typeof t.model==`string`?t.model.trim():``;if(!r||!i)continue;let a=typeof t.description==`string`?t.description.trim():``,o=Array.isArray(t.fallbacks)?t.fallbacks.filter(e=>typeof e==`string`).map(e=>e.trim()).filter(Boolean):[];n.push({id:r,model:i,fallbacks:o,description:a})}return n}function u(e,t){let n=new Set([t.toLowerCase()]),r=[];for(let t of e){let e=t.trim(),i=e.toLowerCase();!e||!c(e)||n.has(i)||(n.add(i),r.push(e))}return r}function d(e){let t=new Map;for(let n of e){let e=n.id.trim(),r=n.model.trim();if(!e||!s.test(e)||!r||!c(r))continue;let i=n.description.trim(),a=u(n.fallbacks??[],r);t.set(e,{model:r,...a.length>0?{fallbacks:a}:{},...i?{description:i}:{}})}return t.size===0?null:{roles:Object.fromEntries(t.entries())}}function f(e,t){let n=new Set;for(let r of e){let e=r.id.trim(),i=r.model.trim(),a=r.fallbacks??[];if(!(!e&&!i&&!r.description.trim()&&a.every(e=>!e.trim()))){if(!e||!s.test(e))return t.invalidId;if(n.has(e))return t.duplicateId;if(n.add(e),!i||!c(i)||a.some(e=>e.trim()&&!c(e)))return t.invalidModel}}return null}function p(e){return e.length===0?`—`:e.map(e=>`${e.id} -> ${e.model}${e.fallbacks?.length?` (+${e.fallbacks.length})`:``}`).join(`, `)}function m(e){return(e??[]).map(e=>({id:e.id,model:e.model,fallbacks:e.fallbacks??[],description:e.description?.trim()??``}))}export{f as a,a as c,m as i,p as n,o,l as r,i as s,d as t};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./check-DUBLcKHA.js";import{t as a}from"./cn-JdwAhgNB.js";import{n as o}from"./locale-store-deR2zRaE.js";import{Jl as s,Nc as c}from"./index-CYT5DOzr.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-deR2zRaE.js";import{Jl as s,Nc as c}from"./index-B-_CEvIX.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-deR2zRaE.js";import{i as s}from"./vendor-swr-BIWyz7Rc.js";import{$l as c,$t as l,Ba as u,Bl as d,Bt as f,Cc as p,Gt as m,Ht as h,Jt as g,Ks as _,Kt as v,Os as y,Qt as b,Ro as x,Rt as S,Ut as C,Vt as w,Wt as T,Xa as E,Xt as D,Yt as O,Zt as k,ds as A,eu as j,hc as M,lc as N,ol as P,qt as F,xl as I,zo as L,zt as R}from"./index-CYT5DOzr.js";import{n as z,t as B}from"./use-autosave-BrjVk5VH.js";import{t as V}from"./page-tabs-C5ge434C.js";import{a as H}from"./connectors-api-DS9ED-EL.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.`,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:`还没有协作约定。`,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)(86),t=o(se),n=J[t],[r,a]=i(),l;if(e[0]!==r){let t=r.get(`tab`);l=t&&K.has(t)?t:`profile`,e[0]=r,e[1]=l}else l=e[1];let f=l,m=E(oe),h=E(ae),{data:g,error:v,isLoading:y,mutate:b}=s(`/api/you`,T),x;e[2]!==h||e[3]!==m||e[4]!==n.subtitle||e[5]!==n.title?(x=()=>(m({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}),h),e[2]=h,e[3]=m,e[4]=n.subtitle,e[5]=n.title,e[6]=x):x=e[6];let S;if(e[7]!==h||e[8]!==m||e[9]!==n?(S=[h,m,n],e[7]=h,e[8]=m,e[9]=n,e[10]=S):S=e[10],(0,W.useEffect)(x,S),y){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(v||!g){let t;e[12]===b?t=e[13]:(t=()=>void b(),e[12]=b,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 D;e[22]===n.profile?D=e[23]:(D={id:`profile`,label:n.profile,icon:d},e[22]=n.profile,e[23]=D);let O;e[24]!==g.understandings.length||e[25]!==n.understanding?(O={id:`understanding`,label:n.understanding,icon:j,count:g.understandings.length},e[24]=g.understandings.length,e[25]=n.understanding,e[26]=O):O=e[26];let k=n.collaboration,A;e[27]===g.rules?A=e[28]:(A=g.rules.filter(ie),e[27]=g.rules,e[28]=A);let M;e[29]!==n.collaboration||e[30]!==A.length?(M={id:`collaboration`,label:k,icon:P,count:A.length},e[29]=n.collaboration,e[30]=A.length,e[31]=M):M=e[31];let N;e[32]===n.sources?N=e[33]:(N={id:`sources`,label:n.sources,icon:c},e[32]=n.sources,e[33]=N);let F;e[34]===n.dreaming?F=e[35]:(F={id:`dreaming`,label:n.dreaming,icon:p},e[34]=n.dreaming,e[35]=F);let I;e[36]===n.privacy?I=e[37]:(I={id:`privacy`,label:n.privacy,icon:_},e[36]=n.privacy,e[37]=I);let L;e[38]!==N||e[39]!==F||e[40]!==I||e[41]!==D||e[42]!==O||e[43]!==M?(L=[D,O,M,N,F,I],e[38]=N,e[39]=F,e[40]=I,e[41]=D,e[42]=O,e[43]=M,e[44]=L):L=e[44];let R;e[45]!==n.title||e[46]!==L||e[47]!==w||e[48]!==f?(R=(0,G.jsx)(V,{ariaLabel:C,activeTab:f,onChange:w,items:L}),e[45]=n.title,e[46]=L,e[47]=w,e[48]=f,e[49]=R):R=e[49];let z;e[50]!==g.profile||e[51]!==t||e[52]!==b||e[53]!==n||e[54]!==f?(z=f===`profile`?(0,G.jsx)(ce,{profile:g.profile,language:t,t:n,onChanged:e=>b(t=>t&&{...t,profile:e},{revalidate:!1})}):null,e[50]=g.profile,e[51]=t,e[52]=b,e[53]=n,e[54]=f,e[55]=z):z=e[55];let B;e[56]!==g.understandings||e[57]!==t||e[58]!==b||e[59]!==n||e[60]!==f?(B=f===`understanding`?(0,G.jsx)(ue,{items:g.understandings,language:t,t:n,onChanged:e=>e?b(t=>t&&{...t,understandings:t.understandings.map(t=>t.id===e.id?e:t)},{revalidate:!1}):b()}):null,e[56]=g.understandings,e[57]=t,e[58]=b,e[59]=n,e[60]=f,e[61]=B):B=e[61];let H;e[62]!==g.rules||e[63]!==t||e[64]!==b||e[65]!==n||e[66]!==f?(H=f===`collaboration`?(0,G.jsx)(he,{rules:g.rules,language:t,t:n,onChanged:()=>b()}):null,e[62]=g.rules,e[63]=t,e[64]=b,e[65]=n,e[66]=f,e[67]=H):H=e[67];let q;e[68]!==n||e[69]!==f?(q=f===`sources`?(0,G.jsx)(ve,{t:n}):null,e[68]=n,e[69]=f,e[70]=q):q=e[70];let Y;e[71]!==g.consolidation?.lastRun||e[72]!==n||e[73]!==f?(Y=f===`dreaming`?(0,G.jsx)(ye,{lastRun:g.consolidation?.lastRun??null,t:n}):null,e[71]=g.consolidation?.lastRun,e[72]=n,e[73]=f,e[74]=Y):Y=e[74];let X;e[75]!==n||e[76]!==f?(X=f===`privacy`?(0,G.jsx)(xe,{t:n}):null,e[75]=n,e[76]=f,e[77]=X):X=e[77];let Z;return e[78]!==R||e[79]!==z||e[80]!==B||e[81]!==H||e[82]!==q||e[83]!==Y||e[84]!==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[78]=R,e[79]=z,e[80]=B,e[81]=H,e[82]=q,e[83]=Y,e[84]=X,e[85]=Z):Z=e[85],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,u]=te(s),d;t[2]===c?d=t[3]:(d=ee(c),t[2]=c,t[3]=d);let f;t[4]===s?f=t[5]:(f=ee(s),t[4]=s,t[5]=f);let p=d!==f,m;t[6]!==a||t[7]!==n?(m=async e=>{await a((await l({...e,accessibility:n.accessibility})).profile)},t[6]=a,t[7]=n,t[8]=m):m=t[8];let h;t[9]!==c||t[10]!==p||t[11]!==m?(h={value:c,dirty:p,delayMs:500,onSave:m},t[9]=c,t[10]=p,t[11]=m,t[12]=h):h=t[12];let g=B(h),_;t[13]!==c||t[14]!==u?(_=(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=>u(n=>({...n,[e]:t.target.value}))})]}),t[13]=c,t[14]=u,t[15]=_):_=t[15];let v=_,y=g.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]!==v||t[19]!==i.callName||t[20]!==i.callNamePlaceholder?(x=v(`callName`,i.callName,i.callNamePlaceholder),t[18]=v,t[19]=i.callName,t[20]=i.callNamePlaceholder,t[21]=x):x=t[21];let S;t[22]!==v||t[23]!==i.role||t[24]!==i.rolePlaceholder?(S=v(`role`,i.role,i.rolePlaceholder),t[22]=v,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]===u?w=t[29]:(w=e=>u(t=>({...t,primaryGoal:e.target.value})),t[28]=u,t[29]=w);let T;t[30]!==c.primaryGoal||t[31]!==i.primaryGoalPlaceholder||t[32]!==w?(T=(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]=T):T=t[33];let E;t[34]!==C||t[35]!==T?(E=(0,G.jsxs)(`label`,{className:`space-y-1.5 text-sm sm:col-span-2`,children:[C,T]}),t[34]=C,t[35]=T,t[36]=E):E=t[36];let D;t[37]!==v||t[38]!==r||t[39]!==i.pronouns||t[40]!==i.pronounsPlaceholder?(D=r===`en`?v(`pronouns`,i.pronouns,i.pronounsPlaceholder):null,t[37]=v,t[38]=r,t[39]=i.pronouns,t[40]=i.pronounsPlaceholder,t[41]=D):D=t[41];let O;t[42]===i.timezone?O=t[43]:(O=(0,G.jsx)(`span`,{className:`font-medium text-fg`,children:i.timezone}),t[42]=i.timezone,t[43]=O);let k;t[44]===u?k=t[45]:(k=e=>u(t=>({...t,timezone:e.target.value})),t[44]=u,t[45]=k);let j;t[46]!==c.timezone||t[47]!==k?(j=(0,G.jsx)(`input`,{className:`${q} min-w-0 flex-1`,value:c.timezone,onChange:k}),t[46]=c.timezone,t[47]=k,t[48]=j):j=t[48];let M;t[49]===u?M=t[50]:(M=()=>u(le),t[49]=u,t[50]=M);let N;t[51]!==i.detect||t[52]!==M?(N=(0,G.jsx)(A,{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]!==O||t[58]!==P?(F=(0,G.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[O,P]}),t[57]=O,t[58]=P,t[59]=F):F=t[59];let I;t[60]!==v||t[61]!==i.locale?(I=v(`locale`,i.locale),t[60]=v,t[61]=i.locale,t[62]=I):I=t[62];let L;t[63]!==x||t[64]!==S||t[65]!==E||t[66]!==D||t[67]!==F||t[68]!==I?(L=(0,G.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[x,S,E,D,F,I]}),t[63]=x,t[64]=S,t[65]=E,t[66]=D,t[67]=F,t[68]=I,t[69]=L):L=t[69];let R;t[70]!==g.error||t[71]!==g.status?(R=(0,G.jsx)(`div`,{className:`mt-5 flex justify-end`,children:(0,G.jsx)(z,{status:g.status,error:g.error})}),t[70]=g.error,t[71]=g.status,t[72]=R):R=t[72];let V;return t[73]!==g.onBlurCapture||t[74]!==L||t[75]!==R||t[76]!==b?(V=(0,G.jsx)(Z,{children:(0,G.jsxs)(`div`,{onBlurCapture:y,children:[b,L,R]})}),t[73]=g.onBlurCapture,t[74]=L,t[75]=R,t[76]=b,t[77]=V):V=t[77],V}function le(e){return{...e,timezone:h()}}function ue(e){let t=(0,U.c)(50),{items:n,language:r,t:i,onChanged:a}=e,[o,s]=(0,W.useState)(!1),[c,l]=(0,W.useState)(``),[u,d]=(0,W.useState)(`preference`),f;t[0]===n?f=t[1]:(f=n.filter(fe),t[0]=n,t[1]=f);let p=f,m;t[2]===n?m=t[3]:(m=n.filter(de),t[2]=n,t[3]=m);let h=m,g;t[4]!==u||t[5]!==a||t[6]!==c?(g=async e=>{e.preventDefault(),c.trim()&&(await R({statement:c,kind:u}),l(``),s(!1),await a())},t[4]=u,t[5]=a,t[6]=c,t[7]=g):g=t[7];let _=g,v;t[8]===i.understoodHint?v=t[9]:(v=(0,G.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:i.understoodHint}),t[8]=i.understoodHint,t[9]=v);let y,b;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(y=()=>s(!0),b=(0,G.jsx)(N,{className:`size-4`}),t[10]=y,t[11]=b):(y=t[10],b=t[11]);let S;t[12]===i.addUnderstanding?S=t[13]:(S=(0,G.jsxs)(A,{variant:`primary`,onClick:y,children:[b,i.addUnderstanding]}),t[12]=i.addUnderstanding,t[13]=S);let C;t[14]!==v||t[15]!==S?(C=(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[v,S]}),t[14]=v,t[15]=S,t[16]=C):C=t[16];let w;t[17]===i?w=t[18]:(w=(0,G.jsx)(pe,{t:i}),t[17]=i,t[18]=w);let T;t[19]!==o||t[20]!==u||t[21]!==r||t[22]!==c||t[23]!==_||t[24]!==i.add||t[25]!==i.cancel||t[26]!==i.statement?(T=o?(0,G.jsx)(Z,{children:(0,G.jsxs)(`form`,{className:`space-y-3`,onSubmit:_,children:[(0,G.jsx)(`textarea`,{autoFocus:!0,className:q,rows:3,placeholder:i.statement,value:c,onChange:e=>l(e.target.value)}),(0,G.jsx)(x,{value:u,onChange:e=>d(e.target.value),children:Object.entries(Y).map(e=>{let[t,n]=e;return(0,G.jsx)(L,{value:t,children:n[r]},t)})}),(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsx)(A,{type:`submit`,variant:`primary`,children:i.add}),(0,G.jsx)(A,{onClick:()=>s(!1),children:i.cancel})]})]})}):null,t[19]=o,t[20]=u,t[21]=r,t[22]=c,t[23]=_,t[24]=i.add,t[25]=i.cancel,t[26]=i.statement,t[27]=T):T=t[27];let E;t[28]!==r||t[29]!==a||t[30]!==h||t[31]!==i?(E=h.length?(0,G.jsxs)(`section`,{className:`space-y-3`,children:[(0,G.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[i.review,` · `,h.length]}),h.map(e=>(0,G.jsx)($,{item:e,language:r,t:i,onChanged:a},e.id))]}):null,t[28]=r,t[29]=a,t[30]=h,t[31]=i,t[32]=E):E=t[32];let D;t[33]!==p.length||t[34]!==i.active?(D=(0,G.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[i.active,` · `,p.length]}),t[33]=p.length,t[34]=i.active,t[35]=D):D=t[35];let O;t[36]!==p||t[37]!==r||t[38]!==a||t[39]!==i?(O=p.length?p.map(e=>(0,G.jsx)($,{item:e,language:r,t:i,onChanged:a},e.id)):(0,G.jsx)(Q,{children:i.emptyUnderstanding}),t[36]=p,t[37]=r,t[38]=a,t[39]=i,t[40]=O):O=t[40];let k;t[41]!==D||t[42]!==O?(k=(0,G.jsxs)(`section`,{className:`space-y-3`,children:[D,O]}),t[41]=D,t[42]=O,t[43]=k):k=t[43];let j;return t[44]!==T||t[45]!==E||t[46]!==k||t[47]!==C||t[48]!==w?(j=(0,G.jsxs)(`div`,{className:`space-y-5`,children:[C,w,T,E,k]}),t[44]=T,t[45]=E,t[46]=k,t[47]=C,t[48]=w,t[49]=j):j=t[49],j}function de(e){return[`candidate`,`needs_review`,`stale`].includes(e.status)}function fe(e){return e.status===`active`}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,p;t[0]===i.required?p=t[1]:(p=e=>e.trim()?null:i.required,t[0]=i.required,t[1]=p);let m;t[2]!==n.id||t[3]!==a?(m=async e=>{await a((await D(n.id,{statement:e})).understanding)},t[2]=n.id,t[3]=a,t[4]=m):m=t[4];let h;t[5]!==u||t[6]!==o||t[7]!==f||t[8]!==p||t[9]!==m?(h={value:u,dirty:f,enabled:o,delayMs:500,validate:p,onSave:m},t[5]=u,t[6]=o,t[7]=f,t[8]=p,t[9]=m,t[10]=h):h=t[10];let g=B(h),_=Y[n.kind][r],v;t[11]===_?v=t[12]:(v=(0,G.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:_}),t[11]=_,t[12]=v);let b=n.explicitness===`explicit`?i.sourceExplicit:n.explicitness===`observed`?i.sourceObserved:i.sourceInferred,x;t[13]===b?x=t[14]:(x=(0,G.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:b}),t[13]=b,t[14]=x);let S;t[15]!==v||t[16]!==x?(S=(0,G.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-center gap-2`,children:[v,x]}),t[15]=v,t[16]=x,t[17]=S):S=t[17];let C;t[18]!==u||t[19]!==o||t[20]!==d?(C=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]=C):C=t[21];let T;t[22]!==C||t[23]!==S?(T=(0,G.jsx)(`div`,{className:`flex items-start justify-between gap-3`,children:(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[S,C]})}),t[22]=C,t[23]=S,t[24]=T):T=t[24];let E;t[25]!==g||t[26]!==o||t[27]!==i.done||t[28]!==i.edit?(E=o?(0,G.jsx)(A,{variant:`ghost`,onClick:()=>{g.flush(),s(!1)},children:i.done}):(0,G.jsxs)(A,{variant:`ghost`,onClick:()=>s(!0),children:[(0,G.jsx)(M,{className:`size-3.5`}),i.edit]}),t[25]=g,t[26]=o,t[27]=i.done,t[28]=i.edit,t[29]=E):E=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)(A,{variant:`primary`,onClick:async()=>{await a((await D(n.id,{status:`active`})).understanding)},children:i.confirm}),(0,G.jsx)(A,{onClick:async()=>{await a((await D(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 k;t[36]!==c||t[37]!==n.id||t[38]!==a?(k=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]=k):k=t[39];let j;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,G.jsx)(y,{className:`size-3.5`}),t[40]=j):j=t[40];let N=c?i.confirmDelete:i.delete,P;t[41]!==k||t[42]!==N?(P=(0,G.jsxs)(A,{variant:`ghost`,className:`text-danger`,onClick:k,children:[j,N]}),t[41]=k,t[42]=N,t[43]=P):P=t[43];let F;t[44]!==g.error||t[45]!==g.status||t[46]!==o?(F=o||g.status!==`idle`?(0,G.jsx)(z,{className:`ml-auto`,status:g.status,error:g.error}):null,t[44]=g.error,t[45]=g.status,t[46]=o,t[47]=F):F=t[47];let I;t[48]!==E||t[49]!==O||t[50]!==P||t[51]!==F?(I=(0,G.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2`,children:[E,O,P,F]}),t[48]=E,t[49]=O,t[50]=P,t[51]=F,t[52]=I):I=t[52];let L;return t[53]!==g.onBlurCapture||t[54]!==T||t[55]!==I?(L=(0,G.jsx)(Z,{children:(0,G.jsxs)(`div`,{onBlurCapture:g.onBlurCapture,children:[T,I]})}),t[53]=g.onBlurCapture,t[54]=T,t[55]=I,t[56]=L):L=t[56],L}function pe(e){let t=(0,U.c)(20),{t:n}=e,{data:r,error:i,isLoading:a,mutate:o}=s(`you-focuses`,v);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(me),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)(A,{onClick:async()=>{await b(e.id,`paused`),await o()},children:n.pause}):(0,G.jsx)(A,{variant:`primary`,onClick:async()=>{await b(e.id,`active`),await o()},children:n.activate}),(0,G.jsx)(A,{variant:`ghost`,onClick:async()=>{await b(e.id,`completed`),await o()},children:n.complete}),e.status===`candidate`?(0,G.jsx)(A,{variant:`ghost`,className:`text-danger`,onClick:async()=>{await b(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 me(e){return e.status!==`rejected`}function he(e){let t=(0,U.c)(36),{rules:n,language:r,t:i,onChanged:a}=e,[o,s]=(0,W.useState)(!1),[c,l]=(0,W.useState)(``),[u,d]=(0,W.useState)(`communication`),[p,m]=(0,W.useState)(null),h;t[0]!==u||t[1]!==a||t[2]!==c?(h=async e=>{e.preventDefault(),c.trim()&&(await S({statement:c,category:u}),l(``),s(!1),await a())},t[0]=u,t[1]=a,t[2]=c,t[3]=h):h=t[3];let g=h,_;t[4]===i.rulesHint?_=t[5]:(_=(0,G.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:i.rulesHint}),t[4]=i.rulesHint,t[5]=_);let v,b;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(v=()=>s(!0),b=(0,G.jsx)(N,{className:`size-4`}),t[6]=v,t[7]=b):(v=t[6],b=t[7]);let C;t[8]===i.addRule?C=t[9]:(C=(0,G.jsxs)(A,{variant:`primary`,onClick:v,children:[b,i.addRule]}),t[8]=i.addRule,t[9]=C);let w;t[10]!==_||t[11]!==C?(w=(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[_,C]}),t[10]=_,t[11]=C,t[12]=w):w=t[12];let T;t[13]!==o||t[14]!==u||t[15]!==r||t[16]!==c||t[17]!==g||t[18]!==i.add||t[19]!==i.cancel||t[20]!==i.ruleStatement?(T=o?(0,G.jsx)(Z,{children:(0,G.jsxs)(`form`,{className:`space-y-3`,onSubmit:g,children:[(0,G.jsx)(`textarea`,{autoFocus:!0,className:q,rows:3,placeholder:i.ruleStatement,value:c,onChange:e=>l(e.target.value)}),(0,G.jsx)(x,{value:u,onChange:e=>d(e.target.value),children:Object.entries(X).map(e=>{let[t,n]=e;return(0,G.jsx)(L,{value:t,children:n[r]},t)})}),(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsx)(A,{type:`submit`,variant:`primary`,children:i.add}),(0,G.jsx)(A,{onClick:()=>s(!1),children:i.cancel})]})]})}):null,t[13]=o,t[14]=u,t[15]=r,t[16]=c,t[17]=g,t[18]=i.add,t[19]=i.cancel,t[20]=i.ruleStatement,t[21]=T):T=t[21];let E;t[22]!==p||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?(E=n.length?n.filter(ge).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)(A,{variant:`ghost`,onClick:async()=>{await O(e.id,{status:e.status===`active`?`disabled`:`active`}),await a()},children:e.status===`active`?i.disable:i.enable}),(0,G.jsxs)(A,{variant:`ghost`,className:`text-danger`,onClick:async()=>{if(p!==e.id){m(e.id);return}await f(e.id),m(null),await a()},children:[(0,G.jsx)(y,{className:`size-3.5`}),p===e.id?i.confirmDelete:i.delete]})]})]},e.id)):(0,G.jsx)(Q,{children:i.emptyRules}),t[22]=p,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]=E):E=t[31];let D;return t[32]!==w||t[33]!==T||t[34]!==E?(D=(0,G.jsxs)(`div`,{className:`space-y-5`,children:[w,T,E]}),t[32]=w,t[33]=T,t[34]=E,t[35]=D):D=t[35],D}function ge(e){return e.status!==`archived`}async function _e(){let[e,t]=await Promise.all([C(),H()]);return{grants:e,connectors:t}}function ve(e){let t=(0,U.c)(39),{t:n}=e,{data:r,error:i,isLoading:o,mutate:c}=s(`you-understanding-sources`,_e);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 l;t[9]===r?.grants?l=t[10]:(l=r?.grants??[],t[9]=r?.grants,t[10]=l);let d=l,f;t[11]===r?.connectors?f=t[12]:(f=r?.connectors??[],t[11]=r?.connectors,t[12]=f);let p=f,m;t[13]===n.sourcesHint?m=t[14]:(m=(0,G.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:n.sourcesHint}),t[13]=n.sourcesHint,t[14]=m);let h;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,G.jsx)(I,{className:`size-4`}),t[15]=h):h=t[15];let _;t[16]===n.manageSources?_=t[17]:(_=(0,G.jsx)(A,{asChild:!0,variant:`primary`,children:(0,G.jsxs)(a,{to:`/connectors?understanding=1&returnTo=%2Fyou%3Ftab%3Dsources`,children:[n.manageSources,h]})}),t[16]=n.manageSources,t[17]=_);let v;t[18]!==m||t[19]!==_?(v=(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[m,_]}),t[18]=m,t[19]=_,t[20]=v):v=t[20];let y;t[21]!==d||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?(y=d.length?(0,G.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:d.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)(A,{variant:`ghost`,onClick:async()=>{await F(e.id),await c()},children:n.refresh}):null,(0,G.jsx)(A,{variant:`ghost`,className:`text-danger`,onClick:async()=>{await g(e.id),await c()},children:n.revoke})]})]})},e.id))}):(0,G.jsx)(Q,{children:n.noSources}),t[21]=d,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]=y):y=t[30];let b;t[31]!==p||t[32]!==n.connected||t[33]!==n.unavailable?(b=p.length?(0,G.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:p.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]=p,t[32]=n.connected,t[33]=n.unavailable,t[34]=b):b=t[34];let x;return t[35]!==v||t[36]!==y||t[37]!==b?(x=(0,G.jsxs)(`div`,{className:`space-y-5`,children:[v,y,b]}),t[35]=v,t[36]=y,t[37]=b,t[38]=x):x=t[38],x}function ye(e){let t=(0,U.c)(112),{lastRun:n,t:r}=e,{data:i,error:a,isLoading:o,mutate:c}=s(`you-context-settings`,m),l=i?.dreaming??null,[d,f]=te(l),p;t[0]!==d||t[1]!==l?(p=d&&l&&ee(d)!==ee(l),t[0]=d,t[1]=l,t[2]=p):p=t[2];let g=!!p,_;t[3]===c?_=t[4]:(_=async e=>{await k({dreaming:e}),await c()},t[3]=c,t[4]=_);let v;t[5]!==d||t[6]!==g||t[7]!==_?(v={value:d,dirty:g,delayMs:500,onSave:_},t[5]=d,t[6]=g,t[7]=_,t[8]=v):v=t[8];let y=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||!d){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 b=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=y.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]===f?T=t[23]:(T=e=>f(t=>t&&{...t,mode:e.target.value}),t[22]=f,t[23]=T);let E;t[24]===r.on?E=t[25]:(E=(0,G.jsx)(L,{value:`review`,children:r.on}),t[24]=r.on,t[25]=E);let D;t[26]===r.off?D=t[27]:(D=(0,G.jsx)(L,{value:`off`,children:r.off}),t[26]=r.off,t[27]=D);let O;t[28]!==d.mode||t[29]!==D||t[30]!==T||t[31]!==E?(O=(0,G.jsxs)(x,{value:d.mode,onChange:T,children:[E,D]}),t[28]=d.mode,t[29]=D,t[30]=T,t[31]=E,t[32]=O):O=t[32];let j;t[33]!==O||t[34]!==w?(j=(0,G.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[w,O]}),t[33]=O,t[34]=w,t[35]=j):j=t[35];let M;t[36]===r.reviewTime?M=t[37]:(M=(0,G.jsx)(`span`,{className:`font-medium text-fg`,children:r.reviewTime}),t[36]=r.reviewTime,t[37]=M);let N;t[38]===f?N=t[39]:(N=e=>f(t=>t&&{...t,schedule:{time:e.target.value}}),t[38]=f,t[39]=N);let P;t[40]!==d.schedule.time||t[41]!==N?(P=(0,G.jsx)(`input`,{type:`time`,className:q,value:d.schedule.time,onChange:N}),t[40]=d.schedule.time,t[41]=N,t[42]=P):P=t[42];let F;t[43]!==M||t[44]!==P?(F=(0,G.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[M,P]}),t[43]=M,t[44]=P,t[45]=F):F=t[45];let I;t[46]===r.timezone?I=t[47]:(I=(0,G.jsx)(`span`,{className:`font-medium text-fg`,children:r.timezone}),t[46]=r.timezone,t[47]=I);let R=d.timezone??``,V;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(V=h(),t[48]=V):V=t[48];let H;t[49]===f?H=t[50]:(H=e=>f(t=>t&&{...t,timezone:e.target.value||void 0}),t[49]=f,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]===f?K=t[55]:(K=()=>f(be),t[54]=f,t[55]=K);let J;t[56]!==r.detect||t[57]!==K?(J=(0,G.jsx)(A,{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]!==I||t[63]!==Y?(X=(0,G.jsxs)(`label`,{className:`space-y-1.5 text-sm sm:col-span-2`,children:[I,Y]}),t[62]=I,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]===f?re=t[68]:(re=e=>f(t=>t&&{...t,minEvidenceSources:Number(e.target.value)}),t[67]=f,t[68]=re);let ie;t[69]!==d.minEvidenceSources||t[70]!==re?(ie=(0,G.jsx)(`input`,{type:`number`,min:2,max:10,className:q,value:d.minEvidenceSources,onChange:re}),t[69]=d.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]===f?se=t[78]:(se=e=>f(t=>t&&{...t,limit:Number(e.target.value)}),t[77]=f,t[78]=se);let ce;t[79]!==d.limit||t[80]!==se?(ce=(0,G.jsx)(`input`,{type:`number`,min:1,max:2e3,className:q,value:d.limit,onChange:se}),t[79]=d.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]!==j||t[86]!==F||t[87]!==X||t[88]!==ae||t[89]!==le?(ue=(0,G.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[j,F,X,ae,le]}),t[85]=j,t[86]=F,t[87]=X,t[88]=ae,t[89]=le,t[90]=ue):ue=t[90];let de;t[91]!==y.error||t[92]!==y.status?(de=(0,G.jsx)(`div`,{className:`mt-5 flex justify-end`,children:(0,G.jsx)(z,{status:y.status,error:y.error})}),t[91]=y.error,t[92]=y.status,t[93]=de):de=t[93];let fe;t[94]!==y.onBlurCapture||t[95]!==ue||t[96]!==de?(fe=(0,G.jsx)(Z,{children:(0,G.jsxs)(`div`,{onBlurCapture:C,children:[ue,de]})}),t[94]=y.onBlurCapture,t[95]=ue,t[96]=de,t[97]=fe):fe=t[97];let $;t[98]===r.lastRun?$=t[99]:($=(0,G.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:r.lastRun}),t[98]=r.lastRun,t[99]=$);let pe;t[100]!==n||t[101]!==b||t[102]!==r.neverRun||t[103]!==r.runItems?(pe=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:b}),(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]=b,t[102]=r.neverRun,t[103]=r.runItems,t[104]=pe):pe=t[104];let me;t[105]!==$||t[106]!==pe?(me=(0,G.jsxs)(Z,{children:[$,pe]}),t[105]=$,t[106]=pe,t[107]=me):me=t[107];let he;return t[108]!==fe||t[109]!==me||t[110]!==S?(he=(0,G.jsxs)(`div`,{className:`space-y-5`,children:[S,fe,me]}),t[108]=fe,t[109]=me,t[110]=S,t[111]=he):he=t[111],he}function be(e){return e&&{...e,timezone:h()}}function xe(e){let t=(0,U.c)(49),{t:n}=e,{data:r,error:i,isLoading:a,mutate:o}=s(`you-context-settings`,m),c=r?.privacy.sensitiveWritePolicy??null,[l,d]=te(c),f=!!(l&&c&&l!==c),p;t[0]===o?p=t[1]:(p=async e=>{await k({privacy:{sensitiveWritePolicy:e}}),await o()},t[0]=o,t[1]=p);let h;t[2]!==l||t[3]!==f||t[4]!==p?(h={value:l,dirty:f,delayMs:350,onSave:p},t[2]=l,t[3]=f,t[4]=p,t[5]=h):h=t[5];let g=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 _;t[15]===n.privacyHint?_=t[16]:(_=(0,G.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:n.privacyHint}),t[15]=n.privacyHint,t[16]=_);let v;t[17]===n.sensitivePolicy?v=t[18]:(v=(0,G.jsx)(`span`,{className:`font-medium text-fg`,children:n.sensitivePolicy}),t[17]=n.sensitivePolicy,t[18]=v);let y;t[19]===d?y=t[20]:(y=e=>d(e.target.value),t[19]=d,t[20]=y);let b;t[21]===n.policyDeny?b=t[22]:(b=(0,G.jsx)(L,{value:`deny`,children:n.policyDeny}),t[21]=n.policyDeny,t[22]=b);let S;t[23]===n.policyConfirm?S=t[24]:(S=(0,G.jsx)(L,{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)(L,{value:`allow`,children:n.policyAllow}),t[25]=n.policyAllow,t[26]=C);let w;t[27]!==l||t[28]!==y||t[29]!==b||t[30]!==S||t[31]!==C?(w=(0,G.jsxs)(x,{value:l,onChange:y,children:[b,S,C]}),t[27]=l,t[28]=y,t[29]=b,t[30]=S,t[31]=C,t[32]=w):w=t[32];let T;t[33]!==w||t[34]!==v?(T=(0,G.jsxs)(`label`,{className:`block max-w-xl space-y-1.5 text-sm`,children:[v,w]}),t[33]=w,t[34]=v,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 D;t[38]!==g.error||t[39]!==g.status?(D=(0,G.jsx)(`div`,{className:`mt-5 flex justify-end`,children:(0,G.jsx)(z,{status:g.status,error:g.error})}),t[38]=g.error,t[39]=g.status,t[40]=D):D=t[40];let O;t[41]!==g.onBlurCapture||t[42]!==T||t[43]!==E||t[44]!==D?(O=(0,G.jsx)(Z,{children:(0,G.jsxs)(`div`,{onBlurCapture:g.onBlurCapture,children:[T,E,D]})}),t[41]=g.onBlurCapture,t[42]=T,t[43]=E,t[44]=D,t[45]=O):O=t[45];let A;return t[46]!==O||t[47]!==_?(A=(0,G.jsxs)(`div`,{className:`space-y-5`,children:[_,O]}),t[46]=O,t[47]=_,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-deR2zRaE.js";import{i as s}from"./vendor-swr-BIWyz7Rc.js";import{$l as c,$t as l,Ba as u,Bl as d,Bt as f,Cc as p,Gt as m,Ht as h,Jt as g,Ks as _,Kt as v,Os as y,Qt as b,Ro as x,Rt as S,Ut as C,Vt as w,Wt as T,Xa as E,Xt as D,Yt as O,Zt as k,ds as A,eu as j,hc as M,lc as N,ol as P,qt as F,xl as I,zo as L,zt as R}from"./index-B-_CEvIX.js";import{n as z,t as B}from"./use-autosave-BN2QgFGn.js";import{t as V}from"./page-tabs-BO262zuu.js";import{a as H}from"./connectors-api-BMMqC0_9.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.`,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:`还没有协作约定。`,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)(86),t=o(se),n=J[t],[r,a]=i(),l;if(e[0]!==r){let t=r.get(`tab`);l=t&&K.has(t)?t:`profile`,e[0]=r,e[1]=l}else l=e[1];let f=l,m=E(oe),h=E(ae),{data:g,error:v,isLoading:y,mutate:b}=s(`/api/you`,T),x;e[2]!==h||e[3]!==m||e[4]!==n.subtitle||e[5]!==n.title?(x=()=>(m({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}),h),e[2]=h,e[3]=m,e[4]=n.subtitle,e[5]=n.title,e[6]=x):x=e[6];let S;if(e[7]!==h||e[8]!==m||e[9]!==n?(S=[h,m,n],e[7]=h,e[8]=m,e[9]=n,e[10]=S):S=e[10],(0,W.useEffect)(x,S),y){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(v||!g){let t;e[12]===b?t=e[13]:(t=()=>void b(),e[12]=b,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 D;e[22]===n.profile?D=e[23]:(D={id:`profile`,label:n.profile,icon:d},e[22]=n.profile,e[23]=D);let O;e[24]!==g.understandings.length||e[25]!==n.understanding?(O={id:`understanding`,label:n.understanding,icon:j,count:g.understandings.length},e[24]=g.understandings.length,e[25]=n.understanding,e[26]=O):O=e[26];let k=n.collaboration,A;e[27]===g.rules?A=e[28]:(A=g.rules.filter(ie),e[27]=g.rules,e[28]=A);let M;e[29]!==n.collaboration||e[30]!==A.length?(M={id:`collaboration`,label:k,icon:P,count:A.length},e[29]=n.collaboration,e[30]=A.length,e[31]=M):M=e[31];let N;e[32]===n.sources?N=e[33]:(N={id:`sources`,label:n.sources,icon:c},e[32]=n.sources,e[33]=N);let F;e[34]===n.dreaming?F=e[35]:(F={id:`dreaming`,label:n.dreaming,icon:p},e[34]=n.dreaming,e[35]=F);let I;e[36]===n.privacy?I=e[37]:(I={id:`privacy`,label:n.privacy,icon:_},e[36]=n.privacy,e[37]=I);let L;e[38]!==N||e[39]!==F||e[40]!==I||e[41]!==D||e[42]!==O||e[43]!==M?(L=[D,O,M,N,F,I],e[38]=N,e[39]=F,e[40]=I,e[41]=D,e[42]=O,e[43]=M,e[44]=L):L=e[44];let R;e[45]!==n.title||e[46]!==L||e[47]!==w||e[48]!==f?(R=(0,G.jsx)(V,{ariaLabel:C,activeTab:f,onChange:w,items:L}),e[45]=n.title,e[46]=L,e[47]=w,e[48]=f,e[49]=R):R=e[49];let z;e[50]!==g.profile||e[51]!==t||e[52]!==b||e[53]!==n||e[54]!==f?(z=f===`profile`?(0,G.jsx)(ce,{profile:g.profile,language:t,t:n,onChanged:e=>b(t=>t&&{...t,profile:e},{revalidate:!1})}):null,e[50]=g.profile,e[51]=t,e[52]=b,e[53]=n,e[54]=f,e[55]=z):z=e[55];let B;e[56]!==g.understandings||e[57]!==t||e[58]!==b||e[59]!==n||e[60]!==f?(B=f===`understanding`?(0,G.jsx)(ue,{items:g.understandings,language:t,t:n,onChanged:e=>e?b(t=>t&&{...t,understandings:t.understandings.map(t=>t.id===e.id?e:t)},{revalidate:!1}):b()}):null,e[56]=g.understandings,e[57]=t,e[58]=b,e[59]=n,e[60]=f,e[61]=B):B=e[61];let H;e[62]!==g.rules||e[63]!==t||e[64]!==b||e[65]!==n||e[66]!==f?(H=f===`collaboration`?(0,G.jsx)(he,{rules:g.rules,language:t,t:n,onChanged:()=>b()}):null,e[62]=g.rules,e[63]=t,e[64]=b,e[65]=n,e[66]=f,e[67]=H):H=e[67];let q;e[68]!==n||e[69]!==f?(q=f===`sources`?(0,G.jsx)(ve,{t:n}):null,e[68]=n,e[69]=f,e[70]=q):q=e[70];let Y;e[71]!==g.consolidation?.lastRun||e[72]!==n||e[73]!==f?(Y=f===`dreaming`?(0,G.jsx)(ye,{lastRun:g.consolidation?.lastRun??null,t:n}):null,e[71]=g.consolidation?.lastRun,e[72]=n,e[73]=f,e[74]=Y):Y=e[74];let X;e[75]!==n||e[76]!==f?(X=f===`privacy`?(0,G.jsx)(xe,{t:n}):null,e[75]=n,e[76]=f,e[77]=X):X=e[77];let Z;return e[78]!==R||e[79]!==z||e[80]!==B||e[81]!==H||e[82]!==q||e[83]!==Y||e[84]!==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[78]=R,e[79]=z,e[80]=B,e[81]=H,e[82]=q,e[83]=Y,e[84]=X,e[85]=Z):Z=e[85],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,u]=te(s),d;t[2]===c?d=t[3]:(d=ee(c),t[2]=c,t[3]=d);let f;t[4]===s?f=t[5]:(f=ee(s),t[4]=s,t[5]=f);let p=d!==f,m;t[6]!==a||t[7]!==n?(m=async e=>{await a((await l({...e,accessibility:n.accessibility})).profile)},t[6]=a,t[7]=n,t[8]=m):m=t[8];let h;t[9]!==c||t[10]!==p||t[11]!==m?(h={value:c,dirty:p,delayMs:500,onSave:m},t[9]=c,t[10]=p,t[11]=m,t[12]=h):h=t[12];let g=B(h),_;t[13]!==c||t[14]!==u?(_=(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=>u(n=>({...n,[e]:t.target.value}))})]}),t[13]=c,t[14]=u,t[15]=_):_=t[15];let v=_,y=g.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]!==v||t[19]!==i.callName||t[20]!==i.callNamePlaceholder?(x=v(`callName`,i.callName,i.callNamePlaceholder),t[18]=v,t[19]=i.callName,t[20]=i.callNamePlaceholder,t[21]=x):x=t[21];let S;t[22]!==v||t[23]!==i.role||t[24]!==i.rolePlaceholder?(S=v(`role`,i.role,i.rolePlaceholder),t[22]=v,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]===u?w=t[29]:(w=e=>u(t=>({...t,primaryGoal:e.target.value})),t[28]=u,t[29]=w);let T;t[30]!==c.primaryGoal||t[31]!==i.primaryGoalPlaceholder||t[32]!==w?(T=(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]=T):T=t[33];let E;t[34]!==C||t[35]!==T?(E=(0,G.jsxs)(`label`,{className:`space-y-1.5 text-sm sm:col-span-2`,children:[C,T]}),t[34]=C,t[35]=T,t[36]=E):E=t[36];let D;t[37]!==v||t[38]!==r||t[39]!==i.pronouns||t[40]!==i.pronounsPlaceholder?(D=r===`en`?v(`pronouns`,i.pronouns,i.pronounsPlaceholder):null,t[37]=v,t[38]=r,t[39]=i.pronouns,t[40]=i.pronounsPlaceholder,t[41]=D):D=t[41];let O;t[42]===i.timezone?O=t[43]:(O=(0,G.jsx)(`span`,{className:`font-medium text-fg`,children:i.timezone}),t[42]=i.timezone,t[43]=O);let k;t[44]===u?k=t[45]:(k=e=>u(t=>({...t,timezone:e.target.value})),t[44]=u,t[45]=k);let j;t[46]!==c.timezone||t[47]!==k?(j=(0,G.jsx)(`input`,{className:`${q} min-w-0 flex-1`,value:c.timezone,onChange:k}),t[46]=c.timezone,t[47]=k,t[48]=j):j=t[48];let M;t[49]===u?M=t[50]:(M=()=>u(le),t[49]=u,t[50]=M);let N;t[51]!==i.detect||t[52]!==M?(N=(0,G.jsx)(A,{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]!==O||t[58]!==P?(F=(0,G.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[O,P]}),t[57]=O,t[58]=P,t[59]=F):F=t[59];let I;t[60]!==v||t[61]!==i.locale?(I=v(`locale`,i.locale),t[60]=v,t[61]=i.locale,t[62]=I):I=t[62];let L;t[63]!==x||t[64]!==S||t[65]!==E||t[66]!==D||t[67]!==F||t[68]!==I?(L=(0,G.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[x,S,E,D,F,I]}),t[63]=x,t[64]=S,t[65]=E,t[66]=D,t[67]=F,t[68]=I,t[69]=L):L=t[69];let R;t[70]!==g.error||t[71]!==g.status?(R=(0,G.jsx)(`div`,{className:`mt-5 flex justify-end`,children:(0,G.jsx)(z,{status:g.status,error:g.error})}),t[70]=g.error,t[71]=g.status,t[72]=R):R=t[72];let V;return t[73]!==g.onBlurCapture||t[74]!==L||t[75]!==R||t[76]!==b?(V=(0,G.jsx)(Z,{children:(0,G.jsxs)(`div`,{onBlurCapture:y,children:[b,L,R]})}),t[73]=g.onBlurCapture,t[74]=L,t[75]=R,t[76]=b,t[77]=V):V=t[77],V}function le(e){return{...e,timezone:h()}}function ue(e){let t=(0,U.c)(50),{items:n,language:r,t:i,onChanged:a}=e,[o,s]=(0,W.useState)(!1),[c,l]=(0,W.useState)(``),[u,d]=(0,W.useState)(`preference`),f;t[0]===n?f=t[1]:(f=n.filter(fe),t[0]=n,t[1]=f);let p=f,m;t[2]===n?m=t[3]:(m=n.filter(de),t[2]=n,t[3]=m);let h=m,g;t[4]!==u||t[5]!==a||t[6]!==c?(g=async e=>{e.preventDefault(),c.trim()&&(await R({statement:c,kind:u}),l(``),s(!1),await a())},t[4]=u,t[5]=a,t[6]=c,t[7]=g):g=t[7];let _=g,v;t[8]===i.understoodHint?v=t[9]:(v=(0,G.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:i.understoodHint}),t[8]=i.understoodHint,t[9]=v);let y,b;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(y=()=>s(!0),b=(0,G.jsx)(N,{className:`size-4`}),t[10]=y,t[11]=b):(y=t[10],b=t[11]);let S;t[12]===i.addUnderstanding?S=t[13]:(S=(0,G.jsxs)(A,{variant:`primary`,onClick:y,children:[b,i.addUnderstanding]}),t[12]=i.addUnderstanding,t[13]=S);let C;t[14]!==v||t[15]!==S?(C=(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[v,S]}),t[14]=v,t[15]=S,t[16]=C):C=t[16];let w;t[17]===i?w=t[18]:(w=(0,G.jsx)(pe,{t:i}),t[17]=i,t[18]=w);let T;t[19]!==o||t[20]!==u||t[21]!==r||t[22]!==c||t[23]!==_||t[24]!==i.add||t[25]!==i.cancel||t[26]!==i.statement?(T=o?(0,G.jsx)(Z,{children:(0,G.jsxs)(`form`,{className:`space-y-3`,onSubmit:_,children:[(0,G.jsx)(`textarea`,{autoFocus:!0,className:q,rows:3,placeholder:i.statement,value:c,onChange:e=>l(e.target.value)}),(0,G.jsx)(x,{value:u,onChange:e=>d(e.target.value),children:Object.entries(Y).map(e=>{let[t,n]=e;return(0,G.jsx)(L,{value:t,children:n[r]},t)})}),(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsx)(A,{type:`submit`,variant:`primary`,children:i.add}),(0,G.jsx)(A,{onClick:()=>s(!1),children:i.cancel})]})]})}):null,t[19]=o,t[20]=u,t[21]=r,t[22]=c,t[23]=_,t[24]=i.add,t[25]=i.cancel,t[26]=i.statement,t[27]=T):T=t[27];let E;t[28]!==r||t[29]!==a||t[30]!==h||t[31]!==i?(E=h.length?(0,G.jsxs)(`section`,{className:`space-y-3`,children:[(0,G.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[i.review,` · `,h.length]}),h.map(e=>(0,G.jsx)($,{item:e,language:r,t:i,onChanged:a},e.id))]}):null,t[28]=r,t[29]=a,t[30]=h,t[31]=i,t[32]=E):E=t[32];let D;t[33]!==p.length||t[34]!==i.active?(D=(0,G.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[i.active,` · `,p.length]}),t[33]=p.length,t[34]=i.active,t[35]=D):D=t[35];let O;t[36]!==p||t[37]!==r||t[38]!==a||t[39]!==i?(O=p.length?p.map(e=>(0,G.jsx)($,{item:e,language:r,t:i,onChanged:a},e.id)):(0,G.jsx)(Q,{children:i.emptyUnderstanding}),t[36]=p,t[37]=r,t[38]=a,t[39]=i,t[40]=O):O=t[40];let k;t[41]!==D||t[42]!==O?(k=(0,G.jsxs)(`section`,{className:`space-y-3`,children:[D,O]}),t[41]=D,t[42]=O,t[43]=k):k=t[43];let j;return t[44]!==T||t[45]!==E||t[46]!==k||t[47]!==C||t[48]!==w?(j=(0,G.jsxs)(`div`,{className:`space-y-5`,children:[C,w,T,E,k]}),t[44]=T,t[45]=E,t[46]=k,t[47]=C,t[48]=w,t[49]=j):j=t[49],j}function de(e){return[`candidate`,`needs_review`,`stale`].includes(e.status)}function fe(e){return e.status===`active`}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,p;t[0]===i.required?p=t[1]:(p=e=>e.trim()?null:i.required,t[0]=i.required,t[1]=p);let m;t[2]!==n.id||t[3]!==a?(m=async e=>{await a((await D(n.id,{statement:e})).understanding)},t[2]=n.id,t[3]=a,t[4]=m):m=t[4];let h;t[5]!==u||t[6]!==o||t[7]!==f||t[8]!==p||t[9]!==m?(h={value:u,dirty:f,enabled:o,delayMs:500,validate:p,onSave:m},t[5]=u,t[6]=o,t[7]=f,t[8]=p,t[9]=m,t[10]=h):h=t[10];let g=B(h),_=Y[n.kind][r],v;t[11]===_?v=t[12]:(v=(0,G.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:_}),t[11]=_,t[12]=v);let b=n.explicitness===`explicit`?i.sourceExplicit:n.explicitness===`observed`?i.sourceObserved:i.sourceInferred,x;t[13]===b?x=t[14]:(x=(0,G.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:b}),t[13]=b,t[14]=x);let S;t[15]!==v||t[16]!==x?(S=(0,G.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-center gap-2`,children:[v,x]}),t[15]=v,t[16]=x,t[17]=S):S=t[17];let C;t[18]!==u||t[19]!==o||t[20]!==d?(C=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]=C):C=t[21];let T;t[22]!==C||t[23]!==S?(T=(0,G.jsx)(`div`,{className:`flex items-start justify-between gap-3`,children:(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[S,C]})}),t[22]=C,t[23]=S,t[24]=T):T=t[24];let E;t[25]!==g||t[26]!==o||t[27]!==i.done||t[28]!==i.edit?(E=o?(0,G.jsx)(A,{variant:`ghost`,onClick:()=>{g.flush(),s(!1)},children:i.done}):(0,G.jsxs)(A,{variant:`ghost`,onClick:()=>s(!0),children:[(0,G.jsx)(M,{className:`size-3.5`}),i.edit]}),t[25]=g,t[26]=o,t[27]=i.done,t[28]=i.edit,t[29]=E):E=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)(A,{variant:`primary`,onClick:async()=>{await a((await D(n.id,{status:`active`})).understanding)},children:i.confirm}),(0,G.jsx)(A,{onClick:async()=>{await a((await D(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 k;t[36]!==c||t[37]!==n.id||t[38]!==a?(k=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]=k):k=t[39];let j;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,G.jsx)(y,{className:`size-3.5`}),t[40]=j):j=t[40];let N=c?i.confirmDelete:i.delete,P;t[41]!==k||t[42]!==N?(P=(0,G.jsxs)(A,{variant:`ghost`,className:`text-danger`,onClick:k,children:[j,N]}),t[41]=k,t[42]=N,t[43]=P):P=t[43];let F;t[44]!==g.error||t[45]!==g.status||t[46]!==o?(F=o||g.status!==`idle`?(0,G.jsx)(z,{className:`ml-auto`,status:g.status,error:g.error}):null,t[44]=g.error,t[45]=g.status,t[46]=o,t[47]=F):F=t[47];let I;t[48]!==E||t[49]!==O||t[50]!==P||t[51]!==F?(I=(0,G.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2`,children:[E,O,P,F]}),t[48]=E,t[49]=O,t[50]=P,t[51]=F,t[52]=I):I=t[52];let L;return t[53]!==g.onBlurCapture||t[54]!==T||t[55]!==I?(L=(0,G.jsx)(Z,{children:(0,G.jsxs)(`div`,{onBlurCapture:g.onBlurCapture,children:[T,I]})}),t[53]=g.onBlurCapture,t[54]=T,t[55]=I,t[56]=L):L=t[56],L}function pe(e){let t=(0,U.c)(20),{t:n}=e,{data:r,error:i,isLoading:a,mutate:o}=s(`you-focuses`,v);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(me),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)(A,{onClick:async()=>{await b(e.id,`paused`),await o()},children:n.pause}):(0,G.jsx)(A,{variant:`primary`,onClick:async()=>{await b(e.id,`active`),await o()},children:n.activate}),(0,G.jsx)(A,{variant:`ghost`,onClick:async()=>{await b(e.id,`completed`),await o()},children:n.complete}),e.status===`candidate`?(0,G.jsx)(A,{variant:`ghost`,className:`text-danger`,onClick:async()=>{await b(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 me(e){return e.status!==`rejected`}function he(e){let t=(0,U.c)(36),{rules:n,language:r,t:i,onChanged:a}=e,[o,s]=(0,W.useState)(!1),[c,l]=(0,W.useState)(``),[u,d]=(0,W.useState)(`communication`),[p,m]=(0,W.useState)(null),h;t[0]!==u||t[1]!==a||t[2]!==c?(h=async e=>{e.preventDefault(),c.trim()&&(await S({statement:c,category:u}),l(``),s(!1),await a())},t[0]=u,t[1]=a,t[2]=c,t[3]=h):h=t[3];let g=h,_;t[4]===i.rulesHint?_=t[5]:(_=(0,G.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:i.rulesHint}),t[4]=i.rulesHint,t[5]=_);let v,b;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(v=()=>s(!0),b=(0,G.jsx)(N,{className:`size-4`}),t[6]=v,t[7]=b):(v=t[6],b=t[7]);let C;t[8]===i.addRule?C=t[9]:(C=(0,G.jsxs)(A,{variant:`primary`,onClick:v,children:[b,i.addRule]}),t[8]=i.addRule,t[9]=C);let w;t[10]!==_||t[11]!==C?(w=(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[_,C]}),t[10]=_,t[11]=C,t[12]=w):w=t[12];let T;t[13]!==o||t[14]!==u||t[15]!==r||t[16]!==c||t[17]!==g||t[18]!==i.add||t[19]!==i.cancel||t[20]!==i.ruleStatement?(T=o?(0,G.jsx)(Z,{children:(0,G.jsxs)(`form`,{className:`space-y-3`,onSubmit:g,children:[(0,G.jsx)(`textarea`,{autoFocus:!0,className:q,rows:3,placeholder:i.ruleStatement,value:c,onChange:e=>l(e.target.value)}),(0,G.jsx)(x,{value:u,onChange:e=>d(e.target.value),children:Object.entries(X).map(e=>{let[t,n]=e;return(0,G.jsx)(L,{value:t,children:n[r]},t)})}),(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsx)(A,{type:`submit`,variant:`primary`,children:i.add}),(0,G.jsx)(A,{onClick:()=>s(!1),children:i.cancel})]})]})}):null,t[13]=o,t[14]=u,t[15]=r,t[16]=c,t[17]=g,t[18]=i.add,t[19]=i.cancel,t[20]=i.ruleStatement,t[21]=T):T=t[21];let E;t[22]!==p||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?(E=n.length?n.filter(ge).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)(A,{variant:`ghost`,onClick:async()=>{await O(e.id,{status:e.status===`active`?`disabled`:`active`}),await a()},children:e.status===`active`?i.disable:i.enable}),(0,G.jsxs)(A,{variant:`ghost`,className:`text-danger`,onClick:async()=>{if(p!==e.id){m(e.id);return}await f(e.id),m(null),await a()},children:[(0,G.jsx)(y,{className:`size-3.5`}),p===e.id?i.confirmDelete:i.delete]})]})]},e.id)):(0,G.jsx)(Q,{children:i.emptyRules}),t[22]=p,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]=E):E=t[31];let D;return t[32]!==w||t[33]!==T||t[34]!==E?(D=(0,G.jsxs)(`div`,{className:`space-y-5`,children:[w,T,E]}),t[32]=w,t[33]=T,t[34]=E,t[35]=D):D=t[35],D}function ge(e){return e.status!==`archived`}async function _e(){let[e,t]=await Promise.all([C(),H()]);return{grants:e,connectors:t}}function ve(e){let t=(0,U.c)(39),{t:n}=e,{data:r,error:i,isLoading:o,mutate:c}=s(`you-understanding-sources`,_e);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 l;t[9]===r?.grants?l=t[10]:(l=r?.grants??[],t[9]=r?.grants,t[10]=l);let d=l,f;t[11]===r?.connectors?f=t[12]:(f=r?.connectors??[],t[11]=r?.connectors,t[12]=f);let p=f,m;t[13]===n.sourcesHint?m=t[14]:(m=(0,G.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:n.sourcesHint}),t[13]=n.sourcesHint,t[14]=m);let h;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,G.jsx)(I,{className:`size-4`}),t[15]=h):h=t[15];let _;t[16]===n.manageSources?_=t[17]:(_=(0,G.jsx)(A,{asChild:!0,variant:`primary`,children:(0,G.jsxs)(a,{to:`/connectors?understanding=1&returnTo=%2Fyou%3Ftab%3Dsources`,children:[n.manageSources,h]})}),t[16]=n.manageSources,t[17]=_);let v;t[18]!==m||t[19]!==_?(v=(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[m,_]}),t[18]=m,t[19]=_,t[20]=v):v=t[20];let y;t[21]!==d||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?(y=d.length?(0,G.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:d.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)(A,{variant:`ghost`,onClick:async()=>{await F(e.id),await c()},children:n.refresh}):null,(0,G.jsx)(A,{variant:`ghost`,className:`text-danger`,onClick:async()=>{await g(e.id),await c()},children:n.revoke})]})]})},e.id))}):(0,G.jsx)(Q,{children:n.noSources}),t[21]=d,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]=y):y=t[30];let b;t[31]!==p||t[32]!==n.connected||t[33]!==n.unavailable?(b=p.length?(0,G.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:p.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]=p,t[32]=n.connected,t[33]=n.unavailable,t[34]=b):b=t[34];let x;return t[35]!==v||t[36]!==y||t[37]!==b?(x=(0,G.jsxs)(`div`,{className:`space-y-5`,children:[v,y,b]}),t[35]=v,t[36]=y,t[37]=b,t[38]=x):x=t[38],x}function ye(e){let t=(0,U.c)(112),{lastRun:n,t:r}=e,{data:i,error:a,isLoading:o,mutate:c}=s(`you-context-settings`,m),l=i?.dreaming??null,[d,f]=te(l),p;t[0]!==d||t[1]!==l?(p=d&&l&&ee(d)!==ee(l),t[0]=d,t[1]=l,t[2]=p):p=t[2];let g=!!p,_;t[3]===c?_=t[4]:(_=async e=>{await k({dreaming:e}),await c()},t[3]=c,t[4]=_);let v;t[5]!==d||t[6]!==g||t[7]!==_?(v={value:d,dirty:g,delayMs:500,onSave:_},t[5]=d,t[6]=g,t[7]=_,t[8]=v):v=t[8];let y=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||!d){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 b=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=y.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]===f?T=t[23]:(T=e=>f(t=>t&&{...t,mode:e.target.value}),t[22]=f,t[23]=T);let E;t[24]===r.on?E=t[25]:(E=(0,G.jsx)(L,{value:`review`,children:r.on}),t[24]=r.on,t[25]=E);let D;t[26]===r.off?D=t[27]:(D=(0,G.jsx)(L,{value:`off`,children:r.off}),t[26]=r.off,t[27]=D);let O;t[28]!==d.mode||t[29]!==D||t[30]!==T||t[31]!==E?(O=(0,G.jsxs)(x,{value:d.mode,onChange:T,children:[E,D]}),t[28]=d.mode,t[29]=D,t[30]=T,t[31]=E,t[32]=O):O=t[32];let j;t[33]!==O||t[34]!==w?(j=(0,G.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[w,O]}),t[33]=O,t[34]=w,t[35]=j):j=t[35];let M;t[36]===r.reviewTime?M=t[37]:(M=(0,G.jsx)(`span`,{className:`font-medium text-fg`,children:r.reviewTime}),t[36]=r.reviewTime,t[37]=M);let N;t[38]===f?N=t[39]:(N=e=>f(t=>t&&{...t,schedule:{time:e.target.value}}),t[38]=f,t[39]=N);let P;t[40]!==d.schedule.time||t[41]!==N?(P=(0,G.jsx)(`input`,{type:`time`,className:q,value:d.schedule.time,onChange:N}),t[40]=d.schedule.time,t[41]=N,t[42]=P):P=t[42];let F;t[43]!==M||t[44]!==P?(F=(0,G.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[M,P]}),t[43]=M,t[44]=P,t[45]=F):F=t[45];let I;t[46]===r.timezone?I=t[47]:(I=(0,G.jsx)(`span`,{className:`font-medium text-fg`,children:r.timezone}),t[46]=r.timezone,t[47]=I);let R=d.timezone??``,V;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(V=h(),t[48]=V):V=t[48];let H;t[49]===f?H=t[50]:(H=e=>f(t=>t&&{...t,timezone:e.target.value||void 0}),t[49]=f,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]===f?K=t[55]:(K=()=>f(be),t[54]=f,t[55]=K);let J;t[56]!==r.detect||t[57]!==K?(J=(0,G.jsx)(A,{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]!==I||t[63]!==Y?(X=(0,G.jsxs)(`label`,{className:`space-y-1.5 text-sm sm:col-span-2`,children:[I,Y]}),t[62]=I,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]===f?re=t[68]:(re=e=>f(t=>t&&{...t,minEvidenceSources:Number(e.target.value)}),t[67]=f,t[68]=re);let ie;t[69]!==d.minEvidenceSources||t[70]!==re?(ie=(0,G.jsx)(`input`,{type:`number`,min:2,max:10,className:q,value:d.minEvidenceSources,onChange:re}),t[69]=d.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]===f?se=t[78]:(se=e=>f(t=>t&&{...t,limit:Number(e.target.value)}),t[77]=f,t[78]=se);let ce;t[79]!==d.limit||t[80]!==se?(ce=(0,G.jsx)(`input`,{type:`number`,min:1,max:2e3,className:q,value:d.limit,onChange:se}),t[79]=d.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]!==j||t[86]!==F||t[87]!==X||t[88]!==ae||t[89]!==le?(ue=(0,G.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[j,F,X,ae,le]}),t[85]=j,t[86]=F,t[87]=X,t[88]=ae,t[89]=le,t[90]=ue):ue=t[90];let de;t[91]!==y.error||t[92]!==y.status?(de=(0,G.jsx)(`div`,{className:`mt-5 flex justify-end`,children:(0,G.jsx)(z,{status:y.status,error:y.error})}),t[91]=y.error,t[92]=y.status,t[93]=de):de=t[93];let fe;t[94]!==y.onBlurCapture||t[95]!==ue||t[96]!==de?(fe=(0,G.jsx)(Z,{children:(0,G.jsxs)(`div`,{onBlurCapture:C,children:[ue,de]})}),t[94]=y.onBlurCapture,t[95]=ue,t[96]=de,t[97]=fe):fe=t[97];let $;t[98]===r.lastRun?$=t[99]:($=(0,G.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:r.lastRun}),t[98]=r.lastRun,t[99]=$);let pe;t[100]!==n||t[101]!==b||t[102]!==r.neverRun||t[103]!==r.runItems?(pe=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:b}),(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]=b,t[102]=r.neverRun,t[103]=r.runItems,t[104]=pe):pe=t[104];let me;t[105]!==$||t[106]!==pe?(me=(0,G.jsxs)(Z,{children:[$,pe]}),t[105]=$,t[106]=pe,t[107]=me):me=t[107];let he;return t[108]!==fe||t[109]!==me||t[110]!==S?(he=(0,G.jsxs)(`div`,{className:`space-y-5`,children:[S,fe,me]}),t[108]=fe,t[109]=me,t[110]=S,t[111]=he):he=t[111],he}function be(e){return e&&{...e,timezone:h()}}function xe(e){let t=(0,U.c)(49),{t:n}=e,{data:r,error:i,isLoading:a,mutate:o}=s(`you-context-settings`,m),c=r?.privacy.sensitiveWritePolicy??null,[l,d]=te(c),f=!!(l&&c&&l!==c),p;t[0]===o?p=t[1]:(p=async e=>{await k({privacy:{sensitiveWritePolicy:e}}),await o()},t[0]=o,t[1]=p);let h;t[2]!==l||t[3]!==f||t[4]!==p?(h={value:l,dirty:f,delayMs:350,onSave:p},t[2]=l,t[3]=f,t[4]=p,t[5]=h):h=t[5];let g=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 _;t[15]===n.privacyHint?_=t[16]:(_=(0,G.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:n.privacyHint}),t[15]=n.privacyHint,t[16]=_);let v;t[17]===n.sensitivePolicy?v=t[18]:(v=(0,G.jsx)(`span`,{className:`font-medium text-fg`,children:n.sensitivePolicy}),t[17]=n.sensitivePolicy,t[18]=v);let y;t[19]===d?y=t[20]:(y=e=>d(e.target.value),t[19]=d,t[20]=y);let b;t[21]===n.policyDeny?b=t[22]:(b=(0,G.jsx)(L,{value:`deny`,children:n.policyDeny}),t[21]=n.policyDeny,t[22]=b);let S;t[23]===n.policyConfirm?S=t[24]:(S=(0,G.jsx)(L,{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)(L,{value:`allow`,children:n.policyAllow}),t[25]=n.policyAllow,t[26]=C);let w;t[27]!==l||t[28]!==y||t[29]!==b||t[30]!==S||t[31]!==C?(w=(0,G.jsxs)(x,{value:l,onChange:y,children:[b,S,C]}),t[27]=l,t[28]=y,t[29]=b,t[30]=S,t[31]=C,t[32]=w):w=t[32];let T;t[33]!==w||t[34]!==v?(T=(0,G.jsxs)(`label`,{className:`block max-w-xl space-y-1.5 text-sm`,children:[v,w]}),t[33]=w,t[34]=v,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 D;t[38]!==g.error||t[39]!==g.status?(D=(0,G.jsx)(`div`,{className:`mt-5 flex justify-end`,children:(0,G.jsx)(z,{status:g.status,error:g.error})}),t[38]=g.error,t[39]=g.status,t[40]=D):D=t[40];let O;t[41]!==g.onBlurCapture||t[42]!==T||t[43]!==E||t[44]!==D?(O=(0,G.jsx)(Z,{children:(0,G.jsxs)(`div`,{onBlurCapture:g.onBlurCapture,children:[T,E,D]})}),t[41]=g.onBlurCapture,t[42]=T,t[43]=E,t[44]=D,t[45]=O):O=t[45];let A;return t[46]!==O||t[47]!==_?(A=(0,G.jsxs)(`div`,{className:`space-y-5`,children:[_,O]}),t[46]=O,t[47]=_,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-deR2zRaE.js";import{Ra as o,ns as s}from"./index-CYT5DOzr.js";e();var c=t();function l(){return{enabled:!0,provider:`xopc-local`,alibaba:{model:`paraformer-v2`},openai:{model:`whisper-1`},providers:{"xopc-local":{model:`sensevoice-small`}},fallback:{enabled:!1,order:[`xopc-local`]}}}function u(){return{enabled:!0,provider:`edge`,trigger:`inbound`,maxTextLength:512,timeoutMs:6e4,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 d(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function f(e){return typeof e==`string`&&e.trim().length>0?e.trim():`xopc-local`}function p(e,t,n){let r=d(e.providers)?e.providers:void 0,i=r&&d(r[t])?r[t]:void 0;return{...n,...i??{}}}function m(e){let t=l();if(!d(e))return t;let n=f(e.provider),r=p(e,`alibaba`,t.alibaba??{}),i=p(e,`openai`,t.openai??{}),a=t.fallback??{enabled:!1,order:[`xopc-local`]};if(d(e.fallback)){let t=Array.isArray(e.fallback.order)?e.fallback.order.filter(e=>typeof e==`string`&&e.trim().length>0):a.order;a={enabled:typeof e.fallback.enabled==`boolean`?e.fallback.enabled:a.enabled,order:t.length?t:a.order}}let o=d(e.providers)?Object.fromEntries(Object.entries(e.providers).map(([e,t])=>[e,d(t)?{...t}:{}])):void 0;return{enabled:!!e.enabled,provider:n,alibaba:r,openai:i,...o?{providers:o}:{},fallback:a}}function h(e){return typeof e==`string`&&e.trim().length>0?e.trim():`edge`}function g(e){let t=u();if(!d(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[`tts-local-cli`]??{},a=d(e.providers)?Object.fromEntries(Object.entries(e.providers).map(([e,t])=>[e,d(t)?{...t}:{}])):void 0;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,...a?{providers:a}:{},alibaba:p(e,`alibaba`,t.alibaba??{}),openai:p(e,`openai`,t.openai??{}),edge:p(e,`edge`,t.edge??{}),minimax:p(e,`minimax`,t.minimax??{}),"tts-local-cli":p(e,`tts-local-cli`,i)}}function _(e){let{alibaba:t,openai:n,providers:r,...i}=e,a={...r??{}};return t&&(a.alibaba={...a.alibaba??{},...t}),n&&(a.openai={...a.openai??{},...n}),{...i,...Object.keys(a).length>0?{providers:a}:{}}}function v(e){let{alibaba:t,openai:n,edge:r,minimax:i,"tts-local-cli":a,providers:o,...s}=e,c={...o??{}};return t&&(c.alibaba={...c.alibaba??{},...t}),n&&(c.openai={...c.openai??{},...n}),r&&(c.edge={...c.edge??{},...r}),i&&(c.minimax={...c.minimax??{},...i}),a&&(c[`tts-local-cli`]={...c[`tts-local-cli`]??{},...a}),{...s,...Object.keys(c).length>0?{providers:c}:{}}}function y(e){let t=d(e)?e:{},n=d(t.voice)?t.voice:{},r=d(n.input)?n.input:{},i=d(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`)),o()}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:o,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]!==o?(_=(0,A.jsx)(s,{id:a,value:o,onChange:l,placeholder:p,labels:u,reveal:h,loadFailedLabel:u.loadFailed,maskedHelp:u.maskedHelp,notInConfigFile:u.notInConfigFile,inputClassName:`text-xs`}),t[5]=a,t[6]=u,t[7]=l,t[8]=p,t[9]=h,t[10]=o,t[11]=_):_=t[11];let v;return t[12]!==g||t[13]!==_?(v=(0,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{b as a,y as c,O as d,C as i,x as l,T as n,w as o,S as r,E as s,j as t,D 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-deR2zRaE.js";import{Ra as o,ns as s}from"./index-B-_CEvIX.js";e();var c=t();function l(){return{enabled:!0,provider:`xopc-local`,alibaba:{model:`paraformer-v2`},openai:{model:`whisper-1`},providers:{"xopc-local":{model:`sensevoice-small`}},fallback:{enabled:!1,order:[`xopc-local`]}}}function u(){return{enabled:!0,provider:`edge`,trigger:`inbound`,maxTextLength:512,timeoutMs:6e4,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 d(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function f(e){return typeof e==`string`&&e.trim().length>0?e.trim():`xopc-local`}function p(e,t,n){let r=d(e.providers)?e.providers:void 0,i=r&&d(r[t])?r[t]:void 0;return{...n,...i??{}}}function m(e){let t=l();if(!d(e))return t;let n=f(e.provider),r=p(e,`alibaba`,t.alibaba??{}),i=p(e,`openai`,t.openai??{}),a=t.fallback??{enabled:!1,order:[`xopc-local`]};if(d(e.fallback)){let t=Array.isArray(e.fallback.order)?e.fallback.order.filter(e=>typeof e==`string`&&e.trim().length>0):a.order;a={enabled:typeof e.fallback.enabled==`boolean`?e.fallback.enabled:a.enabled,order:t.length?t:a.order}}let o=d(e.providers)?Object.fromEntries(Object.entries(e.providers).map(([e,t])=>[e,d(t)?{...t}:{}])):void 0;return{enabled:!!e.enabled,provider:n,alibaba:r,openai:i,...o?{providers:o}:{},fallback:a}}function h(e){return typeof e==`string`&&e.trim().length>0?e.trim():`edge`}function g(e){let t=u();if(!d(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[`tts-local-cli`]??{},a=d(e.providers)?Object.fromEntries(Object.entries(e.providers).map(([e,t])=>[e,d(t)?{...t}:{}])):void 0;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,...a?{providers:a}:{},alibaba:p(e,`alibaba`,t.alibaba??{}),openai:p(e,`openai`,t.openai??{}),edge:p(e,`edge`,t.edge??{}),minimax:p(e,`minimax`,t.minimax??{}),"tts-local-cli":p(e,`tts-local-cli`,i)}}function _(e){let{alibaba:t,openai:n,providers:r,...i}=e,a={...r??{}};return t&&(a.alibaba={...a.alibaba??{},...t}),n&&(a.openai={...a.openai??{},...n}),{...i,...Object.keys(a).length>0?{providers:a}:{}}}function v(e){let{alibaba:t,openai:n,edge:r,minimax:i,"tts-local-cli":a,providers:o,...s}=e,c={...o??{}};return t&&(c.alibaba={...c.alibaba??{},...t}),n&&(c.openai={...c.openai??{},...n}),r&&(c.edge={...c.edge??{},...r}),i&&(c.minimax={...c.minimax??{},...i}),a&&(c[`tts-local-cli`]={...c[`tts-local-cli`]??{},...a}),{...s,...Object.keys(c).length>0?{providers:c}:{}}}function y(e){let t=d(e)?e:{},n=d(t.voice)?t.voice:{},r=d(n.input)?n.input:{},i=d(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`)),o()}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:o,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]!==o?(_=(0,A.jsx)(s,{id:a,value:o,onChange:l,placeholder:p,labels:u,reveal:h,loadFailedLabel:u.loadFailed,maskedHelp:u.maskedHelp,notInConfigFile:u.notInConfigFile,inputClassName:`text-xs`}),t[5]=a,t[6]=u,t[7]=l,t[8]=p,t[9]=h,t[10]=o,t[11]=_):_=t[11];let v;return t[12]!==g||t[13]!==_?(v=(0,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{b as a,y as c,O as d,C as i,x as l,T as n,w as o,S as r,E as s,j as t,D 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-B4XqB8I6.js";import{n as a}from"./locale-store-deR2zRaE.js";import{Do as o,Eo as s,Oo as c,So as l,To as u,Za as d,ds as f,fs as p,ms as m,wo as h}from"./index-CYT5DOzr.js";import{WorkDiscoveryPage as g}from"./work-discovery-page-BWds95sL.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)(p,{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)(c,{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)(u,{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)(m,{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)(o,{children:[z,(0,y.jsx)(h,{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-B4XqB8I6.js";import{n as a}from"./locale-store-deR2zRaE.js";import{Do as o,Eo as s,Oo as c,So as l,To as u,Za as d,ds as f,fs as p,ms as m,wo as h}from"./index-B-_CEvIX.js";import{WorkDiscoveryPage as g}from"./work-discovery-page-C5Kwe_bc.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)(p,{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)(c,{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)(u,{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)(m,{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)(o,{children:[z,(0,y.jsx)(h,{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 +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-B4XqB8I6.js";import{n as te}from"./locale-store-deR2zRaE.js";import{$a as ne,At as re,Ba as s,Et as ie,Fl as ae,Ks as c,Nc as l,Qa as oe,Yl as se,Za as u,Zl as ce,ao as le,cl as ue,co as d,ds as f,eo as de,fl as p,fs as fe,gl as pe,io as me,lo as he,ms as m,no as h,oo as ge,ro as g,so as _e,to as ve}from"./index-CYT5DOzr.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=n(),xe=[`folder_structure`,`recent_progress`,`next_steps`];function b(e){return e instanceof Error?e.message:String(e)}function x({embedded:e=!1,onRequestClose:t}={}){let n=te(e=>e.language),v=ee(n).onboarding.workDiscovery,ye=ee(n).chat.workingDirectory,x=i(),[Se]=r(),Ce=e||Se.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),[we,M]=(0,_.useState)(!1),[N,P]=(0,_.useState)(``),[F,I]=(0,_.useState)(!1),[L,R]=(0,_.useState)(()=>new Set),[z,Te]=(0,_.useState)([]),[B,Ee]=(0,_.useState)(()=>new Set),[De,V]=(0,_.useState)([]),[Oe,ke]=(0,_.useState)(!1),[H,U]=(0,_.useState)({current:0,total:0}),[Ae,je]=(0,_.useState)([]),[W,Me]=(0,_.useState)(()=>new Set),G=(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)}),()=>{e=!0}},[]);let K=(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}Te(e),Ee(new Set([e[0].rootPath])),C(`candidates`)}catch(e){j(b(e))}finally{k(!1)}},Fe=e=>{Ee(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),U({current:t+1,total:n}),V(n=>{let r=[...n];return r[t]=e,r}),C(`running`)},[]),Le=(0,_.useCallback)(e=>{V(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),V([]),U({current:1,total:e.length}),ke(!0),G.current=!1;let t=!1;try{let n=await be(e,{grantDirectory:g,startRun:_e,fetchRun:h,shouldStop:()=>G.current,onRun:(e,n,r)=>{Ie(e,n,r),t||(t=!0,u.getState().collectSources(e.id,[...W]))},onError:(t,n,r)=>{U({current:r+1,total:e.length}),j(v.folderAnalysisFailed.replace(`{{folder}}`,n.displayName).replace(`{{error}}`,b(t)))}});if(G.current)return;let r=n.find(e=>e.status===`completed`)??n.at(-1);r?K(r):C(`candidates`)}catch(e){j(b(e)),C(`candidates`)}finally{ke(!1),k(!1)}},q=re({onPicked:(0,_.useCallback)(async e=>{k(!0),j(null);try{T(await me(e)),C(`consent`)}catch(e){j(b(e)),C(`intro`)}finally{k(!1)}},[])});(0,_.useEffect)(()=>{let e=!1;return ve().then(async({enabled:n,state:r})=>{if(!e){if(!n){t?t():x(`/chat`,{replace:!0});return}if(!Ce&&r.activeRunId)try{let t=await h(r.activeRunId);e||K(t);return}catch{}e||C(`intro`)}}).catch(t=>{e||(j(b(t)),C(`intro`))}),()=>{e=!0}},[K,x,t,Ce]),(0,_.useEffect)(()=>{if(!E||S!==`running`||Oe)return;let e=!1,t=async()=>{try{let t=await h(E.id);e||K(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)}},[K,Oe,S,E]);let J=async()=>{k(!0);try{await de()}finally{t?t():x(`/chat`,{replace:!0})}},ze=async()=>{if(w){k(!0),j(null),V([]),U({current:0,total:0});try{await g(w.canonicalRootPath);let e=await _e(w.canonicalRootPath);K(e),u.getState().collectSources(e.id,[...W])}catch(e){j(b(e)),C(`consent`)}finally{k(!1)}}},Y=(e,t)=>{let n=t?`?draft=${encodeURIComponent(t)}`:``;x(`/chat/${encodeURIComponent(e)}${n}`)},Be=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`)},Ve=async()=>{E&&(G.current=!0,K(await oe(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)},He=async()=>{if(E){k(!0),j(null);try{let e=E.result?.profileCandidates??[],t=await d((e.length>0?await he(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(b(e))}finally{k(!1)}}},Z=async e=>{if(!(!E||!N.trim())){k(!0),j(null);try{let t=await d(E.id,e,N.trim());D(t),Y(t.sessionKey,N.trim())}catch(e){j(b(e)),k(!1)}}},Ue=async()=>{if(E){k(!0);try{Y((await d(E.id,`dismissed`)).sessionKey)}catch(e){j(b(e)),k(!1)}}},Q=E?.result?.suggestions.find(e=>e.id===E.result?.primarySuggestionId)??E?.result?.suggestions[0],We=E?.result?.suggestions.filter(e=>e.id!==Q?.id)??[],Ge=e=>e===`command`?v.riskCommand:e===`file_write`?v.riskFileWrite:v.riskAnalysis,Ke=De.filter(e=>e?.status===`completed`),qe=e&&S===`candidates`,$=Ke.length>1?(0,y.jsxs)(`div`,{className:`mt-6 rounded-xl border border-edge bg-surface-panel p-2`,children:[(0,y.jsx)(`p`,{className:`px-2 pb-2 text-xs font-medium text-fg-muted`,children:v.analysisResults}),(0,y.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:Ke.map(e=>{let t=z.find(t=>t.rootPath===e.rootPath)?.displayName??e.rootPath.split(/[\\/]/).filter(Boolean).at(-1)??e.rootPath;return(0,y.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:()=>Be(e),children:t},e.id)})})]}):null;return(0,y.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,y.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 ${qe?`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,y.jsx)(`div`,{className:`mb-10 flex items-center justify-center`,children:(0,y.jsx)(fe,{className:`size-11`})}),S===`loading`?(0,y.jsxs)(`div`,{className:`mx-auto flex min-h-[26rem] w-full max-w-md flex-col items-center`,"aria-busy":!0,children:[(0,y.jsx)(s,{className:`h-8 w-64 max-w-full`}),(0,y.jsx)(s,{className:`mt-4 h-4 w-full max-w-sm`}),(0,y.jsx)(s,{className:`mt-2 h-4 w-4/5 max-w-xs`}),(0,y.jsx)(s,{className:`mt-10 h-12 w-full rounded-xl`}),(0,y.jsx)(s,{className:`mt-3 h-11 w-full rounded-xl`}),(0,y.jsx)(s,{className:`mt-5 h-4 w-3/5 max-w-56`})]}):null,S===`intro`?(0,y.jsxs)(`section`,{className:`flex flex-1 flex-col text-center`,"aria-labelledby":`work-discovery-title`,children:[(0,y.jsxs)(`div`,{className:`mx-auto max-w-[36rem]`,children:[(0,y.jsx)(`h1`,{id:`work-discovery-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:v.title}),(0,y.jsx)(`p`,{className:`mx-auto mt-3 max-w-[34rem] text-[0.95rem] leading-7 text-fg-muted`,children:v.subtitle})]}),(0,y.jsxs)(`div`,{className:`mx-auto mt-9 w-full max-w-md`,children:[Ae.length?(0,y.jsxs)(`div`,{className:`mb-5 rounded-xl border border-edge bg-surface-panel p-3 text-left`,children:[(0,y.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:v.localSourcesTitle}),(0,y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:v.localSourcesSubtitle}),(0,y.jsx)(`div`,{className:`mt-3 grid grid-cols-2 gap-2 sm:grid-cols-3`,children:Ae.map(e=>{let t=W.has(e.id);return(0,y.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,y.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,y.jsx)(a,{className:`size-3`,"aria-hidden":!0}):null}),e.displayName]},e.id)})})]}):null,(0,y.jsxs)(f,{type:`button`,className:`h-12 w-full gap-2 bg-accent text-white hover:bg-accent-hover`,onClick:()=>void Pe(),disabled:O||q.picking,children:[O?(0,y.jsx)(l,{className:`size-4 animate-spin`}):(0,y.jsx)(c,{className:`size-4`}),v.quickScan]}),(0,y.jsxs)(f,{type:`button`,variant:`secondary`,className:`mt-3 h-11 w-full gap-2`,onClick:q.pick,disabled:O||q.picking,children:[q.picking?(0,y.jsx)(l,{className:`size-4 animate-spin`}):(0,y.jsx)(p,{className:`size-4`}),v.chooseFolderManually]}),(0,y.jsxs)(`div`,{className:`mt-4 flex items-start justify-center gap-2 text-xs leading-5 text-fg-muted`,children:[(0,y.jsx)(c,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`}),(0,y.jsx)(`span`,{children:v.quickScanNote})]}),(0,y.jsx)(`button`,{type:`button`,className:`mt-4 text-sm font-medium text-accent-fg hover:underline`,onClick:()=>x(`/connectors?understanding=1&returnTo=%2Fonboarding%2Fworkspace`),children:v.connectCloudSource}),A?(0,y.jsx)(`p`,{className:`mt-4 text-sm text-danger`,role:`alert`,children:A}):null]}),(0,y.jsx)(`button`,{type:`button`,className:`mx-auto mt-auto pt-10 text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>void J(),disabled:O,children:v.skip})]}):null,S===`candidates`?(0,y.jsxs)(`section`,{className:e?`flex h-full min-h-0 flex-col`:void 0,"aria-labelledby":`work-discovery-candidates-title`,children:[(0,y.jsxs)(`div`,{className:e?`shrink-0 text-center`:`text-center`,children:[(0,y.jsx)(`h1`,{id:`work-discovery-candidates-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:v.candidatesTitle}),(0,y.jsx)(`p`,{className:`mt-3 text-[0.95rem] leading-7 text-fg-muted`,children:v.candidatesSubtitle})]}),(0,y.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,y.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,y.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,y.jsx)(a,{className:`size-3.5`})}),(0,y.jsx)(p,{className:`mt-0.5 size-5 shrink-0 text-accent-fg`}),(0,y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,y.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,y.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.displayName}),t===0?(0,y.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,y.jsx)(`span`,{className:`mt-1 block truncate font-mono text-xs text-fg-muted`,children:e.rootPath}),(0,y.jsxs)(`span`,{className:`mt-2 flex flex-wrap gap-x-3 gap-y-1 text-xs text-fg-muted`,children:[(0,y.jsx)(`span`,{children:e.projectKind===`coding`?v.codingProject:e.projectKind===`general`?v.generalProject:v.unknownProject}),e.branch?(0,y.jsx)(`span`,{children:v.branchValue.replace(`{{branch}}`,e.branch)}):null,e.changedFileCount>0?(0,y.jsx)(`span`,{children:v.changedFiles.replace(`{{count}}`,String(e.changedFileCount))}):null]})]})]},e.id)})}),(0,y.jsxs)(`div`,{className:e?`shrink-0 border-t border-edge-subtle pt-4`:void 0,children:[(0,y.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,y.jsx)(c,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`}),(0,y.jsx)(`span`,{children:v.multiFolderPrivacyNote})]}),A?(0,y.jsx)(`p`,{className:`mt-3 text-sm text-danger`,role:`alert`,children:A}):null,(0,y.jsxs)(`div`,{className:`${e?`mt-4`:`mt-7`} flex flex-col gap-3 sm:flex-row-reverse`,children:[(0,y.jsxs)(f,{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,y.jsx)(l,{className:`mr-2 size-4 animate-spin`}):null,v.analyzeSelected.replace(`{{count}}`,String(B.size))]}),(0,y.jsx)(f,{type:`button`,variant:`secondary`,className:`h-11 flex-1`,disabled:O,onClick:q.pick,children:v.chooseFolderManually})]}),(0,y.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,y.jsxs)(`section`,{"aria-labelledby":`work-discovery-consent-title`,children:[(0,y.jsxs)(`div`,{className:`text-center`,children:[(0,y.jsx)(`h1`,{id:`work-discovery-consent-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:v.selectedTitle}),(0,y.jsx)(`p`,{className:`mt-3 text-[0.95rem] leading-7 text-fg-muted`,children:v.selectedSubtitle})]}),(0,y.jsxs)(`div`,{className:`mt-8 overflow-hidden rounded-xl border border-edge bg-surface-panel`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-edge-subtle px-4 py-3.5`,children:[(0,y.jsx)(p,{className:`size-5 shrink-0 text-accent-fg`}),(0,y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,y.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:w.displayName}),(0,y.jsx)(`p`,{className:`truncate font-mono text-xs text-fg-muted`,children:w.canonicalRootPath})]}),(0,y.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,y.jsxs)(`div`,{className:`grid gap-3 border-b border-edge-subtle bg-surface-base/60 p-4 sm:grid-cols-2`,children:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:v.localFingerprint}),(0,y.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:w.fingerprint.branch?v.branchValue.replace(`{{branch}}`,w.fingerprint.branch):v.noGitBranch})]}),(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:v.recentActivity}),(0,y.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:v.changedFiles.replace(`{{count}}`,String(w.fingerprint.changedFileCount))})]}),w.fingerprint.recentAreas.length>0?(0,y.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,y.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:v.recentAreas}),(0,y.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:w.fingerprint.recentAreas.map(e=>(0,y.jsx)(`code`,{className:`rounded-md bg-surface-muted px-2 py-1 text-xs text-fg`,children:e},e))})]}):null]}),(0,y.jsxs)(`div`,{className:`divide-y divide-edge-subtle px-4`,children:[(0,y.jsxs)(`div`,{className:`flex gap-3 py-4`,children:[(0,y.jsx)(pe,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`}),(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:v.willRead}),(0,y.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:v.willReadValue})]})]}),(0,y.jsxs)(`div`,{className:`flex gap-3 py-4`,children:[(0,y.jsx)(m,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`}),(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:v.willIgnore}),(0,y.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:v.willIgnoreValue})]})]}),(0,y.jsxs)(`div`,{className:`flex gap-3 py-4`,children:[(0,y.jsx)(c,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`}),(0,y.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:w.remoteModel?v.providerDisclosure.replace(`{{provider}}`,w.provider):v.localDisclosure})]})]})]}),A?(0,y.jsx)(`p`,{className:`mt-4 text-sm text-danger`,role:`alert`,children:A}):null,(0,y.jsxs)(`div`,{className:`mt-7 flex flex-col gap-3 sm:flex-row-reverse`,children:[(0,y.jsxs)(f,{type:`button`,className:`h-11 flex-1 bg-accent text-white hover:bg-accent-hover`,disabled:O,onClick:()=>void ze(),children:[O?(0,y.jsx)(l,{className:`mr-2 size-4 animate-spin`}):null,v.startAnalysis]}),(0,y.jsx)(f,{type:`button`,variant:`secondary`,className:`h-11 flex-1`,disabled:O,onClick:q.pick,children:v.changeFolder})]}),(0,y.jsx)(`button`,{type:`button`,className:`mx-auto mt-6 block text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>void J(),children:v.skip})]}):null,S===`running`&&E?(0,y.jsxs)(`section`,{"aria-labelledby":`work-discovery-running-title`,"aria-live":`polite`,children:[(0,y.jsxs)(`div`,{className:`text-center`,children:[(0,y.jsx)(`h1`,{id:`work-discovery-running-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:v.analyzingTitle}),(0,y.jsx)(`p`,{className:`mt-3 text-[0.95rem] leading-7 text-fg-muted`,children:v.analyzingSubtitle}),H.total>1?(0,y.jsx)(`p`,{className:`mt-2 text-sm font-medium text-accent-fg`,children:v.analyzingFolderProgress.replace(`{{current}}`,String(H.current)).replace(`{{total}}`,String(H.total))}):null]}),(0,y.jsx)(`div`,{className:`mt-9 rounded-xl border border-edge bg-surface-panel px-5 py-2`,children:xe.map((e,t)=>{let n=Math.max(0,xe.indexOf(E.stage??`folder_structure`)),r=t<n,i=t===n;return(0,y.jsxs)(`div`,{className:`flex items-center gap-4 border-b border-edge-subtle py-4 last:border-b-0`,children:[(0,y.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,y.jsx)(a,{className:`size-4`}):i?(0,y.jsx)(l,{className:`size-4 animate-spin motion-reduce:animate-none`}):(0,y.jsx)(`span`,{className:`size-1.5 rounded-full bg-current`})}),(0,y.jsx)(`span`,{className:i||r?`text-sm font-medium text-fg`:`text-sm text-fg-muted`,children:v.stages[e]})]},e)})}),(0,y.jsx)(`p`,{className:`mt-4 truncate text-center font-mono text-xs text-fg-muted`,children:E.rootPath}),(0,y.jsxs)(`div`,{className:`mx-auto mt-7 flex max-w-md flex-col gap-3`,children:[(0,y.jsx)(f,{type:`button`,variant:`secondary`,className:`h-11 w-full`,onClick:()=>x(`/chat`),children:v.continueInBackground}),(0,y.jsx)(`button`,{type:`button`,className:`mx-auto text-sm text-fg-muted hover:text-danger hover:underline`,onClick:()=>void Ve(),children:v.cancelAnalysis})]})]}):null,S===`recognition`&&E?.result?(0,y.jsxs)(`section`,{"aria-labelledby":`work-discovery-recognition-title`,children:[(0,y.jsxs)(`div`,{className:`text-center`,children:[(0,y.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.16em] text-accent-fg`,children:v.recognitionEyebrow}),(0,y.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,y.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,y.jsx)(`p`,{className:`text-base font-medium leading-7 text-fg`,children:E.result.projectSummary}),(0,y.jsx)(`p`,{className:`mt-3 text-sm leading-6 text-fg-muted`,children:E.result.currentState}),!E.result.lowConfidence&&Q?.evidence.length?(0,y.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,y.jsxs)(`li`,{className:`flex gap-2 text-xs leading-5 text-fg-muted`,children:[(0,y.jsx)(ue,{className:`mt-0.5 size-3.5 shrink-0 text-accent-fg`}),(0,y.jsxs)(`span`,{children:[e.path?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`code`,{className:`font-mono text-fg`,children:e.path}),`: `]}):null,e.observation]})]},`${Q.id}-recognition-${t}`))}):null]}),E.result.workThreads?.length?(0,y.jsxs)(`div`,{className:`mt-5 rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,y.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:v.workThreadsTitle}),(0,y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:v.workThreadsSubtitle}),(0,y.jsx)(`div`,{className:`mt-3 divide-y divide-edge-subtle`,children:E.result.workThreads.map(e=>(0,y.jsxs)(`div`,{className:`py-3 first:pt-0 last:pb-0`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,y.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,y.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:e.title})]}),(0,y.jsx)(`p`,{className:`mt-1.5 text-xs leading-5 text-fg-muted`,children:e.summary})]},e.id))})]}):null,E.result.profileCandidates?.length?(0,y.jsxs)(`div`,{className:`mt-5 rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,y.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:v.profileCandidatesTitle}),(0,y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:v.profileCandidatesSubtitle}),(0,y.jsx)(`div`,{className:`mt-3 space-y-2`,children:E.result.profileCandidates.map(e=>(0,y.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3 rounded-lg px-2 py-2 hover:bg-surface-muted`,children:[(0,y.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,y.jsx)(`span`,{className:`text-sm leading-5 text-fg`,children:e.statement})]},e.id))})]}):null,E.result.lowConfidence?(0,y.jsxs)(`div`,{className:`mt-5`,children:[(0,y.jsx)(`p`,{className:`text-sm font-medium leading-6 text-fg`,children:E.result.contextQuestion}),(0,y.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,y.jsx)(f,{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,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(`div`,{className:`mt-6 flex flex-col gap-3 sm:flex-row-reverse`,children:[(0,y.jsxs)(f,{className:`h-11 flex-1 bg-accent text-white hover:bg-accent-hover`,disabled:O,onClick:()=>void He(),children:[O?(0,y.jsx)(l,{className:`size-4 animate-spin`}):(0,y.jsx)(a,{className:`size-4`}),v.confirmUnderstanding]}),(0,y.jsx)(f,{variant:`secondary`,className:`h-11 flex-1`,disabled:O,onClick:()=>M(e=>!e),children:v.notQuiteRight})]}),we?(0,y.jsxs)(`div`,{className:`mt-4 rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,y.jsx)(`label`,{className:`text-sm font-medium text-fg`,htmlFor:`work-discovery-correction`,children:v.correctionLabel}),(0,y.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,y.jsxs)(`div`,{className:`mt-3 flex flex-wrap justify-end gap-2`,children:[(0,y.jsx)(f,{variant:`ghost`,disabled:O||!N.trim(),onClick:()=>void Z(`different_goal`),children:v.differentGoal}),(0,y.jsx)(f,{variant:`primary`,disabled:O||!N.trim(),onClick:()=>void Z(`corrected`),children:v.useCorrection})]})]}):null]}),A?(0,y.jsx)(`p`,{className:`mt-4 text-sm text-danger`,role:`alert`,children:A}):null,(0,y.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 Ue(),children:v.openConversation})]}):null,S===`recommendation`&&E?.result&&Q?(0,y.jsxs)(`section`,{"aria-labelledby":`work-discovery-recommendation-title`,children:[(0,y.jsxs)(`div`,{className:`text-center`,children:[(0,y.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.16em] text-accent-fg`,children:v.understandingConfirmed}),(0,y.jsx)(`h1`,{id:`work-discovery-recommendation-title`,className:`mt-2 text-2xl font-semibold tracking-tight text-fg`,children:v.primaryRecommendationTitle})]}),$,(0,y.jsx)(`article`,{className:`mt-7 rounded-2xl border border-accent/30 bg-surface-panel p-5 sm:p-6`,children:(0,y.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,y.jsx)(`div`,{className:`flex size-9 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-accent-fg`,children:(0,y.jsx)(se,{className:`size-5`})}),(0,y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,y.jsx)(`h2`,{className:`text-lg font-semibold text-fg`,children:Q.title}),(0,y.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:Q.rationale}),(0,y.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2 text-xs`,children:[(0,y.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,y.jsx)(ae,{className:`size-3.5`}),v.estimatedMinutes.replace(`{{count}}`,String(Q.estimatedMinutes))]}),(0,y.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2.5 py-1 text-fg-muted`,children:Ge(Q.risk)})]}),(0,y.jsxs)(`div`,{className:`mt-4 rounded-xl bg-surface-base px-4 py-3`,children:[(0,y.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:v.expectedTask}),(0,y.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg`,children:Q.expectedTask})]}),(0,y.jsxs)(`div`,{className:`mt-5 flex flex-wrap gap-2`,children:[(0,y.jsx)(f,{className:`h-10 bg-accent px-4 text-white hover:bg-accent-hover`,onClick:()=>void X(Q,!1),children:v.startRecommendedAction}),(0,y.jsx)(f,{className:`h-10 px-4`,variant:`secondary`,onClick:()=>void X(Q,!0),children:v.explainFirst})]})]})]})}),We.length>0?(0,y.jsxs)(`div`,{className:`mt-5 border-t border-edge-subtle pt-4`,children:[(0,y.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,y.jsx)(ce,{className:`size-4 transition-transform ${F?`rotate-180`:``}`})]}),F?(0,y.jsx)(`div`,{className:`mt-2 divide-y divide-edge-subtle rounded-xl border border-edge bg-surface-panel px-4`,children:We.map(e=>(0,y.jsxs)(`button`,{type:`button`,className:`flex w-full items-start gap-3 py-4 text-left`,onClick:()=>void X(e,!0),children:[(0,y.jsx)(se,{className:`mt-0.5 size-4 shrink-0 text-fg-subtle`}),(0,y.jsxs)(`span`,{children:[(0,y.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.title}),(0,y.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:e.expectedTask})]})]},e.id))}):null]}):null,(0,y.jsxs)(`div`,{className:`mt-6 flex flex-wrap items-center justify-center gap-x-5 gap-y-3`,children:[(0,y.jsx)(`button`,{type:`button`,className:`text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>Y(E.sessionKey),children:v.doSomethingElse}),(0,y.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,y.jsxs)(`section`,{className:`text-center`,"aria-labelledby":`work-discovery-error-title`,children:[(0,y.jsx)(`div`,{className:`mx-auto flex size-11 items-center justify-center rounded-xl bg-danger-soft text-danger`,children:(0,y.jsx)(m,{className:`size-5`})}),(0,y.jsx)(`h1`,{id:`work-discovery-error-title`,className:`mt-5 text-2xl font-semibold tracking-tight text-fg`,children:v.errorTitle}),(0,y.jsx)(`p`,{className:`mx-auto mt-3 max-w-lg text-sm leading-6 text-fg-muted`,children:E.errorMessage}),(0,y.jsxs)(`div`,{className:`mx-auto mt-7 flex max-w-md flex-col gap-3 sm:flex-row-reverse`,children:[(0,y.jsx)(f,{className:`h-11 flex-1 bg-accent text-white hover:bg-accent-hover`,onClick:()=>void le(E.id).then(K),children:v.retry}),(0,y.jsx)(f,{variant:`secondary`,className:`h-11 flex-1`,onClick:()=>{D(null),T(null),C(`intro`)},children:v.chooseDifferent})]}),(0,y.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]}),q.hasNativePicker?null:(0,y.jsx)(ie,{open:q.modalOpen,onOpenChange:q.setModalOpen,initialAbsolutePath:w?.canonicalRootPath,onConfirm:q.confirmPick,wd:ye})]})}export{x as WorkDiscoveryPage};
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-B4XqB8I6.js";import{n as te}from"./locale-store-deR2zRaE.js";import{$a as ne,At as re,Ba as s,Et as ie,Fl as ae,Ks as c,Nc as l,Qa as oe,Yl as se,Za as u,Zl as ce,ao as le,cl as ue,co as d,ds as f,eo as de,fl as p,fs as fe,gl as pe,io as me,lo as he,ms as m,no as h,oo as ge,ro as g,so as _e,to as ve}from"./index-B-_CEvIX.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=n(),xe=[`folder_structure`,`recent_progress`,`next_steps`];function b(e){return e instanceof Error?e.message:String(e)}function x({embedded:e=!1,onRequestClose:t}={}){let n=te(e=>e.language),v=ee(n).onboarding.workDiscovery,ye=ee(n).chat.workingDirectory,x=i(),[Se]=r(),Ce=e||Se.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),[we,M]=(0,_.useState)(!1),[N,P]=(0,_.useState)(``),[F,I]=(0,_.useState)(!1),[L,R]=(0,_.useState)(()=>new Set),[z,Te]=(0,_.useState)([]),[B,Ee]=(0,_.useState)(()=>new Set),[De,V]=(0,_.useState)([]),[Oe,ke]=(0,_.useState)(!1),[H,U]=(0,_.useState)({current:0,total:0}),[Ae,je]=(0,_.useState)([]),[W,Me]=(0,_.useState)(()=>new Set),G=(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)}),()=>{e=!0}},[]);let K=(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}Te(e),Ee(new Set([e[0].rootPath])),C(`candidates`)}catch(e){j(b(e))}finally{k(!1)}},Fe=e=>{Ee(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),U({current:t+1,total:n}),V(n=>{let r=[...n];return r[t]=e,r}),C(`running`)},[]),Le=(0,_.useCallback)(e=>{V(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),V([]),U({current:1,total:e.length}),ke(!0),G.current=!1;let t=!1;try{let n=await be(e,{grantDirectory:g,startRun:_e,fetchRun:h,shouldStop:()=>G.current,onRun:(e,n,r)=>{Ie(e,n,r),t||(t=!0,u.getState().collectSources(e.id,[...W]))},onError:(t,n,r)=>{U({current:r+1,total:e.length}),j(v.folderAnalysisFailed.replace(`{{folder}}`,n.displayName).replace(`{{error}}`,b(t)))}});if(G.current)return;let r=n.find(e=>e.status===`completed`)??n.at(-1);r?K(r):C(`candidates`)}catch(e){j(b(e)),C(`candidates`)}finally{ke(!1),k(!1)}},q=re({onPicked:(0,_.useCallback)(async e=>{k(!0),j(null);try{T(await me(e)),C(`consent`)}catch(e){j(b(e)),C(`intro`)}finally{k(!1)}},[])});(0,_.useEffect)(()=>{let e=!1;return ve().then(async({enabled:n,state:r})=>{if(!e){if(!n){t?t():x(`/chat`,{replace:!0});return}if(!Ce&&r.activeRunId)try{let t=await h(r.activeRunId);e||K(t);return}catch{}e||C(`intro`)}}).catch(t=>{e||(j(b(t)),C(`intro`))}),()=>{e=!0}},[K,x,t,Ce]),(0,_.useEffect)(()=>{if(!E||S!==`running`||Oe)return;let e=!1,t=async()=>{try{let t=await h(E.id);e||K(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)}},[K,Oe,S,E]);let J=async()=>{k(!0);try{await de()}finally{t?t():x(`/chat`,{replace:!0})}},ze=async()=>{if(w){k(!0),j(null),V([]),U({current:0,total:0});try{await g(w.canonicalRootPath);let e=await _e(w.canonicalRootPath);K(e),u.getState().collectSources(e.id,[...W])}catch(e){j(b(e)),C(`consent`)}finally{k(!1)}}},Y=(e,t)=>{let n=t?`?draft=${encodeURIComponent(t)}`:``;x(`/chat/${encodeURIComponent(e)}${n}`)},Be=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`)},Ve=async()=>{E&&(G.current=!0,K(await oe(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)},He=async()=>{if(E){k(!0),j(null);try{let e=E.result?.profileCandidates??[],t=await d((e.length>0?await he(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(b(e))}finally{k(!1)}}},Z=async e=>{if(!(!E||!N.trim())){k(!0),j(null);try{let t=await d(E.id,e,N.trim());D(t),Y(t.sessionKey,N.trim())}catch(e){j(b(e)),k(!1)}}},Ue=async()=>{if(E){k(!0);try{Y((await d(E.id,`dismissed`)).sessionKey)}catch(e){j(b(e)),k(!1)}}},Q=E?.result?.suggestions.find(e=>e.id===E.result?.primarySuggestionId)??E?.result?.suggestions[0],We=E?.result?.suggestions.filter(e=>e.id!==Q?.id)??[],Ge=e=>e===`command`?v.riskCommand:e===`file_write`?v.riskFileWrite:v.riskAnalysis,Ke=De.filter(e=>e?.status===`completed`),qe=e&&S===`candidates`,$=Ke.length>1?(0,y.jsxs)(`div`,{className:`mt-6 rounded-xl border border-edge bg-surface-panel p-2`,children:[(0,y.jsx)(`p`,{className:`px-2 pb-2 text-xs font-medium text-fg-muted`,children:v.analysisResults}),(0,y.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:Ke.map(e=>{let t=z.find(t=>t.rootPath===e.rootPath)?.displayName??e.rootPath.split(/[\\/]/).filter(Boolean).at(-1)??e.rootPath;return(0,y.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:()=>Be(e),children:t},e.id)})})]}):null;return(0,y.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,y.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 ${qe?`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,y.jsx)(`div`,{className:`mb-10 flex items-center justify-center`,children:(0,y.jsx)(fe,{className:`size-11`})}),S===`loading`?(0,y.jsxs)(`div`,{className:`mx-auto flex min-h-[26rem] w-full max-w-md flex-col items-center`,"aria-busy":!0,children:[(0,y.jsx)(s,{className:`h-8 w-64 max-w-full`}),(0,y.jsx)(s,{className:`mt-4 h-4 w-full max-w-sm`}),(0,y.jsx)(s,{className:`mt-2 h-4 w-4/5 max-w-xs`}),(0,y.jsx)(s,{className:`mt-10 h-12 w-full rounded-xl`}),(0,y.jsx)(s,{className:`mt-3 h-11 w-full rounded-xl`}),(0,y.jsx)(s,{className:`mt-5 h-4 w-3/5 max-w-56`})]}):null,S===`intro`?(0,y.jsxs)(`section`,{className:`flex flex-1 flex-col text-center`,"aria-labelledby":`work-discovery-title`,children:[(0,y.jsxs)(`div`,{className:`mx-auto max-w-[36rem]`,children:[(0,y.jsx)(`h1`,{id:`work-discovery-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:v.title}),(0,y.jsx)(`p`,{className:`mx-auto mt-3 max-w-[34rem] text-[0.95rem] leading-7 text-fg-muted`,children:v.subtitle})]}),(0,y.jsxs)(`div`,{className:`mx-auto mt-9 w-full max-w-md`,children:[Ae.length?(0,y.jsxs)(`div`,{className:`mb-5 rounded-xl border border-edge bg-surface-panel p-3 text-left`,children:[(0,y.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:v.localSourcesTitle}),(0,y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:v.localSourcesSubtitle}),(0,y.jsx)(`div`,{className:`mt-3 grid grid-cols-2 gap-2 sm:grid-cols-3`,children:Ae.map(e=>{let t=W.has(e.id);return(0,y.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,y.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,y.jsx)(a,{className:`size-3`,"aria-hidden":!0}):null}),e.displayName]},e.id)})})]}):null,(0,y.jsxs)(f,{type:`button`,className:`h-12 w-full gap-2 bg-accent text-white hover:bg-accent-hover`,onClick:()=>void Pe(),disabled:O||q.picking,children:[O?(0,y.jsx)(l,{className:`size-4 animate-spin`}):(0,y.jsx)(c,{className:`size-4`}),v.quickScan]}),(0,y.jsxs)(f,{type:`button`,variant:`secondary`,className:`mt-3 h-11 w-full gap-2`,onClick:q.pick,disabled:O||q.picking,children:[q.picking?(0,y.jsx)(l,{className:`size-4 animate-spin`}):(0,y.jsx)(p,{className:`size-4`}),v.chooseFolderManually]}),(0,y.jsxs)(`div`,{className:`mt-4 flex items-start justify-center gap-2 text-xs leading-5 text-fg-muted`,children:[(0,y.jsx)(c,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`}),(0,y.jsx)(`span`,{children:v.quickScanNote})]}),(0,y.jsx)(`button`,{type:`button`,className:`mt-4 text-sm font-medium text-accent-fg hover:underline`,onClick:()=>x(`/connectors?understanding=1&returnTo=%2Fonboarding%2Fworkspace`),children:v.connectCloudSource}),A?(0,y.jsx)(`p`,{className:`mt-4 text-sm text-danger`,role:`alert`,children:A}):null]}),(0,y.jsx)(`button`,{type:`button`,className:`mx-auto mt-auto pt-10 text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>void J(),disabled:O,children:v.skip})]}):null,S===`candidates`?(0,y.jsxs)(`section`,{className:e?`flex h-full min-h-0 flex-col`:void 0,"aria-labelledby":`work-discovery-candidates-title`,children:[(0,y.jsxs)(`div`,{className:e?`shrink-0 text-center`:`text-center`,children:[(0,y.jsx)(`h1`,{id:`work-discovery-candidates-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:v.candidatesTitle}),(0,y.jsx)(`p`,{className:`mt-3 text-[0.95rem] leading-7 text-fg-muted`,children:v.candidatesSubtitle})]}),(0,y.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,y.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,y.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,y.jsx)(a,{className:`size-3.5`})}),(0,y.jsx)(p,{className:`mt-0.5 size-5 shrink-0 text-accent-fg`}),(0,y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,y.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,y.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.displayName}),t===0?(0,y.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,y.jsx)(`span`,{className:`mt-1 block truncate font-mono text-xs text-fg-muted`,children:e.rootPath}),(0,y.jsxs)(`span`,{className:`mt-2 flex flex-wrap gap-x-3 gap-y-1 text-xs text-fg-muted`,children:[(0,y.jsx)(`span`,{children:e.projectKind===`coding`?v.codingProject:e.projectKind===`general`?v.generalProject:v.unknownProject}),e.branch?(0,y.jsx)(`span`,{children:v.branchValue.replace(`{{branch}}`,e.branch)}):null,e.changedFileCount>0?(0,y.jsx)(`span`,{children:v.changedFiles.replace(`{{count}}`,String(e.changedFileCount))}):null]})]})]},e.id)})}),(0,y.jsxs)(`div`,{className:e?`shrink-0 border-t border-edge-subtle pt-4`:void 0,children:[(0,y.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,y.jsx)(c,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`}),(0,y.jsx)(`span`,{children:v.multiFolderPrivacyNote})]}),A?(0,y.jsx)(`p`,{className:`mt-3 text-sm text-danger`,role:`alert`,children:A}):null,(0,y.jsxs)(`div`,{className:`${e?`mt-4`:`mt-7`} flex flex-col gap-3 sm:flex-row-reverse`,children:[(0,y.jsxs)(f,{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,y.jsx)(l,{className:`mr-2 size-4 animate-spin`}):null,v.analyzeSelected.replace(`{{count}}`,String(B.size))]}),(0,y.jsx)(f,{type:`button`,variant:`secondary`,className:`h-11 flex-1`,disabled:O,onClick:q.pick,children:v.chooseFolderManually})]}),(0,y.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,y.jsxs)(`section`,{"aria-labelledby":`work-discovery-consent-title`,children:[(0,y.jsxs)(`div`,{className:`text-center`,children:[(0,y.jsx)(`h1`,{id:`work-discovery-consent-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:v.selectedTitle}),(0,y.jsx)(`p`,{className:`mt-3 text-[0.95rem] leading-7 text-fg-muted`,children:v.selectedSubtitle})]}),(0,y.jsxs)(`div`,{className:`mt-8 overflow-hidden rounded-xl border border-edge bg-surface-panel`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-edge-subtle px-4 py-3.5`,children:[(0,y.jsx)(p,{className:`size-5 shrink-0 text-accent-fg`}),(0,y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,y.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:w.displayName}),(0,y.jsx)(`p`,{className:`truncate font-mono text-xs text-fg-muted`,children:w.canonicalRootPath})]}),(0,y.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,y.jsxs)(`div`,{className:`grid gap-3 border-b border-edge-subtle bg-surface-base/60 p-4 sm:grid-cols-2`,children:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:v.localFingerprint}),(0,y.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:w.fingerprint.branch?v.branchValue.replace(`{{branch}}`,w.fingerprint.branch):v.noGitBranch})]}),(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:v.recentActivity}),(0,y.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:v.changedFiles.replace(`{{count}}`,String(w.fingerprint.changedFileCount))})]}),w.fingerprint.recentAreas.length>0?(0,y.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,y.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:v.recentAreas}),(0,y.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:w.fingerprint.recentAreas.map(e=>(0,y.jsx)(`code`,{className:`rounded-md bg-surface-muted px-2 py-1 text-xs text-fg`,children:e},e))})]}):null]}),(0,y.jsxs)(`div`,{className:`divide-y divide-edge-subtle px-4`,children:[(0,y.jsxs)(`div`,{className:`flex gap-3 py-4`,children:[(0,y.jsx)(pe,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`}),(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:v.willRead}),(0,y.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:v.willReadValue})]})]}),(0,y.jsxs)(`div`,{className:`flex gap-3 py-4`,children:[(0,y.jsx)(m,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`}),(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:v.willIgnore}),(0,y.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:v.willIgnoreValue})]})]}),(0,y.jsxs)(`div`,{className:`flex gap-3 py-4`,children:[(0,y.jsx)(c,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`}),(0,y.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:w.remoteModel?v.providerDisclosure.replace(`{{provider}}`,w.provider):v.localDisclosure})]})]})]}),A?(0,y.jsx)(`p`,{className:`mt-4 text-sm text-danger`,role:`alert`,children:A}):null,(0,y.jsxs)(`div`,{className:`mt-7 flex flex-col gap-3 sm:flex-row-reverse`,children:[(0,y.jsxs)(f,{type:`button`,className:`h-11 flex-1 bg-accent text-white hover:bg-accent-hover`,disabled:O,onClick:()=>void ze(),children:[O?(0,y.jsx)(l,{className:`mr-2 size-4 animate-spin`}):null,v.startAnalysis]}),(0,y.jsx)(f,{type:`button`,variant:`secondary`,className:`h-11 flex-1`,disabled:O,onClick:q.pick,children:v.changeFolder})]}),(0,y.jsx)(`button`,{type:`button`,className:`mx-auto mt-6 block text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>void J(),children:v.skip})]}):null,S===`running`&&E?(0,y.jsxs)(`section`,{"aria-labelledby":`work-discovery-running-title`,"aria-live":`polite`,children:[(0,y.jsxs)(`div`,{className:`text-center`,children:[(0,y.jsx)(`h1`,{id:`work-discovery-running-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:v.analyzingTitle}),(0,y.jsx)(`p`,{className:`mt-3 text-[0.95rem] leading-7 text-fg-muted`,children:v.analyzingSubtitle}),H.total>1?(0,y.jsx)(`p`,{className:`mt-2 text-sm font-medium text-accent-fg`,children:v.analyzingFolderProgress.replace(`{{current}}`,String(H.current)).replace(`{{total}}`,String(H.total))}):null]}),(0,y.jsx)(`div`,{className:`mt-9 rounded-xl border border-edge bg-surface-panel px-5 py-2`,children:xe.map((e,t)=>{let n=Math.max(0,xe.indexOf(E.stage??`folder_structure`)),r=t<n,i=t===n;return(0,y.jsxs)(`div`,{className:`flex items-center gap-4 border-b border-edge-subtle py-4 last:border-b-0`,children:[(0,y.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,y.jsx)(a,{className:`size-4`}):i?(0,y.jsx)(l,{className:`size-4 animate-spin motion-reduce:animate-none`}):(0,y.jsx)(`span`,{className:`size-1.5 rounded-full bg-current`})}),(0,y.jsx)(`span`,{className:i||r?`text-sm font-medium text-fg`:`text-sm text-fg-muted`,children:v.stages[e]})]},e)})}),(0,y.jsx)(`p`,{className:`mt-4 truncate text-center font-mono text-xs text-fg-muted`,children:E.rootPath}),(0,y.jsxs)(`div`,{className:`mx-auto mt-7 flex max-w-md flex-col gap-3`,children:[(0,y.jsx)(f,{type:`button`,variant:`secondary`,className:`h-11 w-full`,onClick:()=>x(`/chat`),children:v.continueInBackground}),(0,y.jsx)(`button`,{type:`button`,className:`mx-auto text-sm text-fg-muted hover:text-danger hover:underline`,onClick:()=>void Ve(),children:v.cancelAnalysis})]})]}):null,S===`recognition`&&E?.result?(0,y.jsxs)(`section`,{"aria-labelledby":`work-discovery-recognition-title`,children:[(0,y.jsxs)(`div`,{className:`text-center`,children:[(0,y.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.16em] text-accent-fg`,children:v.recognitionEyebrow}),(0,y.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,y.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,y.jsx)(`p`,{className:`text-base font-medium leading-7 text-fg`,children:E.result.projectSummary}),(0,y.jsx)(`p`,{className:`mt-3 text-sm leading-6 text-fg-muted`,children:E.result.currentState}),!E.result.lowConfidence&&Q?.evidence.length?(0,y.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,y.jsxs)(`li`,{className:`flex gap-2 text-xs leading-5 text-fg-muted`,children:[(0,y.jsx)(ue,{className:`mt-0.5 size-3.5 shrink-0 text-accent-fg`}),(0,y.jsxs)(`span`,{children:[e.path?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`code`,{className:`font-mono text-fg`,children:e.path}),`: `]}):null,e.observation]})]},`${Q.id}-recognition-${t}`))}):null]}),E.result.workThreads?.length?(0,y.jsxs)(`div`,{className:`mt-5 rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,y.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:v.workThreadsTitle}),(0,y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:v.workThreadsSubtitle}),(0,y.jsx)(`div`,{className:`mt-3 divide-y divide-edge-subtle`,children:E.result.workThreads.map(e=>(0,y.jsxs)(`div`,{className:`py-3 first:pt-0 last:pb-0`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,y.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,y.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:e.title})]}),(0,y.jsx)(`p`,{className:`mt-1.5 text-xs leading-5 text-fg-muted`,children:e.summary})]},e.id))})]}):null,E.result.profileCandidates?.length?(0,y.jsxs)(`div`,{className:`mt-5 rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,y.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:v.profileCandidatesTitle}),(0,y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:v.profileCandidatesSubtitle}),(0,y.jsx)(`div`,{className:`mt-3 space-y-2`,children:E.result.profileCandidates.map(e=>(0,y.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3 rounded-lg px-2 py-2 hover:bg-surface-muted`,children:[(0,y.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,y.jsx)(`span`,{className:`text-sm leading-5 text-fg`,children:e.statement})]},e.id))})]}):null,E.result.lowConfidence?(0,y.jsxs)(`div`,{className:`mt-5`,children:[(0,y.jsx)(`p`,{className:`text-sm font-medium leading-6 text-fg`,children:E.result.contextQuestion}),(0,y.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,y.jsx)(f,{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,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(`div`,{className:`mt-6 flex flex-col gap-3 sm:flex-row-reverse`,children:[(0,y.jsxs)(f,{className:`h-11 flex-1 bg-accent text-white hover:bg-accent-hover`,disabled:O,onClick:()=>void He(),children:[O?(0,y.jsx)(l,{className:`size-4 animate-spin`}):(0,y.jsx)(a,{className:`size-4`}),v.confirmUnderstanding]}),(0,y.jsx)(f,{variant:`secondary`,className:`h-11 flex-1`,disabled:O,onClick:()=>M(e=>!e),children:v.notQuiteRight})]}),we?(0,y.jsxs)(`div`,{className:`mt-4 rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,y.jsx)(`label`,{className:`text-sm font-medium text-fg`,htmlFor:`work-discovery-correction`,children:v.correctionLabel}),(0,y.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,y.jsxs)(`div`,{className:`mt-3 flex flex-wrap justify-end gap-2`,children:[(0,y.jsx)(f,{variant:`ghost`,disabled:O||!N.trim(),onClick:()=>void Z(`different_goal`),children:v.differentGoal}),(0,y.jsx)(f,{variant:`primary`,disabled:O||!N.trim(),onClick:()=>void Z(`corrected`),children:v.useCorrection})]})]}):null]}),A?(0,y.jsx)(`p`,{className:`mt-4 text-sm text-danger`,role:`alert`,children:A}):null,(0,y.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 Ue(),children:v.openConversation})]}):null,S===`recommendation`&&E?.result&&Q?(0,y.jsxs)(`section`,{"aria-labelledby":`work-discovery-recommendation-title`,children:[(0,y.jsxs)(`div`,{className:`text-center`,children:[(0,y.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.16em] text-accent-fg`,children:v.understandingConfirmed}),(0,y.jsx)(`h1`,{id:`work-discovery-recommendation-title`,className:`mt-2 text-2xl font-semibold tracking-tight text-fg`,children:v.primaryRecommendationTitle})]}),$,(0,y.jsx)(`article`,{className:`mt-7 rounded-2xl border border-accent/30 bg-surface-panel p-5 sm:p-6`,children:(0,y.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,y.jsx)(`div`,{className:`flex size-9 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-accent-fg`,children:(0,y.jsx)(se,{className:`size-5`})}),(0,y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,y.jsx)(`h2`,{className:`text-lg font-semibold text-fg`,children:Q.title}),(0,y.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:Q.rationale}),(0,y.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2 text-xs`,children:[(0,y.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,y.jsx)(ae,{className:`size-3.5`}),v.estimatedMinutes.replace(`{{count}}`,String(Q.estimatedMinutes))]}),(0,y.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2.5 py-1 text-fg-muted`,children:Ge(Q.risk)})]}),(0,y.jsxs)(`div`,{className:`mt-4 rounded-xl bg-surface-base px-4 py-3`,children:[(0,y.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:v.expectedTask}),(0,y.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg`,children:Q.expectedTask})]}),(0,y.jsxs)(`div`,{className:`mt-5 flex flex-wrap gap-2`,children:[(0,y.jsx)(f,{className:`h-10 bg-accent px-4 text-white hover:bg-accent-hover`,onClick:()=>void X(Q,!1),children:v.startRecommendedAction}),(0,y.jsx)(f,{className:`h-10 px-4`,variant:`secondary`,onClick:()=>void X(Q,!0),children:v.explainFirst})]})]})]})}),We.length>0?(0,y.jsxs)(`div`,{className:`mt-5 border-t border-edge-subtle pt-4`,children:[(0,y.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,y.jsx)(ce,{className:`size-4 transition-transform ${F?`rotate-180`:``}`})]}),F?(0,y.jsx)(`div`,{className:`mt-2 divide-y divide-edge-subtle rounded-xl border border-edge bg-surface-panel px-4`,children:We.map(e=>(0,y.jsxs)(`button`,{type:`button`,className:`flex w-full items-start gap-3 py-4 text-left`,onClick:()=>void X(e,!0),children:[(0,y.jsx)(se,{className:`mt-0.5 size-4 shrink-0 text-fg-subtle`}),(0,y.jsxs)(`span`,{children:[(0,y.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.title}),(0,y.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:e.expectedTask})]})]},e.id))}):null]}):null,(0,y.jsxs)(`div`,{className:`mt-6 flex flex-wrap items-center justify-center gap-x-5 gap-y-3`,children:[(0,y.jsx)(`button`,{type:`button`,className:`text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>Y(E.sessionKey),children:v.doSomethingElse}),(0,y.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,y.jsxs)(`section`,{className:`text-center`,"aria-labelledby":`work-discovery-error-title`,children:[(0,y.jsx)(`div`,{className:`mx-auto flex size-11 items-center justify-center rounded-xl bg-danger-soft text-danger`,children:(0,y.jsx)(m,{className:`size-5`})}),(0,y.jsx)(`h1`,{id:`work-discovery-error-title`,className:`mt-5 text-2xl font-semibold tracking-tight text-fg`,children:v.errorTitle}),(0,y.jsx)(`p`,{className:`mx-auto mt-3 max-w-lg text-sm leading-6 text-fg-muted`,children:E.errorMessage}),(0,y.jsxs)(`div`,{className:`mx-auto mt-7 flex max-w-md flex-col gap-3 sm:flex-row-reverse`,children:[(0,y.jsx)(f,{className:`h-11 flex-1 bg-accent text-white hover:bg-accent-hover`,onClick:()=>void le(E.id).then(K),children:v.retry}),(0,y.jsx)(f,{variant:`secondary`,className:`h-11 flex-1`,onClick:()=>{D(null),T(null),C(`intro`)},children:v.chooseDifferent})]}),(0,y.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]}),q.hasNativePicker?null:(0,y.jsx)(ie,{open:q.modalOpen,onOpenChange:q.setModalOpen,initialAbsolutePath:w?.canonicalRootPath,onConfirm:q.confirmPick,wd:ye})]})}export{x as WorkDiscoveryPage};