@xopcai/xopc 0.0.294 → 0.0.295
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser-ext/dist/assets/{auth-C8gJZEsn.js → auth-B_9ZuGDx.js} +2 -1
- package/dist/browser-ext/dist/background.js +1 -1
- package/dist/browser-ext/dist/sidepanel.html +1 -1
- package/dist/browser-ext/dist/sidepanel.js +1 -1
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-BDWrNpJe.js → agent-avatar-dicebear-CdaEBfdU.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-ESRFnt6Y.js → agent-defaults-settings-panel-CVunPl7p.js} +1 -1
- package/dist/gateway/static/root/assets/{agents-aTs3RFJB.js → agents-DessO-kK.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-CCS9KbKd.js → app-management-settings-panel-BeucVbqM.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-CuRyhUns.js → appearance-settings-D9QdN7OM.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-DAhcVKc4.js → apps-page-CbawVYBT.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-Xj6tLKD2.js → archive-plugin-fRMLP9dL.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-CSMv3wDB.js → attachment-load-DVYW2whr.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-4Njbwe26.js → automations-page-iS1Wmdlc.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-workspace-CZboHws3.js → automations-workspace-ClZiIDCC.js} +1 -1
- package/dist/gateway/static/root/assets/{binary-plugins-ohh8JiqX.js → binary-plugins-Bj3KFtIt.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-ps5gfiDX.js → block-editor-BLs4IKoH.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-DEeymLbJ.js → browser-automations-page-BntIB4a1.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-settings-page-BkGCUKLR.js → browser-settings-page-BMd_-Dq1.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-settings-panel-Bik37Ina.js → capabilities-settings-panel-Cpb0KBZc.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-settings-B6O7oGmA.js → channels-settings-DoRAjGiN.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-terminal-dock-Bx56s8Ju.js → chat-terminal-dock-DH36RVtb.js} +1 -1
- package/dist/gateway/static/root/assets/{computer-model-settings-DdkdFWic.js → computer-model-settings-CH8z1kz0.js} +1 -1
- package/dist/gateway/static/root/assets/{computer-settings-page-_jWKNIO2.js → computer-settings-page-D8oeOhou.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-h2IMptiJ.js → connectors-page-BpEEyOGa.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-B_w38QJJ.js → date-picker-BEZDMNzZ.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-DG-5rqI3.js → dependency-picker-DC8V8-Zp.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-daUwTaBB.js → desktop-pet-CJloB255.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-wVbuFzeN.js → desktop-pet-settings-B97XYYYn.js} +1 -1
- package/dist/gateway/static/root/assets/{device-pairing-wizard-e8NSnXSQ.js → device-pairing-wizard-Cci5K_bT.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-DVQCsGO7.js → extension-debug-page-BTrK__r7.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-BZd649fz.js → extension-page-DgvpFyGJ.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-CW_qtR_s.js → extension-settings-page-DjfuFesA.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-zazNZgv6.js → gateway-settings-BsbofCP6.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-DuRKe_y9.js → heartbeat-settings-BXxtbvha.js} +1 -1
- package/dist/gateway/static/root/assets/{home-page-BzIm3rF9.js → home-page-DErKqiEK.js} +1 -1
- package/dist/gateway/static/root/assets/{index-DTDDJnrO.js → index-CEkw-fGy.js} +8 -8
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-DEGJsaAS.js → keyboard-shortcuts-settings-B7E6CgtA.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-ylC0zfxp.js → local-app-workbench-page-CQsTUpog.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-BupSkP0s.js → local-apps-page-C10gURTO.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-CbbEPEH6.js → logs-page-Dg9Ma1sl.js} +1 -1
- package/dist/gateway/static/root/assets/{management-settings-uzNsZK9S.js → management-settings-Bx1sNion.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-Brz0R-XW.js → media-plugins-BNoJCDvT.js} +1 -1
- package/dist/gateway/static/root/assets/{note-detail-panel-Dja38ec0.js → note-detail-panel-Bsiuk-2U.js} +3 -3
- package/dist/gateway/static/root/assets/{notes-page-DZV1zODX.js → notes-page-BvAj-wx0.js} +1 -1
- package/dist/gateway/static/root/assets/{page-tabs-B5aqgPVw.js → page-tabs-B604dteb.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-C36n0h3j.js → preview-open-alternatives-Cp8vT7M-.js} +1 -1
- package/dist/gateway/static/root/assets/{proactive-page-Bf3fTLFK.js → proactive-page-afUn4Km7.js} +1 -1
- package/dist/gateway/static/root/assets/{project-detail-page-h8R5De4L.js → project-detail-page-D6DLiVAL.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-C4yWYB8l.js → projects-page-Cq9hR-e_.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-C0_N6lUv.js → remote-access-hub-rAPyndf3.js} +1 -1
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-DQrAOOoG.js → runtime-tools-settings-panel-B5EkdFYg.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-CAmYD83K.js → schema-form-BGMXczAd.js} +1 -1
- package/dist/gateway/static/root/assets/{sessions-page-BdzwFjok.js → sessions-page-DwLbo0cX.js} +1 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-XmB-Qb44.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-nZ0L21U5.js → settings-form-section-Dzhqip3r.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-x7y6VkFZ.js → settings-page-DduNxMxn.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-C65mJ7Xd.js → setup-status-panel-ClmdhFhE.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-B3OpivMd.js → share-preview-page-CpreOM1V.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-vClF3hGb.js → shares-settings-CHkRyFET.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-reload-api-sAwxVw0W.js → skill-reload-api-DWVyUbv4.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page-BqQln5BZ.js → skills-page-ClFiDnDu.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page.utils-gVo88ldk.js → skills-page.utils-BR4q22o3.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-DJahgDjR.js → system-settings-panel-BaXq-D5z.js} +1 -1
- package/dist/gateway/static/root/assets/{task-detail-page-BXhn4MVL.js → task-detail-page-CJnZCq6v.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-BvxsNjfv.js → tunnel-api-Dl9H37se.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-Bsv3gvqK.js → use-autosave-CTEqUAxS.js} +1 -1
- package/dist/gateway/static/root/assets/{user-model-page-CCVN7AYB.js → user-model-page-DOA5rAgd.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-api-key-field-BHtJeKg9.js → voice-api-key-field-CVCnJKQC.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-4WxTZ3b5.js → work-discovery-overlay-C8pcp5_j.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-DdnSUVxc.js → workflow-run-setup-panel-CvayjHzR.js} +1 -1
- package/dist/gateway/static/root/assets/{workflows-page-Dw6PIPAz.js → workflows-page-D7pBtuZt.js} +1 -1
- package/dist/gateway/static/root/index.html +1 -1
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/device-pairing.js +9 -7
- package/dist/packages/gateway-contract/src/sessions.js +1 -0
- package/dist/src/agent/tool-manuals/computer.d.ts +1 -1
- package/dist/src/agent/tool-manuals/computer.js +1 -1
- package/dist/src/agent/tools/computer-use-tool.js +24 -14
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/computer/errors.d.ts +8 -0
- package/dist/src/computer/errors.js +10 -0
- package/dist/src/computer/model-adapter.d.ts +5 -0
- package/dist/src/computer/model-adapter.js +69 -22
- package/dist/src/computer/runtime.d.ts +14 -0
- package/dist/src/computer/runtime.js +4 -3
- package/dist/src/computer/task-state.d.ts +5 -1
- package/dist/src/computer/task-state.js +26 -11
- package/dist/src/gateway/heartbeat/service.js +2 -2
- package/dist/src/gateway/hono/routes/device-push.js +11 -1
- package/dist/src/gateway/hono/routes/notes.js +1 -1
- package/dist/src/gateway/hono/routes/voice.js +1 -1
- package/dist/src/gateway/hono/routes/workflows.js +1 -1
- package/dist/src/heartbeat/index.js +1 -1
- package/dist/src/notes/types.d.ts +1 -1
- package/dist/src/notifications/device-store.js +1 -1
- package/dist/src/notifications/harmony-push.d.ts +26 -0
- package/dist/src/notifications/harmony-push.js +94 -0
- package/dist/src/notifications/service.d.ts +2 -0
- package/dist/src/notifications/service.js +15 -1
- package/dist/src/notifications/store.d.ts +2 -0
- package/dist/src/notifications/store.js +2 -1
- package/dist/src/notifications/types.d.ts +1 -1
- package/dist/src/storage/sqlite/device-access-repository.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/179_harmonyos_devices.sql +41 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +13 -5
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/package.json +5 -3
- package/dist/gateway/static/root/assets/settings-advanced-gate-BjgGCe3d.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,i as n,n as r,t as i}from"./vendor-react-BOUWij0V.js";import{d as a,h as o,p as s,t as c}from"./chunk-KS7C4IRE-Cq1tE_3b.js";import{n as l,r as u}from"./popover-select-DldSX8GX.js";import{t as d}from"./circle-check-C23XjkUj.js";import{t as f}from"./external-link-DjqjBmc3.js";import{d as p,p as m,t as h}from"./markdown-view-BIg7cei7.js";import{t as g}from"./message-square-fVE7Ghj1.js";import{t as _}from"./x-B_N4OPjy.js";import{t as v}from"./cn-JdwAhgNB.js";import{c as ee,n as te}from"./locale-store-eliqUnBr.js";import{i as ne,n as re,o as ie,r as ae,s as oe,t as se}from"./dist-BGTk37IG.js";import{t as y}from"./button-CGlRPNzi.js";import{t as b}from"./activity-store-6lmzUBEr.js";import{t as x}from"./skeleton-BwbyijEw.js";import{$l as S,An as ce,Ci as C,Dn as le,En as ue,Fs as de,Hl as fe,Hu as pe,Is as me,Lc as w,Ls as he,Ms as T,Na as E,Oi as D,On as ge,Os as O,P as k,Ps as A,Ss as j,Uc as M,Ul as N,Vr as P,Vs as F,Vt as _e,Zi as ve,hi as I,ho as ye,hu as be,jn as xe,js as Se,kn as Ce,la as we,mi as Te,mu as Ee,n as De,or as Oe,ql as ke,ws as Ae,xs as je,ys as Me}from"./index-DTDDJnrO.js";import{t as L}from"./date-picker-B_w38QJJ.js";import{t as R}from"./dependency-picker-DG-5rqI3.js";var z=r(),B=e(t(),1),V=i();function Ne({wait:e,detail:t,zh:n,onUpdated:r}){let[i,a]=(0,B.useState)(``),[o,s]=(0,B.useState)(!1),[c,l]=(0,B.useState)(``),[u,d]=(0,B.useState)(!1),f=(0,B.useRef)(null),p=e.kind===`approval`,m=Array.isArray(e.condition.choices)?e.condition.choices.filter(e=>typeof e==`string`):[];async function h(a){if(!p&&!i.trim()||p&&!a||o)return;let c=JSON.stringify([t.task.version,i.trim(),a]);f.current?.signature!==c&&(f.current={signature:c,key:crypto.randomUUID()}),s(!0),l(``);try{let o=await j(t.task.id,{type:`resolve_wait`,waitId:e.id,resolution:p?{kind:`task_approval`,decision:a}:{kind:`user_answer`,answer:i.trim()}},t.task.version,f.current.key);d(!0),r(o),b({tone:`success`,title:p?n?`决定已保存`:`Decision saved`:n?`补充信息已保存`:`Answer saved`,message:o.waits.length?n?`仍有其他等待条件,任务尚未恢复执行。`:`Other waiting conditions remain.`:n?`等待已解除,请在任务状态中查看后续执行进展。`:`The wait is resolved. Follow progress in the task status.`,source:n?`任务`:`Task`})}catch{l(n?`提交未确认,内容已保留。可重试;若问题已变化,请刷新。`:`Submission not confirmed. Your answer is saved here; retry or refresh if the question changed.`)}finally{s(!1)}}return(0,V.jsxs)(`form`,{className:`mt-3 space-y-3 rounded-lg border border-edge p-3`,onSubmit:e=>{e.preventDefault(),h()},children:[p?(0,V.jsxs)(`div`,{className:`text-sm text-fg`,children:[(0,V.jsx)(`p`,{children:e.reason}),(0,V.jsxs)(`p`,{className:`mt-2`,children:[n?`授权范围:`:`Permission: `,String(e.condition.capability)]}),(0,V.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[(0,V.jsx)(y,{type:`button`,variant:`primary`,disabled:o||u,onClick:()=>void h(`approve`),children:n?`批准`:`Approve`}),(0,V.jsx)(y,{type:`button`,disabled:o||u,onClick:()=>void h(`deny`),children:n?`拒绝并暂停`:`Deny and pause`})]})]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`label`,{className:`block text-sm text-fg`,children:[typeof e.condition.question==`string`?e.condition.question:e.reason,(0,V.jsx)(`textarea`,{className:`mt-2 w-full rounded-lg border border-edge bg-surface-panel p-3`,rows:3,maxLength:12e3,value:i,disabled:o||u,onChange:e=>a(e.target.value)})]}),m.length>0&&(0,V.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:m.map(e=>(0,V.jsx)(y,{type:`button`,disabled:o||u,variant:`secondary`,"aria-pressed":i===e,onClick:()=>a(e),children:e},e))}),(0,V.jsx)(y,{type:`submit`,variant:`primary`,disabled:o||u||!i.trim(),children:o?n?`正在提交`:`Submitting`:n?`提交补充信息`:`Submit answer`})]}),(0,V.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`保存到任务上下文;其他等待条件满足后继续执行。`:`Saved to task context. Work continues once all waiting conditions are met.`}),c&&(0,V.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:c})]})}var Pe=e(n(),1);function Fe(e,t){let n;try{n=new URL(e)}catch{return}return t.find(e=>[e.shareUrl,e.lanUrl].some(e=>{if(!e)return!1;try{let t=new URL(e);return t.origin===n.origin&&t.pathname.replace(/\/$/,``)===n.pathname.replace(/\/$/,``)}catch{return!1}}))}function Ie({uri:e,zh:t}){let[n,r]=(0,B.useState)(),[i,a]=(0,B.useState)(!1),[o,s]=(0,B.useState)(!1),[l,u]=(0,B.useState)(``),[d,f]=(0,B.useState)(``);async function p(){a(!0),u(``);try{let n=Fe(e,(await D()).payload.shares);r(n),s(!0),n?n.kind!==`file`&&n.kind!==`directory`?u(t?`这是文档快照,请从原笔记或对话的分享面板重新发布。`:`This is a document snapshot. Republish it from the original note or conversation.`):n.revoked?u(t?`分享已被撤销,不能自动恢复。请从原任务重新生成并分享。`:`This share was revoked. Generate and share a new artifact from the task.`):n.maxViews!==null&&n.downloadCount>=n.maxViews?u(t?`已达到访问次数上限,请在分享设置中调整后重试。`:`The access limit was reached. Adjust it in share settings.`):n.expired||(f(n.shareUrl),u(t?`链接仍在有效期内;若打不开,请检查网关连接。`:`The link has not expired. If it cannot open, check gateway connectivity.`)):u(t?`未找到本机管理的分享记录。外部链接或已清理的记录无法在这里续期,请从原任务重新生成产物。`:`No locally managed share matches this link. Regenerate the artifact from its task.`)}catch{u(t?`检查失败,请重试。`:`Check failed. Please retry.`)}finally{a(!1)}}async function m(){if(!(!n||i)){a(!0),u(``);try{let e=await C(n.id,864e5);f(e.payload.shareUrl),r({...n,expired:!1,expiresAt:e.payload.expiresAt}),u(t?`已续期 24 小时,访问范围与次数限制保持不变。`:`Renewed for 24 hours. Access scope and view limits are unchanged.`)}catch(e){u(`${t?`恢复失败:`:`Recovery failed: `}${e instanceof Error?e.message:String(e)}`)}finally{a(!1)}}}return(0,V.jsxs)(`details`,{className:`mt-2 text-xs text-fg-muted`,children:[(0,V.jsx)(`summary`,{className:`cursor-pointer py-2`,children:t?`链接打不开?`:`Trouble opening the link?`}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(y,{type:`button`,variant:`ghost`,disabled:i,onClick:()=>void p(),children:t?`检查链接状态`:`Check link`}),o&&n?.expired&&(n.kind===`file`||n.kind===`directory`)&&!n.revoked&&(n.maxViews===null||n.downloadCount<n.maxViews)&&(0,V.jsx)(y,{type:`button`,disabled:i,onClick:()=>void m(),children:t?`恢复链接 · 续期 24 小时`:`Restore link for 24 hours`}),l&&(0,V.jsx)(`p`,{role:`status`,className:`break-words leading-5`,children:l}),d&&(0,V.jsx)(`a`,{className:`block py-2 text-accent`,href:d,target:`_blank`,rel:`noopener noreferrer`,children:t?`打开产物`:`Open artifact`}),o&&(0,V.jsx)(c,{className:`block py-2 text-accent`,to:`/settings/shares`,children:t?`管理分享记录`:`Manage shares`})]})]})}function Le(e){let t=(0,z.c)(14),{evidence:n,projectId:r,conversationId:i,language:a}=e,o=Te(Re);if(!n.length)return null;let s=a===`zh`?`交付物与验证依据`:`Deliverables and evidence`,c;if(t[0]!==i||t[1]!==n||t[2]!==a||t[3]!==r||t[4]!==o){let e;t[6]!==i||t[7]!==a||t[8]!==r||t[9]!==o?(e=(e,t)=>{let n=e.uri?.trim(),s=n&&/^https?:\/\//i.test(n),c=n&&!s&&e.kind===`artifact`&&!/^[a-z][a-z0-9+.-]*:/i.test(n)&&!n.startsWith(`//`),l=e.title||(a===`zh`?`查看产物`:`Open artifact`);return(0,V.jsxs)(`div`,{className:`min-w-0 rounded-lg border border-edge-subtle p-3`,children:[s?(0,V.jsxs)(`a`,{className:`inline-flex min-h-11 items-center gap-2 text-sm font-medium text-accent hover:underline`,href:n,target:`_blank`,rel:`noopener noreferrer`,children:[(0,V.jsx)(f,{className:`size-4 shrink-0`}),l]}):c&&(r||i)?(0,V.jsxs)(`button`,{type:`button`,className:`inline-flex min-h-11 items-center gap-2 text-sm font-medium text-accent hover:underline`,onClick:()=>o(n,null,r,i),children:[(0,V.jsx)(ke,{className:`size-4 shrink-0`}),l]}):(0,V.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:l}),s&&e.kind===`artifact`&&(0,V.jsx)(Ie,{uri:n,zh:a===`zh`},n),e.summary?(0,V.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:e.summary}):null,(0,V.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:e.strength===`verified`?a===`zh`?`已验证`:`Verified`:a===`zh`?`已记录,待验证`:`Observed, not verified`})]},`${e.title}-${t}`)},t[6]=i,t[7]=a,t[8]=r,t[9]=o,t[10]=e):e=t[10],c=n.map(e),t[0]=i,t[1]=n,t[2]=a,t[3]=r,t[4]=o,t[5]=c}else c=t[5];let l;return t[11]!==s||t[12]!==c?(l=(0,V.jsx)(`div`,{className:`mt-4 grid gap-2 sm:grid-cols-2`,"aria-label":s,children:c}),t[11]=s,t[12]=c,t[13]=l):l=t[13],l}function Re(e){return e.setPath}function ze(e,t,n,r){return!!(e&&t!==e.version&&n!==e.value&&r!==n)}function Be(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}}function Ve(e,t){return(t===`zh`?{backlog:`待规划`,ready:`就绪`,active:`进行中`,review:`待验收`,closed:`已完成`}:{backlog:`Backlog`,ready:`Ready`,active:`Active`,review:`Review`,closed:`Completed`})[e]}function He(){let e=(0,z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,V.jsxs)(`div`,{className:`space-y-4`,"aria-busy":!0,children:[(0,V.jsx)(x,{className:`h-32 rounded-2xl`}),(0,V.jsx)(x,{className:`h-52 rounded-2xl`}),(0,V.jsx)(x,{className:`h-40 rounded-2xl`})]}),e[0]=t):t=e[0],t}function Ue(e){if(e===void 0)return``;let t=new Date(e);return new Date(t.getTime()-t.getTimezoneOffset()*6e4).toISOString().slice(0,10)}function We(e){return e?new Date(`${e}T23:59:59.999`).getTime():null}var Ge=[`backlog`,`ready`,`active`,`review`,`closed`],Ke=[`low`,`normal`,`high`,`critical`],qe=(0,B.memo)(function(e){let t=(0,z.c)(20),{value:n,disabled:r,canMove:i,canApprove:a,canReopen:o,language:s,label:c,onChange:d}=e,f;t[0]!==a||t[1]!==i||t[2]!==o||t[3]!==n?(f=e=>e!==n&&(e===`closed`?!a:n===`closed`?!o:!i),t[0]=a,t[1]=i,t[2]=o,t[3]=n,t[4]=f):f=t[4];let p=f,m;t[5]===c?m=t[6]:(m=(0,V.jsx)(`span`,{children:c}),t[5]=c,t[6]=m);let h;t[7]===d?h=t[8]:(h=e=>d(e.target.value),t[7]=d,t[8]=h);let g;t[9]!==s||t[10]!==p?(g=Ge.map(e=>(0,V.jsx)(u,{value:e,disabled:p(e),children:Ve(e,s)},e)),t[9]=s,t[10]=p,t[11]=g):g=t[11];let _;t[12]!==r||t[13]!==h||t[14]!==g||t[15]!==n?(_=(0,V.jsx)(l,{triggerClassName:`border-0 bg-surface-hover shadow-none focus-visible:ring-2 focus-visible:ring-accent/30`,contentClassName:`border-0`,value:n,disabled:r,onChange:h,children:g}),t[12]=r,t[13]=h,t[14]=g,t[15]=n,t[16]=_):_=t[16];let v;return t[17]!==m||t[18]!==_?(v=(0,V.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[m,_]}),t[17]=m,t[18]=_,t[19]=v):v=t[19],v}),Je=(0,B.memo)(function(e){let t=(0,z.c)(14),{value:n,disabled:r,label:i,labels:a,onChange:o}=e,s;t[0]===i?s=t[1]:(s=(0,V.jsx)(`span`,{children:i}),t[0]=i,t[1]=s);let c;t[2]===o?c=t[3]:(c=e=>o(e.target.value),t[2]=o,t[3]=c);let d;t[4]===a?d=t[5]:(d=Ke.map(e=>(0,V.jsx)(u,{value:e,children:a[e]},e)),t[4]=a,t[5]=d);let f;t[6]!==r||t[7]!==c||t[8]!==d||t[9]!==n?(f=(0,V.jsx)(l,{triggerClassName:`border-0 bg-surface-hover shadow-none focus-visible:ring-2 focus-visible:ring-accent/30`,contentClassName:`border-0`,value:n,disabled:r,onChange:c,children:d}),t[6]=r,t[7]=c,t[8]=d,t[9]=n,t[10]=f):f=t[10];let p;return t[11]!==s||t[12]!==f?(p=(0,V.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[s,f]}),t[11]=s,t[12]=f,t[13]=p):p=t[13],p}),Ye=(0,B.memo)(function(e){let t=(0,z.c)(10),{value:n,disabled:r,label:i,onChange:a}=e,o;t[0]===i?o=t[1]:(o=(0,V.jsx)(`span`,{children:i}),t[0]=i,t[1]=o);let s;t[2]!==r||t[3]!==i||t[4]!==a||t[5]!==n?(s=(0,V.jsx)(L,{disabled:r,value:n,onChange:a,ariaLabel:i}),t[2]=r,t[3]=i,t[4]=a,t[5]=n,t[6]=s):s=t[6];let c;return t[7]!==o||t[8]!==s?(c=(0,V.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[o,s]}),t[7]=o,t[8]=s,t[9]=c):c=t[9],c}),Xe=(0,B.memo)(function(e){let t=(0,z.c)(17),{value:n,disabled:r,label:i,unassignedLabel:a,agents:o,onChange:s}=e,c;t[0]===i?c=t[1]:(c=(0,V.jsx)(`span`,{children:i}),t[0]=i,t[1]=c);let d;t[2]===s?d=t[3]:(d=e=>s(e.target.value),t[2]=s,t[3]=d);let f;t[4]===a?f=t[5]:(f=(0,V.jsx)(u,{value:``,disabled:!0,children:a}),t[4]=a,t[5]=f);let p;t[6]===o?p=t[7]:(p=o.map(mt),t[6]=o,t[7]=p);let m;t[8]!==r||t[9]!==d||t[10]!==f||t[11]!==p||t[12]!==n?(m=(0,V.jsxs)(l,{triggerClassName:`border-0 bg-surface-hover shadow-none focus-visible:ring-2 focus-visible:ring-accent/30`,contentClassName:`border-0`,value:n,disabled:r,onChange:d,children:[f,p]}),t[8]=r,t[9]=d,t[10]=f,t[11]=p,t[12]=n,t[13]=m):m=t[13];let h;return t[14]!==c||t[15]!==m?(h=(0,V.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[c,m]}),t[14]=c,t[15]=m,t[16]=h):h=t[16],h}),Ze=(0,B.memo)(function(e){let t=(0,z.c)(9),{candidates:n,selected:r,disabled:i,labels:a,getTaskHref:o,onChange:s}=e,c;t[0]===r?c=t[1]:(c=r.map(ht),t[0]=r,t[1]=c);let l;return t[2]!==n||t[3]!==i||t[4]!==o||t[5]!==a||t[6]!==s||t[7]!==c?(l=(0,V.jsx)(R,{borderless:!0,candidates:n,selectedIds:c,disabled:i,getTaskHref:o,onChange:s,labels:a}),t[2]=n,t[3]=i,t[4]=o,t[5]=a,t[6]=s,t[7]=c,t[8]=l):l=t[8],l},(e,t)=>e.disabled===t.disabled&&e.labels===t.labels&&e.getTaskHref===t.getTaskHref&&e.onChange===t.onChange&&e.candidates.length===t.candidates.length&&e.candidates.every((e,n)=>e.id===t.candidates[n]?.id&&e.title===t.candidates[n]?.title)&&e.selected.length===t.selected.length&&e.selected.every((e,n)=>e.id===t.selected[n]?.id&&e.title===t.selected[n]?.title)),Qe=`xopc.taskDetail.chatPanelPercent`,$e=42;function et(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?$e:Math.min(r,Math.max(n,e))}function tt(){try{let e=Number(window.localStorage.getItem(Qe));return Number.isFinite(e)&&e>=30&&e<=60?e:$e}catch{return $e}}function nt(e){return e.task.phase===`closed`?e.task.resolution===`done`?`completed`:`ended`:e.waits.some(e=>e.kind===`paused`)?`paused`: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`:`ready`:e.operationalState}function rt(e){return e===`needsUser`||e===`blocked`?`bg-warning/10 text-warning`:e===`completed`?`bg-success-soft text-success`:e===`running`||e===`verifying`||e===`review`?`bg-accent-soft text-accent-fg`:`bg-surface-hover text-fg-muted`}function H(e){let t=(0,z.c)(9),{items:n,empty:r,verificationByCriterion:i}=e;if(n.length===0){let e;return t[0]===r?e=t[1]:(e=(0,V.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:r}),t[0]=r,t[1]=e),e}let a;if(t[2]!==n||t[3]!==i){let e;t[5]===i?e=t[6]:(e=e=>{let t=i?.get(e)??`unverified`;return(0,V.jsxs)(`li`,{className:`flex gap-2 text-sm leading-6 text-fg`,children:[(0,V.jsx)(t===`passed`?d:t===`failed`?be:Ee,{className:t===`passed`?`mt-1 size-4 shrink-0 text-success`:t===`failed`?`mt-1 size-4 shrink-0 text-danger`:`mt-1 size-4 shrink-0 text-fg-subtle`}),(0,V.jsx)(`span`,{children:e})]},e)},t[5]=i,t[6]=e),a=n.map(e),t[2]=n,t[3]=i,t[4]=a}else a=t[4];let o;return t[7]===a?o=t[8]:(o=(0,V.jsx)(`ul`,{className:`space-y-2`,children:a}),t[7]=a,t[8]=o),o}function it({taskId:e,presentation:t,backgroundPath:n,onDeleted:r}){let[i]=o(),s=a(),l=te(e=>e.language),u=ee(e=>e.conversationId),_=(0,B.useMemo)(()=>he(l),[l]),ne=ye(e=>e.setPageHeader),re=ye(e=>e.clearPageHeader),ie=I(e=>e.open),ae=I(e=>e.conversationIdOverride),oe=I(e=>e.openForSession),se=Oe(e=>e.setOpen),{data:b,error:x,mutate:C,lastChange:D,conversationLoading:_e,conversationError:be}=Me(e),[Te,Ee]=(0,B.useState)(null),[ke,L]=(0,B.useState)(null),[R,z]=(0,B.useState)(()=>new Set),[Fe,Ie]=(0,B.useState)([]),[Re,Ve]=(0,B.useState)(null),[Ge,Ke]=(0,B.useState)([]),[it,U]=(0,B.useState)(!1),[at,ot]=(0,B.useState)(``),[st,W]=(0,B.useState)(!1),[ct,lt]=(0,B.useState)(``),[G,ut]=(0,B.useState)(tt),[dt,ft]=(0,B.useState)(!1),pt=(0,B.useRef)(null),mt=(0,B.useRef)(!1),ht=(0,B.useRef)(!1),gt=(0,B.useRef)(``),_t=(0,B.useRef)(null),vt=(0,B.useRef)(null),yt=(0,B.useRef)(null),bt=(0,B.useRef)(b),[xt,K]=(0,B.useState)(null),[St,Ct]=(0,B.useState)(null),[wt,Tt]=(0,B.useState)(!1),Et=(0,B.useMemo)(()=>({link:_.linkDependencies,linked:_.linkedDependencies,searchPlaceholder:_.dependencySearchPlaceholder,noMatches:_.noDependencyMatches,noCandidates:_.noDependencyCandidates,remove:_.removeDependency}),[_.dependencySearchPlaceholder,_.linkDependencies,_.linkedDependencies,_.noDependencyCandidates,_.noDependencyMatches,_.removeDependency]),Dt=b?.dependencies.map(e=>`${e.id}:${e.title}`).join(`\0`)??``,Ot=(0,B.useMemo)(()=>p(i.get(`returnTo`),`/`,[`/projects`,`/chat`,`/notes`,`/tasks`]),[i]),kt=(0,B.useCallback)(e=>t===`modal`&&n?me(n,e):m(`/tasks/${encodeURIComponent(e)}`,Ot),[n,t,Ot]);bt.current=b;let q=(0,B.useCallback)((e,t)=>{z(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r})},[]);(0,B.useEffect)(()=>{L(null),K(null),U(!1),W(!1),Ct(null),Tt(!1)},[e]),(0,B.useEffect)(()=>{let e=!0;return we().then(t=>{e&&Ke(t.items)}).catch(()=>void 0),()=>{e=!1}},[u]),(0,B.useEffect)(()=>{if(!D||D.source===`user`)return;Ct(D);let e=window.setTimeout(()=>Ct(null),3500);return()=>window.clearTimeout(e)},[D]),(0,B.useEffect)(()=>{let t=b?.task.projectId,n=b?.dependencies??[];if(!t){yt.current=null,Ve(null),Ie(n);return}yt.current!==t&&(yt.current=t,Ve(null));let r=!0;return E(t).then(t=>{if(!r)return;Ve(t.project.name);let i=new Map;for(let r of[...t.tasks,...n])r.id!==e&&i.set(r.id,{id:r.id,title:r.title});Ie([...i.values()])}).catch(()=>{r&&Ie(n)}),()=>{r=!1}},[Dt,b?.task.projectId,e]);let J=(0,B.useCallback)(async(t,n=`command`)=>{let r=bt.current;if(r){q(n,!0),L(null);try{await C(await j(e,t,r.task.version),{revalidate:!1})}catch{L(_.actionFailed)}finally{q(n,!1)}}},[_.actionFailed,C,q,e]),Y=(0,B.useCallback)(async(t,n)=>{let r=bt.current;if(!r)return!1;n&&q(n,!0),L(null);try{return await C(T(e,t,r.task.version),{optimisticData:Be(r,t),populateCache:!0,revalidate:!1,rollbackOnError:!0}),!0}catch{return L(_.actionFailed),!1}finally{n&&q(n,!1)}},[_.actionFailed,C,q,e]),At=async()=>{if(!b)return;if(mt.current){mt.current=!1;return}let e=at.trim(),t=_t.current;if(ze(t,b.task.version,b.task.title,e)){K(`title`);return}if(!e||e===b.task.title){ot(b.task.title),U(!1);return}await Y({title:e})&&(K(null),U(!1))},jt=async()=>{if(!b)return;if(ht.current){ht.current=!1;return}let e=ct.trim(),t=vt.current;if(ze(t,b.task.version,b.task.body??``,e)){K(`description`);return}if(ct===gt.current||e===(b.task.body??``).trim()){W(!1);return}await Y({body:e||null})&&(K(null),W(!1))},Mt=(0,B.useCallback)(async e=>{let t=bt.current;if(!(!t||e===t.task.phase)){if(t.task.phase===`closed`){await J({type:`reopen`,phase:e===`closed`?`ready`:e},`phase`);return}if(e===`closed`){await J({type:`close`,resolution:`done`},`phase`);return}await J({type:`move`,phase:e},`phase`)}},[J]),Nt=(0,B.useCallback)(e=>{Y({priority:e},`priority`)},[Y]),Pt=(0,B.useCallback)(e=>{Y({dueAt:We(e)},`dueAt`)},[Y]),Ft=(0,B.useCallback)(e=>{ut(e);try{window.localStorage.setItem(Qe,String(e))}catch{}},[]),It=(0,B.useCallback)(e=>{if(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`&&e.key!==`Home`)return;e.preventDefault();let t=pt.current?.clientWidth??0;Ft(et(e.key===`Home`?$e:G+(e.key===`ArrowLeft`?2:-2),t))},[G,Ft]),Lt=(0,B.useCallback)(e=>{if(!window.matchMedia(`(min-width: 1024px)`).matches)return;let t=pt.current;if(!t)return;e.preventDefault();let n=e.currentTarget,r=e.pointerId;n.setPointerCapture(r),ft(!0);let i=G,a=0,o=()=>{a=0,t.style.setProperty(`--task-chat-panel-width`,`${i}%`)},s=e=>{let n=t.getBoundingClientRect();i=et((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{}ft(!1),Ft(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,Ft]),Rt=(0,B.useCallback)(async t=>{let n=bt.current;if(n){q(`dependencies`,!0),L(null);try{await C(await A(e,t,n.task.version),{revalidate:!1})}catch{L(_.dependencyUpdateFailed)}finally{q(`dependencies`,!1)}}},[_.dependencyUpdateFailed,C,q,e]),zt=(0,B.useCallback)(async t=>{let n=bt.current;if(!(!n||!t||t===n.conversation.currentExecutorAgentId)){q(`delegateAgentId`,!0),L(null);try{await C(await O(e,t,n.task.version),{revalidate:!1})}catch{L(_.actionFailed)}finally{q(`delegateAgentId`,!1)}}},[_.actionFailed,C,q,e]),Bt=(0,B.useCallback)(async()=>{q(`delete`,!0),L(null);try{await Ae(e),r?r():s(Ot,{replace:!0})}catch(e){L(e instanceof Error?e.message:_.actionFailed)}finally{q(`delete`,!1)}},[_.actionFailed,s,r,Ot,q,e]);if((0,B.useLayoutEffect)(()=>{if(t!==`modal`)return ne({startExtra:(0,V.jsx)(c,{to:Ot,className:`flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover`,"aria-label":_.backToWork,children:(0,V.jsx)(pe,{className:`size-4`})}),main:b?(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`p`,{className:`truncate text-sm font-semibold text-fg`,children:Re?`${Re} / ${_.taskLabel}`:_.taskLabel}),(0,V.jsx)(`p`,{className:`text-xs text-fg-muted`,children:_.detailStatuses[nt(b)]})]}):null,end:(0,V.jsx)(`div`,{ref:Ee,className:`flex min-w-0 items-center justify-end`})}),re},[re,_.backToWork,_.detailStatuses,_.taskLabel,b,t,Re,Ot,ne]),x&&!b)return(0,V.jsx)(`div`,{className:t===`modal`?`p-5 text-sm text-danger`:`mx-auto max-w-3xl p-6 text-sm text-danger`,children:_.taskNotFound});if(!b)return(0,V.jsx)(`div`,{className:t===`modal`?`p-5`:`mx-auto max-w-4xl p-4 sm:p-6`,children:(0,V.jsx)(He,{})});let Vt=b.waits[0],Ht=b.waits.find(e=>e.kind===`paused`),X=b.receipts[0],Ut=nt(b),Wt=_.detailStatuses[Ut],Gt=b.task.body?.trim()||b.task.contract?.objective.trim(),Kt=b.runs.find(e=>e.id===X?.runId)?.contractVersion===b.task.latestContractVersion?X:void 0,qt=F(Kt),Jt=new Map(Kt?.verification.checks.map(e=>[e.criterion,e.status===`passed`&&!qt.has(e.criterion)?`unverified`:e.status])),Yt=b.allowedCommands.includes(`mark_ready`),Xt=b.allowedCommands.includes(`start`),Zt=b.allowedCommands.includes(`add_wait`),Qt=!Vt&&b.task.phase===`review`&&b.allowedCommands.includes(`close`),$t=b.allowedCommands.includes(`reopen`),Z=b.conversation.activeConversationId,en=b.conversation.currentExecutorAgentId??b.task.delegateAgentId??b.task.ownerId,tn=Ge.find(e=>e.id===en),nn=!!(Z&&ie&&ae===Z),rn=b.attention.some(e=>e.kind===`input_required`||e.kind===`approval_required`),an=b.task.contract?.acceptanceCriteria??[],on=an.filter(e=>Jt.get(e)===`passed`).length,sn=b.task.contract?.expectedOutputs??[],cn=b.task.contract?.constraints??[],ln=b.task.contract?.approvalRequired??[],un=b.task.contract?.assumptions??[],dn=b.task.contract?.risks??[],Q=(...e)=>!!St?.changedFields.some(t=>e.includes(t)),fn=b.allowedCommands.includes(`move`),$=R.has(`command`),pn=R.has(`delete`),mn=b.runs.find(e=>!e.parentRunId&&[`queued`,`running`,`waiting`,`verifying`].includes(e.status)),hn=mn!==void 0,gn=(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[Yt?(0,V.jsxs)(y,{variant:`primary`,disabled:$,onClick:()=>void J({type:`mark_ready`}),children:[(0,V.jsx)(w,{className:`size-4`}),_.scheduleTask]}):null,Ht&&b.allowedCommands.includes(`resolve_wait`)?(0,V.jsxs)(y,{variant:`primary`,disabled:$,onClick:()=>void J({type:`resolve_wait`,waitId:Ht.id}),children:[(0,V.jsx)(w,{className:`size-4`}),_.resumeTask]}):null,!Vt&&Xt&&en?(0,V.jsxs)(y,{variant:`primary`,disabled:$,onClick:()=>void J({type:`start`,executor:{kind:`agent`,agentId:en}}),children:[(0,V.jsx)(w,{className:`size-4`}),_.runTask]}):null,Qt?(0,V.jsxs)(y,{variant:`primary`,disabled:$,onClick:()=>void J({type:`close`,resolution:`done`}),children:[(0,V.jsx)(d,{className:`size-4`}),_.approveTask]}):null,$t?(0,V.jsxs)(y,{variant:`primary`,disabled:$,onClick:()=>void J({type:`reopen`,phase:`ready`}),children:[(0,V.jsx)(w,{className:`size-4`}),_.reopenTask]}):null,!Ht&&Zt?(0,V.jsxs)(y,{variant:`secondary`,className:`border-0 bg-surface-hover shadow-none`,disabled:$,onClick:()=>void J({type:`add_wait`,wait:{kind:`paused`,reason:`Paused by user`,condition:{}}}),children:[(0,V.jsx)(M,{className:`size-4`}),_.pauseTask]}):null,(0,V.jsxs)(Ce,{children:[(0,V.jsx)(xe,{asChild:!0,children:(0,V.jsx)(y,{type:`button`,variant:`ghost`,className:`size-9 p-0`,disabled:$||pn,"aria-label":_.moreActions,children:(0,V.jsx)(S,{className:`size-4`,"aria-hidden":!0})})}),(0,V.jsx)(ge,{children:(0,V.jsxs)(ue,{align:`end`,sideOffset:6,className:`z-[100] min-w-44 rounded-lg border border-edge bg-surface-panel p-1 shadow-popover`,children:[mn?(0,V.jsx)(le,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-danger outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:()=>{q(`command`,!0),L(null),C(je(e,mn.id,mn.version),{revalidate:!1}).catch(()=>L(_.actionFailed)).finally(()=>q(`command`,!1))},children:_.cancelActiveRun}):null,mn?(0,V.jsx)(ce,{className:`my-1 h-px bg-edge`}):null,b.task.phase===`closed`?null:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(le,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-danger outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:()=>void J({type:`close`,resolution:`cancelled`}),children:_.cancelTask}),(0,V.jsx)(ce,{className:`my-1 h-px bg-edge`})]}),(0,V.jsx)(le,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-danger outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:()=>{if(hn){L(_.deleteActiveTaskBlocked);return}Tt(!0)},children:_.deleteTask})]})})]})]}),Z&&t!==`modal`?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(y,{type:`button`,variant:`ghost`,className:v(`h-8 shrink-0 px-2 text-xs`,nn&&`bg-surface-hover text-fg`),"aria-label":l===`zh`?`项目文件`:`Project files`,"aria-pressed":nn,onClick:()=>{se(Z,!1),oe(Z)},children:[(0,V.jsx)(fe,{className:`size-3.5`,"aria-hidden":!0}),l===`zh`?`文件`:`Files`]}),(0,V.jsx)(y,{asChild:!0,variant:`ghost`,className:`h-8 shrink-0 px-2 text-xs`,children:(0,V.jsxs)(c,{to:de(e),children:[(0,V.jsx)(f,{className:`size-3.5`}),l===`zh`?`全屏`:`Full screen`]})})]}):null]});return(0,V.jsxs)(`div`,{ref:pt,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`} ${dt?`lg:cursor-col-resize lg:select-none`:``}`,style:{"--task-chat-panel-width":`${G}%`},children:[t===`page`&&Te?(0,Pe.createPortal)(gn,Te):null,(0,V.jsxs)(`section`,{className:`task-detail-scroll min-w-0 flex-1 overflow-y-auto overscroll-contain p-5 sm:p-6`,children:[(0,V.jsxs)(`header`,{className:v(`px-4 pb-5`,Q(`title`)&&`task-detail-live-update`),children:[(0,V.jsx)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:(0,V.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:[Re?(0,V.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,V.jsx)(N,{className:`size-3.5`,"aria-hidden":!0}),Re]}):null,(0,V.jsx)(`span`,{children:`/`}),(0,V.jsx)(`span`,{children:_.taskLabel}),(0,V.jsx)(`span`,{className:v(`rounded-full px-2 py-0.5 text-[11px] font-medium`,rt(Ut)),children:Wt}),(0,V.jsx)(`span`,{className:`text-fg-subtle`,children:_.updatedAt.replace(`{{date}}`,P(b.task.updatedAt,l))}),St?(0,V.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent-fg`,role:`status`,children:St.source===`agent`?l===`zh`?`Agent 刚刚更新`:`Updated by Agent`:l===`zh`?`执行结果已同步`:`Execution result synced`}):null]}),it?(0,V.jsx)(`input`,{autoFocus:!0,"data-task-inline-editor":!0,value:at,onChange:e=>ot(e.target.value),onBlur:()=>void At(),onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur(),e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),mt.current=!0,ot(b.task.title),U(!1),queueMicrotask(()=>{mt.current=!1}))},className:`mt-3 w-full max-w-3xl rounded-lg bg-surface-hover px-3 py-2 text-2xl font-semibold leading-8 text-fg outline-none ring-2 ring-accent/30 focus:ring-accent/60`}):(0,V.jsx)(`button`,{type:`button`,className:`mt-3 block max-w-3xl rounded-lg text-left outline-none hover:bg-surface-hover focus-visible:bg-surface-hover`,onClick:()=>{_t.current={value:b.task.title,version:b.task.version},K(null),ot(b.task.title),U(!0)},children:(0,V.jsx)(`h1`,{className:`text-2xl font-semibold leading-8 text-fg`,children:b.task.title})}),xt===`title`?(0,V.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-warning`,role:`alert`,children:[(0,V.jsx)(`span`,{children:l===`zh`?`Agent 在你编辑期间更新了标题。`:`The Agent updated the title while you were editing.`}),(0,V.jsx)(`button`,{type:`button`,className:`rounded-md bg-surface-hover px-2 py-1 text-fg`,onClick:()=>{ot(b.task.title),K(null),U(!1)},children:l===`zh`?`使用 Agent 版本`:`Use Agent version`}),(0,V.jsx)(`button`,{type:`button`,className:`rounded-md bg-accent-soft px-2 py-1 text-accent-fg`,onClick:()=>void Y({title:at.trim()}).then(e=>{e&&(K(null),U(!1))}),children:l===`zh`?`保留我的修改`:`Keep my changes`})]}):null]})}),ke?(0,V.jsx)(`p`,{className:`mt-3 text-sm text-danger`,children:ke}):null]}),b.attention.length>0?(0,V.jsxs)(`section`,{className:v(`mb-4 rounded-xl border border-warning/20 bg-warning/10 p-4`,Q(`attention`)&&`task-detail-live-update`),children:[(0,V.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:rn?_.needsAttention:_.waitingStatus}),(0,V.jsx)(`ul`,{className:`mt-2 space-y-1.5 text-sm leading-6 text-fg-muted`,children:b.attention.map((t,n)=>(0,V.jsxs)(`li`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[(0,V.jsx)(`span`,{className:`min-w-0 flex-1`,children:t.summary}),t.kind===`input_required`||t.kind===`approval_required`?(0,V.jsx)(c,{className:`inline-flex min-h-11 items-center rounded-lg bg-surface-panel px-3 text-sm font-medium text-accent`,to:de(e),children:l===`zh`?t.kind===`approval_required`?`查看并决定`:`补充信息`:t.kind===`approval_required`?`Review decision`:`Provide information`}):null]},`${t.kind}-${n}`))})]}):null,b.task.phase!==`closed`&&!Ht&&b.waits.filter(e=>(e.kind===`user_input`||e.kind===`approval`&&typeof e.condition.capability==`string`)&&e.condition.type!==`connection`).map(e=>(0,V.jsx)(Ne,{wait:e,detail:b,zh:l===`zh`,onUpdated:e=>{C(e,{revalidate:!1})}},e.id)),(0,V.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,V.jsxs)(`main`,{className:`min-w-0 overflow-hidden rounded-xl bg-surface-panel shadow-surface divide-y divide-edge-subtle`,children:[(0,V.jsxs)(`section`,{className:v(`p-5`,Q(`body`)&&`task-detail-live-update`),children:[(0,V.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:_.taskDescription}),st?(0,V.jsx)(`textarea`,{autoFocus:!0,"data-task-inline-editor":!0,rows:6,value:ct,onChange:e=>lt(e.target.value),onBlur:()=>void jt(),onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),ht.current=!0,lt(b.task.body??b.task.contract?.objective??``),W(!1),queueMicrotask(()=>{ht.current=!1}))},className:`mt-3 w-full resize-y rounded-lg bg-surface-hover px-3 py-2 text-sm leading-6 text-fg outline-none ring-2 ring-accent/20 focus:ring-accent/50`}):(0,V.jsx)(`button`,{type:`button`,className:`-mx-1 mt-2 block w-[calc(100%+0.5rem)] rounded-lg px-1 py-1 text-left outline-none hover:bg-surface-hover focus-visible:bg-surface-hover`,onClick:()=>{let e=b.task.body??b.task.contract?.objective??``;gt.current=e,vt.current={value:b.task.body??``,version:b.task.version},K(null),lt(e),W(!0)},children:(0,V.jsx)(`span`,{className:`whitespace-pre-wrap text-sm leading-6 text-fg-muted`,children:Gt&&Gt!==b.task.title?Gt:_.noTaskDescription})}),xt===`description`?(0,V.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-warning`,role:`alert`,children:[(0,V.jsx)(`span`,{children:l===`zh`?`Agent 在你编辑期间更新了描述。`:`The Agent updated the description while you were editing.`}),(0,V.jsx)(`button`,{type:`button`,className:`rounded-md bg-surface-hover px-2 py-1 text-fg`,onClick:()=>{lt(b.task.body??``),K(null),W(!1)},children:l===`zh`?`使用 Agent 版本`:`Use Agent version`}),(0,V.jsx)(`button`,{type:`button`,className:`rounded-md bg-accent-soft px-2 py-1 text-accent-fg`,onClick:()=>void Y({body:ct.trim()||null}).then(e=>{e&&(K(null),W(!1))}),children:l===`zh`?`保留我的修改`:`Keep my changes`})]}):null]}),(0,V.jsxs)(`section`,{className:v(`p-5`,Q(`contract`)&&`task-detail-live-update`),children:[(0,V.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:_.taskDefinition}),(0,V.jsxs)(`div`,{className:`mt-5`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,V.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:_.successDefinition}),an.length>0?(0,V.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:_.criteriaProgress.replace(`{{verified}}`,String(on)).replace(`{{total}}`,String(an.length))}):null]}),(0,V.jsx)(`div`,{className:`mt-3`,children:(0,V.jsx)(H,{items:an,empty:_.noDefinition,verificationByCriterion:Jt})})]}),sn.length>0?(0,V.jsxs)(`div`,{className:`mt-5 border-t border-edge-subtle pt-5`,children:[(0,V.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:_.expectedOutputs}),(0,V.jsx)(`div`,{className:`mt-3`,children:(0,V.jsx)(H,{items:sn,empty:_.noDefinition})})]}):null,cn.length>0?(0,V.jsxs)(`details`,{className:`mt-4 border-t border-edge-subtle pt-4`,children:[(0,V.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted hover:text-fg`,children:_.constraints}),(0,V.jsx)(`div`,{className:`mt-3`,children:(0,V.jsx)(H,{items:cn,empty:_.noDefinition})})]}):null,ln.length>0?(0,V.jsxs)(`details`,{className:`mt-4 border-t border-edge-subtle pt-4`,children:[(0,V.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted hover:text-fg`,children:_.approvalRequired}),(0,V.jsx)(`div`,{className:`mt-3`,children:(0,V.jsx)(H,{items:ln,empty:_.noDefinition})})]}):null,un.length>0?(0,V.jsxs)(`details`,{className:`mt-4 border-t border-edge-subtle pt-4`,children:[(0,V.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted hover:text-fg`,children:_.contextAssumptions}),(0,V.jsx)(`div`,{className:`mt-3`,children:(0,V.jsx)(H,{items:un,empty:_.noDefinition})})]}):null,dn.length>0?(0,V.jsxs)(`details`,{className:`mt-4 border-t border-edge-subtle pt-4`,children:[(0,V.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted hover:text-fg`,children:_.contextRisks}),(0,V.jsx)(`div`,{className:`mt-3`,children:(0,V.jsx)(H,{items:dn,empty:_.noDefinition})})]}):null]}),X?(0,V.jsxs)(`section`,{className:v(`p-5`,Q(`runs`,`receipts`)&&`task-detail-live-update`),children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,V.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,V.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:_.latestResult}),(0,V.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:l===`zh`?X.completionVerdict===`achieved`?`本次执行报告目标已达成,请结合下方验证依据验收。`:`这是阶段性结果,尚不能代表任务全部完成。`:X.completionVerdict===`achieved`?`The run reports the goal achieved. Review the evidence below.`:`This is a partial result; the task is not yet fully complete.`}),(0,V.jsx)(h,{content:X.summary,compact:!0,className:`mt-2 text-sm leading-6 text-fg`})]}),(0,V.jsxs)(`span`,{className:`rounded-full bg-surface-hover px-2.5 py-1 text-xs text-fg-muted`,children:[_.receiptStatuses[X.status],` · `,_.verificationStatuses[X.verification.status]]})]}),X.remainingWork.length>0?(0,V.jsxs)(`div`,{className:`mt-4`,children:[(0,V.jsx)(`h3`,{className:`text-xs font-medium text-fg-muted`,children:_.remainingWork}),(0,V.jsx)(`div`,{className:`mt-2`,children:(0,V.jsx)(H,{items:X.remainingWork,empty:_.noRemainingWork})})]}):null,X.nextAction?(0,V.jsxs)(`div`,{className:`mt-4 rounded-lg bg-surface-hover p-3`,children:[(0,V.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:_.nextAction}),(0,V.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:X.nextAction})]}):null,(0,V.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2`,children:[(0,V.jsx)(y,{className:`border-0 bg-surface-hover px-2 py-1 text-xs shadow-none`,variant:`secondary`,onClick:()=>void Se(X.runId,`helpful`),children:_.doneWell}),(0,V.jsx)(y,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>void Se(X.runId,`not_helpful`),children:_.needsFix})]}),(0,V.jsx)(Le,{evidence:X.evidence,projectId:b.task.projectId,conversationId:Z??void 0,language:l}),b.receipts.length>1?(0,V.jsxs)(`details`,{className:`mt-4 border-t border-edge-subtle pt-4`,children:[(0,V.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted hover:text-fg`,children:_.executionHistory.replace(`{{count}}`,String(b.receipts.length-1))}),(0,V.jsx)(`div`,{className:`mt-3 space-y-3`,children:b.receipts.slice(1).map(e=>(0,V.jsx)(`article`,{className:`rounded-lg bg-surface-hover p-3`,children:(0,V.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,V.jsx)(`p`,{className:`text-sm text-fg`,children:e.summary}),(0,V.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:_.receiptStatuses[e.status]})]})},e.runId))})]}):null]}):null,b.context.length>0?(0,V.jsxs)(`section`,{className:v(`p-5`,Q(`context`)&&`task-detail-live-update`),children:[(0,V.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:_.contextUsed}),(0,V.jsx)(`ul`,{className:`mt-4 grid gap-2 sm:grid-cols-2`,children:b.context.map(e=>(0,V.jsxs)(`li`,{className:`min-w-0 rounded-lg bg-surface-hover p-2.5`,children:[(0,V.jsxs)(`span`,{className:`text-[11px] text-fg-subtle`,children:[_.contextRoleLabels[e.role],` · `,_.contextKindLabels[e.targetKind]]}),e.targetKind===`url`&&/^https?:\/\//.test(e.targetId)?(0,V.jsx)(`a`,{className:`mt-1 block break-all text-sm text-accent hover:underline`,href:e.targetId,target:`_blank`,rel:`noreferrer`,children:e.title??e.targetId}):(0,V.jsx)(`p`,{className:`mt-1 break-words text-sm text-fg`,children:e.title??e.targetId})]},e.id))})]}):null]}),(0,V.jsxs)(`aside`,{className:`min-w-0 overflow-hidden rounded-xl bg-surface-panel shadow-surface divide-y divide-edge-subtle`,children:[(0,V.jsxs)(`section`,{className:v(`p-5`,Q(`phase`,`resolution`,`priority`,`dueAt`,`delegateAgentId`)&&`task-detail-live-update`),children:[(0,V.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:_.taskProperties}),(0,V.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[(0,V.jsx)(qe,{value:b.task.phase,disabled:R.has(`phase`),canMove:fn,canApprove:Qt,canReopen:$t,language:l,label:_.taskPhase,onChange:Mt}),(0,V.jsx)(Je,{value:b.task.priority,disabled:R.has(`priority`),label:_.priority,labels:_.priorityLabels,onChange:Nt}),(0,V.jsx)(Ye,{value:Ue(b.task.dueAt),disabled:R.has(`dueAt`),label:_.dueDate,onChange:Pt}),(0,V.jsx)(Xe,{value:b.conversation.currentExecutorAgentId??``,disabled:R.has(`delegateAgentId`),label:_.executorLabel,unassignedLabel:_.unassigned,agents:Ge,onChange:zt})]})]}),(0,V.jsxs)(`section`,{className:v(`p-5`,Q(`dependencies`)&&`task-detail-live-update`),children:[(0,V.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:_.taskRelations}),(0,V.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:_.dependencies}),(0,V.jsx)(Ze,{candidates:Fe,selected:b.dependencies,disabled:R.has(`dependencies`),labels:Et,getTaskHref:kt,onChange:Rt})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:_.dependents}),b.dependents.length>0?(0,V.jsx)(`div`,{className:`space-y-1.5`,children:b.dependents.map(e=>(0,V.jsx)(c,{to:kt(e.id),className:`block rounded-lg bg-surface-hover p-2.5 text-sm text-fg-muted transition-colors hover:text-fg`,children:e.title},e.id))}):(0,V.jsx)(`p`,{className:`text-sm text-fg-subtle`,children:_.noDependents})]})]})]})]})]})]}),(0,V.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":l===`zh`?`调整任务信息和 Agent 对话的宽度`:`Resize task details and Agent chat`,"aria-valuemin":30,"aria-valuemax":60,"aria-valuenow":Math.round(G),tabIndex:0,onPointerDown:Lt,onKeyDown:It,onDoubleClick:()=>Ft($e),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 ${dt?`bg-surface-hover`:``}`,children:(0,V.jsx)(`div`,{className:`my-3 w-px rounded-full bg-edge-strong/70 transition-colors group-hover:bg-accent group-focus-visible:bg-accent`})}),(0,V.jsxs)(`aside`,{className:`flex min-h-[34rem] min-w-0 flex-col bg-surface-panel lg:min-h-0 lg:w-[var(--task-chat-panel-width)] lg:shrink-0`,children:[(0,V.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-3 bg-surface-subtle px-4 py-3.5`,children:[(0,V.jsx)(`div`,{className:`min-w-0`,children:(0,V.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[en?(0,V.jsx)(k,{agentId:en,avatar:tn?.avatar,size:28,className:`shrink-0`}):null,(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:l===`zh`?`Agent 执行与对话`:`Agent execution and chat`}),(0,V.jsxs)(`p`,{className:`mt-0.5 truncate text-xs text-fg-muted`,children:[tn?.name??en??_.unassigned,` · `,Wt]})]})]})}),t===`modal`?gn:null]}),Z?(0,V.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,V.jsx)(De,{embedded:!0,conversationId:Z,taskId:e})}):_e?(0,V.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,V.jsxs)(`div`,{className:`max-w-xs`,children:[(0,V.jsx)(g,{className:`mx-auto size-8 animate-pulse text-fg-subtle`}),(0,V.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:l===`zh`?`正在创建任务会话`:`Creating task conversation`})]})}):be?(0,V.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,V.jsxs)(`div`,{className:`max-w-xs`,children:[(0,V.jsx)(g,{className:`mx-auto size-8 text-danger`}),(0,V.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:l===`zh`?`任务会话创建失败`:`Could not create task conversation`}),(0,V.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:be instanceof Error?be.message:String(be)})]})}):(0,V.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,V.jsxs)(`div`,{className:`max-w-xs`,children:[(0,V.jsx)(g,{className:`mx-auto size-8 text-fg-subtle`}),(0,V.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:l===`zh`?`等待任务会话`:`Waiting for a task conversation`}),(0,V.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:l===`zh`?`安排或开始任务后,Agent 的执行过程和持续对话会显示在这里。`:`Schedule or start the task to see the agent run and continue the conversation here.`})]})})]}),(0,V.jsx)(ve,{open:wt,title:_.deleteTaskTitle,description:_.deleteTaskDescription.replace(`{{title}}`,b.task.title),confirmLabel:_.confirmDeleteTask,cancelLabel:_.keepTask,destructive:!0,onConfirm:()=>{Tt(!1),Bt()},onCancel:()=>Tt(!1)})]})}function U(){let e=(0,z.c)(2),{taskId:t}=s(),n=t===void 0?``:t,r;return e[0]===n?r=e[1]:(r=(0,V.jsx)(it,{taskId:n,presentation:`page`}),e[0]=n,e[1]=r),r}function at(e){let t=(0,z.c)(58),{taskId:n,backgroundPath:r,onClose:i}=e,a=te(pt),{data:o}=Me(n),s=o?.conversation.activeConversationId??null,l=I(ft),u=I(dt),d=I(ut),p=I(G),m=Oe(lt),h=Te(ct),g=Te(W),ee=l?u:0,y;t[0]!==i||t[1]!==g?(y=e=>{e||(g(null),i())},t[0]=i,t[1]=g,t[2]=y):y=t[2];let b=a===`zh`?`关闭任务详情`:`Close task details`,x;t[3]!==i||t[4]!==g?(x=()=>{g(null),i()},t[3]=i,t[4]=g,t[5]=x):x=t[5];let S;t[6]!==b||t[7]!==x?(S=(0,V.jsx)(`button`,{type:`button`,tabIndex:-1,"data-task-modal-backdrop":!0,className:`fixed inset-0 z-[80] bg-black/45 backdrop-blur-[1px]`,"aria-label":b,onClick:x}),t[6]=b,t[7]=x,t[8]=S):S=t[8];let ce=l?`true`:`false`,C=`${ee/2}px`,le=`${ee}px`,ue;t[9]!==C||t[10]!==le?(ue={"--task-detail-workspace-offset":C,"--task-detail-workspace-width":le},t[9]=C,t[10]=le,t[11]=ue):ue=t[11];let pe=ue,me=a===`zh`?`任务详情`:`Task details`,w;t[12]===me?w=t[13]:(w=(0,V.jsx)(oe,{className:`font-medium text-fg`,children:me}),t[12]=me,t[13]=w);let he=a===`zh`?`查看并操作任务详情`:`View and manage task details`,T;t[14]===he?T=t[15]:(T=(0,V.jsx)(ne,{className:`sr-only`,children:he}),t[14]=he,t[15]=T);let E;t[16]!==s||t[17]!==a||t[18]!==p||t[19]!==m||t[20]!==n||t[21]!==d||t[22]!==l?(E=s?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`button`,{type:`button`,className:v(`flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,l&&d===s&&`bg-surface-hover text-fg`),"aria-label":a===`zh`?`项目文件`:`Project files`,title:a===`zh`?`项目文件`:`Project files`,"aria-pressed":l&&d===s,onClick:()=>{m(s,!1),p(s)},children:(0,V.jsx)(fe,{className:`size-4`,"aria-hidden":!0})}),(0,V.jsx)(c,{to:de(n),className:`flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":a===`zh`?`全屏打开对话`:`Open chat full screen`,title:a===`zh`?`全屏打开对话`:`Open chat full screen`,children:(0,V.jsx)(f,{className:`size-4`,"aria-hidden":!0})})]}):null,t[16]=s,t[17]=a,t[18]=p,t[19]=m,t[20]=n,t[21]=d,t[22]=l,t[23]=E):E=t[23];let D=a===`zh`?`关闭任务详情`:`Close task details`,ge;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,V.jsx)(_,{className:`size-4`,"aria-hidden":!0}),t[24]=ge):ge=t[24];let O;t[25]===D?O=t[26]:(O=(0,V.jsx)(re,{className:`flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":D,children:ge}),t[25]=D,t[26]=O);let k;t[27]!==E||t[28]!==O?(k=(0,V.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[E,O]}),t[27]=E,t[28]=O,t[29]=k):k=t[29];let A;t[30]!==w||t[31]!==T||t[32]!==k?(A=(0,V.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-3 bg-surface-panel px-5 py-3.5`,children:[w,T,k]}),t[30]=w,t[31]=T,t[32]=k,t[33]=A):A=t[33];let j;t[34]!==i||t[35]!==g?(j=()=>{g(null),i()},t[34]=i,t[35]=g,t[36]=j):j=t[36];let M;t[37]!==r||t[38]!==j||t[39]!==n?(M=(0,V.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,V.jsx)(it,{taskId:n,presentation:`modal`,backgroundPath:r,onDeleted:j})}),t[37]=r,t[38]=j,t[39]=n,t[40]=M):M=t[40];let N;t[41]!==A||t[42]!==M||t[43]!==ce||t[44]!==pe?(N=(0,V.jsxs)(ae,{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":ce,style:pe,onEscapeKeyDown:st,onInteractOutside:ot,children:[A,M]}),t[41]=A,t[42]=M,t[43]=ce,t[44]=pe,t[45]=N):N=t[45];let P;t[46]!==h||t[47]!==d||t[48]!==l||t[49]!==u?(P=h?(0,V.jsx)(`div`,{className:`fixed inset-y-0 left-0 z-[100] flex min-h-0 min-w-0 overflow-hidden bg-surface-panel transition-[right] duration-200 ease-out motion-reduce:transition-none`,style:{right:l?u:0},children:(0,V.jsx)(_e,{allowOutsideChat:!0,conversationId:d??void 0})}):null,t[46]=h,t[47]=d,t[48]=l,t[49]=u,t[50]=P):P=t[50];let F;t[51]!==N||t[52]!==P||t[53]!==S?(F=(0,V.jsxs)(ie,{children:[S,N,P]}),t[51]=N,t[52]=P,t[53]=S,t[54]=F):F=t[54];let ve;return t[55]!==y||t[56]!==F?(ve=(0,V.jsx)(se,{modal:!1,open:!0,onOpenChange:y,children:F}),t[55]=y,t[56]=F,t[57]=ve):ve=t[57],ve}function ot(e){let t=e.detail.originalEvent.target;t instanceof Element&&t.closest(`#app-workspace-panel, [data-task-modal-backdrop]`)&&e.preventDefault()}function st(e){let t=e.target;t instanceof HTMLElement&&t.closest(`[data-task-inline-editor]`)&&e.preventDefault()}function W(e){return e.setPath}function ct(e){return e.path}function lt(e){return e.setOpen}function G(e){return e.openForSession}function ut(e){return e.conversationIdOverride}function dt(e){return e.widthPx}function ft(e){return e.open}function pt(e){return e.language}function mt(e){return(0,V.jsx)(u,{value:e.id,children:e.name||e.id},e.id)}function ht(e){return e.id}export{at as TaskDetailModal,U as TaskDetailPage};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,i as n,n as r,t as i}from"./vendor-react-BOUWij0V.js";import{d as a,h as o,p as s,t as c}from"./chunk-KS7C4IRE-Cq1tE_3b.js";import{n as l,r as u}from"./popover-select-DldSX8GX.js";import{t as d}from"./circle-check-C23XjkUj.js";import{t as f}from"./external-link-DjqjBmc3.js";import{d as p,p as m,t as h}from"./markdown-view-BIg7cei7.js";import{t as g}from"./message-square-fVE7Ghj1.js";import{t as _}from"./x-B_N4OPjy.js";import{t as v}from"./cn-JdwAhgNB.js";import{c as ee,n as te}from"./locale-store-eliqUnBr.js";import{i as ne,n as re,o as ie,r as ae,s as oe,t as se}from"./dist-BGTk37IG.js";import{t as y}from"./button-CGlRPNzi.js";import{t as b}from"./activity-store-6lmzUBEr.js";import{t as x}from"./skeleton-BwbyijEw.js";import{$l as S,An as ce,Ci as C,Dn as le,En as ue,Fs as de,Hl as fe,Hu as pe,Is as me,Lc as w,Ls as he,Ms as T,Na as E,Oi as D,On as ge,Os as O,P as k,Ps as A,Ss as j,Uc as M,Ul as N,Vr as P,Vs as F,Vt as _e,Zi as ve,hi as I,ho as ye,hu as be,jn as xe,js as Se,kn as Ce,la as we,mi as Te,mu as Ee,n as De,or as Oe,ql as ke,ws as Ae,xs as je,ys as Me}from"./index-CEkw-fGy.js";import{t as L}from"./date-picker-BEZDMNzZ.js";import{t as R}from"./dependency-picker-DC8V8-Zp.js";var z=r(),B=e(t(),1),V=i();function Ne({wait:e,detail:t,zh:n,onUpdated:r}){let[i,a]=(0,B.useState)(``),[o,s]=(0,B.useState)(!1),[c,l]=(0,B.useState)(``),[u,d]=(0,B.useState)(!1),f=(0,B.useRef)(null),p=e.kind===`approval`,m=Array.isArray(e.condition.choices)?e.condition.choices.filter(e=>typeof e==`string`):[];async function h(a){if(!p&&!i.trim()||p&&!a||o)return;let c=JSON.stringify([t.task.version,i.trim(),a]);f.current?.signature!==c&&(f.current={signature:c,key:crypto.randomUUID()}),s(!0),l(``);try{let o=await j(t.task.id,{type:`resolve_wait`,waitId:e.id,resolution:p?{kind:`task_approval`,decision:a}:{kind:`user_answer`,answer:i.trim()}},t.task.version,f.current.key);d(!0),r(o),b({tone:`success`,title:p?n?`决定已保存`:`Decision saved`:n?`补充信息已保存`:`Answer saved`,message:o.waits.length?n?`仍有其他等待条件,任务尚未恢复执行。`:`Other waiting conditions remain.`:n?`等待已解除,请在任务状态中查看后续执行进展。`:`The wait is resolved. Follow progress in the task status.`,source:n?`任务`:`Task`})}catch{l(n?`提交未确认,内容已保留。可重试;若问题已变化,请刷新。`:`Submission not confirmed. Your answer is saved here; retry or refresh if the question changed.`)}finally{s(!1)}}return(0,V.jsxs)(`form`,{className:`mt-3 space-y-3 rounded-lg border border-edge p-3`,onSubmit:e=>{e.preventDefault(),h()},children:[p?(0,V.jsxs)(`div`,{className:`text-sm text-fg`,children:[(0,V.jsx)(`p`,{children:e.reason}),(0,V.jsxs)(`p`,{className:`mt-2`,children:[n?`授权范围:`:`Permission: `,String(e.condition.capability)]}),(0,V.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[(0,V.jsx)(y,{type:`button`,variant:`primary`,disabled:o||u,onClick:()=>void h(`approve`),children:n?`批准`:`Approve`}),(0,V.jsx)(y,{type:`button`,disabled:o||u,onClick:()=>void h(`deny`),children:n?`拒绝并暂停`:`Deny and pause`})]})]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`label`,{className:`block text-sm text-fg`,children:[typeof e.condition.question==`string`?e.condition.question:e.reason,(0,V.jsx)(`textarea`,{className:`mt-2 w-full rounded-lg border border-edge bg-surface-panel p-3`,rows:3,maxLength:12e3,value:i,disabled:o||u,onChange:e=>a(e.target.value)})]}),m.length>0&&(0,V.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:m.map(e=>(0,V.jsx)(y,{type:`button`,disabled:o||u,variant:`secondary`,"aria-pressed":i===e,onClick:()=>a(e),children:e},e))}),(0,V.jsx)(y,{type:`submit`,variant:`primary`,disabled:o||u||!i.trim(),children:o?n?`正在提交`:`Submitting`:n?`提交补充信息`:`Submit answer`})]}),(0,V.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`保存到任务上下文;其他等待条件满足后继续执行。`:`Saved to task context. Work continues once all waiting conditions are met.`}),c&&(0,V.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:c})]})}var Pe=e(n(),1);function Fe(e,t){let n;try{n=new URL(e)}catch{return}return t.find(e=>[e.shareUrl,e.lanUrl].some(e=>{if(!e)return!1;try{let t=new URL(e);return t.origin===n.origin&&t.pathname.replace(/\/$/,``)===n.pathname.replace(/\/$/,``)}catch{return!1}}))}function Ie({uri:e,zh:t}){let[n,r]=(0,B.useState)(),[i,a]=(0,B.useState)(!1),[o,s]=(0,B.useState)(!1),[l,u]=(0,B.useState)(``),[d,f]=(0,B.useState)(``);async function p(){a(!0),u(``);try{let n=Fe(e,(await D()).payload.shares);r(n),s(!0),n?n.kind!==`file`&&n.kind!==`directory`?u(t?`这是文档快照,请从原笔记或对话的分享面板重新发布。`:`This is a document snapshot. Republish it from the original note or conversation.`):n.revoked?u(t?`分享已被撤销,不能自动恢复。请从原任务重新生成并分享。`:`This share was revoked. Generate and share a new artifact from the task.`):n.maxViews!==null&&n.downloadCount>=n.maxViews?u(t?`已达到访问次数上限,请在分享设置中调整后重试。`:`The access limit was reached. Adjust it in share settings.`):n.expired||(f(n.shareUrl),u(t?`链接仍在有效期内;若打不开,请检查网关连接。`:`The link has not expired. If it cannot open, check gateway connectivity.`)):u(t?`未找到本机管理的分享记录。外部链接或已清理的记录无法在这里续期,请从原任务重新生成产物。`:`No locally managed share matches this link. Regenerate the artifact from its task.`)}catch{u(t?`检查失败,请重试。`:`Check failed. Please retry.`)}finally{a(!1)}}async function m(){if(!(!n||i)){a(!0),u(``);try{let e=await C(n.id,864e5);f(e.payload.shareUrl),r({...n,expired:!1,expiresAt:e.payload.expiresAt}),u(t?`已续期 24 小时,访问范围与次数限制保持不变。`:`Renewed for 24 hours. Access scope and view limits are unchanged.`)}catch(e){u(`${t?`恢复失败:`:`Recovery failed: `}${e instanceof Error?e.message:String(e)}`)}finally{a(!1)}}}return(0,V.jsxs)(`details`,{className:`mt-2 text-xs text-fg-muted`,children:[(0,V.jsx)(`summary`,{className:`cursor-pointer py-2`,children:t?`链接打不开?`:`Trouble opening the link?`}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(y,{type:`button`,variant:`ghost`,disabled:i,onClick:()=>void p(),children:t?`检查链接状态`:`Check link`}),o&&n?.expired&&(n.kind===`file`||n.kind===`directory`)&&!n.revoked&&(n.maxViews===null||n.downloadCount<n.maxViews)&&(0,V.jsx)(y,{type:`button`,disabled:i,onClick:()=>void m(),children:t?`恢复链接 · 续期 24 小时`:`Restore link for 24 hours`}),l&&(0,V.jsx)(`p`,{role:`status`,className:`break-words leading-5`,children:l}),d&&(0,V.jsx)(`a`,{className:`block py-2 text-accent`,href:d,target:`_blank`,rel:`noopener noreferrer`,children:t?`打开产物`:`Open artifact`}),o&&(0,V.jsx)(c,{className:`block py-2 text-accent`,to:`/settings/shares`,children:t?`管理分享记录`:`Manage shares`})]})]})}function Le(e){let t=(0,z.c)(14),{evidence:n,projectId:r,conversationId:i,language:a}=e,o=Te(Re);if(!n.length)return null;let s=a===`zh`?`交付物与验证依据`:`Deliverables and evidence`,c;if(t[0]!==i||t[1]!==n||t[2]!==a||t[3]!==r||t[4]!==o){let e;t[6]!==i||t[7]!==a||t[8]!==r||t[9]!==o?(e=(e,t)=>{let n=e.uri?.trim(),s=n&&/^https?:\/\//i.test(n),c=n&&!s&&e.kind===`artifact`&&!/^[a-z][a-z0-9+.-]*:/i.test(n)&&!n.startsWith(`//`),l=e.title||(a===`zh`?`查看产物`:`Open artifact`);return(0,V.jsxs)(`div`,{className:`min-w-0 rounded-lg border border-edge-subtle p-3`,children:[s?(0,V.jsxs)(`a`,{className:`inline-flex min-h-11 items-center gap-2 text-sm font-medium text-accent hover:underline`,href:n,target:`_blank`,rel:`noopener noreferrer`,children:[(0,V.jsx)(f,{className:`size-4 shrink-0`}),l]}):c&&(r||i)?(0,V.jsxs)(`button`,{type:`button`,className:`inline-flex min-h-11 items-center gap-2 text-sm font-medium text-accent hover:underline`,onClick:()=>o(n,null,r,i),children:[(0,V.jsx)(ke,{className:`size-4 shrink-0`}),l]}):(0,V.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:l}),s&&e.kind===`artifact`&&(0,V.jsx)(Ie,{uri:n,zh:a===`zh`},n),e.summary?(0,V.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:e.summary}):null,(0,V.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:e.strength===`verified`?a===`zh`?`已验证`:`Verified`:a===`zh`?`已记录,待验证`:`Observed, not verified`})]},`${e.title}-${t}`)},t[6]=i,t[7]=a,t[8]=r,t[9]=o,t[10]=e):e=t[10],c=n.map(e),t[0]=i,t[1]=n,t[2]=a,t[3]=r,t[4]=o,t[5]=c}else c=t[5];let l;return t[11]!==s||t[12]!==c?(l=(0,V.jsx)(`div`,{className:`mt-4 grid gap-2 sm:grid-cols-2`,"aria-label":s,children:c}),t[11]=s,t[12]=c,t[13]=l):l=t[13],l}function Re(e){return e.setPath}function ze(e,t,n,r){return!!(e&&t!==e.version&&n!==e.value&&r!==n)}function Be(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}}function Ve(e,t){return(t===`zh`?{backlog:`待规划`,ready:`就绪`,active:`进行中`,review:`待验收`,closed:`已完成`}:{backlog:`Backlog`,ready:`Ready`,active:`Active`,review:`Review`,closed:`Completed`})[e]}function He(){let e=(0,z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,V.jsxs)(`div`,{className:`space-y-4`,"aria-busy":!0,children:[(0,V.jsx)(x,{className:`h-32 rounded-2xl`}),(0,V.jsx)(x,{className:`h-52 rounded-2xl`}),(0,V.jsx)(x,{className:`h-40 rounded-2xl`})]}),e[0]=t):t=e[0],t}function Ue(e){if(e===void 0)return``;let t=new Date(e);return new Date(t.getTime()-t.getTimezoneOffset()*6e4).toISOString().slice(0,10)}function We(e){return e?new Date(`${e}T23:59:59.999`).getTime():null}var Ge=[`backlog`,`ready`,`active`,`review`,`closed`],Ke=[`low`,`normal`,`high`,`critical`],qe=(0,B.memo)(function(e){let t=(0,z.c)(20),{value:n,disabled:r,canMove:i,canApprove:a,canReopen:o,language:s,label:c,onChange:d}=e,f;t[0]!==a||t[1]!==i||t[2]!==o||t[3]!==n?(f=e=>e!==n&&(e===`closed`?!a:n===`closed`?!o:!i),t[0]=a,t[1]=i,t[2]=o,t[3]=n,t[4]=f):f=t[4];let p=f,m;t[5]===c?m=t[6]:(m=(0,V.jsx)(`span`,{children:c}),t[5]=c,t[6]=m);let h;t[7]===d?h=t[8]:(h=e=>d(e.target.value),t[7]=d,t[8]=h);let g;t[9]!==s||t[10]!==p?(g=Ge.map(e=>(0,V.jsx)(u,{value:e,disabled:p(e),children:Ve(e,s)},e)),t[9]=s,t[10]=p,t[11]=g):g=t[11];let _;t[12]!==r||t[13]!==h||t[14]!==g||t[15]!==n?(_=(0,V.jsx)(l,{triggerClassName:`border-0 bg-surface-hover shadow-none focus-visible:ring-2 focus-visible:ring-accent/30`,contentClassName:`border-0`,value:n,disabled:r,onChange:h,children:g}),t[12]=r,t[13]=h,t[14]=g,t[15]=n,t[16]=_):_=t[16];let v;return t[17]!==m||t[18]!==_?(v=(0,V.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[m,_]}),t[17]=m,t[18]=_,t[19]=v):v=t[19],v}),Je=(0,B.memo)(function(e){let t=(0,z.c)(14),{value:n,disabled:r,label:i,labels:a,onChange:o}=e,s;t[0]===i?s=t[1]:(s=(0,V.jsx)(`span`,{children:i}),t[0]=i,t[1]=s);let c;t[2]===o?c=t[3]:(c=e=>o(e.target.value),t[2]=o,t[3]=c);let d;t[4]===a?d=t[5]:(d=Ke.map(e=>(0,V.jsx)(u,{value:e,children:a[e]},e)),t[4]=a,t[5]=d);let f;t[6]!==r||t[7]!==c||t[8]!==d||t[9]!==n?(f=(0,V.jsx)(l,{triggerClassName:`border-0 bg-surface-hover shadow-none focus-visible:ring-2 focus-visible:ring-accent/30`,contentClassName:`border-0`,value:n,disabled:r,onChange:c,children:d}),t[6]=r,t[7]=c,t[8]=d,t[9]=n,t[10]=f):f=t[10];let p;return t[11]!==s||t[12]!==f?(p=(0,V.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[s,f]}),t[11]=s,t[12]=f,t[13]=p):p=t[13],p}),Ye=(0,B.memo)(function(e){let t=(0,z.c)(10),{value:n,disabled:r,label:i,onChange:a}=e,o;t[0]===i?o=t[1]:(o=(0,V.jsx)(`span`,{children:i}),t[0]=i,t[1]=o);let s;t[2]!==r||t[3]!==i||t[4]!==a||t[5]!==n?(s=(0,V.jsx)(L,{disabled:r,value:n,onChange:a,ariaLabel:i}),t[2]=r,t[3]=i,t[4]=a,t[5]=n,t[6]=s):s=t[6];let c;return t[7]!==o||t[8]!==s?(c=(0,V.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[o,s]}),t[7]=o,t[8]=s,t[9]=c):c=t[9],c}),Xe=(0,B.memo)(function(e){let t=(0,z.c)(17),{value:n,disabled:r,label:i,unassignedLabel:a,agents:o,onChange:s}=e,c;t[0]===i?c=t[1]:(c=(0,V.jsx)(`span`,{children:i}),t[0]=i,t[1]=c);let d;t[2]===s?d=t[3]:(d=e=>s(e.target.value),t[2]=s,t[3]=d);let f;t[4]===a?f=t[5]:(f=(0,V.jsx)(u,{value:``,disabled:!0,children:a}),t[4]=a,t[5]=f);let p;t[6]===o?p=t[7]:(p=o.map(mt),t[6]=o,t[7]=p);let m;t[8]!==r||t[9]!==d||t[10]!==f||t[11]!==p||t[12]!==n?(m=(0,V.jsxs)(l,{triggerClassName:`border-0 bg-surface-hover shadow-none focus-visible:ring-2 focus-visible:ring-accent/30`,contentClassName:`border-0`,value:n,disabled:r,onChange:d,children:[f,p]}),t[8]=r,t[9]=d,t[10]=f,t[11]=p,t[12]=n,t[13]=m):m=t[13];let h;return t[14]!==c||t[15]!==m?(h=(0,V.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[c,m]}),t[14]=c,t[15]=m,t[16]=h):h=t[16],h}),Ze=(0,B.memo)(function(e){let t=(0,z.c)(9),{candidates:n,selected:r,disabled:i,labels:a,getTaskHref:o,onChange:s}=e,c;t[0]===r?c=t[1]:(c=r.map(ht),t[0]=r,t[1]=c);let l;return t[2]!==n||t[3]!==i||t[4]!==o||t[5]!==a||t[6]!==s||t[7]!==c?(l=(0,V.jsx)(R,{borderless:!0,candidates:n,selectedIds:c,disabled:i,getTaskHref:o,onChange:s,labels:a}),t[2]=n,t[3]=i,t[4]=o,t[5]=a,t[6]=s,t[7]=c,t[8]=l):l=t[8],l},(e,t)=>e.disabled===t.disabled&&e.labels===t.labels&&e.getTaskHref===t.getTaskHref&&e.onChange===t.onChange&&e.candidates.length===t.candidates.length&&e.candidates.every((e,n)=>e.id===t.candidates[n]?.id&&e.title===t.candidates[n]?.title)&&e.selected.length===t.selected.length&&e.selected.every((e,n)=>e.id===t.selected[n]?.id&&e.title===t.selected[n]?.title)),Qe=`xopc.taskDetail.chatPanelPercent`,$e=42;function et(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?$e:Math.min(r,Math.max(n,e))}function tt(){try{let e=Number(window.localStorage.getItem(Qe));return Number.isFinite(e)&&e>=30&&e<=60?e:$e}catch{return $e}}function nt(e){return e.task.phase===`closed`?e.task.resolution===`done`?`completed`:`ended`:e.waits.some(e=>e.kind===`paused`)?`paused`: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`:`ready`:e.operationalState}function rt(e){return e===`needsUser`||e===`blocked`?`bg-warning/10 text-warning`:e===`completed`?`bg-success-soft text-success`:e===`running`||e===`verifying`||e===`review`?`bg-accent-soft text-accent-fg`:`bg-surface-hover text-fg-muted`}function H(e){let t=(0,z.c)(9),{items:n,empty:r,verificationByCriterion:i}=e;if(n.length===0){let e;return t[0]===r?e=t[1]:(e=(0,V.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:r}),t[0]=r,t[1]=e),e}let a;if(t[2]!==n||t[3]!==i){let e;t[5]===i?e=t[6]:(e=e=>{let t=i?.get(e)??`unverified`;return(0,V.jsxs)(`li`,{className:`flex gap-2 text-sm leading-6 text-fg`,children:[(0,V.jsx)(t===`passed`?d:t===`failed`?be:Ee,{className:t===`passed`?`mt-1 size-4 shrink-0 text-success`:t===`failed`?`mt-1 size-4 shrink-0 text-danger`:`mt-1 size-4 shrink-0 text-fg-subtle`}),(0,V.jsx)(`span`,{children:e})]},e)},t[5]=i,t[6]=e),a=n.map(e),t[2]=n,t[3]=i,t[4]=a}else a=t[4];let o;return t[7]===a?o=t[8]:(o=(0,V.jsx)(`ul`,{className:`space-y-2`,children:a}),t[7]=a,t[8]=o),o}function it({taskId:e,presentation:t,backgroundPath:n,onDeleted:r}){let[i]=o(),s=a(),l=te(e=>e.language),u=ee(e=>e.conversationId),_=(0,B.useMemo)(()=>he(l),[l]),ne=ye(e=>e.setPageHeader),re=ye(e=>e.clearPageHeader),ie=I(e=>e.open),ae=I(e=>e.conversationIdOverride),oe=I(e=>e.openForSession),se=Oe(e=>e.setOpen),{data:b,error:x,mutate:C,lastChange:D,conversationLoading:_e,conversationError:be}=Me(e),[Te,Ee]=(0,B.useState)(null),[ke,L]=(0,B.useState)(null),[R,z]=(0,B.useState)(()=>new Set),[Fe,Ie]=(0,B.useState)([]),[Re,Ve]=(0,B.useState)(null),[Ge,Ke]=(0,B.useState)([]),[it,U]=(0,B.useState)(!1),[at,ot]=(0,B.useState)(``),[st,W]=(0,B.useState)(!1),[ct,lt]=(0,B.useState)(``),[G,ut]=(0,B.useState)(tt),[dt,ft]=(0,B.useState)(!1),pt=(0,B.useRef)(null),mt=(0,B.useRef)(!1),ht=(0,B.useRef)(!1),gt=(0,B.useRef)(``),_t=(0,B.useRef)(null),vt=(0,B.useRef)(null),yt=(0,B.useRef)(null),bt=(0,B.useRef)(b),[xt,K]=(0,B.useState)(null),[St,Ct]=(0,B.useState)(null),[wt,Tt]=(0,B.useState)(!1),Et=(0,B.useMemo)(()=>({link:_.linkDependencies,linked:_.linkedDependencies,searchPlaceholder:_.dependencySearchPlaceholder,noMatches:_.noDependencyMatches,noCandidates:_.noDependencyCandidates,remove:_.removeDependency}),[_.dependencySearchPlaceholder,_.linkDependencies,_.linkedDependencies,_.noDependencyCandidates,_.noDependencyMatches,_.removeDependency]),Dt=b?.dependencies.map(e=>`${e.id}:${e.title}`).join(`\0`)??``,Ot=(0,B.useMemo)(()=>p(i.get(`returnTo`),`/`,[`/projects`,`/chat`,`/notes`,`/tasks`]),[i]),kt=(0,B.useCallback)(e=>t===`modal`&&n?me(n,e):m(`/tasks/${encodeURIComponent(e)}`,Ot),[n,t,Ot]);bt.current=b;let q=(0,B.useCallback)((e,t)=>{z(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r})},[]);(0,B.useEffect)(()=>{L(null),K(null),U(!1),W(!1),Ct(null),Tt(!1)},[e]),(0,B.useEffect)(()=>{let e=!0;return we().then(t=>{e&&Ke(t.items)}).catch(()=>void 0),()=>{e=!1}},[u]),(0,B.useEffect)(()=>{if(!D||D.source===`user`)return;Ct(D);let e=window.setTimeout(()=>Ct(null),3500);return()=>window.clearTimeout(e)},[D]),(0,B.useEffect)(()=>{let t=b?.task.projectId,n=b?.dependencies??[];if(!t){yt.current=null,Ve(null),Ie(n);return}yt.current!==t&&(yt.current=t,Ve(null));let r=!0;return E(t).then(t=>{if(!r)return;Ve(t.project.name);let i=new Map;for(let r of[...t.tasks,...n])r.id!==e&&i.set(r.id,{id:r.id,title:r.title});Ie([...i.values()])}).catch(()=>{r&&Ie(n)}),()=>{r=!1}},[Dt,b?.task.projectId,e]);let J=(0,B.useCallback)(async(t,n=`command`)=>{let r=bt.current;if(r){q(n,!0),L(null);try{await C(await j(e,t,r.task.version),{revalidate:!1})}catch{L(_.actionFailed)}finally{q(n,!1)}}},[_.actionFailed,C,q,e]),Y=(0,B.useCallback)(async(t,n)=>{let r=bt.current;if(!r)return!1;n&&q(n,!0),L(null);try{return await C(T(e,t,r.task.version),{optimisticData:Be(r,t),populateCache:!0,revalidate:!1,rollbackOnError:!0}),!0}catch{return L(_.actionFailed),!1}finally{n&&q(n,!1)}},[_.actionFailed,C,q,e]),At=async()=>{if(!b)return;if(mt.current){mt.current=!1;return}let e=at.trim(),t=_t.current;if(ze(t,b.task.version,b.task.title,e)){K(`title`);return}if(!e||e===b.task.title){ot(b.task.title),U(!1);return}await Y({title:e})&&(K(null),U(!1))},jt=async()=>{if(!b)return;if(ht.current){ht.current=!1;return}let e=ct.trim(),t=vt.current;if(ze(t,b.task.version,b.task.body??``,e)){K(`description`);return}if(ct===gt.current||e===(b.task.body??``).trim()){W(!1);return}await Y({body:e||null})&&(K(null),W(!1))},Mt=(0,B.useCallback)(async e=>{let t=bt.current;if(!(!t||e===t.task.phase)){if(t.task.phase===`closed`){await J({type:`reopen`,phase:e===`closed`?`ready`:e},`phase`);return}if(e===`closed`){await J({type:`close`,resolution:`done`},`phase`);return}await J({type:`move`,phase:e},`phase`)}},[J]),Nt=(0,B.useCallback)(e=>{Y({priority:e},`priority`)},[Y]),Pt=(0,B.useCallback)(e=>{Y({dueAt:We(e)},`dueAt`)},[Y]),Ft=(0,B.useCallback)(e=>{ut(e);try{window.localStorage.setItem(Qe,String(e))}catch{}},[]),It=(0,B.useCallback)(e=>{if(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`&&e.key!==`Home`)return;e.preventDefault();let t=pt.current?.clientWidth??0;Ft(et(e.key===`Home`?$e:G+(e.key===`ArrowLeft`?2:-2),t))},[G,Ft]),Lt=(0,B.useCallback)(e=>{if(!window.matchMedia(`(min-width: 1024px)`).matches)return;let t=pt.current;if(!t)return;e.preventDefault();let n=e.currentTarget,r=e.pointerId;n.setPointerCapture(r),ft(!0);let i=G,a=0,o=()=>{a=0,t.style.setProperty(`--task-chat-panel-width`,`${i}%`)},s=e=>{let n=t.getBoundingClientRect();i=et((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{}ft(!1),Ft(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,Ft]),Rt=(0,B.useCallback)(async t=>{let n=bt.current;if(n){q(`dependencies`,!0),L(null);try{await C(await A(e,t,n.task.version),{revalidate:!1})}catch{L(_.dependencyUpdateFailed)}finally{q(`dependencies`,!1)}}},[_.dependencyUpdateFailed,C,q,e]),zt=(0,B.useCallback)(async t=>{let n=bt.current;if(!(!n||!t||t===n.conversation.currentExecutorAgentId)){q(`delegateAgentId`,!0),L(null);try{await C(await O(e,t,n.task.version),{revalidate:!1})}catch{L(_.actionFailed)}finally{q(`delegateAgentId`,!1)}}},[_.actionFailed,C,q,e]),Bt=(0,B.useCallback)(async()=>{q(`delete`,!0),L(null);try{await Ae(e),r?r():s(Ot,{replace:!0})}catch(e){L(e instanceof Error?e.message:_.actionFailed)}finally{q(`delete`,!1)}},[_.actionFailed,s,r,Ot,q,e]);if((0,B.useLayoutEffect)(()=>{if(t!==`modal`)return ne({startExtra:(0,V.jsx)(c,{to:Ot,className:`flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover`,"aria-label":_.backToWork,children:(0,V.jsx)(pe,{className:`size-4`})}),main:b?(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`p`,{className:`truncate text-sm font-semibold text-fg`,children:Re?`${Re} / ${_.taskLabel}`:_.taskLabel}),(0,V.jsx)(`p`,{className:`text-xs text-fg-muted`,children:_.detailStatuses[nt(b)]})]}):null,end:(0,V.jsx)(`div`,{ref:Ee,className:`flex min-w-0 items-center justify-end`})}),re},[re,_.backToWork,_.detailStatuses,_.taskLabel,b,t,Re,Ot,ne]),x&&!b)return(0,V.jsx)(`div`,{className:t===`modal`?`p-5 text-sm text-danger`:`mx-auto max-w-3xl p-6 text-sm text-danger`,children:_.taskNotFound});if(!b)return(0,V.jsx)(`div`,{className:t===`modal`?`p-5`:`mx-auto max-w-4xl p-4 sm:p-6`,children:(0,V.jsx)(He,{})});let Vt=b.waits[0],Ht=b.waits.find(e=>e.kind===`paused`),X=b.receipts[0],Ut=nt(b),Wt=_.detailStatuses[Ut],Gt=b.task.body?.trim()||b.task.contract?.objective.trim(),Kt=b.runs.find(e=>e.id===X?.runId)?.contractVersion===b.task.latestContractVersion?X:void 0,qt=F(Kt),Jt=new Map(Kt?.verification.checks.map(e=>[e.criterion,e.status===`passed`&&!qt.has(e.criterion)?`unverified`:e.status])),Yt=b.allowedCommands.includes(`mark_ready`),Xt=b.allowedCommands.includes(`start`),Zt=b.allowedCommands.includes(`add_wait`),Qt=!Vt&&b.task.phase===`review`&&b.allowedCommands.includes(`close`),$t=b.allowedCommands.includes(`reopen`),Z=b.conversation.activeConversationId,en=b.conversation.currentExecutorAgentId??b.task.delegateAgentId??b.task.ownerId,tn=Ge.find(e=>e.id===en),nn=!!(Z&&ie&&ae===Z),rn=b.attention.some(e=>e.kind===`input_required`||e.kind===`approval_required`),an=b.task.contract?.acceptanceCriteria??[],on=an.filter(e=>Jt.get(e)===`passed`).length,sn=b.task.contract?.expectedOutputs??[],cn=b.task.contract?.constraints??[],ln=b.task.contract?.approvalRequired??[],un=b.task.contract?.assumptions??[],dn=b.task.contract?.risks??[],Q=(...e)=>!!St?.changedFields.some(t=>e.includes(t)),fn=b.allowedCommands.includes(`move`),$=R.has(`command`),pn=R.has(`delete`),mn=b.runs.find(e=>!e.parentRunId&&[`queued`,`running`,`waiting`,`verifying`].includes(e.status)),hn=mn!==void 0,gn=(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[Yt?(0,V.jsxs)(y,{variant:`primary`,disabled:$,onClick:()=>void J({type:`mark_ready`}),children:[(0,V.jsx)(w,{className:`size-4`}),_.scheduleTask]}):null,Ht&&b.allowedCommands.includes(`resolve_wait`)?(0,V.jsxs)(y,{variant:`primary`,disabled:$,onClick:()=>void J({type:`resolve_wait`,waitId:Ht.id}),children:[(0,V.jsx)(w,{className:`size-4`}),_.resumeTask]}):null,!Vt&&Xt&&en?(0,V.jsxs)(y,{variant:`primary`,disabled:$,onClick:()=>void J({type:`start`,executor:{kind:`agent`,agentId:en}}),children:[(0,V.jsx)(w,{className:`size-4`}),_.runTask]}):null,Qt?(0,V.jsxs)(y,{variant:`primary`,disabled:$,onClick:()=>void J({type:`close`,resolution:`done`}),children:[(0,V.jsx)(d,{className:`size-4`}),_.approveTask]}):null,$t?(0,V.jsxs)(y,{variant:`primary`,disabled:$,onClick:()=>void J({type:`reopen`,phase:`ready`}),children:[(0,V.jsx)(w,{className:`size-4`}),_.reopenTask]}):null,!Ht&&Zt?(0,V.jsxs)(y,{variant:`secondary`,className:`border-0 bg-surface-hover shadow-none`,disabled:$,onClick:()=>void J({type:`add_wait`,wait:{kind:`paused`,reason:`Paused by user`,condition:{}}}),children:[(0,V.jsx)(M,{className:`size-4`}),_.pauseTask]}):null,(0,V.jsxs)(Ce,{children:[(0,V.jsx)(xe,{asChild:!0,children:(0,V.jsx)(y,{type:`button`,variant:`ghost`,className:`size-9 p-0`,disabled:$||pn,"aria-label":_.moreActions,children:(0,V.jsx)(S,{className:`size-4`,"aria-hidden":!0})})}),(0,V.jsx)(ge,{children:(0,V.jsxs)(ue,{align:`end`,sideOffset:6,className:`z-[100] min-w-44 rounded-lg border border-edge bg-surface-panel p-1 shadow-popover`,children:[mn?(0,V.jsx)(le,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-danger outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:()=>{q(`command`,!0),L(null),C(je(e,mn.id,mn.version),{revalidate:!1}).catch(()=>L(_.actionFailed)).finally(()=>q(`command`,!1))},children:_.cancelActiveRun}):null,mn?(0,V.jsx)(ce,{className:`my-1 h-px bg-edge`}):null,b.task.phase===`closed`?null:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(le,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-danger outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:()=>void J({type:`close`,resolution:`cancelled`}),children:_.cancelTask}),(0,V.jsx)(ce,{className:`my-1 h-px bg-edge`})]}),(0,V.jsx)(le,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-danger outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:()=>{if(hn){L(_.deleteActiveTaskBlocked);return}Tt(!0)},children:_.deleteTask})]})})]})]}),Z&&t!==`modal`?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(y,{type:`button`,variant:`ghost`,className:v(`h-8 shrink-0 px-2 text-xs`,nn&&`bg-surface-hover text-fg`),"aria-label":l===`zh`?`项目文件`:`Project files`,"aria-pressed":nn,onClick:()=>{se(Z,!1),oe(Z)},children:[(0,V.jsx)(fe,{className:`size-3.5`,"aria-hidden":!0}),l===`zh`?`文件`:`Files`]}),(0,V.jsx)(y,{asChild:!0,variant:`ghost`,className:`h-8 shrink-0 px-2 text-xs`,children:(0,V.jsxs)(c,{to:de(e),children:[(0,V.jsx)(f,{className:`size-3.5`}),l===`zh`?`全屏`:`Full screen`]})})]}):null]});return(0,V.jsxs)(`div`,{ref:pt,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`} ${dt?`lg:cursor-col-resize lg:select-none`:``}`,style:{"--task-chat-panel-width":`${G}%`},children:[t===`page`&&Te?(0,Pe.createPortal)(gn,Te):null,(0,V.jsxs)(`section`,{className:`task-detail-scroll min-w-0 flex-1 overflow-y-auto overscroll-contain p-5 sm:p-6`,children:[(0,V.jsxs)(`header`,{className:v(`px-4 pb-5`,Q(`title`)&&`task-detail-live-update`),children:[(0,V.jsx)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:(0,V.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:[Re?(0,V.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,V.jsx)(N,{className:`size-3.5`,"aria-hidden":!0}),Re]}):null,(0,V.jsx)(`span`,{children:`/`}),(0,V.jsx)(`span`,{children:_.taskLabel}),(0,V.jsx)(`span`,{className:v(`rounded-full px-2 py-0.5 text-[11px] font-medium`,rt(Ut)),children:Wt}),(0,V.jsx)(`span`,{className:`text-fg-subtle`,children:_.updatedAt.replace(`{{date}}`,P(b.task.updatedAt,l))}),St?(0,V.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent-fg`,role:`status`,children:St.source===`agent`?l===`zh`?`Agent 刚刚更新`:`Updated by Agent`:l===`zh`?`执行结果已同步`:`Execution result synced`}):null]}),it?(0,V.jsx)(`input`,{autoFocus:!0,"data-task-inline-editor":!0,value:at,onChange:e=>ot(e.target.value),onBlur:()=>void At(),onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur(),e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),mt.current=!0,ot(b.task.title),U(!1),queueMicrotask(()=>{mt.current=!1}))},className:`mt-3 w-full max-w-3xl rounded-lg bg-surface-hover px-3 py-2 text-2xl font-semibold leading-8 text-fg outline-none ring-2 ring-accent/30 focus:ring-accent/60`}):(0,V.jsx)(`button`,{type:`button`,className:`mt-3 block max-w-3xl rounded-lg text-left outline-none hover:bg-surface-hover focus-visible:bg-surface-hover`,onClick:()=>{_t.current={value:b.task.title,version:b.task.version},K(null),ot(b.task.title),U(!0)},children:(0,V.jsx)(`h1`,{className:`text-2xl font-semibold leading-8 text-fg`,children:b.task.title})}),xt===`title`?(0,V.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-warning`,role:`alert`,children:[(0,V.jsx)(`span`,{children:l===`zh`?`Agent 在你编辑期间更新了标题。`:`The Agent updated the title while you were editing.`}),(0,V.jsx)(`button`,{type:`button`,className:`rounded-md bg-surface-hover px-2 py-1 text-fg`,onClick:()=>{ot(b.task.title),K(null),U(!1)},children:l===`zh`?`使用 Agent 版本`:`Use Agent version`}),(0,V.jsx)(`button`,{type:`button`,className:`rounded-md bg-accent-soft px-2 py-1 text-accent-fg`,onClick:()=>void Y({title:at.trim()}).then(e=>{e&&(K(null),U(!1))}),children:l===`zh`?`保留我的修改`:`Keep my changes`})]}):null]})}),ke?(0,V.jsx)(`p`,{className:`mt-3 text-sm text-danger`,children:ke}):null]}),b.attention.length>0?(0,V.jsxs)(`section`,{className:v(`mb-4 rounded-xl border border-warning/20 bg-warning/10 p-4`,Q(`attention`)&&`task-detail-live-update`),children:[(0,V.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:rn?_.needsAttention:_.waitingStatus}),(0,V.jsx)(`ul`,{className:`mt-2 space-y-1.5 text-sm leading-6 text-fg-muted`,children:b.attention.map((t,n)=>(0,V.jsxs)(`li`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[(0,V.jsx)(`span`,{className:`min-w-0 flex-1`,children:t.summary}),t.kind===`input_required`||t.kind===`approval_required`?(0,V.jsx)(c,{className:`inline-flex min-h-11 items-center rounded-lg bg-surface-panel px-3 text-sm font-medium text-accent`,to:de(e),children:l===`zh`?t.kind===`approval_required`?`查看并决定`:`补充信息`:t.kind===`approval_required`?`Review decision`:`Provide information`}):null]},`${t.kind}-${n}`))})]}):null,b.task.phase!==`closed`&&!Ht&&b.waits.filter(e=>(e.kind===`user_input`||e.kind===`approval`&&typeof e.condition.capability==`string`)&&e.condition.type!==`connection`).map(e=>(0,V.jsx)(Ne,{wait:e,detail:b,zh:l===`zh`,onUpdated:e=>{C(e,{revalidate:!1})}},e.id)),(0,V.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,V.jsxs)(`main`,{className:`min-w-0 overflow-hidden rounded-xl bg-surface-panel shadow-surface divide-y divide-edge-subtle`,children:[(0,V.jsxs)(`section`,{className:v(`p-5`,Q(`body`)&&`task-detail-live-update`),children:[(0,V.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:_.taskDescription}),st?(0,V.jsx)(`textarea`,{autoFocus:!0,"data-task-inline-editor":!0,rows:6,value:ct,onChange:e=>lt(e.target.value),onBlur:()=>void jt(),onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),ht.current=!0,lt(b.task.body??b.task.contract?.objective??``),W(!1),queueMicrotask(()=>{ht.current=!1}))},className:`mt-3 w-full resize-y rounded-lg bg-surface-hover px-3 py-2 text-sm leading-6 text-fg outline-none ring-2 ring-accent/20 focus:ring-accent/50`}):(0,V.jsx)(`button`,{type:`button`,className:`-mx-1 mt-2 block w-[calc(100%+0.5rem)] rounded-lg px-1 py-1 text-left outline-none hover:bg-surface-hover focus-visible:bg-surface-hover`,onClick:()=>{let e=b.task.body??b.task.contract?.objective??``;gt.current=e,vt.current={value:b.task.body??``,version:b.task.version},K(null),lt(e),W(!0)},children:(0,V.jsx)(`span`,{className:`whitespace-pre-wrap text-sm leading-6 text-fg-muted`,children:Gt&&Gt!==b.task.title?Gt:_.noTaskDescription})}),xt===`description`?(0,V.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-warning`,role:`alert`,children:[(0,V.jsx)(`span`,{children:l===`zh`?`Agent 在你编辑期间更新了描述。`:`The Agent updated the description while you were editing.`}),(0,V.jsx)(`button`,{type:`button`,className:`rounded-md bg-surface-hover px-2 py-1 text-fg`,onClick:()=>{lt(b.task.body??``),K(null),W(!1)},children:l===`zh`?`使用 Agent 版本`:`Use Agent version`}),(0,V.jsx)(`button`,{type:`button`,className:`rounded-md bg-accent-soft px-2 py-1 text-accent-fg`,onClick:()=>void Y({body:ct.trim()||null}).then(e=>{e&&(K(null),W(!1))}),children:l===`zh`?`保留我的修改`:`Keep my changes`})]}):null]}),(0,V.jsxs)(`section`,{className:v(`p-5`,Q(`contract`)&&`task-detail-live-update`),children:[(0,V.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:_.taskDefinition}),(0,V.jsxs)(`div`,{className:`mt-5`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,V.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:_.successDefinition}),an.length>0?(0,V.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:_.criteriaProgress.replace(`{{verified}}`,String(on)).replace(`{{total}}`,String(an.length))}):null]}),(0,V.jsx)(`div`,{className:`mt-3`,children:(0,V.jsx)(H,{items:an,empty:_.noDefinition,verificationByCriterion:Jt})})]}),sn.length>0?(0,V.jsxs)(`div`,{className:`mt-5 border-t border-edge-subtle pt-5`,children:[(0,V.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:_.expectedOutputs}),(0,V.jsx)(`div`,{className:`mt-3`,children:(0,V.jsx)(H,{items:sn,empty:_.noDefinition})})]}):null,cn.length>0?(0,V.jsxs)(`details`,{className:`mt-4 border-t border-edge-subtle pt-4`,children:[(0,V.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted hover:text-fg`,children:_.constraints}),(0,V.jsx)(`div`,{className:`mt-3`,children:(0,V.jsx)(H,{items:cn,empty:_.noDefinition})})]}):null,ln.length>0?(0,V.jsxs)(`details`,{className:`mt-4 border-t border-edge-subtle pt-4`,children:[(0,V.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted hover:text-fg`,children:_.approvalRequired}),(0,V.jsx)(`div`,{className:`mt-3`,children:(0,V.jsx)(H,{items:ln,empty:_.noDefinition})})]}):null,un.length>0?(0,V.jsxs)(`details`,{className:`mt-4 border-t border-edge-subtle pt-4`,children:[(0,V.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted hover:text-fg`,children:_.contextAssumptions}),(0,V.jsx)(`div`,{className:`mt-3`,children:(0,V.jsx)(H,{items:un,empty:_.noDefinition})})]}):null,dn.length>0?(0,V.jsxs)(`details`,{className:`mt-4 border-t border-edge-subtle pt-4`,children:[(0,V.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted hover:text-fg`,children:_.contextRisks}),(0,V.jsx)(`div`,{className:`mt-3`,children:(0,V.jsx)(H,{items:dn,empty:_.noDefinition})})]}):null]}),X?(0,V.jsxs)(`section`,{className:v(`p-5`,Q(`runs`,`receipts`)&&`task-detail-live-update`),children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,V.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,V.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:_.latestResult}),(0,V.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:l===`zh`?X.completionVerdict===`achieved`?`本次执行报告目标已达成,请结合下方验证依据验收。`:`这是阶段性结果,尚不能代表任务全部完成。`:X.completionVerdict===`achieved`?`The run reports the goal achieved. Review the evidence below.`:`This is a partial result; the task is not yet fully complete.`}),(0,V.jsx)(h,{content:X.summary,compact:!0,className:`mt-2 text-sm leading-6 text-fg`})]}),(0,V.jsxs)(`span`,{className:`rounded-full bg-surface-hover px-2.5 py-1 text-xs text-fg-muted`,children:[_.receiptStatuses[X.status],` · `,_.verificationStatuses[X.verification.status]]})]}),X.remainingWork.length>0?(0,V.jsxs)(`div`,{className:`mt-4`,children:[(0,V.jsx)(`h3`,{className:`text-xs font-medium text-fg-muted`,children:_.remainingWork}),(0,V.jsx)(`div`,{className:`mt-2`,children:(0,V.jsx)(H,{items:X.remainingWork,empty:_.noRemainingWork})})]}):null,X.nextAction?(0,V.jsxs)(`div`,{className:`mt-4 rounded-lg bg-surface-hover p-3`,children:[(0,V.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:_.nextAction}),(0,V.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:X.nextAction})]}):null,(0,V.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2`,children:[(0,V.jsx)(y,{className:`border-0 bg-surface-hover px-2 py-1 text-xs shadow-none`,variant:`secondary`,onClick:()=>void Se(X.runId,`helpful`),children:_.doneWell}),(0,V.jsx)(y,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>void Se(X.runId,`not_helpful`),children:_.needsFix})]}),(0,V.jsx)(Le,{evidence:X.evidence,projectId:b.task.projectId,conversationId:Z??void 0,language:l}),b.receipts.length>1?(0,V.jsxs)(`details`,{className:`mt-4 border-t border-edge-subtle pt-4`,children:[(0,V.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted hover:text-fg`,children:_.executionHistory.replace(`{{count}}`,String(b.receipts.length-1))}),(0,V.jsx)(`div`,{className:`mt-3 space-y-3`,children:b.receipts.slice(1).map(e=>(0,V.jsx)(`article`,{className:`rounded-lg bg-surface-hover p-3`,children:(0,V.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,V.jsx)(`p`,{className:`text-sm text-fg`,children:e.summary}),(0,V.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:_.receiptStatuses[e.status]})]})},e.runId))})]}):null]}):null,b.context.length>0?(0,V.jsxs)(`section`,{className:v(`p-5`,Q(`context`)&&`task-detail-live-update`),children:[(0,V.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:_.contextUsed}),(0,V.jsx)(`ul`,{className:`mt-4 grid gap-2 sm:grid-cols-2`,children:b.context.map(e=>(0,V.jsxs)(`li`,{className:`min-w-0 rounded-lg bg-surface-hover p-2.5`,children:[(0,V.jsxs)(`span`,{className:`text-[11px] text-fg-subtle`,children:[_.contextRoleLabels[e.role],` · `,_.contextKindLabels[e.targetKind]]}),e.targetKind===`url`&&/^https?:\/\//.test(e.targetId)?(0,V.jsx)(`a`,{className:`mt-1 block break-all text-sm text-accent hover:underline`,href:e.targetId,target:`_blank`,rel:`noreferrer`,children:e.title??e.targetId}):(0,V.jsx)(`p`,{className:`mt-1 break-words text-sm text-fg`,children:e.title??e.targetId})]},e.id))})]}):null]}),(0,V.jsxs)(`aside`,{className:`min-w-0 overflow-hidden rounded-xl bg-surface-panel shadow-surface divide-y divide-edge-subtle`,children:[(0,V.jsxs)(`section`,{className:v(`p-5`,Q(`phase`,`resolution`,`priority`,`dueAt`,`delegateAgentId`)&&`task-detail-live-update`),children:[(0,V.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:_.taskProperties}),(0,V.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[(0,V.jsx)(qe,{value:b.task.phase,disabled:R.has(`phase`),canMove:fn,canApprove:Qt,canReopen:$t,language:l,label:_.taskPhase,onChange:Mt}),(0,V.jsx)(Je,{value:b.task.priority,disabled:R.has(`priority`),label:_.priority,labels:_.priorityLabels,onChange:Nt}),(0,V.jsx)(Ye,{value:Ue(b.task.dueAt),disabled:R.has(`dueAt`),label:_.dueDate,onChange:Pt}),(0,V.jsx)(Xe,{value:b.conversation.currentExecutorAgentId??``,disabled:R.has(`delegateAgentId`),label:_.executorLabel,unassignedLabel:_.unassigned,agents:Ge,onChange:zt})]})]}),(0,V.jsxs)(`section`,{className:v(`p-5`,Q(`dependencies`)&&`task-detail-live-update`),children:[(0,V.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:_.taskRelations}),(0,V.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:_.dependencies}),(0,V.jsx)(Ze,{candidates:Fe,selected:b.dependencies,disabled:R.has(`dependencies`),labels:Et,getTaskHref:kt,onChange:Rt})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:_.dependents}),b.dependents.length>0?(0,V.jsx)(`div`,{className:`space-y-1.5`,children:b.dependents.map(e=>(0,V.jsx)(c,{to:kt(e.id),className:`block rounded-lg bg-surface-hover p-2.5 text-sm text-fg-muted transition-colors hover:text-fg`,children:e.title},e.id))}):(0,V.jsx)(`p`,{className:`text-sm text-fg-subtle`,children:_.noDependents})]})]})]})]})]})]}),(0,V.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":l===`zh`?`调整任务信息和 Agent 对话的宽度`:`Resize task details and Agent chat`,"aria-valuemin":30,"aria-valuemax":60,"aria-valuenow":Math.round(G),tabIndex:0,onPointerDown:Lt,onKeyDown:It,onDoubleClick:()=>Ft($e),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 ${dt?`bg-surface-hover`:``}`,children:(0,V.jsx)(`div`,{className:`my-3 w-px rounded-full bg-edge-strong/70 transition-colors group-hover:bg-accent group-focus-visible:bg-accent`})}),(0,V.jsxs)(`aside`,{className:`flex min-h-[34rem] min-w-0 flex-col bg-surface-panel lg:min-h-0 lg:w-[var(--task-chat-panel-width)] lg:shrink-0`,children:[(0,V.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-3 bg-surface-subtle px-4 py-3.5`,children:[(0,V.jsx)(`div`,{className:`min-w-0`,children:(0,V.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[en?(0,V.jsx)(k,{agentId:en,avatar:tn?.avatar,size:28,className:`shrink-0`}):null,(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:l===`zh`?`Agent 执行与对话`:`Agent execution and chat`}),(0,V.jsxs)(`p`,{className:`mt-0.5 truncate text-xs text-fg-muted`,children:[tn?.name??en??_.unassigned,` · `,Wt]})]})]})}),t===`modal`?gn:null]}),Z?(0,V.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,V.jsx)(De,{embedded:!0,conversationId:Z,taskId:e})}):_e?(0,V.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,V.jsxs)(`div`,{className:`max-w-xs`,children:[(0,V.jsx)(g,{className:`mx-auto size-8 animate-pulse text-fg-subtle`}),(0,V.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:l===`zh`?`正在创建任务会话`:`Creating task conversation`})]})}):be?(0,V.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,V.jsxs)(`div`,{className:`max-w-xs`,children:[(0,V.jsx)(g,{className:`mx-auto size-8 text-danger`}),(0,V.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:l===`zh`?`任务会话创建失败`:`Could not create task conversation`}),(0,V.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:be instanceof Error?be.message:String(be)})]})}):(0,V.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,V.jsxs)(`div`,{className:`max-w-xs`,children:[(0,V.jsx)(g,{className:`mx-auto size-8 text-fg-subtle`}),(0,V.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:l===`zh`?`等待任务会话`:`Waiting for a task conversation`}),(0,V.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:l===`zh`?`安排或开始任务后,Agent 的执行过程和持续对话会显示在这里。`:`Schedule or start the task to see the agent run and continue the conversation here.`})]})})]}),(0,V.jsx)(ve,{open:wt,title:_.deleteTaskTitle,description:_.deleteTaskDescription.replace(`{{title}}`,b.task.title),confirmLabel:_.confirmDeleteTask,cancelLabel:_.keepTask,destructive:!0,onConfirm:()=>{Tt(!1),Bt()},onCancel:()=>Tt(!1)})]})}function U(){let e=(0,z.c)(2),{taskId:t}=s(),n=t===void 0?``:t,r;return e[0]===n?r=e[1]:(r=(0,V.jsx)(it,{taskId:n,presentation:`page`}),e[0]=n,e[1]=r),r}function at(e){let t=(0,z.c)(58),{taskId:n,backgroundPath:r,onClose:i}=e,a=te(pt),{data:o}=Me(n),s=o?.conversation.activeConversationId??null,l=I(ft),u=I(dt),d=I(ut),p=I(G),m=Oe(lt),h=Te(ct),g=Te(W),ee=l?u:0,y;t[0]!==i||t[1]!==g?(y=e=>{e||(g(null),i())},t[0]=i,t[1]=g,t[2]=y):y=t[2];let b=a===`zh`?`关闭任务详情`:`Close task details`,x;t[3]!==i||t[4]!==g?(x=()=>{g(null),i()},t[3]=i,t[4]=g,t[5]=x):x=t[5];let S;t[6]!==b||t[7]!==x?(S=(0,V.jsx)(`button`,{type:`button`,tabIndex:-1,"data-task-modal-backdrop":!0,className:`fixed inset-0 z-[80] bg-black/45 backdrop-blur-[1px]`,"aria-label":b,onClick:x}),t[6]=b,t[7]=x,t[8]=S):S=t[8];let ce=l?`true`:`false`,C=`${ee/2}px`,le=`${ee}px`,ue;t[9]!==C||t[10]!==le?(ue={"--task-detail-workspace-offset":C,"--task-detail-workspace-width":le},t[9]=C,t[10]=le,t[11]=ue):ue=t[11];let pe=ue,me=a===`zh`?`任务详情`:`Task details`,w;t[12]===me?w=t[13]:(w=(0,V.jsx)(oe,{className:`font-medium text-fg`,children:me}),t[12]=me,t[13]=w);let he=a===`zh`?`查看并操作任务详情`:`View and manage task details`,T;t[14]===he?T=t[15]:(T=(0,V.jsx)(ne,{className:`sr-only`,children:he}),t[14]=he,t[15]=T);let E;t[16]!==s||t[17]!==a||t[18]!==p||t[19]!==m||t[20]!==n||t[21]!==d||t[22]!==l?(E=s?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`button`,{type:`button`,className:v(`flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,l&&d===s&&`bg-surface-hover text-fg`),"aria-label":a===`zh`?`项目文件`:`Project files`,title:a===`zh`?`项目文件`:`Project files`,"aria-pressed":l&&d===s,onClick:()=>{m(s,!1),p(s)},children:(0,V.jsx)(fe,{className:`size-4`,"aria-hidden":!0})}),(0,V.jsx)(c,{to:de(n),className:`flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":a===`zh`?`全屏打开对话`:`Open chat full screen`,title:a===`zh`?`全屏打开对话`:`Open chat full screen`,children:(0,V.jsx)(f,{className:`size-4`,"aria-hidden":!0})})]}):null,t[16]=s,t[17]=a,t[18]=p,t[19]=m,t[20]=n,t[21]=d,t[22]=l,t[23]=E):E=t[23];let D=a===`zh`?`关闭任务详情`:`Close task details`,ge;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,V.jsx)(_,{className:`size-4`,"aria-hidden":!0}),t[24]=ge):ge=t[24];let O;t[25]===D?O=t[26]:(O=(0,V.jsx)(re,{className:`flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":D,children:ge}),t[25]=D,t[26]=O);let k;t[27]!==E||t[28]!==O?(k=(0,V.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[E,O]}),t[27]=E,t[28]=O,t[29]=k):k=t[29];let A;t[30]!==w||t[31]!==T||t[32]!==k?(A=(0,V.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-3 bg-surface-panel px-5 py-3.5`,children:[w,T,k]}),t[30]=w,t[31]=T,t[32]=k,t[33]=A):A=t[33];let j;t[34]!==i||t[35]!==g?(j=()=>{g(null),i()},t[34]=i,t[35]=g,t[36]=j):j=t[36];let M;t[37]!==r||t[38]!==j||t[39]!==n?(M=(0,V.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,V.jsx)(it,{taskId:n,presentation:`modal`,backgroundPath:r,onDeleted:j})}),t[37]=r,t[38]=j,t[39]=n,t[40]=M):M=t[40];let N;t[41]!==A||t[42]!==M||t[43]!==ce||t[44]!==pe?(N=(0,V.jsxs)(ae,{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":ce,style:pe,onEscapeKeyDown:st,onInteractOutside:ot,children:[A,M]}),t[41]=A,t[42]=M,t[43]=ce,t[44]=pe,t[45]=N):N=t[45];let P;t[46]!==h||t[47]!==d||t[48]!==l||t[49]!==u?(P=h?(0,V.jsx)(`div`,{className:`fixed inset-y-0 left-0 z-[100] flex min-h-0 min-w-0 overflow-hidden bg-surface-panel transition-[right] duration-200 ease-out motion-reduce:transition-none`,style:{right:l?u:0},children:(0,V.jsx)(_e,{allowOutsideChat:!0,conversationId:d??void 0})}):null,t[46]=h,t[47]=d,t[48]=l,t[49]=u,t[50]=P):P=t[50];let F;t[51]!==N||t[52]!==P||t[53]!==S?(F=(0,V.jsxs)(ie,{children:[S,N,P]}),t[51]=N,t[52]=P,t[53]=S,t[54]=F):F=t[54];let ve;return t[55]!==y||t[56]!==F?(ve=(0,V.jsx)(se,{modal:!1,open:!0,onOpenChange:y,children:F}),t[55]=y,t[56]=F,t[57]=ve):ve=t[57],ve}function ot(e){let t=e.detail.originalEvent.target;t instanceof Element&&t.closest(`#app-workspace-panel, [data-task-modal-backdrop]`)&&e.preventDefault()}function st(e){let t=e.target;t instanceof HTMLElement&&t.closest(`[data-task-inline-editor]`)&&e.preventDefault()}function W(e){return e.setPath}function ct(e){return e.path}function lt(e){return e.setOpen}function G(e){return e.openForSession}function ut(e){return e.conversationIdOverride}function dt(e){return e.widthPx}function ft(e){return e.open}function pt(e){return e.language}function mt(e){return(0,V.jsx)(u,{value:e.id,children:e.name||e.id},e.id)}function ht(e){return e.id}export{at as TaskDetailModal,U as TaskDetailPage};
|
|
@@ -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"./external-link-DjqjBmc3.js";import{t as a}from"./globe-DSSGFWFn.js";import{t as o}from"./loader-circle-CifKLtgG.js";import{t as s}from"./cn-JdwAhgNB.js";import{a as c,c as l,i as u,n as d,r as f}from"./locale-store-eliqUnBr.js";import{t as ee}from"./messages-NYDOR8-j.js";import{i as p}from"./vendor-swr-BIWyz7Rc.js";import{t as te}from"./button-CGlRPNzi.js";import{n as m,r as h}from"./gateway-config-swr-BBovMBQ1.js";import{t as g}from"./skeleton-BwbyijEw.js";import{Ao as _,Ii as v,Pc as y,yo as b}from"./index-DTDDJnrO.js";import{n as ne,t as re}from"./settings-form-section-nZ0L21U5.js";var x=e(t(),1),S=n(),C=r();function w(e){let t=(0,S.c)(10),{language:n,label:r,section:a,className:o}=e,c;t[0]!==n||t[1]!==a?(c=b(n,a),t[0]=n,t[1]=a,t[2]=c):c=t[2];let l;t[3]===o?l=t[4]:(l=s(`inline-flex items-center gap-1 text-sm font-medium text-accent hover:underline`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,o),t[3]=o,t[4]=l);let u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,C.jsx)(i,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),t[5]=u):u=t[5];let d;return t[6]!==r||t[7]!==c||t[8]!==l?(d=(0,C.jsxs)(`a`,{href:c,target:`_blank`,rel:`noreferrer`,className:l,children:[r,u]}),t[6]=r,t[7]=c,t[8]=l,t[9]=d):d=t[9],d}async function T(){let e=await u(`/api/exposure/status`);if(!e.ok)throw Error(`Failed to load exposure status (${e.status})`);return await e.json()}async function E(e=`serve`){let t=await u(`/api/exposure/tailscale/start`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({mode:e})});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error??`Start failed (${t.status})`)}return await t.json()}async function D(){let e=await u(`/api/exposure/tailscale/stop`,{method:`POST`});if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t.error??`Stop failed (${e.status})`)}return await e.json()}var O=`https://tailscale.com/download`;function k(e){let t=(0,S.c)(2),{label:n}=e,r;return t[0]===n?r=t[1]:(r=(0,C.jsx)(`a`,{href:O,target:`_blank`,rel:`noreferrer`,className:`font-medium text-accent hover:underline`,children:n}),t[0]=n,t[1]=r),r}function A({embedded:e=!1}){let t=d(e=>e.language),n=ee(t).remoteAccess.tailscale,r=(0,x.useMemo)(()=>({copy:n.copyUrl,copied:n.copied,copyFailed:ee(t).clipboard.copyFailed}),[t,n.copyUrl,n.copied]),i=!!l(e=>e.conversationId),[s,c]=(0,x.useState)(!1),[u,f]=(0,x.useState)(null),{data:m,mutate:h,isLoading:_}=p(i?`exposure-status`:null,T,{refreshInterval:3e4}),b=m?.tailscale.hostname,S=m?.tailscale.active===!0,O=m?.tailscale.cliAvailable!==!1,A=b?`https://${b}/`:null,ie=(0,x.useCallback)(async()=>{c(!0),f(null);try{await E(`serve`),await h()}catch(e){f(e instanceof Error?e.message:String(e))}finally{c(!1)}},[h]),ae=(0,x.useCallback)(async()=>{c(!0),f(null);try{await D(),await h()}catch(e){f(e instanceof Error?e.message:String(e))}finally{c(!1)}},[h]);if(!i)return null;let j=(0,C.jsxs)(`div`,{className:e?`space-y-4`:`mt-4 space-y-3`,children:[e?(0,C.jsxs)(`ol`,{className:`space-y-3 text-sm text-fg-muted`,children:[(0,C.jsxs)(`li`,{className:`flex gap-2`,children:[(0,C.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center rounded-full bg-surface-hover text-xs font-semibold text-fg`,children:`1`}),(0,C.jsxs)(`span`,{children:[n.stepInstallBefore,(0,C.jsx)(k,{label:n.stepInstallLink}),n.stepInstallAfter]})]}),(0,C.jsxs)(`li`,{className:`flex gap-2`,children:[(0,C.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center rounded-full bg-surface-hover text-xs font-semibold text-fg`,children:`2`}),(0,C.jsx)(`span`,{children:n.stepEnable})]}),(0,C.jsxs)(`li`,{className:`flex gap-2`,children:[(0,C.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center rounded-full bg-surface-hover text-xs font-semibold text-fg`,children:`3`}),(0,C.jsx)(`span`,{children:n.stepCopy})]})]}):null,e&&m?.tailscale.cliAvailable===!1?(0,C.jsxs)(`p`,{className:`rounded-lg border border-amber-500/25 bg-amber-500/5 px-3 py-2 text-sm text-fg-muted`,children:[n.cliMissingIntro,` `,(0,C.jsx)(k,{label:n.cliMissingDownloadLink}),n.cliMissingSuffix]}):null,_&&!m?(0,C.jsxs)(`div`,{className:`grid gap-3`,"aria-busy":`true`,children:[(0,C.jsx)(g,{className:`h-20 rounded-lg`}),(0,C.jsx)(g,{className:`h-20 rounded-lg`})]}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(re,{children:[(0,C.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:n.statusLabel}),(0,C.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:S?n.statusActive:n.statusOff}),A?(0,C.jsx)(`div`,{className:`mt-3`,children:(0,C.jsx)(v,{text:A,labels:r})}):null,u?(0,C.jsx)(`p`,{className:`mt-2 text-sm text-red-600 dark:text-red-400`,children:u}):null,(0,C.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:S?(0,C.jsxs)(te,{type:`button`,variant:`secondary`,disabled:s,onClick:()=>void ae(),children:[s?(0,C.jsx)(o,{className:`mr-1 size-4 animate-spin`}):null,n.disableServe]}):(0,C.jsxs)(te,{type:`button`,disabled:s||!O,onClick:()=>void ie(),children:[s?(0,C.jsx)(o,{className:`mr-1 size-4 animate-spin`}):(0,C.jsx)(y,{className:`mr-1 size-4`}),n.enableServe]})})]}),(0,C.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.hint}),(0,C.jsx)(w,{language:t,label:n.docsLink,section:`tailscale-serve`,className:`mt-2`})]})]});return e?j:(0,C.jsxs)(re,{children:[(0,C.jsx)(ne,{icon:a,title:n.title,subtitle:n.subtitle}),j]})}async function ie(e){let t=await u(f(`/api/tunnel/probe-public`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({url:e})});if(!t.ok&&t.status!==400)throw Error(`Probe failed (${t.status})`);return await t.json()}async function ae(e){await c(f(`/api/config`),{method:`PATCH`,body:JSON.stringify({gateway:{publicUrl:e??null}})})}function j(e){let t=e.split(`.`).map(e=>Number.parseInt(e,10));if(t.length!==4||t.some(e=>!Number.isFinite(e)))return!1;let[n,r]=t;return n===10||n===127||n===169&&r===254||n===172&&r>=16&&r<=31||n===192&&r===168||n===100&&r>=64&&r<=127}function oe(){return(0,x.useMemo)(()=>{if(typeof window>`u`)return null;let{protocol:e,hostname:t,origin:n}=window.location;if(e!==`https:`&&e!==`http:`)return null;let r=t.toLowerCase();return!r||r===`localhost`||r===`127.0.0.1`||r===`::1`||r===`[::1]`||r.endsWith(`.local`)||r.endsWith(`.localhost`)||j(r)?null:n.toLowerCase().replace(/\/+$/,``)},[])}function se(){return s(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,_,`dark:border-edge`)}function ce(e){if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e.gateway;if(!t||typeof t!=`object`||Array.isArray(t))return null;let n=t.publicUrl;return typeof n==`string`&&n.trim()?n.trim():null}function M(){let e=(0,S.c)(85),t=d(ue),n;e[0]===t?n=e[1]:(n=ee(t),e[0]=t,e[1]=n);let r=n.remoteAccess.reverseProxy,i=!!l(le),c=oe(),u=h(i).data?.payload?.config,f;e[2]===u?f=e[3]:(f=ce(u),e[2]=u,e[3]=f);let p=f,[g,_]=(0,x.useState)(``),v;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(v={busy:!1,result:null},e[4]=v):v=e[4];let[y,b]=(0,x.useState)(v),w;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(w={busy:!1,error:null},e[5]=w):w=e[5];let[T,E]=(0,x.useState)(w),D,O;e[6]!==p||e[7]!==c||e[8]!==g?(D=()=>{g||(p?_(p):c&&_(c))},O=[p,c,g],e[6]=p,e[7]=c,e[8]=g,e[9]=D,e[10]=O):(D=e[9],O=e[10]),(0,x.useEffect)(D,O);let k;bb0:{let t;e[11]===g?t=e[12]:(t=g.trim(),e[11]=g,e[12]=t);let n=t;if(n){k=n;break bb0}k=p??c??``}let A=k,j=!p&&!!c&&A===c,M;e[13]!==g||e[14]!==A?(M=async()=>{let e=g.trim()||A;if(e){b({busy:!0,result:null});try{b({busy:!1,result:await ie(e)})}catch(e){let t=e;b({busy:!1,result:{ok:!1,code:`NETWORK_ERROR`,message:t instanceof Error?t.message:String(t)}})}}},e[13]=g,e[14]=A,e[15]=M):M=e[15];let fe=M,N;e[16]===A?N=e[17]:(N=async()=>{let e=A.trim();if(e){E({busy:!0,error:null});try{await ae(e),await m(),E({busy:!1,error:null})}catch(e){let t=e;E({busy:!1,error:t instanceof Error?t.message:String(t)})}}},e[16]=A,e[17]=N);let pe=N,P;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(P=async()=>{E({busy:!0,error:null});try{await ae(null),await m(),_(``),b({busy:!1,result:null}),E({busy:!1,error:null})}catch(e){let t=e;E({busy:!1,error:t instanceof Error?t.message:String(t)})}},e[18]=P):P=e[18];let me=P;if(!i)return null;let F;e[19]!==r.subtitle||e[20]!==r.title?(F=(0,C.jsx)(ne,{icon:a,title:r.title,subtitle:r.subtitle}),e[19]=r.subtitle,e[20]=r.title,e[21]=F):F=e[21];let I;e[22]===r.urlLabel?I=e[23]:(I=(0,C.jsx)(`label`,{className:`text-sm font-medium text-fg`,htmlFor:`reverse-proxy-url`,children:r.urlLabel}),e[22]=r.urlLabel,e[23]=I);let L;e[24]===Symbol.for(`react.memo_cache_sentinel`)?(L=s(se(),`font-mono text-xs sm:flex-1 sm:min-w-0 sm:w-auto`),e[24]=L):L=e[24];let R;e[25]===Symbol.for(`react.memo_cache_sentinel`)?(R=e=>{_(e.target.value),b({busy:!1,result:null})},e[25]=R):R=e[25];let z;e[26]!==g||e[27]!==r.urlPlaceholder||e[28]!==L?(z=(0,C.jsx)(`input`,{id:`reverse-proxy-url`,className:L,type:`text`,autoComplete:`off`,spellCheck:!1,placeholder:r.urlPlaceholder,value:g,onChange:R}),e[26]=g,e[27]=r.urlPlaceholder,e[28]=L,e[29]=z):z=e[29];let B;e[30]===fe?B=e[31]:(B=()=>void fe(),e[30]=fe,e[31]=B);let V;e[32]!==g||e[33]!==y.busy?(V=y.busy||!g.trim(),e[32]=g,e[33]=y.busy,e[34]=V):V=e[34];let H;e[35]===y.busy?H=e[36]:(H=y.busy?(0,C.jsx)(o,{className:`size-3.5 animate-spin`}):null,e[35]=y.busy,e[36]=H);let he=y.busy?r.probing:r.probeButton,U;e[37]!==B||e[38]!==V||e[39]!==H||e[40]!==he?(U=(0,C.jsxs)(te,{type:`button`,variant:`secondary`,className:`shrink-0 whitespace-nowrap`,onClick:B,disabled:V,children:[H,he]}),e[37]=B,e[38]=V,e[39]=H,e[40]=he,e[41]=U):U=e[41];let W;e[42]!==z||e[43]!==U?(W=(0,C.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-stretch`,children:[z,U]}),e[42]=z,e[43]=U,e[44]=W):W=e[44];let G;e[45]===r.urlHint?G=e[46]:(G=(0,C.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:r.urlHint}),e[45]=r.urlHint,e[46]=G);let K;e[47]!==c||e[48]!==j||e[49]!==r.autoDetectedHint||e[50]!==r.autoDetectedTitle?(K=j&&c?(0,C.jsxs)(`div`,{className:`rounded-lg border border-accent/40 bg-accent-soft/50 px-3 py-2 text-xs leading-relaxed text-accent-fg`,children:[(0,C.jsx)(`div`,{className:`font-medium`,children:r.autoDetectedTitle}),(0,C.jsx)(`div`,{className:`mt-1 break-all font-mono text-[11px]`,children:c}),(0,C.jsx)(`p`,{className:`mt-1`,children:r.autoDetectedHint})]}):null,e[47]=c,e[48]=j,e[49]=r.autoDetectedHint,e[50]=r.autoDetectedTitle,e[51]=K):K=e[51];let q;e[52]!==y.result||e[53]!==r.probeStatus?(q=y.result?(0,C.jsx)(de,{result:y.result,labels:r.probeStatus}):null,e[52]=y.result,e[53]=r.probeStatus,e[54]=q):q=e[54];let J;e[55]!==p||e[56]!==A||e[57]!==pe||e[58]!==r.saveAsDefault||e[59]!==r.saving||e[60]!==T.busy?(J=A&&p!==A?(0,C.jsxs)(te,{type:`button`,onClick:()=>void pe(),disabled:T.busy,children:[T.busy?(0,C.jsx)(o,{className:`size-3.5 animate-spin`}):null,T.busy?r.saving:r.saveAsDefault]}):null,e[55]=p,e[56]=A,e[57]=pe,e[58]=r.saveAsDefault,e[59]=r.saving,e[60]=T.busy,e[61]=J):J=e[61];let Y;e[62]!==p||e[63]!==r.clear||e[64]!==T.busy?(Y=p?(0,C.jsx)(te,{type:`button`,variant:`ghost`,onClick:()=>void me(),disabled:T.busy,children:r.clear}):null,e[62]=p,e[63]=r.clear,e[64]=T.busy,e[65]=Y):Y=e[65];let X;e[66]!==J||e[67]!==Y?(X=(0,C.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:flex-wrap`,children:[J,Y]}),e[66]=J,e[67]=Y,e[68]=X):X=e[68];let Z;e[69]===T.error?Z=e[70]:(Z=T.error?(0,C.jsx)(`p`,{className:`text-xs text-red-800 dark:text-red-200`,children:T.error}):null,e[69]=T.error,e[70]=Z);let Q;e[71]===r.certWarning?Q=e[72]:(Q=(0,C.jsx)(`div`,{className:`rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-xs leading-relaxed text-amber-950 dark:border-amber-800/60 dark:bg-amber-950/30 dark:text-amber-100`,children:r.certWarning}),e[71]=r.certWarning,e[72]=Q);let $;e[73]!==I||e[74]!==W||e[75]!==G||e[76]!==K||e[77]!==q||e[78]!==X||e[79]!==Z||e[80]!==Q?($=(0,C.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[I,W,G,K,q,X,Z,Q]}),e[73]=I,e[74]=W,e[75]=G,e[76]=K,e[77]=q,e[78]=X,e[79]=Z,e[80]=Q,e[81]=$):$=e[81];let ge;return e[82]!==F||e[83]!==$?(ge=(0,C.jsx)(`div`,{className:`flex flex-col gap-4`,children:(0,C.jsxs)(re,{children:[F,$]})}),e[82]=F,e[83]=$,e[84]=ge):ge=e[84],ge}function le(e){return e.conversationId}function ue(e){return e.language}function de(e){let t=(0,S.c)(18),{result:n,labels:r}=e;if(n.ok){let e;t[0]===r.ok?e=t[1]:(e=(0,C.jsx)(`span`,{className:`font-medium`,children:r.ok}),t[0]=r.ok,t[1]=e);let i;t[2]===n.latencyMs?i=t[3]:(i=(0,C.jsxs)(`span`,{className:`font-mono`,children:[n.latencyMs,`ms`]}),t[2]=n.latencyMs,t[3]=i);let a;t[4]!==r.gatewayReady||t[5]!==n.gatewayReady?(a=n.gatewayReady?(0,C.jsxs)(C.Fragment,{children:[` · `,(0,C.jsx)(`span`,{children:r.gatewayReady})]}):null,t[4]=r.gatewayReady,t[5]=n.gatewayReady,t[6]=a):a=t[6];let o;return t[7]!==e||t[8]!==i||t[9]!==a?(o=(0,C.jsxs)(`div`,{className:`rounded-lg border border-emerald-200 bg-emerald-50 px-3 py-2 text-xs text-emerald-900 dark:border-emerald-800/60 dark:bg-emerald-950/30 dark:text-emerald-100`,children:[e,` · `,i,a]}),t[7]=e,t[8]=i,t[9]=a,t[10]=o):o=t[10],o}let i=r[`code_${n.code}`]??r.codeUnknown,a;t[11]===i?a=t[12]:(a=(0,C.jsx)(`span`,{className:`font-medium`,children:i}),t[11]=i,t[12]=a);let o;t[13]===n.message?o=t[14]:(o=n.message?(0,C.jsxs)(C.Fragment,{children:[` — `,(0,C.jsx)(`span`,{className:`font-mono break-all`,children:n.message})]}):null,t[13]=n.message,t[14]=o);let s;return t[15]!==a||t[16]!==o?(s=(0,C.jsxs)(`div`,{className:`rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-xs text-red-900 dark:border-red-800/60 dark:bg-red-950/30 dark:text-red-100`,children:[a,o]}),t[15]=a,t[16]=o,t[17]=s):s=t[17],s}async function fe(){return(await c(f(`/api/devices`))).devices}async function N(){let e=await c(f(`/api/device-pairing/readiness`));return{ready:e.ready,routes:e.routes,protocolVersion:e.protocolVersion}}async function pe(e){try{return{kind:`ready`,setup:(await c(f(`/api/device-pairing/setups`),{method:`POST`,body:JSON.stringify({targetKind:e})})).setup}}catch(e){if(e.body?.error?.code===`NO_SECURE_ROUTE`)return{kind:`needs-secure-route`};throw e}}async function P(e){return c(f(`/api/device-pairing/setups/${encodeURIComponent(e)}`))}async function me(e){await c(f(`/api/device-pairing/setups/${encodeURIComponent(e)}`),{method:`DELETE`})}async function F(e,t){await c(f(`/api/device-pairing/requests/${encodeURIComponent(e.requestId)}/decision`),{method:`POST`,body:JSON.stringify({decision:t,expectedRevision:e.revision})})}async function I(e){await c(f(`/api/devices/${encodeURIComponent(e)}`),{method:`DELETE`})}async function L(){let e=await u(f(`/api/browser/extension/archive`));if(!e.ok)throw Error(`Browser extension download failed (${e.status})`);let t=e.headers.get(`Content-Disposition`)??``,n=/filename="([^"]+)"/.exec(t)?.[1]??`xopc-browser-extension.zip`,r=URL.createObjectURL(await e.blob());try{let e=document.createElement(`a`);e.href=r,e.download=n,e.click()}finally{URL.revokeObjectURL(r)}}var R=`https://console.xopc.ai/access/client`;function z(e){if(!e||typeof e!=`object`)return;let t=e.body;if(!t||typeof t!=`object`)return;let n=t.error;if(!n||typeof n!=`object`)return;let r=n.code;return typeof r==`string`?r:void 0}function B(e){return[`tunnel_oauth_required`,`invalid_token`,`insufficient_scope`].includes(z(e)??``)}async function V(){return c(f(`/api/tunnel/status`))}async function H(){await c(f(`/api/tunnel/consent`),{method:`POST`,body:JSON.stringify({})})}async function he(){await c(f(`/api/tunnel/registration-key`),{method:`POST`,body:JSON.stringify({})})}async function U(){return c(f(`/api/tunnel/start`),{method:`POST`,body:JSON.stringify({})})}async function W(e){return c(f(`/api/tunnel/stop`),{method:`POST`,body:JSON.stringify({release:e?.release===!0})})}async function G(){let e=(await c(f(`/api/tunnel/reveal-registration-secret`),{method:`POST`,body:JSON.stringify({})})).payload;if(!e)throw Error(`Missing reveal payload`);return{registrationSecret:e.registrationSecret??null,source:e.source===`config`?`config`:`none`}}async function K(e){await c(f(`/api/config`),{method:`PATCH`,body:JSON.stringify({tunnel:e})})}export{w as S,P as _,H as a,A as b,W as c,me as d,pe as f,N as g,fe as h,he as i,z as l,L as m,V as n,G as o,F as p,K as r,U as s,R as t,B as u,I as v,T as x,M as y};
|
|
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"./external-link-DjqjBmc3.js";import{t as a}from"./globe-DSSGFWFn.js";import{t as o}from"./loader-circle-CifKLtgG.js";import{t as s}from"./cn-JdwAhgNB.js";import{a as c,c as l,i as u,n as d,r as f}from"./locale-store-eliqUnBr.js";import{t as ee}from"./messages-NYDOR8-j.js";import{i as p}from"./vendor-swr-BIWyz7Rc.js";import{t as te}from"./button-CGlRPNzi.js";import{n as m,r as h}from"./gateway-config-swr-BBovMBQ1.js";import{t as g}from"./skeleton-BwbyijEw.js";import{Ao as _,Ii as v,Pc as y,yo as b}from"./index-CEkw-fGy.js";import{n as ne,t as re}from"./settings-form-section-Dzhqip3r.js";var x=e(t(),1),S=n(),C=r();function w(e){let t=(0,S.c)(10),{language:n,label:r,section:a,className:o}=e,c;t[0]!==n||t[1]!==a?(c=b(n,a),t[0]=n,t[1]=a,t[2]=c):c=t[2];let l;t[3]===o?l=t[4]:(l=s(`inline-flex items-center gap-1 text-sm font-medium text-accent hover:underline`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,o),t[3]=o,t[4]=l);let u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,C.jsx)(i,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),t[5]=u):u=t[5];let d;return t[6]!==r||t[7]!==c||t[8]!==l?(d=(0,C.jsxs)(`a`,{href:c,target:`_blank`,rel:`noreferrer`,className:l,children:[r,u]}),t[6]=r,t[7]=c,t[8]=l,t[9]=d):d=t[9],d}async function T(){let e=await u(`/api/exposure/status`);if(!e.ok)throw Error(`Failed to load exposure status (${e.status})`);return await e.json()}async function E(e=`serve`){let t=await u(`/api/exposure/tailscale/start`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({mode:e})});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error??`Start failed (${t.status})`)}return await t.json()}async function D(){let e=await u(`/api/exposure/tailscale/stop`,{method:`POST`});if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t.error??`Stop failed (${e.status})`)}return await e.json()}var O=`https://tailscale.com/download`;function k(e){let t=(0,S.c)(2),{label:n}=e,r;return t[0]===n?r=t[1]:(r=(0,C.jsx)(`a`,{href:O,target:`_blank`,rel:`noreferrer`,className:`font-medium text-accent hover:underline`,children:n}),t[0]=n,t[1]=r),r}function A({embedded:e=!1}){let t=d(e=>e.language),n=ee(t).remoteAccess.tailscale,r=(0,x.useMemo)(()=>({copy:n.copyUrl,copied:n.copied,copyFailed:ee(t).clipboard.copyFailed}),[t,n.copyUrl,n.copied]),i=!!l(e=>e.conversationId),[s,c]=(0,x.useState)(!1),[u,f]=(0,x.useState)(null),{data:m,mutate:h,isLoading:_}=p(i?`exposure-status`:null,T,{refreshInterval:3e4}),b=m?.tailscale.hostname,S=m?.tailscale.active===!0,O=m?.tailscale.cliAvailable!==!1,A=b?`https://${b}/`:null,ie=(0,x.useCallback)(async()=>{c(!0),f(null);try{await E(`serve`),await h()}catch(e){f(e instanceof Error?e.message:String(e))}finally{c(!1)}},[h]),ae=(0,x.useCallback)(async()=>{c(!0),f(null);try{await D(),await h()}catch(e){f(e instanceof Error?e.message:String(e))}finally{c(!1)}},[h]);if(!i)return null;let j=(0,C.jsxs)(`div`,{className:e?`space-y-4`:`mt-4 space-y-3`,children:[e?(0,C.jsxs)(`ol`,{className:`space-y-3 text-sm text-fg-muted`,children:[(0,C.jsxs)(`li`,{className:`flex gap-2`,children:[(0,C.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center rounded-full bg-surface-hover text-xs font-semibold text-fg`,children:`1`}),(0,C.jsxs)(`span`,{children:[n.stepInstallBefore,(0,C.jsx)(k,{label:n.stepInstallLink}),n.stepInstallAfter]})]}),(0,C.jsxs)(`li`,{className:`flex gap-2`,children:[(0,C.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center rounded-full bg-surface-hover text-xs font-semibold text-fg`,children:`2`}),(0,C.jsx)(`span`,{children:n.stepEnable})]}),(0,C.jsxs)(`li`,{className:`flex gap-2`,children:[(0,C.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center rounded-full bg-surface-hover text-xs font-semibold text-fg`,children:`3`}),(0,C.jsx)(`span`,{children:n.stepCopy})]})]}):null,e&&m?.tailscale.cliAvailable===!1?(0,C.jsxs)(`p`,{className:`rounded-lg border border-amber-500/25 bg-amber-500/5 px-3 py-2 text-sm text-fg-muted`,children:[n.cliMissingIntro,` `,(0,C.jsx)(k,{label:n.cliMissingDownloadLink}),n.cliMissingSuffix]}):null,_&&!m?(0,C.jsxs)(`div`,{className:`grid gap-3`,"aria-busy":`true`,children:[(0,C.jsx)(g,{className:`h-20 rounded-lg`}),(0,C.jsx)(g,{className:`h-20 rounded-lg`})]}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(re,{children:[(0,C.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:n.statusLabel}),(0,C.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:S?n.statusActive:n.statusOff}),A?(0,C.jsx)(`div`,{className:`mt-3`,children:(0,C.jsx)(v,{text:A,labels:r})}):null,u?(0,C.jsx)(`p`,{className:`mt-2 text-sm text-red-600 dark:text-red-400`,children:u}):null,(0,C.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:S?(0,C.jsxs)(te,{type:`button`,variant:`secondary`,disabled:s,onClick:()=>void ae(),children:[s?(0,C.jsx)(o,{className:`mr-1 size-4 animate-spin`}):null,n.disableServe]}):(0,C.jsxs)(te,{type:`button`,disabled:s||!O,onClick:()=>void ie(),children:[s?(0,C.jsx)(o,{className:`mr-1 size-4 animate-spin`}):(0,C.jsx)(y,{className:`mr-1 size-4`}),n.enableServe]})})]}),(0,C.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.hint}),(0,C.jsx)(w,{language:t,label:n.docsLink,section:`tailscale-serve`,className:`mt-2`})]})]});return e?j:(0,C.jsxs)(re,{children:[(0,C.jsx)(ne,{icon:a,title:n.title,subtitle:n.subtitle}),j]})}async function ie(e){let t=await u(f(`/api/tunnel/probe-public`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({url:e})});if(!t.ok&&t.status!==400)throw Error(`Probe failed (${t.status})`);return await t.json()}async function ae(e){await c(f(`/api/config`),{method:`PATCH`,body:JSON.stringify({gateway:{publicUrl:e??null}})})}function j(e){let t=e.split(`.`).map(e=>Number.parseInt(e,10));if(t.length!==4||t.some(e=>!Number.isFinite(e)))return!1;let[n,r]=t;return n===10||n===127||n===169&&r===254||n===172&&r>=16&&r<=31||n===192&&r===168||n===100&&r>=64&&r<=127}function oe(){return(0,x.useMemo)(()=>{if(typeof window>`u`)return null;let{protocol:e,hostname:t,origin:n}=window.location;if(e!==`https:`&&e!==`http:`)return null;let r=t.toLowerCase();return!r||r===`localhost`||r===`127.0.0.1`||r===`::1`||r===`[::1]`||r.endsWith(`.local`)||r.endsWith(`.localhost`)||j(r)?null:n.toLowerCase().replace(/\/+$/,``)},[])}function se(){return s(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,_,`dark:border-edge`)}function ce(e){if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e.gateway;if(!t||typeof t!=`object`||Array.isArray(t))return null;let n=t.publicUrl;return typeof n==`string`&&n.trim()?n.trim():null}function M(){let e=(0,S.c)(85),t=d(ue),n;e[0]===t?n=e[1]:(n=ee(t),e[0]=t,e[1]=n);let r=n.remoteAccess.reverseProxy,i=!!l(le),c=oe(),u=h(i).data?.payload?.config,f;e[2]===u?f=e[3]:(f=ce(u),e[2]=u,e[3]=f);let p=f,[g,_]=(0,x.useState)(``),v;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(v={busy:!1,result:null},e[4]=v):v=e[4];let[y,b]=(0,x.useState)(v),w;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(w={busy:!1,error:null},e[5]=w):w=e[5];let[T,E]=(0,x.useState)(w),D,O;e[6]!==p||e[7]!==c||e[8]!==g?(D=()=>{g||(p?_(p):c&&_(c))},O=[p,c,g],e[6]=p,e[7]=c,e[8]=g,e[9]=D,e[10]=O):(D=e[9],O=e[10]),(0,x.useEffect)(D,O);let k;bb0:{let t;e[11]===g?t=e[12]:(t=g.trim(),e[11]=g,e[12]=t);let n=t;if(n){k=n;break bb0}k=p??c??``}let A=k,j=!p&&!!c&&A===c,M;e[13]!==g||e[14]!==A?(M=async()=>{let e=g.trim()||A;if(e){b({busy:!0,result:null});try{b({busy:!1,result:await ie(e)})}catch(e){let t=e;b({busy:!1,result:{ok:!1,code:`NETWORK_ERROR`,message:t instanceof Error?t.message:String(t)}})}}},e[13]=g,e[14]=A,e[15]=M):M=e[15];let fe=M,N;e[16]===A?N=e[17]:(N=async()=>{let e=A.trim();if(e){E({busy:!0,error:null});try{await ae(e),await m(),E({busy:!1,error:null})}catch(e){let t=e;E({busy:!1,error:t instanceof Error?t.message:String(t)})}}},e[16]=A,e[17]=N);let pe=N,P;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(P=async()=>{E({busy:!0,error:null});try{await ae(null),await m(),_(``),b({busy:!1,result:null}),E({busy:!1,error:null})}catch(e){let t=e;E({busy:!1,error:t instanceof Error?t.message:String(t)})}},e[18]=P):P=e[18];let me=P;if(!i)return null;let F;e[19]!==r.subtitle||e[20]!==r.title?(F=(0,C.jsx)(ne,{icon:a,title:r.title,subtitle:r.subtitle}),e[19]=r.subtitle,e[20]=r.title,e[21]=F):F=e[21];let I;e[22]===r.urlLabel?I=e[23]:(I=(0,C.jsx)(`label`,{className:`text-sm font-medium text-fg`,htmlFor:`reverse-proxy-url`,children:r.urlLabel}),e[22]=r.urlLabel,e[23]=I);let L;e[24]===Symbol.for(`react.memo_cache_sentinel`)?(L=s(se(),`font-mono text-xs sm:flex-1 sm:min-w-0 sm:w-auto`),e[24]=L):L=e[24];let R;e[25]===Symbol.for(`react.memo_cache_sentinel`)?(R=e=>{_(e.target.value),b({busy:!1,result:null})},e[25]=R):R=e[25];let z;e[26]!==g||e[27]!==r.urlPlaceholder||e[28]!==L?(z=(0,C.jsx)(`input`,{id:`reverse-proxy-url`,className:L,type:`text`,autoComplete:`off`,spellCheck:!1,placeholder:r.urlPlaceholder,value:g,onChange:R}),e[26]=g,e[27]=r.urlPlaceholder,e[28]=L,e[29]=z):z=e[29];let B;e[30]===fe?B=e[31]:(B=()=>void fe(),e[30]=fe,e[31]=B);let V;e[32]!==g||e[33]!==y.busy?(V=y.busy||!g.trim(),e[32]=g,e[33]=y.busy,e[34]=V):V=e[34];let H;e[35]===y.busy?H=e[36]:(H=y.busy?(0,C.jsx)(o,{className:`size-3.5 animate-spin`}):null,e[35]=y.busy,e[36]=H);let he=y.busy?r.probing:r.probeButton,U;e[37]!==B||e[38]!==V||e[39]!==H||e[40]!==he?(U=(0,C.jsxs)(te,{type:`button`,variant:`secondary`,className:`shrink-0 whitespace-nowrap`,onClick:B,disabled:V,children:[H,he]}),e[37]=B,e[38]=V,e[39]=H,e[40]=he,e[41]=U):U=e[41];let W;e[42]!==z||e[43]!==U?(W=(0,C.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-stretch`,children:[z,U]}),e[42]=z,e[43]=U,e[44]=W):W=e[44];let G;e[45]===r.urlHint?G=e[46]:(G=(0,C.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:r.urlHint}),e[45]=r.urlHint,e[46]=G);let K;e[47]!==c||e[48]!==j||e[49]!==r.autoDetectedHint||e[50]!==r.autoDetectedTitle?(K=j&&c?(0,C.jsxs)(`div`,{className:`rounded-lg border border-accent/40 bg-accent-soft/50 px-3 py-2 text-xs leading-relaxed text-accent-fg`,children:[(0,C.jsx)(`div`,{className:`font-medium`,children:r.autoDetectedTitle}),(0,C.jsx)(`div`,{className:`mt-1 break-all font-mono text-[11px]`,children:c}),(0,C.jsx)(`p`,{className:`mt-1`,children:r.autoDetectedHint})]}):null,e[47]=c,e[48]=j,e[49]=r.autoDetectedHint,e[50]=r.autoDetectedTitle,e[51]=K):K=e[51];let q;e[52]!==y.result||e[53]!==r.probeStatus?(q=y.result?(0,C.jsx)(de,{result:y.result,labels:r.probeStatus}):null,e[52]=y.result,e[53]=r.probeStatus,e[54]=q):q=e[54];let J;e[55]!==p||e[56]!==A||e[57]!==pe||e[58]!==r.saveAsDefault||e[59]!==r.saving||e[60]!==T.busy?(J=A&&p!==A?(0,C.jsxs)(te,{type:`button`,onClick:()=>void pe(),disabled:T.busy,children:[T.busy?(0,C.jsx)(o,{className:`size-3.5 animate-spin`}):null,T.busy?r.saving:r.saveAsDefault]}):null,e[55]=p,e[56]=A,e[57]=pe,e[58]=r.saveAsDefault,e[59]=r.saving,e[60]=T.busy,e[61]=J):J=e[61];let Y;e[62]!==p||e[63]!==r.clear||e[64]!==T.busy?(Y=p?(0,C.jsx)(te,{type:`button`,variant:`ghost`,onClick:()=>void me(),disabled:T.busy,children:r.clear}):null,e[62]=p,e[63]=r.clear,e[64]=T.busy,e[65]=Y):Y=e[65];let X;e[66]!==J||e[67]!==Y?(X=(0,C.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:flex-wrap`,children:[J,Y]}),e[66]=J,e[67]=Y,e[68]=X):X=e[68];let Z;e[69]===T.error?Z=e[70]:(Z=T.error?(0,C.jsx)(`p`,{className:`text-xs text-red-800 dark:text-red-200`,children:T.error}):null,e[69]=T.error,e[70]=Z);let Q;e[71]===r.certWarning?Q=e[72]:(Q=(0,C.jsx)(`div`,{className:`rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-xs leading-relaxed text-amber-950 dark:border-amber-800/60 dark:bg-amber-950/30 dark:text-amber-100`,children:r.certWarning}),e[71]=r.certWarning,e[72]=Q);let $;e[73]!==I||e[74]!==W||e[75]!==G||e[76]!==K||e[77]!==q||e[78]!==X||e[79]!==Z||e[80]!==Q?($=(0,C.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[I,W,G,K,q,X,Z,Q]}),e[73]=I,e[74]=W,e[75]=G,e[76]=K,e[77]=q,e[78]=X,e[79]=Z,e[80]=Q,e[81]=$):$=e[81];let ge;return e[82]!==F||e[83]!==$?(ge=(0,C.jsx)(`div`,{className:`flex flex-col gap-4`,children:(0,C.jsxs)(re,{children:[F,$]})}),e[82]=F,e[83]=$,e[84]=ge):ge=e[84],ge}function le(e){return e.conversationId}function ue(e){return e.language}function de(e){let t=(0,S.c)(18),{result:n,labels:r}=e;if(n.ok){let e;t[0]===r.ok?e=t[1]:(e=(0,C.jsx)(`span`,{className:`font-medium`,children:r.ok}),t[0]=r.ok,t[1]=e);let i;t[2]===n.latencyMs?i=t[3]:(i=(0,C.jsxs)(`span`,{className:`font-mono`,children:[n.latencyMs,`ms`]}),t[2]=n.latencyMs,t[3]=i);let a;t[4]!==r.gatewayReady||t[5]!==n.gatewayReady?(a=n.gatewayReady?(0,C.jsxs)(C.Fragment,{children:[` · `,(0,C.jsx)(`span`,{children:r.gatewayReady})]}):null,t[4]=r.gatewayReady,t[5]=n.gatewayReady,t[6]=a):a=t[6];let o;return t[7]!==e||t[8]!==i||t[9]!==a?(o=(0,C.jsxs)(`div`,{className:`rounded-lg border border-emerald-200 bg-emerald-50 px-3 py-2 text-xs text-emerald-900 dark:border-emerald-800/60 dark:bg-emerald-950/30 dark:text-emerald-100`,children:[e,` · `,i,a]}),t[7]=e,t[8]=i,t[9]=a,t[10]=o):o=t[10],o}let i=r[`code_${n.code}`]??r.codeUnknown,a;t[11]===i?a=t[12]:(a=(0,C.jsx)(`span`,{className:`font-medium`,children:i}),t[11]=i,t[12]=a);let o;t[13]===n.message?o=t[14]:(o=n.message?(0,C.jsxs)(C.Fragment,{children:[` — `,(0,C.jsx)(`span`,{className:`font-mono break-all`,children:n.message})]}):null,t[13]=n.message,t[14]=o);let s;return t[15]!==a||t[16]!==o?(s=(0,C.jsxs)(`div`,{className:`rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-xs text-red-900 dark:border-red-800/60 dark:bg-red-950/30 dark:text-red-100`,children:[a,o]}),t[15]=a,t[16]=o,t[17]=s):s=t[17],s}async function fe(){return(await c(f(`/api/devices`))).devices}async function N(){let e=await c(f(`/api/device-pairing/readiness`));return{ready:e.ready,routes:e.routes,protocolVersion:e.protocolVersion}}async function pe(e){try{return{kind:`ready`,setup:(await c(f(`/api/device-pairing/setups`),{method:`POST`,body:JSON.stringify({targetKind:e})})).setup}}catch(e){if(e.body?.error?.code===`NO_SECURE_ROUTE`)return{kind:`needs-secure-route`};throw e}}async function P(e){return c(f(`/api/device-pairing/setups/${encodeURIComponent(e)}`))}async function me(e){await c(f(`/api/device-pairing/setups/${encodeURIComponent(e)}`),{method:`DELETE`})}async function F(e,t){await c(f(`/api/device-pairing/requests/${encodeURIComponent(e.requestId)}/decision`),{method:`POST`,body:JSON.stringify({decision:t,expectedRevision:e.revision})})}async function I(e){await c(f(`/api/devices/${encodeURIComponent(e)}`),{method:`DELETE`})}async function L(){let e=await u(f(`/api/browser/extension/archive`));if(!e.ok)throw Error(`Browser extension download failed (${e.status})`);let t=e.headers.get(`Content-Disposition`)??``,n=/filename="([^"]+)"/.exec(t)?.[1]??`xopc-browser-extension.zip`,r=URL.createObjectURL(await e.blob());try{let e=document.createElement(`a`);e.href=r,e.download=n,e.click()}finally{URL.revokeObjectURL(r)}}var R=`https://console.xopc.ai/access/client`;function z(e){if(!e||typeof e!=`object`)return;let t=e.body;if(!t||typeof t!=`object`)return;let n=t.error;if(!n||typeof n!=`object`)return;let r=n.code;return typeof r==`string`?r:void 0}function B(e){return[`tunnel_oauth_required`,`invalid_token`,`insufficient_scope`].includes(z(e)??``)}async function V(){return c(f(`/api/tunnel/status`))}async function H(){await c(f(`/api/tunnel/consent`),{method:`POST`,body:JSON.stringify({})})}async function he(){await c(f(`/api/tunnel/registration-key`),{method:`POST`,body:JSON.stringify({})})}async function U(){return c(f(`/api/tunnel/start`),{method:`POST`,body:JSON.stringify({})})}async function W(e){return c(f(`/api/tunnel/stop`),{method:`POST`,body:JSON.stringify({release:e?.release===!0})})}async function G(){let e=(await c(f(`/api/tunnel/reveal-registration-secret`),{method:`POST`,body:JSON.stringify({})})).payload;if(!e)throw Error(`Missing reveal payload`);return{registrationSecret:e.registrationSecret??null,source:e.source===`config`?`config`:`none`}}async function K(e){await c(f(`/api/config`),{method:`PATCH`,body:JSON.stringify({tunnel:e})})}export{w as S,P as _,H as a,A as b,W as c,me as d,pe as f,N as g,fe as h,he as i,z as l,L as m,V as n,G as o,F as p,K as r,U as s,R as t,B as u,I as v,T as x,M as y};
|
package/dist/gateway/static/root/assets/{use-autosave-Bsv3gvqK.js → use-autosave-CTEqUAxS.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./check-DUBLcKHA.js";import{t as a}from"./loader-circle-CifKLtgG.js";import{t as o}from"./cn-JdwAhgNB.js";import{n as s}from"./locale-store-eliqUnBr.js";import{xu as c}from"./index-
|
|
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-eliqUnBr.js";import{xu as c}from"./index-CEkw-fGy.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`;if(n===`idle`)return null;let m=n===`saving`?p?`正在保存…`:`Saving…`:n===`saved`?p?`已自动保存`:`Saved automatically`:n===`error`?r||(p?`自动保存失败`:`Autosave failed`):n===`dirty`?p?`编辑中,将自动保存`:`Editing — autosave pending`:``,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]),(0,p.useEffect)(()=>{if(s!==`saved`)return;let e=window.setTimeout(()=>c(`idle`),1600);return()=>window.clearTimeout(e)},[s]),{status:s,error:l,flush:w,saveNow:T,retry:w,onBlurCapture:w}}export{d as n,m as t};
|
package/dist/gateway/static/root/assets/{user-model-page-CCVN7AYB.js → user-model-page-DOA5rAgd.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{u as i}from"./chunk-KS7C4IRE-Cq1tE_3b.js";import{t as a}from"./check-DUBLcKHA.js";import{n as o,r as s}from"./popover-select-DldSX8GX.js";import{t as c}from"./circle-check-C23XjkUj.js";import{t as l}from"./clock-3-DnrAnuyZ.js";import{t as u}from"./git-branch-Dh9uxTot.js";import{t as d}from"./loader-circle-CifKLtgG.js";import{t as f}from"./message-circle-Badhj-4D.js";import{t as p}from"./x-B_N4OPjy.js";import{t as m}from"./cn-JdwAhgNB.js";import{n as h}from"./locale-store-eliqUnBr.js";import{a as g,c as _,i as v,n as y,o as b,r as x,s as S,t as C}from"./dist-BGTk37IG.js";import{i as w}from"./vendor-swr-BIWyz7Rc.js";import{t as T}from"./button-CGlRPNzi.js";import{t as E}from"./skeleton-BwbyijEw.js";import{$ as D,$r as O,Du as k,Hl as A,J as j,Js as ee,Mo as M,Ou as N,Pu as P,Q as F,Rl as I,Tu as L,Vc as te,Wu as R,Yl as z,al as B,au as ne,dl as V,ei as H,et as U,ho as W,it as re,kc as G,nt as K,nu as q,oc as J,ol as Y,pc as ie,qs as ae,rt as oe,tt as se,wc as ce,wl as le,wu as ue}from"./index-DTDDJnrO.js";import{t as de}from"./page-tabs-B5aqgPVw.js";var X=n(),Z=e(t(),1),Q=r(),fe=new Set([`candidate`,`needs_review`,`conflicted`,`stale`]),pe={zh:{eyebrow:`全局用户理解`,title:`xopc 如何形成对你的理解`,subtitle:`这里汇总跨项目、跨对话形成的认识,并说明它们来自哪些渠道。项目事实不会混入你的个人画像。`,channels:`理解渠道`,channelHint:`每个渠道只贡献有依据的候选内容。`,noChannels:`尚未通过任何渠道形成可展示的全局理解。`,activeCount:`{{count}} 条已在使用`,pendingCount:`{{count}} 条待确认`,noUnderstanding:`尚未从这个渠道形成可使用的全局理解`,pending:`需要你确认`,pendingHint:`确认后才会用于其他项目和之后的对话。`,nothingPending:`目前没有需要确认的全局理解。`,source:`来源`,remember:`确认`,discard:`不是这样`,edit:`修正`,save:`保存修正`,cancel:`取消`,showAll:`查看全部 {{count}} 条`,showLess:`收起`,done:`完成`,updating:`正在从已授权渠道更新理解;你可以先查看已有内容。`,sourceKinds:{user:`你明确告诉我的`,conversation:`对话与协作`,connector:`连接的服务`,work_folder:`工作目录`,local_source:`本机来源`,inference:`综合整理`},categories:{identity:`关于你是谁`,preference:`偏好`,value:`价值取向`,routine:`工作习惯`,capability:`能力与职责`,relationship:`协作关系`,current_state:`当前状态`,derived_insight:`综合判断`}},en:{eyebrow:`Global user understanding`,title:`How xopc forms its understanding of you`,subtitle:`This brings together understanding formed across projects and conversations, with the channel behind each item. Project facts stay out of your personal portrait.`,channels:`Understanding channels`,channelHint:`Each channel contributes only evidence-backed candidates.`,noChannels:`No channel has formed displayable global understanding yet.`,activeCount:`{{count}} in use`,pendingCount:`{{count}} to review`,noUnderstanding:`No usable global understanding has formed from this channel yet`,pending:`Needs your confirmation`,pendingHint:`Only confirmed items may be used across projects and future conversations.`,nothingPending:`There is no global understanding to review right now.`,source:`Source`,remember:`Confirm`,discard:`Not true`,edit:`Correct`,save:`Save correction`,cancel:`Cancel`,showAll:`View all {{count}}`,showLess:`Show less`,done:`Done`,updating:`Updating from authorized channels. You can review existing understanding now.`,sourceKinds:{user:`You told me`,conversation:`Conversations and work`,connector:`Connected services`,work_folder:`Work folders`,local_source:`On-device sources`,inference:`Synthesized understanding`},categories:{identity:`Who you are`,preference:`Preference`,value:`Values`,routine:`Routine`,capability:`Capabilities and responsibilities`,relationship:`Collaboration`,current_state:`Current state`,derived_insight:`Synthesis`}}},me={"local-recent-files":{en:`Recent files`,zh:`最近文件`},"chromium-bookmarks":{en:`Recent bookmarks`,zh:`最近书签`},"apple-notes":{en:`Apple Notes`,zh:`Apple 备忘录`},"apple-mail":{en:`Apple Mail`,zh:`Apple 邮件`},"apple-calendar":{en:`Apple Calendar`,zh:`Apple 日历`},"apple-reminders":{en:`Apple Reminders`,zh:`Apple 提醒事项`},"windows-recent-documents":{en:`Recent documents`,zh:`最近文档`},"linux-recent-documents":{en:`Recent documents`,zh:`最近文档`}},he={user:ae,conversation:f,connector:q,work_folder:A,local_source:z,inference:q},$={files:A,recent_documents:z,calendar:L,tasks:V,notes:J,mail:Y,messages:f,code_activity:u};function ge(e){let t=e.authority===`user_explicit`?`user`:e.authority===`user_observed`?`conversation`:e.authority===`external_untrusted`?`connector`:`inference`;return{id:t,kind:t,observedAt:e.observedAt}}function _e(e,t){return e.kind===`local_source`&&e.label?me[e.label]?.[t]??e.label:e.kind===`work_folder`&&e.label?t===`zh`?`工作目录 · ${e.label}`:`Work folder · ${e.label}`:e.label?e.label:pe[t].sourceKinds[e.kind]}function ve(e){return`${e.kind}:${e.adapterId}:${e.displayName}`}function ye(e){let t=(0,X.c)(82),{assertions:n,configuredSources:r,activityRunning:i,language:o,busy:s,error:l,onReviewAssertion:u,onCompleted:f}=e,h=pe[o],[g,_]=(0,Z.useState)(!1),[v,y]=(0,Z.useState)(null),[b,x]=(0,Z.useState)(``),S;t[0]===n?S=t[1]:(S=n.filter(Ee),t[0]=n,t[1]=S);let C=S,w;t[2]===C?w=t[3]:(w=C.filter(Te),t[2]=C,t[3]=w);let E=w,D;if(t[4]!==r||t[5]!==C||t[6]!==o){let e=new Map;for(let t of r){let n=t.kind===`local_source`?me[t.adapterId]?.[o]??t.displayName:t.displayName,r=ve(t);e.set(r,{key:r,kind:t.kind,category:t.category,label:t.kind===`work_folder`?o===`zh`?`工作目录 · ${n}`:`Work folder · ${n}`:n,assertions:[],lastObservedAt:t.lastCollectedAt})}for(let t of C)for(let n of t.sources?.length?t.sources:[ge(t)]){let r=_e(n,o),i=[...e.values()].find(e=>e.kind===n.kind&&e.label===r),a=i?.key??`${n.kind}:${r}`,s=i??e.get(a)??{key:a,kind:n.kind,category:n.category,label:r,assertions:[],lastObservedAt:n.observedAt};s.assertions.some(e=>e.id===t.id)||s.assertions.push(t),s.lastObservedAt=Math.max(s.lastObservedAt??0,n.observedAt),e.set(a,s)}D=[...e.values()].sort(we),t[4]=r,t[5]=C,t[6]=o,t[7]=D}else D=t[7];let O=D,k;t[8]===u?k=t[9]:(k=async(e,t,n)=>{await u(e,t,n)&&y(null)},t[8]=u,t[9]=k);let A=k,j;t[10]!==E||t[11]!==g?(j=g?E:E.slice(0,5),t[10]=E,t[11]=g,t[12]=j):j=t[12];let ee=j,M;t[13]===h.eyebrow?M=t[14]:(M=(0,Q.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.18em] text-accent-fg`,children:h.eyebrow}),t[13]=h.eyebrow,t[14]=M);let N;t[15]===h.title?N=t[16]:(N=(0,Q.jsx)(`h2`,{className:`mt-3 text-2xl font-semibold tracking-tight text-fg sm:text-3xl`,children:h.title}),t[15]=h.title,t[16]=N);let P;t[17]===h.subtitle?P=t[18]:(P=(0,Q.jsx)(`p`,{className:`mx-auto mt-3 max-w-[38rem] text-sm leading-6 text-fg-muted`,children:h.subtitle}),t[17]=h.subtitle,t[18]=P);let F;t[19]!==M||t[20]!==N||t[21]!==P?(F=(0,Q.jsxs)(`div`,{className:`text-center`,children:[M,N,P]}),t[19]=M,t[20]=N,t[21]=P,t[22]=F):F=t[22];let I;t[23]!==i||t[24]!==h.updating?(I=i?(0,Q.jsxs)(`div`,{className:`mt-6 flex items-center gap-3 rounded-2xl border border-accent/20 bg-accent-soft/55 px-4 py-3 text-sm text-accent-fg`,children:[(0,Q.jsx)(d,{className:`size-4 shrink-0 animate-spin motion-reduce:animate-none`}),(0,Q.jsx)(`p`,{children:h.updating})]}):null,t[23]=i,t[24]=h.updating,t[25]=I):I=t[25];let L;t[26]===h.channels?L=t[27]:(L=(0,Q.jsx)(`h3`,{id:`understanding-channels-title`,className:`text-sm font-semibold text-fg`,children:h.channels}),t[26]=h.channels,t[27]=L);let R;t[28]===h.channelHint?R=t[29]:(R=(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:h.channelHint}),t[28]=h.channelHint,t[29]=R);let z;t[30]!==O||t[31]!==h.activeCount||t[32]!==h.noChannels||t[33]!==h.noUnderstanding||t[34]!==h.pendingCount?(z=O.length?(0,Q.jsx)(`div`,{className:`mt-3 space-y-3`,children:O.map(e=>{let t=e.category?$[e.category]??he[e.kind]:he[e.kind],n=e.assertions.filter(Ce).length,r=e.assertions.filter(Se).length;return(0,Q.jsxs)(`article`,{className:`rounded-2xl border border-edge bg-surface-base/55 px-4 py-4`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Q.jsx)(`div`,{className:`flex size-9 shrink-0 items-center justify-center rounded-xl bg-surface-muted text-fg-muted`,children:(0,Q.jsx)(t,{className:`size-4`})}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`h4`,{className:`truncate text-sm font-medium text-fg`,children:e.label}),e.assertions.length?(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[n?h.activeCount.replace(`{{count}}`,String(n)):``,r?h.pendingCount.replace(`{{count}}`,String(r)):``].filter(Boolean).join(` · `)}):(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:h.noUnderstanding})]})]}),e.assertions.length?(0,Q.jsx)(`ul`,{className:`ml-12 mt-3 space-y-2 border-t border-edge-subtle pt-3 text-xs leading-5 text-fg-muted`,children:e.assertions.slice(0,5).map(xe)}):null]},e.key)})}):(0,Q.jsx)(`p`,{className:`mt-3 rounded-2xl border border-edge bg-surface-base/55 p-4 text-sm text-fg-muted`,children:h.noChannels}),t[30]=O,t[31]=h.activeCount,t[32]=h.noChannels,t[33]=h.noUnderstanding,t[34]=h.pendingCount,t[35]=z):z=t[35];let B;t[36]!==L||t[37]!==R||t[38]!==z?(B=(0,Q.jsxs)(`section`,{className:`mt-8`,"aria-labelledby":`understanding-channels-title`,children:[L,R,z]}),t[36]=L,t[37]=R,t[38]=z,t[39]=B):B=t[39];let ne=E.length?` · ${E.length}`:``,V;t[40]!==h.pending||t[41]!==ne?(V=(0,Q.jsxs)(`h3`,{id:`understanding-pending-title`,className:`text-sm font-semibold text-fg`,children:[h.pending,ne]}),t[40]=h.pending,t[41]=ne,t[42]=V):V=t[42];let H;t[43]===h.pendingHint?H=t[44]:(H=(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:h.pendingHint}),t[43]=h.pendingHint,t[44]=H);let U;t[45]!==s||t[46]!==b||t[47]!==v||t[48]!==o||t[49]!==E.length||t[50]!==A||t[51]!==g||t[52]!==h.cancel||t[53]!==h.categories||t[54]!==h.discard||t[55]!==h.edit||t[56]!==h.nothingPending||t[57]!==h.remember||t[58]!==h.save||t[59]!==h.showAll||t[60]!==h.showLess||t[61]!==h.source||t[62]!==ee?(U=E.length?(0,Q.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[ee.map(e=>{let t=v===e.id,n=(e.sources?.length?e.sources:[ge(e)]).map(e=>_e(e,o));return(0,Q.jsxs)(`article`,{className:`rounded-2xl border border-edge bg-surface-panel p-4 shadow-surface sm:p-5`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-[11px]`,children:[(0,Q.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 font-medium text-accent-fg`,children:h.categories[e.kind]}),(0,Q.jsxs)(`span`,{className:`text-fg-subtle`,children:[h.source,`: `,n.join(` · `)]})]}),t?(0,Q.jsx)(`textarea`,{autoFocus:!0,value:b,onChange:e=>x(e.target.value),className:`mt-3 min-h-24 w-full resize-y rounded-xl border border-edge bg-surface-base px-3 py-2.5 text-sm leading-6 text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/15`}):(0,Q.jsx)(`p`,{className:`mt-3 text-[0.95rem] font-medium leading-7 text-fg`,children:e.statement}),t?(0,Q.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,Q.jsx)(T,{variant:`ghost`,disabled:s,onClick:()=>y(null),children:h.cancel}),(0,Q.jsxs)(T,{variant:`primary`,disabled:s||!b.trim(),onClick:()=>void A(e,`edited`,b.trim()),children:[s?(0,Q.jsx)(d,{className:`size-4 animate-spin`}):(0,Q.jsx)(a,{className:`size-4`}),h.save]})]}):(0,Q.jsxs)(`div`,{className:`mt-4 flex flex-wrap justify-end gap-2`,children:[(0,Q.jsxs)(T,{variant:`ghost`,disabled:s,onClick:()=>{y(e.id),x(e.statement)},children:[(0,Q.jsx)(te,{className:`size-3.5`}),h.edit]}),(0,Q.jsxs)(T,{variant:`secondary`,disabled:s,onClick:()=>void A(e,`rejected`),children:[(0,Q.jsx)(p,{className:`size-3.5`}),h.discard]}),(0,Q.jsxs)(T,{variant:`primary`,disabled:s,onClick:()=>void A(e,`accepted`),children:[s?(0,Q.jsx)(d,{className:`size-4 animate-spin`}):(0,Q.jsx)(a,{className:`size-4`}),h.remember]})]})]},e.id)}),E.length>5?(0,Q.jsxs)(`button`,{type:`button`,className:`mx-auto flex items-center gap-1.5 px-3 py-2 text-xs font-medium text-accent-fg hover:underline`,onClick:()=>_(be),children:[g?h.showLess:h.showAll.replace(`{{count}}`,String(E.length)),(0,Q.jsx)(ue,{className:m(`size-3.5 transition-transform`,g&&`rotate-180`)})]}):null]}):(0,Q.jsxs)(`div`,{className:`mt-3 flex items-start gap-3 rounded-2xl border border-edge bg-surface-base/55 p-4`,children:[(0,Q.jsx)(c,{className:`mt-0.5 size-5 shrink-0 text-success`}),(0,Q.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:h.nothingPending})]}),t[45]=s,t[46]=b,t[47]=v,t[48]=o,t[49]=E.length,t[50]=A,t[51]=g,t[52]=h.cancel,t[53]=h.categories,t[54]=h.discard,t[55]=h.edit,t[56]=h.nothingPending,t[57]=h.remember,t[58]=h.save,t[59]=h.showAll,t[60]=h.showLess,t[61]=h.source,t[62]=ee,t[63]=U):U=t[63];let W;t[64]!==V||t[65]!==H||t[66]!==U?(W=(0,Q.jsxs)(`section`,{className:`mt-8`,"aria-labelledby":`understanding-pending-title`,children:[V,H,U]}),t[64]=V,t[65]=H,t[66]=U,t[67]=W):W=t[67];let re;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Q.jsx)(a,{className:`size-4`}),t[68]=re):re=t[68];let G;t[69]!==s||t[70]!==f||t[71]!==h.done?(G=(0,Q.jsx)(`div`,{className:`mt-6 flex justify-end`,children:(0,Q.jsxs)(T,{variant:`primary`,disabled:s,onClick:f,children:[re,h.done]})}),t[69]=s,t[70]=f,t[71]=h.done,t[72]=G):G=t[72];let K;t[73]===l?K=t[74]:(K=l?(0,Q.jsx)(`p`,{className:`mt-5 text-sm text-danger`,role:`alert`,children:l}):null,t[73]=l,t[74]=K);let q;return t[75]!==I||t[76]!==B||t[77]!==W||t[78]!==G||t[79]!==K||t[80]!==F?(q=(0,Q.jsxs)(`section`,{className:`mx-auto w-full max-w-[42rem] pb-2`,"aria-live":`polite`,children:[F,I,B,W,G,K]}),t[75]=I,t[76]=B,t[77]=W,t[78]=G,t[79]=K,t[80]=F,t[81]=q):q=t[81],q}function be(e){return!e}function xe(e){return(0,Q.jsxs)(`li`,{className:`flex gap-2`,children:[(0,Q.jsx)(`span`,{className:`mt-2 size-1 shrink-0 rounded-full bg-accent/60`}),(0,Q.jsx)(`span`,{children:e.statement})]},e.id)}function Se(e){return fe.has(e.status)}function Ce(e){return e.status===`active`}function we(e,t){return t.assertions.length-e.assertions.length||(t.lastObservedAt??0)-(e.lastObservedAt??0)}function Te(e){return fe.has(e.status)}function Ee(e){return e.scope.type===`global`&&e.status!==`archived`&&e.status!==`rejected`}function De(){let{pathname:e,search:t}=i(),n=h(e=>e.language),r=j(),[a,o]=(0,Z.useState)(!1),[s,c]=(0,Z.useState)(null),l=e===`/user-model`,{data:u,mutate:f}=w(l?`/api/user-model`:null,U),E=n===`zh`,D=u?.assertions.filter(e=>e.scope.type===`global`&&[`candidate`,`needs_review`,`conflicted`,`stale`].includes(e.status)).length??0;if((0,Z.useEffect)(()=>{if(!l)return;let e=new URLSearchParams(t);if(e.get(`workDiscovery`)!==`review`)return;let n=e.get(`run`),r=!1;return(async()=>{if(n&&j.getState().directoryRun?.id!==n)try{let e=await O(n);if(r)return;j.getState().updateDirectoryRun(e)}catch{return}r||j.getState().setDrawerOpen(!0)})(),()=>{r=!0}},[l,t]),(0,Z.useEffect)(()=>{l&&r.status!==`running`&&f()},[f,l,r.directoryRun?.id,r.status]),!l)return null;let k=r.status===`running`,A=async(e,t,n)=>{let i=j.getState().directoryRun,a=i?.result?.profileCandidates?.find(t=>t.id===e.id||!!(t.assertionId&&t.assertionId===e.assertionId)),s=r.memories.find(t=>t.id===e.id||!!(t.assertionId&&t.assertionId===e.assertionId));if(!a&&!s?.assertionId)return!1;o(!0),c(null);try{if(i&&a){let e=await H(i.id,[{id:a.id,status:t,...n?{statement:n}:{}}]);j.getState().updateDirectoryRun(e)}return s?.assertionId&&await j.getState().reviewMemory(s.assertionId,t===`accepted`,n),await f(),!0}catch(e){return c(e instanceof Error?e.message:String(e)),!1}finally{o(!1)}},ee=async(e,t,n)=>{let r=[...j.getState().directoryRun?.result?.profileCandidates??[],...j.getState().memories].find(t=>t.assertionId===e.id);if(r)return A(r,t,n);o(!0),c(null);try{return t===`edited`&&n?await F(e.id,n):await se(e.id,t===`accepted`?`active`:`rejected`),await f(),!0}catch(e){return c(e instanceof Error?e.message:String(e)),!1}finally{o(!1)}},N=e=>{if(!e&&u&&D===0&&r.status!==`running`){r.finish();return}r.setDrawerOpen(e)};return(0,Q.jsxs)(C,{open:r.drawerOpen,onOpenChange:N,children:[(0,Q.jsx)(_,{asChild:!0,children:(0,Q.jsxs)(T,{type:`button`,variant:`ghost`,className:m(`relative size-8 rounded-xl p-0`,M),title:E?`查看 xopc 对你的理解`:`Review what xopc understands`,"aria-label":E?`查看 xopc 对你的理解`:`Review what xopc understands`,children:[k?(0,Q.jsx)(d,{className:`size-4 animate-spin motion-reduce:animate-none`}):(0,Q.jsx)(ie,{className:`size-4 text-accent-fg`}),D?(0,Q.jsx)(`span`,{className:`absolute right-0.5 top-0.5 size-2 rounded-full bg-accent ring-2 ring-surface-panel`}):null]})}),(0,Q.jsxs)(b,{children:[(0,Q.jsx)(g,{className:`fixed inset-0 z-[60] bg-scrim backdrop-blur-sm data-[state=closed]:animate-out data-[state=open]:animate-in motion-reduce:backdrop-blur-none`}),(0,Q.jsx)(`div`,{className:`pointer-events-none fixed inset-0 z-[61] flex items-center justify-center p-3 sm:p-6`,children:(0,Q.jsxs)(x,{className:`xopc-understanding-center pointer-events-auto flex h-[min(42rem,calc(100dvh-1.5rem))] w-[min(44rem,calc(100vw-1.5rem))] flex-col overflow-hidden rounded-[1.75rem] border border-edge bg-surface-panel shadow-float outline-none sm:h-[min(42rem,calc(100dvh-3rem))] sm:w-[min(44rem,calc(100vw-3rem))]`,children:[(0,Q.jsxs)(`header`,{className:`flex h-16 shrink-0 items-center justify-between border-b border-edge-subtle px-5 sm:px-6`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(S,{className:`text-sm font-semibold text-fg`,children:k?E?`正在更新用户理解`:`Updating user understanding`:E?`用户理解`:`User understanding`}),(0,Q.jsx)(v,{className:`mt-0.5 text-xs text-fg-muted`,children:k?E?`关闭窗口也会在后台继续`:`You can close this window; work continues in the background`:D?E?`${D} 条全局理解待确认`:`${D} global item(s) to review`:E?`查看理解来自哪些渠道`:`See which channels shaped it`})]}),(0,Q.jsx)(y,{asChild:!0,children:(0,Q.jsx)(T,{variant:`ghost`,className:`size-8 rounded-xl p-0`,"aria-label":E?`关闭`:`Close`,children:(0,Q.jsx)(p,{className:`size-4`})})})]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-7 sm:px-9 sm:py-9`,children:u?(0,Q.jsx)(ye,{assertions:u.assertions,configuredSources:u.sources??[],activityRunning:k,language:n,busy:a,error:s,onReviewAssertion:ee,onCompleted:()=>{N(!1)}}):(0,Q.jsx)(`section`,{className:`flex min-h-full items-center justify-center`,"aria-label":E?`正在加载用户理解`:`Loading user understanding`,children:(0,Q.jsx)(d,{className:`size-5 animate-spin text-fg-muted motion-reduce:animate-none`})})})]})})]})]})}var Oe={en:{pageTitle:`You`,pageSubtitle:`A living portrait shaped by you and xopc.`,overview:`Your portrait`,understanding:`Shared understanding`,knowledge:`Work memory`,portraitEyebrow:`YOU × XOPC`,portraitIntro:`Your explicit profile stays clear and editable. xopc builds a separate shared understanding through conversations and work.`,editProfile:`Edit basics`,callName:`What should xopc call you?`,callNamePlaceholder:`For example: Alex, Joyce, or Dr. Chen`,role:`Your role`,rolePlaceholder:`For example: founder, designer, or engineer`,pronouns:`Pronouns (optional)`,pronounsPlaceholder:`For example: she/her, he/him, they/them`,timezone:`Timezone`,locale:`Language / locale`,useDeviceTimezone:`Use this device`,notProvided:`Not provided`,editProfileHint:`These are facts you provide directly. They remain separate from xopc’s observations and inferences.`,saveProfile:`Save`,saving:`Saving…`,explicit:`You told me`,explicitHint:`Facts and preferences you stated directly`,learned:`Learned together`,learnedHint:`Patterns formed from our work`,pending:`To confirm together`,pendingHint:`Items that need your judgment`,confirmTogether:`Confirm together`,confirmHint:`These may affect future behavior. Confirm them, correct the wording, or tell me not to use them.`,nothingToConfirm:`Nothing needs your confirmation right now.`,importantNow:`What matters now`,noPriority:`No current priority has been set.`,otherGoals:`Other active outcomes`,howWeWork:`How we work together`,howWeWorkHint:`Your standing instructions for how I should communicate and act.`,noRules:`No collaboration preferences yet.`,recent:`Recently formed understanding`,recentHint:`The most useful current facts, with their origin and time horizon.`,seeAll:`See all`,workMemory:`What I remember from the work`,workMemoryHint:`Project facts, decisions, lessons, and open questions stay separate from facts about you.`,items:`items`,maintenanceReady:`Memory upkeep is enabled and waiting for its first run.`,maintenanceComplete:`Memory was last organized`,maintenanceFailed:`The latest memory upkeep needs attention`,refresh:`Refresh`,aboutYouTitle:`A view you can correct`,aboutYouHint:`This is working context, not a fixed profile. Every item can be corrected or retired.`,identity:`Who you are`,preferences:`Preferences and working rhythm`,relationships:`People and relationships`,currentState:`Current context`,insights:`My current read`,emptyGroup:`No understanding has formed here yet.`,correct:`Correct`,stopUsing:`Stop using`,confirm:`Confirm`,notTrue:`Not true`,save:`Save correction`,cancel:`Cancel`,correctionPlaceholder:`Write the accurate version…`,searchPlaceholder:`Search work memory…`,allMemory:`All work memory`,memoryLibraryHint:`Only distilled facts, decisions, lessons, commitments, and open questions appear here. Source records stay with their connector.`,noKnowledge:`No work memory has formed yet.`,noKnowledgeMatch:`No work memory matches this search.`,archive:`Archive`,showMore:`Show more`,expand:`Show details`,collapse:`Hide details`,disable:`Disable`,disabled:`Not in use`,enable:`Enable`,loadFailed:`Could not load your understanding.`,tryAgain:`Try again`,actionFailed:`The change could not be saved. Please try again.`},zh:{pageTitle:`你`,pageSubtitle:`一份由你和 xopc 共同塑造、持续生长的画像。`,overview:`你的画像`,understanding:`共同理解`,knowledge:`工作记忆`,portraitEyebrow:`YOU × XOPC`,portraitIntro:`你明确提供的基本信息会被清晰呈现并由你直接编辑;xopc 在对话与共事中形成的理解则单独维护。`,editProfile:`编辑基本信息`,callName:`希望 xopc 如何称呼你?`,callNamePlaceholder:`例如:Mic、Joyce、张老师`,role:`你的角色`,rolePlaceholder:`例如:创业者、产品设计师、工程师`,pronouns:`代词(可选)`,pronounsPlaceholder:`例如:she/her、he/him、they/them`,timezone:`时区`,locale:`语言 / 地区`,useDeviceTimezone:`使用本机时区`,notProvided:`未填写`,editProfileHint:`这些是由你直接提供的事实,与 xopc 的观察和推断分开维护。`,saveProfile:`保存`,saving:`正在保存…`,explicit:`你告诉我的`,explicitHint:`你明确表达的事实与偏好`,learned:`协作中学到的`,learnedHint:`从实际协作中形成的认识`,pending:`等待一起确认`,pendingHint:`需要由你判断的内容`,confirmTogether:`一起确认`,confirmHint:`这些理解可能影响之后的行为。你可以确认、修正,或告诉我以后不要使用。`,nothingToConfirm:`目前没有需要你确认的理解。`,importantNow:`此刻重要`,noPriority:`还没有设置当前优先事项。`,otherGoals:`其他进行中的目标`,howWeWork:`我们怎样协作`,howWeWorkHint:`你对沟通方式和执行行为的长期约定。`,noRules:`还没有形成协作偏好。`,recent:`最近形成的理解`,recentHint:`最值得使用的当前认识,同时说明它来自哪里、适用多久。`,seeAll:`查看全部`,workMemory:`我在工作中记住的`,workMemoryHint:`项目事实、决定、经验和待解问题,与“关于你”的理解分别管理。`,items:`条`,maintenanceReady:`记忆整理已经启用,正在等待首次运行。`,maintenanceComplete:`最近一次记忆整理于`,maintenanceFailed:`最近一次记忆整理需要处理`,refresh:`刷新`,aboutYouTitle:`一份可以共同修正的理解`,aboutYouHint:`它是协作中的工作认知,不是给你定型的档案。每一条都能修正或停止使用。`,identity:`关于你是谁`,preferences:`偏好与工作节奏`,relationships:`重要的人与关系`,currentState:`当前状态`,insights:`我形成的判断`,emptyGroup:`这里还没有形成理解。`,correct:`修正`,stopUsing:`不再使用`,confirm:`确认`,notTrue:`不是这样`,save:`保存修正`,cancel:`取消`,correctionPlaceholder:`写下更准确的说法…`,searchPlaceholder:`搜索工作记忆…`,allMemory:`全部工作记忆`,memoryLibraryHint:`这里只显示提炼后的事实、决定、经验、承诺和待解问题;邮件、日历与文档原文保留在对应来源中。`,noKnowledge:`还没有形成工作记忆。`,noKnowledgeMatch:`没有符合搜索条件的工作记忆。`,archive:`归档`,showMore:`显示更多`,expand:`查看详情`,collapse:`收起详情`,disable:`停用`,disabled:`已停用`,enable:`启用`,loadFailed:`无法载入对你的理解。`,tryAgain:`重试`,actionFailed:`修改没有保存,请重试。`}},ke=[`candidate`,`needs_review`,`conflicted`,`stale`],Ae=new Set([`identity.call_name`,`identity.role`,`identity.pronouns`,`preference.timezone`,`preference.locale`]),je=[`project_fact`,`workspace_fact`,`decision`,`task_lesson`,`commitment`,`open_question`,`episode`,`note`];function Me(e,t,n=!1){return e?new Intl.DateTimeFormat(t===`zh`?`zh-CN`:`en`,{dateStyle:`medium`,...n?{timeStyle:`short`}:{}}).format(e):null}function Ne(e){return typeof e==`string`&&e.trim()?e.trim():void 0}function Pe(e){return{callName:Ne(e.profile.callName)??``,role:Ne(e.profile.role)??``,pronouns:Ne(e.profile.pronouns)??``,timezone:Ne(e.profile.timezone)??``,locale:Ne(e.profile.locale)??``}}function Fe(e,t){return{"zh-CN":{en:`Simplified Chinese`,zh:`简体中文`},"zh-TW":{en:`Traditional Chinese`,zh:`繁体中文`},"en-US":{en:`English (US)`,zh:`英语(美国)`},"en-GB":{en:`English (UK)`,zh:`英语(英国)`},"ja-JP":{en:`Japanese`,zh:`日语`}}[e]?.[t]??e}function Ie(e){return Array.from(e.trim()).slice(0,2).join(``).toLocaleUpperCase()}function Le(e,t){return(t===`zh`?{user_explicit:`你告诉我的`,user_observed:`从协作中观察到`,system_inferred:`我形成的判断`,external_untrusted:`来自连接的信息`}:{user_explicit:`You told me`,user_observed:`Observed while working together`,system_inferred:`My current read`,external_untrusted:`From connected information`})[e.authority]}function Re(e,t){if(e.validTo){let n=Me(e.validTo,t);return t===`zh`?`适用至 ${n}`:`Applies until ${n}`}return(t===`zh`?{stable:`长期有效`,slow:`会随时间复核`,dynamic:`近期状态`,event:`特定阶段`}:{stable:`Long-term`,slow:`Reviewed over time`,dynamic:`Current context`,event:`Specific period`})[e.volatility]}function ze(e,t){let n=Me(e,t);return t===`zh`?`当前安排至 ${n}`:`Current plan through ${n}`}function Be(e,t){return e.authority===`user_explicit`?null:e.confidence>=.85?t===`zh`?`把握较高`:`High confidence`:e.confidence>=.65?t===`zh`?`把握中等`:`Medium confidence`:t===`zh`?`仍需确认`:`Needs confirmation`}function Ve(e,t){return(t===`zh`?{global:`所有协作`,agent:`当前智能体`,workspace:`当前工作区`,project:`当前项目`,session:`当前会话`}:{global:`All work`,agent:`This agent`,workspace:`This workspace`,project:`This project`,session:`This conversation`})[e.type]}function He(e,t){return(t===`zh`?{project_fact:`项目事实`,workspace_fact:`工作区事实`,decision:`已经决定`,task_lesson:`工作经验`,commitment:`承诺与约定`,open_question:`待解问题`,episode:`重要经历`,note:`其他记录`}:{project_fact:`Project facts`,workspace_fact:`Workspace facts`,decision:`Decisions`,task_lesson:`Lessons`,commitment:`Commitments`,open_question:`Open questions`,episode:`Episodes`,note:`Notes`})[e]}function Ue(e,t,n){if(e)return e.targetType===`goal`?t.find(t=>t.id===e.targetId)?.title:/^[0-9a-f]{8}-[0-9a-f-]{20,}$/i.test(e.targetId)?(n===`zh`?{project:`当前项目`,task:`当前任务`,assertion:`一项待处理的理解`,topic:`当前主题`}:{project:`Current project`,task:`Current task`,assertion:`An understanding to address`,topic:`Current topic`})[e.targetType]:e.targetId}function We(e){let t=(0,X.c)(14),{title:n,hint:r,action:i,children:a,className:o}=e,s=`rounded-xl border border-edge bg-surface-panel shadow-surface ${o===void 0?``:o}`,c;t[0]===n?c=t[1]:(c=(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n}),t[0]=n,t[1]=c);let l;t[2]===r?l=t[3]:(l=r?(0,Q.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm leading-5 text-fg-muted`,children:r}):null,t[2]=r,t[3]=l);let u;t[4]!==c||t[5]!==l?(u=(0,Q.jsxs)(`div`,{children:[c,l]}),t[4]=c,t[5]=l,t[6]=u):u=t[6];let d;t[7]!==i||t[8]!==u?(d=(0,Q.jsxs)(`header`,{className:`flex items-start justify-between gap-4 border-b border-edge-subtle px-5 py-4`,children:[u,i]}),t[7]=i,t[8]=u,t[9]=d):d=t[9];let f;return t[10]!==a||t[11]!==s||t[12]!==d?(f=(0,Q.jsxs)(`section`,{className:s,children:[d,a]}),t[10]=a,t[11]=s,t[12]=d,t[13]=f):f=t[13],f}function Ge(e){let t=(0,X.c)(7),{icon:n,children:r}=e,i;t[0]===n?i=t[1]:(i=(0,Q.jsx)(`span`,{className:`text-fg-subtle`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=(0,Q.jsx)(`p`,{children:r}),t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,Q.jsxs)(`div`,{className:`flex min-h-32 flex-col items-center justify-center gap-2 px-5 py-8 text-center text-sm text-fg-muted`,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function Ke({open:e,profile:t,language:n,saving:r,onOpenChange:i,onSave:a}){let c=Oe[n],[l,u]=(0,Z.useState)(t);(0,Z.useEffect)(()=>{e&&u(t)},[e,t]);let f=e=>{e.preventDefault(),a({callName:l.callName.trim(),role:l.role.trim(),pronouns:l.pronouns.trim(),timezone:l.timezone.trim(),locale:l.locale.trim()})},m=(e,t,n)=>(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:t}),(0,Q.jsx)(`input`,{value:l[e],onChange:t=>u(n=>({...n,[e]:t.target.value})),placeholder:n,className:`h-10 w-full rounded-xl border border-edge bg-surface-base px-3 text-sm text-fg outline-none transition placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`})]}),h=[`zh-CN`,`zh-TW`,`en-US`,`en-GB`,`ja-JP`];return l.locale&&!h.includes(l.locale)&&h.push(l.locale),(0,Q.jsx)(C,{open:e,onOpenChange:i,children:(0,Q.jsxs)(b,{children:[(0,Q.jsx)(g,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Q.jsx)(x,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[90] h-[min(40rem,calc(100vh-2rem))] w-[min(42rem,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,Q.jsxs)(`form`,{className:`flex h-full min-h-0 flex-col`,onSubmit:f,children:[(0,Q.jsxs)(`header`,{className:`flex shrink-0 items-start justify-between gap-4 border-b border-edge px-5 py-4 sm:px-6`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(S,{className:`font-semibold text-fg`,children:c.editProfile}),(0,Q.jsx)(v,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:c.editProfileHint})]}),(0,Q.jsx)(y,{asChild:!0,children:(0,Q.jsx)(T,{variant:`ghost`,className:`size-8 shrink-0 p-0`,"aria-label":c.cancel,children:(0,Q.jsx)(p,{className:`size-4`})})})]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5 sm:p-6`,children:(0,Q.jsxs)(`div`,{className:`grid gap-5 sm:grid-cols-2`,children:[m(`callName`,c.callName,c.callNamePlaceholder),m(`role`,c.role,c.rolePlaceholder),m(`pronouns`,c.pronouns,c.pronounsPlaceholder),(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:c.locale}),(0,Q.jsxs)(o,{value:l.locale,onChange:e=>u(t=>({...t,locale:e.target.value})),children:[(0,Q.jsx)(s,{value:``,children:c.notProvided}),h.map(e=>(0,Q.jsx)(s,{value:e,children:Fe(e,n)},e))]})]}),(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-sm sm:col-span-2`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:c.timezone}),(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsx)(`input`,{value:l.timezone,onChange:e=>u(t=>({...t,timezone:e.target.value})),placeholder:D(),className:`h-10 min-w-0 flex-1 rounded-xl border border-edge bg-surface-base px-3 text-sm text-fg outline-none transition placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`}),(0,Q.jsx)(T,{className:`shrink-0 whitespace-nowrap`,onClick:()=>u(e=>({...e,timezone:D()})),children:c.useDeviceTimezone})]})]})]})}),(0,Q.jsxs)(`footer`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-3 sm:px-6`,children:[(0,Q.jsx)(y,{asChild:!0,children:(0,Q.jsx)(T,{disabled:r,children:c.cancel})}),(0,Q.jsxs)(T,{type:`submit`,variant:`primary`,disabled:r,children:[r?(0,Q.jsx)(d,{className:`size-4 animate-spin`}):null,r?c.saving:c.saveProfile]})]})]})})]})})}function qe(e){let t=(0,X.c)(28),{item:n,language:r,busy:i,editing:o,draft:s,onDraftChange:c,onEdit:u,onCancel:d,onAction:m,onCorrect:h}=e,g=Oe[r],_;t[0]===n.status?_=t[1]:(_=ke.includes(n.status),t[0]=n.status,t[1]=_);let v=_,y;t[2]!==n||t[3]!==r?(y=Be(n,r),t[2]=n,t[3]=r,t[4]=y):y=t[4];let b=y,x=`rounded-xl border p-4 ${v?`border-edge-strong bg-surface-base`:`border-edge bg-surface-panel`}`,S;t[5]!==i||t[6]!==b||t[7]!==s||t[8]!==o||t[9]!==n||t[10]!==r||t[11]!==v||t[12]!==m||t[13]!==d||t[14]!==h||t[15]!==c||t[16]!==u||t[17]!==g.cancel||t[18]!==g.confirm||t[19]!==g.correct||t[20]!==g.correctionPlaceholder||t[21]!==g.notTrue||t[22]!==g.save||t[23]!==g.stopUsing?(S=o?(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsx)(`label`,{className:`sr-only`,htmlFor:`assertion-${n.id}`,children:g.correctionPlaceholder}),(0,Q.jsx)(`textarea`,{id:`assertion-${n.id}`,value:s,onChange:e=>c(e.target.value),placeholder:g.correctionPlaceholder,className:`min-h-24 w-full resize-y rounded-xl border border-edge bg-surface-base px-3 py-2.5 text-sm leading-6 text-fg outline-none transition focus:border-accent focus:ring-2 focus:ring-accent/20`,autoFocus:!0}),(0,Q.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Q.jsx)(T,{variant:`ghost`,className:`h-8`,onClick:d,children:g.cancel}),(0,Q.jsx)(T,{variant:`primary`,className:`h-8`,disabled:!s.trim()||i,onClick:h,children:g.save})]})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:n.statement}),(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-3 gap-y-1.5 text-xs text-fg-subtle`,children:[(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,Q.jsx)(f,{className:`size-3.5`}),Le(n,r)]}),(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,Q.jsx)(l,{className:`size-3.5`}),Re(n,r)]}),n.scope.type===`global`?null:(0,Q.jsx)(`span`,{children:Ve(n.scope,r)}),b?(0,Q.jsx)(`span`,{children:b}):null]}),(0,Q.jsx)(`div`,{className:`mt-4 flex flex-wrap justify-end gap-1.5`,children:v?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(T,{variant:`secondary`,className:`h-8 gap-1.5 px-2.5`,disabled:i,onClick:()=>m(`active`),children:[(0,Q.jsx)(a,{className:`size-3.5`}),g.confirm]}),(0,Q.jsxs)(T,{variant:`ghost`,className:`h-8 gap-1.5 px-2.5`,disabled:i,onClick:u,children:[(0,Q.jsx)(te,{className:`size-3.5`}),g.correct]}),(0,Q.jsxs)(T,{variant:`ghost`,className:`h-8 gap-1.5 px-2.5`,disabled:i,onClick:()=>m(`rejected`),children:[(0,Q.jsx)(p,{className:`size-3.5`}),g.notTrue]})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(T,{variant:`ghost`,className:`h-8 gap-1.5 px-2.5`,disabled:i,onClick:u,children:[(0,Q.jsx)(te,{className:`size-3.5`}),g.correct]}),(0,Q.jsxs)(T,{variant:`ghost`,className:`h-8 gap-1.5 px-2.5`,disabled:i,onClick:()=>m(`archived`),children:[(0,Q.jsx)(R,{className:`size-3.5`}),g.stopUsing]})]})})]}),t[5]=i,t[6]=b,t[7]=s,t[8]=o,t[9]=n,t[10]=r,t[11]=v,t[12]=m,t[13]=d,t[14]=h,t[15]=c,t[16]=u,t[17]=g.cancel,t[18]=g.confirm,t[19]=g.correct,t[20]=g.correctionPlaceholder,t[21]=g.notTrue,t[22]=g.save,t[23]=g.stopUsing,t[24]=S):S=t[24];let C;return t[25]!==x||t[26]!==S?(C=(0,Q.jsx)(`article`,{className:x,children:S}),t[25]=x,t[26]=S,t[27]=C):C=t[27],C}function Je(e){let t=(0,X.c)(16),{rule:n,language:r,busy:i,onToggle:a}=e,o=Oe[r],s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsx)(I,{className:`mt-0.5 size-4 shrink-0 text-fg-subtle`}),t[0]=s):s=t[0];let c;t[1]===n.statement?c=t[2]:(c=(0,Q.jsx)(`p`,{className:`min-w-0 flex-1 text-sm leading-6 text-fg`,children:n.statement}),t[1]=n.statement,t[2]=c);let l;t[3]!==n.status||t[4]!==o.disabled?(l=n.status===`disabled`?(0,Q.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:o.disabled}):null,t[3]=n.status,t[4]=o.disabled,t[5]=l):l=t[5];let u=n.status===`active`?o.disable:o.enable,d;t[6]!==i||t[7]!==a||t[8]!==u?(d=(0,Q.jsx)(T,{variant:`ghost`,className:`h-8`,disabled:i,onClick:a,children:u}),t[6]=i,t[7]=a,t[8]=u,t[9]=d):d=t[9];let f;t[10]!==l||t[11]!==d?(f=(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-1`,children:[l,d]}),t[10]=l,t[11]=d,t[12]=f):f=t[12];let p;return t[13]!==c||t[14]!==f?(p=(0,Q.jsxs)(`div`,{className:`flex items-start gap-3 border-t border-edge-subtle px-5 py-3 first:border-t-0`,children:[s,c,f]}),t[13]=c,t[14]=f,t[15]=p):p=t[15],p}function Ye(e){let t=(0,X.c)(39),{item:n,language:r,busy:i,expanded:a,onToggle:o,onArchive:s}=e,c=Oe[r],l=n.updatedAt??n.createdAt,u;t[0]!==r||t[1]!==l?(u=Me(l,r),t[0]=r,t[1]=l,t[2]=u):u=t[2];let d=u,f;t[3]===n.content?f=t[4]:(f=n.content.length>96||n.content.includes(`
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{u as i}from"./chunk-KS7C4IRE-Cq1tE_3b.js";import{t as a}from"./check-DUBLcKHA.js";import{n as o,r as s}from"./popover-select-DldSX8GX.js";import{t as c}from"./circle-check-C23XjkUj.js";import{t as l}from"./clock-3-DnrAnuyZ.js";import{t as u}from"./git-branch-Dh9uxTot.js";import{t as d}from"./loader-circle-CifKLtgG.js";import{t as f}from"./message-circle-Badhj-4D.js";import{t as p}from"./x-B_N4OPjy.js";import{t as m}from"./cn-JdwAhgNB.js";import{n as h}from"./locale-store-eliqUnBr.js";import{a as g,c as _,i as v,n as y,o as b,r as x,s as S,t as C}from"./dist-BGTk37IG.js";import{i as w}from"./vendor-swr-BIWyz7Rc.js";import{t as T}from"./button-CGlRPNzi.js";import{t as E}from"./skeleton-BwbyijEw.js";import{$ as D,$r as O,Du as k,Hl as A,J as j,Js as ee,Mo as M,Ou as N,Pu as P,Q as F,Rl as I,Tu as L,Vc as te,Wu as R,Yl as z,al as B,au as ne,dl as V,ei as H,et as U,ho as W,it as re,kc as G,nt as K,nu as q,oc as J,ol as Y,pc as ie,qs as ae,rt as oe,tt as se,wc as ce,wl as le,wu as ue}from"./index-CEkw-fGy.js";import{t as de}from"./page-tabs-B604dteb.js";var X=n(),Z=e(t(),1),Q=r(),fe=new Set([`candidate`,`needs_review`,`conflicted`,`stale`]),pe={zh:{eyebrow:`全局用户理解`,title:`xopc 如何形成对你的理解`,subtitle:`这里汇总跨项目、跨对话形成的认识,并说明它们来自哪些渠道。项目事实不会混入你的个人画像。`,channels:`理解渠道`,channelHint:`每个渠道只贡献有依据的候选内容。`,noChannels:`尚未通过任何渠道形成可展示的全局理解。`,activeCount:`{{count}} 条已在使用`,pendingCount:`{{count}} 条待确认`,noUnderstanding:`尚未从这个渠道形成可使用的全局理解`,pending:`需要你确认`,pendingHint:`确认后才会用于其他项目和之后的对话。`,nothingPending:`目前没有需要确认的全局理解。`,source:`来源`,remember:`确认`,discard:`不是这样`,edit:`修正`,save:`保存修正`,cancel:`取消`,showAll:`查看全部 {{count}} 条`,showLess:`收起`,done:`完成`,updating:`正在从已授权渠道更新理解;你可以先查看已有内容。`,sourceKinds:{user:`你明确告诉我的`,conversation:`对话与协作`,connector:`连接的服务`,work_folder:`工作目录`,local_source:`本机来源`,inference:`综合整理`},categories:{identity:`关于你是谁`,preference:`偏好`,value:`价值取向`,routine:`工作习惯`,capability:`能力与职责`,relationship:`协作关系`,current_state:`当前状态`,derived_insight:`综合判断`}},en:{eyebrow:`Global user understanding`,title:`How xopc forms its understanding of you`,subtitle:`This brings together understanding formed across projects and conversations, with the channel behind each item. Project facts stay out of your personal portrait.`,channels:`Understanding channels`,channelHint:`Each channel contributes only evidence-backed candidates.`,noChannels:`No channel has formed displayable global understanding yet.`,activeCount:`{{count}} in use`,pendingCount:`{{count}} to review`,noUnderstanding:`No usable global understanding has formed from this channel yet`,pending:`Needs your confirmation`,pendingHint:`Only confirmed items may be used across projects and future conversations.`,nothingPending:`There is no global understanding to review right now.`,source:`Source`,remember:`Confirm`,discard:`Not true`,edit:`Correct`,save:`Save correction`,cancel:`Cancel`,showAll:`View all {{count}}`,showLess:`Show less`,done:`Done`,updating:`Updating from authorized channels. You can review existing understanding now.`,sourceKinds:{user:`You told me`,conversation:`Conversations and work`,connector:`Connected services`,work_folder:`Work folders`,local_source:`On-device sources`,inference:`Synthesized understanding`},categories:{identity:`Who you are`,preference:`Preference`,value:`Values`,routine:`Routine`,capability:`Capabilities and responsibilities`,relationship:`Collaboration`,current_state:`Current state`,derived_insight:`Synthesis`}}},me={"local-recent-files":{en:`Recent files`,zh:`最近文件`},"chromium-bookmarks":{en:`Recent bookmarks`,zh:`最近书签`},"apple-notes":{en:`Apple Notes`,zh:`Apple 备忘录`},"apple-mail":{en:`Apple Mail`,zh:`Apple 邮件`},"apple-calendar":{en:`Apple Calendar`,zh:`Apple 日历`},"apple-reminders":{en:`Apple Reminders`,zh:`Apple 提醒事项`},"windows-recent-documents":{en:`Recent documents`,zh:`最近文档`},"linux-recent-documents":{en:`Recent documents`,zh:`最近文档`}},he={user:ae,conversation:f,connector:q,work_folder:A,local_source:z,inference:q},$={files:A,recent_documents:z,calendar:L,tasks:V,notes:J,mail:Y,messages:f,code_activity:u};function ge(e){let t=e.authority===`user_explicit`?`user`:e.authority===`user_observed`?`conversation`:e.authority===`external_untrusted`?`connector`:`inference`;return{id:t,kind:t,observedAt:e.observedAt}}function _e(e,t){return e.kind===`local_source`&&e.label?me[e.label]?.[t]??e.label:e.kind===`work_folder`&&e.label?t===`zh`?`工作目录 · ${e.label}`:`Work folder · ${e.label}`:e.label?e.label:pe[t].sourceKinds[e.kind]}function ve(e){return`${e.kind}:${e.adapterId}:${e.displayName}`}function ye(e){let t=(0,X.c)(82),{assertions:n,configuredSources:r,activityRunning:i,language:o,busy:s,error:l,onReviewAssertion:u,onCompleted:f}=e,h=pe[o],[g,_]=(0,Z.useState)(!1),[v,y]=(0,Z.useState)(null),[b,x]=(0,Z.useState)(``),S;t[0]===n?S=t[1]:(S=n.filter(Ee),t[0]=n,t[1]=S);let C=S,w;t[2]===C?w=t[3]:(w=C.filter(Te),t[2]=C,t[3]=w);let E=w,D;if(t[4]!==r||t[5]!==C||t[6]!==o){let e=new Map;for(let t of r){let n=t.kind===`local_source`?me[t.adapterId]?.[o]??t.displayName:t.displayName,r=ve(t);e.set(r,{key:r,kind:t.kind,category:t.category,label:t.kind===`work_folder`?o===`zh`?`工作目录 · ${n}`:`Work folder · ${n}`:n,assertions:[],lastObservedAt:t.lastCollectedAt})}for(let t of C)for(let n of t.sources?.length?t.sources:[ge(t)]){let r=_e(n,o),i=[...e.values()].find(e=>e.kind===n.kind&&e.label===r),a=i?.key??`${n.kind}:${r}`,s=i??e.get(a)??{key:a,kind:n.kind,category:n.category,label:r,assertions:[],lastObservedAt:n.observedAt};s.assertions.some(e=>e.id===t.id)||s.assertions.push(t),s.lastObservedAt=Math.max(s.lastObservedAt??0,n.observedAt),e.set(a,s)}D=[...e.values()].sort(we),t[4]=r,t[5]=C,t[6]=o,t[7]=D}else D=t[7];let O=D,k;t[8]===u?k=t[9]:(k=async(e,t,n)=>{await u(e,t,n)&&y(null)},t[8]=u,t[9]=k);let A=k,j;t[10]!==E||t[11]!==g?(j=g?E:E.slice(0,5),t[10]=E,t[11]=g,t[12]=j):j=t[12];let ee=j,M;t[13]===h.eyebrow?M=t[14]:(M=(0,Q.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.18em] text-accent-fg`,children:h.eyebrow}),t[13]=h.eyebrow,t[14]=M);let N;t[15]===h.title?N=t[16]:(N=(0,Q.jsx)(`h2`,{className:`mt-3 text-2xl font-semibold tracking-tight text-fg sm:text-3xl`,children:h.title}),t[15]=h.title,t[16]=N);let P;t[17]===h.subtitle?P=t[18]:(P=(0,Q.jsx)(`p`,{className:`mx-auto mt-3 max-w-[38rem] text-sm leading-6 text-fg-muted`,children:h.subtitle}),t[17]=h.subtitle,t[18]=P);let F;t[19]!==M||t[20]!==N||t[21]!==P?(F=(0,Q.jsxs)(`div`,{className:`text-center`,children:[M,N,P]}),t[19]=M,t[20]=N,t[21]=P,t[22]=F):F=t[22];let I;t[23]!==i||t[24]!==h.updating?(I=i?(0,Q.jsxs)(`div`,{className:`mt-6 flex items-center gap-3 rounded-2xl border border-accent/20 bg-accent-soft/55 px-4 py-3 text-sm text-accent-fg`,children:[(0,Q.jsx)(d,{className:`size-4 shrink-0 animate-spin motion-reduce:animate-none`}),(0,Q.jsx)(`p`,{children:h.updating})]}):null,t[23]=i,t[24]=h.updating,t[25]=I):I=t[25];let L;t[26]===h.channels?L=t[27]:(L=(0,Q.jsx)(`h3`,{id:`understanding-channels-title`,className:`text-sm font-semibold text-fg`,children:h.channels}),t[26]=h.channels,t[27]=L);let R;t[28]===h.channelHint?R=t[29]:(R=(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:h.channelHint}),t[28]=h.channelHint,t[29]=R);let z;t[30]!==O||t[31]!==h.activeCount||t[32]!==h.noChannels||t[33]!==h.noUnderstanding||t[34]!==h.pendingCount?(z=O.length?(0,Q.jsx)(`div`,{className:`mt-3 space-y-3`,children:O.map(e=>{let t=e.category?$[e.category]??he[e.kind]:he[e.kind],n=e.assertions.filter(Ce).length,r=e.assertions.filter(Se).length;return(0,Q.jsxs)(`article`,{className:`rounded-2xl border border-edge bg-surface-base/55 px-4 py-4`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Q.jsx)(`div`,{className:`flex size-9 shrink-0 items-center justify-center rounded-xl bg-surface-muted text-fg-muted`,children:(0,Q.jsx)(t,{className:`size-4`})}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`h4`,{className:`truncate text-sm font-medium text-fg`,children:e.label}),e.assertions.length?(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[n?h.activeCount.replace(`{{count}}`,String(n)):``,r?h.pendingCount.replace(`{{count}}`,String(r)):``].filter(Boolean).join(` · `)}):(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:h.noUnderstanding})]})]}),e.assertions.length?(0,Q.jsx)(`ul`,{className:`ml-12 mt-3 space-y-2 border-t border-edge-subtle pt-3 text-xs leading-5 text-fg-muted`,children:e.assertions.slice(0,5).map(xe)}):null]},e.key)})}):(0,Q.jsx)(`p`,{className:`mt-3 rounded-2xl border border-edge bg-surface-base/55 p-4 text-sm text-fg-muted`,children:h.noChannels}),t[30]=O,t[31]=h.activeCount,t[32]=h.noChannels,t[33]=h.noUnderstanding,t[34]=h.pendingCount,t[35]=z):z=t[35];let B;t[36]!==L||t[37]!==R||t[38]!==z?(B=(0,Q.jsxs)(`section`,{className:`mt-8`,"aria-labelledby":`understanding-channels-title`,children:[L,R,z]}),t[36]=L,t[37]=R,t[38]=z,t[39]=B):B=t[39];let ne=E.length?` · ${E.length}`:``,V;t[40]!==h.pending||t[41]!==ne?(V=(0,Q.jsxs)(`h3`,{id:`understanding-pending-title`,className:`text-sm font-semibold text-fg`,children:[h.pending,ne]}),t[40]=h.pending,t[41]=ne,t[42]=V):V=t[42];let H;t[43]===h.pendingHint?H=t[44]:(H=(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:h.pendingHint}),t[43]=h.pendingHint,t[44]=H);let U;t[45]!==s||t[46]!==b||t[47]!==v||t[48]!==o||t[49]!==E.length||t[50]!==A||t[51]!==g||t[52]!==h.cancel||t[53]!==h.categories||t[54]!==h.discard||t[55]!==h.edit||t[56]!==h.nothingPending||t[57]!==h.remember||t[58]!==h.save||t[59]!==h.showAll||t[60]!==h.showLess||t[61]!==h.source||t[62]!==ee?(U=E.length?(0,Q.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[ee.map(e=>{let t=v===e.id,n=(e.sources?.length?e.sources:[ge(e)]).map(e=>_e(e,o));return(0,Q.jsxs)(`article`,{className:`rounded-2xl border border-edge bg-surface-panel p-4 shadow-surface sm:p-5`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-[11px]`,children:[(0,Q.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 font-medium text-accent-fg`,children:h.categories[e.kind]}),(0,Q.jsxs)(`span`,{className:`text-fg-subtle`,children:[h.source,`: `,n.join(` · `)]})]}),t?(0,Q.jsx)(`textarea`,{autoFocus:!0,value:b,onChange:e=>x(e.target.value),className:`mt-3 min-h-24 w-full resize-y rounded-xl border border-edge bg-surface-base px-3 py-2.5 text-sm leading-6 text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/15`}):(0,Q.jsx)(`p`,{className:`mt-3 text-[0.95rem] font-medium leading-7 text-fg`,children:e.statement}),t?(0,Q.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,Q.jsx)(T,{variant:`ghost`,disabled:s,onClick:()=>y(null),children:h.cancel}),(0,Q.jsxs)(T,{variant:`primary`,disabled:s||!b.trim(),onClick:()=>void A(e,`edited`,b.trim()),children:[s?(0,Q.jsx)(d,{className:`size-4 animate-spin`}):(0,Q.jsx)(a,{className:`size-4`}),h.save]})]}):(0,Q.jsxs)(`div`,{className:`mt-4 flex flex-wrap justify-end gap-2`,children:[(0,Q.jsxs)(T,{variant:`ghost`,disabled:s,onClick:()=>{y(e.id),x(e.statement)},children:[(0,Q.jsx)(te,{className:`size-3.5`}),h.edit]}),(0,Q.jsxs)(T,{variant:`secondary`,disabled:s,onClick:()=>void A(e,`rejected`),children:[(0,Q.jsx)(p,{className:`size-3.5`}),h.discard]}),(0,Q.jsxs)(T,{variant:`primary`,disabled:s,onClick:()=>void A(e,`accepted`),children:[s?(0,Q.jsx)(d,{className:`size-4 animate-spin`}):(0,Q.jsx)(a,{className:`size-4`}),h.remember]})]})]},e.id)}),E.length>5?(0,Q.jsxs)(`button`,{type:`button`,className:`mx-auto flex items-center gap-1.5 px-3 py-2 text-xs font-medium text-accent-fg hover:underline`,onClick:()=>_(be),children:[g?h.showLess:h.showAll.replace(`{{count}}`,String(E.length)),(0,Q.jsx)(ue,{className:m(`size-3.5 transition-transform`,g&&`rotate-180`)})]}):null]}):(0,Q.jsxs)(`div`,{className:`mt-3 flex items-start gap-3 rounded-2xl border border-edge bg-surface-base/55 p-4`,children:[(0,Q.jsx)(c,{className:`mt-0.5 size-5 shrink-0 text-success`}),(0,Q.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:h.nothingPending})]}),t[45]=s,t[46]=b,t[47]=v,t[48]=o,t[49]=E.length,t[50]=A,t[51]=g,t[52]=h.cancel,t[53]=h.categories,t[54]=h.discard,t[55]=h.edit,t[56]=h.nothingPending,t[57]=h.remember,t[58]=h.save,t[59]=h.showAll,t[60]=h.showLess,t[61]=h.source,t[62]=ee,t[63]=U):U=t[63];let W;t[64]!==V||t[65]!==H||t[66]!==U?(W=(0,Q.jsxs)(`section`,{className:`mt-8`,"aria-labelledby":`understanding-pending-title`,children:[V,H,U]}),t[64]=V,t[65]=H,t[66]=U,t[67]=W):W=t[67];let re;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Q.jsx)(a,{className:`size-4`}),t[68]=re):re=t[68];let G;t[69]!==s||t[70]!==f||t[71]!==h.done?(G=(0,Q.jsx)(`div`,{className:`mt-6 flex justify-end`,children:(0,Q.jsxs)(T,{variant:`primary`,disabled:s,onClick:f,children:[re,h.done]})}),t[69]=s,t[70]=f,t[71]=h.done,t[72]=G):G=t[72];let K;t[73]===l?K=t[74]:(K=l?(0,Q.jsx)(`p`,{className:`mt-5 text-sm text-danger`,role:`alert`,children:l}):null,t[73]=l,t[74]=K);let q;return t[75]!==I||t[76]!==B||t[77]!==W||t[78]!==G||t[79]!==K||t[80]!==F?(q=(0,Q.jsxs)(`section`,{className:`mx-auto w-full max-w-[42rem] pb-2`,"aria-live":`polite`,children:[F,I,B,W,G,K]}),t[75]=I,t[76]=B,t[77]=W,t[78]=G,t[79]=K,t[80]=F,t[81]=q):q=t[81],q}function be(e){return!e}function xe(e){return(0,Q.jsxs)(`li`,{className:`flex gap-2`,children:[(0,Q.jsx)(`span`,{className:`mt-2 size-1 shrink-0 rounded-full bg-accent/60`}),(0,Q.jsx)(`span`,{children:e.statement})]},e.id)}function Se(e){return fe.has(e.status)}function Ce(e){return e.status===`active`}function we(e,t){return t.assertions.length-e.assertions.length||(t.lastObservedAt??0)-(e.lastObservedAt??0)}function Te(e){return fe.has(e.status)}function Ee(e){return e.scope.type===`global`&&e.status!==`archived`&&e.status!==`rejected`}function De(){let{pathname:e,search:t}=i(),n=h(e=>e.language),r=j(),[a,o]=(0,Z.useState)(!1),[s,c]=(0,Z.useState)(null),l=e===`/user-model`,{data:u,mutate:f}=w(l?`/api/user-model`:null,U),E=n===`zh`,D=u?.assertions.filter(e=>e.scope.type===`global`&&[`candidate`,`needs_review`,`conflicted`,`stale`].includes(e.status)).length??0;if((0,Z.useEffect)(()=>{if(!l)return;let e=new URLSearchParams(t);if(e.get(`workDiscovery`)!==`review`)return;let n=e.get(`run`),r=!1;return(async()=>{if(n&&j.getState().directoryRun?.id!==n)try{let e=await O(n);if(r)return;j.getState().updateDirectoryRun(e)}catch{return}r||j.getState().setDrawerOpen(!0)})(),()=>{r=!0}},[l,t]),(0,Z.useEffect)(()=>{l&&r.status!==`running`&&f()},[f,l,r.directoryRun?.id,r.status]),!l)return null;let k=r.status===`running`,A=async(e,t,n)=>{let i=j.getState().directoryRun,a=i?.result?.profileCandidates?.find(t=>t.id===e.id||!!(t.assertionId&&t.assertionId===e.assertionId)),s=r.memories.find(t=>t.id===e.id||!!(t.assertionId&&t.assertionId===e.assertionId));if(!a&&!s?.assertionId)return!1;o(!0),c(null);try{if(i&&a){let e=await H(i.id,[{id:a.id,status:t,...n?{statement:n}:{}}]);j.getState().updateDirectoryRun(e)}return s?.assertionId&&await j.getState().reviewMemory(s.assertionId,t===`accepted`,n),await f(),!0}catch(e){return c(e instanceof Error?e.message:String(e)),!1}finally{o(!1)}},ee=async(e,t,n)=>{let r=[...j.getState().directoryRun?.result?.profileCandidates??[],...j.getState().memories].find(t=>t.assertionId===e.id);if(r)return A(r,t,n);o(!0),c(null);try{return t===`edited`&&n?await F(e.id,n):await se(e.id,t===`accepted`?`active`:`rejected`),await f(),!0}catch(e){return c(e instanceof Error?e.message:String(e)),!1}finally{o(!1)}},N=e=>{if(!e&&u&&D===0&&r.status!==`running`){r.finish();return}r.setDrawerOpen(e)};return(0,Q.jsxs)(C,{open:r.drawerOpen,onOpenChange:N,children:[(0,Q.jsx)(_,{asChild:!0,children:(0,Q.jsxs)(T,{type:`button`,variant:`ghost`,className:m(`relative size-8 rounded-xl p-0`,M),title:E?`查看 xopc 对你的理解`:`Review what xopc understands`,"aria-label":E?`查看 xopc 对你的理解`:`Review what xopc understands`,children:[k?(0,Q.jsx)(d,{className:`size-4 animate-spin motion-reduce:animate-none`}):(0,Q.jsx)(ie,{className:`size-4 text-accent-fg`}),D?(0,Q.jsx)(`span`,{className:`absolute right-0.5 top-0.5 size-2 rounded-full bg-accent ring-2 ring-surface-panel`}):null]})}),(0,Q.jsxs)(b,{children:[(0,Q.jsx)(g,{className:`fixed inset-0 z-[60] bg-scrim backdrop-blur-sm data-[state=closed]:animate-out data-[state=open]:animate-in motion-reduce:backdrop-blur-none`}),(0,Q.jsx)(`div`,{className:`pointer-events-none fixed inset-0 z-[61] flex items-center justify-center p-3 sm:p-6`,children:(0,Q.jsxs)(x,{className:`xopc-understanding-center pointer-events-auto flex h-[min(42rem,calc(100dvh-1.5rem))] w-[min(44rem,calc(100vw-1.5rem))] flex-col overflow-hidden rounded-[1.75rem] border border-edge bg-surface-panel shadow-float outline-none sm:h-[min(42rem,calc(100dvh-3rem))] sm:w-[min(44rem,calc(100vw-3rem))]`,children:[(0,Q.jsxs)(`header`,{className:`flex h-16 shrink-0 items-center justify-between border-b border-edge-subtle px-5 sm:px-6`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(S,{className:`text-sm font-semibold text-fg`,children:k?E?`正在更新用户理解`:`Updating user understanding`:E?`用户理解`:`User understanding`}),(0,Q.jsx)(v,{className:`mt-0.5 text-xs text-fg-muted`,children:k?E?`关闭窗口也会在后台继续`:`You can close this window; work continues in the background`:D?E?`${D} 条全局理解待确认`:`${D} global item(s) to review`:E?`查看理解来自哪些渠道`:`See which channels shaped it`})]}),(0,Q.jsx)(y,{asChild:!0,children:(0,Q.jsx)(T,{variant:`ghost`,className:`size-8 rounded-xl p-0`,"aria-label":E?`关闭`:`Close`,children:(0,Q.jsx)(p,{className:`size-4`})})})]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-7 sm:px-9 sm:py-9`,children:u?(0,Q.jsx)(ye,{assertions:u.assertions,configuredSources:u.sources??[],activityRunning:k,language:n,busy:a,error:s,onReviewAssertion:ee,onCompleted:()=>{N(!1)}}):(0,Q.jsx)(`section`,{className:`flex min-h-full items-center justify-center`,"aria-label":E?`正在加载用户理解`:`Loading user understanding`,children:(0,Q.jsx)(d,{className:`size-5 animate-spin text-fg-muted motion-reduce:animate-none`})})})]})})]})]})}var Oe={en:{pageTitle:`You`,pageSubtitle:`A living portrait shaped by you and xopc.`,overview:`Your portrait`,understanding:`Shared understanding`,knowledge:`Work memory`,portraitEyebrow:`YOU × XOPC`,portraitIntro:`Your explicit profile stays clear and editable. xopc builds a separate shared understanding through conversations and work.`,editProfile:`Edit basics`,callName:`What should xopc call you?`,callNamePlaceholder:`For example: Alex, Joyce, or Dr. Chen`,role:`Your role`,rolePlaceholder:`For example: founder, designer, or engineer`,pronouns:`Pronouns (optional)`,pronounsPlaceholder:`For example: she/her, he/him, they/them`,timezone:`Timezone`,locale:`Language / locale`,useDeviceTimezone:`Use this device`,notProvided:`Not provided`,editProfileHint:`These are facts you provide directly. They remain separate from xopc’s observations and inferences.`,saveProfile:`Save`,saving:`Saving…`,explicit:`You told me`,explicitHint:`Facts and preferences you stated directly`,learned:`Learned together`,learnedHint:`Patterns formed from our work`,pending:`To confirm together`,pendingHint:`Items that need your judgment`,confirmTogether:`Confirm together`,confirmHint:`These may affect future behavior. Confirm them, correct the wording, or tell me not to use them.`,nothingToConfirm:`Nothing needs your confirmation right now.`,importantNow:`What matters now`,noPriority:`No current priority has been set.`,otherGoals:`Other active outcomes`,howWeWork:`How we work together`,howWeWorkHint:`Your standing instructions for how I should communicate and act.`,noRules:`No collaboration preferences yet.`,recent:`Recently formed understanding`,recentHint:`The most useful current facts, with their origin and time horizon.`,seeAll:`See all`,workMemory:`What I remember from the work`,workMemoryHint:`Project facts, decisions, lessons, and open questions stay separate from facts about you.`,items:`items`,maintenanceReady:`Memory upkeep is enabled and waiting for its first run.`,maintenanceComplete:`Memory was last organized`,maintenanceFailed:`The latest memory upkeep needs attention`,refresh:`Refresh`,aboutYouTitle:`A view you can correct`,aboutYouHint:`This is working context, not a fixed profile. Every item can be corrected or retired.`,identity:`Who you are`,preferences:`Preferences and working rhythm`,relationships:`People and relationships`,currentState:`Current context`,insights:`My current read`,emptyGroup:`No understanding has formed here yet.`,correct:`Correct`,stopUsing:`Stop using`,confirm:`Confirm`,notTrue:`Not true`,save:`Save correction`,cancel:`Cancel`,correctionPlaceholder:`Write the accurate version…`,searchPlaceholder:`Search work memory…`,allMemory:`All work memory`,memoryLibraryHint:`Only distilled facts, decisions, lessons, commitments, and open questions appear here. Source records stay with their connector.`,noKnowledge:`No work memory has formed yet.`,noKnowledgeMatch:`No work memory matches this search.`,archive:`Archive`,showMore:`Show more`,expand:`Show details`,collapse:`Hide details`,disable:`Disable`,disabled:`Not in use`,enable:`Enable`,loadFailed:`Could not load your understanding.`,tryAgain:`Try again`,actionFailed:`The change could not be saved. Please try again.`},zh:{pageTitle:`你`,pageSubtitle:`一份由你和 xopc 共同塑造、持续生长的画像。`,overview:`你的画像`,understanding:`共同理解`,knowledge:`工作记忆`,portraitEyebrow:`YOU × XOPC`,portraitIntro:`你明确提供的基本信息会被清晰呈现并由你直接编辑;xopc 在对话与共事中形成的理解则单独维护。`,editProfile:`编辑基本信息`,callName:`希望 xopc 如何称呼你?`,callNamePlaceholder:`例如:Mic、Joyce、张老师`,role:`你的角色`,rolePlaceholder:`例如:创业者、产品设计师、工程师`,pronouns:`代词(可选)`,pronounsPlaceholder:`例如:she/her、he/him、they/them`,timezone:`时区`,locale:`语言 / 地区`,useDeviceTimezone:`使用本机时区`,notProvided:`未填写`,editProfileHint:`这些是由你直接提供的事实,与 xopc 的观察和推断分开维护。`,saveProfile:`保存`,saving:`正在保存…`,explicit:`你告诉我的`,explicitHint:`你明确表达的事实与偏好`,learned:`协作中学到的`,learnedHint:`从实际协作中形成的认识`,pending:`等待一起确认`,pendingHint:`需要由你判断的内容`,confirmTogether:`一起确认`,confirmHint:`这些理解可能影响之后的行为。你可以确认、修正,或告诉我以后不要使用。`,nothingToConfirm:`目前没有需要你确认的理解。`,importantNow:`此刻重要`,noPriority:`还没有设置当前优先事项。`,otherGoals:`其他进行中的目标`,howWeWork:`我们怎样协作`,howWeWorkHint:`你对沟通方式和执行行为的长期约定。`,noRules:`还没有形成协作偏好。`,recent:`最近形成的理解`,recentHint:`最值得使用的当前认识,同时说明它来自哪里、适用多久。`,seeAll:`查看全部`,workMemory:`我在工作中记住的`,workMemoryHint:`项目事实、决定、经验和待解问题,与“关于你”的理解分别管理。`,items:`条`,maintenanceReady:`记忆整理已经启用,正在等待首次运行。`,maintenanceComplete:`最近一次记忆整理于`,maintenanceFailed:`最近一次记忆整理需要处理`,refresh:`刷新`,aboutYouTitle:`一份可以共同修正的理解`,aboutYouHint:`它是协作中的工作认知,不是给你定型的档案。每一条都能修正或停止使用。`,identity:`关于你是谁`,preferences:`偏好与工作节奏`,relationships:`重要的人与关系`,currentState:`当前状态`,insights:`我形成的判断`,emptyGroup:`这里还没有形成理解。`,correct:`修正`,stopUsing:`不再使用`,confirm:`确认`,notTrue:`不是这样`,save:`保存修正`,cancel:`取消`,correctionPlaceholder:`写下更准确的说法…`,searchPlaceholder:`搜索工作记忆…`,allMemory:`全部工作记忆`,memoryLibraryHint:`这里只显示提炼后的事实、决定、经验、承诺和待解问题;邮件、日历与文档原文保留在对应来源中。`,noKnowledge:`还没有形成工作记忆。`,noKnowledgeMatch:`没有符合搜索条件的工作记忆。`,archive:`归档`,showMore:`显示更多`,expand:`查看详情`,collapse:`收起详情`,disable:`停用`,disabled:`已停用`,enable:`启用`,loadFailed:`无法载入对你的理解。`,tryAgain:`重试`,actionFailed:`修改没有保存,请重试。`}},ke=[`candidate`,`needs_review`,`conflicted`,`stale`],Ae=new Set([`identity.call_name`,`identity.role`,`identity.pronouns`,`preference.timezone`,`preference.locale`]),je=[`project_fact`,`workspace_fact`,`decision`,`task_lesson`,`commitment`,`open_question`,`episode`,`note`];function Me(e,t,n=!1){return e?new Intl.DateTimeFormat(t===`zh`?`zh-CN`:`en`,{dateStyle:`medium`,...n?{timeStyle:`short`}:{}}).format(e):null}function Ne(e){return typeof e==`string`&&e.trim()?e.trim():void 0}function Pe(e){return{callName:Ne(e.profile.callName)??``,role:Ne(e.profile.role)??``,pronouns:Ne(e.profile.pronouns)??``,timezone:Ne(e.profile.timezone)??``,locale:Ne(e.profile.locale)??``}}function Fe(e,t){return{"zh-CN":{en:`Simplified Chinese`,zh:`简体中文`},"zh-TW":{en:`Traditional Chinese`,zh:`繁体中文`},"en-US":{en:`English (US)`,zh:`英语(美国)`},"en-GB":{en:`English (UK)`,zh:`英语(英国)`},"ja-JP":{en:`Japanese`,zh:`日语`}}[e]?.[t]??e}function Ie(e){return Array.from(e.trim()).slice(0,2).join(``).toLocaleUpperCase()}function Le(e,t){return(t===`zh`?{user_explicit:`你告诉我的`,user_observed:`从协作中观察到`,system_inferred:`我形成的判断`,external_untrusted:`来自连接的信息`}:{user_explicit:`You told me`,user_observed:`Observed while working together`,system_inferred:`My current read`,external_untrusted:`From connected information`})[e.authority]}function Re(e,t){if(e.validTo){let n=Me(e.validTo,t);return t===`zh`?`适用至 ${n}`:`Applies until ${n}`}return(t===`zh`?{stable:`长期有效`,slow:`会随时间复核`,dynamic:`近期状态`,event:`特定阶段`}:{stable:`Long-term`,slow:`Reviewed over time`,dynamic:`Current context`,event:`Specific period`})[e.volatility]}function ze(e,t){let n=Me(e,t);return t===`zh`?`当前安排至 ${n}`:`Current plan through ${n}`}function Be(e,t){return e.authority===`user_explicit`?null:e.confidence>=.85?t===`zh`?`把握较高`:`High confidence`:e.confidence>=.65?t===`zh`?`把握中等`:`Medium confidence`:t===`zh`?`仍需确认`:`Needs confirmation`}function Ve(e,t){return(t===`zh`?{global:`所有协作`,agent:`当前智能体`,workspace:`当前工作区`,project:`当前项目`,session:`当前会话`}:{global:`All work`,agent:`This agent`,workspace:`This workspace`,project:`This project`,session:`This conversation`})[e.type]}function He(e,t){return(t===`zh`?{project_fact:`项目事实`,workspace_fact:`工作区事实`,decision:`已经决定`,task_lesson:`工作经验`,commitment:`承诺与约定`,open_question:`待解问题`,episode:`重要经历`,note:`其他记录`}:{project_fact:`Project facts`,workspace_fact:`Workspace facts`,decision:`Decisions`,task_lesson:`Lessons`,commitment:`Commitments`,open_question:`Open questions`,episode:`Episodes`,note:`Notes`})[e]}function Ue(e,t,n){if(e)return e.targetType===`goal`?t.find(t=>t.id===e.targetId)?.title:/^[0-9a-f]{8}-[0-9a-f-]{20,}$/i.test(e.targetId)?(n===`zh`?{project:`当前项目`,task:`当前任务`,assertion:`一项待处理的理解`,topic:`当前主题`}:{project:`Current project`,task:`Current task`,assertion:`An understanding to address`,topic:`Current topic`})[e.targetType]:e.targetId}function We(e){let t=(0,X.c)(14),{title:n,hint:r,action:i,children:a,className:o}=e,s=`rounded-xl border border-edge bg-surface-panel shadow-surface ${o===void 0?``:o}`,c;t[0]===n?c=t[1]:(c=(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n}),t[0]=n,t[1]=c);let l;t[2]===r?l=t[3]:(l=r?(0,Q.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm leading-5 text-fg-muted`,children:r}):null,t[2]=r,t[3]=l);let u;t[4]!==c||t[5]!==l?(u=(0,Q.jsxs)(`div`,{children:[c,l]}),t[4]=c,t[5]=l,t[6]=u):u=t[6];let d;t[7]!==i||t[8]!==u?(d=(0,Q.jsxs)(`header`,{className:`flex items-start justify-between gap-4 border-b border-edge-subtle px-5 py-4`,children:[u,i]}),t[7]=i,t[8]=u,t[9]=d):d=t[9];let f;return t[10]!==a||t[11]!==s||t[12]!==d?(f=(0,Q.jsxs)(`section`,{className:s,children:[d,a]}),t[10]=a,t[11]=s,t[12]=d,t[13]=f):f=t[13],f}function Ge(e){let t=(0,X.c)(7),{icon:n,children:r}=e,i;t[0]===n?i=t[1]:(i=(0,Q.jsx)(`span`,{className:`text-fg-subtle`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=(0,Q.jsx)(`p`,{children:r}),t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,Q.jsxs)(`div`,{className:`flex min-h-32 flex-col items-center justify-center gap-2 px-5 py-8 text-center text-sm text-fg-muted`,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function Ke({open:e,profile:t,language:n,saving:r,onOpenChange:i,onSave:a}){let c=Oe[n],[l,u]=(0,Z.useState)(t);(0,Z.useEffect)(()=>{e&&u(t)},[e,t]);let f=e=>{e.preventDefault(),a({callName:l.callName.trim(),role:l.role.trim(),pronouns:l.pronouns.trim(),timezone:l.timezone.trim(),locale:l.locale.trim()})},m=(e,t,n)=>(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:t}),(0,Q.jsx)(`input`,{value:l[e],onChange:t=>u(n=>({...n,[e]:t.target.value})),placeholder:n,className:`h-10 w-full rounded-xl border border-edge bg-surface-base px-3 text-sm text-fg outline-none transition placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`})]}),h=[`zh-CN`,`zh-TW`,`en-US`,`en-GB`,`ja-JP`];return l.locale&&!h.includes(l.locale)&&h.push(l.locale),(0,Q.jsx)(C,{open:e,onOpenChange:i,children:(0,Q.jsxs)(b,{children:[(0,Q.jsx)(g,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Q.jsx)(x,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[90] h-[min(40rem,calc(100vh-2rem))] w-[min(42rem,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,Q.jsxs)(`form`,{className:`flex h-full min-h-0 flex-col`,onSubmit:f,children:[(0,Q.jsxs)(`header`,{className:`flex shrink-0 items-start justify-between gap-4 border-b border-edge px-5 py-4 sm:px-6`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(S,{className:`font-semibold text-fg`,children:c.editProfile}),(0,Q.jsx)(v,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:c.editProfileHint})]}),(0,Q.jsx)(y,{asChild:!0,children:(0,Q.jsx)(T,{variant:`ghost`,className:`size-8 shrink-0 p-0`,"aria-label":c.cancel,children:(0,Q.jsx)(p,{className:`size-4`})})})]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5 sm:p-6`,children:(0,Q.jsxs)(`div`,{className:`grid gap-5 sm:grid-cols-2`,children:[m(`callName`,c.callName,c.callNamePlaceholder),m(`role`,c.role,c.rolePlaceholder),m(`pronouns`,c.pronouns,c.pronounsPlaceholder),(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:c.locale}),(0,Q.jsxs)(o,{value:l.locale,onChange:e=>u(t=>({...t,locale:e.target.value})),children:[(0,Q.jsx)(s,{value:``,children:c.notProvided}),h.map(e=>(0,Q.jsx)(s,{value:e,children:Fe(e,n)},e))]})]}),(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-sm sm:col-span-2`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:c.timezone}),(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsx)(`input`,{value:l.timezone,onChange:e=>u(t=>({...t,timezone:e.target.value})),placeholder:D(),className:`h-10 min-w-0 flex-1 rounded-xl border border-edge bg-surface-base px-3 text-sm text-fg outline-none transition placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`}),(0,Q.jsx)(T,{className:`shrink-0 whitespace-nowrap`,onClick:()=>u(e=>({...e,timezone:D()})),children:c.useDeviceTimezone})]})]})]})}),(0,Q.jsxs)(`footer`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-3 sm:px-6`,children:[(0,Q.jsx)(y,{asChild:!0,children:(0,Q.jsx)(T,{disabled:r,children:c.cancel})}),(0,Q.jsxs)(T,{type:`submit`,variant:`primary`,disabled:r,children:[r?(0,Q.jsx)(d,{className:`size-4 animate-spin`}):null,r?c.saving:c.saveProfile]})]})]})})]})})}function qe(e){let t=(0,X.c)(28),{item:n,language:r,busy:i,editing:o,draft:s,onDraftChange:c,onEdit:u,onCancel:d,onAction:m,onCorrect:h}=e,g=Oe[r],_;t[0]===n.status?_=t[1]:(_=ke.includes(n.status),t[0]=n.status,t[1]=_);let v=_,y;t[2]!==n||t[3]!==r?(y=Be(n,r),t[2]=n,t[3]=r,t[4]=y):y=t[4];let b=y,x=`rounded-xl border p-4 ${v?`border-edge-strong bg-surface-base`:`border-edge bg-surface-panel`}`,S;t[5]!==i||t[6]!==b||t[7]!==s||t[8]!==o||t[9]!==n||t[10]!==r||t[11]!==v||t[12]!==m||t[13]!==d||t[14]!==h||t[15]!==c||t[16]!==u||t[17]!==g.cancel||t[18]!==g.confirm||t[19]!==g.correct||t[20]!==g.correctionPlaceholder||t[21]!==g.notTrue||t[22]!==g.save||t[23]!==g.stopUsing?(S=o?(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsx)(`label`,{className:`sr-only`,htmlFor:`assertion-${n.id}`,children:g.correctionPlaceholder}),(0,Q.jsx)(`textarea`,{id:`assertion-${n.id}`,value:s,onChange:e=>c(e.target.value),placeholder:g.correctionPlaceholder,className:`min-h-24 w-full resize-y rounded-xl border border-edge bg-surface-base px-3 py-2.5 text-sm leading-6 text-fg outline-none transition focus:border-accent focus:ring-2 focus:ring-accent/20`,autoFocus:!0}),(0,Q.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Q.jsx)(T,{variant:`ghost`,className:`h-8`,onClick:d,children:g.cancel}),(0,Q.jsx)(T,{variant:`primary`,className:`h-8`,disabled:!s.trim()||i,onClick:h,children:g.save})]})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:n.statement}),(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-3 gap-y-1.5 text-xs text-fg-subtle`,children:[(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,Q.jsx)(f,{className:`size-3.5`}),Le(n,r)]}),(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,Q.jsx)(l,{className:`size-3.5`}),Re(n,r)]}),n.scope.type===`global`?null:(0,Q.jsx)(`span`,{children:Ve(n.scope,r)}),b?(0,Q.jsx)(`span`,{children:b}):null]}),(0,Q.jsx)(`div`,{className:`mt-4 flex flex-wrap justify-end gap-1.5`,children:v?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(T,{variant:`secondary`,className:`h-8 gap-1.5 px-2.5`,disabled:i,onClick:()=>m(`active`),children:[(0,Q.jsx)(a,{className:`size-3.5`}),g.confirm]}),(0,Q.jsxs)(T,{variant:`ghost`,className:`h-8 gap-1.5 px-2.5`,disabled:i,onClick:u,children:[(0,Q.jsx)(te,{className:`size-3.5`}),g.correct]}),(0,Q.jsxs)(T,{variant:`ghost`,className:`h-8 gap-1.5 px-2.5`,disabled:i,onClick:()=>m(`rejected`),children:[(0,Q.jsx)(p,{className:`size-3.5`}),g.notTrue]})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(T,{variant:`ghost`,className:`h-8 gap-1.5 px-2.5`,disabled:i,onClick:u,children:[(0,Q.jsx)(te,{className:`size-3.5`}),g.correct]}),(0,Q.jsxs)(T,{variant:`ghost`,className:`h-8 gap-1.5 px-2.5`,disabled:i,onClick:()=>m(`archived`),children:[(0,Q.jsx)(R,{className:`size-3.5`}),g.stopUsing]})]})})]}),t[5]=i,t[6]=b,t[7]=s,t[8]=o,t[9]=n,t[10]=r,t[11]=v,t[12]=m,t[13]=d,t[14]=h,t[15]=c,t[16]=u,t[17]=g.cancel,t[18]=g.confirm,t[19]=g.correct,t[20]=g.correctionPlaceholder,t[21]=g.notTrue,t[22]=g.save,t[23]=g.stopUsing,t[24]=S):S=t[24];let C;return t[25]!==x||t[26]!==S?(C=(0,Q.jsx)(`article`,{className:x,children:S}),t[25]=x,t[26]=S,t[27]=C):C=t[27],C}function Je(e){let t=(0,X.c)(16),{rule:n,language:r,busy:i,onToggle:a}=e,o=Oe[r],s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsx)(I,{className:`mt-0.5 size-4 shrink-0 text-fg-subtle`}),t[0]=s):s=t[0];let c;t[1]===n.statement?c=t[2]:(c=(0,Q.jsx)(`p`,{className:`min-w-0 flex-1 text-sm leading-6 text-fg`,children:n.statement}),t[1]=n.statement,t[2]=c);let l;t[3]!==n.status||t[4]!==o.disabled?(l=n.status===`disabled`?(0,Q.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:o.disabled}):null,t[3]=n.status,t[4]=o.disabled,t[5]=l):l=t[5];let u=n.status===`active`?o.disable:o.enable,d;t[6]!==i||t[7]!==a||t[8]!==u?(d=(0,Q.jsx)(T,{variant:`ghost`,className:`h-8`,disabled:i,onClick:a,children:u}),t[6]=i,t[7]=a,t[8]=u,t[9]=d):d=t[9];let f;t[10]!==l||t[11]!==d?(f=(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-1`,children:[l,d]}),t[10]=l,t[11]=d,t[12]=f):f=t[12];let p;return t[13]!==c||t[14]!==f?(p=(0,Q.jsxs)(`div`,{className:`flex items-start gap-3 border-t border-edge-subtle px-5 py-3 first:border-t-0`,children:[s,c,f]}),t[13]=c,t[14]=f,t[15]=p):p=t[15],p}function Ye(e){let t=(0,X.c)(39),{item:n,language:r,busy:i,expanded:a,onToggle:o,onArchive:s}=e,c=Oe[r],l=n.updatedAt??n.createdAt,u;t[0]!==r||t[1]!==l?(u=Me(l,r),t[0]=r,t[1]=l,t[2]=u):u=t[2];let d=u,f;t[3]===n.content?f=t[4]:(f=n.content.length>96||n.content.includes(`
|
|
2
2
|
`),t[3]=n.content,t[4]=f);let p=f,m;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Q.jsx)(P,{className:`mt-1 size-4 shrink-0 text-fg-subtle`}),t[5]=m):m=t[5];let h=`whitespace-pre-wrap text-sm leading-6 text-fg ${a?``:`line-clamp-2`}`,g;t[6]!==n.content||t[7]!==h?(g=(0,Q.jsx)(`p`,{className:h,children:n.content}),t[6]=n.content,t[7]=h,t[8]=g):g=t[8];let _;t[9]!==n.scope||t[10]!==r?(_=Ve(n.scope,r),t[9]=n.scope,t[10]=r,t[11]=_):_=t[11];let v;t[12]===_?v=t[13]:(v=(0,Q.jsx)(`span`,{children:_}),t[12]=_,t[13]=v);let y;t[14]===d?y=t[15]:(y=d?(0,Q.jsx)(`span`,{children:d}):null,t[14]=d,t[15]=y);let b;t[16]!==v||t[17]!==y?(b=(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-fg-subtle`,children:[v,y]}),t[16]=v,t[17]=y,t[18]=b):b=t[18];let x;t[19]!==b||t[20]!==g?(x=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[g,b]}),t[19]=b,t[20]=g,t[21]=x):x=t[21];let S;t[22]!==p||t[23]!==a||t[24]!==o||t[25]!==c.collapse||t[26]!==c.expand?(S=p?(0,Q.jsxs)(T,{variant:`ghost`,className:`h-8 gap-1 px-2`,onClick:o,children:[(0,Q.jsx)(`span`,{className:`hidden sm:inline`,children:a?c.collapse:c.expand}),(0,Q.jsx)(ue,{className:`size-3.5 transition-transform ${a?`rotate-180`:``}`})]}):null,t[22]=p,t[23]=a,t[24]=o,t[25]=c.collapse,t[26]=c.expand,t[27]=S):S=t[27];let C;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Q.jsx)(R,{className:`size-3.5`}),t[28]=C):C=t[28];let w;t[29]!==i||t[30]!==s||t[31]!==c.archive?(w=(0,Q.jsx)(T,{variant:`ghost`,className:`size-8 shrink-0 p-0`,disabled:i,onClick:s,"aria-label":c.archive,title:c.archive,children:C}),t[29]=i,t[30]=s,t[31]=c.archive,t[32]=w):w=t[32];let E;t[33]!==S||t[34]!==w?(E=(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[S,w]}),t[33]=S,t[34]=w,t[35]=E):E=t[35];let D;return t[36]!==x||t[37]!==E?(D=(0,Q.jsx)(`article`,{className:`group border-t border-edge-subtle px-5 py-4 first:border-t-0 sm:px-6`,children:(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[m,x,E]})}),t[36]=x,t[37]=E,t[38]=D):D=t[38],D}function Xe(){let e=h(e=>e.language),t=Oe[e],n=W(e=>e.setPageHeader),r=W(e=>e.clearPageHeader),{data:i,error:o,isLoading:s,mutate:c}=w(`/api/user-model`,U),[u,d]=(0,Z.useState)(`overview`),[m,g]=(0,Z.useState)(),[_,v]=(0,Z.useState)(),[y,b]=(0,Z.useState)(),[x,S]=(0,Z.useState)(``),[C,D]=(0,Z.useState)(``),[O,A]=(0,Z.useState)(24),[j,M]=(0,Z.useState)(),[L,te]=(0,Z.useState)(!1);(0,Z.useEffect)(()=>(n({startExtra:null,main:(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h1`,{className:`text-base font-semibold text-fg`,children:t.pageTitle}),(0,Q.jsx)(`p`,{className:`hidden text-xs text-fg-muted sm:block`,children:t.pageSubtitle})]}),end:(0,Q.jsx)(De,{})}),r),[r,n,t]);let R=async(e,n)=>{g(e),v(void 0);try{await n(),await c()}catch{v(t.actionFailed)}finally{g(void 0)}},z=(e,t)=>{R(e.id,()=>se(e.id,t))},V=e=>{R(e.id,async()=>{await F(e.id,x.trim()),b(void 0),S(``)})},H=async e=>{g(`profile`),v(void 0);try{await re(e),await c(),te(!1)}catch{v(t.actionFailed)}finally{g(void 0)}};if(s)return(0,Q.jsxs)(`div`,{className:`mx-auto w-full max-w-6xl space-y-5 p-4 sm:p-6 lg:py-8`,children:[(0,Q.jsx)(E,{className:`h-10 w-72 rounded-xl`}),(0,Q.jsx)(E,{className:`h-72 rounded-xl`}),(0,Q.jsxs)(`div`,{className:`grid gap-5 lg:grid-cols-2`,children:[(0,Q.jsx)(E,{className:`h-80 rounded-xl`}),(0,Q.jsx)(E,{className:`h-80 rounded-xl`})]})]});if(o||!i)return(0,Q.jsxs)(`div`,{className:`mx-auto flex min-h-72 max-w-xl flex-col items-center justify-center gap-3 p-6 text-center`,children:[(0,Q.jsx)(N,{className:`size-6 text-fg-subtle`}),(0,Q.jsx)(`p`,{className:`text-sm text-danger`,children:t.loadFailed}),(0,Q.jsx)(T,{onClick:()=>void c(),children:t.tryAgain})]});let J=[...i.assertions].sort((e,t)=>{let n=Number(ke.includes(t.status))-Number(ke.includes(e.status));if(n)return n;let r=e.declaredImportance??e.inferredImportance;return(t.declaredImportance??t.inferredImportance)-r||t.recordedAt-e.recordedAt}).filter(e=>e.scope.type===`global`&&!Ae.has(e.predicate)),Y=Pe(i),ue=Y.callName||(e===`zh`?`你`:`You`),X=J.filter(e=>ke.includes(e.status)),fe=J.filter(e=>e.status===`active`),pe=fe.filter(e=>e.authority===`user_explicit`).length,me=fe.length-pe,he=i.priorities.filter(e=>e.status===`active`&&e.validTo>Date.now()),$=he.find(e=>e.rank===`primary`)??he[0],ge=Ue($,i.goals,e),_e=$?.targetType===`goal`?i.goals.find(e=>e.id===$.targetId):void 0,ve=i.goals.filter(e=>e.status===`active`||e.status===`paused`).filter(e=>$?.targetType!==`goal`||e.id!==$.targetId),ye=i.rules.filter(e=>e.status!==`archived`),be=[...fe].sort((e,t)=>t.recordedAt-e.recordedAt),xe=i.knowledge.filter(e=>e.status!==`archived`&&e.status!==`rejected`),Se=C.trim().toLocaleLowerCase(),Ce=xe.filter(t=>!Se||t.content.toLocaleLowerCase().includes(Se)||He(t.kind,e).toLocaleLowerCase().includes(Se)),we=[{key:`identity`,title:t.identity,icon:ae,items:J.filter(e=>e.kind===`identity`)},{key:`preferences`,title:t.preferences,icon:ne,items:J.filter(e=>[`preference`,`value`,`routine`,`capability`].includes(e.kind))},{key:`relationships`,title:t.relationships,icon:I,items:J.filter(e=>e.kind===`relationship`)},{key:`current`,title:t.currentState,icon:l,items:J.filter(e=>e.kind===`current_state`)},{key:`insights`,title:t.insights,icon:ie,items:J.filter(e=>e.kind===`derived_insight`)}].filter(e=>e.items.length>0),Te=je.map(e=>({kind:e,count:xe.filter(t=>t.kind===e).length})).filter(e=>e.count>0),Ee=Ce.slice(0,O),Ne=je.map(e=>({kind:e,items:Ee.filter(t=>t.kind===e),totalCount:Ce.filter(t=>t.kind===e).length})).filter(e=>e.items.length>0),Le=t=>(0,Q.jsx)(qe,{item:t,language:e,busy:m===t.id,editing:y===t.id,draft:y===t.id?x:``,onDraftChange:S,onEdit:()=>{b(t.id),S(t.statement)},onCancel:()=>{b(void 0),S(``)},onAction:e=>z(t,e),onCorrect:()=>V(t)},t.id),Re=i.maintenance.lastRun?Me(i.maintenance.lastRun.finishedAt??i.maintenance.lastRun.startedAt,e,!0):null,Be=i.maintenance.lastRun?i.maintenance.lastRun.status===`completed`?`${t.maintenanceComplete} ${Re}`:t.maintenanceFailed:t.maintenanceReady;return(0,Q.jsxs)(`div`,{className:`mx-auto w-full max-w-6xl space-y-5 p-4 sm:p-6 lg:py-8`,children:[(0,Q.jsx)(de,{items:[{id:`overview`,label:t.overview,icon:ie},{id:`understanding`,label:t.understanding,icon:ae,count:J.length},{id:`knowledge`,label:t.knowledge,icon:P,count:xe.length}],activeTab:u,onChange:d,ariaLabel:t.pageTitle,tabIdPrefix:`understanding-tab`,panelIdPrefix:`understanding-panel`}),_?(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl border border-danger bg-danger-soft px-4 py-3 text-sm text-danger`,children:[(0,Q.jsx)(`span`,{children:_}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>v(void 0),"aria-label":t.cancel,children:(0,Q.jsx)(p,{className:`size-4`})})]}):null,u===`overview`?(0,Q.jsxs)(`div`,{id:`understanding-panel-overview`,role:`tabpanel`,"aria-labelledby":`understanding-tab-overview`,className:`space-y-5`,children:[(0,Q.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-surface`,children:[(0,Q.jsxs)(`div`,{className:`grid gap-8 px-5 py-7 sm:px-8 sm:py-9 lg:grid-cols-[minmax(0,1fr)_21rem] lg:gap-10`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-semibold tracking-[0.16em] text-accent-fg`,children:[(0,Q.jsx)(ie,{className:`size-3.5`}),(0,Q.jsx)(`span`,{children:t.portraitEyebrow})]}),(0,Q.jsxs)(`div`,{className:`mt-6 flex items-center gap-4`,children:[(0,Q.jsx)(`div`,{className:`flex size-16 shrink-0 items-center justify-center rounded-2xl border border-edge bg-surface-active text-lg font-semibold text-fg sm:size-20 sm:text-xl`,children:Ie(ue)}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`h2`,{className:`truncate text-2xl font-semibold tracking-tight text-fg sm:text-3xl`,children:ue}),(0,Q.jsx)(`p`,{className:`mt-1 truncate text-sm text-fg-muted`,children:Y.role||t.notProvided})]}),(0,Q.jsxs)(T,{className:`shrink-0`,onClick:()=>te(!0),children:[(0,Q.jsx)(ee,{className:`size-4`}),t.editProfile]})]}),(0,Q.jsx)(`p`,{className:`mt-6 max-w-2xl text-sm leading-6 text-fg-muted`,children:t.portraitIntro}),(0,Q.jsx)(`div`,{className:`mt-6 overflow-hidden rounded-xl border border-edge bg-edge-subtle`,children:(0,Q.jsx)(`div`,{className:`grid gap-px sm:grid-cols-3`,children:[{icon:le,label:t.locale,value:Y.locale?Fe(Y.locale,e):t.notProvided},{icon:B,label:t.timezone,value:Y.timezone||t.notProvided},{icon:ae,label:t.pronouns,value:Y.pronouns||t.notProvided}].map(({icon:e,label:t,value:n})=>(0,Q.jsxs)(`div`,{className:`bg-surface-panel px-4 py-3.5`,children:[(0,Q.jsxs)(`p`,{className:`flex items-center gap-1.5 text-xs text-fg-subtle`,children:[(0,Q.jsx)(e,{className:`size-3.5`}),t]}),(0,Q.jsx)(`p`,{className:`mt-1.5 truncate text-sm font-medium text-fg`,children:n})]},t))})})]}),(0,Q.jsxs)(`div`,{className:`flex min-h-52 flex-col rounded-xl border border-edge bg-surface-base p-5 sm:p-6`,children:[(0,Q.jsx)(`p`,{className:`text-xs font-semibold tracking-wide text-fg-subtle`,children:t.importantNow}),ge?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`mt-4 text-xl font-semibold leading-7 tracking-tight text-fg`,children:ge}),_e?.desiredOutcome?(0,Q.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:_e.desiredOutcome}):null,$?(0,Q.jsx)(`p`,{className:`mt-4 text-xs text-fg-subtle`,children:ze($.validTo,e)}):null]}):(0,Q.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-2 py-6 text-center text-sm text-fg-muted`,children:[(0,Q.jsx)(k,{className:`size-5 text-fg-subtle`}),(0,Q.jsx)(`span`,{children:t.noPriority})]}),ve.length?(0,Q.jsxs)(`div`,{className:`mt-5 border-t border-edge pt-4`,children:[(0,Q.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:t.otherGoals}),(0,Q.jsx)(`div`,{className:`mt-2 space-y-2`,children:ve.slice(0,3).map(e=>(0,Q.jsx)(`p`,{className:`text-sm text-fg`,children:e.title},e.id))})]}):null]})]}),(0,Q.jsx)(`div`,{className:`grid border-t border-edge-subtle sm:grid-cols-3`,children:[{icon:f,label:t.explicit,hint:t.explicitHint,count:pe},{icon:N,label:t.learned,hint:t.learnedHint,count:me},{icon:a,label:t.pending,hint:t.pendingHint,count:X.length}].map(({icon:e,label:t,hint:n,count:r},i)=>(0,Q.jsxs)(`div`,{className:`flex gap-3 px-5 py-4 sm:px-6 ${i?`border-t border-edge-subtle sm:border-l sm:border-t-0`:``}`,children:[(0,Q.jsx)(e,{className:`mt-0.5 size-4 shrink-0 text-fg-subtle`}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`p`,{className:`text-sm font-medium text-fg`,children:[(0,Q.jsx)(`span`,{className:`mr-1.5 text-lg tabular-nums`,children:r}),t]}),(0,Q.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:n})]})]},t))})]}),X.length?(0,Q.jsx)(We,{title:t.confirmTogether,hint:t.confirmHint,children:(0,Q.jsx)(`div`,{className:`grid gap-3 p-4 lg:grid-cols-2`,children:X.map(Le)})}):null,(0,Q.jsx)(We,{title:t.howWeWork,hint:t.howWeWorkHint,children:ye.length?ye.map(t=>(0,Q.jsx)(Je,{rule:t,language:e,busy:m===t.id,onToggle:()=>void R(t.id,()=>oe(t.id,t.status===`active`?`disabled`:`active`))},t.id)):(0,Q.jsx)(Ge,{icon:(0,Q.jsx)(I,{className:`size-5`}),children:t.noRules})}),(0,Q.jsx)(We,{title:t.recent,hint:t.recentHint,action:(0,Q.jsx)(T,{variant:`ghost`,className:`h-8 shrink-0`,onClick:()=>d(`understanding`),children:t.seeAll}),children:be.length?(0,Q.jsx)(`div`,{className:`grid gap-3 p-4 lg:grid-cols-2`,children:be.slice(0,6).map(Le)}):(0,Q.jsx)(Ge,{icon:(0,Q.jsx)(N,{className:`size-5`}),children:t.emptyGroup})}),(0,Q.jsx)(We,{title:t.workMemory,hint:t.workMemoryHint,action:(0,Q.jsx)(T,{variant:`ghost`,className:`h-8 shrink-0`,onClick:()=>d(`knowledge`),children:t.seeAll}),children:Te.length?(0,Q.jsx)(`div`,{className:`grid gap-px bg-edge-subtle sm:grid-cols-2 lg:grid-cols-4`,children:Te.slice(0,4).map(({kind:t,count:n})=>(0,Q.jsxs)(`div`,{className:`bg-surface-panel px-5 py-4`,children:[(0,Q.jsx)(`p`,{className:`text-2xl font-semibold tabular-nums text-fg`,children:n}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:He(t,e)})]},t))}):(0,Q.jsx)(Ge,{icon:(0,Q.jsx)(q,{className:`size-5`}),children:t.noKnowledge})}),(0,Q.jsxs)(`footer`,{className:`flex items-center justify-between gap-4 px-1 pb-2 text-xs text-fg-subtle`,children:[(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,Q.jsx)(G,{className:`size-3.5`}),Be]}),(0,Q.jsxs)(T,{variant:`ghost`,className:`h-8 gap-1.5 px-2.5`,onClick:()=>void c(),children:[(0,Q.jsx)(G,{className:`size-3.5`}),t.refresh]})]})]}):null,u===`understanding`?(0,Q.jsxs)(`div`,{id:`understanding-panel-understanding`,role:`tabpanel`,"aria-labelledby":`understanding-tab-understanding`,className:`space-y-5`,children:[(0,Q.jsx)(`div`,{className:`rounded-xl border border-edge bg-surface-panel px-5 py-5 shadow-surface sm:px-6`,children:(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Q.jsx)(N,{className:`mt-0.5 size-5 shrink-0 text-accent-fg`}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`font-semibold text-fg`,children:t.aboutYouTitle}),(0,Q.jsx)(`p`,{className:`mt-1 max-w-3xl text-sm leading-6 text-fg-muted`,children:t.aboutYouHint})]})]})}),we.length?we.map(({key:e,title:t,icon:n,items:r})=>(0,Q.jsx)(We,{title:t,action:(0,Q.jsx)(n,{className:`size-4 text-fg-subtle`}),children:(0,Q.jsx)(`div`,{className:`grid gap-3 p-4 lg:grid-cols-2`,children:r.map(Le)})},e)):(0,Q.jsx)(`div`,{className:`rounded-xl border border-edge bg-surface-panel shadow-surface`,children:(0,Q.jsx)(Ge,{icon:(0,Q.jsx)(N,{className:`size-5`}),children:t.emptyGroup})})]}):null,u===`knowledge`?(0,Q.jsxs)(`div`,{id:`understanding-panel-knowledge`,role:`tabpanel`,"aria-labelledby":`understanding-tab-knowledge`,className:`space-y-4`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-xl border border-edge bg-surface-panel p-4 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,Q.jsxs)(`div`,{className:`max-w-2xl`,children:[(0,Q.jsx)(`h2`,{className:`font-semibold text-fg`,children:t.allMemory}),(0,Q.jsxs)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:[xe.length,` `,t.items,` · `,t.memoryLibraryHint]})]}),(0,Q.jsxs)(`label`,{className:`relative block sm:w-80`,children:[(0,Q.jsx)(ce,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`}),(0,Q.jsx)(`span`,{className:`sr-only`,children:t.searchPlaceholder}),(0,Q.jsx)(`input`,{type:`search`,value:C,onChange:e=>{D(e.target.value),A(24)},placeholder:t.searchPlaceholder,className:`h-10 w-full rounded-xl border border-edge bg-surface-base pl-9 pr-3 text-sm text-fg outline-none transition placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`})]})]}),Ce.length?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`space-y-4`,children:Ne.map(({kind:t,items:n,totalCount:r})=>(0,Q.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-surface`,children:[(0,Q.jsxs)(`header`,{className:`flex items-center justify-between border-b border-edge-subtle px-5 py-3 sm:px-6`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:He(t,e)}),(0,Q.jsx)(`span`,{className:`text-xs tabular-nums text-fg-subtle`,children:r})]}),(0,Q.jsx)(`div`,{children:n.map(t=>(0,Q.jsx)(Ye,{item:t,language:e,busy:m===t.id,expanded:j===t.id,onToggle:()=>M(e=>e===t.id?void 0:t.id),onArchive:()=>void R(t.id,()=>K(t.id,`archived`))},t.id))})]},t))}),Ce.length>O?(0,Q.jsx)(`div`,{className:`flex justify-center pt-2`,children:(0,Q.jsx)(T,{onClick:()=>A(e=>e+24),children:t.showMore})}):null]}):(0,Q.jsx)(`div`,{className:`rounded-xl border border-edge bg-surface-panel shadow-surface`,children:(0,Q.jsx)(Ge,{icon:(0,Q.jsx)(ce,{className:`size-5`}),children:C.trim()?t.noKnowledgeMatch:t.noKnowledge})})]}):null,(0,Q.jsx)(Ke,{open:L,profile:Y,language:e,saving:m===`profile`,onOpenChange:te,onSave:e=>void H(e)})]})}export{Xe as UserModelPage};
|
|
@@ -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{wo as i}from"./index-
|
|
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{wo as i}from"./index-CEkw-fGy.js";import{m as a}from"./voice-config-api-Bjy8EFqi.js";var o=t();e();var s=n();function c(e){let t=(0,o.c)(15),{kind:n,providerId:c,fieldId:u,value:d,onChange:f,labels:p,placeholder:m,className:h}=e,g=m===void 0?`sk-...`:m,_;t[0]!==n||t[1]!==c?(_=()=>a({kind:n,provider:c}).then(l),t[0]=n,t[1]=c,t[2]=_):_=t[2];let v=_,y;t[3]===h?y=t[4]:(y=r(`flex min-w-0 flex-col gap-1.5`,h),t[3]=h,t[4]=y);let b;t[5]!==u||t[6]!==p||t[7]!==f||t[8]!==g||t[9]!==v||t[10]!==d?(b=(0,s.jsx)(i,{id:u,value:d,onChange:f,placeholder:g,labels:p,reveal:v,loadFailedLabel:p.loadFailed,maskedHelp:p.maskedHelp,notInConfigFile:p.notInConfigFile,inputClassName:`text-xs`}),t[5]=u,t[6]=p,t[7]=f,t[8]=g,t[9]=v,t[10]=d,t[11]=b):b=t[11];let x;return t[12]!==y||t[13]!==b?(x=(0,s.jsx)(`div`,{className:y,children:b}),t[12]=y,t[13]=b,t[14]=x):x=t[14],x}function l(e){return e.apiKey??null}export{c 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"./x-B_N4OPjy.js";import{n as a}from"./locale-store-eliqUnBr.js";import{t as o}from"./messages-NYDOR8-j.js";import{a as s,i as c,o as l,r as u,s as d,t as f}from"./dist-BGTk37IG.js";import{t as p}from"./button-CGlRPNzi.js";import{H as m,J as h,jo as g}from"./index-
|
|
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{n as a}from"./locale-store-eliqUnBr.js";import{t as o}from"./messages-NYDOR8-j.js";import{a as s,i as c,o as l,r as u,s as d,t as f}from"./dist-BGTk37IG.js";import{t as p}from"./button-CGlRPNzi.js";import{H as m,J as h,jo as g}from"./index-CEkw-fGy.js";var _=n(),v=e(t(),1),y=r(),b=180;function x(e){let t=(0,_.c)(40),{requestedOpen:n,onExited:r}=e,x=a(C),w=h(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)(s,{className:`xopc-dialog-overlay fixed inset-0 z-[75] bg-scrim backdrop-blur-[1px]`}),t[12]=z):z=t[12];let B;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,y.jsx)(g,{className:`size-7 shrink-0`,"aria-hidden":!0}),t[13]=B):B=t[13];let V;t[14]===A.title?V=t[15]:(V=(0,y.jsx)(d,{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)(c,{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)(p,{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)(m,{embedded:!0,onRequestClose:N})}),t[31]=N,t[32]=J);let Y;t[33]!==q||t[34]!==J?(Y=(0,y.jsxs)(l,{children:[z,(0,y.jsx)(u,{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)(f,{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};
|