@xopcai/xopc 0.0.204 → 0.0.206

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 (156) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/xopc.extension.json +1 -1
  3. package/dist/gateway/static/root/assets/{activity-store-DJBadfSX.js → activity-store-URW-e_me.js} +1 -1
  4. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-BaH7Poqk.js → agent-avatar-dicebear-BLK6kRCJ.js} +1 -1
  5. package/dist/gateway/static/root/assets/agents-D5HVmdNx.js +68 -0
  6. package/dist/gateway/static/root/assets/{api-B5O7fKXa.js → api-C_MS4arC.js} +1 -1
  7. package/dist/gateway/static/root/assets/{app-management-settings-panel-CCLK9wdi.js → app-management-settings-panel-CnUN6BJk.js} +1 -1
  8. package/dist/gateway/static/root/assets/{appearance-settings-DYSHvGJP.js → appearance-settings-C8Nx8hZE.js} +1 -1
  9. package/dist/gateway/static/root/assets/apps-page-DKCA_LFY.js +1 -0
  10. package/dist/gateway/static/root/assets/{archive-plugin-CZX6pfRb.js → archive-plugin-C7FqeJZD.js} +1 -1
  11. package/dist/gateway/static/root/assets/{attachment-load-CGYpcBXN.js → attachment-load-DCYQgsYE.js} +1 -1
  12. package/dist/gateway/static/root/assets/automations-page-BEOE4ZKM.js +6 -0
  13. package/dist/gateway/static/root/assets/{binary-plugins-BJ1AQfTa.js → binary-plugins-Bf1WROsh.js} +1 -1
  14. package/dist/gateway/static/root/assets/{block-editor-DR6LCljI.js → block-editor-BPK08Pjv.js} +46 -46
  15. package/dist/gateway/static/root/assets/browser-settings-page-CLRmMdU9.js +8 -0
  16. package/dist/gateway/static/root/assets/{browser-workflow-inputs-Bd68yluo.js → browser-workflow-inputs-cqVoDHyp.js} +1 -1
  17. package/dist/gateway/static/root/assets/{browser-workflows-page-BG-hEoGn.js → browser-workflows-page-Des1UTsS.js} +2 -2
  18. package/dist/gateway/static/root/assets/capabilities-settings-panel-BNcVi4ar.js +7 -0
  19. package/dist/gateway/static/root/assets/{capability-presets-api-BerPMp6f.js → capability-presets-api-D4MjqV2a.js} +1 -1
  20. package/dist/gateway/static/root/assets/{capability-presets-settings-panel-CxpKaTzc.js → capability-presets-settings-panel-uFwW2ah5.js} +2 -2
  21. package/dist/gateway/static/root/assets/{channel-recipient-api-D2d21_XA.js → channel-recipient-api-CcimZduy.js} +1 -1
  22. package/dist/gateway/static/root/assets/channels-settings-DSLP8OjS.js +1 -0
  23. package/dist/gateway/static/root/assets/channels-status-swr-D0OR6Ylw.js +1 -0
  24. package/dist/gateway/static/root/assets/chat-terminal-dock-B1njb2Cr.css +1 -0
  25. package/dist/gateway/static/root/assets/chat-terminal-dock-wpi7abPg.js +38 -0
  26. package/dist/gateway/static/root/assets/{connectors-api-Sw0BrUmJ.js → connectors-api-CUvFu8jh.js} +1 -1
  27. package/dist/gateway/static/root/assets/connectors-page-BJoHjWnu.js +2 -0
  28. package/dist/gateway/static/root/assets/{cron-expression-DfZsNMAq.js → cron-expression-hFSZZpvM.js} +1 -1
  29. package/dist/gateway/static/root/assets/{date-picker-DjHSmgq9.js → date-picker-CKZ0gc-Y.js} +1 -1
  30. package/dist/gateway/static/root/assets/{dependency-picker-CRajhh0O.js → dependency-picker-zv1oHtg4.js} +1 -1
  31. package/dist/gateway/static/root/assets/{desktop-pet-a3DXD4IR.js → desktop-pet-DY9ykMtD.js} +1 -1
  32. package/dist/gateway/static/root/assets/{desktop-pet-settings-BWx0Duz-.js → desktop-pet-settings-XiSmmt26.js} +1 -1
  33. package/dist/gateway/static/root/assets/directory-picker-path-field-CZkgk15r.js +1 -0
  34. package/dist/gateway/static/root/assets/{extension-debug-page-CwJ-R0DC.js → extension-debug-page-CTppsTEi.js} +1 -1
  35. package/dist/gateway/static/root/assets/{extension-page-BpXWrZFh.js → extension-page-CHRTUvAa.js} +1 -1
  36. package/dist/gateway/static/root/assets/{extension-settings-page-D0c4RgxT.js → extension-settings-page-z2UBx25A.js} +1 -1
  37. package/dist/gateway/static/root/assets/{gateway-config-api-Dn2FSNBa.js → gateway-config-api-DzFPJTnm.js} +1 -1
  38. package/dist/gateway/static/root/assets/{gateway-config-swr-VVcfd3sG.js → gateway-config-swr-CGpoH1gU.js} +1 -1
  39. package/dist/gateway/static/root/assets/{gateway-settings-BNamAC3x.js → gateway-settings-DBa2I6VM.js} +1 -1
  40. package/dist/gateway/static/root/assets/{gateway-startup-retry-qAX_T2t2.js → gateway-startup-retry-Te-TREBt.js} +1 -1
  41. package/dist/gateway/static/root/assets/heartbeat-settings-DyQGGdBu.js +1 -0
  42. package/dist/gateway/static/root/assets/home-page-EkT4eGeP.js +3 -0
  43. package/dist/gateway/static/root/assets/index-BpLqHdfz.css +2 -0
  44. package/dist/gateway/static/root/assets/index-CrwXzRpA.js +85 -0
  45. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BOoz5DNd.js → keyboard-shortcuts-settings-fb0zS8pk.js} +1 -1
  46. package/dist/gateway/static/root/assets/local-app-workbench-page-CCC3Cvb8.js +2 -0
  47. package/dist/gateway/static/root/assets/{local-apps-page-B2mV4Olf.js → local-apps-page-DFdheruU.js} +1 -1
  48. package/dist/gateway/static/root/assets/{locale-store-CbPVxonP.js → locale-store-CieddUjx.js} +1 -1
  49. package/dist/gateway/static/root/assets/{logs-page-DLFwiLa6.js → logs-page-B6jfkNDF.js} +2 -2
  50. package/dist/gateway/static/root/assets/{management-settings-BEduNvMc.js → management-settings-D3PsQ612.js} +1 -1
  51. package/dist/gateway/static/root/assets/{markdown-split-BgE9kKG6.js → markdown-split-x5K52Thz.js} +1 -1
  52. package/dist/gateway/static/root/assets/{markdown-view-Dl-0_9JR.js → markdown-view-Cjjey5Y6.js} +1 -1
  53. package/dist/gateway/static/root/assets/{media-plugins-DNESLGDB.js → media-plugins-DNtEkRAh.js} +1 -1
  54. package/dist/gateway/static/root/assets/messages-CySMn8WL.js +3 -0
  55. package/dist/gateway/static/root/assets/{notes-page-COgmlorx.js → notes-page-nWEqlwDw.js} +1 -1
  56. package/dist/gateway/static/root/assets/notes-workbench-QstkgWsW.js +4 -0
  57. package/dist/gateway/static/root/assets/{preview-open-alternatives-BV_58lf7.js → preview-open-alternatives-CXcIKVi9.js} +1 -1
  58. package/dist/gateway/static/root/assets/{product-open-page-Bh8WERvg.js → product-open-page-CZLJudPk.js} +1 -1
  59. package/dist/gateway/static/root/assets/project-detail-page-Cf1v94LO.js +1 -0
  60. package/dist/gateway/static/root/assets/projects-page-BRMZkNht.js +1 -0
  61. package/dist/gateway/static/root/assets/remote-access-hub-D55FTXZw.js +1 -0
  62. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-HZYyqA5T.js → runtime-tools-settings-panel-RYjduQV6.js} +1 -1
  63. package/dist/gateway/static/root/assets/{schema-form-C6EnKgW2.js → schema-form--1ZXg4qC.js} +1 -1
  64. package/dist/gateway/static/root/assets/sessions-page-C5Yy6eIn.js +1 -0
  65. package/dist/gateway/static/root/assets/settings-advanced-gate-BqO_8bUh.js +1 -0
  66. package/dist/gateway/static/root/assets/{settings-form-section-sAjYWtCZ.js → settings-form-section-71-8j3zt.js} +1 -1
  67. package/dist/gateway/static/root/assets/{settings-loading-skeleton-Bw56H64J.js → settings-loading-skeleton-C5Jn1l0q.js} +1 -1
  68. package/dist/gateway/static/root/assets/{settings-page-aduxT-Nu.js → settings-page-TYYGe6kZ.js} +1 -1
  69. package/dist/gateway/static/root/assets/{setup-status-panel-CVg8oOTw.js → setup-status-panel-jA5I-17g.js} +1 -1
  70. package/dist/gateway/static/root/assets/{share-preview-page-SmtgZyVf.js → share-preview-page-BMUQIGfk.js} +1 -1
  71. package/dist/gateway/static/root/assets/shares-settings-Dru1a2rZ.js +1 -0
  72. package/dist/gateway/static/root/assets/skill-reload-api-C8iqS6kF.js +1 -0
  73. package/dist/gateway/static/root/assets/{skills-page-BHBDl1pN.js → skills-page-BzZT1SKg.js} +1 -1
  74. package/dist/gateway/static/root/assets/{skills-page.utils-D5SnlPVg.js → skills-page.utils-DnaBw5Ji.js} +1 -1
  75. package/dist/gateway/static/root/assets/{system-settings-panel-wiXKgbG9.js → system-settings-panel-DqiPQgVI.js} +1 -1
  76. package/dist/gateway/static/root/assets/task-detail-page-DQP5vDr-.js +1 -0
  77. package/dist/gateway/static/root/assets/{theme-store-Bc_eRUev.js → theme-store-BP3_RpaY.js} +1 -1
  78. package/dist/gateway/static/root/assets/{use-autosave-CiuRY85U.js → use-autosave-BJkQ-vpu.js} +1 -1
  79. package/dist/gateway/static/root/assets/{user-context-page-B-uZKYIg.js → user-context-page-BP8-sOPi.js} +1 -1
  80. package/dist/gateway/static/root/assets/{voice-api-key-field-CX9xuc7h.js → voice-api-key-field-C6c8e7Mx.js} +1 -1
  81. package/dist/gateway/static/root/assets/{work-discovery-overlay-DrTD6gtS.js → work-discovery-overlay-CCNjWKql.js} +1 -1
  82. package/dist/gateway/static/root/assets/work-discovery-page-DL_Ie0s2.js +1 -0
  83. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-CG0fSFFv.js → workflow-run-setup-panel-DLO-dMSN.js} +2 -2
  84. package/dist/gateway/static/root/assets/workflows-page-B4-k2FHB.js +5 -0
  85. package/dist/gateway/static/root/assets/{working-directory-picker-modal-CYWdZUJ5.js → working-directory-picker-modal-vWi33CZJ.js} +1 -1
  86. package/dist/gateway/static/root/index.html +10 -10
  87. package/dist/package.js +1 -1
  88. package/dist/src/agent/agent-manager.d.ts +11 -0
  89. package/dist/src/agent/agent-manager.js +36 -6
  90. package/dist/src/agent/memory/compaction.js +14 -5
  91. package/dist/src/agent/service.d.ts +4 -1
  92. package/dist/src/agent/service.js +12 -0
  93. package/dist/src/agent/tools/xopc-use-tool.js +6 -2
  94. package/dist/src/automations/api/routes.js +8 -0
  95. package/dist/src/automations/domain/index.js +2 -2
  96. package/dist/src/automations/domain/types.d.ts +17 -12
  97. package/dist/src/automations/domain/validation.d.ts +30 -32
  98. package/dist/src/automations/domain/validation.js +8 -10
  99. package/dist/src/automations/draft/automation-draft-prompt.js +9 -5
  100. package/dist/src/automations/draft/automation-draft-validator.d.ts +3 -8
  101. package/dist/src/automations/draft/automation-draft-validator.js +3 -3
  102. package/dist/src/automations/index.js +2 -2
  103. package/dist/src/automations/service/action-executor.js +13 -4
  104. package/dist/src/automations/service/automation-service.d.ts +5 -1
  105. package/dist/src/automations/service/automation-service.js +19 -12
  106. package/dist/src/automations/storage/automation-repository.js +8 -4
  107. package/dist/src/automations/storage/automation-run-repository.d.ts +5 -0
  108. package/dist/src/automations/storage/automation-run-repository.js +24 -8
  109. package/dist/src/automations/storage/index.js +2 -2
  110. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  111. package/dist/src/cli/commands/gateway/lifecycle.js +1 -1
  112. package/dist/src/config/agent-profile.js +1 -1
  113. package/dist/src/gateway/agents-admin.js +1 -1
  114. package/dist/src/gateway/automation-agent-session.d.ts +4 -0
  115. package/dist/src/gateway/automation-agent-session.js +40 -0
  116. package/dist/src/gateway/dreaming-automation-reconciler.js +3 -2
  117. package/dist/src/gateway/hono/routes/commands-skills.js +36 -2
  118. package/dist/src/gateway/hono/routes/lazy-bundles.js +1 -0
  119. package/dist/src/gateway/service/marketplace-service.d.ts +4 -1
  120. package/dist/src/gateway/service/marketplace-service.js +9 -0
  121. package/dist/src/gateway/service.js +19 -2
  122. package/dist/src/infra/update-restart.js +1 -1
  123. package/dist/src/mobile/notification-service.js +7 -4
  124. package/dist/src/storage/sqlite/migrations/121_automation_inbox.sql +24 -0
  125. package/dist/src/storage/sqlite/migrations/122_automation_session_projects.sql +18 -0
  126. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  127. package/dist/src/storage/sqlite/migrations/runner.js +3 -3
  128. package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
  129. package/dist/src/storage/sqlite/schema.js +1 -1
  130. package/package.json +3 -2
  131. package/dist/gateway/static/root/assets/agents-HctDDhtH.js +0 -68
  132. package/dist/gateway/static/root/assets/apps-page-kCUkEIoM.js +0 -1
  133. package/dist/gateway/static/root/assets/automations-page-D2Ao4Dwi.js +0 -6
  134. package/dist/gateway/static/root/assets/browser-settings-page-B_IjOjtT.js +0 -8
  135. package/dist/gateway/static/root/assets/capabilities-settings-panel-DDC5-wqk.js +0 -7
  136. package/dist/gateway/static/root/assets/channels-settings-D7pmMIbZ.js +0 -1
  137. package/dist/gateway/static/root/assets/channels-status-swr-CZ5P9jbB.js +0 -1
  138. package/dist/gateway/static/root/assets/connectors-page-DTyM5bMS.js +0 -2
  139. package/dist/gateway/static/root/assets/directory-picker-path-field-CEZrPGZx.js +0 -1
  140. package/dist/gateway/static/root/assets/heartbeat-settings-BagVvGe6.js +0 -1
  141. package/dist/gateway/static/root/assets/home-page-Ci0h-uKG.js +0 -3
  142. package/dist/gateway/static/root/assets/index-DHGnTdgl.js +0 -85
  143. package/dist/gateway/static/root/assets/index-Dm-cvIpl.css +0 -2
  144. package/dist/gateway/static/root/assets/local-app-workbench-page-B1mLlQT6.js +0 -2
  145. package/dist/gateway/static/root/assets/messages-9zCa8KkW.js +0 -3
  146. package/dist/gateway/static/root/assets/notes-workbench-Ce5ORQus.js +0 -4
  147. package/dist/gateway/static/root/assets/project-detail-page-C0vjVpKC.js +0 -1
  148. package/dist/gateway/static/root/assets/projects-page-RGaztvxc.js +0 -1
  149. package/dist/gateway/static/root/assets/remote-access-hub-C7EfVrqr.js +0 -1
  150. package/dist/gateway/static/root/assets/sessions-page-BTpLFg2e.js +0 -1
  151. package/dist/gateway/static/root/assets/settings-advanced-gate-RV6nphHJ.js +0 -1
  152. package/dist/gateway/static/root/assets/shares-settings-DNXQwu2U.js +0 -1
  153. package/dist/gateway/static/root/assets/skill-reload-api-DhgLGYw8.js +0 -1
  154. package/dist/gateway/static/root/assets/task-detail-page-DBu-p3Iv.js +0 -1
  155. package/dist/gateway/static/root/assets/work-discovery-page-C4Ivt1_C.js +0 -1
  156. package/dist/gateway/static/root/assets/workflows-page-CT5g5who.js +0 -5
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{d as i,f as a,t as o}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{n as s,r as c}from"./popover-select-BzdnTy3h.js";import{t as l}from"./external-link-DjqjBmc3.js";import{f as u,u as ee}from"./markdown-view-Cjjey5Y6.js";import{t as te}from"./x-B_N4OPjy.js";import{t as d}from"./cn-JdwAhgNB.js";import{t as f}from"./button-CSEbl4zT.js";import{l as p,n as ne}from"./locale-store-CieddUjx.js";import{i as m,n as re,o as ie,r as h,s as ae,t as g}from"./dist-BPoKqzeH.js";import{A as _,Aa as v,Cr as oe,Dr as se,H as y,Hc as b,Hl as x,Hs as S,Js as C,K as w,M as ce,Qc as T,R as E,Sr as D,Tr as O,Va as k,W as A,Z as j,bl as M,fa as le,fl as ue,ic as de,in as N,ka as fe,n as pe,nn as me,pl as he,q as ge,rn as _e,si as ve,vi as P,wr as ye,yi as F}from"./index-CrwXzRpA.js";import{t as be}from"./date-picker-CKZ0gc-Y.js";import{t as xe}from"./dependency-picker-zv1oHtg4.js";var I=e(t(),1),L=n();function Se(e,t,n,r){return!!(e&&t!==e.version&&n!==e.value&&r!==n)}function Ce(e,t){let n={...e.task};t.title!==void 0&&(n.title=t.title),t.priority!==void 0&&(n.priority=t.priority);for(let e of[`body`,`projectId`,`milestoneId`,`parentTaskId`,`dueAt`,`ownerId`]){let r=t[e];r!==void 0&&(r===null?delete n[e]:Object.assign(n,{[e]:r}))}return n.version+=1,n.updatedAt=Date.now(),{...e,task:n}}var R=r();function we(e,t){return(t===`zh`?{backlog:`待规划`,ready:`就绪`,active:`进行中`,review:`待验收`,closed:`已完成`}:{backlog:`Backlog`,ready:`Ready`,active:`Active`,review:`Review`,closed:`Completed`})[e]}function Te(){let e=(0,L.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,R.jsxs)(`div`,{className:`space-y-4`,"aria-busy":!0,children:[(0,R.jsx)(v,{className:`h-32 rounded-2xl`}),(0,R.jsx)(v,{className:`h-52 rounded-2xl`}),(0,R.jsx)(v,{className:`h-40 rounded-2xl`})]}),e[0]=t):t=e[0],t}function Ee(e){if(e===void 0)return``;let t=new Date(e);return new Date(t.getTime()-t.getTimezoneOffset()*6e4).toISOString().slice(0,10)}function De(e){return e?new Date(`${e}T23:59:59.999`).getTime():null}var Oe=`xopc.taskDetail.chatPanelPercent`,z=42;function ke(e,t){let n=Math.max(30,352/Math.max(t,1)*100),r=Math.min(60,(t-480)/Math.max(t,1)*100);return r<n?z:Math.min(r,Math.max(n,e))}function Ae(){try{let e=Number(window.localStorage.getItem(Oe));return Number.isFinite(e)&&e>=30&&e<=60?e:z}catch{return z}}function je(e){return e.task.phase===`closed`?e.task.resolution===`done`?`completed`:`ended`:e.attention.some(e=>e.kind===`input_required`||e.kind===`approval_required`)?`needsUser`:e.operationalState===`idle`?e.task.phase===`backlog`?`captured`:e.task.phase===`ready`?`ready`:e.task.phase===`review`?`review`:`paused`:e.operationalState}function B(e){let t=(0,L.c)(9),{items:n,empty:r,verificationByCriterion:i}=e;if(n.length===0){let e;return t[0]===r?e=t[1]:(e=(0,R.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:r}),t[0]=r,t[1]=e),e}let a;if(t[2]!==n||t[3]!==i){let e;t[5]===i?e=t[6]:(e=e=>{let t=i?.get(e)??`unverified`;return(0,R.jsxs)(`li`,{className:`flex gap-2 text-sm leading-6 text-fg`,children:[(0,R.jsx)(t===`passed`?M:t===`failed`?he:ue,{className:t===`passed`?`mt-1 size-4 shrink-0 text-success`:t===`failed`?`mt-1 size-4 shrink-0 text-danger`:`mt-1 size-4 shrink-0 text-fg-subtle`}),(0,R.jsx)(`span`,{children:e})]},e)},t[5]=i,t[6]=e),a=n.map(e),t[2]=n,t[3]=i,t[4]=a}else a=t[4];let o;return t[7]===a?o=t[8]:(o=(0,R.jsx)(`ul`,{className:`space-y-2`,children:a}),t[7]=a,t[8]=o),o}function Me({taskId:e,presentation:t,backgroundPath:n}){let[r]=a(),i=ne(e=>e.language),te=p(e=>e.token),m=(0,I.useMemo)(()=>ge(i),[i]),re=k(e=>e.setPageHeader),ie=k(e=>e.clearPageHeader),{data:h,error:ae,mutate:g,lastChange:v,conversationLoading:ue,conversationError:N}=_(e),[he,P]=(0,I.useState)(null),[F,L]=(0,I.useState)(!1),[Me,Ne]=(0,I.useState)([]),[V,Pe]=(0,I.useState)(null),[Fe,Ie]=(0,I.useState)([]),[Le,H]=(0,I.useState)(!1),[Re,U]=(0,I.useState)(``),[ze,W]=(0,I.useState)(!1),[Be,Ve]=(0,I.useState)(``),[G,He]=(0,I.useState)(Ae),[Ue,We]=(0,I.useState)(!1),Ge=(0,I.useRef)(null),Ke=(0,I.useRef)(!1),qe=(0,I.useRef)(!1),Je=(0,I.useRef)(``),Ye=(0,I.useRef)(null),Xe=(0,I.useRef)(null),Ze=(0,I.useRef)(null),[Qe,K]=(0,I.useState)(null),[$e,et]=(0,I.useState)(null),tt=h?.dependencies.map(e=>`${e.id}:${e.title}`).join(`\0`)??``,nt=(0,I.useMemo)(()=>ee(r.get(`returnTo`),`/`,[`/projects`,`/chat`,`/notes`,`/tasks`]),[r]);(0,I.useEffect)(()=>{P(null),K(null),H(!1),W(!1),et(null)},[e]),(0,I.useEffect)(()=>{let e=!0;return fe().then(t=>{e&&Ie(t.items)}).catch(()=>void 0),()=>{e=!1}},[te]),(0,I.useEffect)(()=>{if(!v||v.source===`user`)return;et(v);let e=window.setTimeout(()=>et(null),3500);return()=>window.clearTimeout(e)},[v]),(0,I.useEffect)(()=>{let t=h?.task.projectId,n=h?.dependencies??[];if(!t){Ze.current=null,Pe(null),Ne(n);return}Ze.current!==t&&(Ze.current=t,Pe(null));let r=!0;return le(t).then(t=>{if(!r)return;Pe(t.project.name);let i=new Map;for(let r of[...t.tasks,...n])r.id!==e&&i.set(r.id,{id:r.id,title:r.title});Ne([...i.values()])}).catch(()=>{r&&Ne(n)}),()=>{r=!1}},[tt,h?.task.projectId,e]);let q=async t=>{if(h){L(!0),P(null);try{await g(await ce(e,t,h.task.version),{revalidate:!1})}catch{P(m.actionFailed)}finally{L(!1)}}},J=async t=>{if(!h)return!1;L(!0),P(null);try{return await g(A(e,t,h.task.version),{optimisticData:Ce(h,t),populateCache:!0,revalidate:!1,rollbackOnError:!0}),!0}catch{return P(m.actionFailed),!1}finally{L(!1)}},rt=async()=>{if(!h)return;if(Ke.current){Ke.current=!1;return}let e=Re.trim(),t=Ye.current;if(Se(t,h.task.version,h.task.title,e)){K(`title`);return}if(!e||e===h.task.title){U(h.task.title),H(!1);return}await J({title:e})&&(K(null),H(!1))},it=async()=>{if(!h)return;if(qe.current){qe.current=!1;return}let e=Be.trim(),t=Xe.current;if(Se(t,h.task.version,h.task.body??``,e)){K(`description`);return}if(Be===Je.current||e===(h.task.body??``).trim()){W(!1);return}await J({body:e||null})&&(K(null),W(!1))},at=async e=>{if(!(!h||e===h.task.phase)){if(h.task.phase===`closed`){await q({type:`reopen`,phase:e===`closed`?`ready`:e});return}if(e===`closed`){await q({type:`close`,resolution:`done`});return}await q({type:`move`,phase:e})}},Y=(0,I.useCallback)(e=>{He(e);try{window.localStorage.setItem(Oe,String(e))}catch{}},[]),ot=(0,I.useCallback)(e=>{if(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`&&e.key!==`Home`)return;e.preventDefault();let t=Ge.current?.clientWidth??0;Y(ke(e.key===`Home`?z:G+(e.key===`ArrowLeft`?2:-2),t))},[G,Y]),st=(0,I.useCallback)(e=>{if(!window.matchMedia(`(min-width: 1024px)`).matches)return;let t=Ge.current;if(!t)return;e.preventDefault();let n=e.currentTarget,r=e.pointerId;n.setPointerCapture(r),We(!0);let i=G,a=0,o=()=>{a=0,t.style.setProperty(`--task-chat-panel-width`,`${i}%`)},s=e=>{let n=t.getBoundingClientRect();i=ke((n.right-e.clientX)/n.width*100,n.width),a===0&&(a=window.requestAnimationFrame(o))},c=()=>{a!==0&&(window.cancelAnimationFrame(a),o());try{n.releasePointerCapture(r)}catch{}We(!1),Y(i),window.removeEventListener(`pointermove`,s),window.removeEventListener(`pointerup`,c),window.removeEventListener(`pointercancel`,c)};window.addEventListener(`pointermove`,s),window.addEventListener(`pointerup`,c),window.addEventListener(`pointercancel`,c)},[G,Y]),ct=async t=>{if(h){L(!0),P(null);try{await g(await w(e,t,h.task.version),{revalidate:!1})}catch{P(m.dependencyUpdateFailed)}finally{L(!1)}}},lt=async t=>{if(!(!h||!t||t===h.conversation.currentExecutorAgentId)){L(!0),P(null);try{await g(await E(e,t,h.task.version),{revalidate:!1})}catch{P(m.actionFailed)}finally{L(!1)}}};if((0,I.useLayoutEffect)(()=>{if(t!==`modal`)return re({startExtra:(0,R.jsx)(o,{to:nt,className:`flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover`,"aria-label":m.backToWork,children:(0,R.jsx)(x,{className:`size-4`})}),main:h?(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsx)(`p`,{className:`truncate text-sm font-semibold text-fg`,children:V?`${V} / ${m.taskLabel}`:m.taskLabel}),(0,R.jsx)(`p`,{className:`text-xs text-fg-muted`,children:m.detailStatuses[je(h)]})]}):null,end:null}),ie},[ie,m.backToWork,m.detailStatuses,m.taskLabel,h,t,V,nt,re]),ae&&!h)return(0,R.jsx)(`div`,{className:t===`modal`?`p-5 text-sm text-danger`:`mx-auto max-w-3xl p-6 text-sm text-danger`,children:m.taskNotFound});if(!h)return(0,R.jsx)(`div`,{className:t===`modal`?`p-5`:`mx-auto max-w-4xl p-4 sm:p-6`,children:(0,R.jsx)(Te,{})});let ut=h.waits[0],dt=ut?.kind===`paused`?ut:void 0,X=h.receipts[0],ft=m.detailStatuses[je(h)],pt=m.detailStatusDescriptions[je(h)],mt=h.task.body?.trim()||h.task.contract?.objective.trim(),ht=new Map(X?.verification.checks.map(e=>[e.criterion,e.status])),gt=h.allowedCommands.includes(`mark_ready`),_t=h.allowedCommands.includes(`start`),vt=h.allowedCommands.includes(`add_wait`),yt=h.task.phase===`review`&&h.allowedCommands.includes(`close`),bt=h.allowedCommands.includes(`reopen`),xt=h.conversation.activeSessionKey,Z=h.conversation.currentExecutorAgentId??h.task.delegateAgentId??h.task.ownerId,St=Fe.find(e=>e.id===Z),Ct=h.attention.some(e=>e.kind===`input_required`||e.kind===`approval_required`),Q=h.task.contract?.acceptanceCriteria??[],wt=Q.filter(e=>ht.get(e)===`passed`).length,Tt=h.task.contract?.expectedOutputs??[],Et=h.task.contract?.constraints??[],Dt=h.task.contract?.approvalRequired??[],Ot=h.task.contract?.assumptions??[],kt=h.task.contract?.risks??[],$=(...e)=>!!$e?.changedFields.some(t=>e.includes(t)),At=e=>t===`modal`&&n?_e(n,e):u(`/tasks/${e}`,nt),jt=h.allowedCommands.includes(`move`),Mt=e=>e!==h.task.phase&&(e===`closed`?!yt:h.task.phase===`closed`?!bt:!jt),Nt=(0,R.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[gt?(0,R.jsxs)(f,{variant:`primary`,disabled:F,onClick:()=>void q({type:`mark_ready`}),children:[(0,R.jsx)(S,{className:`size-4`}),m.scheduleTask]}):null,dt?(0,R.jsxs)(f,{variant:`primary`,disabled:F,onClick:()=>void q({type:`resolve_wait`,waitId:dt.id}),children:[(0,R.jsx)(S,{className:`size-4`}),m.resumeTask]}):null,!ut&&_t&&Z?(0,R.jsxs)(f,{variant:`primary`,disabled:F,onClick:()=>void q({type:`start`,executor:{kind:`agent`,agentId:Z}}),children:[(0,R.jsx)(S,{className:`size-4`}),m.runTask]}):null,yt?(0,R.jsxs)(f,{variant:`primary`,disabled:F,onClick:()=>void q({type:`close`,resolution:`done`}),children:[(0,R.jsx)(M,{className:`size-4`}),m.approveTask]}):null,bt?(0,R.jsxs)(f,{variant:`primary`,disabled:F,onClick:()=>void q({type:`reopen`,phase:`ready`}),children:[(0,R.jsx)(S,{className:`size-4`}),m.reopenTask]}):null,!ut&&vt?(0,R.jsxs)(f,{variant:`secondary`,className:`border-0 bg-surface-hover shadow-none`,disabled:F,onClick:()=>void q({type:`add_wait`,wait:{kind:`paused`,reason:`Paused by user`,condition:{}}}),children:[(0,R.jsx)(C,{className:`size-4`}),m.pauseTask]}):null,h.task.phase===`closed`?null:(0,R.jsxs)(O,{children:[(0,R.jsx)(se,{asChild:!0,children:(0,R.jsx)(f,{type:`button`,variant:`ghost`,className:`size-9 p-0`,disabled:F,"aria-label":m.moreActions,children:(0,R.jsx)(T,{className:`size-4`,"aria-hidden":!0})})}),(0,R.jsx)(ye,{children:(0,R.jsx)(D,{align:`end`,sideOffset:6,className:`z-[100] min-w-40 rounded-lg border border-edge bg-surface-panel p-1 shadow-popover`,children:(0,R.jsx)(oe,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-danger outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:()=>void q({type:`close`,resolution:`cancelled`}),children:m.cancelTask})})})]})]});return(0,R.jsxs)(`div`,{ref:Ge,className:`${t===`modal`?`flex h-full min-h-0 flex-col lg:flex-row`:`flex min-h-[calc(100dvh-8rem)] flex-col overflow-hidden lg:flex-row`} ${Ue?`lg:cursor-col-resize lg:select-none`:``}`,style:{"--task-chat-panel-width":`${G}%`},children:[(0,R.jsxs)(`section`,{className:`task-detail-scroll min-w-0 flex-1 overflow-y-auto overscroll-contain p-5 sm:p-6`,children:[(0,R.jsxs)(`header`,{className:d(`px-4 pb-5`,$(`title`)&&`task-detail-live-update`),children:[(0,R.jsx)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:[V?(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,R.jsx)(b,{className:`size-3.5`,"aria-hidden":!0}),V]}):null,(0,R.jsx)(`span`,{children:`/`}),(0,R.jsx)(`span`,{children:m.taskLabel}),$e?(0,R.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent-fg`,role:`status`,children:$e.source===`agent`?i===`zh`?`Agent 刚刚更新`:`Updated by Agent`:i===`zh`?`执行结果已同步`:`Execution result synced`}):null]}),Le?(0,R.jsx)(`input`,{autoFocus:!0,"data-task-inline-editor":!0,value:Re,onChange:e=>U(e.target.value),onBlur:()=>void rt(),onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur(),e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),Ke.current=!0,U(h.task.title),H(!1),queueMicrotask(()=>{Ke.current=!1}))},className:`mt-3 w-full max-w-3xl rounded-lg bg-surface-hover px-3 py-2 text-2xl font-semibold leading-8 text-fg outline-none ring-2 ring-accent/30 focus:ring-accent/60`}):(0,R.jsx)(`button`,{type:`button`,className:`mt-3 block max-w-3xl rounded-lg text-left outline-none hover:bg-surface-hover focus-visible:bg-surface-hover`,onClick:()=>{Ye.current={value:h.task.title,version:h.task.version},K(null),U(h.task.title),H(!0)},children:(0,R.jsx)(`h1`,{className:`text-2xl font-semibold leading-8 text-fg`,children:h.task.title})}),Qe===`title`?(0,R.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-warning`,role:`alert`,children:[(0,R.jsx)(`span`,{children:i===`zh`?`Agent 在你编辑期间更新了标题。`:`The Agent updated the title while you were editing.`}),(0,R.jsx)(`button`,{type:`button`,className:`rounded-md bg-surface-hover px-2 py-1 text-fg`,onClick:()=>{U(h.task.title),K(null),H(!1)},children:i===`zh`?`使用 Agent 版本`:`Use Agent version`}),(0,R.jsx)(`button`,{type:`button`,className:`rounded-md bg-accent-soft px-2 py-1 text-accent-fg`,onClick:()=>void J({title:Re.trim()}).then(e=>{e&&(K(null),H(!1))}),children:i===`zh`?`保留我的修改`:`Keep my changes`})]}):null]})}),he?(0,R.jsx)(`p`,{className:`mt-3 text-sm text-danger`,children:he}):null]}),(0,R.jsxs)(`div`,{className:`mt-5 flex flex-col gap-5`,children:[(0,R.jsxs)(`main`,{className:`order-2 min-w-0 space-y-5`,children:[(0,R.jsxs)(`section`,{className:d(`rounded-xl bg-surface-panel p-4`,$(`body`)&&`task-detail-live-update`),children:[(0,R.jsx)(`h2`,{className:`font-medium text-fg`,children:m.taskDescription}),ze?(0,R.jsx)(`textarea`,{autoFocus:!0,"data-task-inline-editor":!0,rows:6,value:Be,onChange:e=>Ve(e.target.value),onBlur:()=>void it(),onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),qe.current=!0,Ve(h.task.body??h.task.contract?.objective??``),W(!1),queueMicrotask(()=>{qe.current=!1}))},className:`mt-3 w-full resize-y rounded-lg bg-surface-hover px-3 py-2 text-sm leading-6 text-fg outline-none ring-2 ring-accent/20 focus:ring-accent/50`}):(0,R.jsx)(`button`,{type:`button`,className:`-mx-1 mt-2 block w-[calc(100%+0.5rem)] rounded-lg px-1 py-1 text-left outline-none hover:bg-surface-hover focus-visible:bg-surface-hover`,onClick:()=>{let e=h.task.body??h.task.contract?.objective??``;Je.current=e,Xe.current={value:h.task.body??``,version:h.task.version},K(null),Ve(e),W(!0)},children:(0,R.jsx)(`span`,{className:`whitespace-pre-wrap text-sm leading-6 text-fg-muted`,children:mt&&mt!==h.task.title?mt:m.noTaskDescription})}),Qe===`description`?(0,R.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-warning`,role:`alert`,children:[(0,R.jsx)(`span`,{children:i===`zh`?`Agent 在你编辑期间更新了描述。`:`The Agent updated the description while you were editing.`}),(0,R.jsx)(`button`,{type:`button`,className:`rounded-md bg-surface-hover px-2 py-1 text-fg`,onClick:()=>{Ve(h.task.body??``),K(null),W(!1)},children:i===`zh`?`使用 Agent 版本`:`Use Agent version`}),(0,R.jsx)(`button`,{type:`button`,className:`rounded-md bg-accent-soft px-2 py-1 text-accent-fg`,onClick:()=>void J({body:Be.trim()||null}).then(e=>{e&&(K(null),W(!1))}),children:i===`zh`?`保留我的修改`:`Keep my changes`})]}):null]}),h.attention.length>0?(0,R.jsxs)(`section`,{className:d(`rounded-xl bg-warning/10 p-4`,$(`attention`)&&`task-detail-live-update`),children:[(0,R.jsx)(`h3`,{className:`font-medium text-fg`,children:Ct?m.needsAttention:m.waitingStatus}),(0,R.jsx)(`ul`,{className:`mt-3 space-y-2 text-sm text-fg-muted`,children:h.attention.map((e,t)=>(0,R.jsx)(`li`,{children:e.summary},`${e.kind}-${t}`))})]}):null,(0,R.jsxs)(`section`,{className:d(`rounded-xl bg-surface-panel p-4`,$(`contract`)&&`task-detail-live-update`),children:[(0,R.jsx)(`h2`,{className:`font-medium text-fg`,children:m.taskDefinition}),(0,R.jsxs)(`div`,{className:`mt-5`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,R.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:m.successDefinition}),Q.length>0?(0,R.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:m.criteriaProgress.replace(`{{verified}}`,String(wt)).replace(`{{total}}`,String(Q.length))}):null]}),(0,R.jsx)(`div`,{className:`mt-3`,children:(0,R.jsx)(B,{items:Q,empty:m.noDefinition,verificationByCriterion:ht})})]}),Tt.length>0?(0,R.jsxs)(`div`,{className:`mt-5 rounded-lg bg-surface-hover p-4`,children:[(0,R.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:m.expectedOutputs}),(0,R.jsx)(`div`,{className:`mt-3`,children:(0,R.jsx)(B,{items:Tt,empty:m.noDefinition})})]}):null,Et.length>0?(0,R.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,R.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:m.constraints}),(0,R.jsx)(`div`,{className:`mt-3`,children:(0,R.jsx)(B,{items:Et,empty:m.noDefinition})})]}):null,Dt.length>0?(0,R.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,R.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:m.approvalRequired}),(0,R.jsx)(`div`,{className:`mt-3`,children:(0,R.jsx)(B,{items:Dt,empty:m.noDefinition})})]}):null,Ot.length>0?(0,R.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,R.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:m.contextAssumptions}),(0,R.jsx)(`div`,{className:`mt-3`,children:(0,R.jsx)(B,{items:Ot,empty:m.noDefinition})})]}):null,kt.length>0?(0,R.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,R.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:m.contextRisks}),(0,R.jsx)(`div`,{className:`mt-3`,children:(0,R.jsx)(B,{items:kt,empty:m.noDefinition})})]}):null]}),X?(0,R.jsxs)(`section`,{className:d(`rounded-xl bg-surface-panel p-4`,$(`runs`,`receipts`)&&`task-detail-live-update`),children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h2`,{className:`font-medium text-fg`,children:m.latestResult}),(0,R.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg`,children:X.summary})]}),(0,R.jsxs)(`span`,{className:`rounded-full bg-surface-hover px-2.5 py-1 text-xs text-fg-muted`,children:[m.receiptStatuses[X.status],` · `,m.verificationStatuses[X.verification.status]]})]}),X.remainingWork.length>0?(0,R.jsxs)(`div`,{className:`mt-4`,children:[(0,R.jsx)(`h3`,{className:`text-xs font-medium text-fg-muted`,children:m.remainingWork}),(0,R.jsx)(`div`,{className:`mt-2`,children:(0,R.jsx)(B,{items:X.remainingWork,empty:m.noRemainingWork})})]}):null,X.nextAction?(0,R.jsxs)(`div`,{className:`mt-4 rounded-lg bg-surface-hover p-3`,children:[(0,R.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:m.nextAction}),(0,R.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:X.nextAction})]}):null,(0,R.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2`,children:[(0,R.jsx)(f,{className:`border-0 bg-surface-hover px-2 py-1 text-xs shadow-none`,variant:`secondary`,onClick:()=>void y(X.runId,`helpful`),children:m.doneWell}),(0,R.jsx)(f,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>void y(X.runId,`not_helpful`),children:m.needsFix}),X.evidence.filter(e=>e.uri).map(e=>(0,R.jsxs)(`a`,{className:`ml-auto inline-flex items-center gap-1 text-xs text-accent hover:underline`,href:e.uri,children:[(0,R.jsx)(l,{className:`size-3`}),e.title]},`${e.title}-${e.uri}`))]}),h.receipts.length>1?(0,R.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,R.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted`,children:m.executionHistory.replace(`{{count}}`,String(h.receipts.length-1))}),(0,R.jsx)(`div`,{className:`mt-3 space-y-3`,children:h.receipts.slice(1).map(e=>(0,R.jsx)(`article`,{className:`rounded-lg bg-surface-active p-3`,children:(0,R.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,R.jsx)(`p`,{className:`text-sm text-fg`,children:e.summary}),(0,R.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:m.receiptStatuses[e.status]})]})},e.runId))})]}):null]}):null,h.context.length>0?(0,R.jsxs)(`section`,{className:d(`rounded-xl bg-surface-panel p-4`,$(`context`)&&`task-detail-live-update`),children:[(0,R.jsx)(`h2`,{className:`font-medium text-fg`,children:m.contextUsed}),(0,R.jsx)(`ul`,{className:`mt-4 grid gap-2 sm:grid-cols-2`,children:h.context.map(e=>(0,R.jsxs)(`li`,{className:`min-w-0 rounded-lg bg-surface-hover p-2.5`,children:[(0,R.jsxs)(`span`,{className:`text-[11px] text-fg-subtle`,children:[m.contextRoleLabels[e.role],` · `,m.contextKindLabels[e.targetKind]]}),e.targetKind===`url`&&/^https?:\/\//.test(e.targetId)?(0,R.jsx)(`a`,{className:`mt-1 block break-all text-sm text-accent hover:underline`,href:e.targetId,target:`_blank`,rel:`noreferrer`,children:e.title??e.targetId}):(0,R.jsx)(`p`,{className:`mt-1 break-words text-sm text-fg`,children:e.title??e.targetId})]},e.id))})]}):null]}),(0,R.jsxs)(`aside`,{className:`order-1 min-w-0 space-y-4`,children:[(0,R.jsxs)(`section`,{className:d(`rounded-xl bg-surface-subtle p-4`,$(`phase`,`resolution`,`priority`,`dueAt`,`delegateAgentId`)&&`task-detail-live-update`),children:[(0,R.jsx)(`h2`,{className:`font-medium text-fg`,children:m.taskProperties}),(0,R.jsxs)(`div`,{className:`mt-4 grid gap-4 sm:grid-cols-2`,children:[(0,R.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[(0,R.jsx)(`span`,{children:m.taskPhase}),(0,R.jsx)(s,{triggerClassName:`border-0 bg-surface-hover shadow-none focus-visible:ring-2 focus-visible:ring-accent/30`,contentClassName:`border-0`,value:h.task.phase,disabled:F,onChange:e=>void at(e.target.value),children:[`backlog`,`ready`,`active`,`review`,`closed`].map(e=>(0,R.jsx)(c,{value:e,disabled:Mt(e),children:we(e,i)},e))})]}),(0,R.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[(0,R.jsx)(`span`,{children:m.priority}),(0,R.jsx)(s,{triggerClassName:`border-0 bg-surface-hover shadow-none focus-visible:ring-2 focus-visible:ring-accent/30`,contentClassName:`border-0`,value:h.task.priority,disabled:F,onChange:e=>void J({priority:e.target.value}),children:[`low`,`normal`,`high`,`critical`].map(e=>(0,R.jsx)(c,{value:e,children:m.priorityLabels[e]},e))})]}),(0,R.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[(0,R.jsx)(`span`,{children:m.dueDate}),(0,R.jsx)(be,{disabled:F,value:Ee(h.task.dueAt),onChange:e=>void J({dueAt:De(e)}),ariaLabel:m.dueDate})]}),(0,R.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[(0,R.jsx)(`span`,{children:m.executorLabel}),(0,R.jsxs)(s,{triggerClassName:`border-0 bg-surface-hover shadow-none focus-visible:ring-2 focus-visible:ring-accent/30`,contentClassName:`border-0`,value:h.conversation.currentExecutorAgentId??``,disabled:F,onChange:e=>void lt(e.target.value),children:[(0,R.jsx)(c,{value:``,disabled:!0,children:m.unassigned}),Fe.map(e=>(0,R.jsx)(c,{value:e.id,children:e.name||e.id},e.id))]})]}),V?(0,R.jsxs)(`div`,{className:`grid gap-1 text-xs text-fg-muted`,children:[(0,R.jsx)(`span`,{children:m.projectLabel}),(0,R.jsxs)(`span`,{className:`flex items-center gap-1.5 rounded-lg bg-surface-hover px-3 py-2 text-sm text-fg`,children:[(0,R.jsx)(b,{className:`size-3.5`}),V]})]}):null]}),(0,R.jsxs)(`div`,{className:`mt-4 rounded-lg bg-surface-hover p-3 text-xs leading-5 text-fg-subtle`,children:[(0,R.jsx)(`p`,{children:ft}),(0,R.jsx)(`p`,{children:pt}),(0,R.jsx)(`p`,{className:`mt-2`,children:m.updatedAt.replace(`{{date}}`,ve(h.task.updatedAt,i))})]})]}),(0,R.jsxs)(`section`,{className:d(`rounded-xl bg-surface-panel p-4`,$(`dependencies`)&&`task-detail-live-update`),children:[(0,R.jsx)(`h2`,{className:`font-medium text-fg`,children:m.taskRelations}),(0,R.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:m.dependencies}),(0,R.jsx)(xe,{borderless:!0,candidates:Me,selectedIds:h.dependencies.map(e=>e.id),disabled:F,onChange:e=>void ct(e),labels:{link:m.linkDependencies,linked:m.linkedDependencies,searchPlaceholder:m.dependencySearchPlaceholder,noMatches:m.noDependencyMatches,noCandidates:m.noDependencyCandidates,remove:m.removeDependency}})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:m.dependents}),h.dependents.length>0?(0,R.jsx)(`div`,{className:`space-y-1.5`,children:h.dependents.map(e=>(0,R.jsx)(o,{to:At(e.id),className:`block rounded-lg bg-surface-hover p-2.5 text-sm text-accent hover:underline`,children:e.title},e.id))}):(0,R.jsx)(`p`,{className:`text-sm text-fg-subtle`,children:m.noDependents})]})]})]})]})]})]}),(0,R.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":i===`zh`?`调整任务信息和 Agent 对话的宽度`:`Resize task details and Agent chat`,"aria-valuemin":30,"aria-valuemax":60,"aria-valuenow":Math.round(G),tabIndex:0,onPointerDown:st,onKeyDown:ot,onDoubleClick:()=>Y(z),className:`group hidden w-2 shrink-0 cursor-col-resize touch-none items-stretch justify-center bg-surface-panel outline-none transition-colors hover:bg-surface-hover focus-visible:bg-surface-hover lg:flex ${Ue?`bg-surface-hover`:``}`,children:(0,R.jsx)(`div`,{className:`my-3 w-px rounded-full bg-edge-strong/70 transition-colors group-hover:bg-accent group-focus-visible:bg-accent`})}),(0,R.jsxs)(`aside`,{className:`flex min-h-[34rem] min-w-0 flex-col bg-surface-panel lg:min-h-0 lg:w-[var(--task-chat-panel-width)] lg:shrink-0`,children:[(0,R.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-3 bg-surface-subtle px-4 py-3.5`,children:[(0,R.jsx)(`div`,{className:`min-w-0`,children:(0,R.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[Z?(0,R.jsx)(j,{agentId:Z,avatar:St?.avatar,size:28,className:`shrink-0`}):null,(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:i===`zh`?`Agent 执行与对话`:`Agent execution and chat`}),(0,R.jsxs)(`p`,{className:`mt-0.5 truncate text-xs text-fg-muted`,children:[St?.name??Z??m.unassigned,` · `,ft]})]})]})}),(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[Nt,xt?(0,R.jsx)(f,{asChild:!0,variant:`ghost`,className:`h-8 shrink-0 px-2 text-xs`,children:(0,R.jsxs)(o,{to:me(e),children:[(0,R.jsx)(l,{className:`size-3.5`}),i===`zh`?`全屏`:`Full screen`]})}):null]})]}),xt?(0,R.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,R.jsx)(pe,{embedded:!0,sessionKey:xt,taskId:e})}):ue?(0,R.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,R.jsxs)(`div`,{className:`max-w-xs`,children:[(0,R.jsx)(de,{className:`mx-auto size-8 animate-pulse text-fg-subtle`}),(0,R.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:i===`zh`?`正在创建任务会话`:`Creating task conversation`})]})}):N?(0,R.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,R.jsxs)(`div`,{className:`max-w-xs`,children:[(0,R.jsx)(de,{className:`mx-auto size-8 text-danger`}),(0,R.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:i===`zh`?`任务会话创建失败`:`Could not create task conversation`}),(0,R.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:N instanceof Error?N.message:String(N)})]})}):(0,R.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,R.jsxs)(`div`,{className:`max-w-xs`,children:[(0,R.jsx)(de,{className:`mx-auto size-8 text-fg-subtle`}),(0,R.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:i===`zh`?`等待任务会话`:`Waiting for a task conversation`}),(0,R.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:i===`zh`?`安排或开始任务后,Agent 的执行过程和持续对话会显示在这里。`:`Schedule or start the task to see the agent run and continue the conversation here.`})]})})]})]})}function Ne(){let e=(0,L.c)(2),{taskId:t}=i(),n=t===void 0?``:t,r;return e[0]===n?r=e[1]:(r=(0,R.jsx)(Me,{taskId:n,presentation:`page`}),e[0]=n,e[1]=r),r}function V(e){let t=(0,L.c)(43),{taskId:n,backgroundPath:r,onClose:i}=e,a=ne(ze),o=F(U),s=F(Re),c=F(H),l=P(Le),u=P(Ie),ee=o?s:0,d;t[0]!==i||t[1]!==u?(d=e=>{e||(u(null),i())},t[0]=i,t[1]=u,t[2]=d):d=t[2];let f=a===`zh`?`关闭任务详情`:`Close task details`,p;t[3]!==i||t[4]!==u?(p=()=>{u(null),i()},t[3]=i,t[4]=u,t[5]=p):p=t[5];let _;t[6]!==f||t[7]!==p?(_=(0,R.jsx)(`button`,{type:`button`,tabIndex:-1,"data-task-modal-backdrop":!0,className:`fixed inset-0 z-[80] bg-black/45 backdrop-blur-[1px]`,"aria-label":f,onClick:p}),t[6]=f,t[7]=p,t[8]=_):_=t[8];let v=o?`true`:`false`,oe=`${ee/2}px`,se=`${ee}px`,y;t[9]!==oe||t[10]!==se?(y={"--task-detail-workspace-offset":oe,"--task-detail-workspace-width":se},t[9]=oe,t[10]=se,t[11]=y):y=t[11];let b=y,x=a===`zh`?`任务详情`:`Task details`,S;t[12]===x?S=t[13]:(S=(0,R.jsx)(ae,{className:`font-medium text-fg`,children:x}),t[12]=x,t[13]=S);let C=a===`zh`?`查看并操作任务详情`:`View and manage task details`,w;t[14]===C?w=t[15]:(w=(0,R.jsx)(m,{className:`sr-only`,children:C}),t[14]=C,t[15]=w);let ce=a===`zh`?`关闭任务详情`:`Close task details`,T;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,R.jsx)(te,{className:`size-4`,"aria-hidden":!0}),t[16]=T):T=t[16];let E;t[17]===ce?E=t[18]:(E=(0,R.jsx)(re,{className:`flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":ce,children:T}),t[17]=ce,t[18]=E);let D;t[19]!==S||t[20]!==w||t[21]!==E?(D=(0,R.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-3 bg-surface-panel px-5 py-3.5`,children:[S,w,E]}),t[19]=S,t[20]=w,t[21]=E,t[22]=D):D=t[22];let O;t[23]!==r||t[24]!==n?(O=(0,R.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,R.jsx)(Me,{taskId:n,presentation:`modal`,backgroundPath:r})}),t[23]=r,t[24]=n,t[25]=O):O=t[25];let k;t[26]!==D||t[27]!==O||t[28]!==v||t[29]!==b?(k=(0,R.jsxs)(h,{className:`task-detail-modal-content fixed top-1/2 z-[90] flex h-[min(54rem,calc(100dvh-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl bg-surface-base shadow-float focus:outline-none`,"data-workspace-panel-open":v,style:b,onEscapeKeyDown:Fe,onInteractOutside:Pe,children:[D,O]}),t[26]=D,t[27]=O,t[28]=v,t[29]=b,t[30]=k):k=t[30];let A;t[31]!==l||t[32]!==o||t[33]!==s||t[34]!==c?(A=l?(0,R.jsx)(`div`,{className:`fixed inset-y-0 left-0 z-[100] flex min-h-0 min-w-0 overflow-hidden bg-surface-panel transition-[right] duration-200 ease-out motion-reduce:transition-none`,style:{right:o?s:0},children:(0,R.jsx)(N,{allowOutsideChat:!0,sessionKey:c??void 0})}):null,t[31]=l,t[32]=o,t[33]=s,t[34]=c,t[35]=A):A=t[35];let j;t[36]!==k||t[37]!==A||t[38]!==_?(j=(0,R.jsxs)(ie,{children:[_,k,A]}),t[36]=k,t[37]=A,t[38]=_,t[39]=j):j=t[39];let M;return t[40]!==d||t[41]!==j?(M=(0,R.jsx)(g,{modal:!1,open:!0,onOpenChange:d,children:j}),t[40]=d,t[41]=j,t[42]=M):M=t[42],M}function Pe(e){let t=e.detail.originalEvent.target;t instanceof Element&&t.closest(`#app-workspace-panel, [data-task-modal-backdrop]`)&&e.preventDefault()}function Fe(e){let t=e.target;t instanceof HTMLElement&&t.closest(`[data-task-inline-editor]`)&&e.preventDefault()}function Ie(e){return e.setPath}function Le(e){return e.path}function H(e){return e.sessionKeyOverride}function Re(e){return e.widthPx}function U(e){return e.open}function ze(e){return e.language}export{V as TaskDetailModal,Ne as TaskDetailPage};
@@ -1 +1 @@
1
- import{p as e}from"./locale-store-CbPVxonP.js";import{t}from"./middleware-Pd0e8Igk.js";var n=`default`,r={light:{default:`#ffffff`,emerald:`#f0fdf4`,mono:`#ffffff`,clay:`#fffaf0`},dark:{default:`#0a0a0a`,emerald:`#000000`,mono:`#101010`,clay:`#0a1a1a`}};function i(e,t){let n=document.head;if(!n)return;let i=n.querySelector(`meta[name="theme-color"][data-xopc-theme-color="true"]`);i||(i=document.createElement(`meta`),i.setAttribute(`name`,`theme-color`),i.setAttribute(`data-xopc-theme-color`,`true`),n.appendChild(i)),i.setAttribute(`content`,r[e][t])}function a(){return globalThis.matchMedia?.(`(prefers-color-scheme: dark)`).matches??!1}function o(e){return e===`system`?a()?`dark`:`light`:e}function s(){return globalThis.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches??!1}function c(e){return e===`cal`?`mono`:e==="default"||e===`emerald`||e===`mono`||e===`clay`?e:n}function l(e,t,n){let r=document.documentElement,a=()=>{r.classList.toggle(`dark`,e===`dark`),r.dataset.theme=e,r.dataset.colorScheme=t,i(e,t)},o=document;n&&!s()&&typeof o.startViewTransition==`function`?o.startViewTransition(a):a()}function u(){try{let e=localStorage.getItem(`xopc-web-theme`),t=`system`,r=n;if(e){let n=JSON.parse(e);n.state?.preference&&(t=n.state.preference),n.state&&`colorScheme`in n.state&&(r=c(n.state.colorScheme))}l(o(t),r,!1)}catch{l(o(`system`),`default`,!1)}}var d=e(t((e,t)=>({preference:`system`,colorScheme:n,resolved:o(`system`),setPreference:n=>{let r=o(n),{resolved:i,colorScheme:a}=t();l(r,a,r!==i),e({preference:n,resolved:r})},setColorScheme:n=>{let{resolved:r}=t();l(r,n,!0),e({colorScheme:n})}}),{name:`xopc-web-theme`,merge:(e,t)=>{let n=e??{};return{...t,...n,colorScheme:c(n.colorScheme)}}}));function f(){let{preference:e,colorScheme:t}=d.getState(),n=o(e);l(n,t,!1),d.setState({resolved:n})}function p(){let e=globalThis.matchMedia?.(`(prefers-color-scheme: dark)`);if(!e)return()=>{};let t=()=>{let{preference:e,colorScheme:t}=d.getState();if(e!==`system`)return;let n=o(`system`),r=d.getState().resolved;l(n,t,n!==r),d.setState({resolved:n})};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)}export{d as i,p as n,f as r,u as t};
1
+ import{p as e}from"./locale-store-CieddUjx.js";import{t}from"./middleware-Pd0e8Igk.js";var n=`default`,r={light:{default:`#ffffff`,emerald:`#f0fdf4`,mono:`#ffffff`,clay:`#fffaf0`},dark:{default:`#0a0a0a`,emerald:`#000000`,mono:`#101010`,clay:`#0a1a1a`}};function i(e,t){let n=document.head;if(!n)return;let i=n.querySelector(`meta[name="theme-color"][data-xopc-theme-color="true"]`);i||(i=document.createElement(`meta`),i.setAttribute(`name`,`theme-color`),i.setAttribute(`data-xopc-theme-color`,`true`),n.appendChild(i)),i.setAttribute(`content`,r[e][t])}function a(){return globalThis.matchMedia?.(`(prefers-color-scheme: dark)`).matches??!1}function o(e){return e===`system`?a()?`dark`:`light`:e}function s(){return globalThis.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches??!1}function c(e){return e===`cal`?`mono`:e==="default"||e===`emerald`||e===`mono`||e===`clay`?e:n}function l(e,t,n){let r=document.documentElement,a=()=>{r.classList.toggle(`dark`,e===`dark`),r.dataset.theme=e,r.dataset.colorScheme=t,i(e,t)},o=document;n&&!s()&&typeof o.startViewTransition==`function`?o.startViewTransition(a):a()}function u(){try{let e=localStorage.getItem(`xopc-web-theme`),t=`system`,r=n;if(e){let n=JSON.parse(e);n.state?.preference&&(t=n.state.preference),n.state&&`colorScheme`in n.state&&(r=c(n.state.colorScheme))}l(o(t),r,!1)}catch{l(o(`system`),`default`,!1)}}var d=e(t((e,t)=>({preference:`system`,colorScheme:n,resolved:o(`system`),setPreference:n=>{let r=o(n),{resolved:i,colorScheme:a}=t();l(r,a,r!==i),e({preference:n,resolved:r})},setColorScheme:n=>{let{resolved:r}=t();l(r,n,!0),e({colorScheme:n})}}),{name:`xopc-web-theme`,merge:(e,t)=>{let n=e??{};return{...t,...n,colorScheme:c(n.colorScheme)}}}));function f(){let{preference:e,colorScheme:t}=d.getState(),n=o(e);l(n,t,!1),d.setState({resolved:n})}function p(){let e=globalThis.matchMedia?.(`(prefers-color-scheme: dark)`);if(!e)return()=>{};let t=()=>{let{preference:e,colorScheme:t}=d.getState();if(e!==`system`)return;let n=o(`system`),r=d.getState().resolved;l(n,t,n!==r),d.setState({resolved:n})};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)}export{d as i,p as n,f as r,u as t};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./check-DUBLcKHA.js";import{t as a}from"./loader-circle-CifKLtgG.js";import{t as o}from"./cn-JdwAhgNB.js";import{n as s}from"./locale-store-CbPVxonP.js";import{bl as c}from"./index-DHGnTdgl.js";var l=n(),u=r();function d(e){let t=(0,l.c)(21),{status:n,error:r,className:d}=e,p=s(f)===`zh`,m=n===`saving`?p?`正在保存…`:`Saving…`:n===`saved`?p?`已自动保存`:`Saved automatically`:n===`error`?r||(p?`自动保存失败`:`Autosave failed`):n===`dirty`?p?`编辑中,将自动保存`:`Editing — autosave pending`:p?`自动保存`:`Autosave`,h=n===`error`?`text-danger`:n===`saved`?`text-success`:`text-fg-subtle`,g;t[0]!==d||t[1]!==h?(g=o(`inline-flex min-w-0 items-center gap-1.5 text-xs`,h,d),t[0]=d,t[1]=h,t[2]=g):g=t[2];let _;t[3]===n?_=t[4]:(_=n===`saving`?(0,u.jsx)(a,{className:`size-3.5 shrink-0 animate-spin`,"aria-hidden":!0}):null,t[3]=n,t[4]=_);let v;t[5]===n?v=t[6]:(v=n===`saved`?(0,u.jsx)(i,{className:`size-3.5 shrink-0`,"aria-hidden":!0}):null,t[5]=n,t[6]=v);let y;t[7]===n?y=t[8]:(y=n===`error`?(0,u.jsx)(c,{className:`size-3.5 shrink-0`,"aria-hidden":!0}):null,t[7]=n,t[8]=y);let b;t[9]===n?b=t[10]:(b=n===`dirty`?(0,u.jsx)(`span`,{className:`size-1.5 shrink-0 rounded-full bg-current`,"aria-hidden":!0}):null,t[9]=n,t[10]=b);let x;t[11]===m?x=t[12]:(x=(0,u.jsx)(`span`,{className:`truncate`,children:m}),t[11]=m,t[12]=x);let S;return t[13]!==m||t[14]!==g||t[15]!==_||t[16]!==v||t[17]!==y||t[18]!==b||t[19]!==x?(S=(0,u.jsxs)(`span`,{className:g,role:`status`,"aria-live":`polite`,title:m,children:[_,v,y,b,x]}),t[13]=m,t[14]=g,t[15]=_,t[16]=v,t[17]=y,t[18]=b,t[19]=x,t[20]=S):S=t[20],S}function f(e){return e.language}var p=e(t(),1);function m({value:e,dirty:t,onSave:n,enabled:r=!0,delayMs:i=700,validate:a,serialize:o=JSON.stringify}){let[s,c]=(0,p.useState)(`idle`),[l,u]=(0,p.useState)(null),d=(0,p.useRef)(e),f=(0,p.useRef)(n),m=(0,p.useRef)(a),h=(0,p.useRef)(o),g=(0,p.useRef)(null),_=(0,p.useRef)(!1),v=(0,p.useRef)(null),y=(0,p.useRef)(null),b=(0,p.useRef)(null),x=(0,p.useRef)(!0);d.current=e,f.current=n,m.current=a,h.current=o;let S=(0,p.useCallback)(()=>{g.current!==null&&(window.clearTimeout(g.current),g.current=null)},[]),C=(0,p.useCallback)(async e=>{S();let t=h.current(e);b.current=t;let n=m.current?.(e)??null;if(n){u(n),c(`error`);return}if(_.current){v.current=e;return}_.current=!0,u(null),c(`saving`);try{await f.current(e),y.current=t,x.current&&c(`saved`)}catch(e){x.current&&(u(e instanceof Error?e.message:String(e)),c(`error`))}finally{_.current=!1;let e=v.current;v.current=null,e&&h.current(e)!==y.current&&C(e)}},[S]),w=(0,p.useCallback)(()=>{let e=d.current;!r||!t||e===null||C(e)},[t,r,C]),T=(0,p.useCallback)(e=>{let t=e??d.current;!r||t===null||C(t)},[r,C]);return(0,p.useEffect)(()=>{if(!r||!t||e===null){S(),!t&&s===`dirty`&&c(`idle`);return}let n=o(e);if(n!==y.current&&!(s===`error`&&n===b.current))return c(e=>e===`saving`?e:`dirty`),S(),g.current=window.setTimeout(()=>void C(e),i),S},[S,i,t,r,C,o,s,e]),(0,p.useEffect)(()=>(x.current=!0,()=>{x.current=!1,S()}),[S]),{status:s,error:l,flush:w,saveNow:T,retry:w,onBlurCapture:w}}export{d as n,m as t};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./check-DUBLcKHA.js";import{t as a}from"./loader-circle-CifKLtgG.js";import{t as o}from"./cn-JdwAhgNB.js";import{n as s}from"./locale-store-CieddUjx.js";import{Sl as c}from"./index-CrwXzRpA.js";var l=n(),u=r();function d(e){let t=(0,l.c)(21),{status:n,error:r,className:d}=e,p=s(f)===`zh`,m=n===`saving`?p?`正在保存…`:`Saving…`:n===`saved`?p?`已自动保存`:`Saved automatically`:n===`error`?r||(p?`自动保存失败`:`Autosave failed`):n===`dirty`?p?`编辑中,将自动保存`:`Editing — autosave pending`:p?`自动保存`:`Autosave`,h=n===`error`?`text-danger`:n===`saved`?`text-success`:`text-fg-subtle`,g;t[0]!==d||t[1]!==h?(g=o(`inline-flex min-w-0 items-center gap-1.5 text-xs`,h,d),t[0]=d,t[1]=h,t[2]=g):g=t[2];let _;t[3]===n?_=t[4]:(_=n===`saving`?(0,u.jsx)(a,{className:`size-3.5 shrink-0 animate-spin`,"aria-hidden":!0}):null,t[3]=n,t[4]=_);let v;t[5]===n?v=t[6]:(v=n===`saved`?(0,u.jsx)(i,{className:`size-3.5 shrink-0`,"aria-hidden":!0}):null,t[5]=n,t[6]=v);let y;t[7]===n?y=t[8]:(y=n===`error`?(0,u.jsx)(c,{className:`size-3.5 shrink-0`,"aria-hidden":!0}):null,t[7]=n,t[8]=y);let b;t[9]===n?b=t[10]:(b=n===`dirty`?(0,u.jsx)(`span`,{className:`size-1.5 shrink-0 rounded-full bg-current`,"aria-hidden":!0}):null,t[9]=n,t[10]=b);let x;t[11]===m?x=t[12]:(x=(0,u.jsx)(`span`,{className:`truncate`,children:m}),t[11]=m,t[12]=x);let S;return t[13]!==m||t[14]!==g||t[15]!==_||t[16]!==v||t[17]!==y||t[18]!==b||t[19]!==x?(S=(0,u.jsxs)(`span`,{className:g,role:`status`,"aria-live":`polite`,title:m,children:[_,v,y,b,x]}),t[13]=m,t[14]=g,t[15]=_,t[16]=v,t[17]=y,t[18]=b,t[19]=x,t[20]=S):S=t[20],S}function f(e){return e.language}var p=e(t(),1);function m({value:e,dirty:t,onSave:n,enabled:r=!0,delayMs:i=700,validate:a,serialize:o=JSON.stringify}){let[s,c]=(0,p.useState)(`idle`),[l,u]=(0,p.useState)(null),d=(0,p.useRef)(e),f=(0,p.useRef)(n),m=(0,p.useRef)(a),h=(0,p.useRef)(o),g=(0,p.useRef)(null),_=(0,p.useRef)(!1),v=(0,p.useRef)(null),y=(0,p.useRef)(null),b=(0,p.useRef)(null),x=(0,p.useRef)(!0);d.current=e,f.current=n,m.current=a,h.current=o;let S=(0,p.useCallback)(()=>{g.current!==null&&(window.clearTimeout(g.current),g.current=null)},[]),C=(0,p.useCallback)(async e=>{S();let t=h.current(e);b.current=t;let n=m.current?.(e)??null;if(n){u(n),c(`error`);return}if(_.current){v.current=e;return}_.current=!0,u(null),c(`saving`);try{await f.current(e),y.current=t,x.current&&c(`saved`)}catch(e){x.current&&(u(e instanceof Error?e.message:String(e)),c(`error`))}finally{_.current=!1;let e=v.current;v.current=null,e&&h.current(e)!==y.current&&C(e)}},[S]),w=(0,p.useCallback)(()=>{let e=d.current;!r||!t||e===null||C(e)},[t,r,C]),T=(0,p.useCallback)(e=>{let t=e??d.current;!r||t===null||C(t)},[r,C]);return(0,p.useEffect)(()=>{if(!r||!t||e===null){S(),!t&&s===`dirty`&&c(`idle`);return}let n=o(e);if(n!==y.current&&!(s===`error`&&n===b.current))return c(e=>e===`saving`?e:`dirty`),S(),g.current=window.setTimeout(()=>void C(e),i),S},[S,i,t,r,C,o,s,e]),(0,p.useEffect)(()=>(x.current=!0,()=>{x.current=!1,S()}),[S]),{status:s,error:l,flush:w,saveNow:T,retry:w,onBlurCapture:w}}export{d as n,m as t};
@@ -1 +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,r as s}from"./popover-select-BzdnTy3h.js";import{t as c}from"./external-link-DjqjBmc3.js";import{t as l}from"./loader-circle-CifKLtgG.js";import{t as u}from"./plus-Q2yW6OE7.js";import{t as d}from"./x-B_N4OPjy.js";import{t as f}from"./button-CSEbl4zT.js";import{n as p}from"./locale-store-CbPVxonP.js";import{a as m,i as h,n as g,o as _,r as v,s as y,t as b}from"./dist-BPoKqzeH.js";import{i as x}from"./vendor-swr-BIWyz7Rc.js";import{$c as S,$s as C,Aa as w,Cs as T,Dl as E,El as D,Fc as O,Gs as k,Va as A,_o as j,ao as M,as as N,co as P,do as F,fl as I,fo as L,go as R,ho as z,io as B,lo as V,mo as H,no as U,oo as W,po as G,ro as K,so as q,to as J,uo as Y,xl as X}from"./index-DHGnTdgl.js";import{n as ee,t as te}from"./use-autosave-CiuRY85U.js";import{t as ne}from"./page-tabs-BaEQMYm_.js";import{F as re,a as ie,i as ae}from"./connectors-api-Sw0BrUmJ.js";var Z=n(),Q=e(t(),1),$=r(),oe=new Set([`profile`,`understanding`,`collaboration`,`sources`,`dreaming`,`privacy`]),se=`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`,ce={en:{title:`About You`,subtitle:`What xopc knows, why it knows it, and how it should work with you.`,profile:`Profile`,understanding:`Understanding`,collaboration:`Working agreement`,sources:`Sources`,dreaming:`Background review`,privacy:`Privacy`,profileHint:`Facts you provide directly. These are available across conversations.`,done:`Done`,required:`This field cannot be empty.`,callName:`What should xopc call you?`,callNamePlaceholder:`For example: Alex, Joyce, or Dr. Chen`,role:`Your role`,rolePlaceholder:`For example: product designer, founder, or engineer`,primaryGoal:`What are you mainly trying to achieve?`,primaryGoalPlaceholder:`The outcome you want xopc to optimize for`,pronouns:`Pronouns (optional)`,pronounsPlaceholder:`For example: she/her, he/him, they/them`,timezone:`Timezone`,locale:`Language / locale`,detect:`Use this device`,understoodHint:`Reviewable beliefs learned from your conversations and work. Inferences stay pending until confirmed.`,addUnderstanding:`Add understanding`,statement:`What should xopc understand?`,kind:`Type`,add:`Add`,cancel:`Cancel`,active:`Active`,review:`Needs review`,confirm:`Confirm`,reject:`Wrong`,edit:`Edit`,delete:`Delete`,confirmDelete:`Delete now`,rulesHint:`Explicit instructions for how xopc should collaborate with you. Rules outrank inferred understanding.`,addRule:`Add rule`,ruleStatement:`How should xopc work with you?`,category:`Category`,disable:`Disable`,enable:`Enable`,emptyUnderstanding:`Nothing here yet. Tell xopc something explicitly, or confirm a suggestion after it learns one.`,qualityTitle:`Learning quality`,qualityActive:`Confirmed`,qualityPending:`Pending review`,qualityAcceptance:`30-day acceptance`,qualityRecall:`Helpful recall`,qualityNoData:`Not enough feedback yet`,emptyRules:`No working agreements yet.`,sourceExplicit:`You said this directly`,sourceInferred:`Inferred — may be wrong`,sourceObserved:`Observed across prior work`,sourcesHint:`Review every granted source, its access mode, retention, and last collection. Revoking stops future learning.`,manageSources:`Connect another source`,authorizedSources:`Authorized sources`,connectorsTitle:`Connectors`,openConnector:`Open connector`,noSources:`No sources are authorized.`,noConnectors:`No connectors are installed.`,connected:`Connected`,unavailable:`Needs attention`,revoke:`Revoke source`,revokeHint:`Revoke this source and remove its derived understanding`,confirmRevoke:`Confirm revoke`,revoking:`Revoking…`,revokeDone:`Source revoked and derived understanding removed.`,refresh:`Update`,refreshing:`Updating…`,refreshStarted:`Update started.`,actionFailed:`Action failed`,once:`One-time`,continuous:`Continuous`,localOnly:`Local only`,derivedOnly:`Derived understanding only`,focuses:`Current focuses`,focusHint:`Candidate focuses never activate until you confirm them.`,activate:`Activate`,pause:`Pause`,complete:`Complete`,noFocuses:`No focus candidates yet.`,focusCandidate:`Suggested`,focusActive:`Active`,focusPaused:`Paused`,focusCompleted:`Completed`,confidence:`Confidence`,confidenceHigh:`High`,confidenceMedium:`Medium`,confidenceLow:`Low`,dreamingHint:`A deterministic daily review checks expiry, contradictory evidence, and corroborated candidates. It never auto-activates an inference.`,mode:`Background review`,on:`On — propose for review`,off:`Off`,reviewTime:`Daily review time`,evidenceThreshold:`Supporting evidence required`,scanLimit:`Maximum items per run`,lastRun:`Last review`,neverRun:`Not run yet`,runCompleted:`Completed`,runFailed:`Failed`,runRunning:`Running`,runItems:`items`,privacyHint:`Choose how generic memory providers handle sensitive content. Structured user understanding applies stricter rules of its own.`,sensitivePolicy:`Sensitive memory writes`,policyDeny:`Do not store`,policyConfirm:`Ask before storing`,policyAllow:`Store when relevant`,privacyWarning:`Secret and regulated content is never stored as structured user understanding, regardless of this setting.`,error:`Could not load your context.`,retry:`Try again`},zh:{title:`关于你`,subtitle:`清楚查看 xopc 知道什么、为什么知道,以及应该如何与你协作。`,profile:`个人资料`,understanding:`对你的理解`,collaboration:`协作约定`,sources:`数据来源`,dreaming:`后台复核`,privacy:`隐私`,profileHint:`由你直接提供的事实,会在不同对话中使用。`,done:`完成`,required:`此项不能为空。`,callName:`希望 xopc 如何称呼你?`,callNamePlaceholder:`例如:Mic、Joyce、张老师`,role:`你的角色`,rolePlaceholder:`例如:产品设计师、创业者、工程师`,primaryGoal:`你目前最想达成什么?`,primaryGoalPlaceholder:`希望 xopc 优先帮助你实现的结果`,pronouns:`代词(可选)`,pronounsPlaceholder:`例如:she/her、he/him、they/them`,timezone:`时区`,locale:`语言 / 地区`,detect:`使用本机时区`,understoodHint:`从对话和工作中形成、可复核的理解。推断内容在你确认前保持待审核。`,addUnderstanding:`添加理解`,statement:`希望 xopc 了解什么?`,kind:`类型`,add:`添加`,cancel:`取消`,active:`使用中`,review:`待审核`,confirm:`确认`,reject:`不正确`,edit:`编辑`,delete:`删除`,confirmDelete:`确认删除`,rulesHint:`你明确设定的协作方式。协作约定的优先级高于推断出的理解。`,addRule:`添加约定`,ruleStatement:`希望 xopc 如何与你协作?`,category:`类别`,disable:`停用`,enable:`启用`,emptyUnderstanding:`还没有内容。你可以直接告诉 xopc,或在它学到建议后进行确认。`,emptyRules:`还没有协作约定。`,qualityTitle:`学习质量`,qualityActive:`已确认`,qualityPending:`待审核`,qualityAcceptance:`30 天采纳率`,qualityRecall:`有效召回`,qualityNoData:`反馈数据还不足`,sourceExplicit:`由你直接告知`,sourceInferred:`推断内容,可能有误`,sourceObserved:`从过往工作中观察到`,sourcesHint:`查看每项授权的访问方式、保留策略和最近采集时间;撤销后将停止后续学习。`,manageSources:`连接其他来源`,authorizedSources:`已授权数据来源`,connectorsTitle:`连接器`,openConnector:`打开连接器`,noSources:`尚未授权任何来源。`,noConnectors:`尚未安装连接器。`,connected:`已连接`,unavailable:`需要处理`,revoke:`撤销来源`,revokeHint:`撤销此来源并删除由它产生的理解`,confirmRevoke:`确认撤销`,revoking:`正在撤销…`,revokeDone:`已撤销来源并删除派生理解。`,refresh:`更新`,refreshing:`正在更新…`,refreshStarted:`更新任务已开始。`,actionFailed:`操作失败`,once:`仅一次`,continuous:`持续更新`,localOnly:`仅本地处理`,derivedOnly:`仅保留派生理解`,focuses:`当前关注`,focusHint:`候选关注不会自动生效,只有你确认后才会启用。`,activate:`启用`,pause:`暂停`,complete:`完成`,noFocuses:`还没有候选关注。`,focusCandidate:`待确认`,focusActive:`进行中`,focusPaused:`已暂停`,focusCompleted:`已完成`,confidence:`置信度`,confidenceHigh:`高`,confidenceMedium:`中`,confidenceLow:`低`,dreamingHint:`每天进行一次确定性复核,检查过期、矛盾证据和得到佐证的候选理解;推断内容不会自动生效。`,mode:`后台复核`,on:`开启并生成待审核项`,off:`关闭`,reviewTime:`每日复核时间`,evidenceThreshold:`所需支持证据数`,scanLimit:`每次最多检查`,lastRun:`最近一次复核`,neverRun:`尚未运行`,runCompleted:`已完成`,runFailed:`失败`,runRunning:`运行中`,runItems:`项`,privacyHint:`选择通用记忆服务如何处理敏感内容;结构化用户理解有独立且更严格的规则。`,sensitivePolicy:`敏感记忆写入`,policyDeny:`不保存`,policyConfirm:`保存前询问`,policyAllow:`相关时允许保存`,privacyWarning:`无论这里如何设置,秘密和受监管内容都不会保存为结构化用户理解。`,error:`无法加载用户上下文。`,retry:`重试`}},le={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:`洞察`}},ue={communication:{en:`Communication`,zh:`沟通`},execution:{en:`Execution`,zh:`执行`},boundary:{en:`Boundary`,zh:`边界`},routine:{en:`Routine`,zh:`习惯`},proactive:{en:`Proactive help`,zh:`主动协助`}};function de(e){let t=(0,Z.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,$.jsx)(`section`,{className:`rounded-2xl border border-edge bg-surface-panel p-4 sm:p-5`,children:n}),t[0]=n,t[1]=r),r}function fe(e){let t=(0,Z.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,$.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge px-5 py-10 text-center text-sm text-fg-muted`,children:n}),t[0]=n,t[1]=r),r}function pe(e){let t=(0,Z.c)(33),{open:n,onOpenChange:r,title:i,description:a,submitLabel:o,cancelLabel:s,submitDisabled:c,onSubmit:l,children:u}=e,p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(m,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),t[0]=p):p=t[0];let x;t[1]===i?x=t[2]:(x=(0,$.jsx)(y,{className:`text-base font-semibold text-fg`,children:i}),t[1]=i,t[2]=x);let S;t[3]===a?S=t[4]:(S=(0,$.jsx)(h,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:a}),t[3]=a,t[4]=S);let C;t[5]!==x||t[6]!==S?(C=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[x,S]}),t[5]=x,t[6]=S,t[7]=C):C=t[7];let w;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,$.jsx)(d,{className:`size-4`}),t[8]=w):w=t[8];let T;t[9]===s?T=t[10]:(T=(0,$.jsx)(g,{asChild:!0,children:(0,$.jsx)(f,{type:`button`,variant:`ghost`,className:`size-8 shrink-0 p-0`,"aria-label":s,children:w})}),t[9]=s,t[10]=T);let E;t[11]!==C||t[12]!==T?(E=(0,$.jsxs)(`header`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge px-5 py-4`,children:[C,T]}),t[11]=C,t[12]=T,t[13]=E):E=t[13];let D;t[14]===u?D=t[15]:(D=(0,$.jsx)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-5`,children:u}),t[14]=u,t[15]=D);let O;t[16]===s?O=t[17]:(O=(0,$.jsx)(g,{asChild:!0,children:(0,$.jsx)(f,{type:`button`,children:s})}),t[16]=s,t[17]=O);let k;t[18]!==c||t[19]!==o?(k=(0,$.jsx)(f,{type:`submit`,variant:`primary`,disabled:c,children:o}),t[18]=c,t[19]=o,t[20]=k):k=t[20];let A;t[21]!==k||t[22]!==O?(A=(0,$.jsxs)(`footer`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-3`,children:[O,k]}),t[21]=k,t[22]=O,t[23]=A):A=t[23];let j;t[24]!==l||t[25]!==A||t[26]!==E||t[27]!==D?(j=(0,$.jsxs)(_,{children:[p,(0,$.jsx)(v,{className:`fixed left-1/2 top-1/2 z-[90] h-[min(30rem,calc(100vh-2rem))] w-[min(36rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`,children:(0,$.jsxs)(`form`,{className:`flex h-full min-h-0 flex-col`,onSubmit:l,children:[E,D,A]})})]}),t[24]=l,t[25]=A,t[26]=E,t[27]=D,t[28]=j):j=t[28];let M;return t[29]!==r||t[30]!==n||t[31]!==j?(M=(0,$.jsx)(b,{open:n,onOpenChange:r,children:j}),t[29]=r,t[30]=n,t[31]=j,t[32]=M):M=t[32],M}function me(e){return JSON.stringify(e)}function he(e){let t=(0,Z.c)(10),[n,r]=(0,Q.useState)(e),i;t[0]===e?i=t[1]:(i=me(e),t[0]=e,t[1]=i);let a=(0,Q.useRef)(i),o;t[2]===e?o=t[3]:(o=me(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=>me(n)===t?e:n)},l=[e,s],t[4]=e,t[5]=s,t[6]=c,t[7]=l):(c=t[6],l=t[7]),(0,Q.useEffect)(c,l);let u;return t[8]===n?u=t[9]:(u=[n,r],t[8]=n,t[9]=u),u}function ge(e){return{callName:e.callName,role:e.role,primaryGoal:e.primaryGoal,pronouns:e.pronouns,timezone:e.timezone,locale:e.locale}}function _e(){let e=(0,Z.c)(87),t=p(xe),n=ce[t],[r,a]=i(),o;if(e[0]!==r){let t=r.get(`tab`);o=t&&oe.has(t)?t:`profile`,e[0]=r,e[1]=o}else o=e[1];let s=o,c=A(be),l=A(ye),{data:u,error:d,isLoading:f,mutate:m}=x(`/api/you`,P),h;e[2]!==l||e[3]!==c||e[4]!==n.subtitle||e[5]!==n.title?(h=()=>(c({startExtra:null,main:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h1`,{className:`text-base font-semibold text-fg`,children:n.title}),(0,$.jsx)(`p`,{className:`hidden text-xs text-fg-muted sm:block`,children:n.subtitle})]}),end:null}),l),e[2]=l,e[3]=c,e[4]=n.subtitle,e[5]=n.title,e[6]=h):h=e[6];let g;if(e[7]!==l||e[8]!==c||e[9]!==n?(g=[l,c,n],e[7]=l,e[8]=c,e[9]=n,e[10]=g):g=e[10],(0,Q.useEffect)(h,g),f){let t;return e[11]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`div`,{className:`space-y-4 p-4 sm:p-6`,children:[(0,$.jsx)(w,{className:`h-10 w-96 max-w-full`}),(0,$.jsx)(w,{className:`h-72 rounded-2xl`})]}),e[11]=t):t=e[11],t}if(d||!u){let t;e[12]===m?t=e[13]:(t=()=>void m(),e[12]=m,e[13]=t);let r;e[14]!==n.retry||e[15]!==t?(r=(0,$.jsx)(`button`,{className:`text-accent hover:underline`,onClick:t,children:n.retry}),e[14]=n.retry,e[15]=t,e[16]=r):r=e[16];let i;return e[17]!==n.error||e[18]!==r?(i=(0,$.jsx)(`div`,{className:`p-6`,children:(0,$.jsxs)(fe,{children:[n.error,` `,r]})}),e[17]=n.error,e[18]=r,e[19]=i):i=e[19],i}let _=n.title,v;e[20]===a?v=e[21]:(v=e=>a({tab:e}),e[20]=a,e[21]=v);let y;e[22]===n.profile?y=e[23]:(y={id:`profile`,label:n.profile,icon:I},e[22]=n.profile,e[23]=y);let b;e[24]!==u.understandings.length||e[25]!==n.understanding?(b={id:`understanding`,label:n.understanding,icon:E,count:u.understandings.length},e[24]=u.understandings.length,e[25]=n.understanding,e[26]=b):b=e[26];let S=n.collaboration,k;e[27]===u.rules?k=e[28]:(k=u.rules.filter(ve),e[27]=u.rules,e[28]=k);let j;e[29]!==n.collaboration||e[30]!==k.length?(j={id:`collaboration`,label:S,icon:O,count:k.length},e[29]=n.collaboration,e[30]=k.length,e[31]=j):j=e[31];let M;e[32]===n.sources?M=e[33]:(M={id:`sources`,label:n.sources,icon:D},e[32]=n.sources,e[33]=M);let N;e[34]===n.dreaming?N=e[35]:(N={id:`dreaming`,label:n.dreaming,icon:C},e[34]=n.dreaming,e[35]=N);let F;e[36]===n.privacy?F=e[37]:(F={id:`privacy`,label:n.privacy,icon:T},e[36]=n.privacy,e[37]=F);let L;e[38]!==M||e[39]!==N||e[40]!==F||e[41]!==y||e[42]!==b||e[43]!==j?(L=[y,b,j,M,N,F],e[38]=M,e[39]=N,e[40]=F,e[41]=y,e[42]=b,e[43]=j,e[44]=L):L=e[44];let R;e[45]!==n.title||e[46]!==L||e[47]!==v||e[48]!==s?(R=(0,$.jsx)(ne,{ariaLabel:_,activeTab:s,onChange:v,items:L}),e[45]=n.title,e[46]=L,e[47]=v,e[48]=s,e[49]=R):R=e[49];let z;e[50]!==u.profile||e[51]!==t||e[52]!==m||e[53]!==n||e[54]!==s?(z=s===`profile`?(0,$.jsx)(Se,{profile:u.profile,language:t,t:n,onChanged:e=>m(t=>t&&{...t,profile:e},{revalidate:!1})}):null,e[50]=u.profile,e[51]=t,e[52]=m,e[53]=n,e[54]=s,e[55]=z):z=e[55];let B;e[56]!==u.quality||e[57]!==u.understandings||e[58]!==t||e[59]!==m||e[60]!==n||e[61]!==s?(B=s===`understanding`?(0,$.jsx)(we,{items:u.understandings,quality:u.quality,language:t,t:n,onChanged:e=>e?m(t=>t&&{...t,understandings:t.understandings.map(t=>t.id===e.id?e:t)},{revalidate:!0}):m()}):null,e[56]=u.quality,e[57]=u.understandings,e[58]=t,e[59]=m,e[60]=n,e[61]=s,e[62]=B):B=e[62];let V;e[63]!==u.rules||e[64]!==t||e[65]!==m||e[66]!==n||e[67]!==s?(V=s===`collaboration`?(0,$.jsx)(Me,{rules:u.rules,language:t,t:n,onChanged:()=>m()}):null,e[63]=u.rules,e[64]=t,e[65]=m,e[66]=n,e[67]=s,e[68]=V):V=e[68];let H;e[69]!==n||e[70]!==s?(H=s===`sources`?(0,$.jsx)(Fe,{t:n}):null,e[69]=n,e[70]=s,e[71]=H):H=e[71];let U;e[72]!==u.consolidation?.lastRun||e[73]!==n||e[74]!==s?(U=s===`dreaming`?(0,$.jsx)(Ie,{lastRun:u.consolidation?.lastRun??null,t:n}):null,e[72]=u.consolidation?.lastRun,e[73]=n,e[74]=s,e[75]=U):U=e[75];let W;e[76]!==n||e[77]!==s?(W=s===`privacy`?(0,$.jsx)(Re,{t:n}):null,e[76]=n,e[77]=s,e[78]=W):W=e[78];let G;return e[79]!==R||e[80]!==z||e[81]!==B||e[82]!==V||e[83]!==H||e[84]!==U||e[85]!==W?(G=(0,$.jsxs)(`div`,{className:`mx-auto w-full max-w-5xl space-y-5 p-4 sm:p-6`,children:[R,z,B,V,H,U,W]}),e[79]=R,e[80]=z,e[81]=B,e[82]=V,e[83]=H,e[84]=U,e[85]=W,e[86]=G):G=e[86],G}function ve(e){return e.status===`active`}function ye(e){return e.clearPageHeader}function be(e){return e.setPageHeader}function xe(e){return e.language}function Se(e){let t=(0,Z.c)(78),{profile:n,language:r,t:i,onChanged:a}=e,o;t[0]===n?o=t[1]:(o=ge(n),t[0]=n,t[1]=o);let s=o,[c,l]=he(s),u;t[2]===c?u=t[3]:(u=me(c),t[2]=c,t[3]=u);let d;t[4]===s?d=t[5]:(d=me(s),t[4]=s,t[5]=d);let p=u!==d,m;t[6]!==a||t[7]!==n?(m=async e=>{await a((await j({...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=te(h),_;t[13]!==c||t[14]!==l?(_=(e,t,n)=>(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:t}),(0,$.jsx)(`input`,{className:se,placeholder:n,value:c[e],onChange:t=>l(n=>({...n,[e]:t.target.value}))})]}),t[13]=c,t[14]=l,t[15]=_):_=t[15];let v=_,y=g.onBlurCapture,b;t[16]===i.profileHint?b=t[17]:(b=(0,$.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,$.jsx)(`span`,{className:`font-medium text-fg`,children:i.primaryGoal}),t[26]=i.primaryGoal,t[27]=C);let w;t[28]===l?w=t[29]:(w=e=>l(t=>({...t,primaryGoal:e.target.value})),t[28]=l,t[29]=w);let T;t[30]!==c.primaryGoal||t[31]!==i.primaryGoalPlaceholder||t[32]!==w?(T=(0,$.jsx)(`textarea`,{className:se,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,$.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,$.jsx)(`span`,{className:`font-medium text-fg`,children:i.timezone}),t[42]=i.timezone,t[43]=O);let k;t[44]===l?k=t[45]:(k=e=>l(t=>({...t,timezone:e.target.value})),t[44]=l,t[45]=k);let A;t[46]!==c.timezone||t[47]!==k?(A=(0,$.jsx)(`input`,{className:`${se} min-w-0 flex-1`,value:c.timezone,onChange:k}),t[46]=c.timezone,t[47]=k,t[48]=A):A=t[48];let M;t[49]===l?M=t[50]:(M=()=>l(Ce),t[49]=l,t[50]=M);let N;t[51]!==i.detect||t[52]!==M?(N=(0,$.jsx)(f,{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]!==A||t[55]!==N?(P=(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[A,N]}),t[54]=A,t[55]=N,t[56]=P):P=t[56];let F;t[57]!==O||t[58]!==P?(F=(0,$.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,$.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,$.jsx)(`div`,{className:`mt-5 flex justify-end`,children:(0,$.jsx)(ee,{status:g.status,error:g.error})}),t[70]=g.error,t[71]=g.status,t[72]=R):R=t[72];let z;return t[73]!==g.onBlurCapture||t[74]!==L||t[75]!==R||t[76]!==b?(z=(0,$.jsx)(de,{children:(0,$.jsxs)(`div`,{onBlurCapture:y,children:[b,L,R]})}),t[73]=g.onBlurCapture,t[74]=L,t[75]=R,t[76]=b,t[77]=z):z=t[77],z}function Ce(e){return{...e,timezone:W()}}function we(e){let t=(0,Z.c)(78),{items:n,quality:r,language:i,t:a,onChanged:c}=e,[l,d]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(``),[h,g]=(0,Q.useState)(`preference`),_;t[0]===n?_=t[1]:(_=n.filter(Ee),t[0]=n,t[1]=_);let v=_,y;t[2]===n?y=t[3]:(y=n.filter(Te),t[2]=n,t[3]=y);let b=y,x;t[4]!==h||t[5]!==c||t[6]!==p?(x=async e=>{e.preventDefault(),p.trim()&&(await U({statement:p,kind:h}),m(``),d(!1),await c())},t[4]=h,t[5]=c,t[6]=p,t[7]=x):x=t[7];let S=x,C;t[8]===a.understoodHint?C=t[9]:(C=(0,$.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:a.understoodHint}),t[8]=a.understoodHint,t[9]=C);let w,T;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(w=()=>d(!0),T=(0,$.jsx)(u,{className:`size-4`}),t[10]=w,t[11]=T):(w=t[10],T=t[11]);let E;t[12]===a.addUnderstanding?E=t[13]:(E=(0,$.jsxs)(f,{variant:`primary`,onClick:w,children:[T,a.addUnderstanding]}),t[12]=a.addUnderstanding,t[13]=E);let D;t[14]!==C||t[15]!==E?(D=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[C,E]}),t[14]=C,t[15]=E,t[16]=D):D=t[16];let O=a.addUnderstanding,k=a.understoodHint,A=a.add,j=a.cancel,M;t[17]===p?M=t[18]:(M=p.trim(),t[17]=p,t[18]=M);let N=!M,P;t[19]===a.statement?P=t[20]:(P=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:a.statement}),t[19]=a.statement,t[20]=P);let F;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(F=e=>m(e.target.value),t[21]=F):F=t[21];let I;t[22]!==p||t[23]!==a.statement?(I=(0,$.jsx)(`textarea`,{autoFocus:!0,className:se,rows:4,placeholder:a.statement,value:p,onChange:F}),t[22]=p,t[23]=a.statement,t[24]=I):I=t[24];let L;t[25]!==P||t[26]!==I?(L=(0,$.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[P,I]}),t[25]=P,t[26]=I,t[27]=L):L=t[27];let R;t[28]===a.kind?R=t[29]:(R=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:a.kind}),t[28]=a.kind,t[29]=R);let z,B;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(z=e=>g(e.target.value),B=Object.entries(le),t[30]=z,t[31]=B):(z=t[30],B=t[31]);let V;t[32]===i?V=t[33]:(V=B.map(e=>{let[t,n]=e;return(0,$.jsx)(s,{value:t,children:n[i]},t)}),t[32]=i,t[33]=V);let H;t[34]!==h||t[35]!==V?(H=(0,$.jsx)(o,{value:h,onChange:z,children:V}),t[34]=h,t[35]=V,t[36]=H):H=t[36];let W;t[37]!==R||t[38]!==H?(W=(0,$.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[R,H]}),t[37]=R,t[38]=H,t[39]=W):W=t[39];let G;t[40]!==l||t[41]!==S||t[42]!==a.add||t[43]!==a.addUnderstanding||t[44]!==a.cancel||t[45]!==a.understoodHint||t[46]!==N||t[47]!==L||t[48]!==W?(G=(0,$.jsxs)(pe,{open:l,onOpenChange:d,title:O,description:k,submitLabel:A,cancelLabel:j,submitDisabled:N,onSubmit:S,children:[L,W]}),t[40]=l,t[41]=S,t[42]=a.add,t[43]=a.addUnderstanding,t[44]=a.cancel,t[45]=a.understoodHint,t[46]=N,t[47]=L,t[48]=W,t[49]=G):G=t[49];let K;t[50]!==r||t[51]!==a?(K=(0,$.jsx)(De,{quality:r,t:a}),t[50]=r,t[51]=a,t[52]=K):K=t[52];let q;t[53]===a?q=t[54]:(q=(0,$.jsx)(Ae,{t:a}),t[53]=a,t[54]=q);let J;t[55]!==i||t[56]!==c||t[57]!==b||t[58]!==a?(J=b.length?(0,$.jsxs)(`section`,{className:`space-y-2`,children:[(0,$.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[a.review,` · `,b.length]}),(0,$.jsx)(`div`,{className:`divide-y divide-edge overflow-hidden rounded-2xl border border-edge bg-surface-panel`,children:b.map(e=>(0,$.jsx)(ke,{item:e,language:i,t:a,onChanged:c},e.id))})]}):null,t[55]=i,t[56]=c,t[57]=b,t[58]=a,t[59]=J):J=t[59];let Y;t[60]!==v.length||t[61]!==a.active?(Y=(0,$.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[a.active,` · `,v.length]}),t[60]=v.length,t[61]=a.active,t[62]=Y):Y=t[62];let X;t[63]!==v||t[64]!==i||t[65]!==c||t[66]!==a?(X=v.length?(0,$.jsx)(`div`,{className:`divide-y divide-edge overflow-hidden rounded-2xl border border-edge bg-surface-panel`,children:v.map(e=>(0,$.jsx)(ke,{item:e,language:i,t:a,onChanged:c},e.id))}):(0,$.jsx)(fe,{children:a.emptyUnderstanding}),t[63]=v,t[64]=i,t[65]=c,t[66]=a,t[67]=X):X=t[67];let ee;t[68]!==Y||t[69]!==X?(ee=(0,$.jsxs)(`section`,{className:`space-y-2`,children:[Y,X]}),t[68]=Y,t[69]=X,t[70]=ee):ee=t[70];let te;return t[71]!==G||t[72]!==K||t[73]!==q||t[74]!==J||t[75]!==ee||t[76]!==D?(te=(0,$.jsxs)(`div`,{className:`space-y-5`,children:[D,G,K,q,J,ee]}),t[71]=G,t[72]=K,t[73]=q,t[74]=J,t[75]=ee,t[76]=D,t[77]=te):te=t[77],te}function Te(e){return[`candidate`,`needs_review`,`stale`].includes(e.status)}function Ee(e){return e.status===`active`}function De(e){let t=(0,Z.c)(32),{quality:n,t:r}=e,i;t[0]===r.qualityNoData?i=t[1]:(i=e=>e==null?r.qualityNoData:`${Math.round(e*100)}%`,t[0]=r.qualityNoData,t[1]=i);let a=i,o=r.qualityActive,s=String(n.records.active),c;t[2]!==r.qualityActive||t[3]!==s?(c=[o,s],t[2]=r.qualityActive,t[3]=s,t[4]=c):c=t[4];let l=r.qualityPending,u=String(n.records.candidate+n.records.needsReview),d;t[5]!==r.qualityPending||t[6]!==u?(d=[l,u],t[5]=r.qualityPending,t[6]=u,t[7]=d):d=t[7];let f=r.qualityAcceptance,p;t[8]!==n.decisions.acceptanceRate||t[9]!==a?(p=a(n.decisions.acceptanceRate),t[8]=n.decisions.acceptanceRate,t[9]=a,t[10]=p):p=t[10];let m;t[11]!==r.qualityAcceptance||t[12]!==p?(m=[f,p],t[11]=r.qualityAcceptance,t[12]=p,t[13]=m):m=t[13];let h=r.qualityRecall,g;t[14]!==n.recall.helpfulRate||t[15]!==a?(g=a(n.recall.helpfulRate),t[14]=n.recall.helpfulRate,t[15]=a,t[16]=g):g=t[16];let _;t[17]!==r.qualityRecall||t[18]!==g?(_=[h,g],t[17]=r.qualityRecall,t[18]=g,t[19]=_):_=t[19];let v;t[20]!==m||t[21]!==_||t[22]!==c||t[23]!==d?(v=[c,d,m,_],t[20]=m,t[21]=_,t[22]=c,t[23]=d,t[24]=v):v=t[24];let y=v,b;t[25]===r.qualityTitle?b=t[26]:(b=(0,$.jsx)(`h2`,{className:`text-xs font-medium text-fg-muted`,children:r.qualityTitle}),t[25]=r.qualityTitle,t[26]=b);let x;t[27]===y?x=t[28]:(x=y.map(Oe),t[27]=y,t[28]=x);let S;return t[29]!==b||t[30]!==x?(S=(0,$.jsxs)(`section`,{className:`flex flex-wrap items-center gap-x-5 gap-y-2 rounded-xl bg-surface-muted px-3 py-2.5`,children:[b,x]}),t[29]=b,t[30]=x,t[31]=S):S=t[31],S}function Oe(e){let[t,n]=e;return(0,$.jsxs)(`div`,{className:`flex items-baseline gap-1.5 text-xs`,children:[(0,$.jsx)(`span`,{className:`text-fg-subtle`,children:t}),(0,$.jsx)(`span`,{className:`font-semibold text-fg`,children:n})]},t)}function ke(e){let t=(0,Z.c)(60),{item:n,language:r,t:i,onChanged:a}=e,[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(!1),[u,d]=he(n.statement),p=u!==n.statement,m;t[0]===i.required?m=t[1]:(m=e=>e.trim()?null:i.required,t[0]=i.required,t[1]=m);let h;t[2]!==n.id||t[3]!==a?(h=async e=>{await a((await H(n.id,{statement:e})).understanding)},t[2]=n.id,t[3]=a,t[4]=h):h=t[4];let g;t[5]!==u||t[6]!==o||t[7]!==p||t[8]!==m||t[9]!==h?(g={value:u,dirty:p,enabled:o,delayMs:500,validate:m,onSave:h},t[5]=u,t[6]=o,t[7]=p,t[8]=m,t[9]=h,t[10]=g):g=t[10];let _=te(g),v;t[11]!==u||t[12]!==o||t[13]!==d?(v=o?(0,$.jsx)(`textarea`,{autoFocus:!0,className:se,value:u,onChange:e=>d(e.target.value),rows:3}):(0,$.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:u}),t[11]=u,t[12]=o,t[13]=d,t[14]=v):v=t[14];let y=le[n.kind][r],b;t[15]===y?b=t[16]:(b=(0,$.jsx)(`span`,{children:y}),t[15]=y,t[16]=b);let x;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,$.jsx)(`span`,{children:`·`}),t[17]=x):x=t[17];let S=n.explicitness===`explicit`?i.sourceExplicit:n.explicitness===`observed`?i.sourceObserved:i.sourceInferred,C;t[18]===S?C=t[19]:(C=(0,$.jsx)(`span`,{children:S}),t[18]=S,t[19]=C);let w;t[20]!==C||t[21]!==b?(w=(0,$.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-2 text-[11px] text-fg-subtle`,children:[b,x,C]}),t[20]=C,t[21]=b,t[22]=w):w=t[22];let T;t[23]!==w||t[24]!==v?(T=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[v,w]}),t[23]=w,t[24]=v,t[25]=T):T=t[25];let E;t[26]!==_||t[27]!==o||t[28]!==i.done||t[29]!==i.edit?(E=o?(0,$.jsx)(f,{variant:`ghost`,onClick:()=>{_.flush(),s(!1)},children:i.done}):(0,$.jsxs)(f,{variant:`ghost`,onClick:()=>s(!0),children:[(0,$.jsx)(k,{className:`size-3.5`}),i.edit]}),t[26]=_,t[27]=o,t[28]=i.done,t[29]=i.edit,t[30]=E):E=t[30];let D;t[31]!==n.id||t[32]!==n.status||t[33]!==a||t[34]!==i.confirm||t[35]!==i.reject?(D=n.status===`active`?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(f,{variant:`primary`,onClick:async()=>{await a((await H(n.id,{status:`active`})).understanding)},children:i.confirm}),(0,$.jsx)(f,{onClick:async()=>{await a((await H(n.id,{status:`rejected`})).understanding)},children:i.reject})]}),t[31]=n.id,t[32]=n.status,t[33]=a,t[34]=i.confirm,t[35]=i.reject,t[36]=D):D=t[36];let O;t[37]!==c||t[38]!==n.id||t[39]!==a?(O=async()=>{if(!c){l(!0);return}await B(n.id),l(!1),await a()},t[37]=c,t[38]=n.id,t[39]=a,t[40]=O):O=t[40];let A;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,$.jsx)(N,{className:`size-3.5`}),t[41]=A):A=t[41];let j=c?i.confirmDelete:i.delete,M;t[42]!==O||t[43]!==j?(M=(0,$.jsxs)(f,{variant:`ghost`,className:`text-danger`,onClick:O,children:[A,j]}),t[42]=O,t[43]=j,t[44]=M):M=t[44];let P;t[45]!==E||t[46]!==D||t[47]!==M?(P=(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-1 sm:justify-end`,children:[E,D,M]}),t[45]=E,t[46]=D,t[47]=M,t[48]=P):P=t[48];let F;t[49]!==T||t[50]!==P?(F=(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-start sm:gap-4`,children:[T,P]}),t[49]=T,t[50]=P,t[51]=F):F=t[51];let I;t[52]!==_.error||t[53]!==_.status||t[54]!==o?(I=o||_.status!==`idle`?(0,$.jsx)(ee,{className:`mt-2`,status:_.status,error:_.error}):null,t[52]=_.error,t[53]=_.status,t[54]=o,t[55]=I):I=t[55];let L;return t[56]!==_.onBlurCapture||t[57]!==F||t[58]!==I?(L=(0,$.jsx)(`article`,{className:`px-4 py-3 sm:px-5`,children:(0,$.jsxs)(`div`,{onBlurCapture:_.onBlurCapture,children:[F,I]})}),t[56]=_.onBlurCapture,t[57]=F,t[58]=I,t[59]=L):L=t[59],L}function Ae(e){let t=(0,Z.c)(35),{t:n}=e,{data:r,error:i,isLoading:a,mutate:o}=x(`you-focuses`,Y),[s,c]=(0,Q.useState)(null);if(a){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(w,{className:`h-40 rounded-2xl`}),t[0]=e):e=t[0],e}if(i){let e;return t[1]===n.error?e=t[2]:(e=(0,$.jsx)(fe,{children:n.error}),t[1]=n.error,t[2]=e),e}let l;if(t[3]!==r||t[4]!==s||t[5]!==o||t[6]!==n.activate||t[7]!==n.complete||t[8]!==n.confidence||t[9]!==n.confidenceHigh||t[10]!==n.confidenceLow||t[11]!==n.confidenceMedium||t[12]!==n.confirmDelete||t[13]!==n.delete||t[14]!==n.focusActive||t[15]!==n.focusCandidate||t[16]!==n.focusCompleted||t[17]!==n.focusHint||t[18]!==n.focusPaused||t[19]!==n.focuses||t[20]!==n.noFocuses||t[21]!==n.pause||t[22]!==n.reject){let e=(r??[]).filter(je),i;t[24]!==n.focusActive||t[25]!==n.focusCandidate||t[26]!==n.focusCompleted||t[27]!==n.focusPaused?(i=e=>e===`candidate`?n.focusCandidate:e===`active`?n.focusActive:e===`paused`?n.focusPaused:n.focusCompleted,t[24]=n.focusActive,t[25]=n.focusCandidate,t[26]=n.focusCompleted,t[27]=n.focusPaused,t[28]=i):i=t[28];let a=i,u;t[29]!==n.confidenceHigh||t[30]!==n.confidenceLow||t[31]!==n.confidenceMedium?(u=e=>e>=.85?n.confidenceHigh:e>=.65?n.confidenceMedium:n.confidenceLow,t[29]=n.confidenceHigh,t[30]=n.confidenceLow,t[31]=n.confidenceMedium,t[32]=u):u=t[32];let d=u,p;t[33]===n.focusHint?p=t[34]:(p=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n.focusHint}),t[33]=n.focusHint,t[34]=p),l=(0,$.jsxs)(`section`,{className:`space-y-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[n.focuses,` · `,e.length]}),p]}),e.length?(0,$.jsx)(`div`,{className:`divide-y divide-edge overflow-hidden rounded-2xl border border-edge bg-surface-panel`,children:e.map(e=>(0,$.jsxs)(`article`,{className:`flex flex-col gap-3 px-4 py-3 sm:flex-row sm:items-center sm:px-5`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:e.title}),(0,$.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-[11px] text-fg-muted`,children:a(e.status)}),(0,$.jsxs)(`span`,{className:`text-[11px] text-fg-subtle`,children:[n.confidence,` · `,d(e.confidence)]})]}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-5 text-fg-muted`,children:e.summary})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-1 sm:justify-end`,children:[e.status===`active`?(0,$.jsx)(f,{onClick:async()=>{await R(e.id,`paused`),await o()},children:n.pause}):(0,$.jsx)(f,{variant:`primary`,onClick:async()=>{await R(e.id,`active`),await o()},children:n.activate}),(0,$.jsx)(f,{variant:`ghost`,onClick:async()=>{await R(e.id,`completed`),await o()},children:n.complete}),e.status===`candidate`?(0,$.jsx)(f,{variant:`ghost`,className:`text-danger`,onClick:async()=>{await R(e.id,`rejected`),await o()},children:n.reject}):null,(0,$.jsxs)(f,{variant:`ghost`,className:`text-danger`,onClick:async()=>{if(s!==e.id){c(e.id);return}await M(e.id),c(null),await o()},children:[(0,$.jsx)(N,{className:`size-3.5`}),s===e.id?n.confirmDelete:n.delete]})]})]},e.id))}):(0,$.jsx)(fe,{children:n.noFocuses})]}),t[3]=r,t[4]=s,t[5]=o,t[6]=n.activate,t[7]=n.complete,t[8]=n.confidence,t[9]=n.confidenceHigh,t[10]=n.confidenceLow,t[11]=n.confidenceMedium,t[12]=n.confirmDelete,t[13]=n.delete,t[14]=n.focusActive,t[15]=n.focusCandidate,t[16]=n.focusCompleted,t[17]=n.focusHint,t[18]=n.focusPaused,t[19]=n.focuses,t[20]=n.noFocuses,t[21]=n.pause,t[22]=n.reject,t[23]=l}else l=t[23];return l}function je(e){return e.status!==`rejected`}function Me(e){let t=(0,Z.c)(80),{rules:n,language:r,t:i,onChanged:a}=e,[c,l]=(0,Q.useState)(!1),[d,p]=(0,Q.useState)(``),[m,h]=(0,Q.useState)(`communication`),[g,_]=(0,Q.useState)(null),v,y,b,x,S,C;if(t[0]!==c||t[1]!==m||t[2]!==g||t[3]!==r||t[4]!==a||t[5]!==n||t[6]!==d||t[7]!==i.add||t[8]!==i.addRule||t[9]!==i.cancel||t[10]!==i.category||t[11]!==i.collaboration||t[12]!==i.confirmDelete||t[13]!==i.delete||t[14]!==i.disable||t[15]!==i.emptyRules||t[16]!==i.enable||t[17]!==i.ruleStatement||t[18]!==i.rulesHint){let e=n.filter(Ne),w;t[25]!==m||t[26]!==a||t[27]!==d?(w=async e=>{e.preventDefault(),d.trim()&&(await J({statement:d,category:m}),p(``),l(!1),await a())},t[25]=m,t[26]=a,t[27]=d,t[28]=w):w=t[28];let T=w;x=`space-y-5`;let E;t[29]===i.rulesHint?E=t[30]:(E=(0,$.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:i.rulesHint}),t[29]=i.rulesHint,t[30]=E);let D,O;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(O=()=>l(!0),D=(0,$.jsx)(u,{className:`size-4`}),t[31]=D,t[32]=O):(D=t[31],O=t[32]);let k;t[33]===i.addRule?k=t[34]:(k=(0,$.jsxs)(f,{variant:`primary`,onClick:O,children:[D,i.addRule]}),t[33]=i.addRule,t[34]=k),t[35]!==k||t[36]!==E?(S=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[E,k]}),t[35]=k,t[36]=E,t[37]=S):S=t[37];let A=i.addRule,j=i.rulesHint,M=i.add,P=i.cancel,F;t[38]===d?F=t[39]:(F=d.trim(),t[38]=d,t[39]=F);let I=!F,L;t[40]===i.ruleStatement?L=t[41]:(L=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:i.ruleStatement}),t[40]=i.ruleStatement,t[41]=L);let R;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(R=e=>p(e.target.value),t[42]=R):R=t[42];let z;t[43]!==d||t[44]!==i.ruleStatement?(z=(0,$.jsx)(`textarea`,{autoFocus:!0,className:se,rows:4,placeholder:i.ruleStatement,value:d,onChange:R}),t[43]=d,t[44]=i.ruleStatement,t[45]=z):z=t[45];let B;t[46]!==L||t[47]!==z?(B=(0,$.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[L,z]}),t[46]=L,t[47]=z,t[48]=B):B=t[48];let V;t[49]===i.category?V=t[50]:(V=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:i.category}),t[49]=i.category,t[50]=V);let H,U;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(H=e=>h(e.target.value),U=Object.entries(ue),t[51]=H,t[52]=U):(H=t[51],U=t[52]);let W;t[53]===r?W=t[54]:(W=U.map(e=>{let[t,n]=e;return(0,$.jsx)(s,{value:t,children:n[r]},t)}),t[53]=r,t[54]=W);let q;t[55]!==m||t[56]!==W?(q=(0,$.jsx)(o,{value:m,onChange:H,children:W}),t[55]=m,t[56]=W,t[57]=q):q=t[57];let Y;t[58]!==V||t[59]!==q?(Y=(0,$.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[V,q]}),t[58]=V,t[59]=q,t[60]=Y):Y=t[60],t[61]!==c||t[62]!==T||t[63]!==i.add||t[64]!==i.addRule||t[65]!==i.cancel||t[66]!==i.rulesHint||t[67]!==I||t[68]!==B||t[69]!==Y?(C=(0,$.jsxs)(pe,{open:c,onOpenChange:l,title:A,description:j,submitLabel:M,cancelLabel:P,submitDisabled:I,onSubmit:T,children:[B,Y]}),t[61]=c,t[62]=T,t[63]=i.add,t[64]=i.addRule,t[65]=i.cancel,t[66]=i.rulesHint,t[67]=I,t[68]=B,t[69]=Y,t[70]=C):C=t[70],v=`space-y-2`,y=(0,$.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[i.collaboration,` · `,e.length]}),b=e.length?(0,$.jsx)(`div`,{className:`divide-y divide-edge overflow-hidden rounded-2xl border border-edge bg-surface-panel`,children:e.map(e=>(0,$.jsxs)(`article`,{className:`flex flex-col gap-2 px-4 py-3 sm:flex-row sm:items-start sm:gap-4 sm:px-5`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`p`,{className:`text-sm leading-6 ${e.status===`disabled`?`text-fg-subtle line-through`:`text-fg`}`,children:e.statement}),(0,$.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-2 text-[11px] text-fg-subtle`,children:[(0,$.jsx)(`span`,{children:ue[e.category][r]}),(0,$.jsx)(`span`,{children:`·`}),(0,$.jsxs)(`span`,{children:[`P`,e.priority]}),e.status===`disabled`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{children:`·`}),(0,$.jsx)(`span`,{children:i.disable})]}):null]})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-1 sm:justify-end`,children:[(0,$.jsx)(f,{variant:`ghost`,onClick:async()=>{await G(e.id,{status:e.status===`active`?`disabled`:`active`}),await a()},children:e.status===`active`?i.disable:i.enable}),(0,$.jsxs)(f,{variant:`ghost`,className:`text-danger`,onClick:async()=>{if(g!==e.id){_(e.id);return}await K(e.id),_(null),await a()},children:[(0,$.jsx)(N,{className:`size-3.5`}),g===e.id?i.confirmDelete:i.delete]})]})]},e.id))}):(0,$.jsx)(fe,{children:i.emptyRules}),t[0]=c,t[1]=m,t[2]=g,t[3]=r,t[4]=a,t[5]=n,t[6]=d,t[7]=i.add,t[8]=i.addRule,t[9]=i.cancel,t[10]=i.category,t[11]=i.collaboration,t[12]=i.confirmDelete,t[13]=i.delete,t[14]=i.disable,t[15]=i.emptyRules,t[16]=i.enable,t[17]=i.ruleStatement,t[18]=i.rulesHint,t[19]=v,t[20]=y,t[21]=b,t[22]=x,t[23]=S,t[24]=C}else v=t[19],y=t[20],b=t[21],x=t[22],S=t[23],C=t[24];let w;t[71]!==v||t[72]!==y||t[73]!==b?(w=(0,$.jsxs)(`section`,{className:v,children:[y,b]}),t[71]=v,t[72]=y,t[73]=b,t[74]=w):w=t[74];let T;return t[75]!==x||t[76]!==S||t[77]!==C||t[78]!==w?(T=(0,$.jsxs)(`div`,{className:x,children:[S,C,w]}),t[75]=x,t[76]=S,t[77]=C,t[78]=w,t[79]=T):T=t[79],T}function Ne(e){return e.status!==`archived`}async function Pe(){let[e,t,n]=await Promise.all([q(),ie(),ae()]);return{grants:e,connectors:t,catalog:n}}function Fe({t:e}){let{data:t,error:n,isLoading:r,mutate:i}=x(`you-understanding-sources`,Pe),[o,s]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(null);if(r)return(0,$.jsx)(w,{className:`h-64 rounded-2xl`});if(n)return(0,$.jsxs)(fe,{children:[e.error,` `,(0,$.jsx)(`button`,{className:`text-accent hover:underline`,onClick:()=>void i(),children:e.retry})]});let h=t?.grants??[],g=t?.connectors??[],_=new Map((t?.catalog??[]).map(e=>[e.id,e])),v=e=>{let t=e.displayName.trim().toLocaleLowerCase(),n=g.find(e=>e.displayName.trim().toLocaleLowerCase()===t);return n?_.get(n.connectorId):[..._.values()].find(n=>n.displayName.trim().toLocaleLowerCase()===t||e.sourceKey.toLocaleLowerCase().includes(n.id.toLocaleLowerCase()))},y=t=>`${e.actionFailed}: ${t instanceof Error?t.message:String(t)}`,b=async t=>{m(null),d(null),s({grantId:t.id,kind:`refresh`});try{await F(t.id),await i().catch(()=>void 0),m({tone:`success`,message:`${t.displayName}: ${e.refreshStarted}`})}catch(e){m({tone:`error`,message:y(e)})}finally{s(null)}},C=async t=>{if(u!==t.id){d(t.id),m(null);return}s({grantId:t.id,kind:`revoke`});try{await L(t.id),await i().catch(()=>void 0),d(null),m({tone:`success`,message:`${t.displayName}: ${e.revokeDone}`})}catch(e){m({tone:`error`,message:y(e)})}finally{s(null)}};return(0,$.jsxs)(`div`,{className:`space-y-5`,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,$.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:e.sourcesHint}),(0,$.jsx)(f,{asChild:!0,variant:`primary`,children:(0,$.jsxs)(a,{to:`/connectors?understanding=1&returnTo=%2Fyou%3Ftab%3Dsources`,children:[e.manageSources,(0,$.jsx)(c,{className:`size-4`})]})})]}),p?(0,$.jsx)(`p`,{role:`status`,"aria-live":`polite`,className:`rounded-xl px-3 py-2 text-sm ${p.tone===`success`?`bg-success-soft text-success`:`bg-danger/10 text-danger`}`,children:p.message}):null,(0,$.jsxs)(`section`,{className:`space-y-2`,children:[(0,$.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[e.authorizedSources,` · `,h.length]}),h.length?(0,$.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:h.map(t=>{let n=v(t);return(0,$.jsxs)(`article`,{className:`flex min-h-28 items-start gap-3 rounded-2xl border border-edge bg-surface-panel p-4`,children:[n?(0,$.jsx)(re,{connector:n,size:`sm`}):(0,$.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg border border-edge bg-surface-base`,children:(0,$.jsx)(S,{className:`size-4 text-fg-muted`})}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:t.displayName}),(0,$.jsxs)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:[t.accessMode===`continuous`?e.continuous:e.once,` · `,t.processingPolicy===`local_only`?e.localOnly:t.retentionPolicy===`derived_only`?e.derivedOnly:t.retentionPolicy]}),t.lastCollectedAt?(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:new Date(t.lastCollectedAt).toLocaleString()}):null]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-1`,children:[t.accessMode===`continuous`?(0,$.jsx)(f,{variant:`ghost`,disabled:o!==null,"aria-busy":o?.grantId===t.id&&o.kind===`refresh`,onClick:()=>void b(t),children:o?.grantId===t.id&&o.kind===`refresh`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(l,{className:`size-4 animate-spin`}),e.refreshing]}):e.refresh}):null,(0,$.jsx)(f,{variant:`ghost`,className:`text-danger`,title:e.revokeHint,"aria-label":`${e.revoke}: ${t.displayName}`,disabled:o!==null,"aria-busy":o?.grantId===t.id&&o.kind===`revoke`,onClick:()=>void C(t),children:o?.grantId===t.id&&o.kind===`revoke`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(l,{className:`size-4 animate-spin`}),e.revoking]}):u===t.id?e.confirmRevoke:e.revoke})]})]},t.id)})}):(0,$.jsx)(fe,{children:e.noSources})]}),(0,$.jsxs)(`section`,{className:`space-y-2`,children:[(0,$.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[e.connectorsTitle,` · `,g.length]}),g.length?(0,$.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:g.map(t=>{let n=t.enabled&&(t.status===`connected`||t.connectionStatus===`connected`||t.authStatus===`connected`),r=_.get(t.connectorId);return(0,$.jsxs)(a,{to:`/connectors?tab=connected&instance=${encodeURIComponent(t.instanceId)}`,"aria-label":`${e.openConnector}: ${t.displayName}`,className:`group flex min-h-24 items-center gap-3 rounded-2xl border border-edge bg-surface-panel p-4 transition-colors hover:border-edge-strong hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,children:[(0,$.jsx)(re,{connector:r??{displayName:t.displayName}}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:t.displayName}),(0,$.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:t.connectorId})]}),(0,$.jsx)(`span`,{className:`shrink-0 rounded-full px-2 py-1 text-xs ${n?`bg-success-soft text-success`:`bg-warning-soft text-warning`}`,children:n?e.connected:e.unavailable}),(0,$.jsx)(X,{className:`size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5`})]},t.instanceId)})}):(0,$.jsx)(fe,{children:e.noConnectors})]})]})}function Ie(e){let t=(0,Z.c)(112),{lastRun:n,t:r}=e,{data:i,error:a,isLoading:c,mutate:l}=x(`you-context-settings`,V),u=i?.dreaming??null,[d,p]=he(u),m;t[0]!==d||t[1]!==u?(m=d&&u&&me(d)!==me(u),t[0]=d,t[1]=u,t[2]=m):m=t[2];let h=!!m,g;t[3]===l?g=t[4]:(g=async e=>{await z({dreaming:e}),await l()},t[3]=l,t[4]=g);let _;t[5]!==d||t[6]!==h||t[7]!==g?(_={value:d,dirty:h,delayMs:500,onSave:g},t[5]=d,t[6]=h,t[7]=g,t[8]=_):_=t[8];let v=te(_);if(a){let e;t[9]===l?e=t[10]:(e=()=>void l(),t[9]=l,t[10]=e);let n;t[11]!==r.retry||t[12]!==e?(n=(0,$.jsx)(`button`,{className:`text-accent hover:underline`,onClick:e,children:r.retry}),t[11]=r.retry,t[12]=e,t[13]=n):n=t[13];let i;return t[14]!==r.error||t[15]!==n?(i=(0,$.jsxs)(fe,{children:[r.error,` `,n]}),t[14]=r.error,t[15]=n,t[16]=i):i=t[16],i}if(c||!d){let e;return t[17]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(w,{className:`h-72 rounded-2xl`}),t[17]=e):e=t[17],e}let y=n?.status===`completed`?r.runCompleted:n?.status===`failed`?r.runFailed:r.runRunning,b;t[18]===r.dreamingHint?b=t[19]:(b=(0,$.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:r.dreamingHint}),t[18]=r.dreamingHint,t[19]=b);let S=v.onBlurCapture,C;t[20]===r.mode?C=t[21]:(C=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:r.mode}),t[20]=r.mode,t[21]=C);let T;t[22]===p?T=t[23]:(T=e=>p(t=>t&&{...t,mode:e.target.value}),t[22]=p,t[23]=T);let E;t[24]===r.on?E=t[25]:(E=(0,$.jsx)(s,{value:`review`,children:r.on}),t[24]=r.on,t[25]=E);let D;t[26]===r.off?D=t[27]:(D=(0,$.jsx)(s,{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,$.jsxs)(o,{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 k;t[33]!==O||t[34]!==C?(k=(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[C,O]}),t[33]=O,t[34]=C,t[35]=k):k=t[35];let A;t[36]===r.reviewTime?A=t[37]:(A=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:r.reviewTime}),t[36]=r.reviewTime,t[37]=A);let j;t[38]===p?j=t[39]:(j=e=>p(t=>t&&{...t,schedule:{time:e.target.value}}),t[38]=p,t[39]=j);let M;t[40]!==d.schedule.time||t[41]!==j?(M=(0,$.jsx)(`input`,{type:`time`,className:se,value:d.schedule.time,onChange:j}),t[40]=d.schedule.time,t[41]=j,t[42]=M):M=t[42];let N;t[43]!==A||t[44]!==M?(N=(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[A,M]}),t[43]=A,t[44]=M,t[45]=N):N=t[45];let P;t[46]===r.timezone?P=t[47]:(P=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:r.timezone}),t[46]=r.timezone,t[47]=P);let F=d.timezone??``,I;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(I=W(),t[48]=I):I=t[48];let L;t[49]===p?L=t[50]:(L=e=>p(t=>t&&{...t,timezone:e.target.value||void 0}),t[49]=p,t[50]=L);let R;t[51]!==F||t[52]!==L?(R=(0,$.jsx)(`input`,{className:`${se} min-w-0 flex-1`,value:F,placeholder:I,onChange:L}),t[51]=F,t[52]=L,t[53]=R):R=t[53];let B;t[54]===p?B=t[55]:(B=()=>p(Le),t[54]=p,t[55]=B);let H;t[56]!==r.detect||t[57]!==B?(H=(0,$.jsx)(f,{className:`shrink-0 whitespace-nowrap`,onClick:B,children:r.detect}),t[56]=r.detect,t[57]=B,t[58]=H):H=t[58];let U;t[59]!==R||t[60]!==H?(U=(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[R,H]}),t[59]=R,t[60]=H,t[61]=U):U=t[61];let G;t[62]!==P||t[63]!==U?(G=(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm sm:col-span-2`,children:[P,U]}),t[62]=P,t[63]=U,t[64]=G):G=t[64];let K;t[65]===r.evidenceThreshold?K=t[66]:(K=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:r.evidenceThreshold}),t[65]=r.evidenceThreshold,t[66]=K);let q;t[67]===p?q=t[68]:(q=e=>p(t=>t&&{...t,minEvidenceSources:Number(e.target.value)}),t[67]=p,t[68]=q);let J;t[69]!==d.minEvidenceSources||t[70]!==q?(J=(0,$.jsx)(`input`,{type:`number`,min:2,max:10,className:se,value:d.minEvidenceSources,onChange:q}),t[69]=d.minEvidenceSources,t[70]=q,t[71]=J):J=t[71];let Y;t[72]!==K||t[73]!==J?(Y=(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[K,J]}),t[72]=K,t[73]=J,t[74]=Y):Y=t[74];let X;t[75]===r.scanLimit?X=t[76]:(X=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:r.scanLimit}),t[75]=r.scanLimit,t[76]=X);let ne;t[77]===p?ne=t[78]:(ne=e=>p(t=>t&&{...t,limit:Number(e.target.value)}),t[77]=p,t[78]=ne);let re;t[79]!==d.limit||t[80]!==ne?(re=(0,$.jsx)(`input`,{type:`number`,min:1,max:2e3,className:se,value:d.limit,onChange:ne}),t[79]=d.limit,t[80]=ne,t[81]=re):re=t[81];let ie;t[82]!==X||t[83]!==re?(ie=(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[X,re]}),t[82]=X,t[83]=re,t[84]=ie):ie=t[84];let ae;t[85]!==k||t[86]!==N||t[87]!==G||t[88]!==Y||t[89]!==ie?(ae=(0,$.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[k,N,G,Y,ie]}),t[85]=k,t[86]=N,t[87]=G,t[88]=Y,t[89]=ie,t[90]=ae):ae=t[90];let Q;t[91]!==v.error||t[92]!==v.status?(Q=(0,$.jsx)(`div`,{className:`mt-5 flex justify-end`,children:(0,$.jsx)(ee,{status:v.status,error:v.error})}),t[91]=v.error,t[92]=v.status,t[93]=Q):Q=t[93];let oe;t[94]!==v.onBlurCapture||t[95]!==ae||t[96]!==Q?(oe=(0,$.jsx)(de,{children:(0,$.jsxs)(`div`,{onBlurCapture:S,children:[ae,Q]})}),t[94]=v.onBlurCapture,t[95]=ae,t[96]=Q,t[97]=oe):oe=t[97];let ce;t[98]===r.lastRun?ce=t[99]:(ce=(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:r.lastRun}),t[98]=r.lastRun,t[99]=ce);let le;t[100]!==n||t[101]!==y||t[102]!==r.neverRun||t[103]!==r.runItems?(le=n?(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-sm text-fg-muted`,children:[(0,$.jsx)(`span`,{children:y}),(0,$.jsx)(`span`,{children:`·`}),(0,$.jsx)(`time`,{children:new Date(n.startedAt).toLocaleString()}),typeof n.metrics.scanned==`number`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{children:`·`}),(0,$.jsxs)(`span`,{children:[String(n.metrics.scanned),` `,r.runItems]})]}):null]}):(0,$.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:r.neverRun}),t[100]=n,t[101]=y,t[102]=r.neverRun,t[103]=r.runItems,t[104]=le):le=t[104];let ue;t[105]!==ce||t[106]!==le?(ue=(0,$.jsxs)(de,{children:[ce,le]}),t[105]=ce,t[106]=le,t[107]=ue):ue=t[107];let pe;return t[108]!==oe||t[109]!==ue||t[110]!==b?(pe=(0,$.jsxs)(`div`,{className:`space-y-5`,children:[b,oe,ue]}),t[108]=oe,t[109]=ue,t[110]=b,t[111]=pe):pe=t[111],pe}function Le(e){return e&&{...e,timezone:W()}}function Re(e){let t=(0,Z.c)(49),{t:n}=e,{data:r,error:i,isLoading:a,mutate:c}=x(`you-context-settings`,V),l=r?.privacy.sensitiveWritePolicy??null,[u,d]=he(l),f=!!(u&&l&&u!==l),p;t[0]===c?p=t[1]:(p=async e=>{await z({privacy:{sensitiveWritePolicy:e}}),await c()},t[0]=c,t[1]=p);let m;t[2]!==u||t[3]!==f||t[4]!==p?(m={value:u,dirty:f,delayMs:350,onSave:p},t[2]=u,t[3]=f,t[4]=p,t[5]=m):m=t[5];let h=te(m);if(i){let e;t[6]===c?e=t[7]:(e=()=>void c(),t[6]=c,t[7]=e);let r;t[8]!==n.retry||t[9]!==e?(r=(0,$.jsx)(`button`,{className:`text-accent hover:underline`,onClick:e,children:n.retry}),t[8]=n.retry,t[9]=e,t[10]=r):r=t[10];let i;return t[11]!==n.error||t[12]!==r?(i=(0,$.jsxs)(fe,{children:[n.error,` `,r]}),t[11]=n.error,t[12]=r,t[13]=i):i=t[13],i}if(a||!u){let e;return t[14]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(w,{className:`h-56 rounded-2xl`}),t[14]=e):e=t[14],e}let g;t[15]===n.privacyHint?g=t[16]:(g=(0,$.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:n.privacyHint}),t[15]=n.privacyHint,t[16]=g);let _;t[17]===n.sensitivePolicy?_=t[18]:(_=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:n.sensitivePolicy}),t[17]=n.sensitivePolicy,t[18]=_);let v;t[19]===d?v=t[20]:(v=e=>d(e.target.value),t[19]=d,t[20]=v);let y;t[21]===n.policyDeny?y=t[22]:(y=(0,$.jsx)(s,{value:`deny`,children:n.policyDeny}),t[21]=n.policyDeny,t[22]=y);let b;t[23]===n.policyConfirm?b=t[24]:(b=(0,$.jsx)(s,{value:`confirm`,children:n.policyConfirm}),t[23]=n.policyConfirm,t[24]=b);let S;t[25]===n.policyAllow?S=t[26]:(S=(0,$.jsx)(s,{value:`allow`,children:n.policyAllow}),t[25]=n.policyAllow,t[26]=S);let C;t[27]!==u||t[28]!==v||t[29]!==y||t[30]!==b||t[31]!==S?(C=(0,$.jsxs)(o,{value:u,onChange:v,children:[y,b,S]}),t[27]=u,t[28]=v,t[29]=y,t[30]=b,t[31]=S,t[32]=C):C=t[32];let T;t[33]!==C||t[34]!==_?(T=(0,$.jsxs)(`label`,{className:`block max-w-xl space-y-1.5 text-sm`,children:[_,C]}),t[33]=C,t[34]=_,t[35]=T):T=t[35];let E;t[36]===n.privacyWarning?E=t[37]:(E=(0,$.jsx)(`p`,{className:`mt-3 max-w-2xl text-xs leading-5 text-fg-subtle`,children:n.privacyWarning}),t[36]=n.privacyWarning,t[37]=E);let D;t[38]!==h.error||t[39]!==h.status?(D=(0,$.jsx)(`div`,{className:`mt-5 flex justify-end`,children:(0,$.jsx)(ee,{status:h.status,error:h.error})}),t[38]=h.error,t[39]=h.status,t[40]=D):D=t[40];let O;t[41]!==h.onBlurCapture||t[42]!==T||t[43]!==E||t[44]!==D?(O=(0,$.jsx)(de,{children:(0,$.jsxs)(`div`,{onBlurCapture:h.onBlurCapture,children:[T,E,D]})}),t[41]=h.onBlurCapture,t[42]=T,t[43]=E,t[44]=D,t[45]=O):O=t[45];let k;return t[46]!==O||t[47]!==g?(k=(0,$.jsxs)(`div`,{className:`space-y-5`,children:[g,O]}),t[46]=O,t[47]=g,t[48]=k):k=t[48],k}export{_e 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,r as s}from"./popover-select-BzdnTy3h.js";import{t as c}from"./external-link-DjqjBmc3.js";import{t as l}from"./loader-circle-CifKLtgG.js";import{t as u}from"./plus-Q2yW6OE7.js";import{t as d}from"./x-B_N4OPjy.js";import{t as f}from"./button-CSEbl4zT.js";import{n as p}from"./locale-store-CieddUjx.js";import{a as m,i as h,n as g,o as _,r as v,s as y,t as b}from"./dist-BPoKqzeH.js";import{i as x}from"./vendor-swr-BIWyz7Rc.js";import{Aa as S,Cl as C,Cs as w,Ic as T,Ks as E,Ol as D,Va as O,_o as k,ao as A,as as j,co as M,do as N,ec as P,fo as F,go as I,ho as L,io as R,kl as z,lo as B,ml as V,mo as H,no as U,oo as W,po as G,ro as K,so as q,tl as J,to as Y,uo as X}from"./index-CrwXzRpA.js";import{n as ee,t as te}from"./use-autosave-BJkQ-vpu.js";import{t as ne}from"./page-tabs-BaEQMYm_.js";import{F as re,a as ie,i as ae}from"./connectors-api-CUvFu8jh.js";var Z=n(),Q=e(t(),1),$=r(),oe=new Set([`profile`,`understanding`,`collaboration`,`sources`,`dreaming`,`privacy`]),se=`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`,ce={en:{title:`About You`,subtitle:`What xopc knows, why it knows it, and how it should work with you.`,profile:`Profile`,understanding:`Understanding`,collaboration:`Working agreement`,sources:`Sources`,dreaming:`Background review`,privacy:`Privacy`,profileHint:`Facts you provide directly. These are available across conversations.`,done:`Done`,required:`This field cannot be empty.`,callName:`What should xopc call you?`,callNamePlaceholder:`For example: Alex, Joyce, or Dr. Chen`,role:`Your role`,rolePlaceholder:`For example: product designer, founder, or engineer`,primaryGoal:`What are you mainly trying to achieve?`,primaryGoalPlaceholder:`The outcome you want xopc to optimize for`,pronouns:`Pronouns (optional)`,pronounsPlaceholder:`For example: she/her, he/him, they/them`,timezone:`Timezone`,locale:`Language / locale`,detect:`Use this device`,understoodHint:`Reviewable beliefs learned from your conversations and work. Inferences stay pending until confirmed.`,addUnderstanding:`Add understanding`,statement:`What should xopc understand?`,kind:`Type`,add:`Add`,cancel:`Cancel`,active:`Active`,review:`Needs review`,confirm:`Confirm`,reject:`Wrong`,edit:`Edit`,delete:`Delete`,confirmDelete:`Delete now`,rulesHint:`Explicit instructions for how xopc should collaborate with you. Rules outrank inferred understanding.`,addRule:`Add rule`,ruleStatement:`How should xopc work with you?`,category:`Category`,disable:`Disable`,enable:`Enable`,emptyUnderstanding:`Nothing here yet. Tell xopc something explicitly, or confirm a suggestion after it learns one.`,qualityTitle:`Learning quality`,qualityActive:`Confirmed`,qualityPending:`Pending review`,qualityAcceptance:`30-day acceptance`,qualityRecall:`Helpful recall`,qualityNoData:`Not enough feedback yet`,emptyRules:`No working agreements yet.`,sourceExplicit:`You said this directly`,sourceInferred:`Inferred — may be wrong`,sourceObserved:`Observed across prior work`,sourcesHint:`Review every granted source, its access mode, retention, and last collection. Revoking stops future learning.`,manageSources:`Connect another source`,authorizedSources:`Authorized sources`,connectorsTitle:`Connectors`,openConnector:`Open connector`,noSources:`No sources are authorized.`,noConnectors:`No connectors are installed.`,connected:`Connected`,unavailable:`Needs attention`,revoke:`Revoke source`,revokeHint:`Revoke this source and remove its derived understanding`,confirmRevoke:`Confirm revoke`,revoking:`Revoking…`,revokeDone:`Source revoked and derived understanding removed.`,refresh:`Update`,refreshing:`Updating…`,refreshStarted:`Update started.`,actionFailed:`Action failed`,once:`One-time`,continuous:`Continuous`,localOnly:`Local only`,derivedOnly:`Derived understanding only`,focuses:`Current focuses`,focusHint:`Candidate focuses never activate until you confirm them.`,activate:`Activate`,pause:`Pause`,complete:`Complete`,noFocuses:`No focus candidates yet.`,focusCandidate:`Suggested`,focusActive:`Active`,focusPaused:`Paused`,focusCompleted:`Completed`,confidence:`Confidence`,confidenceHigh:`High`,confidenceMedium:`Medium`,confidenceLow:`Low`,dreamingHint:`A deterministic daily review checks expiry, contradictory evidence, and corroborated candidates. It never auto-activates an inference.`,mode:`Background review`,on:`On — propose for review`,off:`Off`,reviewTime:`Daily review time`,evidenceThreshold:`Supporting evidence required`,scanLimit:`Maximum items per run`,lastRun:`Last review`,neverRun:`Not run yet`,runCompleted:`Completed`,runFailed:`Failed`,runRunning:`Running`,runItems:`items`,privacyHint:`Choose how generic memory providers handle sensitive content. Structured user understanding applies stricter rules of its own.`,sensitivePolicy:`Sensitive memory writes`,policyDeny:`Do not store`,policyConfirm:`Ask before storing`,policyAllow:`Store when relevant`,privacyWarning:`Secret and regulated content is never stored as structured user understanding, regardless of this setting.`,error:`Could not load your context.`,retry:`Try again`},zh:{title:`关于你`,subtitle:`清楚查看 xopc 知道什么、为什么知道,以及应该如何与你协作。`,profile:`个人资料`,understanding:`对你的理解`,collaboration:`协作约定`,sources:`数据来源`,dreaming:`后台复核`,privacy:`隐私`,profileHint:`由你直接提供的事实,会在不同对话中使用。`,done:`完成`,required:`此项不能为空。`,callName:`希望 xopc 如何称呼你?`,callNamePlaceholder:`例如:Mic、Joyce、张老师`,role:`你的角色`,rolePlaceholder:`例如:产品设计师、创业者、工程师`,primaryGoal:`你目前最想达成什么?`,primaryGoalPlaceholder:`希望 xopc 优先帮助你实现的结果`,pronouns:`代词(可选)`,pronounsPlaceholder:`例如:she/her、he/him、they/them`,timezone:`时区`,locale:`语言 / 地区`,detect:`使用本机时区`,understoodHint:`从对话和工作中形成、可复核的理解。推断内容在你确认前保持待审核。`,addUnderstanding:`添加理解`,statement:`希望 xopc 了解什么?`,kind:`类型`,add:`添加`,cancel:`取消`,active:`使用中`,review:`待审核`,confirm:`确认`,reject:`不正确`,edit:`编辑`,delete:`删除`,confirmDelete:`确认删除`,rulesHint:`你明确设定的协作方式。协作约定的优先级高于推断出的理解。`,addRule:`添加约定`,ruleStatement:`希望 xopc 如何与你协作?`,category:`类别`,disable:`停用`,enable:`启用`,emptyUnderstanding:`还没有内容。你可以直接告诉 xopc,或在它学到建议后进行确认。`,emptyRules:`还没有协作约定。`,qualityTitle:`学习质量`,qualityActive:`已确认`,qualityPending:`待审核`,qualityAcceptance:`30 天采纳率`,qualityRecall:`有效召回`,qualityNoData:`反馈数据还不足`,sourceExplicit:`由你直接告知`,sourceInferred:`推断内容,可能有误`,sourceObserved:`从过往工作中观察到`,sourcesHint:`查看每项授权的访问方式、保留策略和最近采集时间;撤销后将停止后续学习。`,manageSources:`连接其他来源`,authorizedSources:`已授权数据来源`,connectorsTitle:`连接器`,openConnector:`打开连接器`,noSources:`尚未授权任何来源。`,noConnectors:`尚未安装连接器。`,connected:`已连接`,unavailable:`需要处理`,revoke:`撤销来源`,revokeHint:`撤销此来源并删除由它产生的理解`,confirmRevoke:`确认撤销`,revoking:`正在撤销…`,revokeDone:`已撤销来源并删除派生理解。`,refresh:`更新`,refreshing:`正在更新…`,refreshStarted:`更新任务已开始。`,actionFailed:`操作失败`,once:`仅一次`,continuous:`持续更新`,localOnly:`仅本地处理`,derivedOnly:`仅保留派生理解`,focuses:`当前关注`,focusHint:`候选关注不会自动生效,只有你确认后才会启用。`,activate:`启用`,pause:`暂停`,complete:`完成`,noFocuses:`还没有候选关注。`,focusCandidate:`待确认`,focusActive:`进行中`,focusPaused:`已暂停`,focusCompleted:`已完成`,confidence:`置信度`,confidenceHigh:`高`,confidenceMedium:`中`,confidenceLow:`低`,dreamingHint:`每天进行一次确定性复核,检查过期、矛盾证据和得到佐证的候选理解;推断内容不会自动生效。`,mode:`后台复核`,on:`开启并生成待审核项`,off:`关闭`,reviewTime:`每日复核时间`,evidenceThreshold:`所需支持证据数`,scanLimit:`每次最多检查`,lastRun:`最近一次复核`,neverRun:`尚未运行`,runCompleted:`已完成`,runFailed:`失败`,runRunning:`运行中`,runItems:`项`,privacyHint:`选择通用记忆服务如何处理敏感内容;结构化用户理解有独立且更严格的规则。`,sensitivePolicy:`敏感记忆写入`,policyDeny:`不保存`,policyConfirm:`保存前询问`,policyAllow:`相关时允许保存`,privacyWarning:`无论这里如何设置,秘密和受监管内容都不会保存为结构化用户理解。`,error:`无法加载用户上下文。`,retry:`重试`}},le={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:`洞察`}},ue={communication:{en:`Communication`,zh:`沟通`},execution:{en:`Execution`,zh:`执行`},boundary:{en:`Boundary`,zh:`边界`},routine:{en:`Routine`,zh:`习惯`},proactive:{en:`Proactive help`,zh:`主动协助`}};function de(e){let t=(0,Z.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,$.jsx)(`section`,{className:`rounded-2xl border border-edge bg-surface-panel p-4 sm:p-5`,children:n}),t[0]=n,t[1]=r),r}function fe(e){let t=(0,Z.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,$.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge px-5 py-10 text-center text-sm text-fg-muted`,children:n}),t[0]=n,t[1]=r),r}function pe(e){let t=(0,Z.c)(33),{open:n,onOpenChange:r,title:i,description:a,submitLabel:o,cancelLabel:s,submitDisabled:c,onSubmit:l,children:u}=e,p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(m,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),t[0]=p):p=t[0];let x;t[1]===i?x=t[2]:(x=(0,$.jsx)(y,{className:`text-base font-semibold text-fg`,children:i}),t[1]=i,t[2]=x);let S;t[3]===a?S=t[4]:(S=(0,$.jsx)(h,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:a}),t[3]=a,t[4]=S);let C;t[5]!==x||t[6]!==S?(C=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[x,S]}),t[5]=x,t[6]=S,t[7]=C):C=t[7];let w;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,$.jsx)(d,{className:`size-4`}),t[8]=w):w=t[8];let T;t[9]===s?T=t[10]:(T=(0,$.jsx)(g,{asChild:!0,children:(0,$.jsx)(f,{type:`button`,variant:`ghost`,className:`size-8 shrink-0 p-0`,"aria-label":s,children:w})}),t[9]=s,t[10]=T);let E;t[11]!==C||t[12]!==T?(E=(0,$.jsxs)(`header`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge px-5 py-4`,children:[C,T]}),t[11]=C,t[12]=T,t[13]=E):E=t[13];let D;t[14]===u?D=t[15]:(D=(0,$.jsx)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-5`,children:u}),t[14]=u,t[15]=D);let O;t[16]===s?O=t[17]:(O=(0,$.jsx)(g,{asChild:!0,children:(0,$.jsx)(f,{type:`button`,children:s})}),t[16]=s,t[17]=O);let k;t[18]!==c||t[19]!==o?(k=(0,$.jsx)(f,{type:`submit`,variant:`primary`,disabled:c,children:o}),t[18]=c,t[19]=o,t[20]=k):k=t[20];let A;t[21]!==k||t[22]!==O?(A=(0,$.jsxs)(`footer`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-3`,children:[O,k]}),t[21]=k,t[22]=O,t[23]=A):A=t[23];let j;t[24]!==l||t[25]!==A||t[26]!==E||t[27]!==D?(j=(0,$.jsxs)(_,{children:[p,(0,$.jsx)(v,{className:`fixed left-1/2 top-1/2 z-[90] h-[min(30rem,calc(100vh-2rem))] w-[min(36rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`,children:(0,$.jsxs)(`form`,{className:`flex h-full min-h-0 flex-col`,onSubmit:l,children:[E,D,A]})})]}),t[24]=l,t[25]=A,t[26]=E,t[27]=D,t[28]=j):j=t[28];let M;return t[29]!==r||t[30]!==n||t[31]!==j?(M=(0,$.jsx)(b,{open:n,onOpenChange:r,children:j}),t[29]=r,t[30]=n,t[31]=j,t[32]=M):M=t[32],M}function me(e){return JSON.stringify(e)}function he(e){let t=(0,Z.c)(10),[n,r]=(0,Q.useState)(e),i;t[0]===e?i=t[1]:(i=me(e),t[0]=e,t[1]=i);let a=(0,Q.useRef)(i),o;t[2]===e?o=t[3]:(o=me(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=>me(n)===t?e:n)},l=[e,s],t[4]=e,t[5]=s,t[6]=c,t[7]=l):(c=t[6],l=t[7]),(0,Q.useEffect)(c,l);let u;return t[8]===n?u=t[9]:(u=[n,r],t[8]=n,t[9]=u),u}function ge(e){return{callName:e.callName,role:e.role,primaryGoal:e.primaryGoal,pronouns:e.pronouns,timezone:e.timezone,locale:e.locale}}function _e(){let e=(0,Z.c)(87),t=p(xe),n=ce[t],[r,a]=i(),o;if(e[0]!==r){let t=r.get(`tab`);o=t&&oe.has(t)?t:`profile`,e[0]=r,e[1]=o}else o=e[1];let s=o,c=O(be),l=O(ye),{data:u,error:d,isLoading:f,mutate:m}=x(`/api/you`,M),h;e[2]!==l||e[3]!==c||e[4]!==n.subtitle||e[5]!==n.title?(h=()=>(c({startExtra:null,main:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h1`,{className:`text-base font-semibold text-fg`,children:n.title}),(0,$.jsx)(`p`,{className:`hidden text-xs text-fg-muted sm:block`,children:n.subtitle})]}),end:null}),l),e[2]=l,e[3]=c,e[4]=n.subtitle,e[5]=n.title,e[6]=h):h=e[6];let g;if(e[7]!==l||e[8]!==c||e[9]!==n?(g=[l,c,n],e[7]=l,e[8]=c,e[9]=n,e[10]=g):g=e[10],(0,Q.useEffect)(h,g),f){let t;return e[11]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`div`,{className:`space-y-4 p-4 sm:p-6`,children:[(0,$.jsx)(S,{className:`h-10 w-96 max-w-full`}),(0,$.jsx)(S,{className:`h-72 rounded-2xl`})]}),e[11]=t):t=e[11],t}if(d||!u){let t;e[12]===m?t=e[13]:(t=()=>void m(),e[12]=m,e[13]=t);let r;e[14]!==n.retry||e[15]!==t?(r=(0,$.jsx)(`button`,{className:`text-accent hover:underline`,onClick:t,children:n.retry}),e[14]=n.retry,e[15]=t,e[16]=r):r=e[16];let i;return e[17]!==n.error||e[18]!==r?(i=(0,$.jsx)(`div`,{className:`p-6`,children:(0,$.jsxs)(fe,{children:[n.error,` `,r]})}),e[17]=n.error,e[18]=r,e[19]=i):i=e[19],i}let _=n.title,v;e[20]===a?v=e[21]:(v=e=>a({tab:e}),e[20]=a,e[21]=v);let y;e[22]===n.profile?y=e[23]:(y={id:`profile`,label:n.profile,icon:V},e[22]=n.profile,e[23]=y);let b;e[24]!==u.understandings.length||e[25]!==n.understanding?(b={id:`understanding`,label:n.understanding,icon:z,count:u.understandings.length},e[24]=u.understandings.length,e[25]=n.understanding,e[26]=b):b=e[26];let C=n.collaboration,E;e[27]===u.rules?E=e[28]:(E=u.rules.filter(ve),e[27]=u.rules,e[28]=E);let k;e[29]!==n.collaboration||e[30]!==E.length?(k={id:`collaboration`,label:C,icon:T,count:E.length},e[29]=n.collaboration,e[30]=E.length,e[31]=k):k=e[31];let A;e[32]===n.sources?A=e[33]:(A={id:`sources`,label:n.sources,icon:D},e[32]=n.sources,e[33]=A);let j;e[34]===n.dreaming?j=e[35]:(j={id:`dreaming`,label:n.dreaming,icon:P},e[34]=n.dreaming,e[35]=j);let N;e[36]===n.privacy?N=e[37]:(N={id:`privacy`,label:n.privacy,icon:w},e[36]=n.privacy,e[37]=N);let F;e[38]!==A||e[39]!==j||e[40]!==N||e[41]!==y||e[42]!==b||e[43]!==k?(F=[y,b,k,A,j,N],e[38]=A,e[39]=j,e[40]=N,e[41]=y,e[42]=b,e[43]=k,e[44]=F):F=e[44];let I;e[45]!==n.title||e[46]!==F||e[47]!==v||e[48]!==s?(I=(0,$.jsx)(ne,{ariaLabel:_,activeTab:s,onChange:v,items:F}),e[45]=n.title,e[46]=F,e[47]=v,e[48]=s,e[49]=I):I=e[49];let L;e[50]!==u.profile||e[51]!==t||e[52]!==m||e[53]!==n||e[54]!==s?(L=s===`profile`?(0,$.jsx)(Se,{profile:u.profile,language:t,t:n,onChanged:e=>m(t=>t&&{...t,profile:e},{revalidate:!1})}):null,e[50]=u.profile,e[51]=t,e[52]=m,e[53]=n,e[54]=s,e[55]=L):L=e[55];let R;e[56]!==u.quality||e[57]!==u.understandings||e[58]!==t||e[59]!==m||e[60]!==n||e[61]!==s?(R=s===`understanding`?(0,$.jsx)(we,{items:u.understandings,quality:u.quality,language:t,t:n,onChanged:e=>e?m(t=>t&&{...t,understandings:t.understandings.map(t=>t.id===e.id?e:t)},{revalidate:!0}):m()}):null,e[56]=u.quality,e[57]=u.understandings,e[58]=t,e[59]=m,e[60]=n,e[61]=s,e[62]=R):R=e[62];let B;e[63]!==u.rules||e[64]!==t||e[65]!==m||e[66]!==n||e[67]!==s?(B=s===`collaboration`?(0,$.jsx)(Me,{rules:u.rules,language:t,t:n,onChanged:()=>m()}):null,e[63]=u.rules,e[64]=t,e[65]=m,e[66]=n,e[67]=s,e[68]=B):B=e[68];let H;e[69]!==n||e[70]!==s?(H=s===`sources`?(0,$.jsx)(Fe,{t:n}):null,e[69]=n,e[70]=s,e[71]=H):H=e[71];let U;e[72]!==u.consolidation?.lastRun||e[73]!==n||e[74]!==s?(U=s===`dreaming`?(0,$.jsx)(Ie,{lastRun:u.consolidation?.lastRun??null,t:n}):null,e[72]=u.consolidation?.lastRun,e[73]=n,e[74]=s,e[75]=U):U=e[75];let W;e[76]!==n||e[77]!==s?(W=s===`privacy`?(0,$.jsx)(Re,{t:n}):null,e[76]=n,e[77]=s,e[78]=W):W=e[78];let G;return e[79]!==I||e[80]!==L||e[81]!==R||e[82]!==B||e[83]!==H||e[84]!==U||e[85]!==W?(G=(0,$.jsxs)(`div`,{className:`mx-auto w-full max-w-5xl space-y-5 p-4 sm:p-6`,children:[I,L,R,B,H,U,W]}),e[79]=I,e[80]=L,e[81]=R,e[82]=B,e[83]=H,e[84]=U,e[85]=W,e[86]=G):G=e[86],G}function ve(e){return e.status===`active`}function ye(e){return e.clearPageHeader}function be(e){return e.setPageHeader}function xe(e){return e.language}function Se(e){let t=(0,Z.c)(78),{profile:n,language:r,t:i,onChanged:a}=e,o;t[0]===n?o=t[1]:(o=ge(n),t[0]=n,t[1]=o);let s=o,[c,l]=he(s),u;t[2]===c?u=t[3]:(u=me(c),t[2]=c,t[3]=u);let d;t[4]===s?d=t[5]:(d=me(s),t[4]=s,t[5]=d);let p=u!==d,m;t[6]!==a||t[7]!==n?(m=async e=>{await a((await k({...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=te(h),_;t[13]!==c||t[14]!==l?(_=(e,t,n)=>(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:t}),(0,$.jsx)(`input`,{className:se,placeholder:n,value:c[e],onChange:t=>l(n=>({...n,[e]:t.target.value}))})]}),t[13]=c,t[14]=l,t[15]=_):_=t[15];let v=_,y=g.onBlurCapture,b;t[16]===i.profileHint?b=t[17]:(b=(0,$.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,$.jsx)(`span`,{className:`font-medium text-fg`,children:i.primaryGoal}),t[26]=i.primaryGoal,t[27]=C);let w;t[28]===l?w=t[29]:(w=e=>l(t=>({...t,primaryGoal:e.target.value})),t[28]=l,t[29]=w);let T;t[30]!==c.primaryGoal||t[31]!==i.primaryGoalPlaceholder||t[32]!==w?(T=(0,$.jsx)(`textarea`,{className:se,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,$.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,$.jsx)(`span`,{className:`font-medium text-fg`,children:i.timezone}),t[42]=i.timezone,t[43]=O);let A;t[44]===l?A=t[45]:(A=e=>l(t=>({...t,timezone:e.target.value})),t[44]=l,t[45]=A);let j;t[46]!==c.timezone||t[47]!==A?(j=(0,$.jsx)(`input`,{className:`${se} min-w-0 flex-1`,value:c.timezone,onChange:A}),t[46]=c.timezone,t[47]=A,t[48]=j):j=t[48];let M;t[49]===l?M=t[50]:(M=()=>l(Ce),t[49]=l,t[50]=M);let N;t[51]!==i.detect||t[52]!==M?(N=(0,$.jsx)(f,{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,$.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,$.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,$.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,$.jsx)(`div`,{className:`mt-5 flex justify-end`,children:(0,$.jsx)(ee,{status:g.status,error:g.error})}),t[70]=g.error,t[71]=g.status,t[72]=R):R=t[72];let z;return t[73]!==g.onBlurCapture||t[74]!==L||t[75]!==R||t[76]!==b?(z=(0,$.jsx)(de,{children:(0,$.jsxs)(`div`,{onBlurCapture:y,children:[b,L,R]})}),t[73]=g.onBlurCapture,t[74]=L,t[75]=R,t[76]=b,t[77]=z):z=t[77],z}function Ce(e){return{...e,timezone:W()}}function we(e){let t=(0,Z.c)(78),{items:n,quality:r,language:i,t:a,onChanged:c}=e,[l,d]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(``),[h,g]=(0,Q.useState)(`preference`),_;t[0]===n?_=t[1]:(_=n.filter(Ee),t[0]=n,t[1]=_);let v=_,y;t[2]===n?y=t[3]:(y=n.filter(Te),t[2]=n,t[3]=y);let b=y,x;t[4]!==h||t[5]!==c||t[6]!==p?(x=async e=>{e.preventDefault(),p.trim()&&(await U({statement:p,kind:h}),m(``),d(!1),await c())},t[4]=h,t[5]=c,t[6]=p,t[7]=x):x=t[7];let S=x,C;t[8]===a.understoodHint?C=t[9]:(C=(0,$.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:a.understoodHint}),t[8]=a.understoodHint,t[9]=C);let w,T;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(w=()=>d(!0),T=(0,$.jsx)(u,{className:`size-4`}),t[10]=w,t[11]=T):(w=t[10],T=t[11]);let E;t[12]===a.addUnderstanding?E=t[13]:(E=(0,$.jsxs)(f,{variant:`primary`,onClick:w,children:[T,a.addUnderstanding]}),t[12]=a.addUnderstanding,t[13]=E);let D;t[14]!==C||t[15]!==E?(D=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[C,E]}),t[14]=C,t[15]=E,t[16]=D):D=t[16];let O=a.addUnderstanding,k=a.understoodHint,A=a.add,j=a.cancel,M;t[17]===p?M=t[18]:(M=p.trim(),t[17]=p,t[18]=M);let N=!M,P;t[19]===a.statement?P=t[20]:(P=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:a.statement}),t[19]=a.statement,t[20]=P);let F;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(F=e=>m(e.target.value),t[21]=F):F=t[21];let I;t[22]!==p||t[23]!==a.statement?(I=(0,$.jsx)(`textarea`,{autoFocus:!0,className:se,rows:4,placeholder:a.statement,value:p,onChange:F}),t[22]=p,t[23]=a.statement,t[24]=I):I=t[24];let L;t[25]!==P||t[26]!==I?(L=(0,$.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[P,I]}),t[25]=P,t[26]=I,t[27]=L):L=t[27];let R;t[28]===a.kind?R=t[29]:(R=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:a.kind}),t[28]=a.kind,t[29]=R);let z,B;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(z=e=>g(e.target.value),B=Object.entries(le),t[30]=z,t[31]=B):(z=t[30],B=t[31]);let V;t[32]===i?V=t[33]:(V=B.map(e=>{let[t,n]=e;return(0,$.jsx)(s,{value:t,children:n[i]},t)}),t[32]=i,t[33]=V);let H;t[34]!==h||t[35]!==V?(H=(0,$.jsx)(o,{value:h,onChange:z,children:V}),t[34]=h,t[35]=V,t[36]=H):H=t[36];let W;t[37]!==R||t[38]!==H?(W=(0,$.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[R,H]}),t[37]=R,t[38]=H,t[39]=W):W=t[39];let G;t[40]!==l||t[41]!==S||t[42]!==a.add||t[43]!==a.addUnderstanding||t[44]!==a.cancel||t[45]!==a.understoodHint||t[46]!==N||t[47]!==L||t[48]!==W?(G=(0,$.jsxs)(pe,{open:l,onOpenChange:d,title:O,description:k,submitLabel:A,cancelLabel:j,submitDisabled:N,onSubmit:S,children:[L,W]}),t[40]=l,t[41]=S,t[42]=a.add,t[43]=a.addUnderstanding,t[44]=a.cancel,t[45]=a.understoodHint,t[46]=N,t[47]=L,t[48]=W,t[49]=G):G=t[49];let K;t[50]!==r||t[51]!==a?(K=(0,$.jsx)(De,{quality:r,t:a}),t[50]=r,t[51]=a,t[52]=K):K=t[52];let q;t[53]===a?q=t[54]:(q=(0,$.jsx)(Ae,{t:a}),t[53]=a,t[54]=q);let J;t[55]!==i||t[56]!==c||t[57]!==b||t[58]!==a?(J=b.length?(0,$.jsxs)(`section`,{className:`space-y-2`,children:[(0,$.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[a.review,` · `,b.length]}),(0,$.jsx)(`div`,{className:`divide-y divide-edge overflow-hidden rounded-2xl border border-edge bg-surface-panel`,children:b.map(e=>(0,$.jsx)(ke,{item:e,language:i,t:a,onChanged:c},e.id))})]}):null,t[55]=i,t[56]=c,t[57]=b,t[58]=a,t[59]=J):J=t[59];let Y;t[60]!==v.length||t[61]!==a.active?(Y=(0,$.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[a.active,` · `,v.length]}),t[60]=v.length,t[61]=a.active,t[62]=Y):Y=t[62];let X;t[63]!==v||t[64]!==i||t[65]!==c||t[66]!==a?(X=v.length?(0,$.jsx)(`div`,{className:`divide-y divide-edge overflow-hidden rounded-2xl border border-edge bg-surface-panel`,children:v.map(e=>(0,$.jsx)(ke,{item:e,language:i,t:a,onChanged:c},e.id))}):(0,$.jsx)(fe,{children:a.emptyUnderstanding}),t[63]=v,t[64]=i,t[65]=c,t[66]=a,t[67]=X):X=t[67];let ee;t[68]!==Y||t[69]!==X?(ee=(0,$.jsxs)(`section`,{className:`space-y-2`,children:[Y,X]}),t[68]=Y,t[69]=X,t[70]=ee):ee=t[70];let te;return t[71]!==G||t[72]!==K||t[73]!==q||t[74]!==J||t[75]!==ee||t[76]!==D?(te=(0,$.jsxs)(`div`,{className:`space-y-5`,children:[D,G,K,q,J,ee]}),t[71]=G,t[72]=K,t[73]=q,t[74]=J,t[75]=ee,t[76]=D,t[77]=te):te=t[77],te}function Te(e){return[`candidate`,`needs_review`,`stale`].includes(e.status)}function Ee(e){return e.status===`active`}function De(e){let t=(0,Z.c)(32),{quality:n,t:r}=e,i;t[0]===r.qualityNoData?i=t[1]:(i=e=>e==null?r.qualityNoData:`${Math.round(e*100)}%`,t[0]=r.qualityNoData,t[1]=i);let a=i,o=r.qualityActive,s=String(n.records.active),c;t[2]!==r.qualityActive||t[3]!==s?(c=[o,s],t[2]=r.qualityActive,t[3]=s,t[4]=c):c=t[4];let l=r.qualityPending,u=String(n.records.candidate+n.records.needsReview),d;t[5]!==r.qualityPending||t[6]!==u?(d=[l,u],t[5]=r.qualityPending,t[6]=u,t[7]=d):d=t[7];let f=r.qualityAcceptance,p;t[8]!==n.decisions.acceptanceRate||t[9]!==a?(p=a(n.decisions.acceptanceRate),t[8]=n.decisions.acceptanceRate,t[9]=a,t[10]=p):p=t[10];let m;t[11]!==r.qualityAcceptance||t[12]!==p?(m=[f,p],t[11]=r.qualityAcceptance,t[12]=p,t[13]=m):m=t[13];let h=r.qualityRecall,g;t[14]!==n.recall.helpfulRate||t[15]!==a?(g=a(n.recall.helpfulRate),t[14]=n.recall.helpfulRate,t[15]=a,t[16]=g):g=t[16];let _;t[17]!==r.qualityRecall||t[18]!==g?(_=[h,g],t[17]=r.qualityRecall,t[18]=g,t[19]=_):_=t[19];let v;t[20]!==m||t[21]!==_||t[22]!==c||t[23]!==d?(v=[c,d,m,_],t[20]=m,t[21]=_,t[22]=c,t[23]=d,t[24]=v):v=t[24];let y=v,b;t[25]===r.qualityTitle?b=t[26]:(b=(0,$.jsx)(`h2`,{className:`text-xs font-medium text-fg-muted`,children:r.qualityTitle}),t[25]=r.qualityTitle,t[26]=b);let x;t[27]===y?x=t[28]:(x=y.map(Oe),t[27]=y,t[28]=x);let S;return t[29]!==b||t[30]!==x?(S=(0,$.jsxs)(`section`,{className:`flex flex-wrap items-center gap-x-5 gap-y-2 rounded-xl bg-surface-muted px-3 py-2.5`,children:[b,x]}),t[29]=b,t[30]=x,t[31]=S):S=t[31],S}function Oe(e){let[t,n]=e;return(0,$.jsxs)(`div`,{className:`flex items-baseline gap-1.5 text-xs`,children:[(0,$.jsx)(`span`,{className:`text-fg-subtle`,children:t}),(0,$.jsx)(`span`,{className:`font-semibold text-fg`,children:n})]},t)}function ke(e){let t=(0,Z.c)(60),{item:n,language:r,t:i,onChanged:a}=e,[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(!1),[u,d]=he(n.statement),p=u!==n.statement,m;t[0]===i.required?m=t[1]:(m=e=>e.trim()?null:i.required,t[0]=i.required,t[1]=m);let h;t[2]!==n.id||t[3]!==a?(h=async e=>{await a((await H(n.id,{statement:e})).understanding)},t[2]=n.id,t[3]=a,t[4]=h):h=t[4];let g;t[5]!==u||t[6]!==o||t[7]!==p||t[8]!==m||t[9]!==h?(g={value:u,dirty:p,enabled:o,delayMs:500,validate:m,onSave:h},t[5]=u,t[6]=o,t[7]=p,t[8]=m,t[9]=h,t[10]=g):g=t[10];let _=te(g),v;t[11]!==u||t[12]!==o||t[13]!==d?(v=o?(0,$.jsx)(`textarea`,{autoFocus:!0,className:se,value:u,onChange:e=>d(e.target.value),rows:3}):(0,$.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:u}),t[11]=u,t[12]=o,t[13]=d,t[14]=v):v=t[14];let y=le[n.kind][r],b;t[15]===y?b=t[16]:(b=(0,$.jsx)(`span`,{children:y}),t[15]=y,t[16]=b);let x;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,$.jsx)(`span`,{children:`·`}),t[17]=x):x=t[17];let S=n.explicitness===`explicit`?i.sourceExplicit:n.explicitness===`observed`?i.sourceObserved:i.sourceInferred,C;t[18]===S?C=t[19]:(C=(0,$.jsx)(`span`,{children:S}),t[18]=S,t[19]=C);let w;t[20]!==C||t[21]!==b?(w=(0,$.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-2 text-[11px] text-fg-subtle`,children:[b,x,C]}),t[20]=C,t[21]=b,t[22]=w):w=t[22];let T;t[23]!==w||t[24]!==v?(T=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[v,w]}),t[23]=w,t[24]=v,t[25]=T):T=t[25];let D;t[26]!==_||t[27]!==o||t[28]!==i.done||t[29]!==i.edit?(D=o?(0,$.jsx)(f,{variant:`ghost`,onClick:()=>{_.flush(),s(!1)},children:i.done}):(0,$.jsxs)(f,{variant:`ghost`,onClick:()=>s(!0),children:[(0,$.jsx)(E,{className:`size-3.5`}),i.edit]}),t[26]=_,t[27]=o,t[28]=i.done,t[29]=i.edit,t[30]=D):D=t[30];let O;t[31]!==n.id||t[32]!==n.status||t[33]!==a||t[34]!==i.confirm||t[35]!==i.reject?(O=n.status===`active`?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(f,{variant:`primary`,onClick:async()=>{await a((await H(n.id,{status:`active`})).understanding)},children:i.confirm}),(0,$.jsx)(f,{onClick:async()=>{await a((await H(n.id,{status:`rejected`})).understanding)},children:i.reject})]}),t[31]=n.id,t[32]=n.status,t[33]=a,t[34]=i.confirm,t[35]=i.reject,t[36]=O):O=t[36];let k;t[37]!==c||t[38]!==n.id||t[39]!==a?(k=async()=>{if(!c){l(!0);return}await R(n.id),l(!1),await a()},t[37]=c,t[38]=n.id,t[39]=a,t[40]=k):k=t[40];let A;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,$.jsx)(j,{className:`size-3.5`}),t[41]=A):A=t[41];let M=c?i.confirmDelete:i.delete,N;t[42]!==k||t[43]!==M?(N=(0,$.jsxs)(f,{variant:`ghost`,className:`text-danger`,onClick:k,children:[A,M]}),t[42]=k,t[43]=M,t[44]=N):N=t[44];let P;t[45]!==D||t[46]!==O||t[47]!==N?(P=(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-1 sm:justify-end`,children:[D,O,N]}),t[45]=D,t[46]=O,t[47]=N,t[48]=P):P=t[48];let F;t[49]!==T||t[50]!==P?(F=(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-start sm:gap-4`,children:[T,P]}),t[49]=T,t[50]=P,t[51]=F):F=t[51];let I;t[52]!==_.error||t[53]!==_.status||t[54]!==o?(I=o||_.status!==`idle`?(0,$.jsx)(ee,{className:`mt-2`,status:_.status,error:_.error}):null,t[52]=_.error,t[53]=_.status,t[54]=o,t[55]=I):I=t[55];let L;return t[56]!==_.onBlurCapture||t[57]!==F||t[58]!==I?(L=(0,$.jsx)(`article`,{className:`px-4 py-3 sm:px-5`,children:(0,$.jsxs)(`div`,{onBlurCapture:_.onBlurCapture,children:[F,I]})}),t[56]=_.onBlurCapture,t[57]=F,t[58]=I,t[59]=L):L=t[59],L}function Ae(e){let t=(0,Z.c)(35),{t:n}=e,{data:r,error:i,isLoading:a,mutate:o}=x(`you-focuses`,X),[s,c]=(0,Q.useState)(null);if(a){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(S,{className:`h-40 rounded-2xl`}),t[0]=e):e=t[0],e}if(i){let e;return t[1]===n.error?e=t[2]:(e=(0,$.jsx)(fe,{children:n.error}),t[1]=n.error,t[2]=e),e}let l;if(t[3]!==r||t[4]!==s||t[5]!==o||t[6]!==n.activate||t[7]!==n.complete||t[8]!==n.confidence||t[9]!==n.confidenceHigh||t[10]!==n.confidenceLow||t[11]!==n.confidenceMedium||t[12]!==n.confirmDelete||t[13]!==n.delete||t[14]!==n.focusActive||t[15]!==n.focusCandidate||t[16]!==n.focusCompleted||t[17]!==n.focusHint||t[18]!==n.focusPaused||t[19]!==n.focuses||t[20]!==n.noFocuses||t[21]!==n.pause||t[22]!==n.reject){let e=(r??[]).filter(je),i;t[24]!==n.focusActive||t[25]!==n.focusCandidate||t[26]!==n.focusCompleted||t[27]!==n.focusPaused?(i=e=>e===`candidate`?n.focusCandidate:e===`active`?n.focusActive:e===`paused`?n.focusPaused:n.focusCompleted,t[24]=n.focusActive,t[25]=n.focusCandidate,t[26]=n.focusCompleted,t[27]=n.focusPaused,t[28]=i):i=t[28];let a=i,u;t[29]!==n.confidenceHigh||t[30]!==n.confidenceLow||t[31]!==n.confidenceMedium?(u=e=>e>=.85?n.confidenceHigh:e>=.65?n.confidenceMedium:n.confidenceLow,t[29]=n.confidenceHigh,t[30]=n.confidenceLow,t[31]=n.confidenceMedium,t[32]=u):u=t[32];let d=u,p;t[33]===n.focusHint?p=t[34]:(p=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n.focusHint}),t[33]=n.focusHint,t[34]=p),l=(0,$.jsxs)(`section`,{className:`space-y-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[n.focuses,` · `,e.length]}),p]}),e.length?(0,$.jsx)(`div`,{className:`divide-y divide-edge overflow-hidden rounded-2xl border border-edge bg-surface-panel`,children:e.map(e=>(0,$.jsxs)(`article`,{className:`flex flex-col gap-3 px-4 py-3 sm:flex-row sm:items-center sm:px-5`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:e.title}),(0,$.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-[11px] text-fg-muted`,children:a(e.status)}),(0,$.jsxs)(`span`,{className:`text-[11px] text-fg-subtle`,children:[n.confidence,` · `,d(e.confidence)]})]}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-5 text-fg-muted`,children:e.summary})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-1 sm:justify-end`,children:[e.status===`active`?(0,$.jsx)(f,{onClick:async()=>{await I(e.id,`paused`),await o()},children:n.pause}):(0,$.jsx)(f,{variant:`primary`,onClick:async()=>{await I(e.id,`active`),await o()},children:n.activate}),(0,$.jsx)(f,{variant:`ghost`,onClick:async()=>{await I(e.id,`completed`),await o()},children:n.complete}),e.status===`candidate`?(0,$.jsx)(f,{variant:`ghost`,className:`text-danger`,onClick:async()=>{await I(e.id,`rejected`),await o()},children:n.reject}):null,(0,$.jsxs)(f,{variant:`ghost`,className:`text-danger`,onClick:async()=>{if(s!==e.id){c(e.id);return}await A(e.id),c(null),await o()},children:[(0,$.jsx)(j,{className:`size-3.5`}),s===e.id?n.confirmDelete:n.delete]})]})]},e.id))}):(0,$.jsx)(fe,{children:n.noFocuses})]}),t[3]=r,t[4]=s,t[5]=o,t[6]=n.activate,t[7]=n.complete,t[8]=n.confidence,t[9]=n.confidenceHigh,t[10]=n.confidenceLow,t[11]=n.confidenceMedium,t[12]=n.confirmDelete,t[13]=n.delete,t[14]=n.focusActive,t[15]=n.focusCandidate,t[16]=n.focusCompleted,t[17]=n.focusHint,t[18]=n.focusPaused,t[19]=n.focuses,t[20]=n.noFocuses,t[21]=n.pause,t[22]=n.reject,t[23]=l}else l=t[23];return l}function je(e){return e.status!==`rejected`}function Me(e){let t=(0,Z.c)(80),{rules:n,language:r,t:i,onChanged:a}=e,[c,l]=(0,Q.useState)(!1),[d,p]=(0,Q.useState)(``),[m,h]=(0,Q.useState)(`communication`),[g,_]=(0,Q.useState)(null),v,y,b,x,S,C;if(t[0]!==c||t[1]!==m||t[2]!==g||t[3]!==r||t[4]!==a||t[5]!==n||t[6]!==d||t[7]!==i.add||t[8]!==i.addRule||t[9]!==i.cancel||t[10]!==i.category||t[11]!==i.collaboration||t[12]!==i.confirmDelete||t[13]!==i.delete||t[14]!==i.disable||t[15]!==i.emptyRules||t[16]!==i.enable||t[17]!==i.ruleStatement||t[18]!==i.rulesHint){let e=n.filter(Ne),w;t[25]!==m||t[26]!==a||t[27]!==d?(w=async e=>{e.preventDefault(),d.trim()&&(await Y({statement:d,category:m}),p(``),l(!1),await a())},t[25]=m,t[26]=a,t[27]=d,t[28]=w):w=t[28];let T=w;x=`space-y-5`;let E;t[29]===i.rulesHint?E=t[30]:(E=(0,$.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:i.rulesHint}),t[29]=i.rulesHint,t[30]=E);let D,O;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(O=()=>l(!0),D=(0,$.jsx)(u,{className:`size-4`}),t[31]=D,t[32]=O):(D=t[31],O=t[32]);let k;t[33]===i.addRule?k=t[34]:(k=(0,$.jsxs)(f,{variant:`primary`,onClick:O,children:[D,i.addRule]}),t[33]=i.addRule,t[34]=k),t[35]!==k||t[36]!==E?(S=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[E,k]}),t[35]=k,t[36]=E,t[37]=S):S=t[37];let A=i.addRule,M=i.rulesHint,N=i.add,P=i.cancel,F;t[38]===d?F=t[39]:(F=d.trim(),t[38]=d,t[39]=F);let I=!F,L;t[40]===i.ruleStatement?L=t[41]:(L=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:i.ruleStatement}),t[40]=i.ruleStatement,t[41]=L);let R;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(R=e=>p(e.target.value),t[42]=R):R=t[42];let z;t[43]!==d||t[44]!==i.ruleStatement?(z=(0,$.jsx)(`textarea`,{autoFocus:!0,className:se,rows:4,placeholder:i.ruleStatement,value:d,onChange:R}),t[43]=d,t[44]=i.ruleStatement,t[45]=z):z=t[45];let B;t[46]!==L||t[47]!==z?(B=(0,$.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[L,z]}),t[46]=L,t[47]=z,t[48]=B):B=t[48];let V;t[49]===i.category?V=t[50]:(V=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:i.category}),t[49]=i.category,t[50]=V);let H,U;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(H=e=>h(e.target.value),U=Object.entries(ue),t[51]=H,t[52]=U):(H=t[51],U=t[52]);let W;t[53]===r?W=t[54]:(W=U.map(e=>{let[t,n]=e;return(0,$.jsx)(s,{value:t,children:n[r]},t)}),t[53]=r,t[54]=W);let q;t[55]!==m||t[56]!==W?(q=(0,$.jsx)(o,{value:m,onChange:H,children:W}),t[55]=m,t[56]=W,t[57]=q):q=t[57];let J;t[58]!==V||t[59]!==q?(J=(0,$.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[V,q]}),t[58]=V,t[59]=q,t[60]=J):J=t[60],t[61]!==c||t[62]!==T||t[63]!==i.add||t[64]!==i.addRule||t[65]!==i.cancel||t[66]!==i.rulesHint||t[67]!==I||t[68]!==B||t[69]!==J?(C=(0,$.jsxs)(pe,{open:c,onOpenChange:l,title:A,description:M,submitLabel:N,cancelLabel:P,submitDisabled:I,onSubmit:T,children:[B,J]}),t[61]=c,t[62]=T,t[63]=i.add,t[64]=i.addRule,t[65]=i.cancel,t[66]=i.rulesHint,t[67]=I,t[68]=B,t[69]=J,t[70]=C):C=t[70],v=`space-y-2`,y=(0,$.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[i.collaboration,` · `,e.length]}),b=e.length?(0,$.jsx)(`div`,{className:`divide-y divide-edge overflow-hidden rounded-2xl border border-edge bg-surface-panel`,children:e.map(e=>(0,$.jsxs)(`article`,{className:`flex flex-col gap-2 px-4 py-3 sm:flex-row sm:items-start sm:gap-4 sm:px-5`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`p`,{className:`text-sm leading-6 ${e.status===`disabled`?`text-fg-subtle line-through`:`text-fg`}`,children:e.statement}),(0,$.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-2 text-[11px] text-fg-subtle`,children:[(0,$.jsx)(`span`,{children:ue[e.category][r]}),(0,$.jsx)(`span`,{children:`·`}),(0,$.jsxs)(`span`,{children:[`P`,e.priority]}),e.status===`disabled`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{children:`·`}),(0,$.jsx)(`span`,{children:i.disable})]}):null]})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-1 sm:justify-end`,children:[(0,$.jsx)(f,{variant:`ghost`,onClick:async()=>{await G(e.id,{status:e.status===`active`?`disabled`:`active`}),await a()},children:e.status===`active`?i.disable:i.enable}),(0,$.jsxs)(f,{variant:`ghost`,className:`text-danger`,onClick:async()=>{if(g!==e.id){_(e.id);return}await K(e.id),_(null),await a()},children:[(0,$.jsx)(j,{className:`size-3.5`}),g===e.id?i.confirmDelete:i.delete]})]})]},e.id))}):(0,$.jsx)(fe,{children:i.emptyRules}),t[0]=c,t[1]=m,t[2]=g,t[3]=r,t[4]=a,t[5]=n,t[6]=d,t[7]=i.add,t[8]=i.addRule,t[9]=i.cancel,t[10]=i.category,t[11]=i.collaboration,t[12]=i.confirmDelete,t[13]=i.delete,t[14]=i.disable,t[15]=i.emptyRules,t[16]=i.enable,t[17]=i.ruleStatement,t[18]=i.rulesHint,t[19]=v,t[20]=y,t[21]=b,t[22]=x,t[23]=S,t[24]=C}else v=t[19],y=t[20],b=t[21],x=t[22],S=t[23],C=t[24];let w;t[71]!==v||t[72]!==y||t[73]!==b?(w=(0,$.jsxs)(`section`,{className:v,children:[y,b]}),t[71]=v,t[72]=y,t[73]=b,t[74]=w):w=t[74];let T;return t[75]!==x||t[76]!==S||t[77]!==C||t[78]!==w?(T=(0,$.jsxs)(`div`,{className:x,children:[S,C,w]}),t[75]=x,t[76]=S,t[77]=C,t[78]=w,t[79]=T):T=t[79],T}function Ne(e){return e.status!==`archived`}async function Pe(){let[e,t,n]=await Promise.all([q(),ie(),ae()]);return{grants:e,connectors:t,catalog:n}}function Fe({t:e}){let{data:t,error:n,isLoading:r,mutate:i}=x(`you-understanding-sources`,Pe),[o,s]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(null);if(r)return(0,$.jsx)(S,{className:`h-64 rounded-2xl`});if(n)return(0,$.jsxs)(fe,{children:[e.error,` `,(0,$.jsx)(`button`,{className:`text-accent hover:underline`,onClick:()=>void i(),children:e.retry})]});let h=t?.grants??[],g=t?.connectors??[],_=new Map((t?.catalog??[]).map(e=>[e.id,e])),v=e=>{let t=e.displayName.trim().toLocaleLowerCase(),n=g.find(e=>e.displayName.trim().toLocaleLowerCase()===t);return n?_.get(n.connectorId):[..._.values()].find(n=>n.displayName.trim().toLocaleLowerCase()===t||e.sourceKey.toLocaleLowerCase().includes(n.id.toLocaleLowerCase()))},y=t=>`${e.actionFailed}: ${t instanceof Error?t.message:String(t)}`,b=async t=>{m(null),d(null),s({grantId:t.id,kind:`refresh`});try{await N(t.id),await i().catch(()=>void 0),m({tone:`success`,message:`${t.displayName}: ${e.refreshStarted}`})}catch(e){m({tone:`error`,message:y(e)})}finally{s(null)}},w=async t=>{if(u!==t.id){d(t.id),m(null);return}s({grantId:t.id,kind:`revoke`});try{await F(t.id),await i().catch(()=>void 0),d(null),m({tone:`success`,message:`${t.displayName}: ${e.revokeDone}`})}catch(e){m({tone:`error`,message:y(e)})}finally{s(null)}};return(0,$.jsxs)(`div`,{className:`space-y-5`,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,$.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:e.sourcesHint}),(0,$.jsx)(f,{asChild:!0,variant:`primary`,children:(0,$.jsxs)(a,{to:`/connectors?understanding=1&returnTo=%2Fyou%3Ftab%3Dsources`,children:[e.manageSources,(0,$.jsx)(c,{className:`size-4`})]})})]}),p?(0,$.jsx)(`p`,{role:`status`,"aria-live":`polite`,className:`rounded-xl px-3 py-2 text-sm ${p.tone===`success`?`bg-success-soft text-success`:`bg-danger/10 text-danger`}`,children:p.message}):null,(0,$.jsxs)(`section`,{className:`space-y-2`,children:[(0,$.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[e.authorizedSources,` · `,h.length]}),h.length?(0,$.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:h.map(t=>{let n=v(t);return(0,$.jsxs)(`article`,{className:`flex min-h-28 items-start gap-3 rounded-2xl border border-edge bg-surface-panel p-4`,children:[n?(0,$.jsx)(re,{connector:n,size:`sm`}):(0,$.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg border border-edge bg-surface-base`,children:(0,$.jsx)(J,{className:`size-4 text-fg-muted`})}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:t.displayName}),(0,$.jsxs)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:[t.accessMode===`continuous`?e.continuous:e.once,` · `,t.processingPolicy===`local_only`?e.localOnly:t.retentionPolicy===`derived_only`?e.derivedOnly:t.retentionPolicy]}),t.lastCollectedAt?(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:new Date(t.lastCollectedAt).toLocaleString()}):null]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-1`,children:[t.accessMode===`continuous`?(0,$.jsx)(f,{variant:`ghost`,disabled:o!==null,"aria-busy":o?.grantId===t.id&&o.kind===`refresh`,onClick:()=>void b(t),children:o?.grantId===t.id&&o.kind===`refresh`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(l,{className:`size-4 animate-spin`}),e.refreshing]}):e.refresh}):null,(0,$.jsx)(f,{variant:`ghost`,className:`text-danger`,title:e.revokeHint,"aria-label":`${e.revoke}: ${t.displayName}`,disabled:o!==null,"aria-busy":o?.grantId===t.id&&o.kind===`revoke`,onClick:()=>void w(t),children:o?.grantId===t.id&&o.kind===`revoke`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(l,{className:`size-4 animate-spin`}),e.revoking]}):u===t.id?e.confirmRevoke:e.revoke})]})]},t.id)})}):(0,$.jsx)(fe,{children:e.noSources})]}),(0,$.jsxs)(`section`,{className:`space-y-2`,children:[(0,$.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[e.connectorsTitle,` · `,g.length]}),g.length?(0,$.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:g.map(t=>{let n=t.enabled&&(t.status===`connected`||t.connectionStatus===`connected`||t.authStatus===`connected`),r=_.get(t.connectorId);return(0,$.jsxs)(a,{to:`/connectors?tab=connected&instance=${encodeURIComponent(t.instanceId)}`,"aria-label":`${e.openConnector}: ${t.displayName}`,className:`group flex min-h-24 items-center gap-3 rounded-2xl border border-edge bg-surface-panel p-4 transition-colors hover:border-edge-strong hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,children:[(0,$.jsx)(re,{connector:r??{displayName:t.displayName}}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:t.displayName}),(0,$.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:t.connectorId})]}),(0,$.jsx)(`span`,{className:`shrink-0 rounded-full px-2 py-1 text-xs ${n?`bg-success-soft text-success`:`bg-warning-soft text-warning`}`,children:n?e.connected:e.unavailable}),(0,$.jsx)(C,{className:`size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5`})]},t.instanceId)})}):(0,$.jsx)(fe,{children:e.noConnectors})]})]})}function Ie(e){let t=(0,Z.c)(112),{lastRun:n,t:r}=e,{data:i,error:a,isLoading:c,mutate:l}=x(`you-context-settings`,B),u=i?.dreaming??null,[d,p]=he(u),m;t[0]!==d||t[1]!==u?(m=d&&u&&me(d)!==me(u),t[0]=d,t[1]=u,t[2]=m):m=t[2];let h=!!m,g;t[3]===l?g=t[4]:(g=async e=>{await L({dreaming:e}),await l()},t[3]=l,t[4]=g);let _;t[5]!==d||t[6]!==h||t[7]!==g?(_={value:d,dirty:h,delayMs:500,onSave:g},t[5]=d,t[6]=h,t[7]=g,t[8]=_):_=t[8];let v=te(_);if(a){let e;t[9]===l?e=t[10]:(e=()=>void l(),t[9]=l,t[10]=e);let n;t[11]!==r.retry||t[12]!==e?(n=(0,$.jsx)(`button`,{className:`text-accent hover:underline`,onClick:e,children:r.retry}),t[11]=r.retry,t[12]=e,t[13]=n):n=t[13];let i;return t[14]!==r.error||t[15]!==n?(i=(0,$.jsxs)(fe,{children:[r.error,` `,n]}),t[14]=r.error,t[15]=n,t[16]=i):i=t[16],i}if(c||!d){let e;return t[17]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(S,{className:`h-72 rounded-2xl`}),t[17]=e):e=t[17],e}let y=n?.status===`completed`?r.runCompleted:n?.status===`failed`?r.runFailed:r.runRunning,b;t[18]===r.dreamingHint?b=t[19]:(b=(0,$.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:r.dreamingHint}),t[18]=r.dreamingHint,t[19]=b);let C=v.onBlurCapture,w;t[20]===r.mode?w=t[21]:(w=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:r.mode}),t[20]=r.mode,t[21]=w);let T;t[22]===p?T=t[23]:(T=e=>p(t=>t&&{...t,mode:e.target.value}),t[22]=p,t[23]=T);let E;t[24]===r.on?E=t[25]:(E=(0,$.jsx)(s,{value:`review`,children:r.on}),t[24]=r.on,t[25]=E);let D;t[26]===r.off?D=t[27]:(D=(0,$.jsx)(s,{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,$.jsxs)(o,{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 k;t[33]!==O||t[34]!==w?(k=(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[w,O]}),t[33]=O,t[34]=w,t[35]=k):k=t[35];let A;t[36]===r.reviewTime?A=t[37]:(A=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:r.reviewTime}),t[36]=r.reviewTime,t[37]=A);let j;t[38]===p?j=t[39]:(j=e=>p(t=>t&&{...t,schedule:{time:e.target.value}}),t[38]=p,t[39]=j);let M;t[40]!==d.schedule.time||t[41]!==j?(M=(0,$.jsx)(`input`,{type:`time`,className:se,value:d.schedule.time,onChange:j}),t[40]=d.schedule.time,t[41]=j,t[42]=M):M=t[42];let N;t[43]!==A||t[44]!==M?(N=(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[A,M]}),t[43]=A,t[44]=M,t[45]=N):N=t[45];let P;t[46]===r.timezone?P=t[47]:(P=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:r.timezone}),t[46]=r.timezone,t[47]=P);let F=d.timezone??``,I;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(I=W(),t[48]=I):I=t[48];let R;t[49]===p?R=t[50]:(R=e=>p(t=>t&&{...t,timezone:e.target.value||void 0}),t[49]=p,t[50]=R);let z;t[51]!==F||t[52]!==R?(z=(0,$.jsx)(`input`,{className:`${se} min-w-0 flex-1`,value:F,placeholder:I,onChange:R}),t[51]=F,t[52]=R,t[53]=z):z=t[53];let V;t[54]===p?V=t[55]:(V=()=>p(Le),t[54]=p,t[55]=V);let H;t[56]!==r.detect||t[57]!==V?(H=(0,$.jsx)(f,{className:`shrink-0 whitespace-nowrap`,onClick:V,children:r.detect}),t[56]=r.detect,t[57]=V,t[58]=H):H=t[58];let U;t[59]!==z||t[60]!==H?(U=(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[z,H]}),t[59]=z,t[60]=H,t[61]=U):U=t[61];let G;t[62]!==P||t[63]!==U?(G=(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm sm:col-span-2`,children:[P,U]}),t[62]=P,t[63]=U,t[64]=G):G=t[64];let K;t[65]===r.evidenceThreshold?K=t[66]:(K=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:r.evidenceThreshold}),t[65]=r.evidenceThreshold,t[66]=K);let q;t[67]===p?q=t[68]:(q=e=>p(t=>t&&{...t,minEvidenceSources:Number(e.target.value)}),t[67]=p,t[68]=q);let J;t[69]!==d.minEvidenceSources||t[70]!==q?(J=(0,$.jsx)(`input`,{type:`number`,min:2,max:10,className:se,value:d.minEvidenceSources,onChange:q}),t[69]=d.minEvidenceSources,t[70]=q,t[71]=J):J=t[71];let Y;t[72]!==K||t[73]!==J?(Y=(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[K,J]}),t[72]=K,t[73]=J,t[74]=Y):Y=t[74];let X;t[75]===r.scanLimit?X=t[76]:(X=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:r.scanLimit}),t[75]=r.scanLimit,t[76]=X);let ne;t[77]===p?ne=t[78]:(ne=e=>p(t=>t&&{...t,limit:Number(e.target.value)}),t[77]=p,t[78]=ne);let re;t[79]!==d.limit||t[80]!==ne?(re=(0,$.jsx)(`input`,{type:`number`,min:1,max:2e3,className:se,value:d.limit,onChange:ne}),t[79]=d.limit,t[80]=ne,t[81]=re):re=t[81];let ie;t[82]!==X||t[83]!==re?(ie=(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[X,re]}),t[82]=X,t[83]=re,t[84]=ie):ie=t[84];let ae;t[85]!==k||t[86]!==N||t[87]!==G||t[88]!==Y||t[89]!==ie?(ae=(0,$.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[k,N,G,Y,ie]}),t[85]=k,t[86]=N,t[87]=G,t[88]=Y,t[89]=ie,t[90]=ae):ae=t[90];let Q;t[91]!==v.error||t[92]!==v.status?(Q=(0,$.jsx)(`div`,{className:`mt-5 flex justify-end`,children:(0,$.jsx)(ee,{status:v.status,error:v.error})}),t[91]=v.error,t[92]=v.status,t[93]=Q):Q=t[93];let oe;t[94]!==v.onBlurCapture||t[95]!==ae||t[96]!==Q?(oe=(0,$.jsx)(de,{children:(0,$.jsxs)(`div`,{onBlurCapture:C,children:[ae,Q]})}),t[94]=v.onBlurCapture,t[95]=ae,t[96]=Q,t[97]=oe):oe=t[97];let ce;t[98]===r.lastRun?ce=t[99]:(ce=(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:r.lastRun}),t[98]=r.lastRun,t[99]=ce);let le;t[100]!==n||t[101]!==y||t[102]!==r.neverRun||t[103]!==r.runItems?(le=n?(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-sm text-fg-muted`,children:[(0,$.jsx)(`span`,{children:y}),(0,$.jsx)(`span`,{children:`·`}),(0,$.jsx)(`time`,{children:new Date(n.startedAt).toLocaleString()}),typeof n.metrics.scanned==`number`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{children:`·`}),(0,$.jsxs)(`span`,{children:[String(n.metrics.scanned),` `,r.runItems]})]}):null]}):(0,$.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:r.neverRun}),t[100]=n,t[101]=y,t[102]=r.neverRun,t[103]=r.runItems,t[104]=le):le=t[104];let ue;t[105]!==ce||t[106]!==le?(ue=(0,$.jsxs)(de,{children:[ce,le]}),t[105]=ce,t[106]=le,t[107]=ue):ue=t[107];let pe;return t[108]!==oe||t[109]!==ue||t[110]!==b?(pe=(0,$.jsxs)(`div`,{className:`space-y-5`,children:[b,oe,ue]}),t[108]=oe,t[109]=ue,t[110]=b,t[111]=pe):pe=t[111],pe}function Le(e){return e&&{...e,timezone:W()}}function Re(e){let t=(0,Z.c)(49),{t:n}=e,{data:r,error:i,isLoading:a,mutate:c}=x(`you-context-settings`,B),l=r?.privacy.sensitiveWritePolicy??null,[u,d]=he(l),f=!!(u&&l&&u!==l),p;t[0]===c?p=t[1]:(p=async e=>{await L({privacy:{sensitiveWritePolicy:e}}),await c()},t[0]=c,t[1]=p);let m;t[2]!==u||t[3]!==f||t[4]!==p?(m={value:u,dirty:f,delayMs:350,onSave:p},t[2]=u,t[3]=f,t[4]=p,t[5]=m):m=t[5];let h=te(m);if(i){let e;t[6]===c?e=t[7]:(e=()=>void c(),t[6]=c,t[7]=e);let r;t[8]!==n.retry||t[9]!==e?(r=(0,$.jsx)(`button`,{className:`text-accent hover:underline`,onClick:e,children:n.retry}),t[8]=n.retry,t[9]=e,t[10]=r):r=t[10];let i;return t[11]!==n.error||t[12]!==r?(i=(0,$.jsxs)(fe,{children:[n.error,` `,r]}),t[11]=n.error,t[12]=r,t[13]=i):i=t[13],i}if(a||!u){let e;return t[14]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(S,{className:`h-56 rounded-2xl`}),t[14]=e):e=t[14],e}let g;t[15]===n.privacyHint?g=t[16]:(g=(0,$.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:n.privacyHint}),t[15]=n.privacyHint,t[16]=g);let _;t[17]===n.sensitivePolicy?_=t[18]:(_=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:n.sensitivePolicy}),t[17]=n.sensitivePolicy,t[18]=_);let v;t[19]===d?v=t[20]:(v=e=>d(e.target.value),t[19]=d,t[20]=v);let y;t[21]===n.policyDeny?y=t[22]:(y=(0,$.jsx)(s,{value:`deny`,children:n.policyDeny}),t[21]=n.policyDeny,t[22]=y);let b;t[23]===n.policyConfirm?b=t[24]:(b=(0,$.jsx)(s,{value:`confirm`,children:n.policyConfirm}),t[23]=n.policyConfirm,t[24]=b);let C;t[25]===n.policyAllow?C=t[26]:(C=(0,$.jsx)(s,{value:`allow`,children:n.policyAllow}),t[25]=n.policyAllow,t[26]=C);let w;t[27]!==u||t[28]!==v||t[29]!==y||t[30]!==b||t[31]!==C?(w=(0,$.jsxs)(o,{value:u,onChange:v,children:[y,b,C]}),t[27]=u,t[28]=v,t[29]=y,t[30]=b,t[31]=C,t[32]=w):w=t[32];let T;t[33]!==w||t[34]!==_?(T=(0,$.jsxs)(`label`,{className:`block max-w-xl space-y-1.5 text-sm`,children:[_,w]}),t[33]=w,t[34]=_,t[35]=T):T=t[35];let E;t[36]===n.privacyWarning?E=t[37]:(E=(0,$.jsx)(`p`,{className:`mt-3 max-w-2xl text-xs leading-5 text-fg-subtle`,children:n.privacyWarning}),t[36]=n.privacyWarning,t[37]=E);let D;t[38]!==h.error||t[39]!==h.status?(D=(0,$.jsx)(`div`,{className:`mt-5 flex justify-end`,children:(0,$.jsx)(ee,{status:h.status,error:h.error})}),t[38]=h.error,t[39]=h.status,t[40]=D):D=t[40];let O;t[41]!==h.onBlurCapture||t[42]!==T||t[43]!==E||t[44]!==D?(O=(0,$.jsx)(de,{children:(0,$.jsxs)(`div`,{onBlurCapture:h.onBlurCapture,children:[T,E,D]})}),t[41]=h.onBlurCapture,t[42]=T,t[43]=E,t[44]=D,t[45]=O):O=t[45];let k;return t[46]!==O||t[47]!==g?(k=(0,$.jsxs)(`div`,{className:`space-y-5`,children:[g,O]}),t[46]=O,t[47]=g,t[48]=k):k=t[48],k}export{_e 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-CbPVxonP.js";import{n as o}from"./gateway-config-swr-VVcfd3sG.js";import{Ho as s}from"./index-DHGnTdgl.js";e();var c=t();async function l(e,t){return(await a(i(`/api/voice/tts-voices?${new URLSearchParams({provider:e,model:t}).toString()}`))).payload?.voices??[]}function u(){return{enabled:!0,provider:`xopc-local`,providers:{"xopc-local":{model:`sensevoice-small`},alibaba:{model:`qwen-audio-3.0-asr-flash`},openai:{model:`gpt-4o-mini-transcribe`},groq:{model:`whisper-large-v3-turbo`}},fallback:{enabled:!1,order:[`xopc-local`]}}}function d(){return{enabled:!0,provider:`edge`,trigger:`inbound`,maxTextLength:512,timeoutMs:6e4,providers:{alibaba:{model:`qwen-tts`,voice:`Cherry`},openai:{model:`tts-1`,voice:`alloy`},edge:{voice:`zh-CN-XiaoxiaoNeural`,lang:`zh-CN`},minimax:{model:`speech-2.8-hd`,voice:`male-qn-qingse`},"tts-local-cli":{command:``,outputFormat:`wav`}}}}function f(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function p(e){return typeof e==`string`&&e.trim().length>0?e.trim():`xopc-local`}function m(e){let t=u();if(!f(e))return t;let n=p(e.provider),r=t.fallback??{enabled:!1,order:[`xopc-local`]};if(f(e.fallback)){let t=Array.isArray(e.fallback.order)?e.fallback.order.filter(e=>typeof e==`string`&&e.trim().length>0):r.order;r={enabled:typeof e.fallback.enabled==`boolean`?e.fallback.enabled:r.enabled,order:t.length?t:r.order}}let i={...t.providers??{},...f(e.providers)?Object.fromEntries(Object.entries(e.providers).map(([e,t])=>[e,f(t)?{...t}:{}])):{}};return{enabled:!!e.enabled,provider:n,providers:i,fallback:r}}function h(e){return typeof e==`string`&&e.trim().length>0?e.trim():`edge`}function g(e){let t=d();if(!f(e))return t;let n=h(e.provider),r=e.trigger===`off`||e.trigger===`always`||e.trigger===`inbound`||e.trigger===`tagged`?e.trigger:`inbound`,i={...t.providers??{},...f(e.providers)?Object.fromEntries(Object.entries(e.providers).map(([e,t])=>[e,f(t)?{...t}:{}])):{}};return{enabled:!!e.enabled,provider:n,trigger:r,maxTextLength:typeof e.maxTextLength==`number`&&Number.isFinite(e.maxTextLength)?e.maxTextLength:t.maxTextLength,timeoutMs:typeof e.timeoutMs==`number`&&Number.isFinite(e.timeoutMs)?e.timeoutMs:t.timeoutMs,providers:i}}function _(e){return{...e}}function v(e){return{...e}}function y(e){let t=f(e)?e:{},n=f(t.voice)?t.voice:{},r=f(n.input)?n.input:{},i=f(r.refinement)?r.refinement:{},a=i.mode===`punctuation`||i.mode===`light`||i.mode===`custom`?i.mode:`off`;return{stt:m(t.stt),tts:g(t.tts),voice:{languageMode:n.languageMode===`manual`?`manual`:`auto`,language:n.language===`zh`?`zh`:`en`,input:{refinement:{mode:a,...typeof i.model==`string`&&i.model.trim()?{model:i.model.trim()}:{},...typeof i.customInstruction==`string`?{customInstruction:i.customInstruction}:{}}}}}}async function b(){return y((await a(i(`/api/config`))).payload?.config??{})}async function x(e){await a(i(`/api/config`),{method:`PATCH`,body:JSON.stringify({stt:_(e.stt),tts:v(e.tts),voice:e.voice})}),e.voice.languageMode===`auto`&&await a(i(`/api/voice/language`),{method:`POST`,body:JSON.stringify({language:e.voice.language})}),typeof window<`u`&&window.dispatchEvent(new Event(`voice-config-changed`)),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{C as a,E as c,D as d,O as f,S as i,y as l,T as n,b as o,l as r,w as s,j as t,x as u};
1
+ import"./rolldown-runtime-aKtaBQYM.js";import{a as e,n as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./cn-JdwAhgNB.js";import{r as i,s as a}from"./locale-store-CieddUjx.js";import{n as o}from"./gateway-config-swr-CGpoH1gU.js";import{Ho as s}from"./index-CrwXzRpA.js";e();var c=t();async function l(e,t){return(await a(i(`/api/voice/tts-voices?${new URLSearchParams({provider:e,model:t}).toString()}`))).payload?.voices??[]}function u(){return{enabled:!0,provider:`xopc-local`,providers:{"xopc-local":{model:`sensevoice-small`},alibaba:{model:`qwen-audio-3.0-asr-flash`},openai:{model:`gpt-4o-mini-transcribe`},groq:{model:`whisper-large-v3-turbo`}},fallback:{enabled:!1,order:[`xopc-local`]}}}function d(){return{enabled:!0,provider:`edge`,trigger:`inbound`,maxTextLength:512,timeoutMs:6e4,providers:{alibaba:{model:`qwen-tts`,voice:`Cherry`},openai:{model:`tts-1`,voice:`alloy`},edge:{voice:`zh-CN-XiaoxiaoNeural`,lang:`zh-CN`},minimax:{model:`speech-2.8-hd`,voice:`male-qn-qingse`},"tts-local-cli":{command:``,outputFormat:`wav`}}}}function f(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function p(e){return typeof e==`string`&&e.trim().length>0?e.trim():`xopc-local`}function m(e){let t=u();if(!f(e))return t;let n=p(e.provider),r=t.fallback??{enabled:!1,order:[`xopc-local`]};if(f(e.fallback)){let t=Array.isArray(e.fallback.order)?e.fallback.order.filter(e=>typeof e==`string`&&e.trim().length>0):r.order;r={enabled:typeof e.fallback.enabled==`boolean`?e.fallback.enabled:r.enabled,order:t.length?t:r.order}}let i={...t.providers??{},...f(e.providers)?Object.fromEntries(Object.entries(e.providers).map(([e,t])=>[e,f(t)?{...t}:{}])):{}};return{enabled:!!e.enabled,provider:n,providers:i,fallback:r}}function h(e){return typeof e==`string`&&e.trim().length>0?e.trim():`edge`}function g(e){let t=d();if(!f(e))return t;let n=h(e.provider),r=e.trigger===`off`||e.trigger===`always`||e.trigger===`inbound`||e.trigger===`tagged`?e.trigger:`inbound`,i={...t.providers??{},...f(e.providers)?Object.fromEntries(Object.entries(e.providers).map(([e,t])=>[e,f(t)?{...t}:{}])):{}};return{enabled:!!e.enabled,provider:n,trigger:r,maxTextLength:typeof e.maxTextLength==`number`&&Number.isFinite(e.maxTextLength)?e.maxTextLength:t.maxTextLength,timeoutMs:typeof e.timeoutMs==`number`&&Number.isFinite(e.timeoutMs)?e.timeoutMs:t.timeoutMs,providers:i}}function _(e){return{...e}}function v(e){return{...e}}function y(e){let t=f(e)?e:{},n=f(t.voice)?t.voice:{},r=f(n.input)?n.input:{},i=f(r.refinement)?r.refinement:{},a=i.mode===`punctuation`||i.mode===`light`||i.mode===`custom`?i.mode:`off`;return{stt:m(t.stt),tts:g(t.tts),voice:{languageMode:n.languageMode===`manual`?`manual`:`auto`,language:n.language===`zh`?`zh`:`en`,input:{refinement:{mode:a,...typeof i.model==`string`&&i.model.trim()?{model:i.model.trim()}:{},...typeof i.customInstruction==`string`?{customInstruction:i.customInstruction}:{}}}}}}async function b(){return y((await a(i(`/api/config`))).payload?.config??{})}async function x(e){await a(i(`/api/config`),{method:`PATCH`,body:JSON.stringify({stt:_(e.stt),tts:v(e.tts),voice:e.voice})}),e.voice.languageMode===`auto`&&await a(i(`/api/voice/language`),{method:`POST`,body:JSON.stringify({language:e.voice.language})}),typeof window<`u`&&window.dispatchEvent(new Event(`voice-config-changed`)),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{C as a,E as c,D as d,O as f,S as i,y as l,T as n,b as o,l as r,w as s,j as t,x as u};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./x-B_N4OPjy.js";import{t as a}from"./button-CSEbl4zT.js";import{t as o}from"./messages-9zCa8KkW.js";import{n as s}from"./locale-store-CbPVxonP.js";import{a as c,i as l,o as u,r as d,s as f,t as p}from"./dist-BPoKqzeH.js";import{Ha as m,Wo as h}from"./index-DHGnTdgl.js";import{WorkDiscoveryPage as g}from"./work-discovery-page-C4Ivt1_C.js";var _=n(),v=e(t(),1),y=r(),b=180;function x(e){let t=(0,_.c)(40),{requestedOpen:n,onExited:r}=e,x=s(C),w=m(S),[T,E]=(0,v.useState)(!0),D=(0,v.useRef)(!1),O=(0,v.useRef)(null),k;t[0]===x?k=t[1]:(k=o(x),t[0]=x,t[1]=k);let A=k.onboarding.workDiscovery,j=w?x===`zh`?`在后台继续`:`Continue in background`:x===`zh`?`稍后再说`:`Maybe later`,M;t[2]===r?M=t[3]:(M=()=>{if(D.current)return;D.current=!0,E(!1);let e=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?0:b;O.current=window.setTimeout(r,e)},t[2]=r,t[3]=M);let N=M,P,F;t[4]!==N||t[5]!==n?(P=()=>{n||N()},F=[N,n],t[4]=N,t[5]=n,t[6]=P,t[7]=F):(P=t[6],F=t[7]),(0,v.useEffect)(P,F);let I,L;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(I=()=>()=>{O.current!==null&&window.clearTimeout(O.current)},L=[],t[8]=I,t[9]=L):(I=t[8],L=t[9]),(0,v.useEffect)(I,L);let R;t[10]===N?R=t[11]:(R=e=>{e||N()},t[10]=N,t[11]=R);let z;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,y.jsx)(c,{className:`xopc-dialog-overlay fixed inset-0 z-[75] bg-scrim backdrop-blur-[1px]`}),t[12]=z):z=t[12];let B;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,y.jsx)(h,{className:`size-7 shrink-0`,"aria-hidden":!0}),t[13]=B):B=t[13];let V;t[14]===A.title?V=t[15]:(V=(0,y.jsx)(f,{className:`truncate text-sm font-semibold text-fg`,children:A.title}),t[14]=A.title,t[15]=V);let H;t[16]===A.subtitle?H=t[17]:(H=(0,y.jsx)(l,{className:`sr-only`,children:A.subtitle}),t[16]=A.subtitle,t[17]=H);let U;t[18]!==V||t[19]!==H?(U=(0,y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[B,V,H]}),t[18]=V,t[19]=H,t[20]=U):U=t[20];let W;t[21]===j?W=t[22]:(W=(0,y.jsx)(`span`,{className:`hidden text-xs sm:inline`,children:j}),t[21]=j,t[22]=W);let G;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,y.jsx)(i,{className:`size-4`,"aria-hidden":!0}),t[23]=G):G=t[23];let K;t[24]!==j||t[25]!==N||t[26]!==W?(K=(0,y.jsxs)(a,{type:`button`,variant:`ghost`,className:`h-9 shrink-0 gap-1.5 px-2.5 text-fg-muted`,title:j,"aria-label":j,onClick:N,children:[W,G]}),t[24]=j,t[25]=N,t[26]=W,t[27]=K):K=t[27];let q;t[28]!==U||t[29]!==K?(q=(0,y.jsxs)(`header`,{className:`flex h-14 shrink-0 items-center justify-between gap-4 border-b border-edge bg-surface-panel px-4 sm:px-5`,children:[U,K]}),t[28]=U,t[29]=K,t[30]=q):q=t[30];let J;t[31]===N?J=t[32]:(J=(0,y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,y.jsx)(g,{embedded:!0,onRequestClose:N})}),t[31]=N,t[32]=J);let Y;t[33]!==q||t[34]!==J?(Y=(0,y.jsxs)(u,{children:[z,(0,y.jsx)(d,{className:`xopc-work-discovery-dialog pointer-events-none fixed inset-0 z-[76] flex items-center justify-center p-3 outline-none sm:p-6`,children:(0,y.jsxs)(`section`,{className:`xopc-work-discovery-panel pointer-events-auto flex h-[min(47.5rem,calc(100dvh-1.5rem))] w-[min(45rem,calc(100vw-1.5rem))] flex-col overflow-hidden rounded-2xl border border-edge bg-surface-base shadow-float sm:h-[min(47.5rem,calc(100dvh-3rem))] sm:w-[min(45rem,calc(100vw-3rem))]`,children:[q,J]})})]}),t[33]=q,t[34]=J,t[35]=Y):Y=t[35];let X;return t[36]!==T||t[37]!==Y||t[38]!==R?(X=(0,y.jsx)(p,{open:T,onOpenChange:R,children:Y}),t[36]=T,t[37]=Y,t[38]=R,t[39]=X):X=t[39],X}function S(e){return e.status===`running`}function C(e){return e.language}export{x as WorkDiscoveryOverlay};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./x-B_N4OPjy.js";import{t as a}from"./button-CSEbl4zT.js";import{t as o}from"./messages-CySMn8WL.js";import{n as s}from"./locale-store-CieddUjx.js";import{a as c,i as l,o as u,r as d,s as f,t as p}from"./dist-BPoKqzeH.js";import{Ha as m,Wo as h}from"./index-CrwXzRpA.js";import{WorkDiscoveryPage as g}from"./work-discovery-page-DL_Ie0s2.js";var _=n(),v=e(t(),1),y=r(),b=180;function x(e){let t=(0,_.c)(40),{requestedOpen:n,onExited:r}=e,x=s(C),w=m(S),[T,E]=(0,v.useState)(!0),D=(0,v.useRef)(!1),O=(0,v.useRef)(null),k;t[0]===x?k=t[1]:(k=o(x),t[0]=x,t[1]=k);let A=k.onboarding.workDiscovery,j=w?x===`zh`?`在后台继续`:`Continue in background`:x===`zh`?`稍后再说`:`Maybe later`,M;t[2]===r?M=t[3]:(M=()=>{if(D.current)return;D.current=!0,E(!1);let e=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?0:b;O.current=window.setTimeout(r,e)},t[2]=r,t[3]=M);let N=M,P,F;t[4]!==N||t[5]!==n?(P=()=>{n||N()},F=[N,n],t[4]=N,t[5]=n,t[6]=P,t[7]=F):(P=t[6],F=t[7]),(0,v.useEffect)(P,F);let I,L;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(I=()=>()=>{O.current!==null&&window.clearTimeout(O.current)},L=[],t[8]=I,t[9]=L):(I=t[8],L=t[9]),(0,v.useEffect)(I,L);let R;t[10]===N?R=t[11]:(R=e=>{e||N()},t[10]=N,t[11]=R);let z;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,y.jsx)(c,{className:`xopc-dialog-overlay fixed inset-0 z-[75] bg-scrim backdrop-blur-[1px]`}),t[12]=z):z=t[12];let B;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,y.jsx)(h,{className:`size-7 shrink-0`,"aria-hidden":!0}),t[13]=B):B=t[13];let V;t[14]===A.title?V=t[15]:(V=(0,y.jsx)(f,{className:`truncate text-sm font-semibold text-fg`,children:A.title}),t[14]=A.title,t[15]=V);let H;t[16]===A.subtitle?H=t[17]:(H=(0,y.jsx)(l,{className:`sr-only`,children:A.subtitle}),t[16]=A.subtitle,t[17]=H);let U;t[18]!==V||t[19]!==H?(U=(0,y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[B,V,H]}),t[18]=V,t[19]=H,t[20]=U):U=t[20];let W;t[21]===j?W=t[22]:(W=(0,y.jsx)(`span`,{className:`hidden text-xs sm:inline`,children:j}),t[21]=j,t[22]=W);let G;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,y.jsx)(i,{className:`size-4`,"aria-hidden":!0}),t[23]=G):G=t[23];let K;t[24]!==j||t[25]!==N||t[26]!==W?(K=(0,y.jsxs)(a,{type:`button`,variant:`ghost`,className:`h-9 shrink-0 gap-1.5 px-2.5 text-fg-muted`,title:j,"aria-label":j,onClick:N,children:[W,G]}),t[24]=j,t[25]=N,t[26]=W,t[27]=K):K=t[27];let q;t[28]!==U||t[29]!==K?(q=(0,y.jsxs)(`header`,{className:`flex h-14 shrink-0 items-center justify-between gap-4 border-b border-edge bg-surface-panel px-4 sm:px-5`,children:[U,K]}),t[28]=U,t[29]=K,t[30]=q):q=t[30];let J;t[31]===N?J=t[32]:(J=(0,y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,y.jsx)(g,{embedded:!0,onRequestClose:N})}),t[31]=N,t[32]=J);let Y;t[33]!==q||t[34]!==J?(Y=(0,y.jsxs)(u,{children:[z,(0,y.jsx)(d,{className:`xopc-work-discovery-dialog pointer-events-none fixed inset-0 z-[76] flex items-center justify-center p-3 outline-none sm:p-6`,children:(0,y.jsxs)(`section`,{className:`xopc-work-discovery-panel pointer-events-auto flex h-[min(47.5rem,calc(100dvh-1.5rem))] w-[min(45rem,calc(100vw-1.5rem))] flex-col overflow-hidden rounded-2xl border border-edge bg-surface-base shadow-float sm:h-[min(47.5rem,calc(100dvh-3rem))] sm:w-[min(45rem,calc(100vw-3rem))]`,children:[q,J]})})]}),t[33]=q,t[34]=J,t[35]=Y):Y=t[35];let X;return t[36]!==T||t[37]!==Y||t[38]!==R?(X=(0,y.jsx)(p,{open:T,onOpenChange:R,children:Y}),t[36]=T,t[37]=Y,t[38]=R,t[39]=X):X=t[39],X}function S(e){return e.status===`running`}function C(e){return e.language}export{x as WorkDiscoveryOverlay};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{f as r,l as i}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as a}from"./check-DUBLcKHA.js";import{n as o,t as ee}from"./working-directory-picker-modal-vWi33CZJ.js";import{t as s}from"./loader-circle-CifKLtgG.js";import{t as c}from"./x-B_N4OPjy.js";import{t as te}from"./cn-JdwAhgNB.js";import{t as l}from"./button-CSEbl4zT.js";import{t as ne}from"./messages-CySMn8WL.js";import{n as re}from"./locale-store-CieddUjx.js";import{$a as u,Aa as d,Cl as f,Cs as p,Ga as ie,Ha as m,Ja as ae,Ka as oe,Kc as se,Lc as ce,Qa as le,Tl as ue,Ua as de,Vc as h,Wa as fe,Wo as pe,Xa as me,Ya as he,Za as ge,eo as _e,ll as ve,qa as g}from"./index-CrwXzRpA.js";var _=e(t(),1),v=new Set([`completed`,`failed`,`canceled`]);function y(){return new Promise(e=>window.setTimeout(e,1200))}async function ye(e,t){let n=[],r=t.wait??y;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 b=new Set([`local-recent-files`,`chromium-bookmarks`,`apple-notes`,`apple-calendar`,`apple-reminders`]);function be(e){return new Set(e.filter(e=>e.availability===`available`&&b.has(e.id)).map(e=>e.id))}var x=n(),S=[`folder_structure`,`recent_progress`,`next_steps`];function C(e){return e instanceof Error?e.message:String(e)}function xe({embedded:e=!1,onRequestClose:t}={}){let n=re(e=>e.language),v=ne(n).onboarding.workDiscovery,y=ne(n).chat.workingDirectory,b=i(),[xe]=r(),Se=e||xe.get(`new`)===`1`,[w,T]=(0,_.useState)(`loading`),[E,Ce]=(0,_.useState)(null),[D,O]=(0,_.useState)(null),[k,A]=(0,_.useState)(!1),[j,M]=(0,_.useState)(null),[we,N]=(0,_.useState)(!1),[P,F]=(0,_.useState)(``),[I,L]=(0,_.useState)(!1),[R,z]=(0,_.useState)(()=>new Set),[B,Te]=(0,_.useState)([]),[V,Ee]=(0,_.useState)(()=>new Set),[De,H]=(0,_.useState)([]),[Oe,ke]=(0,_.useState)(!1),[U,W]=(0,_.useState)({current:0,total:0}),[Ae,je]=(0,_.useState)([]),[G,Me]=(0,_.useState)(()=>new Set),K=(0,_.useRef)(!1),Ne=e=>{Me(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})};(0,_.useEffect)(()=>{let e=!1;return window.electronAPI?.understandingSources?.catalog().then(t=>{e||(je(t),Me(be(t)))}),()=>{e=!0}},[]);let q=(0,_.useCallback)(e=>{m.getState().updateDirectoryRun(e),O(e),e.status===`completed`?(z(new Set(e.result?.profileCandidates?.filter(e=>e.status===`pending`).map(e=>e.id)??[])),T(e.feedback?.recognitionDecision===`confirmed`?`recommendation`:`recognition`)):e.status===`failed`||e.status===`canceled`?T(`error`):T(`running`)},[]),Pe=async()=>{A(!0),M(null);try{let e=await fe();if(!e.length){M(v.noCandidates);return}Te(e),Ee(new Set([e[0].rootPath])),T(`candidates`)}catch(e){M(C(e))}finally{A(!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)=>{m.getState().updateDirectoryRun(e),O(e),W({current:t+1,total:n}),H(n=>{let r=[...n];return r[t]=e,r}),T(`running`)},[]),Le=(0,_.useCallback)(e=>{H(t=>t.map(t=>t?.id===e.id?e:t))},[]),Re=async()=>{let e=B.filter(e=>V.has(e.rootPath));if(!e.length)return;A(!0),M(null),H([]),W({current:1,total:e.length}),ke(!0),K.current=!1;let t=!1;try{let n=await ye(e,{grantDirectory:ae,startRun:le,fetchRun:g,shouldStop:()=>K.current,onRun:(e,n,r)=>{Ie(e,n,r),t||(t=!0,m.getState().collectSources(e.id,[...G]))},onError:(t,n,r)=>{W({current:r+1,total:e.length}),M(v.folderAnalysisFailed.replace(`{{folder}}`,n.displayName).replace(`{{error}}`,C(t)))}});if(K.current)return;let r=n.find(e=>e.status===`completed`)??n.at(-1);r?q(r):T(`candidates`)}catch(e){M(C(e)),T(`candidates`)}finally{ke(!1),A(!1)}},J=o({onPicked:(0,_.useCallback)(async e=>{A(!0),M(null);try{Ce(await he(e)),T(`consent`)}catch(e){M(C(e)),T(`intro`)}finally{A(!1)}},[])});(0,_.useEffect)(()=>{let e=!1;return oe().then(async({enabled:n,state:r})=>{if(!e){if(!n){t?t():b(`/chat`,{replace:!0});return}if(!Se&&r.activeRunId)try{let t=await g(r.activeRunId);e||q(t);return}catch{}e||T(`intro`)}}).catch(t=>{e||(M(C(t)),T(`intro`))}),()=>{e=!0}},[q,b,t,Se]),(0,_.useEffect)(()=>{if(!D||w!==`running`||Oe)return;let e=!1,t=async()=>{try{let t=await g(D.id);e||q(t)}catch{}},n=window.setInterval(()=>void t(),1200),r=e=>{let n=e.detail;(!n?.runId||n.runId===D.id)&&t()};for(let e of[`work-discovery-progress`,`work-discovery-completed`,`work-discovery-failed`,`work-discovery-canceled`])window.addEventListener(e,r);return()=>{e=!0,window.clearInterval(n);for(let e of[`work-discovery-progress`,`work-discovery-completed`,`work-discovery-failed`,`work-discovery-canceled`])window.removeEventListener(e,r)}},[q,Oe,w,D]);let ze=async()=>{A(!0);try{await ie()}finally{t?t():b(`/chat`,{replace:!0})}},Be=async()=>{if(E){A(!0),M(null),H([]),W({current:0,total:0});try{await ae(E.canonicalRootPath);let e=await le(E.canonicalRootPath);q(e),m.getState().collectSources(e.id,[...G])}catch(e){M(C(e)),T(`consent`)}finally{A(!1)}}},Y=(e,t)=>{let n=t?`?draft=${encodeURIComponent(t)}`:``;b(`/chat/${encodeURIComponent(e)}${n}`)},Ve=e=>{O(e),N(!1),L(!1),z(new Set(e.result?.profileCandidates?.filter(e=>e.status===`pending`).map(e=>e.id)??[])),e.status===`completed`?T(e.feedback?.recognitionDecision===`confirmed`?`recommendation`:`recognition`):e.status===`failed`||e.status===`canceled`?T(`error`):T(`running`)},He=async()=>{D&&(K.current=!0,q(await de(D.id)))},X=async(e,t)=>{if(!D)return;await ge(D.id,e.id).catch(()=>{});let r=t?`${n===`zh`?`先帮我评估这个方向,不要修改文件:`:`First assess this direction without changing files:`}\n\n${e.actionPrompt}`:e.actionPrompt;Y(D.sessionKey,r)},Ue=async()=>{if(D){A(!0),M(null);try{let e=D.result?.profileCandidates??[],t=await u((e.length>0?await _e(D.id,e.map(e=>({id:e.id,status:R.has(e.id)?`accepted`:`rejected`}))):D).id,`confirmed`);O(t),Le(t),T(`recommendation`)}catch(e){M(C(e))}finally{A(!1)}}},Z=async e=>{if(!(!D||!P.trim())){A(!0),M(null);try{let t=await u(D.id,e,P.trim());O(t),Y(t.sessionKey,P.trim())}catch(e){M(C(e)),A(!1)}}},We=async()=>{if(D){A(!0);try{Y((await u(D.id,`dismissed`)).sessionKey)}catch(e){M(C(e)),A(!1)}}},Q=D?.result?.suggestions.find(e=>e.id===D.result?.primarySuggestionId)??D?.result?.suggestions[0],Ge=D?.result?.suggestions.filter(e=>e.id!==Q?.id)??[],Ke=e=>e===`command`?v.riskCommand:e===`file_write`?v.riskFileWrite:v.riskAnalysis,qe=De.filter(e=>e?.status===`completed`),Je=e&&w===`candidates`,$=qe.length>1?(0,x.jsxs)(`div`,{className:`mt-6 rounded-xl border border-edge bg-surface-panel p-2`,children:[(0,x.jsx)(`p`,{className:`px-2 pb-2 text-xs font-medium text-fg-muted`,children:v.analysisResults}),(0,x.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:qe.map(e=>{let t=B.find(t=>t.rootPath===e.rootPath)?.displayName??e.rootPath.split(/[\\/]/).filter(Boolean).at(-1)??e.rootPath;return(0,x.jsx)(`button`,{type:`button`,className:`rounded-lg px-3 py-2 text-sm font-medium transition ${e.id===D?.id?`bg-accent text-white`:`bg-surface-muted text-fg hover:bg-surface-hover`}`,onClick:()=>Ve(e),children:t},e.id)})})]}):null;return(0,x.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,x.jsxs)(`main`,{className:e?`mx-auto flex h-full min-h-0 w-full max-w-[40rem] flex-1 flex-col px-5 py-7 sm:px-8 sm:py-9 ${Je?`overflow-hidden`:`overflow-y-auto [scrollbar-gutter:stable]`}`:`mx-auto flex w-full max-w-[40rem] flex-1 flex-col px-5 py-10 sm:px-8 sm:py-16`,children:[e?null:(0,x.jsx)(`div`,{className:`mb-10 flex items-center justify-center`,children:(0,x.jsx)(pe,{className:`size-11`})}),w===`loading`?(0,x.jsxs)(`div`,{className:`mx-auto flex min-h-[26rem] w-full max-w-md flex-col items-center`,"aria-busy":!0,children:[(0,x.jsx)(d,{className:`h-8 w-64 max-w-full`}),(0,x.jsx)(d,{className:`mt-4 h-4 w-full max-w-sm`}),(0,x.jsx)(d,{className:`mt-2 h-4 w-4/5 max-w-xs`}),(0,x.jsx)(d,{className:`mt-10 h-12 w-full rounded-xl`}),(0,x.jsx)(d,{className:`mt-3 h-11 w-full rounded-xl`}),(0,x.jsx)(d,{className:`mt-5 h-4 w-3/5 max-w-56`})]}):null,w===`intro`?(0,x.jsxs)(`section`,{className:`flex flex-1 flex-col text-center`,"aria-labelledby":`work-discovery-title`,children:[(0,x.jsxs)(`div`,{className:`mx-auto max-w-[36rem]`,children:[(0,x.jsx)(`h1`,{id:`work-discovery-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:v.title}),(0,x.jsx)(`p`,{className:`mx-auto mt-3 max-w-[34rem] text-[0.95rem] leading-7 text-fg-muted`,children:v.subtitle})]}),(0,x.jsxs)(`div`,{className:`mx-auto mt-9 w-full max-w-md`,children:[Ae.length?(0,x.jsxs)(`div`,{className:`mb-5 rounded-xl border border-edge bg-surface-panel p-3 text-left`,children:[(0,x.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:v.localSourcesTitle}),(0,x.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:v.localSourcesSubtitle}),(0,x.jsx)(`div`,{className:`mt-3 grid grid-cols-2 gap-2 sm:grid-cols-3`,children:Ae.map(e=>{let t=G.has(e.id);return(0,x.jsxs)(`button`,{type:`button`,className:te(`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,x.jsx)(`span`,{className:te(`flex size-4 items-center justify-center rounded-full border`,t?`border-accent bg-accent text-white`:`border-edge`),children:t?(0,x.jsx)(a,{className:`size-3`,"aria-hidden":!0}):null}),e.displayName]},e.id)})})]}):null,(0,x.jsxs)(l,{type:`button`,className:`h-12 w-full gap-2 bg-accent text-white hover:bg-accent-hover`,onClick:()=>void Pe(),disabled:k||J.picking,children:[k?(0,x.jsx)(s,{className:`size-4 animate-spin`}):(0,x.jsx)(p,{className:`size-4`}),v.quickScan]}),(0,x.jsxs)(l,{type:`button`,variant:`secondary`,className:`mt-3 h-11 w-full gap-2`,onClick:J.pick,disabled:k||J.picking,children:[J.picking?(0,x.jsx)(s,{className:`size-4 animate-spin`}):(0,x.jsx)(h,{className:`size-4`}),v.chooseFolderManually]}),(0,x.jsxs)(`div`,{className:`mt-4 flex items-start justify-center gap-2 text-xs leading-5 text-fg-muted`,children:[(0,x.jsx)(p,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`}),(0,x.jsx)(`span`,{children:v.quickScanNote})]}),(0,x.jsx)(`button`,{type:`button`,className:`mt-4 text-sm font-medium text-accent-fg hover:underline`,onClick:()=>b(`/connectors?understanding=1&returnTo=%2Fonboarding%2Fworkspace`),children:v.connectCloudSource}),j?(0,x.jsx)(`p`,{className:`mt-4 text-sm text-danger`,role:`alert`,children:j}):null]}),(0,x.jsx)(`button`,{type:`button`,className:`mx-auto mt-auto pt-10 text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>void ze(),disabled:k,children:v.skip})]}):null,w===`candidates`?(0,x.jsxs)(`section`,{className:e?`flex h-full min-h-0 flex-col`:void 0,"aria-labelledby":`work-discovery-candidates-title`,children:[(0,x.jsxs)(`div`,{className:e?`shrink-0 text-center`:`text-center`,children:[(0,x.jsx)(`h1`,{id:`work-discovery-candidates-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:v.candidatesTitle}),(0,x.jsx)(`p`,{className:`mt-3 text-[0.95rem] leading-7 text-fg-muted`,children:v.candidatesSubtitle})]}),(0,x.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:B.map((e,t)=>{let n=V.has(e.rootPath);return(0,x.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,x.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,x.jsx)(a,{className:`size-3.5`})}),(0,x.jsx)(h,{className:`mt-0.5 size-5 shrink-0 text-accent-fg`}),(0,x.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,x.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,x.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.displayName}),t===0?(0,x.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,x.jsx)(`span`,{className:`mt-1 block truncate font-mono text-xs text-fg-muted`,children:e.rootPath}),(0,x.jsxs)(`span`,{className:`mt-2 flex flex-wrap gap-x-3 gap-y-1 text-xs text-fg-muted`,children:[(0,x.jsx)(`span`,{children:e.projectKind===`coding`?v.codingProject:e.projectKind===`general`?v.generalProject:v.unknownProject}),e.branch?(0,x.jsx)(`span`,{children:v.branchValue.replace(`{{branch}}`,e.branch)}):null,e.changedFileCount>0?(0,x.jsx)(`span`,{children:v.changedFiles.replace(`{{count}}`,String(e.changedFileCount))}):null]})]})]},e.id)})}),(0,x.jsxs)(`div`,{className:e?`shrink-0 border-t border-edge-subtle pt-4`:void 0,children:[(0,x.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,x.jsx)(p,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`}),(0,x.jsx)(`span`,{children:v.multiFolderPrivacyNote})]}),j?(0,x.jsx)(`p`,{className:`mt-3 text-sm text-danger`,role:`alert`,children:j}):null,(0,x.jsxs)(`div`,{className:`${e?`mt-4`:`mt-7`} flex flex-col gap-3 sm:flex-row-reverse`,children:[(0,x.jsxs)(l,{type:`button`,className:`h-11 flex-1 bg-accent text-white hover:bg-accent-hover`,disabled:k||V.size===0,onClick:()=>void Re(),children:[k?(0,x.jsx)(s,{className:`mr-2 size-4 animate-spin`}):null,v.analyzeSelected.replace(`{{count}}`,String(V.size))]}),(0,x.jsx)(l,{type:`button`,variant:`secondary`,className:`h-11 flex-1`,disabled:k,onClick:J.pick,children:v.chooseFolderManually})]}),(0,x.jsx)(`button`,{type:`button`,className:`${e?`mt-3`:`mt-6`} mx-auto block text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>T(`intro`),children:v.back})]})]}):null,w===`consent`&&E?(0,x.jsxs)(`section`,{"aria-labelledby":`work-discovery-consent-title`,children:[(0,x.jsxs)(`div`,{className:`text-center`,children:[(0,x.jsx)(`h1`,{id:`work-discovery-consent-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:v.selectedTitle}),(0,x.jsx)(`p`,{className:`mt-3 text-[0.95rem] leading-7 text-fg-muted`,children:v.selectedSubtitle})]}),(0,x.jsxs)(`div`,{className:`mt-8 overflow-hidden rounded-xl border border-edge bg-surface-panel`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-edge-subtle px-4 py-3.5`,children:[(0,x.jsx)(h,{className:`size-5 shrink-0 text-accent-fg`}),(0,x.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,x.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:E.displayName}),(0,x.jsx)(`p`,{className:`truncate font-mono text-xs text-fg-muted`,children:E.canonicalRootPath})]}),(0,x.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2.5 py-1 text-xs font-medium text-accent-fg`,children:E.projectKind===`coding`?v.codingProject:E.projectKind===`general`?v.generalProject:v.unknownProject})]}),(0,x.jsxs)(`div`,{className:`grid gap-3 border-b border-edge-subtle bg-surface-base/60 p-4 sm:grid-cols-2`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:v.localFingerprint}),(0,x.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:E.fingerprint.branch?v.branchValue.replace(`{{branch}}`,E.fingerprint.branch):v.noGitBranch})]}),(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:v.recentActivity}),(0,x.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:v.changedFiles.replace(`{{count}}`,String(E.fingerprint.changedFileCount))})]}),E.fingerprint.recentAreas.length>0?(0,x.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,x.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:v.recentAreas}),(0,x.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:E.fingerprint.recentAreas.map(e=>(0,x.jsx)(`code`,{className:`rounded-md bg-surface-muted px-2 py-1 text-xs text-fg`,children:e},e))})]}):null]}),(0,x.jsxs)(`div`,{className:`divide-y divide-edge-subtle px-4`,children:[(0,x.jsxs)(`div`,{className:`flex gap-3 py-4`,children:[(0,x.jsx)(se,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`}),(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:v.willRead}),(0,x.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:v.willReadValue})]})]}),(0,x.jsxs)(`div`,{className:`flex gap-3 py-4`,children:[(0,x.jsx)(c,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`}),(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:v.willIgnore}),(0,x.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:v.willIgnoreValue})]})]}),(0,x.jsxs)(`div`,{className:`flex gap-3 py-4`,children:[(0,x.jsx)(p,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`}),(0,x.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:E.remoteModel?v.providerDisclosure.replace(`{{provider}}`,E.provider):v.localDisclosure})]})]})]}),j?(0,x.jsx)(`p`,{className:`mt-4 text-sm text-danger`,role:`alert`,children:j}):null,(0,x.jsxs)(`div`,{className:`mt-7 flex flex-col gap-3 sm:flex-row-reverse`,children:[(0,x.jsxs)(l,{type:`button`,className:`h-11 flex-1 bg-accent text-white hover:bg-accent-hover`,disabled:k,onClick:()=>void Be(),children:[k?(0,x.jsx)(s,{className:`mr-2 size-4 animate-spin`}):null,v.startAnalysis]}),(0,x.jsx)(l,{type:`button`,variant:`secondary`,className:`h-11 flex-1`,disabled:k,onClick:J.pick,children:v.changeFolder})]}),(0,x.jsx)(`button`,{type:`button`,className:`mx-auto mt-6 block text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>void ze(),children:v.skip})]}):null,w===`running`&&D?(0,x.jsxs)(`section`,{"aria-labelledby":`work-discovery-running-title`,"aria-live":`polite`,children:[(0,x.jsxs)(`div`,{className:`text-center`,children:[(0,x.jsx)(`h1`,{id:`work-discovery-running-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:v.analyzingTitle}),(0,x.jsx)(`p`,{className:`mt-3 text-[0.95rem] leading-7 text-fg-muted`,children:v.analyzingSubtitle}),U.total>1?(0,x.jsx)(`p`,{className:`mt-2 text-sm font-medium text-accent-fg`,children:v.analyzingFolderProgress.replace(`{{current}}`,String(U.current)).replace(`{{total}}`,String(U.total))}):null]}),(0,x.jsx)(`div`,{className:`mt-9 rounded-xl border border-edge bg-surface-panel px-5 py-2`,children:S.map((e,t)=>{let n=Math.max(0,S.indexOf(D.stage??`folder_structure`)),r=t<n,i=t===n;return(0,x.jsxs)(`div`,{className:`flex items-center gap-4 border-b border-edge-subtle py-4 last:border-b-0`,children:[(0,x.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,x.jsx)(a,{className:`size-4`}):i?(0,x.jsx)(s,{className:`size-4 animate-spin motion-reduce:animate-none`}):(0,x.jsx)(`span`,{className:`size-1.5 rounded-full bg-current`})}),(0,x.jsx)(`span`,{className:i||r?`text-sm font-medium text-fg`:`text-sm text-fg-muted`,children:v.stages[e]})]},e)})}),(0,x.jsx)(`p`,{className:`mt-4 truncate text-center font-mono text-xs text-fg-muted`,children:D.rootPath}),(0,x.jsxs)(`div`,{className:`mx-auto mt-7 flex max-w-md flex-col gap-3`,children:[(0,x.jsx)(l,{type:`button`,variant:`secondary`,className:`h-11 w-full`,onClick:()=>b(`/chat`),children:v.continueInBackground}),(0,x.jsx)(`button`,{type:`button`,className:`mx-auto text-sm text-fg-muted hover:text-danger hover:underline`,onClick:()=>void He(),children:v.cancelAnalysis})]})]}):null,w===`recognition`&&D?.result?(0,x.jsxs)(`section`,{"aria-labelledby":`work-discovery-recognition-title`,children:[(0,x.jsxs)(`div`,{className:`text-center`,children:[(0,x.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.16em] text-accent-fg`,children:v.recognitionEyebrow}),(0,x.jsx)(`h1`,{id:`work-discovery-recognition-title`,className:`mt-2 text-2xl font-semibold tracking-tight text-fg`,children:D.result.lowConfidence?v.lowConfidenceTitle:v.recognitionTitle})]}),$,(0,x.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,x.jsx)(`p`,{className:`text-base font-medium leading-7 text-fg`,children:D.result.projectSummary}),(0,x.jsx)(`p`,{className:`mt-3 text-sm leading-6 text-fg-muted`,children:D.result.currentState}),!D.result.lowConfidence&&Q?.evidence.length?(0,x.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,x.jsxs)(`li`,{className:`flex gap-2 text-xs leading-5 text-fg-muted`,children:[(0,x.jsx)(ce,{className:`mt-0.5 size-3.5 shrink-0 text-accent-fg`}),(0,x.jsxs)(`span`,{children:[e.path?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`code`,{className:`font-mono text-fg`,children:e.path}),`: `]}):null,e.observation]})]},`${Q.id}-recognition-${t}`))}):null]}),D.result.workThreads?.length?(0,x.jsxs)(`div`,{className:`mt-5 rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,x.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:v.workThreadsTitle}),(0,x.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:v.workThreadsSubtitle}),(0,x.jsx)(`div`,{className:`mt-3 divide-y divide-edge-subtle`,children:D.result.workThreads.map(e=>(0,x.jsxs)(`div`,{className:`py-3 first:pt-0 last:pb-0`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,x.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,x.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:e.title})]}),(0,x.jsx)(`p`,{className:`mt-1.5 text-xs leading-5 text-fg-muted`,children:e.summary})]},e.id))})]}):null,D.result.profileCandidates?.length?(0,x.jsxs)(`div`,{className:`mt-5 rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,x.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:v.profileCandidatesTitle}),(0,x.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:v.profileCandidatesSubtitle}),(0,x.jsx)(`div`,{className:`mt-3 space-y-2`,children:D.result.profileCandidates.map(e=>(0,x.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3 rounded-lg px-2 py-2 hover:bg-surface-muted`,children:[(0,x.jsx)(`input`,{type:`checkbox`,className:`mt-0.5 size-4 rounded border-edge accent-accent`,checked:R.has(e.id),onChange:()=>z(t=>{let n=new Set(t);return n.has(e.id)?n.delete(e.id):n.add(e.id),n})}),(0,x.jsx)(`span`,{className:`text-sm leading-5 text-fg`,children:e.statement})]},e.id))})]}):null,D.result.lowConfidence?(0,x.jsxs)(`div`,{className:`mt-5`,children:[(0,x.jsx)(`p`,{className:`text-sm font-medium leading-6 text-fg`,children:D.result.contextQuestion}),(0,x.jsx)(`textarea`,{value:P,onChange:e=>F(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,x.jsx)(l,{className:`mt-3 w-full bg-accent text-white hover:bg-accent-hover`,disabled:k||!P.trim(),onClick:()=>void Z(`different_goal`),children:v.continueWithCorrection})]}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`div`,{className:`mt-6 flex flex-col gap-3 sm:flex-row-reverse`,children:[(0,x.jsxs)(l,{className:`h-11 flex-1 bg-accent text-white hover:bg-accent-hover`,disabled:k,onClick:()=>void Ue(),children:[k?(0,x.jsx)(s,{className:`size-4 animate-spin`}):(0,x.jsx)(a,{className:`size-4`}),v.confirmUnderstanding]}),(0,x.jsx)(l,{variant:`secondary`,className:`h-11 flex-1`,disabled:k,onClick:()=>N(e=>!e),children:v.notQuiteRight})]}),we?(0,x.jsxs)(`div`,{className:`mt-4 rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,x.jsx)(`label`,{className:`text-sm font-medium text-fg`,htmlFor:`work-discovery-correction`,children:v.correctionLabel}),(0,x.jsx)(`textarea`,{id:`work-discovery-correction`,value:P,onChange:e=>F(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,x.jsxs)(`div`,{className:`mt-3 flex flex-wrap justify-end gap-2`,children:[(0,x.jsx)(l,{variant:`ghost`,disabled:k||!P.trim(),onClick:()=>void Z(`different_goal`),children:v.differentGoal}),(0,x.jsx)(l,{variant:`primary`,disabled:k||!P.trim(),onClick:()=>void Z(`corrected`),children:v.useCorrection})]})]}):null]}),j?(0,x.jsx)(`p`,{className:`mt-4 text-sm text-danger`,role:`alert`,children:j}):null,(0,x.jsx)(`button`,{type:`button`,disabled:k,className:`mx-auto mt-6 block text-sm text-fg-muted hover:text-fg hover:underline disabled:opacity-60`,onClick:()=>void We(),children:v.openConversation})]}):null,w===`recommendation`&&D?.result&&Q?(0,x.jsxs)(`section`,{"aria-labelledby":`work-discovery-recommendation-title`,children:[(0,x.jsxs)(`div`,{className:`text-center`,children:[(0,x.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.16em] text-accent-fg`,children:v.understandingConfirmed}),(0,x.jsx)(`h1`,{id:`work-discovery-recommendation-title`,className:`mt-2 text-2xl font-semibold tracking-tight text-fg`,children:v.primaryRecommendationTitle})]}),$,(0,x.jsx)(`article`,{className:`mt-7 rounded-2xl border border-accent/30 bg-surface-panel p-5 sm:p-6`,children:(0,x.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,x.jsx)(`div`,{className:`flex size-9 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-accent-fg`,children:(0,x.jsx)(f,{className:`size-5`})}),(0,x.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,x.jsx)(`h2`,{className:`text-lg font-semibold text-fg`,children:Q.title}),(0,x.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:Q.rationale}),(0,x.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2 text-xs`,children:[(0,x.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,x.jsx)(ve,{className:`size-3.5`}),v.estimatedMinutes.replace(`{{count}}`,String(Q.estimatedMinutes))]}),(0,x.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2.5 py-1 text-fg-muted`,children:Ke(Q.risk)})]}),(0,x.jsxs)(`div`,{className:`mt-4 rounded-xl bg-surface-base px-4 py-3`,children:[(0,x.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:v.expectedTask}),(0,x.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg`,children:Q.expectedTask})]}),(0,x.jsxs)(`div`,{className:`mt-5 flex flex-wrap gap-2`,children:[(0,x.jsx)(l,{className:`h-10 bg-accent px-4 text-white hover:bg-accent-hover`,onClick:()=>void X(Q,!1),children:v.startRecommendedAction}),(0,x.jsx)(l,{className:`h-10 px-4`,variant:`secondary`,onClick:()=>void X(Q,!0),children:v.explainFirst})]})]})]})}),Ge.length>0?(0,x.jsxs)(`div`,{className:`mt-5 border-t border-edge-subtle pt-4`,children:[(0,x.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:()=>L(e=>!e),children:[v.otherDirections,(0,x.jsx)(ue,{className:`size-4 transition-transform ${I?`rotate-180`:``}`})]}),I?(0,x.jsx)(`div`,{className:`mt-2 divide-y divide-edge-subtle rounded-xl border border-edge bg-surface-panel px-4`,children:Ge.map(e=>(0,x.jsxs)(`button`,{type:`button`,className:`flex w-full items-start gap-3 py-4 text-left`,onClick:()=>void X(e,!0),children:[(0,x.jsx)(f,{className:`mt-0.5 size-4 shrink-0 text-fg-subtle`}),(0,x.jsxs)(`span`,{children:[(0,x.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.title}),(0,x.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:e.expectedTask})]})]},e.id))}):null]}):null,(0,x.jsxs)(`div`,{className:`mt-6 flex flex-wrap items-center justify-center gap-x-5 gap-y-3`,children:[(0,x.jsx)(`button`,{type:`button`,className:`text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>Y(D.sessionKey),children:v.doSomethingElse}),(0,x.jsx)(`button`,{type:`button`,className:`text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>{N(!0),T(`recognition`)},children:v.correctUnderstanding})]})]}):null,w===`error`&&D?(0,x.jsxs)(`section`,{className:`text-center`,"aria-labelledby":`work-discovery-error-title`,children:[(0,x.jsx)(`div`,{className:`mx-auto flex size-11 items-center justify-center rounded-xl bg-danger-soft text-danger`,children:(0,x.jsx)(c,{className:`size-5`})}),(0,x.jsx)(`h1`,{id:`work-discovery-error-title`,className:`mt-5 text-2xl font-semibold tracking-tight text-fg`,children:v.errorTitle}),(0,x.jsx)(`p`,{className:`mx-auto mt-3 max-w-lg text-sm leading-6 text-fg-muted`,children:D.errorMessage}),(0,x.jsxs)(`div`,{className:`mx-auto mt-7 flex max-w-md flex-col gap-3 sm:flex-row-reverse`,children:[(0,x.jsx)(l,{className:`h-11 flex-1 bg-accent text-white hover:bg-accent-hover`,onClick:()=>void me(D.id).then(q),children:v.retry}),(0,x.jsx)(l,{variant:`secondary`,className:`h-11 flex-1`,onClick:()=>{O(null),Ce(null),T(`intro`)},children:v.chooseDifferent})]}),(0,x.jsx)(`button`,{type:`button`,className:`mt-6 text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>Y(D.sessionKey),children:v.openConversation})]}):null]}),J.hasNativePicker?null:(0,x.jsx)(ee,{open:J.modalOpen,onOpenChange:J.setModalOpen,initialAbsolutePath:E?.canonicalRootPath,onConfirm:J.confirmPick,wd:y})]})}export{xe as WorkDiscoveryPage};