@xopcai/xopc 0.0.221 → 0.0.222
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/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-B8SBTGg3.js → agent-avatar-dicebear-DsR_2U9-.js} +1 -1
- package/dist/gateway/static/root/assets/agents-DijFbC4G.js +68 -0
- package/dist/gateway/static/root/assets/{app-management-settings-panel-BtmPXaqu.js → app-management-settings-panel-BCzVX09V.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-t7HoJyNN.js → appearance-settings-DgSpwqQI.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-DJ_Dsb1j.js → apps-page-BFAmf9hq.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-CsLXzas8.js → attachment-load-BQHcAR6J.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-D-zgoAKz.js → automations-page-CswK3HFb.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-B8us5JBf.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-B-MjP_22.js → binary-plugins-BlpyTJ1b.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-i4CfDqLG.js → block-editor-C3mwGsms.js} +4 -4
- package/dist/gateway/static/root/assets/browser-settings-page-BeBd17-3.js +8 -0
- package/dist/gateway/static/root/assets/{browser-workflows-page-EEFHUm1i.js → browser-workflows-page-CZNOOQY4.js} +2 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-Bv0z3KRq.js +7 -0
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-BczD-pWE.js +3 -0
- package/dist/gateway/static/root/assets/{channels-settings-Je-9a5ZC.js → channels-settings-2KQYq6xl.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-terminal-dock-DT-OFl4r.js → chat-terminal-dock-2fpzufzt.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-PB1boaNy.js +2 -0
- package/dist/gateway/static/root/assets/{cron-expression-MZ_AJqrm.js → cron-expression-VePLfPUR.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-Bv9hZLuD.js → date-picker-CJegmPTJ.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-D-6oO_Vk.js → dependency-picker-B2o9unBk.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-CiI5caKj.js → desktop-pet-BH4Np-ay.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-DhkSOy4K.js → desktop-pet-settings-Duu3ctxD.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-C4s4Pz8I.js → directory-picker-path-field-BBCUZOg2.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-DE7J1-6W.js → extension-debug-page-DS_o3F97.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-DSnACD7E.js → extension-page-BTLBZdCq.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-Dk7k2Pok.js → extension-settings-page-KTGrYbgk.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-IOA1OlHx.js → gateway-config-api-D3YJVfzY.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-FX7QsgSQ.js → gateway-settings-B8--s3yC.js} +1 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-5YQ5BUwp.js +1 -0
- package/dist/gateway/static/root/assets/home-page-DfIVWJl3.js +1 -0
- package/dist/gateway/static/root/assets/{index-Dcj5KJRg.css → index-BXGC3VFm.css} +1 -1
- package/dist/gateway/static/root/assets/{index-EvA8c7fo.js → index-jqDCfet4.js} +47 -47
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BjYiM4xq.js → keyboard-shortcuts-settings-D-Ib-suu.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-CAb0odzu.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-7DHvwSgA.js → local-apps-page-Bsy1lvAc.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-CFxKbDZl.js +2 -0
- package/dist/gateway/static/root/assets/{management-settings-BSxppo9Z.js → management-settings-D-akydG4.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-split-D4oDjZtl.js → markdown-split-DHH4Cu2i.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-BPNTGROA.js → media-plugins-BwHtUXkj.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-DU5tKPTq.js → notes-page-BxM1p6hz.js} +1 -1
- package/dist/gateway/static/root/assets/notes-workbench-BGjEC89c.js +4 -0
- package/dist/gateway/static/root/assets/{product-open-page-CPoQvD6P.js → product-open-page-DrfWH1ir.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-Dj9kEQwg.js +1 -0
- package/dist/gateway/static/root/assets/{projects-page-CitO1LMc.js → projects-page-CBRy5Ezz.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-DSwz9RBh.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-xqnWcvIv.js → runtime-tools-settings-panel-DF7syQRd.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-CuIDPYu6.js → schema-form-BQ_qRIsM.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-WtattyVX.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-CNAz_q1F.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-DkAv9ncE.js → settings-form-section-BBHGOQHU.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-BJUQiEKb.js → settings-loading-skeleton-CiwjP2-b.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-KHRbLwmw.js → settings-page-Rl9waapk.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-CNo4Ajhn.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-WCVtJ3sX.js → share-preview-page-B7PI3yZ6.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-DpOH0zWB.js +1 -0
- package/dist/gateway/static/root/assets/{skill-reload-api-C_4cG30x.js → skill-reload-api-BOf4xCat.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page-CKhR9J81.js → skills-page-YbtR_zEU.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page.utils-AYX-e5sD.js → skills-page.utils-DTmx2Zza.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-IIF-K9ML.js → system-settings-panel-BZDJcKdS.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-DrMX5Yhj.js +1 -0
- package/dist/gateway/static/root/assets/{use-autosave-DcktF1j1.js → use-autosave-Be9aR9qA.js} +1 -1
- package/dist/gateway/static/root/assets/user-context-page-ewIK2ddC.js +1 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-BMkNTHHE.js → voice-api-key-field-IMc3Ua6C.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-DVoiXekA.js → work-discovery-overlay-TC-xQenr.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-Cw4LQjuM.js → workflow-run-setup-panel-B2auxcRv.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-Bdn82kFQ.js +5 -0
- package/dist/gateway/static/root/index.html +2 -2
- package/dist/package.js +1 -1
- package/dist/src/agent/agent-manager.js +4 -4
- package/dist/src/agent/embedded/model-runtime.js +1 -1
- package/dist/src/agent/embedded/run-for-session.js +1 -1
- package/dist/src/agent/image/tool-model-config.js +1 -1
- package/dist/src/agent/ipc/inbox.js +1 -1
- package/dist/src/agent/memory/create-memory-manager.js +1 -1
- package/dist/src/agent/service.js +2 -2
- package/dist/src/agent/session/session-inspector.js +1 -1
- package/dist/src/agent/skills/hub-lock.js +1 -1
- package/dist/src/agent/tasks/task-judge-service.js +3 -3
- package/dist/src/agent-runtime/index.js +1 -1
- package/dist/src/agent-runtime/runtime-profile.js +1 -1
- package/dist/src/ai-assist/text-assist.js +1 -1
- package/dist/src/auth/credentials.js +2 -2
- package/dist/src/auth/profiles/store.js +1 -1
- package/dist/src/auth/sync-provider-auth.js +2 -2
- package/dist/src/browser/providers/browser-ext-install.js +1 -1
- package/dist/src/channels/attachments/voice-stt-webchat.js +20 -3
- package/dist/src/cli/commands/doctor/checks/provider-auth.js +1 -1
- package/dist/src/cli/commands/models.js +1 -1
- package/dist/src/config/agent-profile.js +1 -1
- package/dist/src/config/index.js +4 -4
- package/dist/src/config/loader.js +1 -1
- package/dist/src/config/models-json.js +1 -1
- package/dist/src/connectors/learning-coordinator.js +3 -19
- package/dist/src/extensions/lockfile.js +1 -1
- package/dist/src/gateway/agents-admin.js +2 -2
- package/dist/src/gateway/file-path-classifier.js +1 -1
- package/dist/src/gateway/hono/lib/config-payload.js +1 -1
- package/dist/src/gateway/hono/routes/models.js +1 -1
- package/dist/src/gateway/hono/routes/voice.js +8 -1
- package/dist/src/gateway/hono/routes/workflows.js +2 -2
- package/dist/src/gateway/service/config-coordinator.js +1 -1
- package/dist/src/gateway/service.js +9 -9
- package/dist/src/providers/auth-runtime/resolve-auth.js +1 -1
- package/dist/src/providers/index.js +2 -2
- package/dist/src/providers/model-registry.js +1 -1
- package/dist/src/providers/register-runtime-providers.js +1 -1
- package/dist/src/tui/tui-startup-resources.js +1 -1
- package/dist/src/tui/tui.js +1 -1
- package/dist/src/voice/audio/normalize.d.ts +7 -0
- package/dist/src/voice/audio/normalize.js +30 -4
- package/dist/src/voice/local/runtime-worker.js +26 -6
- package/dist/src/workflows/service/workflow-run-service.js +1 -1
- package/package.json +7 -13
- package/dist/gateway/static/root/assets/agents-Brs2-m6t.js +0 -68
- package/dist/gateway/static/root/assets/automations-workspace-DehLRXfd.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-C3QIO4Ti.js +0 -8
- package/dist/gateway/static/root/assets/capabilities-settings-panel-BHhUp7FW.js +0 -7
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-DoClNVLz.js +0 -3
- package/dist/gateway/static/root/assets/connectors-page-D8z9Trw4.js +0 -2
- package/dist/gateway/static/root/assets/heartbeat-settings-D5CGVyci.js +0 -1
- package/dist/gateway/static/root/assets/home-page-DzfZFZx5.js +0 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-hPyTaVYU.js +0 -2
- package/dist/gateway/static/root/assets/logs-page-DW0xMKWP.js +0 -2
- package/dist/gateway/static/root/assets/notes-workbench-D669d98r.js +0 -4
- package/dist/gateway/static/root/assets/project-detail-page-CpsQ9PTA.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-C9-bL4V6.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-CPSARi4y.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BxT80Fmr.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-C8jd20Db.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-DrQ_cOXh.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-CYjsecEr.js +0 -1
- package/dist/gateway/static/root/assets/user-context-page-Cy1D2hkt.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-DKKH1_Yt.js +0 -5
|
@@ -1 +0,0 @@
|
|
|
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"./chunk-KS7C4IRE-BaASWQor.js";import{t as a}from"./circle-check-C23XjkUj.js";import{t as o}from"./loader-circle-CifKLtgG.js";import{t as s}from"./cn-JdwAhgNB.js";import{n as c}from"./interaction-BmQogeqz.js";import{n as l}from"./is-masked-secret-DOkL5b_X.js";import{t as u}from"./messages-kx5W39dO.js";import{l as d,n as f,r as p,s as m}from"./locale-store-iKjqemWG.js";import{i as h}from"./vendor-swr-BIWyz7Rc.js";import{r as g}from"./gateway-config-swr-BzTbnu4O.js";import{n as _,t as v}from"./registry-api-Cx3JxXSL.js";import{Dl as y,Pc as b,Ql as x,Us as S,_l as C,hs as w,kn as T,oo as E,vl as D,ws as O,xr as k}from"./index-EvA8c7fo.js";import{n as A,r as j}from"./settings-page-layout-BRQNel6r.js";import{n as M}from"./settings-loading-skeleton-BJUQiEKb.js";import{n as N,t as P}from"./settings-form-section-DkAv9ncE.js";var F=e(t(),1),I=n();function L(e){if(!e||typeof e!=`object`)return 0;let t=e.providers;return!t||typeof t!=`object`||Array.isArray(t)?0:Object.values(t).filter(e=>typeof e==`string`&&l(e)).length}function R(e){if(!e||typeof e!=`object`)return``;let t=e.agents;if(!t||typeof t!=`object`||Array.isArray(t))return``;let n=t,r=typeof n.defaultPreset==`string`&&n.defaultPreset.trim()?n.defaultPreset.trim():`default`,i=n.capabilityPresets,a=i&&typeof i==`object`&&!Array.isArray(i)?i[r]:void 0,o=a&&typeof a==`object`&&!Array.isArray(a)?a.models:void 0;if(!o||typeof o!=`object`||Array.isArray(o))return``;let s=o,c=s.roles;if(!c||typeof c!=`object`||Array.isArray(c))return``;let l=c,u=typeof s.defaultRole==`string`&&s.defaultRole.trim()?s.defaultRole.trim():Object.keys(l)[0],d=u?l[u]:void 0;if(!d||typeof d!=`object`||Array.isArray(d))return``;let f=d.model;return typeof f==`string`?f.trim():``}function z(e){if(!e||typeof e!=`object`)return!1;let t=e.channels;return!t||typeof t!=`object`||Array.isArray(t)?!1:Object.values(t).some(e=>{if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;if(`configured`in t||`config`in t||`schema`in t||`uiHints`in t){if(t.configured===!0)return!0;let e=t.config;if(!e||typeof e!=`object`||Array.isArray(e))return!1;let n=e;return n.enabled===!0||Object.keys(n).length>0}return t.enabled===!0||Object.keys(t).length>0})}function B(e){if(!e||typeof e!=`object`)return{enabled:!1,backend:`extension`};let t=e.browser;if(!t||typeof t!=`object`||Array.isArray(t))return{enabled:!1,backend:`extension`};let n=t;return{enabled:n.enabled===!0,backend:typeof n.backend==`string`&&n.backend.trim()?n.backend.trim():`extension`}}function V(e){return e?`pass`:`fail`}function H(e){if(e===`provider-auth`)return`/settings/capabilities/models`;if(e===`config-health`)return`/settings/gateway`;if(e===`state-integrity`||e===`workspace-status`)return`/agents`;if(e===`database-schema`||e===`session-integrity`)return`/settings/sessions`;if(e===`channel-config`||e===`channel-pairing-pending`||e.startsWith(`channel:`))return`/channels`;if(e===`security-audit`||e===`gateway-service`||e===`gateway-health`)return`/settings/gateway`;if(e===`version-check`)return`/settings/desktop-app`}function U(e){return{fail:4,warn:3,skip:2,pass:1}[e]}function ee(e){return e.filter(e=>e.status===`fail`||e.status===`warn`).map(e=>({id:e.id,label:e.label,status:e.status,message:e.message,hints:e.hints,path:H(e.id),source:`doctor`})).toSorted((e,t)=>U(t.status)-U(e.status)||e.label.localeCompare(t.label))}function W(e){let t=new Map(e.doctorChecks.map(e=>[e.id,e])),n=[];for(let e of[`security-audit`,`channel-config`,`channel-pairing-pending`,`gateway-health`]){let r=t.get(e);r&&n.push({id:r.id,label:r.label,status:r.status,message:r.message,path:H(r.id)})}if(e.logsHealth){let t=e.logsHealth.stats?.errorsLast24h??0;n.push({id:`logs-health`,label:`Logs`,status:e.logsHealth.shuttingDown||t>0?`warn`:`pass`,message:e.logsHealth.shuttingDown?`Logger is shutting down.`:t>0?`${t} error(s) in the last 24 hours.`:`Log system is healthy.`,path:`/settings/logs`})}for(let t of e.browserDiagnostics??[])n.push(t);return n}function te(e){let t=L(e.config),n=e.providerMeta?.configured??t,r=e.providerMeta?.total??0,i=n>0||t>0,a=R(e.config),o=a.length>0,s=e.hasToken&&e.realtimeConnected,c=z(e.config),l=e.skillCount>0,u=e.doctorChecks??[],d=ee(u),f=[{id:`gateway`,done:s,detail:s?e.labels.gatewayOnline:e.labels.gatewayOffline},{id:`provider`,done:i,detail:i?e.providerMeta&&e.providerMeta.total>0?e.labels.providersMetaReady(n,r):e.labels.providersConfigured(t):e.labels.providersMissing},{id:`defaultModel`,done:o,detail:o?e.labels.modelConfigured(a):e.labels.modelMissing},{id:`channel`,done:c,optional:!0,detail:c?e.labels.channelConfigured:e.labels.channelMissing},{id:`skill`,done:l,optional:!0,detail:l?e.labels.skillsConfigured(e.skillCount):e.labels.skillsMissing}],p=f.filter(e=>!e.optional).every(e=>e.done),m=f.every(e=>e.done),h=[{id:`gateway`,status:V(s),title:`Gateway`,detail:s?e.labels.gatewayOnline:e.labels.gatewayOffline,path:`/settings/gateway`},{id:`provider`,status:V(i),title:`Model provider`,detail:i?e.providerMeta&&e.providerMeta.total>0?e.labels.providersMetaReady(n,r):e.labels.providersConfigured(t):e.labels.providersMissing,path:`/settings/capabilities/models`},{id:`defaultModel`,status:V(o),title:`Default model`,detail:o?e.labels.modelConfigured(a):e.labels.modelMissing,path:`/settings/capabilities/models`},{id:`ready`,status:p?`pass`:`fail`,title:`Chat readiness`,detail:p?e.labels.readyToChat:e.labels.modelMissing,path:`/chat`}],g=d.some(e=>e.status===`fail`),_=d.some(e=>e.status===`warn`),v=g?`blocked`:_?`attention`:p?`ready`:`setup`,y=W({doctorChecks:u,logsHealth:e.logsHealth,browserDiagnostics:e.browserDiagnostics});return{gatewayConnected:s,providerConfigured:i,providerCount:t,providerMetaConfigured:n,providerMetaTotal:r,defaultModel:a,defaultModelConfigured:o,channelConfigured:c,skillInstalled:l,skillCount:e.skillCount,checklist:f,readiness:h,issues:d,healthTier:v,diagnosticSignals:y,requiredComplete:p,allComplete:m}}function ne(e){return B(e)}function G(e){return!e.id||!e.label||!e.status||!e.message||![`pass`,`warn`,`fail`,`skip`].includes(e.status)?null:{id:e.id,label:e.label,status:e.status,message:e.message,hints:Array.isArray(e.hints)?e.hints.filter(e=>typeof e==`string`):[],fixed:e.fixed===!0,findings:Array.isArray(e.findings)?e.findings:void 0}}function re(){return p(`/api/doctor`)}async function ie(){return((await m(re())).checks??[]).map(G).filter(e=>e!==null)}function ae(){return p(`/api/logs/health`)}async function oe(){return m(ae())}function K(e){return e?`pass`:`warn`}function q(e){return`/settings/agent-browser?tab=${encodeURIComponent(e)}`}function se(e){return e?.enabled?[`setup-browser-diagnostics`,e]:null}async function ce(e){if(!e.enabled)return[];if(e.backend===`local`){let e=await m(p(`/api/browser/playwright/doctor`)),t=e.payload?.installed===!0;return[{id:`browser-playwright`,label:`Browser: Playwright`,status:K(t),message:t?`Local Chromium is installed.`:e.payload?.reason??`Local Chromium is not installed.`,path:q(`local`)}]}if(e.backend===`cloakbrowser`){let e=await m(p(`/api/browser/cloakbrowser/doctor`)),t=e.payload?.installed===!0;return[{id:`browser-cloakbrowser`,label:`Browser: CloakBrowser`,status:K(t),message:t?`CloakBrowser ${e.payload?.version??``}`.trim():`CloakBrowser is not installed.`,path:q(`cloakbrowser`)}]}if(e.backend===`extension`){let e=await m(p(`/api/browser/extension-status?probe=true`)),t=e.artifacts?.installed===!0,n=e.connected===!0,r=e.artifacts?.needsRefresh===!0||e.artifacts?.needsChromeReload===!0;return[{id:`browser-extension`,label:`Browser: Chrome extension`,status:n?`pass`:`warn`,message:n?`Chrome extension bridge is connected.`:t?r?`Chrome extension needs refresh.`:`Chrome extension is installed but not connected.`:`Chrome extension is not installed.`,path:q(`extension`)}]}return[{id:`browser-playwright`,label:`Browser`,status:`skip`,message:`Browser backend "${e.backend}" is not checked on this overview.`,path:q(e.backend||`overview`)}]}function J(){let e=(0,I.c)(57),t=d(me),n=f(pe),r;e[0]===n?r=e[1]:(r=u(n),e[0]=n,e[1]=r);let i=r,a=i.setupStatus.labels,o=E(fe),{data:s,error:c,isLoading:l,mutate:p}=g(!!t),m;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(m={revalidateOnFocus:!1},e[2]=m):m=e[2];let{data:y,error:b,isLoading:x,mutate:S}=h(t?`setup-checklist-skills`:null,de,m),C;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(C={revalidateOnFocus:!1},e[3]=C):C=e[3];let{data:w,error:D,isLoading:O,mutate:k}=h(t?`setup-checklist-provider-meta`:null,T,C),A;e[4]===t?A=e[5]:(A=t?re():null,e[4]=t,e[5]=A);let j;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(j={revalidateOnFocus:!1},e[6]=j):j=e[6];let{data:M,error:N,isLoading:P,mutate:F}=h(A,ie,j),L;e[7]===t?L=e[8]:(L=t?ae():null,e[7]=t,e[8]=L);let R;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(R={revalidateOnFocus:!1},e[9]=R):R=e[9];let{data:z,isLoading:B,mutate:V}=h(L,oe,R);s?.payload?.config;let H=s?.payload?.config,U;e[10]===H?U=e[11]:(U=ne(H),e[10]=H,e[11]=U);let ee=t?U:null,W;e[12]===ee?W=e[13]:(W=se(ee),e[12]=ee,e[13]=W);let G;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(G={revalidateOnFocus:!1},e[14]=G):G=e[14];let{data:K,isLoading:q,mutate:ce}=h(W,ue,G),J;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(J={revalidateOnFocus:!1},e[15]=J):J=e[15],h(t?v:null,_,J);let Y=!t||!l&&!x&&!O&&!P&&!B&&!q,X=!!(c||b||D||N),Z;bb0:{if(!t||!Y){Z=null;break bb0}let n=y?.catalog?.length??0,r;if(e[16]!==K||e[17]!==s?.payload?.config||e[18]!==M||e[19]!==a.channelConfigured||e[20]!==a.channelMissing||e[21]!==a.gatewayOffline||e[22]!==a.gatewayOnline||e[23]!==a.modelConfigured||e[24]!==a.modelMissing||e[25]!==a.providersConfigured||e[26]!==a.providersMetaReady||e[27]!==a.providersMissing||e[28]!==a.skillsConfigured||e[29]!==a.skillsMissing||e[30]!==z||e[31]!==i.setupStatus.requiredCompleteMessage||e[32]!==w||e[33]!==o||e[34]!==n||e[35]!==t){let c=w?.filter(le).length??0,l=w?.length??0,u;e[37]===a.providersConfigured?u=e[38]:(u=e=>a.providersConfigured.replace(`{{count}}`,String(e)),e[37]=a.providersConfigured,e[38]=u);let d;e[39]===a.providersMetaReady?d=e[40]:(d=(e,t)=>a.providersMetaReady.replace(`{{configured}}`,String(e)).replace(`{{total}}`,String(t)),e[39]=a.providersMetaReady,e[40]=d);let f;e[41]===a.modelConfigured?f=e[42]:(f=e=>a.modelConfigured.replace(`{{model}}`,e),e[41]=a.modelConfigured,e[42]=f);let p;e[43]===a.skillsConfigured?p=e[44]:(p=e=>a.skillsConfigured.replace(`{{count}}`,String(e)),e[43]=a.skillsConfigured,e[44]=p),r=te({hasToken:!!t,realtimeConnected:o,config:s?.payload?.config,skillCount:n,providerMeta:l>0?{configured:c,total:l}:null,doctorChecks:M,logsHealth:z,browserDiagnostics:K,labels:{gatewayOnline:a.gatewayOnline,gatewayOffline:a.gatewayOffline,providersConfigured:u,providersMetaReady:d,providersMissing:a.providersMissing,modelConfigured:f,modelMissing:a.modelMissing,channelConfigured:a.channelConfigured,channelMissing:a.channelMissing,skillsConfigured:p,skillsMissing:a.skillsMissing,readyToChat:i.setupStatus.requiredCompleteMessage}}),e[16]=K,e[17]=s?.payload?.config,e[18]=M,e[19]=a.channelConfigured,e[20]=a.channelMissing,e[21]=a.gatewayOffline,e[22]=a.gatewayOnline,e[23]=a.modelConfigured,e[24]=a.modelMissing,e[25]=a.providersConfigured,e[26]=a.providersMetaReady,e[27]=a.providersMissing,e[28]=a.skillsConfigured,e[29]=a.skillsMissing,e[30]=z,e[31]=i.setupStatus.requiredCompleteMessage,e[32]=w,e[33]=o,e[34]=n,e[35]=t,e[36]=r}else r=e[36];Z=r}let he=Z,Q;e[45]!==ce||e[46]!==p||e[47]!==F||e[48]!==V||e[49]!==k||e[50]!==S?(Q=async()=>{await Promise.all([p(),S(),k(),F(),V(),ce()])},e[45]=ce,e[46]=p,e[47]=F,e[48]=V,e[49]=k,e[50]=S,e[51]=Q):Q=e[51];let ge=Q,$;return e[52]!==X||e[53]!==Y||e[54]!==ge||e[55]!==he?($={ready:Y,error:X,snapshot:he,refresh:ge},e[52]=X,e[53]=Y,e[54]=ge,e[55]=he,e[56]=$):$=e[56],$}function le(e){return e.configured}function ue(e){let[,t]=e;return ce(t)}function de(){return k()}function fe(e){return e.connectionState===`connected`}function pe(e){return e.language}function me(e){return e.token}var Y=r();function X(e){return e===`pass`?`border-success/30 bg-success-soft text-success`:e===`warn`?`border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300`:e===`fail`?`border-red-500/30 bg-red-500/10 text-red-700 dark:text-red-300`:`border-edge bg-surface-hover text-fg-muted`}function Z(e){return e===`pass`?a:e===`warn`?w:e===`fail`?D:b}function he(e,t){return e===`blocked`?{icon:D,className:`bg-red-500/10 text-red-950 dark:text-red-100`,title:t.health.blockedTitle,body:t.health.blockedBody,action:t.health.viewIssues,targetId:`next-steps`}:e===`attention`?{icon:w,className:`bg-amber-500/10 text-amber-950 dark:text-amber-100`,title:t.health.attentionTitle,body:t.health.attentionBody,action:t.health.viewIssues,targetId:`next-steps`}:e===`setup`?{icon:C,className:`bg-surface-base text-fg shadow-surface`,title:t.health.setupTitle,body:t.health.setupBody,action:t.health.continueSetup,targetId:`next-steps`}:{icon:a,className:`bg-success-soft text-success`,title:t.health.readyTitle,body:t.health.readyBody,action:t.health.startChat,actionPath:`/chat`}}function Q(e){let t=(0,I.c)(48),{tier:n,issueCount:r,onRunDoctor:a,ready:l,doctorRunning:d,doctorRunState:p}=e,m=f(ge),h,g,_,v,b,x,C,w,T,E,D;if(t[0]!==r||t[1]!==m||t[2]!==n){g=u(m).setupStatus;let e=he(n,g),a=e.icon,o=`targetId`in e&&typeof e.targetId==`string`?e.targetId:null,c=`actionPath`in e&&typeof e.actionPath==`string`?e.actionPath:`/chat`;h=o?(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>document.getElementById(o)?.scrollIntoView({block:`start`,behavior:`smooth`}),className:`inline-flex items-center gap-1 rounded-lg bg-surface-base px-3 py-2 text-sm font-medium text-fg shadow-sm hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[e.action,(0,Y.jsx)(y,{className:`size-4`,"aria-hidden":!0})]}):(0,Y.jsxs)(i,{to:c,className:`inline-flex items-center gap-1 rounded-lg bg-surface-base px-3 py-2 text-sm font-medium text-fg shadow-sm hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[e.action,(0,Y.jsx)(y,{className:`size-4`,"aria-hidden":!0})]}),D=s(`rounded-xl p-4`,e.className),E=`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,w=`flex min-w-0 gap-3`,T=(0,Y.jsx)(a,{className:`mt-0.5 size-5 shrink-0`,"aria-hidden":!0}),b=`min-w-0`,x=(0,Y.jsx)(`h2`,{className:`text-base font-semibold`,children:e.title}),C=(0,Y.jsx)(`p`,{className:`mt-1 text-sm opacity-85`,children:e.body}),_=`mt-2 text-xs opacity-75`,v=g.health.issueCount.replace(`{{count}}`,String(r)),t[0]=r,t[1]=m,t[2]=n,t[3]=h,t[4]=g,t[5]=_,t[6]=v,t[7]=b,t[8]=x,t[9]=C,t[10]=w,t[11]=T,t[12]=E,t[13]=D}else h=t[3],g=t[4],_=t[5],v=t[6],b=t[7],x=t[8],C=t[9],w=t[10],T=t[11],E=t[12],D=t[13];let O;t[14]!==_||t[15]!==v?(O=(0,Y.jsx)(`p`,{className:_,children:v}),t[14]=_,t[15]=v,t[16]=O):O=t[16];let k;t[17]!==O||t[18]!==b||t[19]!==x||t[20]!==C?(k=(0,Y.jsxs)(`div`,{className:b,children:[x,C,O]}),t[17]=O,t[18]=b,t[19]=x,t[20]=C,t[21]=k):k=t[21];let A;t[22]!==k||t[23]!==w||t[24]!==T?(A=(0,Y.jsxs)(`div`,{className:w,children:[T,k]}),t[22]=k,t[23]=w,t[24]=T,t[25]=A):A=t[25];let j;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(j=s(`inline-flex items-center gap-2 rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,c.press),t[26]=j):j=t[26];let M=!l||d,N;t[27]===d?N=t[28]:(N=d?(0,Y.jsx)(o,{className:`size-4 animate-spin`,"aria-hidden":!0}):(0,Y.jsx)(S,{className:`size-4`,"aria-hidden":!0}),t[27]=d,t[28]=N);let P=d?g.health.runDoctorRunning:g.health.runDoctor,F;t[29]!==d||t[30]!==a||t[31]!==M||t[32]!==N||t[33]!==P?(F=(0,Y.jsxs)(`button`,{type:`button`,className:j,onClick:a,disabled:M,"aria-busy":d,children:[N,P]}),t[29]=d,t[30]=a,t[31]=M,t[32]=N,t[33]=P,t[34]=F):F=t[34];let L;t[35]!==h||t[36]!==F?(L=(0,Y.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:[h,F]}),t[35]=h,t[36]=F,t[37]=L):L=t[37];let R;t[38]!==A||t[39]!==L||t[40]!==E?(R=(0,Y.jsxs)(`div`,{className:E,children:[A,L]}),t[38]=A,t[39]=L,t[40]=E,t[41]=R):R=t[41];let z=d?g.health.doctorRunningMessage:p===`success`?g.health.doctorCompleteMessage:p===`error`?g.health.doctorFailedMessage:g.health.doctorIdleMessage,B;t[42]===z?B=t[43]:(B=(0,Y.jsx)(`p`,{className:`mt-3 text-xs opacity-75`,role:`status`,"aria-live":`polite`,children:z}),t[42]=z,t[43]=B);let V;return t[44]!==R||t[45]!==B||t[46]!==D?(V=(0,Y.jsxs)(`section`,{className:D,children:[R,B]}),t[44]=R,t[45]=B,t[46]=D,t[47]=V):V=t[47],V}function ge(e){return e.language}function $(e){let t=(0,I.c)(34),{issue:n,fixLabel:r}=e,a;t[0]===n.status?a=t[1]:(a=Z(n.status),t[0]=n.status,t[1]=a);let o=a,c;t[2]===o?c=t[3]:(c=(0,Y.jsx)(o,{className:`mt-0.5 size-4 shrink-0`,"aria-hidden":!0}),t[2]=o,t[3]=c);let l;t[4]===n.label?l=t[5]:(l=(0,Y.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:n.label}),t[4]=n.label,t[5]=l);let u;t[6]===n.status?u=t[7]:(u=s(`rounded-full border px-2 py-0.5 text-[11px] font-medium uppercase`,X(n.status)),t[6]=n.status,t[7]=u);let d;t[8]!==n.status||t[9]!==u?(d=(0,Y.jsx)(`span`,{className:u,children:n.status}),t[8]=n.status,t[9]=u,t[10]=d):d=t[10];let f;t[11]!==l||t[12]!==d?(f=(0,Y.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[l,d]}),t[11]=l,t[12]=d,t[13]=f):f=t[13];let p;t[14]===n.message?p=t[15]:(p=(0,Y.jsx)(`span`,{className:`mt-1 block text-sm text-fg-muted`,children:n.message}),t[14]=n.message,t[15]=p);let m;t[16]===n.hints[0]?m=t[17]:(m=n.hints[0]?(0,Y.jsx)(`span`,{className:`mt-1 block truncate text-xs text-fg-subtle`,children:n.hints[0]}):null,t[16]=n.hints[0],t[17]=m);let h;t[18]!==f||t[19]!==p||t[20]!==m?(h=(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[f,p,m]}),t[18]=f,t[19]=p,t[20]=m,t[21]=h):h=t[21];let g;t[22]!==r||t[23]!==n.path?(g=n.path?(0,Y.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 text-xs font-medium text-accent-fg`,children:[r,(0,Y.jsx)(y,{className:`size-4`,"aria-hidden":!0})]}):null,t[22]=r,t[23]=n.path,t[24]=g):g=t[24];let _;t[25]!==g||t[26]!==c||t[27]!==h?(_=(0,Y.jsxs)(Y.Fragment,{children:[c,h,g]}),t[25]=g,t[26]=c,t[27]=h,t[28]=_):_=t[28];let v=_;if(n.path){let e;return t[29]!==v||t[30]!==n.path?(e=(0,Y.jsx)(i,{to:n.path,className:`flex items-start gap-3 rounded-lg bg-surface-panel/80 p-3 shadow-surface hover:bg-surface-hover/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:v}),t[29]=v,t[30]=n.path,t[31]=e):e=t[31],e}let b;return t[32]===v?b=t[33]:(b=(0,Y.jsx)(`div`,{className:`flex items-start gap-3 rounded-lg bg-surface-panel/80 p-3 shadow-surface`,children:v}),t[32]=v,t[33]=b),b}function _e(e){let t=(0,I.c)(27),{item:n,labels:r}=e,a;t[0]===n.status?a=t[1]:(a=Z(n.status),t[0]=n.status,t[1]=a);let o=a,c=r[n.id]??n.title,l;t[2]===n.status?l=t[3]:(l=s(`flex size-7 shrink-0 items-center justify-center rounded-full border`,X(n.status)),t[2]=n.status,t[3]=l);let u;t[4]===o?u=t[5]:(u=(0,Y.jsx)(o,{className:`size-4`,"aria-hidden":!0}),t[4]=o,t[5]=u);let d;t[6]!==l||t[7]!==u?(d=(0,Y.jsx)(`span`,{className:l,children:u}),t[6]=l,t[7]=u,t[8]=d):d=t[8];let f;t[9]===c?f=t[10]:(f=(0,Y.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:c}),t[9]=c,t[10]=f);let p;t[11]===n.detail?p=t[12]:(p=(0,Y.jsx)(`span`,{className:`mt-0.5 block truncate text-xs text-fg-muted`,children:n.detail}),t[11]=n.detail,t[12]=p);let m;t[13]!==f||t[14]!==p?(m=(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[f,p]}),t[13]=f,t[14]=p,t[15]=m):m=t[15];let h;t[16]===n.path?h=t[17]:(h=n.path?(0,Y.jsx)(y,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}):null,t[16]=n.path,t[17]=h);let g;t[18]!==d||t[19]!==m||t[20]!==h?(g=(0,Y.jsxs)(Y.Fragment,{children:[d,m,h]}),t[18]=d,t[19]=m,t[20]=h,t[21]=g):g=t[21];let _=g;if(n.path){let e;return t[22]!==_||t[23]!==n.path?(e=(0,Y.jsx)(i,{to:n.path,className:`flex items-center gap-3 rounded-lg p-3 hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:_}),t[22]=_,t[23]=n.path,t[24]=e):e=t[24],e}let v;return t[25]===_?v=t[26]:(v=(0,Y.jsx)(`div`,{className:`flex items-center gap-3 rounded-lg p-3`,children:_}),t[25]=_,t[26]=v),v}function ve(e){let t=(0,I.c)(29),{signal:n,fixLabel:r}=e,a;t[0]===n.status?a=t[1]:(a=Z(n.status),t[0]=n.status,t[1]=a);let o=a,c;t[2]===o?c=t[3]:(c=(0,Y.jsx)(o,{className:`mt-0.5 size-4 shrink-0`,"aria-hidden":!0}),t[2]=o,t[3]=c);let l;t[4]===n.label?l=t[5]:(l=(0,Y.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:n.label}),t[4]=n.label,t[5]=l);let u;t[6]===n.message?u=t[7]:(u=(0,Y.jsx)(`span`,{className:`mt-0.5 block truncate text-xs text-fg-muted`,children:n.message}),t[6]=n.message,t[7]=u);let d;t[8]!==l||t[9]!==u?(d=(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[l,u]}),t[8]=l,t[9]=u,t[10]=d):d=t[10];let f;t[11]===n.status?f=t[12]:(f=s(`shrink-0 rounded-full border px-2 py-0.5 text-[11px] font-medium uppercase`,X(n.status)),t[11]=n.status,t[12]=f);let p;t[13]!==n.status||t[14]!==f?(p=(0,Y.jsx)(`span`,{className:f,children:n.status}),t[13]=n.status,t[14]=f,t[15]=p):p=t[15];let m;t[16]!==r||t[17]!==n.path?(m=n.path?(0,Y.jsx)(`span`,{className:`sr-only`,children:r}):null,t[16]=r,t[17]=n.path,t[18]=m):m=t[18];let h;t[19]!==c||t[20]!==d||t[21]!==p||t[22]!==m?(h=(0,Y.jsxs)(Y.Fragment,{children:[c,d,p,m]}),t[19]=c,t[20]=d,t[21]=p,t[22]=m,t[23]=h):h=t[23];let g=h;if(n.path){let e;return t[24]!==g||t[25]!==n.path?(e=(0,Y.jsx)(i,{to:n.path,className:`flex min-w-0 items-start gap-2 rounded-lg bg-surface-panel/80 px-3 py-2.5 shadow-surface hover:bg-surface-hover/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:g}),t[24]=g,t[25]=n.path,t[26]=e):e=t[26],e}let _;return t[27]===g?_=t[28]:(_=(0,Y.jsx)(`div`,{className:`flex min-w-0 items-start gap-2 rounded-lg bg-surface-panel/80 px-3 py-2.5 shadow-surface`,children:g}),t[27]=g,t[28]=_),_}function ye(){let e=u(f(e=>e.language)).setupStatus,{ready:t,error:n,snapshot:r,refresh:i}=J(),[a,o]=(0,F.useState)(!1),[l,d]=(0,F.useState)(`idle`),p=r?.diagnosticSignals.filter(e=>e.status===`fail`||e.status===`warn`)??[],m=async()=>{if(!(a||!t)){o(!0),d(`idle`);try{await i(),d(`success`)}catch{d(`error`)}finally{o(!1)}}};return(0,Y.jsxs)(j,{gap:`gap-6`,children:[(0,Y.jsx)(A,{title:e.title,subtitle:e.subtitle,actions:(0,Y.jsxs)(`button`,{type:`button`,className:s(`inline-flex shrink-0 items-center gap-2 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,c.press),onClick:()=>void m(),disabled:!t||a,"aria-busy":a,children:[(0,Y.jsx)(S,{className:s(`size-4`,(!t||a)&&`animate-spin`),"aria-hidden":!0}),a?e.health.runDoctorRunning:e.refresh]})}),n?(0,Y.jsx)(`p`,{className:`rounded-xl border border-red-300/40 bg-red-50 px-4 py-3 text-sm text-red-700 dark:border-red-900/40 dark:bg-red-950/30 dark:text-red-300`,children:e.loadError}):null,!t||!r?(0,Y.jsx)(M,{sections:2}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Q,{tier:r.healthTier,issueCount:r.issues.length,ready:t,onRunDoctor:()=>void m(),doctorRunning:a,doctorRunState:l}),(0,Y.jsxs)(P,{id:`next-steps`,children:[(0,Y.jsx)(N,{icon:r.issues.length?w:x,title:e.nextStepsTitle,subtitle:r.issues.length?e.nextStepsIssuesSubtitle:e.nextStepsReadySubtitle}),r.issues.length?(0,Y.jsx)(`div`,{className:`mt-4 flex flex-col gap-2`,children:r.issues.slice(0,8).map(t=>(0,Y.jsx)($,{issue:t,fixLabel:e.fixIssue},`${t.source}:${t.id}`))}):(0,Y.jsx)(`div`,{className:`mt-4 rounded-lg bg-surface-panel/80 shadow-surface`,children:r.readiness.map(t=>(0,Y.jsx)(_e,{item:t,labels:e.readinessLabels},t.id))})]}),(0,Y.jsxs)(P,{children:[(0,Y.jsx)(N,{icon:O,title:e.diagnosticsTitle,subtitle:e.diagnosticsSubtitle}),p.length?(0,Y.jsx)(`div`,{className:`mt-4 grid gap-2 md:grid-cols-2`,children:p.map(t=>(0,Y.jsx)(ve,{signal:t,fixLabel:e.fixIssue},t.id))}):(0,Y.jsx)(`p`,{className:`mt-4 rounded-lg bg-surface-panel/80 p-3 text-sm text-fg-muted shadow-surface`,children:r.diagnosticSignals.length?e.diagnosticsAllClear:e.diagnosticsEmpty})]})]})]})}export{ye as SetupStatusPanel};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{p as i}from"./chunk-KS7C4IRE-BaASWQor.js";import{t as a}from"./check-DUBLcKHA.js";import{n as o,r as s}from"./popover-select-BzdnTy3h.js";import{t as c}from"./copy-Dv6d4Dvw.js";import{t as l}from"./loader-circle-CifKLtgG.js";import{t as u}from"./plus-Q2yW6OE7.js";import{t as d}from"./x-B_N4OPjy.js";import{t as f}from"./cn-JdwAhgNB.js";import{t as p}from"./button-CSEbl4zT.js";import{s as m}from"./form-field-width-DJw_jULe.js";import{t as h}from"./copy-to-clipboard-HOJ79TWv.js";import{t as g}from"./messages-kx5W39dO.js";import{l as _,n as v,r as y,s as b}from"./locale-store-iKjqemWG.js";import{a as x,n as S,o as ee,r as C,s as w,t as T}from"./dist-BPoKqzeH.js";import{i as te}from"./vendor-swr-BIWyz7Rc.js";import{n as E,r as D}from"./gateway-config-swr-BzTbnu4O.js";import{Gi as O,Ii as k,Ji as A,Ki as j,Ri as M,Ui as N,Us as ne,Vi as P,Wi as F,Xi as I,Ya as L,Yc as re,Yi as R,Zi as ie,gs as z,kl as ae,or as oe,pa as se,pl as B,pr as ce,qi as V,tl as H}from"./index-EvA8c7fo.js";import{n as U,r as W,t as G}from"./settings-page-layout-BRQNel6r.js";import{t as K}from"./settings-loading-skeleton-BJUQiEKb.js";import{t as q}from"./settings-form-section-DkAv9ncE.js";import{t as le}from"./page-tabs-BaEQMYm_.js";var J=e(t(),1),ue=n(),Y={enabled:!0,defaultTtlHours:24,maxTtlDays:30,maxActiveShares:500,maxFileSizeMb:500,directoryMaxFolderSizeMb:2048,directoryMaxFileCount:1e4,inlinePreviewMimes:[`image/png`,`image/jpeg`,`image/gif`,`image/webp`,`image/svg+xml`,`application/pdf`,`text/html`,`text/markdown`,`text/plain`,`application/json`],siteEnabled:!0,siteDefaultTtlHours:24,siteMaxTtlDays:30,maxActiveSites:50,siteMaxRootDirSizeMb:1024,siteMaxFileCount:2e4};function de(){return structuredClone(Y)}var fe=36e5,X=864e5,Z=1048576;function pe(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function me(e,t=32){return Array.isArray(e)?e.filter(e=>typeof e==`string`&&e.trim().length>0).map(e=>e.trim()).slice(0,t):[]}function he(e){let t=pe(e)?e:{},n=pe(t.gateway)?t.gateway:{},r=pe(n.share)?n.share:{},i=pe(r.directory)?r.directory:{},a=pe(n.siteShare)?n.siteShare:{},o=pe(a.static)?a.static:{},s=typeof r.defaultTtlMs==`number`&&Number.isFinite(r.defaultTtlMs)?Math.floor(r.defaultTtlMs):Y.defaultTtlHours*fe,c=typeof r.maxTtlMs==`number`&&Number.isFinite(r.maxTtlMs)?Math.floor(r.maxTtlMs):Y.maxTtlDays*X,l=typeof r.maxFileSize==`number`&&Number.isFinite(r.maxFileSize)?Math.floor(r.maxFileSize):Y.maxFileSizeMb*Z,u=typeof i.maxFolderSize==`number`&&Number.isFinite(i.maxFolderSize)?Math.floor(i.maxFolderSize):Y.directoryMaxFolderSizeMb*Z,d=typeof a.defaultTtlMs==`number`&&Number.isFinite(a.defaultTtlMs)?Math.floor(a.defaultTtlMs):Y.siteDefaultTtlHours*fe,f=typeof a.maxTtlMs==`number`&&Number.isFinite(a.maxTtlMs)?Math.floor(a.maxTtlMs):Y.siteMaxTtlDays*X,p=typeof o.maxRootDirSize==`number`&&Number.isFinite(o.maxRootDirSize)?Math.floor(o.maxRootDirSize):Y.siteMaxRootDirSizeMb*Z;return{enabled:r.enabled!==!1,defaultTtlHours:Math.max(1,Math.round(s/fe)),maxTtlDays:Math.max(1,Math.round(c/X)),maxActiveShares:typeof r.maxActiveShares==`number`&&Number.isFinite(r.maxActiveShares)?Math.max(1,Math.min(1e4,Math.floor(r.maxActiveShares))):Y.maxActiveShares,maxFileSizeMb:Math.max(1,Math.round(l/Z)),directoryMaxFolderSizeMb:Math.max(1,Math.round(u/Z)),directoryMaxFileCount:typeof i.maxFileCount==`number`&&Number.isFinite(i.maxFileCount)?Math.max(1,Math.min(1e5,Math.floor(i.maxFileCount))):Y.directoryMaxFileCount,inlinePreviewMimes:me(r.inlinePreviewMimes,32).length?me(r.inlinePreviewMimes,32):[...Y.inlinePreviewMimes],siteEnabled:a.enabled!==!1,siteDefaultTtlHours:Math.max(1,Math.round(d/fe)),siteMaxTtlDays:Math.max(1,Math.round(f/X)),maxActiveSites:typeof a.maxActiveSites==`number`&&Number.isFinite(a.maxActiveSites)?Math.max(1,Math.min(1e3,Math.floor(a.maxActiveSites))):Y.maxActiveSites,siteMaxRootDirSizeMb:Math.max(1,Math.round(p/Z)),siteMaxFileCount:typeof o.maxFileCount==`number`&&Number.isFinite(o.maxFileCount)?Math.max(1,Math.min(1e5,Math.floor(o.maxFileCount))):Y.siteMaxFileCount}}function ge(e){let t=e.defaultTtlHours*fe,n=e.maxTtlDays*X,r=e.siteDefaultTtlHours*fe,i=e.siteMaxTtlDays*X;return t<6e4||t>6048e5?`Default share TTL must be between 1 minute and 7 days.`:n<6e4||n>2592e6?`Maximum share TTL must be between 1 minute and 30 days.`:t>n?`Default TTL cannot exceed maximum TTL.`:e.maxActiveShares<1||e.maxActiveShares>1e4?`Maximum active shares must be between 1 and 10,000.`:e.maxActiveSites<1||e.maxActiveSites>1e3?`Maximum active site shares must be between 1 and 1,000.`:e.maxFileSizeMb<1||e.maxFileSizeMb>10240?`Maximum file size must be between 1 MB and 10 GB.`:e.directoryMaxFolderSizeMb<1||e.directoryMaxFolderSizeMb>10240?`Maximum folder size must be between 1 MB and 10 GB.`:e.directoryMaxFileCount<1||e.directoryMaxFileCount>1e5?`Maximum directory file count must be between 1 and 100,000.`:r<6e4||r>6048e5?`Default site share TTL must be between 1 minute and 7 days.`:i<6e4||i>2592e6?`Maximum site share TTL must be between 1 minute and 30 days.`:r>i?`Default site TTL cannot exceed maximum site TTL.`:e.siteMaxRootDirSizeMb<1||e.siteMaxRootDirSizeMb>10240?`Maximum static site size must be between 1 MB and 10 GB.`:e.siteMaxFileCount<1||e.siteMaxFileCount>1e5?`Maximum static site file count must be between 1 and 100,000.`:null}async function _e(e){let t=ge(e);if(t)throw Error(t);await b(y(`/api/config`),{method:`PATCH`,body:JSON.stringify({gateway:{share:{enabled:e.enabled,defaultTtlMs:e.defaultTtlHours*fe,maxTtlMs:e.maxTtlDays*X,maxActiveShares:e.maxActiveShares,maxFileSize:e.maxFileSizeMb*Z,inlinePreviewMimes:e.inlinePreviewMimes,directory:{maxFolderSize:e.directoryMaxFolderSizeMb*Z,maxFileCount:e.directoryMaxFileCount}},siteShare:{enabled:e.siteEnabled,defaultTtlMs:e.siteDefaultTtlHours*fe,maxTtlMs:e.siteMaxTtlDays*X,maxActiveSites:e.maxActiveSites,static:{maxRootDirSize:e.siteMaxRootDirSizeMb*Z,maxFileCount:e.siteMaxFileCount}}}})}),E()}var Q=r();function ve(){return f(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,m,`dark:border-edge`)}function ye({hasToken:e}){let t=g(v(e=>e.language)).sharesSettings,{data:n,isLoading:r}=D(e),i=(0,J.useMemo)(()=>n?.payload?.config===void 0?null:structuredClone(he(n.payload.config)),[n]),a=(0,J.useRef)(!1),[o,s]=(0,J.useState)(null),[c,l]=(0,J.useState)(!1),[u,d]=(0,J.useState)(null),[f,m]=(0,J.useState)(!1),h=o??i,_=i,y=(0,J.useMemo)(()=>!h||!_?!1:JSON.stringify(h)!==JSON.stringify(_),[h,_]),b=(0,J.useCallback)(e=>{a.current=!0,s(t=>{let n=t??_;return n?{...n,...e}:null})},[_]),x=(0,J.useCallback)(async()=>{if(!(!h||c)){l(!0),d(null),m(!1);try{await _e(h),a.current=!1,s(null),m(!0),window.setTimeout(()=>m(!1),2500)}catch(e){d(e instanceof Error?e.message:t.policySaveError)}finally{l(!1)}}},[h,c,t.policySaveError]),S=(0,J.useCallback)(()=>{a.current=!1,s(null),d(null),m(!1)},[]);return!e||!h?r?(0,Q.jsx)(q,{children:(0,Q.jsx)(K,{rows:2})}):null:(0,Q.jsxs)(q,{children:[(0,Q.jsxs)(`div`,{className:`mb-4 flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.policyTitle}),(0,Q.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:t.policyHint})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[f?(0,Q.jsx)(`span`,{className:`text-sm text-fg-muted`,children:t.policySaved}):null,(0,Q.jsx)(p,{type:`button`,variant:`secondary`,disabled:c,onClick:()=>b(de()),children:t.policyUseRecommended}),(0,Q.jsx)(p,{type:`button`,variant:`secondary`,disabled:!y||c,onClick:S,children:t.policyDiscard}),(0,Q.jsx)(p,{type:`button`,variant:`primary`,disabled:!y||c,onClick:()=>void x(),children:c?t.policySaving:t.policySave})]})]}),y?(0,Q.jsx)(`p`,{className:`mb-3 text-xs text-amber-800 dark:text-amber-200`,children:t.policyUnsaved}):null,u?(0,Q.jsx)(`p`,{className:`mb-3 text-sm text-red-600 dark:text-red-400`,children:u}):null,(0,Q.jsx)(`p`,{className:`mb-4 text-xs text-fg-subtle`,children:t.policyRestartHint}),(0,Q.jsx)(be,{t,form:h,onChange:b})]})}function be(e){let t=(0,ue.c)(150),{t:n,form:r,onChange:i}=e,a;t[0]===n.policyFileSection?a=t[1]:(a=(0,Q.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.policyFileSection}),t[0]=n.policyFileSection,t[1]=a);let o;t[2]===n.policyFileSectionHint?o=t[3]:(o=(0,Q.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:n.policyFileSectionHint}),t[2]=n.policyFileSectionHint,t[3]=o);let s;t[4]!==a||t[5]!==o?(s=(0,Q.jsxs)(`div`,{className:`mb-4`,children:[a,o]}),t[4]=a,t[5]=o,t[6]=s):s=t[6];let c;t[7]===i?c=t[8]:(c=e=>i({enabled:e.target.checked}),t[7]=i,t[8]=c);let l;t[9]!==r.enabled||t[10]!==c?(l=(0,Q.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:r.enabled,onChange:c}),t[9]=r.enabled,t[10]=c,t[11]=l):l=t[11];let u;t[12]!==n.policyEnabled||t[13]!==l?(u=(0,Q.jsxs)(`label`,{className:`mb-4 flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[l,n.policyEnabled]}),t[12]=n.policyEnabled,t[13]=l,t[14]=u):u=t[14];let d=!r.enabled,f;t[15]===i?f=t[16]:(f=e=>i({defaultTtlHours:e}),t[15]=i,t[16]=f);let p;t[17]!==r.defaultTtlHours||t[18]!==n.policyDefaultTtlHint||t[19]!==n.policyDefaultTtlHours||t[20]!==d||t[21]!==f?(p=(0,Q.jsx)($,{id:`share-default-ttl-hours`,label:n.policyDefaultTtlHours,hint:n.policyDefaultTtlHint,value:r.defaultTtlHours,min:1,max:168,disabled:d,onChange:f}),t[17]=r.defaultTtlHours,t[18]=n.policyDefaultTtlHint,t[19]=n.policyDefaultTtlHours,t[20]=d,t[21]=f,t[22]=p):p=t[22];let m=!r.enabled,h;t[23]===i?h=t[24]:(h=e=>i({maxTtlDays:e}),t[23]=i,t[24]=h);let g;t[25]!==r.maxTtlDays||t[26]!==n.policyMaxTtlDays||t[27]!==n.policyMaxTtlHint||t[28]!==m||t[29]!==h?(g=(0,Q.jsx)($,{id:`share-max-ttl-days`,label:n.policyMaxTtlDays,hint:n.policyMaxTtlHint,value:r.maxTtlDays,min:1,max:30,disabled:m,onChange:h}),t[25]=r.maxTtlDays,t[26]=n.policyMaxTtlDays,t[27]=n.policyMaxTtlHint,t[28]=m,t[29]=h,t[30]=g):g=t[30];let _=!r.enabled,v;t[31]===i?v=t[32]:(v=e=>i({maxActiveShares:e}),t[31]=i,t[32]=v);let y;t[33]!==r.maxActiveShares||t[34]!==n.policyMaxActiveShares||t[35]!==n.policyMaxActiveSharesHint||t[36]!==_||t[37]!==v?(y=(0,Q.jsx)($,{id:`share-max-active`,label:n.policyMaxActiveShares,hint:n.policyMaxActiveSharesHint,value:r.maxActiveShares,min:1,max:1e4,disabled:_,onChange:v}),t[33]=r.maxActiveShares,t[34]=n.policyMaxActiveShares,t[35]=n.policyMaxActiveSharesHint,t[36]=_,t[37]=v,t[38]=y):y=t[38];let b=!r.enabled,x;t[39]===i?x=t[40]:(x=e=>i({maxFileSizeMb:e}),t[39]=i,t[40]=x);let S;t[41]!==r.maxFileSizeMb||t[42]!==n.policyMaxFileSizeHint||t[43]!==n.policyMaxFileSizeMb||t[44]!==b||t[45]!==x?(S=(0,Q.jsx)($,{id:`share-max-file-mb`,label:n.policyMaxFileSizeMb,hint:n.policyMaxFileSizeHint,value:r.maxFileSizeMb,min:1,max:10240,disabled:b,onChange:x}),t[41]=r.maxFileSizeMb,t[42]=n.policyMaxFileSizeHint,t[43]=n.policyMaxFileSizeMb,t[44]=b,t[45]=x,t[46]=S):S=t[46];let ee=!r.enabled,C;t[47]===i?C=t[48]:(C=e=>i({directoryMaxFolderSizeMb:e}),t[47]=i,t[48]=C);let w;t[49]!==r.directoryMaxFolderSizeMb||t[50]!==n.policyDirectoryMaxFolderSizeHint||t[51]!==n.policyDirectoryMaxFolderSizeMb||t[52]!==ee||t[53]!==C?(w=(0,Q.jsx)($,{id:`share-directory-max-size-mb`,label:n.policyDirectoryMaxFolderSizeMb,hint:n.policyDirectoryMaxFolderSizeHint,value:r.directoryMaxFolderSizeMb,min:1,max:10240,disabled:ee,onChange:C}),t[49]=r.directoryMaxFolderSizeMb,t[50]=n.policyDirectoryMaxFolderSizeHint,t[51]=n.policyDirectoryMaxFolderSizeMb,t[52]=ee,t[53]=C,t[54]=w):w=t[54];let T=!r.enabled,te;t[55]===i?te=t[56]:(te=e=>i({directoryMaxFileCount:e}),t[55]=i,t[56]=te);let E;t[57]!==r.directoryMaxFileCount||t[58]!==n.policyDirectoryMaxFileCount||t[59]!==n.policyDirectoryMaxFileCountHint||t[60]!==T||t[61]!==te?(E=(0,Q.jsx)($,{id:`share-directory-max-files`,label:n.policyDirectoryMaxFileCount,hint:n.policyDirectoryMaxFileCountHint,value:r.directoryMaxFileCount,min:1,max:1e5,disabled:T,onChange:te}),t[57]=r.directoryMaxFileCount,t[58]=n.policyDirectoryMaxFileCount,t[59]=n.policyDirectoryMaxFileCountHint,t[60]=T,t[61]=te,t[62]=E):E=t[62];let D;t[63]!==g||t[64]!==y||t[65]!==S||t[66]!==w||t[67]!==E||t[68]!==p?(D=(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[p,g,y,S,w,E]}),t[63]=g,t[64]=y,t[65]=S,t[66]=w,t[67]=E,t[68]=p,t[69]=D):D=t[69];let O=!r.enabled,k;t[70]===i?k=t[71]:(k=e=>i({inlinePreviewMimes:e}),t[70]=i,t[71]=k);let A;t[72]!==r.inlinePreviewMimes||t[73]!==n||t[74]!==O||t[75]!==k?(A=(0,Q.jsx)(xe,{t:n,values:r.inlinePreviewMimes,disabled:O,onChange:k}),t[72]=r.inlinePreviewMimes,t[73]=n,t[74]=O,t[75]=k,t[76]=A):A=t[76];let j;t[77]!==D||t[78]!==A||t[79]!==s||t[80]!==u?(j=(0,Q.jsxs)(`div`,{className:`rounded-xl border border-edge bg-surface-muted/25 p-4`,children:[s,u,D,A]}),t[77]=D,t[78]=A,t[79]=s,t[80]=u,t[81]=j):j=t[81];let M;t[82]===n.policySiteSection?M=t[83]:(M=(0,Q.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.policySiteSection}),t[82]=n.policySiteSection,t[83]=M);let N;t[84]===n.policySiteSectionHint?N=t[85]:(N=(0,Q.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:n.policySiteSectionHint}),t[84]=n.policySiteSectionHint,t[85]=N);let ne;t[86]!==M||t[87]!==N?(ne=(0,Q.jsxs)(`div`,{className:`mb-4`,children:[M,N]}),t[86]=M,t[87]=N,t[88]=ne):ne=t[88];let P;t[89]===i?P=t[90]:(P=e=>i({siteEnabled:e.target.checked}),t[89]=i,t[90]=P);let F;t[91]!==r.siteEnabled||t[92]!==P?(F=(0,Q.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:r.siteEnabled,onChange:P}),t[91]=r.siteEnabled,t[92]=P,t[93]=F):F=t[93];let I;t[94]!==n.policySiteEnabled||t[95]!==F?(I=(0,Q.jsxs)(`label`,{className:`mb-4 flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[F,n.policySiteEnabled]}),t[94]=n.policySiteEnabled,t[95]=F,t[96]=I):I=t[96];let L=!r.siteEnabled,re;t[97]===i?re=t[98]:(re=e=>i({siteDefaultTtlHours:e}),t[97]=i,t[98]=re);let R;t[99]!==r.siteDefaultTtlHours||t[100]!==n.policySiteDefaultTtlHint||t[101]!==n.policySiteDefaultTtlHours||t[102]!==L||t[103]!==re?(R=(0,Q.jsx)($,{id:`site-share-default-ttl-hours`,label:n.policySiteDefaultTtlHours,hint:n.policySiteDefaultTtlHint,value:r.siteDefaultTtlHours,min:1,max:168,disabled:L,onChange:re}),t[99]=r.siteDefaultTtlHours,t[100]=n.policySiteDefaultTtlHint,t[101]=n.policySiteDefaultTtlHours,t[102]=L,t[103]=re,t[104]=R):R=t[104];let ie=!r.siteEnabled,z;t[105]===i?z=t[106]:(z=e=>i({siteMaxTtlDays:e}),t[105]=i,t[106]=z);let ae;t[107]!==r.siteMaxTtlDays||t[108]!==n.policySiteMaxTtlDays||t[109]!==n.policySiteMaxTtlHint||t[110]!==ie||t[111]!==z?(ae=(0,Q.jsx)($,{id:`site-share-max-ttl-days`,label:n.policySiteMaxTtlDays,hint:n.policySiteMaxTtlHint,value:r.siteMaxTtlDays,min:1,max:30,disabled:ie,onChange:z}),t[107]=r.siteMaxTtlDays,t[108]=n.policySiteMaxTtlDays,t[109]=n.policySiteMaxTtlHint,t[110]=ie,t[111]=z,t[112]=ae):ae=t[112];let oe=!r.siteEnabled,se;t[113]===i?se=t[114]:(se=e=>i({maxActiveSites:e}),t[113]=i,t[114]=se);let B;t[115]!==r.maxActiveSites||t[116]!==n.policyMaxActiveSites||t[117]!==n.policyMaxActiveSitesHint||t[118]!==oe||t[119]!==se?(B=(0,Q.jsx)($,{id:`site-share-max-active`,label:n.policyMaxActiveSites,hint:n.policyMaxActiveSitesHint,value:r.maxActiveSites,min:1,max:1e3,disabled:oe,onChange:se}),t[115]=r.maxActiveSites,t[116]=n.policyMaxActiveSites,t[117]=n.policyMaxActiveSitesHint,t[118]=oe,t[119]=se,t[120]=B):B=t[120];let ce=!r.siteEnabled,V;t[121]===i?V=t[122]:(V=e=>i({siteMaxRootDirSizeMb:e}),t[121]=i,t[122]=V);let H;t[123]!==r.siteMaxRootDirSizeMb||t[124]!==n.policySiteMaxRootDirSizeHint||t[125]!==n.policySiteMaxRootDirSizeMb||t[126]!==ce||t[127]!==V?(H=(0,Q.jsx)($,{id:`site-share-max-root-size-mb`,label:n.policySiteMaxRootDirSizeMb,hint:n.policySiteMaxRootDirSizeHint,value:r.siteMaxRootDirSizeMb,min:1,max:10240,disabled:ce,onChange:V}),t[123]=r.siteMaxRootDirSizeMb,t[124]=n.policySiteMaxRootDirSizeHint,t[125]=n.policySiteMaxRootDirSizeMb,t[126]=ce,t[127]=V,t[128]=H):H=t[128];let U=!r.siteEnabled,W;t[129]===i?W=t[130]:(W=e=>i({siteMaxFileCount:e}),t[129]=i,t[130]=W);let G;t[131]!==r.siteMaxFileCount||t[132]!==n.policySiteMaxFileCount||t[133]!==n.policySiteMaxFileCountHint||t[134]!==U||t[135]!==W?(G=(0,Q.jsx)($,{id:`site-share-max-files`,label:n.policySiteMaxFileCount,hint:n.policySiteMaxFileCountHint,value:r.siteMaxFileCount,min:1,max:1e5,disabled:U,onChange:W}),t[131]=r.siteMaxFileCount,t[132]=n.policySiteMaxFileCount,t[133]=n.policySiteMaxFileCountHint,t[134]=U,t[135]=W,t[136]=G):G=t[136];let K;t[137]!==R||t[138]!==ae||t[139]!==B||t[140]!==H||t[141]!==G?(K=(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[R,ae,B,H,G]}),t[137]=R,t[138]=ae,t[139]=B,t[140]=H,t[141]=G,t[142]=K):K=t[142];let q;t[143]!==ne||t[144]!==I||t[145]!==K?(q=(0,Q.jsxs)(`div`,{className:`rounded-xl border border-edge bg-surface-muted/25 p-4`,children:[ne,I,K]}),t[143]=ne,t[144]=I,t[145]=K,t[146]=q):q=t[146];let le;return t[147]!==j||t[148]!==q?(le=(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[j,q]}),t[147]=j,t[148]=q,t[149]=le):le=t[149],le}function $(e){let t=(0,ue.c)(21),{id:n,label:r,hint:i,value:a,min:o,max:s,disabled:c,onChange:l}=e,u;t[0]!==n||t[1]!==r?(u=(0,Q.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,htmlFor:n,children:r}),t[0]=n,t[1]=r,t[2]=u):u=t[2];let d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=f(ve(),`max-w-xs font-mono text-xs`),t[3]=d):d=t[3];let p;t[4]!==s||t[5]!==o||t[6]!==l?(p=e=>{let t=Number(e.target.value);Number.isFinite(t)&&l(Math.max(o,Math.min(s,Math.floor(t))))},t[4]=s,t[5]=o,t[6]=l,t[7]=p):p=t[7];let m;t[8]!==c||t[9]!==n||t[10]!==s||t[11]!==o||t[12]!==p||t[13]!==a?(m=(0,Q.jsx)(`input`,{id:n,type:`number`,min:o,max:s,disabled:c,className:d,value:a,onChange:p}),t[8]=c,t[9]=n,t[10]=s,t[11]=o,t[12]=p,t[13]=a,t[14]=m):m=t[14];let h;t[15]===i?h=t[16]:(h=(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:i}),t[15]=i,t[16]=h);let g;return t[17]!==u||t[18]!==m||t[19]!==h?(g=(0,Q.jsxs)(`div`,{children:[u,m,h]}),t[17]=u,t[18]=m,t[19]=h,t[20]=g):g=t[20],g}function xe(e){let t=(0,ue.c)(25),{t:n,values:r,disabled:i,onChange:a}=e,o;t[0]!==a||t[1]!==r?(o=e=>{let t=e.trim();!t||r.includes(t)||r.length>=32||a([...r,t])},t[0]=a,t[1]=r,t[2]=o):o=t[2];let s=o,c;t[3]===n.policyInlinePreviewMimes?c=t[4]:(c=(0,Q.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n.policyInlinePreviewMimes}),t[3]=n.policyInlinePreviewMimes,t[4]=c);let l;t[5]===n.policyInlinePreviewMimesHint?l=t[6]:(l=(0,Q.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.policyInlinePreviewMimesHint}),t[5]=n.policyInlinePreviewMimesHint,t[6]=l);let u;t[7]!==i||t[8]!==a||t[9]!==r?(u=r.map(e=>(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md border border-edge bg-surface-panel px-2 py-0.5 font-mono text-xs text-fg`,children:[e,i?null:(0,Q.jsx)(`button`,{type:`button`,className:`text-fg-muted hover:text-fg`,"aria-label":`Remove ${e}`,onClick:()=>a(r.filter(t=>t!==e)),children:`×`})]},e)),t[7]=i,t[8]=a,t[9]=r,t[10]=u):u=t[10];let d;t[11]===u?d=t[12]:(d=(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:u}),t[11]=u,t[12]=d);let p;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(p=f(ve(),`font-mono text-xs`),t[13]=p):p=t[13];let m=i||r.length>=32,h;t[14]===s?h=t[15]:(h=e=>{e.key===`Enter`&&(e.preventDefault(),s(e.target.value),e.target.value=``)},t[14]=s,t[15]=h);let g;t[16]!==n.policyMimePlaceholder||t[17]!==m||t[18]!==h?(g=(0,Q.jsx)(`input`,{className:p,placeholder:n.policyMimePlaceholder,disabled:m,onKeyDown:h}),t[16]=n.policyMimePlaceholder,t[17]=m,t[18]=h,t[19]=g):g=t[19];let _;return t[20]!==c||t[21]!==l||t[22]!==d||t[23]!==g?(_=(0,Q.jsxs)(`div`,{className:`space-y-2 border-t border-edge pt-4`,children:[c,l,d,g]}),t[20]=c,t[21]=l,t[22]=d,t[23]=g,t[24]=_):_=t[24],_}function Se(e){let t=(0,ue.c)(70),{open:n,onOpenChange:r,onConfirm:i,initialPath:a,selectKind:c,sessionKey:u,agentId:m}=e,h=c===void 0?`any`:c,y=g(v(Te)),b=y.workspace,E=y.sharesSettings,D=P(we),{data:O}=te(_(Ce)?`picker-agents-list`:null,ce),k;bb0:{let e;t[0]===m?e=t[1]:(e=m?.trim(),t[0]=m,t[1]=e);let n=e;if(n){k=n;break bb0}let r;t[2]===D?r=t[3]:(r=D.trim(),t[2]=D,t[3]=r);let i=r;if(i){k=i;break bb0}if(O?.defaultId){k=O.defaultId;break bb0}if(O?.agents?.[0]?.id){k=O.agents[0].id;break bb0}k=``}let A=k,[j,M]=(0,J.useState)(A),F,I;t[4]===A?(F=t[5],I=t[6]):(F=()=>{M(A)},I=[A],t[4]=A,t[5]=F,t[6]=I),(0,J.useEffect)(F,I);let{tree:L,loading:R,error:ie,loadRoot:z,loadChildren:ae,reset:B}=N(j,u??null),V;t[7]===a?V=t[8]:(V=a?{path:a,isDirectory:!1}:null,t[7]=a,t[8]=V);let[H,U]=(0,J.useState)(V),W;t[9]!==a||t[10]!==z||t[11]!==n||t[12]!==B||t[13]!==U?(W=()=>{if(!n){B(),U(a?{path:a,isDirectory:!1}:null);return}z()},t[9]=a,t[10]=z,t[11]=n,t[12]=B,t[13]=U,t[14]=W):W=t[14];let G;t[15]!==a||t[16]!==z||t[17]!==n||t[18]!==j||t[19]!==B||t[20]!==u?(G=[n,j,u,z,B,a],t[15]=a,t[16]=z,t[17]=n,t[18]=j,t[19]=B,t[20]=u,t[21]=G):G=t[21],(0,J.useEffect)(W,G);let K;t[22]===ae?K=t[23]:(K=e=>{ae(e)},t[22]=ae,t[23]=K);let q=K,le=H!==null&&(h===`any`||h===`file`&&!H.isDirectory||h===`directory`&&H.isDirectory),Y;bb1:{if(!H){Y=E.pickerHintNone;break bb1}if(h===`file`&&H.isDirectory){Y=E.pickerHintNeedsFile;break bb1}if(h===`directory`&&!H.isDirectory){Y=E.pickerHintNeedsDirectory;break bb1}Y=`${H.isDirectory?`📁`:`📄`} ${H.path}`}let de=Y,fe=O?.agents??[],X;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(X=(0,Q.jsx)(x,{className:`fixed inset-0 z-[70] bg-scrim backdrop-blur-[2px]`}),t[24]=X):X=t[24];let Z;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(Z=f(`fixed left-1/2 top-1/2 z-[71] w-[min(34rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2`,`flex h-[min(28rem,calc(100vh-3rem))] flex-col overflow-hidden rounded-lg border border-edge bg-surface-panel shadow-popover outline-none`),t[25]=Z):Z=t[25];let pe;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(pe=(0,Q.jsx)(re,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),t[26]=pe):pe=t[26];let me=y.cron.refresh,he=y.cron.refresh,ge;t[27]===z?ge=t[28]:(ge=()=>void z(),t[27]=z,t[28]=ge);let _e=R&&`animate-spin`,ve;t[29]===_e?ve=t[30]:(ve=f(`size-4`,_e),t[29]=_e,t[30]=ve);let ye;t[31]===ve?ye=t[32]:(ye=(0,Q.jsx)(ne,{className:ve,"aria-hidden":!0}),t[31]=ve,t[32]=ye);let be;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(be=(0,Q.jsx)(d,{className:`size-4`}),t[33]=be):be=t[33];let $;t[34]!==ie||t[35]!==b.loadError?($=ie?(0,Q.jsxs)(`p`,{className:`shrink-0 px-4 py-2 text-xs text-red-600 dark:text-red-400`,children:[b.loadError,`: `,ie]}):null,t[34]=ie,t[35]=b.loadError,t[36]=$):$=t[36];let xe;t[37]!==q||t[38]!==R||t[39]!==H?.path||t[40]!==U||t[41]!==b.emptyDir||t[42]!==b.title||t[43]!==L?(xe=R&&L.length===0?(0,Q.jsxs)(`p`,{className:`flex shrink-0 items-center gap-2 px-4 py-3 text-sm text-fg-muted`,children:[(0,Q.jsx)(l,{className:`size-4 animate-spin`}),b.title,`…`]}):(0,Q.jsx)(se,{tree:L,selectedPath:H?.path??null,onSelectFile:e=>U({path:e,isDirectory:!1}),onSelectEntry:(e,t)=>U({path:e,isDirectory:t}),onExpandDir:q,onAction:void 0,emptyHint:b.emptyDir}),t[37]=q,t[38]=R,t[39]=H?.path,t[40]=U,t[41]=b.emptyDir,t[42]=b.title,t[43]=L,t[44]=xe):xe=t[44];let Se;t[45]!==$||t[46]!==xe?(Se=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:[$,xe]}),t[45]=$,t[46]=xe,t[47]=Se):Se=t[47];let Ee;t[48]===de?Ee=t[49]:(Ee=(0,Q.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-xs text-fg-muted`,children:de}),t[48]=de,t[49]=Ee);let De;t[50]===r?De=t[51]:(De=()=>r(!1),t[50]=r,t[51]=De);let Oe;t[52]!==E.cancel||t[53]!==De?(Oe=(0,Q.jsx)(p,{type:`button`,variant:`ghost`,onClick:De,children:E.cancel}),t[52]=E.cancel,t[53]=De,t[54]=Oe):Oe=t[54];let ke=!le,Ae;t[55]!==i||t[56]!==r||t[57]!==j||t[58]!==H?(Ae=()=>{H&&(i({...H,agentId:j}),r(!1))},t[55]=i,t[56]=r,t[57]=j,t[58]=H,t[59]=Ae):Ae=t[59];let je;t[60]!==E.pickerConfirm||t[61]!==ke||t[62]!==Ae?(je=(0,Q.jsx)(p,{type:`button`,disabled:ke,onClick:Ae,children:E.pickerConfirm}),t[60]=E.pickerConfirm,t[61]=ke,t[62]=Ae,t[63]=je):je=t[63];let Me;t[64]!==Oe||t[65]!==je?(Me=(0,Q.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[Oe,je]}),t[64]=Oe,t[65]=je,t[66]=Me):Me=t[66];let Ne;return t[67]!==Ee||t[68]!==Me?(Ne=(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-3 border-t border-edge px-4 py-3`,children:[Ee,Me]}),t[67]=Ee,t[68]=Me,t[69]=Ne):Ne=t[69],(0,Q.jsx)(T,{open:n,onOpenChange:r,children:(0,Q.jsxs)(ee,{children:[X,(0,Q.jsxs)(C,{className:Z,children:[(0,Q.jsxs)(`div`,{className:`flex h-11 shrink-0 items-center gap-2 border-b border-edge px-4`,children:[pe,(0,Q.jsx)(w,{className:`min-w-0 flex-1 truncate text-base font-semibold text-fg`,children:E.pickerTitle}),(0,Q.jsx)(`button`,{type:`button`,className:`inline-flex size-8 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg disabled:opacity-50`,title:me,"aria-label":he,disabled:R,onClick:ge,children:ye}),(0,Q.jsx)(S,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:`inline-flex size-8 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":b.close,children:be})})]}),fe.length>0?(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-edge px-4 py-2`,children:[(0,Q.jsx)(`label`,{className:`text-xs text-fg-muted`,htmlFor:`picker-agent-select`,children:E.pickerAgentLabel}),(0,Q.jsx)(o,{id:`picker-agent-select`,className:`min-w-0 flex-1 rounded-md border border-edge bg-surface-panel px-2 py-1 text-sm text-fg focus:outline-none focus:ring-2 focus:ring-accent`,value:j,onChange:e=>{M(e.target.value),U(null)},children:fe.map(e=>(0,Q.jsxs)(s,{value:e.id,children:[oe(e,y.agentsSettings),e.id===O?.defaultId?` ★`:``]},e.id))})]}):null,Se,Ne]})]})})}function Ce(e){return e.token}function we(e){return e.agentId}function Te(e){return e.language}var Ee=[`shares`,`policy`];function De(e){let t=(e??``).trim();return Ee.includes(t)?t:`shares`}function Oe(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${(e/(1024*1024*1024)).toFixed(1)} GB`}function ke(e,t){let n=new Date(e).getTime()-Date.now(),r=Math.abs(n),i=n<0;if(r<6e4)return t===`zh`?`刚刚`:`just now`;let a=Math.floor(r/6e4);if(a<60){let e=t===`zh`?`${a} 分钟`:`${a}m`;return i?t===`zh`?`${e}前`:`${e} ago`:e}let o=Math.floor(a/60);if(o<24){let e=t===`zh`?`${o} 小时`:`${o}h`;return i?t===`zh`?`${e}前`:`${e} ago`:e}let s=Math.floor(o/24),c=t===`zh`?`${s} 天`:`${s}d`;return i?t===`zh`?`${c}前`:`${c} ago`:c}var Ae=[{value:36e5,key:`1h`},{value:216e5,key:`6h`},{value:864e5,key:`24h`},{value:2592e5,key:`3d`},{value:6048e5,key:`7d`},{value:2592e6,key:`30d`}];function je(){let e=(0,ue.c)(24),t=v(Ne),n=g(t).sharesSettings,r=!!_(Me),[a,o]=i(),s;e[0]===a?s=e[1]:(s=De(a.get(`tab`)),e[0]=a,e[1]=s);let c=s,l;e[2]===o?l=e[3]:(l=e=>{o(t=>{let n=new URLSearchParams(t);return e===`shares`?n.delete(`tab`):n.set(`tab`,e),n},{replace:!0})},e[2]=o,e[3]=l);let u=l;if(!r)return(0,Q.jsx)(W,{gap:`gap-3`,padding:`px-3 py-8 sm:px-5 xl:px-6`,children:(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.needToken})});let d={shares:n.tabShares,policy:n.tabPolicy},f=Ee.map(e=>({id:e,label:d[e]})),p;e[4]!==n.subtitle||e[5]!==n.title?(p=(0,Q.jsx)(U,{title:n.title,subtitle:n.subtitle}),e[4]=n.subtitle,e[5]=n.title,e[6]=p):p=e[6];let m;e[7]!==c||e[8]!==u||e[9]!==n.tabsAria||e[10]!==f?(m=(0,Q.jsx)(le,{items:f,activeTab:c,onChange:u,ariaLabel:n.tabsAria,tabIdPrefix:`shares-tab`,panelIdPrefix:`shares-panel`}),e[7]=c,e[8]=u,e[9]=n.tabsAria,e[10]=f,e[11]=m):m=e[11];let h;e[12]!==c||e[13]!==r||e[14]!==t||e[15]!==n?(h=c===`shares`?(0,Q.jsx)(Pe,{t:n,language:t}):(0,Q.jsx)(ye,{hasToken:r}),e[12]=c,e[13]=r,e[14]=t,e[15]=n,e[16]=h):h=e[16];let y;e[17]!==c||e[18]!==h?(y=(0,Q.jsx)(G,{id:c,activeTab:c,tabIdPrefix:`shares-tab`,panelIdPrefix:`shares-panel`,showHeading:!1,children:h}),e[17]=c,e[18]=h,e[19]=y):y=e[19];let b;return e[20]!==p||e[21]!==m||e[22]!==y?(b=(0,Q.jsxs)(W,{children:[p,m,y]}),e[20]=p,e[21]=m,e[22]=y,e[23]=b):b=e[23],b}function Me(e){return e.token}function Ne(e){return e.language}function Pe(e){let t=(0,ue.c)(60),{t:n,language:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i={refreshInterval:3e4},t[0]=i):i=t[0];let{data:a,error:o,isLoading:s,mutate:c}=te(`shares-list`,V,i),l;t[1]===a?.payload?.shares?l=t[2]:(l=a?.payload?.shares??[],t[1]=a?.payload?.shares,t[2]=l);let u=l,[d,m]=(0,J.useState)(!1),h;bb0:{if(d){h=u;break bb0}let e;t[3]===u?e=t[4]:(e=u.filter(ze),t[3]=u,t[4]=e),h=e}let g=h,_;t[5]===u?_=t[6]:(_=u.filter(Re),t[5]=u,t[6]=_);let v=_.length,y;t[7]===u?y=t[8]:(y=u.filter(Le),t[7]=u,t[8]=y);let b=y.length,x;t[9]===c?x=t[10]:(x=()=>void c(),t[9]=c,t[10]=x);let S;t[11]!==n||t[12]!==x?(S=(0,Q.jsx)(Ve,{t:n,onCreated:x}),t[11]=n,t[12]=x,t[13]=S):S=t[13];let ee=d?n.allSharesTitle:n.listTitle,C;t[14]===v?C=t[15]:(C=v>0&&(0,Q.jsxs)(`span`,{className:`ml-2 text-xs font-normal text-fg-muted`,children:[`(`,v,`)`]}),t[14]=v,t[15]=C);let w;t[16]!==ee||t[17]!==C?(w=(0,Q.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[ee,C]}),t[16]=ee,t[17]=C,t[18]=w):w=t[18];let T;t[19]===c?T=t[20]:(T=()=>void c(),t[19]=c,t[20]=T);let E=s&&`animate-spin`,D;t[21]===E?D=t[22]:(D=f(`size-3.5`,E),t[21]=E,t[22]=D);let O;t[23]===D?O=t[24]:(O=(0,Q.jsx)(ne,{className:D}),t[23]=D,t[24]=O);let k;t[25]!==s||t[26]!==T||t[27]!==O?(k=(0,Q.jsx)(p,{type:`button`,variant:`ghost`,className:`px-2 py-1`,onClick:T,disabled:s,children:O}),t[25]=s,t[26]=T,t[27]=O,t[28]=k):k=t[28];let A;t[29]!==b||t[30]!==d||t[31]!==n.hideExpired||t[32]!==n.showExpired?(A=b>0&&(0,Q.jsx)(`button`,{type:`button`,className:`text-xs text-accent hover:underline`,onClick:()=>m(Ie),children:d?n.hideExpired:n.showExpired}),t[29]=b,t[30]=d,t[31]=n.hideExpired,t[32]=n.showExpired,t[33]=A):A=t[33];let j;t[34]!==k||t[35]!==A?(j=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[k,A]}),t[34]=k,t[35]=A,t[36]=j):j=t[36];let M;t[37]!==w||t[38]!==j?(M=(0,Q.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[w,j]}),t[37]=w,t[38]=j,t[39]=M):M=t[39];let N;t[40]!==a||t[41]!==o||t[42]!==g||t[43]!==s||t[44]!==r||t[45]!==c||t[46]!==n?(N=s&&!a?(0,Q.jsx)(`div`,{className:`grid gap-2`,"aria-busy":`true`,children:Array.from({length:4}).map(Fe)}):o?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-red-600 dark:text-red-400`,children:[(0,Q.jsx)(`span`,{children:n.error}),(0,Q.jsx)(p,{type:`button`,variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>void c(),children:n.retry})]}):g.length===0?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.emptyState}):(0,Q.jsx)(`div`,{className:`flex flex-col gap-2`,children:g.map(e=>(0,Q.jsx)(Ue,{share:e,t:n,language:r,onRevoked:()=>void c(),onExtended:()=>void c()},e.id))}),t[40]=a,t[41]=o,t[42]=g,t[43]=s,t[44]=r,t[45]=c,t[46]=n,t[47]=N):N=t[47];let P;t[48]!==b||t[49]!==c||t[50]!==d||t[51]!==n?(P=b>0&&d&&(0,Q.jsx)(We,{t:n,onCleaned:()=>void c()}),t[48]=b,t[49]=c,t[50]=d,t[51]=n,t[52]=P):P=t[52];let F;t[53]!==M||t[54]!==N||t[55]!==P?(F=(0,Q.jsxs)(q,{children:[M,N,P]}),t[53]=M,t[54]=N,t[55]=P,t[56]=F):F=t[56];let I;return t[57]!==F||t[58]!==S?(I=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[S,F]}),t[57]=F,t[58]=S,t[59]=I):I=t[59],I}function Fe(e,t){return(0,Q.jsx)(`div`,{className:`rounded-lg border border-edge bg-surface-base p-3`,children:(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(L,{className:`h-4 w-2/3`}),(0,Q.jsx)(L,{className:`mt-2 h-3 w-1/2`})]}),(0,Q.jsx)(L,{className:`h-7 w-20 rounded-md`})]})},t)}function Ie(e){return!e}function Le(e){return e.expired||e.revoked}function Re(e){return!e.expired&&!e.revoked}function ze(e){return!e.expired&&!e.revoked}var Be={expanded:!0,path:``,isDirectory:!1,agentId:``,ttlMs:864e5,maxViews:null,description:``,directoryMode:`browse`,creating:!1,result:null,errorMsg:null,resultDialogOpen:!1,pickerOpen:!1};function Ve({t:e,onCreated:t}){let[n,r]=(0,J.useReducer)(k,Be),{expanded:i,path:a,isDirectory:c,agentId:d,ttlMs:m,maxViews:h,description:g,directoryMode:_,creating:v,result:y,errorMsg:b,resultDialogOpen:x,pickerOpen:S}=n,ee=(0,J.useCallback)(async()=>{if(a.trim()){r({type:`patch`,patch:{creating:!0,errorMsg:null,result:null}});try{r({type:`patch`,patch:{result:(await O({path:a.trim(),ttlMs:m,maxViews:h,description:g.trim()||void 0,...d?{agentId:d}:{},...c?{kind:`directory`,directoryMode:_}:{}})).payload,resultDialogOpen:!0}}),t()}catch(e){r({type:`patch`,patch:{errorMsg:e instanceof Error?e.message:String(e)}})}finally{r({type:`patch`,patch:{creating:!1}})}}},[a,c,d,m,h,g,_,t]),C=(0,J.useCallback)(()=>{r({type:`patch`,patch:{path:``,isDirectory:!1,agentId:``,description:``,maxViews:null,ttlMs:864e5,directoryMode:`browse`,result:null,errorMsg:null}})},[]);return i?(0,Q.jsxs)(q,{children:[(0,Q.jsx)(`h2`,{className:`mb-1 text-sm font-semibold text-fg`,children:e.createTitle}),(0,Q.jsx)(`p`,{className:`mb-4 text-xs text-fg-muted`,children:e.createHint}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:e.pathLabel}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`div`,{className:f(`flex min-w-0 flex-1 items-center gap-2 rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm`,a?`text-fg`:`text-fg-subtle`),children:a?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{"aria-hidden":!0,children:c?`📁`:`📄`}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:a,children:a})]}):(0,Q.jsx)(`span`,{className:`truncate`,children:e.pathPlaceholder})}),(0,Q.jsxs)(p,{type:`button`,variant:`ghost`,onClick:()=>r({type:`patch`,patch:{pickerOpen:!0}}),children:[(0,Q.jsx)(H,{className:`size-4`}),a?e.pathBrowseChange:e.pathBrowse]})]})]}),c?(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:e.directoryModeLabel}),(0,Q.jsxs)(o,{className:`rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg focus:outline-none focus:ring-2 focus:ring-accent`,value:_,onChange:e=>r({type:`patch`,patch:{directoryMode:e.target.value===`zip-only`?`zip-only`:`browse`}}),children:[(0,Q.jsx)(s,{value:`browse`,children:e.directoryModeBrowse}),(0,Q.jsx)(s,{value:`zip-only`,children:e.directoryModeZipOnly})]})]}):null,(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:e.ttlLabel}),(0,Q.jsx)(o,{className:`rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg focus:outline-none focus:ring-2 focus:ring-accent`,value:m,onChange:e=>r({type:`patch`,patch:{ttlMs:Number(e.target.value)}}),children:Ae.map(t=>(0,Q.jsx)(s,{value:t.value,children:e.ttlOptions[t.key]},t.key))})]}),(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:e.maxViewsLabel}),(0,Q.jsxs)(o,{className:`rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg focus:outline-none focus:ring-2 focus:ring-accent`,value:h??`unlimited`,onChange:e=>r({type:`patch`,patch:{maxViews:e.target.value===`unlimited`?null:Number(e.target.value)}}),children:[(0,Q.jsx)(s,{value:`unlimited`,children:e.maxViewsUnlimited}),(0,Q.jsx)(s,{value:`1`,children:`1`}),(0,Q.jsx)(s,{value:`5`,children:`5`}),(0,Q.jsx)(s,{value:`10`,children:`10`}),(0,Q.jsx)(s,{value:`50`,children:`50`}),(0,Q.jsx)(s,{value:`100`,children:`100`})]})]})]}),(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:e.descriptionLabel}),(0,Q.jsx)(`input`,{type:`text`,className:`rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg placeholder:text-fg-subtle focus:outline-none focus:ring-2 focus:ring-accent`,placeholder:e.descriptionPlaceholder,value:g,onChange:e=>r({type:`patch`,patch:{description:e.target.value}})})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 pt-1`,children:[(0,Q.jsxs)(p,{type:`button`,disabled:v||!a.trim(),onClick:()=>void ee(),children:[v?(0,Q.jsx)(l,{className:`size-4 animate-spin`}):(0,Q.jsx)(u,{className:`size-4`}),v?e.creating:e.createButton]}),(0,Q.jsx)(p,{type:`button`,variant:`ghost`,onClick:()=>{C(),r({type:`patch`,patch:{expanded:!1}})},children:e.cancel})]}),b&&(0,Q.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:b})]}),(0,Q.jsx)(I,{open:x,onOpenChange:e=>{r({type:`patch`,patch:{resultDialogOpen:e,...e?{}:{result:null}}})},result:y}),(0,Q.jsx)(Se,{open:S,onOpenChange:e=>r({type:`patch`,patch:{pickerOpen:e}}),initialPath:a||void 0,selectKind:`any`,onConfirm:e=>r({type:`patch`,patch:{path:e.path,isDirectory:e.isDirectory,agentId:e.agentId,directoryMode:`browse`}})})]}):(0,Q.jsxs)(p,{type:`button`,onClick:()=>r({type:`patch`,patch:{expanded:!0}}),className:`self-start`,children:[(0,Q.jsx)(u,{className:`size-4`}),e.createTitle]})}var He={revokeOpen:!1,revoking:!1,linksOpen:!1,urlCopied:!1,copyFailed:!1,extending:!1};function Ue({share:e,t,language:n,onRevoked:r,onExtended:i}){let[o,s]=(0,J.useReducer)(k,He),{revokeOpen:u,revoking:d,linksOpen:m,urlCopied:g,copyFailed:_,extending:v}=o,y=!e.expired&&!e.revoked,b=e.revoked?t.statusRevoked:e.expired?t.statusExpired:t.statusActive,x=e.revoked?`text-red-600 dark:text-red-400`:e.expired?`text-fg-subtle`:`text-emerald-600 dark:text-emerald-400`,S=(0,J.useCallback)(async()=>{s({type:`patch`,patch:{revokeOpen:!1,revoking:!0}});try{await A(e.id),r()}catch{}finally{s({type:`patch`,patch:{revoking:!1}})}},[e.id,r]),ee=(0,J.useCallback)(async()=>{if(s({type:`patch`,patch:{linksOpen:!0,copyFailed:!1}}),!await h(e.shareUrl)){s({type:`patch`,patch:{copyFailed:!0}}),window.setTimeout(()=>s({type:`patch`,patch:{copyFailed:!1}}),2500);return}s({type:`patch`,patch:{urlCopied:!0}}),window.setTimeout(()=>s({type:`patch`,patch:{urlCopied:!1}}),2e3)},[e.shareUrl]),C=(0,J.useCallback)(async()=>{s({type:`patch`,patch:{extending:!0}});try{await j(e.id,864e5),i()}catch{}finally{s({type:`patch`,patch:{extending:!1}})}},[e.id,i]),w=`share-links-${e.id}`;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`rounded-lg bg-surface-panel/80 px-3 py-2.5 shadow-surface`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Q.jsxs)(`button`,{type:`button`,className:f(`flex min-w-0 flex-1 items-start gap-3 rounded-md text-left`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),"aria-expanded":m,"aria-controls":w,onClick:()=>s({type:`patch`,patch:{linksOpen:!m}}),children:[(0,Q.jsx)(ae,{className:f(`mt-0.5 size-4 shrink-0 text-fg-muted transition-transform`,m?`rotate-0`:`-rotate-90`),"aria-hidden":!0}),(0,Q.jsx)(H,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.fileName}),(0,Q.jsx)(`span`,{className:f(`text-xs font-medium`,x),children:b})]}),(0,Q.jsx)(`p`,{className:`truncate text-xs text-fg-subtle`,children:e.workspaceRelativePath}),(0,Q.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-fg-muted`,children:[(0,Q.jsx)(`span`,{children:Oe(e.fileSize)}),(0,Q.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,Q.jsx)(B,{className:`size-3`}),e.expired?n===`zh`?`已过期`:`expired`:ke(e.expiresAt,n)]}),(0,Q.jsxs)(`span`,{children:[t.views,`: `,e.downloadCount,e.maxViews!==null&&` ${t.viewsOf} ${e.maxViews}`]}),e.description&&(0,Q.jsx)(`span`,{className:`italic text-fg-subtle`,children:e.description})]})]})]}),(0,Q.jsx)(`div`,{className:`flex shrink-0 items-center gap-1`,children:y&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(p,{type:`button`,variant:`ghost`,className:`px-2 py-1`,title:t.copyUrl,onClick:()=>void ee(),children:g?(0,Q.jsx)(a,{className:`size-3.5 text-emerald-500`}):(0,Q.jsx)(c,{className:`size-3.5`})}),(0,Q.jsx)(p,{type:`button`,variant:`ghost`,className:`px-2 py-1`,onClick:()=>void C(),disabled:v,title:t.extend,children:v?(0,Q.jsx)(l,{className:`size-3.5 animate-spin`}):(0,Q.jsx)(B,{className:`size-3.5`})}),(0,Q.jsx)(p,{type:`button`,variant:`ghost`,className:`px-2 py-1 text-red-600 hover:text-red-700 dark:text-red-400`,onClick:()=>s({type:`patch`,patch:{revokeOpen:!0}}),disabled:d,children:d?(0,Q.jsx)(l,{className:`size-3.5 animate-spin`}):(0,Q.jsx)(z,{className:`size-3.5`})})]})})]}),y&&m?(0,Q.jsxs)(`div`,{id:w,className:`mt-3 bg-surface-base/45 py-3 pl-7 pr-3`,children:[(0,Q.jsx)(ie,{shareUrl:e.shareUrl,lanUrl:e.lanUrl,reachability:e.reachability,compact:!0}),_?(0,Q.jsx)(`p`,{className:`mt-2 text-xs text-red-600 dark:text-red-400`,children:t.copyFailed}):null,(0,Q.jsx)(`div`,{className:`mt-2`,children:(0,Q.jsx)(R,{reachability:e.reachability})})]}):null]}),(0,Q.jsx)(M,{open:u,title:t.revokeConfirmTitle,description:t.revokeConfirmBody,confirmLabel:t.revokeConfirmLabel,cancelLabel:t.cancel,destructive:!0,onConfirm:()=>void S(),onCancel:()=>s({type:`patch`,patch:{revokeOpen:!1}})})]})}function We({t:e,onCleaned:t}){let[n,r]=(0,J.useState)(!1),[i,a]=(0,J.useState)(!1),o=(0,J.useCallback)(async()=>{r(!1),a(!0);try{await F(),t()}catch{}finally{a(!1)}},[t]);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,Q.jsxs)(p,{type:`button`,variant:`secondary`,disabled:i,onClick:()=>r(!0),className:`border-danger/40 px-2 py-1 text-xs text-danger hover:bg-danger/10`,children:[i?(0,Q.jsx)(l,{className:`size-3.5 animate-spin`}):(0,Q.jsx)(z,{className:`size-3.5`}),e.cleanExpired]})}),(0,Q.jsx)(M,{open:n,title:e.cleanExpiredConfirmTitle,description:e.cleanExpiredConfirmBody,confirmLabel:e.cleanExpiredConfirmLabel,cancelLabel:e.cancel,destructive:!0,onConfirm:()=>void o(),onCancel:()=>r(!1)})]})}export{je as SharesSettingsPanel};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{d as i,l as a,p as o,t as s}from"./chunk-KS7C4IRE-BaASWQor.js";import{n as c,r as l}from"./popover-select-BzdnTy3h.js";import{t as u}from"./circle-check-C23XjkUj.js";import{t as d}from"./ellipsis-0k4rZLoy.js";import{t as f}from"./external-link-DjqjBmc3.js";import{f as p,t as m,u as h}from"./markdown-view-DYkxMtJA.js";import{t as g}from"./x-B_N4OPjy.js";import{t as _}from"./cn-JdwAhgNB.js";import{t as v}from"./button-CSEbl4zT.js";import{l as ee,n as te}from"./locale-store-iKjqemWG.js";import{i as y,n as ne,o as re,r as ie,s as ae,t as oe}from"./dist-BPoKqzeH.js";import{$ as b,B as se,Bi as x,Gr as S,Hn as ce,Hr as C,I as le,J as ue,Ja as de,Kr as fe,L as pe,P as me,Pa as he,Q as w,Ri as ge,Ti as T,Un as E,Ur as _e,Vr as ve,W as D,Wn as ye,Wr as O,X as k,Xc as A,Ya as j,Yc as be,Zs as M,_l as N,at as P,n as xe,pc as Se,ql as Ce,qr as we,rc as Te,uo as Ee,vl as F,zi as De}from"./index-EvA8c7fo.js";import{t as Oe}from"./date-picker-Bv9hZLuD.js";import{t as ke}from"./dependency-picker-D-6oO_Vk.js";var I=e(t(),1),L=n();function Ae(e,t,n,r){return!!(e&&t!==e.version&&n!==e.value&&r!==n)}function je(e,t){let n={...e.task};t.title!==void 0&&(n.title=t.title),t.priority!==void 0&&(n.priority=t.priority);for(let e of[`body`,`projectId`,`milestoneId`,`parentTaskId`,`dueAt`,`ownerId`]){let r=t[e];r!==void 0&&(r===null?delete n[e]:Object.assign(n,{[e]:r}))}return n.version+=1,n.updatedAt=Date.now(),{...e,task:n}}var R=r();function z(e,t){return(t===`zh`?{backlog:`待规划`,ready:`就绪`,active:`进行中`,review:`待验收`,closed:`已完成`}:{backlog:`Backlog`,ready:`Ready`,active:`Active`,review:`Review`,closed:`Completed`})[e]}function Me(){let e=(0,L.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,R.jsxs)(`div`,{className:`space-y-4`,"aria-busy":!0,children:[(0,R.jsx)(j,{className:`h-32 rounded-2xl`}),(0,R.jsx)(j,{className:`h-52 rounded-2xl`}),(0,R.jsx)(j,{className:`h-40 rounded-2xl`})]}),e[0]=t):t=e[0],t}function Ne(e){if(e===void 0)return``;let t=new Date(e);return new Date(t.getTime()-t.getTimezoneOffset()*6e4).toISOString().slice(0,10)}function Pe(e){return e?new Date(`${e}T23:59:59.999`).getTime():null}var B=[`backlog`,`ready`,`active`,`review`,`closed`],Fe=[`low`,`normal`,`high`,`critical`],Ie=(0,I.memo)(function(e){let t=(0,L.c)(20),{value:n,disabled:r,canMove:i,canApprove:a,canReopen:o,language:s,label:u,onChange:d}=e,f;t[0]!==a||t[1]!==i||t[2]!==o||t[3]!==n?(f=e=>e!==n&&(e===`closed`?!a:n===`closed`?!o:!i),t[0]=a,t[1]=i,t[2]=o,t[3]=n,t[4]=f):f=t[4];let p=f,m;t[5]===u?m=t[6]:(m=(0,R.jsx)(`span`,{children:u}),t[5]=u,t[6]=m);let h;t[7]===d?h=t[8]:(h=e=>d(e.target.value),t[7]=d,t[8]=h);let g;t[9]!==s||t[10]!==p?(g=B.map(e=>(0,R.jsx)(l,{value:e,disabled:p(e),children:z(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,R.jsx)(c,{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,R.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}),Le=(0,I.memo)(function(e){let t=(0,L.c)(14),{value:n,disabled:r,label:i,labels:a,onChange:o}=e,s;t[0]===i?s=t[1]:(s=(0,R.jsx)(`span`,{children:i}),t[0]=i,t[1]=s);let u;t[2]===o?u=t[3]:(u=e=>o(e.target.value),t[2]=o,t[3]=u);let d;t[4]===a?d=t[5]:(d=Fe.map(e=>(0,R.jsx)(l,{value:e,children:a[e]},e)),t[4]=a,t[5]=d);let f;t[6]!==r||t[7]!==u||t[8]!==d||t[9]!==n?(f=(0,R.jsx)(c,{triggerClassName:`border-0 bg-surface-hover shadow-none focus-visible:ring-2 focus-visible:ring-accent/30`,contentClassName:`border-0`,value:n,disabled:r,onChange:u,children:d}),t[6]=r,t[7]=u,t[8]=d,t[9]=n,t[10]=f):f=t[10];let p;return t[11]!==s||t[12]!==f?(p=(0,R.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}),Re=(0,I.memo)(function(e){let t=(0,L.c)(10),{value:n,disabled:r,label:i,onChange:a}=e,o;t[0]===i?o=t[1]:(o=(0,R.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,R.jsx)(Oe,{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,R.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}),ze=(0,I.memo)(function(e){let t=(0,L.c)(17),{value:n,disabled:r,label:i,unassignedLabel:a,agents:o,onChange:s}=e,u;t[0]===i?u=t[1]:(u=(0,R.jsx)(`span`,{children:i}),t[0]=i,t[1]=u);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,R.jsx)(l,{value:``,disabled:!0,children:a}),t[4]=a,t[5]=f);let p;t[6]===o?p=t[7]:(p=o.map(nt),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,R.jsxs)(c,{triggerClassName:`border-0 bg-surface-hover shadow-none focus-visible:ring-2 focus-visible:ring-accent/30`,contentClassName:`border-0`,value:n,disabled:r,onChange:d,children:[f,p]}),t[8]=r,t[9]=d,t[10]=f,t[11]=p,t[12]=n,t[13]=m):m=t[13];let h;return t[14]!==u||t[15]!==m?(h=(0,R.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[u,m]}),t[14]=u,t[15]=m,t[16]=h):h=t[16],h}),Be=(0,I.memo)(function(e){let t=(0,L.c)(8),{candidates:n,selected:r,disabled:i,labels:a,onChange:o}=e,s;t[0]===r?s=t[1]:(s=r.map(G),t[0]=r,t[1]=s);let c;return t[2]!==n||t[3]!==i||t[4]!==a||t[5]!==o||t[6]!==s?(c=(0,R.jsx)(ke,{borderless:!0,candidates:n,selectedIds:s,disabled:i,onChange:o,labels:a}),t[2]=n,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c):c=t[7],c},(e,t)=>e.disabled===t.disabled&&e.labels===t.labels&&e.onChange===t.onChange&&e.candidates.length===t.candidates.length&&e.candidates.every((e,n)=>e.id===t.candidates[n]?.id&&e.title===t.candidates[n]?.title)&&e.selected.length===t.selected.length&&e.selected.every((e,n)=>e.id===t.selected[n]?.id&&e.title===t.selected[n]?.title)),Ve=`xopc.taskDetail.chatPanelPercent`,He=42;function Ue(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?He:Math.min(r,Math.max(n,e))}function We(){try{let e=Number(window.localStorage.getItem(Ve));return Number.isFinite(e)&&e>=30&&e<=60?e:He}catch{return He}}function Ge(e){return e.task.phase===`closed`?e.task.resolution===`done`?`completed`:`ended`:e.attention.some(e=>e.kind===`input_required`||e.kind===`approval_required`)?`needsUser`:e.operationalState===`idle`?e.task.phase===`backlog`?`captured`:e.task.phase===`ready`?`ready`:e.task.phase===`review`?`review`:`paused`:e.operationalState}function V(e){let t=(0,L.c)(9),{items:n,empty:r,verificationByCriterion:i}=e;if(n.length===0){let e;return t[0]===r?e=t[1]:(e=(0,R.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:r}),t[0]=r,t[1]=e),e}let a;if(t[2]!==n||t[3]!==i){let e;t[5]===i?e=t[6]:(e=e=>{let t=i?.get(e)??`unverified`;return(0,R.jsxs)(`li`,{className:`flex gap-2 text-sm leading-6 text-fg`,children:[(0,R.jsx)(t===`passed`?u:t===`failed`?F:N,{className:t===`passed`?`mt-1 size-4 shrink-0 text-success`:t===`failed`?`mt-1 size-4 shrink-0 text-danger`:`mt-1 size-4 shrink-0 text-fg-subtle`}),(0,R.jsx)(`span`,{children:e})]},e)},t[5]=i,t[6]=e),a=n.map(e),t[2]=n,t[3]=i,t[4]=a}else a=t[4];let o;return t[7]===a?o=t[8]:(o=(0,R.jsx)(`ul`,{className:`space-y-2`,children:a}),t[7]=a,t[8]=o),o}function Ke({taskId:e,presentation:t,backgroundPath:n,onDeleted:r}){let[i]=o(),c=a(),l=te(e=>e.language),g=ee(e=>e.token),y=(0,I.useMemo)(()=>b(l),[l]),ne=Ee(e=>e.setPageHeader),re=Ee(e=>e.clearPageHeader),ie=x(e=>e.open),ae=x(e=>e.sessionKeyOverride),oe=x(e=>e.openForSession),ye=we(e=>e.setOpen),{data:j,error:N,mutate:F,lastChange:De,conversationLoading:Oe,conversationError:ke}=me(e),[L,z]=(0,I.useState)(null),[B,Fe]=(0,I.useState)(()=>new Set),[Ke,qe]=(0,I.useState)([]),[H,Je]=(0,I.useState)(null),[Ye,Xe]=(0,I.useState)([]),[Ze,U]=(0,I.useState)(!1),[Qe,$e]=(0,I.useState)(``),[et,W]=(0,I.useState)(!1),[tt,nt]=(0,I.useState)(``),[G,rt]=(0,I.useState)(We),[it,at]=(0,I.useState)(!1),ot=(0,I.useRef)(null),st=(0,I.useRef)(!1),ct=(0,I.useRef)(!1),lt=(0,I.useRef)(``),ut=(0,I.useRef)(null),dt=(0,I.useRef)(null),ft=(0,I.useRef)(null),pt=(0,I.useRef)(j),[mt,K]=(0,I.useState)(null),[ht,gt]=(0,I.useState)(null),[_t,vt]=(0,I.useState)(!1),yt=(0,I.useMemo)(()=>({link:y.linkDependencies,linked:y.linkedDependencies,searchPlaceholder:y.dependencySearchPlaceholder,noMatches:y.noDependencyMatches,noCandidates:y.noDependencyCandidates,remove:y.removeDependency}),[y.dependencySearchPlaceholder,y.linkDependencies,y.linkedDependencies,y.noDependencyCandidates,y.noDependencyMatches,y.removeDependency]),bt=j?.dependencies.map(e=>`${e.id}:${e.title}`).join(`\0`)??``,xt=(0,I.useMemo)(()=>h(i.get(`returnTo`),`/`,[`/projects`,`/chat`,`/notes`,`/tasks`]),[i]);pt.current=j;let q=(0,I.useCallback)((e,t)=>{Fe(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r})},[]);(0,I.useEffect)(()=>{z(null),K(null),U(!1),W(!1),gt(null),vt(!1)},[e]),(0,I.useEffect)(()=>{let e=!0;return de().then(t=>{e&&Xe(t.items)}).catch(()=>void 0),()=>{e=!1}},[g]),(0,I.useEffect)(()=>{if(!De||De.source===`user`)return;gt(De);let e=window.setTimeout(()=>gt(null),3500);return()=>window.clearTimeout(e)},[De]),(0,I.useEffect)(()=>{let t=j?.task.projectId,n=j?.dependencies??[];if(!t){ft.current=null,Je(null),qe(n);return}ft.current!==t&&(ft.current=t,Je(null));let r=!0;return he(t).then(t=>{if(!r)return;Je(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});qe([...i.values()])}).catch(()=>{r&&qe(n)}),()=>{r=!1}},[bt,j?.task.projectId,e]);let J=(0,I.useCallback)(async(t,n=`command`)=>{let r=pt.current;if(r){q(n,!0),z(null);try{await F(await pe(e,t,r.task.version),{revalidate:!1})}catch{z(y.actionFailed)}finally{q(n,!1)}}},[y.actionFailed,F,q,e]),Y=(0,I.useCallback)(async(t,n)=>{let r=pt.current;if(!r)return!1;n&&q(n,!0),z(null);try{return await F(k(e,t,r.task.version),{optimisticData:je(r,t),populateCache:!0,revalidate:!1,rollbackOnError:!0}),!0}catch{return z(y.actionFailed),!1}finally{n&&q(n,!1)}},[y.actionFailed,F,q,e]),St=async()=>{if(!j)return;if(st.current){st.current=!1;return}let e=Qe.trim(),t=ut.current;if(Ae(t,j.task.version,j.task.title,e)){K(`title`);return}if(!e||e===j.task.title){$e(j.task.title),U(!1);return}await Y({title:e})&&(K(null),U(!1))},Ct=async()=>{if(!j)return;if(ct.current){ct.current=!1;return}let e=tt.trim(),t=dt.current;if(Ae(t,j.task.version,j.task.body??``,e)){K(`description`);return}if(tt===lt.current||e===(j.task.body??``).trim()){W(!1);return}await Y({body:e||null})&&(K(null),W(!1))},wt=(0,I.useCallback)(async e=>{let t=pt.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]),Tt=(0,I.useCallback)(e=>{Y({priority:e},`priority`)},[Y]),Et=(0,I.useCallback)(e=>{Y({dueAt:Pe(e)},`dueAt`)},[Y]),Dt=(0,I.useCallback)(e=>{rt(e);try{window.localStorage.setItem(Ve,String(e))}catch{}},[]),Ot=(0,I.useCallback)(e=>{if(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`&&e.key!==`Home`)return;e.preventDefault();let t=ot.current?.clientWidth??0;Dt(Ue(e.key===`Home`?He:G+(e.key===`ArrowLeft`?2:-2),t))},[G,Dt]),kt=(0,I.useCallback)(e=>{if(!window.matchMedia(`(min-width: 1024px)`).matches)return;let t=ot.current;if(!t)return;e.preventDefault();let n=e.currentTarget,r=e.pointerId;n.setPointerCapture(r),at(!0);let i=G,a=0,o=()=>{a=0,t.style.setProperty(`--task-chat-panel-width`,`${i}%`)},s=e=>{let n=t.getBoundingClientRect();i=Ue((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{}at(!1),Dt(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,Dt]),At=(0,I.useCallback)(async t=>{let n=pt.current;if(n){q(`dependencies`,!0),z(null);try{await F(await w(e,t,n.task.version),{revalidate:!1})}catch{z(y.dependencyUpdateFailed)}finally{q(`dependencies`,!1)}}},[y.dependencyUpdateFailed,F,q,e]),jt=(0,I.useCallback)(async t=>{let n=pt.current;if(!(!n||!t||t===n.conversation.currentExecutorAgentId)){q(`delegateAgentId`,!0),z(null);try{await F(await D(e,t,n.task.version),{revalidate:!1})}catch{z(y.actionFailed)}finally{q(`delegateAgentId`,!1)}}},[y.actionFailed,F,q,e]),Mt=(0,I.useCallback)(async()=>{q(`delete`,!0),z(null);try{await se(e),r?r():c(xt,{replace:!0})}catch(e){z(e instanceof Error?e.message:y.actionFailed)}finally{q(`delete`,!1)}},[y.actionFailed,c,r,xt,q,e]);if((0,I.useLayoutEffect)(()=>{if(t!==`modal`)return ne({startExtra:(0,R.jsx)(s,{to:xt,className:`flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover`,"aria-label":y.backToWork,children:(0,R.jsx)(Ce,{className:`size-4`})}),main:j?(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsx)(`p`,{className:`truncate text-sm font-semibold text-fg`,children:H?`${H} / ${y.taskLabel}`:y.taskLabel}),(0,R.jsx)(`p`,{className:`text-xs text-fg-muted`,children:y.detailStatuses[Ge(j)]})]}):null,end:null}),re},[re,y.backToWork,y.detailStatuses,y.taskLabel,j,t,H,xt,ne]),N&&!j)return(0,R.jsx)(`div`,{className:t===`modal`?`p-5 text-sm text-danger`:`mx-auto max-w-3xl p-6 text-sm text-danger`,children:y.taskNotFound});if(!j)return(0,R.jsx)(`div`,{className:t===`modal`?`p-5`:`mx-auto max-w-4xl p-4 sm:p-6`,children:(0,R.jsx)(Me,{})});let Nt=j.waits[0],Pt=Nt?.kind===`paused`?Nt:void 0,X=j.receipts[0],Ft=y.detailStatuses[Ge(j)],It=y.detailStatusDescriptions[Ge(j)],Lt=j.task.body?.trim()||j.task.contract?.objective.trim(),Rt=new Map(X?.verification.checks.map(e=>[e.criterion,e.status])),zt=j.allowedCommands.includes(`mark_ready`),Bt=j.allowedCommands.includes(`start`),Vt=j.allowedCommands.includes(`add_wait`),Ht=j.task.phase===`review`&&j.allowedCommands.includes(`close`),Ut=j.allowedCommands.includes(`reopen`),Z=j.conversation.activeSessionKey,Wt=j.conversation.currentExecutorAgentId??j.task.delegateAgentId??j.task.ownerId,Gt=Ye.find(e=>e.id===Wt),Kt=!!(Z&&ie&&ae===Z),qt=j.attention.some(e=>e.kind===`input_required`||e.kind===`approval_required`),Jt=j.task.contract?.acceptanceCriteria??[],Yt=Jt.filter(e=>Rt.get(e)===`passed`).length,Xt=j.task.contract?.expectedOutputs??[],Zt=j.task.contract?.constraints??[],Qt=j.task.contract?.approvalRequired??[],$t=j.task.contract?.assumptions??[],en=j.task.contract?.risks??[],Q=(...e)=>!!ht?.changedFields.some(t=>e.includes(t)),tn=e=>t===`modal`&&n?E(n,e):p(`/tasks/${e}`,xt),nn=j.allowedCommands.includes(`move`),$=B.has(`command`),rn=B.has(`delete`),an=j.runs.find(e=>[`queued`,`running`,`waiting`,`verifying`].includes(e.status)),on=an!==void 0,sn=(0,R.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[zt?(0,R.jsxs)(v,{variant:`primary`,disabled:$,onClick:()=>void J({type:`mark_ready`}),children:[(0,R.jsx)(M,{className:`size-4`}),y.scheduleTask]}):null,Pt?(0,R.jsxs)(v,{variant:`primary`,disabled:$,onClick:()=>void J({type:`resolve_wait`,waitId:Pt.id}),children:[(0,R.jsx)(M,{className:`size-4`}),y.resumeTask]}):null,!Nt&&Bt&&Wt?(0,R.jsxs)(v,{variant:`primary`,disabled:$,onClick:()=>void J({type:`start`,executor:{kind:`agent`,agentId:Wt}}),children:[(0,R.jsx)(M,{className:`size-4`}),y.runTask]}):null,Ht?(0,R.jsxs)(v,{variant:`primary`,disabled:$,onClick:()=>void J({type:`close`,resolution:`done`}),children:[(0,R.jsx)(u,{className:`size-4`}),y.approveTask]}):null,Ut?(0,R.jsxs)(v,{variant:`primary`,disabled:$,onClick:()=>void J({type:`reopen`,phase:`ready`}),children:[(0,R.jsx)(M,{className:`size-4`}),y.reopenTask]}):null,!Nt&&Vt?(0,R.jsxs)(v,{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,R.jsx)(Te,{className:`size-4`}),y.pauseTask]}):null,(0,R.jsxs)(O,{children:[(0,R.jsx)(fe,{asChild:!0,children:(0,R.jsx)(v,{type:`button`,variant:`ghost`,className:`size-9 p-0`,disabled:$||rn,"aria-label":y.moreActions,children:(0,R.jsx)(d,{className:`size-4`,"aria-hidden":!0})})}),(0,R.jsx)(_e,{children:(0,R.jsxs)(ve,{align:`end`,sideOffset:6,className:`z-[100] min-w-44 rounded-lg border border-edge bg-surface-panel p-1 shadow-popover`,children:[an?(0,R.jsx)(C,{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),z(null),F(le(e,an.id,an.version),{revalidate:!1}).catch(()=>z(y.actionFailed)).finally(()=>q(`command`,!1))},children:y.cancelActiveRun}):null,an?(0,R.jsx)(S,{className:`my-1 h-px bg-edge`}):null,j.task.phase===`closed`?null:(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(C,{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:y.cancelTask}),(0,R.jsx)(S,{className:`my-1 h-px bg-edge`})]}),(0,R.jsx)(C,{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(on){z(y.deleteActiveTaskBlocked);return}vt(!0)},children:y.deleteTask})]})})]})]});return(0,R.jsxs)(`div`,{ref:ot,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`} ${it?`lg:cursor-col-resize lg:select-none`:``}`,style:{"--task-chat-panel-width":`${G}%`},children:[(0,R.jsxs)(`section`,{className:`task-detail-scroll min-w-0 flex-1 overflow-y-auto overscroll-contain p-5 sm:p-6`,children:[(0,R.jsxs)(`header`,{className:_(`px-4 pb-5`,Q(`title`)&&`task-detail-live-update`),children:[(0,R.jsx)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:[H?(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,R.jsx)(A,{className:`size-3.5`,"aria-hidden":!0}),H]}):null,(0,R.jsx)(`span`,{children:`/`}),(0,R.jsx)(`span`,{children:y.taskLabel}),ht?(0,R.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent-fg`,role:`status`,children:ht.source===`agent`?l===`zh`?`Agent 刚刚更新`:`Updated by Agent`:l===`zh`?`执行结果已同步`:`Execution result synced`}):null]}),Ze?(0,R.jsx)(`input`,{autoFocus:!0,"data-task-inline-editor":!0,value:Qe,onChange:e=>$e(e.target.value),onBlur:()=>void St(),onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur(),e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),st.current=!0,$e(j.task.title),U(!1),queueMicrotask(()=>{st.current=!1}))},className:`mt-3 w-full max-w-3xl rounded-lg bg-surface-hover px-3 py-2 text-2xl font-semibold leading-8 text-fg outline-none ring-2 ring-accent/30 focus:ring-accent/60`}):(0,R.jsx)(`button`,{type:`button`,className:`mt-3 block max-w-3xl rounded-lg text-left outline-none hover:bg-surface-hover focus-visible:bg-surface-hover`,onClick:()=>{ut.current={value:j.task.title,version:j.task.version},K(null),$e(j.task.title),U(!0)},children:(0,R.jsx)(`h1`,{className:`text-2xl font-semibold leading-8 text-fg`,children:j.task.title})}),mt===`title`?(0,R.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-warning`,role:`alert`,children:[(0,R.jsx)(`span`,{children:l===`zh`?`Agent 在你编辑期间更新了标题。`:`The Agent updated the title while you were editing.`}),(0,R.jsx)(`button`,{type:`button`,className:`rounded-md bg-surface-hover px-2 py-1 text-fg`,onClick:()=>{$e(j.task.title),K(null),U(!1)},children:l===`zh`?`使用 Agent 版本`:`Use Agent version`}),(0,R.jsx)(`button`,{type:`button`,className:`rounded-md bg-accent-soft px-2 py-1 text-accent-fg`,onClick:()=>void Y({title:Qe.trim()}).then(e=>{e&&(K(null),U(!1))}),children:l===`zh`?`保留我的修改`:`Keep my changes`})]}):null]})}),L?(0,R.jsx)(`p`,{className:`mt-3 text-sm text-danger`,children:L}):null]}),(0,R.jsxs)(`div`,{className:`mt-5 flex flex-col gap-5`,children:[(0,R.jsxs)(`main`,{className:`order-2 min-w-0 space-y-5`,children:[(0,R.jsxs)(`section`,{className:_(`rounded-xl bg-surface-panel p-4`,Q(`body`)&&`task-detail-live-update`),children:[(0,R.jsx)(`h2`,{className:`font-medium text-fg`,children:y.taskDescription}),et?(0,R.jsx)(`textarea`,{autoFocus:!0,"data-task-inline-editor":!0,rows:6,value:tt,onChange:e=>nt(e.target.value),onBlur:()=>void Ct(),onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),ct.current=!0,nt(j.task.body??j.task.contract?.objective??``),W(!1),queueMicrotask(()=>{ct.current=!1}))},className:`mt-3 w-full resize-y rounded-lg bg-surface-hover px-3 py-2 text-sm leading-6 text-fg outline-none ring-2 ring-accent/20 focus:ring-accent/50`}):(0,R.jsx)(`button`,{type:`button`,className:`-mx-1 mt-2 block w-[calc(100%+0.5rem)] rounded-lg px-1 py-1 text-left outline-none hover:bg-surface-hover focus-visible:bg-surface-hover`,onClick:()=>{let e=j.task.body??j.task.contract?.objective??``;lt.current=e,dt.current={value:j.task.body??``,version:j.task.version},K(null),nt(e),W(!0)},children:(0,R.jsx)(`span`,{className:`whitespace-pre-wrap text-sm leading-6 text-fg-muted`,children:Lt&&Lt!==j.task.title?Lt:y.noTaskDescription})}),mt===`description`?(0,R.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-warning`,role:`alert`,children:[(0,R.jsx)(`span`,{children:l===`zh`?`Agent 在你编辑期间更新了描述。`:`The Agent updated the description while you were editing.`}),(0,R.jsx)(`button`,{type:`button`,className:`rounded-md bg-surface-hover px-2 py-1 text-fg`,onClick:()=>{nt(j.task.body??``),K(null),W(!1)},children:l===`zh`?`使用 Agent 版本`:`Use Agent version`}),(0,R.jsx)(`button`,{type:`button`,className:`rounded-md bg-accent-soft px-2 py-1 text-accent-fg`,onClick:()=>void Y({body:tt.trim()||null}).then(e=>{e&&(K(null),W(!1))}),children:l===`zh`?`保留我的修改`:`Keep my changes`})]}):null]}),j.attention.length>0?(0,R.jsxs)(`section`,{className:_(`rounded-xl bg-warning/10 p-4`,Q(`attention`)&&`task-detail-live-update`),children:[(0,R.jsx)(`h3`,{className:`font-medium text-fg`,children:qt?y.needsAttention:y.waitingStatus}),(0,R.jsx)(`ul`,{className:`mt-3 space-y-2 text-sm text-fg-muted`,children:j.attention.map((e,t)=>(0,R.jsx)(`li`,{children:e.summary},`${e.kind}-${t}`))})]}):null,(0,R.jsxs)(`section`,{className:_(`rounded-xl bg-surface-panel p-4`,Q(`contract`)&&`task-detail-live-update`),children:[(0,R.jsx)(`h2`,{className:`font-medium text-fg`,children:y.taskDefinition}),(0,R.jsxs)(`div`,{className:`mt-5`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,R.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:y.successDefinition}),Jt.length>0?(0,R.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:y.criteriaProgress.replace(`{{verified}}`,String(Yt)).replace(`{{total}}`,String(Jt.length))}):null]}),(0,R.jsx)(`div`,{className:`mt-3`,children:(0,R.jsx)(V,{items:Jt,empty:y.noDefinition,verificationByCriterion:Rt})})]}),Xt.length>0?(0,R.jsxs)(`div`,{className:`mt-5 rounded-lg bg-surface-hover p-4`,children:[(0,R.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:y.expectedOutputs}),(0,R.jsx)(`div`,{className:`mt-3`,children:(0,R.jsx)(V,{items:Xt,empty:y.noDefinition})})]}):null,Zt.length>0?(0,R.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,R.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:y.constraints}),(0,R.jsx)(`div`,{className:`mt-3`,children:(0,R.jsx)(V,{items:Zt,empty:y.noDefinition})})]}):null,Qt.length>0?(0,R.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,R.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:y.approvalRequired}),(0,R.jsx)(`div`,{className:`mt-3`,children:(0,R.jsx)(V,{items:Qt,empty:y.noDefinition})})]}):null,$t.length>0?(0,R.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,R.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:y.contextAssumptions}),(0,R.jsx)(`div`,{className:`mt-3`,children:(0,R.jsx)(V,{items:$t,empty:y.noDefinition})})]}):null,en.length>0?(0,R.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,R.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:y.contextRisks}),(0,R.jsx)(`div`,{className:`mt-3`,children:(0,R.jsx)(V,{items:en,empty:y.noDefinition})})]}):null]}),X?(0,R.jsxs)(`section`,{className:_(`rounded-xl bg-surface-panel p-4`,Q(`runs`,`receipts`)&&`task-detail-live-update`),children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`h2`,{className:`font-medium text-fg`,children:y.latestResult}),(0,R.jsx)(m,{content:X.summary,compact:!0,className:`mt-2 text-sm leading-6 text-fg`,openHttpLinksInNewTab:!0})]}),(0,R.jsxs)(`span`,{className:`rounded-full bg-surface-hover px-2.5 py-1 text-xs text-fg-muted`,children:[y.receiptStatuses[X.status],` · `,y.verificationStatuses[X.verification.status]]})]}),X.remainingWork.length>0?(0,R.jsxs)(`div`,{className:`mt-4`,children:[(0,R.jsx)(`h3`,{className:`text-xs font-medium text-fg-muted`,children:y.remainingWork}),(0,R.jsx)(`div`,{className:`mt-2`,children:(0,R.jsx)(V,{items:X.remainingWork,empty:y.noRemainingWork})})]}):null,X.nextAction?(0,R.jsxs)(`div`,{className:`mt-4 rounded-lg bg-surface-hover p-3`,children:[(0,R.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:y.nextAction}),(0,R.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:X.nextAction})]}):null,(0,R.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2`,children:[(0,R.jsx)(v,{className:`border-0 bg-surface-hover px-2 py-1 text-xs shadow-none`,variant:`secondary`,onClick:()=>void ue(X.runId,`helpful`),children:y.doneWell}),(0,R.jsx)(v,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>void ue(X.runId,`not_helpful`),children:y.needsFix}),X.evidence.filter(e=>e.uri).map(e=>(0,R.jsxs)(`a`,{className:`ml-auto inline-flex items-center gap-1 text-xs text-accent hover:underline`,href:e.uri,children:[(0,R.jsx)(f,{className:`size-3`}),e.title]},`${e.title}-${e.uri}`))]}),j.receipts.length>1?(0,R.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,R.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted`,children:y.executionHistory.replace(`{{count}}`,String(j.receipts.length-1))}),(0,R.jsx)(`div`,{className:`mt-3 space-y-3`,children:j.receipts.slice(1).map(e=>(0,R.jsx)(`article`,{className:`rounded-lg bg-surface-active p-3`,children:(0,R.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,R.jsx)(`p`,{className:`text-sm text-fg`,children:e.summary}),(0,R.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:y.receiptStatuses[e.status]})]})},e.runId))})]}):null]}):null,j.context.length>0?(0,R.jsxs)(`section`,{className:_(`rounded-xl bg-surface-panel p-4`,Q(`context`)&&`task-detail-live-update`),children:[(0,R.jsx)(`h2`,{className:`font-medium text-fg`,children:y.contextUsed}),(0,R.jsx)(`ul`,{className:`mt-4 grid gap-2 sm:grid-cols-2`,children:j.context.map(e=>(0,R.jsxs)(`li`,{className:`min-w-0 rounded-lg bg-surface-hover p-2.5`,children:[(0,R.jsxs)(`span`,{className:`text-[11px] text-fg-subtle`,children:[y.contextRoleLabels[e.role],` · `,y.contextKindLabels[e.targetKind]]}),e.targetKind===`url`&&/^https?:\/\//.test(e.targetId)?(0,R.jsx)(`a`,{className:`mt-1 block break-all text-sm text-accent hover:underline`,href:e.targetId,target:`_blank`,rel:`noreferrer`,children:e.title??e.targetId}):(0,R.jsx)(`p`,{className:`mt-1 break-words text-sm text-fg`,children:e.title??e.targetId})]},e.id))})]}):null]}),(0,R.jsxs)(`aside`,{className:`order-1 min-w-0 space-y-4`,children:[(0,R.jsxs)(`section`,{className:_(`rounded-xl bg-surface-subtle p-4`,Q(`phase`,`resolution`,`priority`,`dueAt`,`delegateAgentId`)&&`task-detail-live-update`),children:[(0,R.jsx)(`h2`,{className:`font-medium text-fg`,children:y.taskProperties}),(0,R.jsxs)(`div`,{className:`mt-4 grid gap-4 sm:grid-cols-2`,children:[(0,R.jsx)(Ie,{value:j.task.phase,disabled:B.has(`phase`),canMove:nn,canApprove:Ht,canReopen:Ut,language:l,label:y.taskPhase,onChange:wt}),(0,R.jsx)(Le,{value:j.task.priority,disabled:B.has(`priority`),label:y.priority,labels:y.priorityLabels,onChange:Tt}),(0,R.jsx)(Re,{value:Ne(j.task.dueAt),disabled:B.has(`dueAt`),label:y.dueDate,onChange:Et}),(0,R.jsx)(ze,{value:j.conversation.currentExecutorAgentId??``,disabled:B.has(`delegateAgentId`),label:y.executorLabel,unassignedLabel:y.unassigned,agents:Ye,onChange:jt}),H?(0,R.jsxs)(`div`,{className:`grid gap-1 text-xs text-fg-muted`,children:[(0,R.jsx)(`span`,{children:y.projectLabel}),(0,R.jsxs)(`span`,{className:`flex items-center gap-1.5 rounded-lg bg-surface-hover px-3 py-2 text-sm text-fg`,children:[(0,R.jsx)(A,{className:`size-3.5`}),H]})]}):null]}),(0,R.jsxs)(`div`,{className:`mt-4 rounded-lg bg-surface-hover p-3 text-xs leading-5 text-fg-subtle`,children:[(0,R.jsx)(`p`,{children:Ft}),(0,R.jsx)(`p`,{children:It}),(0,R.jsx)(`p`,{className:`mt-2`,children:y.updatedAt.replace(`{{date}}`,T(j.task.updatedAt,l))})]})]}),(0,R.jsxs)(`section`,{className:_(`rounded-xl bg-surface-panel p-4`,Q(`dependencies`)&&`task-detail-live-update`),children:[(0,R.jsx)(`h2`,{className:`font-medium text-fg`,children:y.taskRelations}),(0,R.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:y.dependencies}),(0,R.jsx)(Be,{candidates:Ke,selected:j.dependencies,disabled:B.has(`dependencies`),labels:yt,onChange:At})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:y.dependents}),j.dependents.length>0?(0,R.jsx)(`div`,{className:`space-y-1.5`,children:j.dependents.map(e=>(0,R.jsx)(s,{to:tn(e.id),className:`block rounded-lg bg-surface-hover p-2.5 text-sm text-accent hover:underline`,children:e.title},e.id))}):(0,R.jsx)(`p`,{className:`text-sm text-fg-subtle`,children:y.noDependents})]})]})]})]})]})]}),(0,R.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:kt,onKeyDown:Ot,onDoubleClick:()=>Dt(He),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 ${it?`bg-surface-hover`:``}`,children:(0,R.jsx)(`div`,{className:`my-3 w-px rounded-full bg-edge-strong/70 transition-colors group-hover:bg-accent group-focus-visible:bg-accent`})}),(0,R.jsxs)(`aside`,{className:`flex min-h-[34rem] min-w-0 flex-col bg-surface-panel lg:min-h-0 lg:w-[var(--task-chat-panel-width)] lg:shrink-0`,children:[(0,R.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-3 bg-surface-subtle px-4 py-3.5`,children:[(0,R.jsx)(`div`,{className:`min-w-0`,children:(0,R.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[Wt?(0,R.jsx)(P,{agentId:Wt,avatar:Gt?.avatar,size:28,className:`shrink-0`}):null,(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:l===`zh`?`Agent 执行与对话`:`Agent execution and chat`}),(0,R.jsxs)(`p`,{className:`mt-0.5 truncate text-xs text-fg-muted`,children:[Gt?.name??Wt??y.unassigned,` · `,Ft]})]})]})}),(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[sn,Z&&t!==`modal`?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(v,{type:`button`,variant:`ghost`,className:_(`h-8 shrink-0 px-2 text-xs`,Kt&&`bg-surface-hover text-fg`),"aria-label":l===`zh`?`项目文件`:`Project files`,"aria-pressed":Kt,onClick:()=>{ye(Z,!1),oe(Z)},children:[(0,R.jsx)(be,{className:`size-3.5`,"aria-hidden":!0}),l===`zh`?`文件`:`Files`]}),(0,R.jsx)(v,{asChild:!0,variant:`ghost`,className:`h-8 shrink-0 px-2 text-xs`,children:(0,R.jsxs)(s,{to:ce(e),children:[(0,R.jsx)(f,{className:`size-3.5`}),l===`zh`?`全屏`:`Full screen`]})})]}):null]})]}),Z?(0,R.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,R.jsx)(xe,{embedded:!0,sessionKey:Z,taskId:e})}):Oe?(0,R.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,R.jsxs)(`div`,{className:`max-w-xs`,children:[(0,R.jsx)(Se,{className:`mx-auto size-8 animate-pulse text-fg-subtle`}),(0,R.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:l===`zh`?`正在创建任务会话`:`Creating task conversation`})]})}):ke?(0,R.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,R.jsxs)(`div`,{className:`max-w-xs`,children:[(0,R.jsx)(Se,{className:`mx-auto size-8 text-danger`}),(0,R.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:l===`zh`?`任务会话创建失败`:`Could not create task conversation`}),(0,R.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:ke instanceof Error?ke.message:String(ke)})]})}):(0,R.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,R.jsxs)(`div`,{className:`max-w-xs`,children:[(0,R.jsx)(Se,{className:`mx-auto size-8 text-fg-subtle`}),(0,R.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:l===`zh`?`等待任务会话`:`Waiting for a task conversation`}),(0,R.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,R.jsx)(ge,{open:_t,title:y.deleteTaskTitle,description:y.deleteTaskDescription.replace(`{{title}}`,j.task.title),confirmLabel:y.confirmDeleteTask,cancelLabel:y.keepTask,destructive:!0,onConfirm:()=>{vt(!1),Mt()},onCancel:()=>vt(!1)})]})}function qe(){let e=(0,L.c)(2),{taskId:t}=i(),n=t===void 0?``:t,r;return e[0]===n?r=e[1]:(r=(0,R.jsx)(Ke,{taskId:n,presentation:`page`}),e[0]=n,e[1]=r),r}function H(e){let t=(0,L.c)(58),{taskId:n,backgroundPath:r,onClose:i}=e,a=te(tt),{data:o}=me(n),c=o?.conversation.activeSessionKey??null,l=x(W),u=x(et),d=x($e),p=x(Qe),m=we(U),h=De(Ze),v=De(Xe),ee=l?u:0,b;t[0]!==i||t[1]!==v?(b=e=>{e||(v(null),i())},t[0]=i,t[1]=v,t[2]=b):b=t[2];let se=a===`zh`?`关闭任务详情`:`Close task details`,S;t[3]!==i||t[4]!==v?(S=()=>{v(null),i()},t[3]=i,t[4]=v,t[5]=S):S=t[5];let C;t[6]!==se||t[7]!==S?(C=(0,R.jsx)(`button`,{type:`button`,tabIndex:-1,"data-task-modal-backdrop":!0,className:`fixed inset-0 z-[80] bg-black/45 backdrop-blur-[1px]`,"aria-label":se,onClick:S}),t[6]=se,t[7]=S,t[8]=C):C=t[8];let le=l?`true`:`false`,ue=`${ee/2}px`,de=`${ee}px`,fe;t[9]!==ue||t[10]!==de?(fe={"--task-detail-workspace-offset":ue,"--task-detail-workspace-width":de},t[9]=ue,t[10]=de,t[11]=fe):fe=t[11];let pe=fe,he=a===`zh`?`任务详情`:`Task details`,w;t[12]===he?w=t[13]:(w=(0,R.jsx)(ae,{className:`font-medium text-fg`,children:he}),t[12]=he,t[13]=w);let ge=a===`zh`?`查看并操作任务详情`:`View and manage task details`,T;t[14]===ge?T=t[15]:(T=(0,R.jsx)(y,{className:`sr-only`,children:ge}),t[14]=ge,t[15]=T);let E;t[16]!==c||t[17]!==a||t[18]!==p||t[19]!==m||t[20]!==n||t[21]!==l||t[22]!==d?(E=c?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`button`,{type:`button`,className:_(`flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,l&&d===c&&`bg-surface-hover text-fg`),"aria-label":a===`zh`?`项目文件`:`Project files`,title:a===`zh`?`项目文件`:`Project files`,"aria-pressed":l&&d===c,onClick:()=>{m(c,!1),p(c)},children:(0,R.jsx)(be,{className:`size-4`,"aria-hidden":!0})}),(0,R.jsx)(s,{to:ce(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,R.jsx)(f,{className:`size-4`,"aria-hidden":!0})})]}):null,t[16]=c,t[17]=a,t[18]=p,t[19]=m,t[20]=n,t[21]=l,t[22]=d,t[23]=E):E=t[23];let _e=a===`zh`?`关闭任务详情`:`Close task details`,ve;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(ve=(0,R.jsx)(g,{className:`size-4`,"aria-hidden":!0}),t[24]=ve):ve=t[24];let D;t[25]===_e?D=t[26]:(D=(0,R.jsx)(ne,{className:`flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":_e,children:ve}),t[25]=_e,t[26]=D);let O;t[27]!==E||t[28]!==D?(O=(0,R.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[E,D]}),t[27]=E,t[28]=D,t[29]=O):O=t[29];let k;t[30]!==w||t[31]!==T||t[32]!==O?(k=(0,R.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-3 bg-surface-panel px-5 py-3.5`,children:[w,T,O]}),t[30]=w,t[31]=T,t[32]=O,t[33]=k):k=t[33];let A;t[34]!==i||t[35]!==v?(A=()=>{v(null),i()},t[34]=i,t[35]=v,t[36]=A):A=t[36];let j;t[37]!==r||t[38]!==A||t[39]!==n?(j=(0,R.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,R.jsx)(Ke,{taskId:n,presentation:`modal`,backgroundPath:r,onDeleted:A})}),t[37]=r,t[38]=A,t[39]=n,t[40]=j):j=t[40];let M;t[41]!==k||t[42]!==j||t[43]!==le||t[44]!==pe?(M=(0,R.jsxs)(ie,{className:`task-detail-modal-content fixed top-1/2 z-[90] flex h-[min(54rem,calc(100dvh-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl bg-surface-base shadow-float focus:outline-none`,"data-workspace-panel-open":le,style:pe,onEscapeKeyDown:Ye,onInteractOutside:Je,children:[k,j]}),t[41]=k,t[42]=j,t[43]=le,t[44]=pe,t[45]=M):M=t[45];let N;t[46]!==h||t[47]!==l||t[48]!==u||t[49]!==d?(N=h?(0,R.jsx)(`div`,{className:`fixed inset-y-0 left-0 z-[100] flex min-h-0 min-w-0 overflow-hidden bg-surface-panel transition-[right] duration-200 ease-out motion-reduce:transition-none`,style:{right:l?u:0},children:(0,R.jsx)(ye,{allowOutsideChat:!0,sessionKey:d??void 0})}):null,t[46]=h,t[47]=l,t[48]=u,t[49]=d,t[50]=N):N=t[50];let P;t[51]!==M||t[52]!==N||t[53]!==C?(P=(0,R.jsxs)(re,{children:[C,M,N]}),t[51]=M,t[52]=N,t[53]=C,t[54]=P):P=t[54];let xe;return t[55]!==b||t[56]!==P?(xe=(0,R.jsx)(oe,{modal:!1,open:!0,onOpenChange:b,children:P}),t[55]=b,t[56]=P,t[57]=xe):xe=t[57],xe}function Je(e){let t=e.detail.originalEvent.target;t instanceof Element&&t.closest(`#app-workspace-panel, [data-task-modal-backdrop]`)&&e.preventDefault()}function Ye(e){let t=e.target;t instanceof HTMLElement&&t.closest(`[data-task-inline-editor]`)&&e.preventDefault()}function Xe(e){return e.setPath}function Ze(e){return e.path}function U(e){return e.setOpen}function Qe(e){return e.openForSession}function $e(e){return e.sessionKeyOverride}function et(e){return e.widthPx}function W(e){return e.open}function tt(e){return e.language}function nt(e){return(0,R.jsx)(l,{value:e.id,children:e.name||e.id},e.id)}function G(e){return e.id}export{H as TaskDetailModal,qe as TaskDetailPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{p as i,t as a}from"./chunk-KS7C4IRE-BaASWQor.js";import{t as o}from"./check-DUBLcKHA.js";import{n as s,r as c}from"./popover-select-BzdnTy3h.js";import{t as l}from"./circle-check-C23XjkUj.js";import{t as u}from"./external-link-DjqjBmc3.js";import{t as d}from"./eye-off-DEAzt3g1.js";import{t as f}from"./eye-CABVeTq0.js";import{t as p}from"./loader-circle-CifKLtgG.js";import{t as m}from"./plus-Q2yW6OE7.js";import{t as h}from"./x-B_N4OPjy.js";import{t as g}from"./button-CSEbl4zT.js";import{n as _}from"./locale-store-iKjqemWG.js";import{a as v,i as y,n as b,o as x,r as S,s as C,t as w}from"./dist-BPoKqzeH.js";import{i as T}from"./vendor-swr-BIWyz7Rc.js";import{As as E,Co as D,Dl as O,Do as k,Dt as A,Eo as j,Fs as M,Gl as N,Ml as P,Nl as F,Ol as I,Oo as L,Ot as R,Rs as z,So as B,To as V,Wc as H,Ya as U,_o as W,bo as G,bs as K,cc as ee,fo as q,gc as te,go as ne,gs as re,ho as ie,ko as ae,lc as J,ls as oe,mo as se,ol as ce,po as le,tc as Y,uo as X,us as ue,vo as de,wo as fe,wt as pe,xo as me,yl as he,yo as ge,zc as _e}from"./index-EvA8c7fo.js";import{n as ve,t as ye}from"./use-autosave-DcktF1j1.js";import{t as be}from"./tab-completion-input-D64VNmiA.js";import{t as xe}from"./page-tabs-BaEQMYm_.js";var Z=e(t(),1),Q=n(),Se=new Set([`candidate`,`needs_review`,`stale`]),Ce=new Set([`archived`,`rejected`]),we=new Set([`preference`,`boundary`,`relationship`,`routine`,`current_state`,`long_term_goal`]),Te=new Set([`and`,`are`,`for`,`from`,`into`,`that`,`the`,`this`,`with`,`you`,`your`]);function Ee(e,t){return t.updatedAt-e.updatedAt}function De(e,t){return{currentFocuses:e.filter(e=>e.status===`active`).sort(Ee),activeUnderstandings:t.filter(e=>e.status===`active`).sort(Ee),reviewQueue:[...e.filter(e=>e.status===`candidate`).map(e=>({type:`focus`,id:e.id,updatedAt:e.updatedAt,focus:e})),...t.filter(e=>Se.has(e.status)).map(e=>({type:`understanding`,id:e.id,updatedAt:e.updatedAt,understanding:e}))].sort(Ee),history:[...e.filter(e=>e.status===`paused`||e.status===`completed`||e.status===`rejected`).map(e=>({type:`focus`,id:e.id,updatedAt:e.updatedAt,focus:e})),...t.filter(e=>Ce.has(e.status)).map(e=>({type:`understanding`,id:e.id,updatedAt:e.updatedAt,understanding:e}))].sort(Ee),timeline:[...e.map(e=>({type:`focus`,id:e.id,updatedAt:e.updatedAt,focus:e})),...t.map(e=>({type:`understanding`,id:e.id,updatedAt:e.updatedAt,understanding:e}))].sort(Ee)}}function Oe(e){let t=new Set,n=e.toLocaleLowerCase().match(/[\p{Script=Han}]+|[\p{L}\p{N}]+/gu)??[];for(let e of n){if(/^\p{Script=Han}+$/u.test(e)){e.length===1&&t.add(e);for(let n=0;n<e.length-1;n+=1)t.add(e.slice(n,n+2));continue}e.length>=3&&!Te.has(e)&&t.add(e)}return t}function ke(e,t){let n=Oe(e),r=Oe(t);if(!n.size||!r.size)return 0;let i=0;for(let e of n)r.has(e)&&(i+=1);return i/Math.min(n.size,r.size)}function Ae(e,t,n=6){let r=`${e.title} ${e.summary}`;return t.filter(e=>[`active`,`candidate`,`needs_review`,`stale`].includes(e.status)).map(t=>{let n=[],i=0;e.scope.type===`project`&&t.scope.type===`project`&&t.scope.id===e.scope.id&&(n.push(`project_scope`),i+=.75);let a=ke(r,t.statement);return a>=.12&&(n.push(`topic_overlap`),i+=Math.min(.65,.18+a*.55)),t.status===`active`&&t.scope.type===`global`&&we.has(t.kind)&&(n.push(`global_context`),i+=.16),n.length?{understanding:t,reasons:n,score:Math.min(1,i)}:null}).filter(e=>e!==null).sort((e,t)=>t.score-e.score||t.understanding.updatedAt-e.understanding.updatedAt).slice(0,Math.max(0,n))}var je={preference:{en:`Preference`,zh:`偏好`},boundary:{en:`Boundary`,zh:`边界`},relationship:{en:`Relationship`,zh:`关系`},routine:{en:`Routine`,zh:`习惯`},current_state:{en:`Current state`,zh:`当前状态`},long_term_goal:{en:`Long-term goal`,zh:`长期目标`},project_context:{en:`Project context`,zh:`项目背景`},task_lesson:{en:`Task lesson`,zh:`任务经验`},derived_insight:{en:`Insight`,zh:`洞察`}},$=r(),Me=[{x:15,y:17},{x:14,y:51},{x:19,y:83},{x:85,y:17},{x:86,y:51},{x:81,y:83}],Ne={en:{focus:`Focus`,selectFocus:`Focus in view`,you:`You`,active:`Active`,pending:`Needs review`,hint:`A local map around one focus — enough context to explain xopc’s help, without turning your portrait into a database.`,confirmed:`Confirmed`,possible:`Possible`,weak:`Show weak signals`,hideWeak:`Hide weak signals`,noFocus:`Confirm a focus first, then xopc can show the context that affects it.`,noRelations:`No relationship is strong enough to show yet.`,why:`Why this relationship is shown`,project_scope:`Both belong to the same project.`,topic_overlap:`They share a meaningful topic signal.`,global_context:`This confirmed context may shape work across projects.`,projectEdge:`same project`,topicEdge:`shared topic`,contextEdge:`shapes work`,edit:`Edit`,pause:`Pause`,complete:`Complete`,incorrect:`Not true`,archive:`Move to history`,save:`Save`,cancel:`Cancel`,review:`Review this suggestion`,explicit:`You said this directly`,observed:`Observed across work`,inferred:`Inferred — may be wrong`,relatedCount:`relationships`},zh:{focus:`当前关注`,selectFocus:`图中关注`,you:`你`,active:`进行中`,pending:`待确认`,hint:`只围绕一个当前重点展开局部关系:足以解释 xopc 为什么这样帮助你,又不会把画像变成数据库。`,confirmed:`已确认`,possible:`可能关联`,weak:`显示弱信号`,hideWeak:`隐藏弱信号`,noFocus:`先确认一项关注,xopc 才能展示会影响它的上下文。`,noRelations:`目前还没有足够明确的关系。`,why:`为什么展示这条关系`,project_scope:`它们属于同一个项目。`,topic_overlap:`它们共享了有意义的主题信号。`,global_context:`这条已确认的上下文可能影响不同项目中的工作。`,projectEdge:`同一项目`,topicEdge:`主题相关`,contextEdge:`影响工作方式`,edit:`编辑`,pause:`暂停`,complete:`完成`,incorrect:`不正确`,archive:`移入历史`,save:`保存`,cancel:`取消`,review:`去确认这条建议`,explicit:`由你直接告知`,observed:`从过往工作中观察到`,inferred:`推断内容,可能有误`,relatedCount:`条关系`}},Pe=`w-full rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none focus:border-accent/60 focus:ring-2 focus:ring-accent/20`;function Fe(e){let t=(0,Q.c)(128),{focuses:n,understandings:r,language:i,onRefresh:a,onOpenReview:o}=e,c=Ne[i],[l,u]=(0,Z.useState)(n[0]?.id??``),p;t[0]!==l||t[1]!==n?(p=n.find(e=>e.id===l)??n[0],t[0]=l,t[1]=n,t[2]=p):p=t[2];let m=p,h;t[3]!==m||t[4]!==r?(h=m?Ae(m,r):[],t[3]=m,t[4]=r,t[5]=h):h=t[5];let g=h,[_,v]=(0,Z.useState)(!1),y;t[6]!==g||t[7]!==_?(y=_?g:g.filter(ze),t[6]=g,t[7]=_,t[8]=y):y=t[8];let b=y,[x,S]=(0,Z.useState)(null),C;t[9]!==b||t[10]!==x?(C=b.find(e=>e.understanding.id===x)??null,t[9]=b,t[10]=x,t[11]=C):C=t[11];let w=C,T,E;t[12]!==m||t[13]!==l?(T=()=>{!m||m.id===l||u(m.id)},E=[m,l],t[12]=m,t[13]=l,t[14]=T,t[15]=E):(T=t[14],E=t[15]),(0,Z.useEffect)(T,E);let D,O;if(t[16]!==b||t[17]!==x?(D=()=>{x&&!b.some(e=>e.understanding.id===x)&&S(null)},O=[b,x],t[16]=b,t[17]=x,t[18]=D,t[19]=O):(D=t[18],O=t[19]),(0,Z.useEffect)(D,O),!m){let e;return t[20]===c.noFocus?e=t[21]:(e=(0,$.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge px-5 py-16 text-center text-sm text-fg-muted`,children:c.noFocus}),t[20]=c.noFocus,t[21]=e),e}let k;t[22]===c.hint?k=t[23]:(k=(0,$.jsx)(`p`,{className:`max-w-2xl text-xs leading-5 text-fg-muted`,children:c.hint}),t[22]=c.hint,t[23]=k);let A;t[24]!==m.id||t[25]!==n||t[26]!==c.selectFocus?(A=n.length>1?(0,$.jsxs)(`label`,{className:`flex shrink-0 items-center gap-2 text-xs text-fg-muted`,children:[(0,$.jsx)(`span`,{children:c.selectFocus}),(0,$.jsx)(s,{value:m.id,onChange:e=>{u(e.target.value),S(null)},triggerClassName:`min-w-44 bg-surface-base`,children:n.map(Re)})]}):null,t[24]=m.id,t[25]=n,t[26]=c.selectFocus,t[27]=A):A=t[27];let j;t[28]!==A||t[29]!==k?(j=(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[k,A]}),t[28]=A,t[29]=k,t[30]=j):j=t[30];let M;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,$.jsx)(`span`,{className:`h-px w-5 bg-edge-strong`}),t[31]=M):M=t[31];let N;t[32]===c.confirmed?N=t[33]:(N=(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[M,c.confirmed]}),t[32]=c.confirmed,t[33]=N);let P;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,$.jsx)(`span`,{className:`w-5 border-t border-dashed border-warning`}),t[34]=P):P=t[34];let F;t[35]===c.possible?F=t[36]:(F=(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[P,c.possible]}),t[35]=c.possible,t[36]=F);let I;t[37]!==g||t[38]!==_||t[39]!==c.hideWeak||t[40]!==c.weak?(I=g.some(Le)?(0,$.jsxs)(`button`,{type:`button`,className:`ml-auto inline-flex items-center gap-1.5 rounded-md text-fg-muted hover:text-accent`,onClick:()=>v(Ie),children:[_?(0,$.jsx)(d,{className:`size-3.5`}):(0,$.jsx)(f,{className:`size-3.5`}),_?c.hideWeak:c.weak]}):null,t[37]=g,t[38]=_,t[39]=c.hideWeak,t[40]=c.weak,t[41]=I):I=t[41];let L;t[42]!==N||t[43]!==F||t[44]!==I?(L=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2 text-[11px] text-fg-subtle`,children:[N,F,I]}),t[42]=N,t[43]=F,t[44]=I,t[45]=L):L=t[45];let R;t[46]!==j||t[47]!==L?(R=(0,$.jsxs)(`header`,{className:`flex flex-col gap-3 border-b border-edge px-4 py-3`,children:[j,L]}),t[46]=j,t[47]=L,t[48]=R):R=t[48];let z;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,$.jsx)(`div`,{className:`absolute inset-0 opacity-50 [background-image:radial-gradient(var(--color-edge)_0.7px,transparent_0.7px)] [background-size:20px_20px]`,"aria-hidden":`true`}),t[49]=z):z=t[49];let B;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,$.jsx)(`line`,{x1:`50`,y1:`13`,x2:`50`,y2:`50`,className:`stroke-edge-strong`,strokeWidth:`0.35`,vectorEffect:`non-scaling-stroke`}),t[50]=B):B=t[50];let V;if(t[51]!==b||t[52]!==x){let e;t[54]===x?e=t[55]:(e=(e,t)=>(0,$.jsx)(`line`,{x1:`50`,y1:`50`,x2:Me[t]?.x??50,y2:Me[t]?.y??50,className:e.understanding.status===`active`?`stroke-edge-strong`:`stroke-warning`,strokeWidth:x===e.understanding.id?`0.55`:`0.3`,strokeDasharray:e.understanding.status===`active`?void 0:`1.4 1.4`,vectorEffect:`non-scaling-stroke`},e.understanding.id),t[54]=x,t[55]=e),V=b.map(e),t[51]=b,t[52]=x,t[53]=V}else V=t[53];let H;t[56]===V?H=t[57]:(H=(0,$.jsxs)(`svg`,{className:`pointer-events-none absolute inset-0 size-full`,viewBox:`0 0 100 100`,preserveAspectRatio:`none`,"aria-hidden":`true`,children:[B,V]}),t[56]=V,t[57]=H);let U;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,$.jsx)(oe,{className:`size-5`}),t[58]=U):U=t[58];let W;t[59]===c.you?W=t[60]:(W=(0,$.jsxs)(`div`,{className:`absolute left-1/2 top-[13%] z-10 flex size-12 -translate-x-1/2 -translate-y-1/2 items-center justify-center rounded-full bg-accent text-white shadow-surface`,children:[U,(0,$.jsx)(`span`,{className:`sr-only`,children:c.you})]}),t[59]=c.you,t[60]=W);let G;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(G=()=>S(null),t[61]=G):G=t[61];let ee=`absolute left-1/2 top-1/2 z-10 flex w-44 -translate-x-1/2 -translate-y-1/2 items-center gap-2 rounded-xl border px-3 py-3 text-left text-sm font-medium shadow-surface transition-colors ${w?`border-edge bg-surface-panel hover:bg-surface-hover`:`border-accent bg-accent-soft text-accent-fg ring-2 ring-accent/15`}`,q;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,$.jsx)(K,{className:`size-4 shrink-0`}),t[62]=q):q=t[62];let te;t[63]===m.title?te=t[64]:(te=(0,$.jsx)(`span`,{className:`line-clamp-2`,children:m.title}),t[63]=m.title,t[64]=te);let ne;t[65]!==ee||t[66]!==te?(ne=(0,$.jsxs)(`button`,{type:`button`,onClick:G,className:ee,children:[q,te]}),t[65]=ee,t[66]=te,t[67]=ne):ne=t[67];let re;if(t[68]!==b||t[69]!==c){let e;t[71]===c?e=t[72]:(e=(e,t)=>{let n=Me[t]??Me[0];return(0,$.jsx)(`span`,{style:{left:`${(50+n.x)/2}%`,top:`${(50+n.y)/2}%`},className:`pointer-events-none absolute z-[5] -translate-x-1/2 -translate-y-1/2 rounded bg-surface-base/90 px-1.5 py-0.5 text-[9px] text-fg-subtle`,children:Be(e,c)},`edge:${e.understanding.id}`)},t[71]=c,t[72]=e),re=b.map(e),t[68]=b,t[69]=c,t[70]=re}else re=t[70];let ie;if(t[73]!==i||t[74]!==b||t[75]!==x){let e;t[77]!==i||t[78]!==x?(e=(e,t)=>(0,$.jsx)(Ve,{relation:e,position:Me[t]??Me[0],language:i,selected:x===e.understanding.id,onSelect:()=>S(e.understanding.id)},e.understanding.id),t[77]=i,t[78]=x,t[79]=e):e=t[79],ie=b.map(e),t[73]=i,t[74]=b,t[75]=x,t[76]=ie}else ie=t[76];let ae;t[80]!==b.length||t[81]!==c.noRelations?(ae=b.length?null:(0,$.jsx)(`p`,{className:`absolute inset-x-0 bottom-8 text-center text-xs text-fg-muted`,children:c.noRelations}),t[80]=b.length,t[81]=c.noRelations,t[82]=ae):ae=t[82];let J;t[83]!==H||t[84]!==W||t[85]!==ne||t[86]!==re||t[87]!==ie||t[88]!==ae?(J=(0,$.jsxs)(`div`,{className:`relative hidden h-[30rem] overflow-hidden rounded-xl border border-edge bg-surface-base sm:block`,children:[z,H,W,ne,re,ie,ae]}),t[83]=H,t[84]=W,t[85]=ne,t[86]=re,t[87]=ie,t[88]=ae,t[89]=J):J=t[89];let se;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(se=()=>S(null),t[90]=se):se=t[90];let ce=`rounded-xl border p-3 text-left ${w?`border-edge bg-surface-panel`:`border-accent bg-accent-soft`}`,le;t[91]===c.focus?le=t[92]:(le=(0,$.jsx)(`span`,{className:`text-xs text-fg-muted`,children:c.focus}),t[91]=c.focus,t[92]=le);let Y;t[93]===m.title?Y=t[94]:(Y=(0,$.jsx)(`p`,{className:`mt-1 text-sm font-medium text-fg`,children:m.title}),t[93]=m.title,t[94]=Y);let X;t[95]!==ce||t[96]!==le||t[97]!==Y?(X=(0,$.jsxs)(`button`,{type:`button`,onClick:se,className:ce,children:[le,Y]}),t[95]=ce,t[96]=le,t[97]=Y,t[98]=X):X=t[98];let ue;if(t[99]!==i||t[100]!==b||t[101]!==x||t[102]!==c){let e;t[104]!==i||t[105]!==x||t[106]!==c?(e=e=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>S(e.understanding.id),className:`rounded-xl border p-3 text-left ${x===e.understanding.id?`border-accent bg-accent-soft`:e.understanding.status===`active`?`border-edge bg-surface-panel`:`border-dashed border-warning/40 bg-warning-soft`}`,children:[(0,$.jsxs)(`span`,{className:`flex items-center justify-between gap-2 text-[11px] text-fg-subtle`,children:[(0,$.jsx)(`span`,{children:je[e.understanding.kind][i]}),(0,$.jsx)(`span`,{children:Be(e,c)})]}),(0,$.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm text-fg`,children:e.understanding.statement})]},e.understanding.id),t[104]=i,t[105]=x,t[106]=c,t[107]=e):e=t[107],ue=b.map(e),t[99]=i,t[100]=b,t[101]=x,t[102]=c,t[103]=ue}else ue=t[103];let de;t[108]!==X||t[109]!==ue?(de=(0,$.jsxs)(`div`,{className:`grid gap-2 sm:hidden`,children:[X,ue]}),t[108]=X,t[109]=ue,t[110]=de):de=t[110];let fe;t[111]!==J||t[112]!==de?(fe=(0,$.jsxs)(`div`,{className:`min-w-0 bg-surface-base/45 p-3 sm:p-4`,children:[J,de]}),t[111]=J,t[112]=de,t[113]=fe):fe=t[113];let pe;t[114]!==m||t[115]!==i||t[116]!==o||t[117]!==a||t[118]!==b.length||t[119]!==w||t[120]!==c?(pe=(0,$.jsx)(He,{focus:m,relation:w,relationCount:b.length,language:i,t:c,onRefresh:a,onOpenReview:o}),t[114]=m,t[115]=i,t[116]=o,t[117]=a,t[118]=b.length,t[119]=w,t[120]=c,t[121]=pe):pe=t[121];let me;t[122]!==fe||t[123]!==pe?(me=(0,$.jsxs)(`div`,{className:`grid lg:grid-cols-[minmax(0,1fr)_19rem]`,children:[fe,pe]}),t[122]=fe,t[123]=pe,t[124]=me):me=t[124];let he;return t[125]!==R||t[126]!==me?(he=(0,$.jsxs)(`section`,{className:`overflow-hidden rounded-2xl border border-edge bg-surface-panel`,children:[R,me]}),t[125]=R,t[126]=me,t[127]=he):he=t[127],he}function Ie(e){return!e}function Le(e){return e.score<.25}function Re(e){return(0,$.jsx)(c,{value:e.id,children:e.title},e.id)}function ze(e){return e.score>=.25}function Be(e,t){return e.reasons.includes(`project_scope`)?t.projectEdge:e.reasons.includes(`topic_overlap`)?t.topicEdge:t.contextEdge}function Ve(e){let t=(0,Q.c)(18),{relation:n,position:r,language:i,selected:a,onSelect:o}=e,s=n.understanding.status!==`active`,c=`${r.x}%`,l=`${r.y}%`,u;t[0]!==c||t[1]!==l?(u={left:c,top:l},t[0]=c,t[1]=l,t[2]=u):u=t[2];let d=`absolute z-10 flex max-w-40 -translate-x-1/2 -translate-y-1/2 items-start gap-2 rounded-xl border px-3 py-2.5 text-left text-xs leading-5 shadow-surface transition-colors ${a?`border-accent bg-accent-soft ring-2 ring-accent/15`:s?`border-dashed border-warning/60 bg-warning-soft hover:border-warning`:`border-edge bg-surface-panel hover:bg-surface-hover`}`,f=`mt-1.5 size-1.5 shrink-0 rounded-full ${s?`bg-warning`:`bg-success`}`,p;t[3]===f?p=t[4]:(p=(0,$.jsx)(`span`,{className:f}),t[3]=f,t[4]=p);let m=je[n.understanding.kind][i],h;t[5]===m?h=t[6]:(h=(0,$.jsx)(`span`,{className:`block text-[10px] text-fg-subtle`,children:m}),t[5]=m,t[6]=h);let g;t[7]===n.understanding.statement?g=t[8]:(g=(0,$.jsx)(`span`,{className:`line-clamp-2 text-fg`,children:n.understanding.statement}),t[7]=n.understanding.statement,t[8]=g);let _;t[9]!==h||t[10]!==g?(_=(0,$.jsxs)(`span`,{className:`min-w-0`,children:[h,g]}),t[9]=h,t[10]=g,t[11]=_):_=t[11];let v;return t[12]!==o||t[13]!==_||t[14]!==u||t[15]!==d||t[16]!==p?(v=(0,$.jsxs)(`button`,{type:`button`,onClick:o,style:u,className:d,children:[p,_]}),t[12]=o,t[13]=_,t[14]=u,t[15]=d,t[16]=p,t[17]=v):v=t[17],v}function He({focus:e,relation:t,relationCount:n,language:r,t:i,onRefresh:a,onOpenReview:o}){let[s,c]=(0,Z.useState)(!1),[u,d]=(0,Z.useState)(e.title),[f,p]=(0,Z.useState)(t?.understanding.statement??e.summary),[m,h]=(0,Z.useState)(!1),_=t?.understanding;(0,Z.useEffect)(()=>{c(!1),d(e.title),p(_?.statement??e.summary)},[e.id,e.summary,e.title,_?.id,_?.statement]);let v=async e=>{h(!0);try{await e(),await a()}finally{h(!1)}},y=async t=>{t.preventDefault(),!(!f.trim()||!_&&!u.trim())&&(await v(()=>_?j(_.id,{statement:f}):L(e.id,{title:u,summary:f})),c(!1))},b=_?_.explicitness===`explicit`?i.explicit:_.explicitness===`observed`?i.observed:i.inferred:`${n} ${i.relatedCount}`,x=_?.status===`active`||!_?i.active:i.pending;return(0,$.jsxs)(`aside`,{className:`border-t border-edge bg-surface-panel p-5 lg:border-l lg:border-t-0`,children:[(0,$.jsx)(`p`,{className:`text-[11px] font-medium text-accent`,children:_?je[_.kind][r]:i.focus}),s?(0,$.jsxs)(`form`,{className:`mt-3 space-y-3`,onSubmit:y,children:[_?null:(0,$.jsx)(`input`,{className:Pe,value:u,onChange:e=>d(e.target.value)}),(0,$.jsx)(`textarea`,{autoFocus:!0,className:Pe,rows:5,value:f,onChange:e=>p(e.target.value)}),(0,$.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,$.jsx)(g,{type:`button`,disabled:m,onClick:()=>c(!1),children:i.cancel}),(0,$.jsx)(g,{type:`submit`,variant:`primary`,disabled:m||!f.trim()||!_&&!u.trim(),children:i.save})]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`h2`,{className:`mt-2 text-base font-semibold leading-6 text-fg`,children:_?.statement??e.title}),_?null:(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:e.summary}),(0,$.jsxs)(`div`,{className:`mt-3 flex items-center gap-2 text-xs text-fg-muted`,children:[(0,$.jsx)(`span`,{className:`size-1.5 rounded-full ${_?.status===`active`||!_?`bg-success`:`bg-warning`}`}),x,(0,$.jsx)(`span`,{children:`·`}),(0,$.jsx)(`span`,{children:b})]}),t?(0,$.jsxs)(`div`,{className:`mt-6`,children:[(0,$.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:i.why}),(0,$.jsx)(`div`,{className:`mt-2 grid gap-2`,children:t.reasons.map(e=>(0,$.jsx)(`p`,{className:`rounded-xl bg-surface-muted px-3 py-2 text-xs leading-5 text-fg-muted`,children:i[e]},e))})]}):null,(0,$.jsxs)(`div`,{className:`mt-6 flex flex-wrap gap-2`,children:[_?_.status===`active`?(0,$.jsxs)(g,{disabled:m,onClick:()=>c(!0),children:[(0,$.jsx)(Y,{className:`size-3.5`}),i.edit]}):(0,$.jsx)(g,{variant:`primary`,onClick:o,children:i.review}):(0,$.jsxs)(g,{disabled:m,onClick:()=>c(!0),children:[(0,$.jsx)(Y,{className:`size-3.5`}),i.edit]}),_?_.status===`active`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(g,{variant:`ghost`,disabled:m,onClick:()=>void v(()=>j(_.id,{status:`archived`})),children:i.archive}),(0,$.jsx)(g,{variant:`ghost`,className:`text-danger`,disabled:m,onClick:()=>void v(()=>j(_.id,{status:`rejected`})),children:i.incorrect})]}):null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(g,{disabled:m,onClick:()=>void v(()=>L(e.id,{status:`paused`})),children:i.pause}),(0,$.jsxs)(g,{variant:`ghost`,disabled:m,onClick:()=>void v(()=>L(e.id,{status:`completed`})),children:[(0,$.jsx)(l,{className:`size-3.5`}),i.complete]})]})]})]})]})}var Ue={en:{eyebrow:`YOU, NOW`,intro:`A living, correctable portrait of what matters now and what remains true over time.`,add:`Add understanding`,portrait:`Now`,map:`Relationships`,changes:`Recent changes`,review:`Review`,portraitHint:`This is the context xopc will use when helping you now.`,importantNow:`Important now`,lastingPortrait:`What continues to shape the portrait`,lastingHint:`Confirmed context that can travel across conversations.`,noFocus:`No active focus yet. Tell xopc what matters now, or confirm a suggested focus.`,noUnderstanding:`No confirmed understanding yet. Add one directly or review a suggestion.`,selectedDetail:`Selected understanding`,focusDetail:`Selected focus`,scope:`Scope`,source:`Origin`,global:`Across xopc`,workspace:`Workspace`,project:`Project`,session:`Conversation`,active:`Active`,horizonCurrent:`Right now`,horizonOngoing:`Ongoing`,horizonLongTerm:`Long term`,moreFocuses:`more active focuses`,explicit:`Told by you`,observed:`Observed over time`,inferred:`Inferred — may be wrong`,validSince:`Valid since`,validUntil:`Valid until`,updated:`Updated`,reviewDue:`Review due`,edit:`Edit`,save:`Save`,cancel:`Cancel`,pause:`Pause`,complete:`Complete`,archive:`Archive`,incorrect:`Not true`,evidence:`View evidence`,evidenceTitle:`Why xopc holds this`,evidenceLoading:`Loading evidence…`,evidenceEmpty:`No displayable evidence is linked.`,evidenceError:`Evidence could not be loaded.`,changesIntro:`A timeline of when the portrait formed, changed, or stopped applying. It shows state changes without inventing a diff.`,timelineEmpty:`There are no changes yet.`,formed:`Formed`,changed:`Updated`,proposed:`Proposed`,needsReview:`Needs review`,paused:`Paused`,completed:`Completed`,rejected:`Marked incorrect`,archived:`Archived`,reviewTitle:`One decision at a time`,reviewHint:`Suggestions do not affect xopc until you confirm them.`,later:`Later`,yes:`Yes`,change:`Needs changes`,wrong:`Not true`,saveConfirm:`Save and confirm`,confidence:`confidence`,focusCandidate:`Suggested focus`,understandingCandidate:`Suggested understanding`,high:`high`,medium:`medium`,low:`low`,noReview:`Nothing needs your review.`,statement:`What should xopc understand?`,type:`Type`,create:`Add`},zh:{eyebrow:`此刻的你`,intro:`一份会随时间生长、可以随时纠正的画像:既看此刻重要的事,也保留长期成立的理解。`,add:`添加理解`,portrait:`此刻`,map:`关系`,changes:`最近变化`,review:`待确认`,portraitHint:`这是 xopc 此刻帮助你时会使用的上下文。`,importantNow:`此刻重要`,lastingPortrait:`持续构成画像的理解`,lastingHint:`已经确认、可以跨对话使用的上下文。`,noFocus:`还没有进行中的关注。你可以告诉 xopc 此刻什么最重要,或确认一条候选关注。`,noUnderstanding:`还没有已确认的理解。你可以直接添加,或确认一条建议。`,selectedDetail:`选中的理解`,focusDetail:`选中的关注`,scope:`适用范围`,source:`形成方式`,global:`全局适用`,workspace:`工作区`,project:`项目`,session:`当前对话`,active:`生效中`,horizonCurrent:`当下`,horizonOngoing:`持续推进`,horizonLongTerm:`长期方向`,moreFocuses:`项进行中的关注`,explicit:`由你直接告知`,observed:`从长期共事中观察到`,inferred:`推断内容,可能有误`,validSince:`开始成立`,validUntil:`有效至`,updated:`最近更新`,reviewDue:`建议复核`,edit:`编辑`,save:`保存`,cancel:`取消`,pause:`暂停`,complete:`完成`,archive:`归档`,incorrect:`不正确`,evidence:`查看依据`,evidenceTitle:`xopc 为什么这样理解`,evidenceLoading:`正在读取依据…`,evidenceEmpty:`暂时没有可展示的依据。`,evidenceError:`暂时无法读取依据。`,changesIntro:`按时间呈现画像何时形成、更新或不再适用;只表达状态变化,不虚构具体差异。`,timelineEmpty:`还没有画像变化。`,formed:`形成`,changed:`更新`,proposed:`提出建议`,needsReview:`需要复核`,paused:`已暂停`,completed:`已完成`,rejected:`标记为不正确`,archived:`已归档`,reviewTitle:`一次只确认一条`,reviewHint:`建议内容在你确认前不会影响 xopc 的行动。`,later:`稍后`,yes:`是的`,change:`需要修改`,wrong:`不是这样`,saveConfirm:`保存并确认`,confidence:`把握`,focusCandidate:`候选关注`,understandingCandidate:`候选理解`,high:`高`,medium:`中`,low:`低`,noReview:`目前没有需要你确认的内容。`,statement:`希望 xopc 了解什么?`,type:`类型`,create:`添加`}},We=`w-full rounded-xl border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent/60 focus:ring-2 focus:ring-accent/20`;function Ge(e){let t=(0,Q.c)(83),{focuses:n,understandings:r,language:i,onRefresh:a}=e,o=Ue[i],s;t[0]!==n||t[1]!==r?(s=De(n,r),t[0]=n,t[1]=r,t[2]=s):s=t[2];let c=s,[l,u]=(0,Z.useState)(`portrait`),[d,f]=(0,Z.useState)(!1),p;t[3]===o.eyebrow?p=t[4]:(p=(0,$.jsx)(`p`,{className:`text-[11px] font-semibold uppercase tracking-[0.18em] text-accent`,children:o.eyebrow}),t[3]=o.eyebrow,t[4]=p);let h;t[5]===o.intro?h=t[6]:(h=(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:o.intro}),t[5]=o.intro,t[6]=h);let _;t[7]!==p||t[8]!==h?(_=(0,$.jsxs)(`div`,{className:`max-w-2xl`,children:[p,h]}),t[7]=p,t[8]=h,t[9]=_):_=t[9];let v,y;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(v=()=>f(!0),y=(0,$.jsx)(m,{className:`size-4`}),t[10]=v,t[11]=y):(v=t[10],y=t[11]);let b;t[12]===o.add?b=t[13]:(b=(0,$.jsxs)(g,{variant:`primary`,className:`shrink-0`,onClick:v,children:[y,o.add]}),t[12]=o.add,t[13]=b);let x;t[14]!==_||t[15]!==b?(x=(0,$.jsxs)(`header`,{className:`flex flex-col gap-5 sm:flex-row sm:items-end sm:justify-between`,children:[_,b]}),t[14]=_,t[15]=b,t[16]=x):x=t[16];let S=i===`zh`?`共同理解视图`:`Shared understanding views`,C=l===`portrait`,w,T;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(w=()=>u(`portrait`),T=(0,$.jsx)(K,{className:`size-3.5`}),t[17]=w,t[18]=T):(w=t[17],T=t[18]);let D;t[19]!==c.currentFocuses.length||t[20]!==o.portrait||t[21]!==C?(D=(0,$.jsx)(Ke,{selected:C,onClick:w,icon:T,label:o.portrait,count:c.currentFocuses.length}),t[19]=c.currentFocuses.length,t[20]=o.portrait,t[21]=C,t[22]=D):D=t[22];let O=l===`map`,k,A;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(k=()=>u(`map`),A=(0,$.jsx)(ee,{className:`size-3.5`}),t[23]=k,t[24]=A):(k=t[23],A=t[24]);let j;t[25]!==o.map||t[26]!==O?(j=(0,$.jsx)(Ke,{selected:O,onClick:k,icon:A,label:o.map}),t[25]=o.map,t[26]=O,t[27]=j):j=t[27];let M=l===`changes`,N,P;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(N=()=>u(`changes`),P=(0,$.jsx)(_e,{className:`size-3.5`}),t[28]=N,t[29]=P):(N=t[28],P=t[29]);let F;t[30]!==o.changes||t[31]!==M?(F=(0,$.jsx)(Ke,{selected:M,onClick:N,icon:P,label:o.changes}),t[30]=o.changes,t[31]=M,t[32]=F):F=t[32];let I=l===`review`,L,R;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(L=()=>u(`review`),R=(0,$.jsx)(E,{className:`size-3.5`}),t[33]=L,t[34]=R):(L=t[33],R=t[34]);let z=c.reviewQueue.length>0,B;t[35]!==c.reviewQueue.length||t[36]!==o.review||t[37]!==I||t[38]!==z?(B=(0,$.jsx)(Ke,{selected:I,onClick:L,icon:R,label:o.review,count:c.reviewQueue.length,emphasize:z}),t[35]=c.reviewQueue.length,t[36]=o.review,t[37]=I,t[38]=z,t[39]=B):B=t[39];let V;t[40]!==D||t[41]!==j||t[42]!==F||t[43]!==B||t[44]!==S?(V=(0,$.jsxs)(`div`,{className:`flex gap-1 overflow-x-auto border-b border-edge`,role:`tablist`,"aria-label":S,children:[D,j,F,B]}),t[40]=D,t[41]=j,t[42]=F,t[43]=B,t[44]=S,t[45]=V):V=t[45];let H;t[46]!==i||t[47]!==c.activeUnderstandings||t[48]!==c.currentFocuses||t[49]!==a||t[50]!==o||t[51]!==l?(H=l===`portrait`?(0,$.jsx)(qe,{focuses:c.currentFocuses,understandings:c.activeUnderstandings,language:i,t:o,onRefresh:a}):null,t[46]=i,t[47]=c.activeUnderstandings,t[48]=c.currentFocuses,t[49]=a,t[50]=o,t[51]=l,t[52]=H):H=t[52];let U;t[53]!==i||t[54]!==c.currentFocuses||t[55]!==a||t[56]!==r||t[57]!==l?(U=l===`map`?(0,$.jsx)(Fe,{focuses:c.currentFocuses,understandings:r,language:i,onRefresh:a,onOpenReview:()=>u(`review`)}):null,t[53]=i,t[54]=c.currentFocuses,t[55]=a,t[56]=r,t[57]=l,t[58]=U):U=t[58];let W;t[59]!==i||t[60]!==c.timeline||t[61]!==o||t[62]!==l?(W=l===`changes`?(0,$.jsx)($e,{items:c.timeline,language:i,t:o}):null,t[59]=i,t[60]=c.timeline,t[61]=o,t[62]=l,t[63]=W):W=t[63];let G;t[64]!==i||t[65]!==c.reviewQueue||t[66]!==a||t[67]!==o||t[68]!==l?(G=l===`review`?(0,$.jsx)(it,{items:c.reviewQueue,language:i,t:o,onRefresh:a}):null,t[64]=i,t[65]=c.reviewQueue,t[66]=a,t[67]=o,t[68]=l,t[69]=G):G=t[69];let q;t[70]!==d||t[71]!==i||t[72]!==a||t[73]!==o?(q=(0,$.jsx)(ot,{open:d,onOpenChange:f,language:i,t:o,onCreated:a}),t[70]=d,t[71]=i,t[72]=a,t[73]=o,t[74]=q):q=t[74];let te;return t[75]!==V||t[76]!==H||t[77]!==U||t[78]!==W||t[79]!==G||t[80]!==q||t[81]!==x?(te=(0,$.jsxs)(`div`,{className:`space-y-5`,children:[x,V,H,U,W,G,q]}),t[75]=V,t[76]=H,t[77]=U,t[78]=W,t[79]=G,t[80]=q,t[81]=x,t[82]=te):te=t[82],te}function Ke(e){let t=(0,Q.c)(12),{selected:n,onClick:r,icon:i,label:a,count:o,emphasize:s}=e,c=s===void 0?!1:s,l=`inline-flex min-h-10 shrink-0 items-center gap-1.5 border-b-2 px-3 text-sm transition-colors ${n?`border-accent text-fg`:`border-transparent text-fg-muted hover:text-fg`}`,u;t[0]===a?u=t[1]:(u=(0,$.jsx)(`span`,{children:a}),t[0]=a,t[1]=u);let d;t[2]!==o||t[3]!==c?(d=o===void 0?null:(0,$.jsx)(`span`,{className:`rounded-full px-1.5 py-0.5 text-[10px] ${c?`bg-accent-soft text-accent-fg`:`bg-surface-muted text-fg-subtle`}`,children:o}),t[2]=o,t[3]=c,t[4]=d):d=t[4];let f;return t[5]!==i||t[6]!==r||t[7]!==n||t[8]!==l||t[9]!==u||t[10]!==d?(f=(0,$.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":n,onClick:r,className:l,children:[i,u,d]}),t[5]=i,t[6]=r,t[7]=n,t[8]=l,t[9]=u,t[10]=d,t[11]=f):f=t[11],f}function qe(e){let t=(0,Q.c)(62),{focuses:n,understandings:r,language:i,t:a,onRefresh:o}=e,s;t[0]!==n[0]||t[1]!==r?(s=n[0]?{type:`focus`,item:n[0]}:r[0]?{type:`understanding`,item:r[0]}:null,t[0]=n[0],t[1]=r,t[2]=s):s=t[2];let c=s,[l,u]=(0,Z.useState)(c?`${c.type}:${c.item.id}`:``),d;t[3]!==n||t[4]!==c||t[5]!==l||t[6]!==r?(d=Je(l,n,r)??c,t[3]=n,t[4]=c,t[5]=l,t[6]=r,t[7]=d):d=t[7];let f=d,p=n[0],m=Ye(n),h=m.slice(0,5),g=Math.max(0,m.length-h.length),_,v;if(t[8]!==c||t[9]!==f?(_=()=>{f||!c||u(`${c.type}:${c.item.id}`)},v=[c,f],t[8]=c,t[9]=f,t[10]=_,t[11]=v):(_=t[10],v=t[11]),(0,Z.useEffect)(_,v),!p&&!r.length){let e;return t[12]===a.noFocus?e=t[13]:(e=(0,$.jsx)(st,{children:a.noFocus}),t[12]=a.noFocus,t[13]=e),e}let y;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,$.jsx)(`div`,{className:`absolute inset-x-0 top-0 h-px bg-gradient-to-r from-transparent via-accent/45 to-transparent`,"aria-hidden":`true`}),t[14]=y):y=t[14];let b;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(E,{className:`size-3.5`}),t[15]=b):b=t[15];let x;t[16]===a.portraitHint?x=t[17]:(x=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-semibold uppercase tracking-[0.16em] text-accent`,children:[b,a.portraitHint]}),t[16]=a.portraitHint,t[17]=x);let S;t[18]!==i||t[19]!==p||t[20]!==a?(S=p?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`button`,{type:`button`,className:`mt-7 block max-w-3xl text-left`,onClick:()=>u(`focus:${p.id}`),children:[(0,$.jsx)(`h2`,{className:`text-2xl font-semibold leading-tight tracking-tight text-fg sm:text-3xl`,children:p.title}),(0,$.jsx)(`p`,{className:`mt-3 max-w-2xl text-sm leading-7 text-fg-muted sm:text-base`,children:p.summary})]}),(0,$.jsxs)(`div`,{className:`mt-auto flex flex-wrap items-center gap-x-4 gap-y-2 pt-8 text-xs text-fg-subtle`,children:[(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-fg-muted`,children:[(0,$.jsx)(`span`,{className:`size-1.5 rounded-full bg-success`}),a.active]}),(0,$.jsx)(`span`,{children:nt(p.horizon,a)}),(0,$.jsx)(`span`,{children:tt(p.scope,a)}),(0,$.jsxs)(`span`,{children:[a.updated,` · `,rt(p.updatedAt,i)]})]})]}):(0,$.jsx)(`p`,{className:`mt-7 max-w-2xl text-base leading-7 text-fg-muted`,children:a.noFocus}),t[18]=i,t[19]=p,t[20]=a,t[21]=S):S=t[21];let C;t[22]!==x||t[23]!==S?(C=(0,$.jsxs)(`div`,{className:`flex min-h-[18rem] min-w-0 flex-col`,children:[x,S]}),t[22]=x,t[23]=S,t[24]=C):C=t[24];let w;t[25]===a.importantNow?w=t[26]:(w=(0,$.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.12em] text-fg-subtle`,children:a.importantNow}),t[25]=a.importantNow,t[26]=w);let T=n.length?(0,$.jsxs)(`div`,{className:`mt-4 space-y-1`,children:[h.map((e,t)=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>u(`focus:${e.id}`),className:`group flex w-full items-start gap-3 rounded-xl px-2.5 py-2.5 text-left transition-colors ${f?.type===`focus`&&f.item.id===e.id?`bg-accent-soft`:`hover:bg-surface-hover`}`,children:[(0,$.jsx)(`span`,{className:`mt-2 size-1.5 shrink-0 rounded-full ${t===0?`bg-accent`:`bg-success`}`}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`span`,{className:`line-clamp-2 text-sm leading-6 text-fg`,children:e.title}),(0,$.jsx)(`span`,{className:`mt-0.5 block text-[11px] text-fg-subtle`,children:rt(e.updatedAt,i)})]}),(0,$.jsx)(O,{className:`mt-1 size-3.5 shrink-0 text-fg-subtle opacity-0 transition-opacity group-hover:opacity-100`})]},e.id)),g?(0,$.jsxs)(`p`,{className:`border-t border-edge px-2.5 pt-3 text-[11px] text-fg-subtle`,children:[`+`,g,` `,a.moreFocuses]}):null]}):(0,$.jsx)(`p`,{className:`mt-4 text-sm leading-6 text-fg-muted`,children:a.noFocus}),D;t[27]!==w||t[28]!==T?(D=(0,$.jsxs)(`div`,{className:`self-start rounded-2xl border border-edge bg-surface-base/70 p-5`,children:[w,T]}),t[27]=w,t[28]=T,t[29]=D):D=t[29];let k;t[30]!==C||t[31]!==D?(k=(0,$.jsxs)(`div`,{className:`grid gap-8 px-5 py-7 sm:px-8 sm:py-9 lg:grid-cols-[minmax(0,1fr)_18rem] lg:gap-12 lg:px-10 lg:py-11`,children:[C,D]}),t[30]=C,t[31]=D,t[32]=k):k=t[32];let A;t[33]!==k||t[34]!==y?(A=(0,$.jsxs)(`section`,{className:`relative overflow-hidden rounded-3xl border border-edge bg-surface-panel`,children:[y,k]}),t[33]=k,t[34]=y,t[35]=A):A=t[35];let j;t[36]===a.lastingPortrait?j=t[37]:(j=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:a.lastingPortrait}),t[36]=a.lastingPortrait,t[37]=j);let M;t[38]===a.lastingHint?M=t[39]:(M=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:a.lastingHint}),t[38]=a.lastingHint,t[39]=M);let N;t[40]!==j||t[41]!==M?(N=(0,$.jsxs)(`div`,{children:[j,M]}),t[40]=j,t[41]=M,t[42]=N):N=t[42];let P;t[43]!==i||t[44]!==f||t[45]!==a.noUnderstanding||t[46]!==r?(P=r.length?(0,$.jsx)(`div`,{className:`mt-4 grid gap-2 sm:grid-cols-2`,children:r.map(e=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>u(`understanding:${e.id}`),className:`group min-h-28 rounded-xl border p-3.5 text-left transition-colors ${f?.type===`understanding`&&f.item.id===e.id?`border-accent bg-accent-soft ring-2 ring-accent/10`:`border-edge bg-surface-base/50 hover:bg-surface-hover`}`,children:[(0,$.jsxs)(`span`,{className:`flex items-center justify-between gap-2 text-[11px] text-fg-subtle`,children:[(0,$.jsx)(`span`,{children:je[e.kind][i]}),(0,$.jsx)(`span`,{children:rt(e.updatedAt,i)})]}),(0,$.jsx)(`span`,{className:`mt-2 line-clamp-3 block text-sm leading-6 text-fg`,children:e.statement})]},e.id))}):(0,$.jsx)(`p`,{className:`mt-5 rounded-xl border border-dashed border-edge px-4 py-8 text-center text-sm leading-6 text-fg-muted`,children:a.noUnderstanding}),t[43]=i,t[44]=f,t[45]=a.noUnderstanding,t[46]=r,t[47]=P):P=t[47];let F;t[48]!==N||t[49]!==P?(F=(0,$.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-panel p-4 sm:p-5`,children:[N,P]}),t[48]=N,t[49]=P,t[50]=F):F=t[50];let I;t[51]!==i||t[52]!==o||t[53]!==f||t[54]!==a?(I=f?(0,$.jsx)(Xe,{selection:f,language:i,t:a,onRefresh:o}):null,t[51]=i,t[52]=o,t[53]=f,t[54]=a,t[55]=I):I=t[55];let L;t[56]!==F||t[57]!==I?(L=(0,$.jsxs)(`div`,{className:`grid gap-5 lg:grid-cols-[minmax(0,1fr)_20rem]`,children:[F,I]}),t[56]=F,t[57]=I,t[58]=L):L=t[58];let R;return t[59]!==A||t[60]!==L?(R=(0,$.jsxs)(`div`,{className:`space-y-5`,children:[A,L]}),t[59]=A,t[60]=L,t[61]=R):R=t[61],R}function Je(e,t,n){let[r,i]=e.split(`:`,2);if(r===`focus`){let e=t.find(e=>e.id===i);return e?{type:`focus`,item:e}:null}if(r===`understanding`){let e=n.find(e=>e.id===i);return e?{type:`understanding`,item:e}:null}return null}function Ye(e){let t=new Set;return e.filter(e=>{let n=e.title.trim().toLocaleLowerCase();return t.has(n)?!1:(t.add(n),!0)})}function Xe({selection:e,language:t,t:n,onRefresh:r}){let i=e.item,a=e.type===`understanding`?e.item:null,[s,c]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)(e.type===`focus`?e.item.title:``),[d,p]=(0,Z.useState)(e.type===`focus`?e.item.summary:e.item.statement),[m,h]=(0,Z.useState)(!1),[_,v]=(0,Z.useState)(`idle`),[y,b]=(0,Z.useState)([]);(0,Z.useEffect)(()=>{c(!1),u(e.type===`focus`?e.item.title:``),p(e.type===`focus`?e.item.summary:e.item.statement),v(`idle`),b([])},[e.type,e.item.id]);let x=async e=>{h(!0);try{await e(),await r()}finally{h(!1)}},S=async t=>{t.preventDefault(),!(!d.trim()||e.type===`focus`&&!l.trim())&&(await x(()=>e.type===`focus`?L(e.item.id,{title:l.trim(),summary:d.trim()}):j(e.item.id,{statement:d.trim()})),c(!1))},C=async()=>{if(!(!a||_===`loading`)){v(`loading`);try{b((await W(a.id)).evidence),v(`loaded`)}catch{v(`error`)}}},w=i.explicitness===`explicit`?n.explicit:i.explicitness===`observed`?n.observed:n.inferred;return(0,$.jsxs)(`aside`,{className:`self-start overflow-hidden rounded-2xl border border-edge bg-surface-panel lg:sticky lg:top-5`,children:[(0,$.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,$.jsx)(`p`,{className:`text-[11px] font-semibold uppercase tracking-[0.12em] text-accent`,children:e.type===`focus`?n.focusDetail:n.selectedDetail}),s?(0,$.jsxs)(`form`,{className:`mt-3 space-y-3`,onSubmit:S,children:[e.type===`focus`?(0,$.jsx)(`input`,{className:We,value:l,onChange:e=>u(e.target.value)}):null,(0,$.jsx)(`textarea`,{autoFocus:!0,className:We,rows:5,value:d,onChange:e=>p(e.target.value)}),(0,$.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,$.jsx)(g,{type:`button`,disabled:m,onClick:()=>c(!1),children:n.cancel}),(0,$.jsx)(g,{type:`submit`,variant:`primary`,disabled:m||!d.trim()||e.type===`focus`&&!l.trim(),children:n.save})]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`h3`,{className:`mt-3 text-base font-semibold leading-6 text-fg`,children:e.type===`focus`?e.item.title:e.item.statement}),e.type===`focus`?(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:e.item.summary}):null]})]}),s?null:(0,$.jsxs)(`div`,{className:`space-y-5 px-5 py-4`,children:[(0,$.jsxs)(`dl`,{className:`space-y-3 text-xs`,children:[(0,$.jsx)(Ze,{label:n.source,value:w}),(0,$.jsx)(Ze,{label:n.scope,value:tt(i.scope,n)}),(0,$.jsx)(Ze,{label:n.updated,value:rt(i.updatedAt,t,!0)}),i.validFrom?(0,$.jsx)(Ze,{label:n.validSince,value:rt(i.validFrom,t,!0)}):null,i.validTo?(0,$.jsx)(Ze,{label:n.validUntil,value:rt(i.validTo,t,!0)}):null,i.reviewAt?(0,$.jsx)(Ze,{label:n.reviewDue,value:rt(i.reviewAt,t,!0)}):null]}),a?(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>void C(),className:`inline-flex items-center gap-1.5 text-xs font-medium text-accent hover:underline`,children:[(0,$.jsx)(f,{className:`size-3.5`}),n.evidence]}),_===`idle`?null:(0,$.jsxs)(`div`,{className:`mt-2 rounded-xl bg-surface-muted p-3`,children:[(0,$.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:n.evidenceTitle}),_===`loading`?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:n.evidenceLoading}):null,_===`error`?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-danger`,children:n.evidenceError}):null,_===`loaded`&&!y.length?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:n.evidenceEmpty}):null,y.length?(0,$.jsx)(`div`,{className:`mt-2 space-y-2`,children:y.slice(0,4).map(e=>(0,$.jsx)(Qe,{evidence:e,language:t},e.id))}):null]})]}):null,(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2 border-t border-edge pt-4`,children:[(0,$.jsxs)(g,{disabled:m,onClick:()=>c(!0),children:[(0,$.jsx)(Y,{className:`size-3.5`}),n.edit]}),e.type===`focus`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(g,{variant:`ghost`,disabled:m,onClick:()=>void x(()=>L(e.item.id,{status:`paused`})),children:n.pause}),(0,$.jsxs)(g,{variant:`ghost`,disabled:m,onClick:()=>void x(()=>L(e.item.id,{status:`completed`})),children:[(0,$.jsx)(o,{className:`size-3.5`}),n.complete]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(g,{variant:`ghost`,disabled:m,onClick:()=>void x(()=>j(e.item.id,{status:`archived`})),children:n.archive}),(0,$.jsx)(g,{variant:`ghost`,className:`text-danger`,disabled:m,onClick:()=>void x(()=>j(e.item.id,{status:`rejected`})),children:n.incorrect})]})]})]})]})}function Ze(e){let t=(0,Q.c)(7),{label:n,value:r}=e,i;t[0]===n?i=t[1]:(i=(0,$.jsx)(`dt`,{className:`shrink-0 text-fg-subtle`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=(0,$.jsx)(`dd`,{className:`text-right leading-5 text-fg-muted`,children:r}),t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function Qe(e){let t=(0,Q.c)(12),{evidence:n,language:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i={conversation:{en:`Conversation`,zh:`对话`},connector:{en:`Connected source`,zh:`连接的数据源`},user:{en:`Direct input`,zh:`直接输入`},runtime:{en:`Work context`,zh:`工作过程`}},t[0]=i):i=t[0];let a=i[n.sourceType][r],o;t[1]!==n.observedAt||t[2]!==r?(o=rt(n.observedAt,r),t[1]=n.observedAt,t[2]=r,t[3]=o):o=t[3];let s;t[4]!==a||t[5]!==o?(s=(0,$.jsxs)(`p`,{className:`text-[11px] text-fg-subtle`,children:[a,` · `,o]}),t[4]=a,t[5]=o,t[6]=s):s=t[6];let c;t[7]===n.redactedExcerpt?c=t[8]:(c=n.redactedExcerpt?(0,$.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-xs leading-5 text-fg-muted`,children:n.redactedExcerpt}):null,t[7]=n.redactedExcerpt,t[8]=c);let l;return t[9]!==s||t[10]!==c?(l=(0,$.jsxs)(`div`,{className:`border-l-2 border-edge-strong pl-2.5`,children:[s,c]}),t[9]=s,t[10]=c,t[11]=l):l=t[11],l}function $e(e){let t=(0,Q.c)(17),{items:n,language:r,t:i}=e;if(!n.length){let e;return t[0]===i.timelineEmpty?e=t[1]:(e=(0,$.jsx)(st,{children:i.timelineEmpty}),t[0]=i.timelineEmpty,t[1]=e),e}let a;t[2]===i.changesIntro?a=t[3]:(a=(0,$.jsx)(`header`,{className:`border-b border-edge px-5 py-4`,children:(0,$.jsx)(`p`,{className:`max-w-2xl text-xs leading-5 text-fg-muted`,children:i.changesIntro})}),t[2]=i.changesIntro,t[3]=a);let o;if(t[4]!==n||t[5]!==r||t[6]!==i){let e;t[8]!==n.length||t[9]!==r||t[10]!==i?(e=(e,t)=>{let a=e.type===`focus`?e.focus.status:e.understanding.status,o=e.type===`focus`?e.focus:e.understanding,s=e.type===`focus`?e.focus.title:e.understanding.statement,c=et(a,o.createdAt===o.updatedAt,i),l=e.type===`focus`?i.importantNow:je[e.understanding.kind][r],u=[`paused`,`completed`,`rejected`,`archived`].includes(a);return(0,$.jsxs)(`article`,{className:`relative grid grid-cols-[1.25rem_minmax(0,1fr)] gap-3 py-4 sm:grid-cols-[6.5rem_1.25rem_minmax(0,1fr)] sm:gap-4`,children:[(0,$.jsx)(`time`,{className:`hidden pt-0.5 text-right text-[11px] tabular-nums text-fg-subtle sm:block`,children:rt(e.updatedAt,r)}),t<n.length-1?(0,$.jsx)(`span`,{className:`absolute bottom-0 left-[0.6rem] top-7 w-px bg-edge sm:left-[7.9rem]`,"aria-hidden":`true`}):null,(0,$.jsx)(`span`,{className:`relative z-10 mt-1 size-2.5 rounded-full border-2 border-surface-panel ${u?`bg-fg-subtle`:a===`active`?`bg-success`:`bg-warning`}`,"aria-hidden":`true`}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,$.jsx)(`span`,{className:`text-[11px] font-medium text-accent`,children:c}),(0,$.jsx)(`span`,{className:`text-[11px] text-fg-subtle`,children:l}),(0,$.jsx)(`time`,{className:`text-[11px] text-fg-subtle sm:hidden`,children:rt(e.updatedAt,r)})]}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-6 ${u?`text-fg-muted`:`text-fg`}`,children:s})]})]},`${e.type}:${e.id}`)},t[8]=n.length,t[9]=r,t[10]=i,t[11]=e):e=t[11],o=n.map(e),t[4]=n,t[5]=r,t[6]=i,t[7]=o}else o=t[7];let s;t[12]===o?s=t[13]:(s=(0,$.jsx)(`div`,{className:`px-4 py-2 sm:px-6`,children:o}),t[12]=o,t[13]=s);let c;return t[14]!==a||t[15]!==s?(c=(0,$.jsxs)(`section`,{className:`overflow-hidden rounded-2xl border border-edge bg-surface-panel`,children:[a,s]}),t[14]=a,t[15]=s,t[16]=c):c=t[16],c}function et(e,t,n){return e===`candidate`?n.proposed:e===`needs_review`||e===`stale`?n.needsReview:e===`paused`?n.paused:e===`completed`?n.completed:e===`rejected`?n.rejected:e===`archived`?n.archived:t?n.formed:n.changed}function tt(e,t){let n=e.type===`global`?t.global:e.type===`workspace`?t.workspace:e.type===`project`?t.project:t.session;return e.id?`${n} · ${e.id}`:n}function nt(e,t){return e===`long_term`?t.horizonLongTerm:e===`ongoing`?t.horizonOngoing:t.horizonCurrent}function rt(e,t,n=!1){return new Intl.DateTimeFormat(t===`zh`?`zh-CN`:`en`,{...n?{year:`numeric`}:{},month:`short`,day:`numeric`}).format(new Date(e))}function it({items:e,language:t,t:n,onRefresh:r}){let[i,a]=(0,Z.useState)(0),[s,c]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)(!1),d=e.length?i%e.length:0,f=e[d];if((0,Z.useEffect)(()=>{a(0),c(!1)},[e.length]),!f)return(0,$.jsx)(st,{children:n.noReview});let p=async e=>{u(!0);try{f.type===`focus`?await L(f.id,{status:e?`active`:`rejected`}):await j(f.id,{status:e?`active`:`rejected`}),await r()}finally{u(!1)}};return(0,$.jsxs)(`section`,{className:`mx-auto max-w-2xl`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-fg-muted`,children:[(0,$.jsx)(`span`,{children:n.reviewTitle}),(0,$.jsxs)(`span`,{className:`tabular-nums`,children:[d+1,` / `,e.length]})]}),(0,$.jsxs)(`article`,{className:`mt-3 rounded-2xl border border-edge bg-surface-panel p-5 sm:p-6`,children:[(0,$.jsx)(at,{item:f,language:t,t:n,editing:s,pending:l,onCancelEdit:()=>c(!1),onSaved:r}),s?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`mt-5 rounded-xl bg-surface-muted px-3 py-2.5 text-xs leading-5 text-fg-muted`,children:n.reviewHint}),(0,$.jsxs)(`div`,{className:`mt-5 grid gap-2 sm:grid-cols-3`,children:[(0,$.jsxs)(g,{variant:`primary`,disabled:l,onClick:()=>void p(!0),children:[(0,$.jsx)(o,{className:`size-4`}),n.yes]}),(0,$.jsx)(g,{disabled:l,onClick:()=>c(!0),children:n.change}),(0,$.jsx)(g,{variant:`ghost`,className:`text-danger`,disabled:l,onClick:()=>void p(!1),children:n.wrong})]}),e.length>1?(0,$.jsx)(`button`,{type:`button`,className:`mx-auto mt-3 block rounded-md px-2 py-1 text-xs text-fg-muted hover:text-fg`,onClick:()=>a(t=>(t+1)%e.length),children:n.later}):null]})]})]})}function at({item:e,language:t,t:n,editing:r,pending:i,onCancelEdit:a,onSaved:o}){let[s,c]=(0,Z.useState)(e.type===`focus`?e.focus.title:``),[l,u]=(0,Z.useState)(e.type===`focus`?e.focus.summary:e.understanding.statement),[d,f]=(0,Z.useState)(!1);(0,Z.useEffect)(()=>{c(e.type===`focus`?e.focus.title:``),u(e.type===`focus`?e.focus.summary:e.understanding.statement)},[e]);let p=e.type===`focus`?e.focus.confidence:e.understanding.confidence,m=p>=.85?n.high:p>=.65?n.medium:n.low,h=async t=>{if(t.preventDefault(),!(!l.trim()||e.type===`focus`&&!s.trim())){f(!0);try{e.type===`focus`?await L(e.id,{title:s,summary:l,status:`active`}):await j(e.id,{statement:l,status:`active`}),await o()}finally{f(!1)}}};if(r)return(0,$.jsxs)(`form`,{onSubmit:h,className:`space-y-3`,children:[e.type===`focus`?(0,$.jsx)(`input`,{autoFocus:!0,className:We,value:s,onChange:e=>c(e.target.value)}):null,(0,$.jsx)(`textarea`,{autoFocus:e.type===`understanding`,className:We,rows:4,value:l,onChange:e=>u(e.target.value)}),(0,$.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,$.jsx)(g,{type:`button`,disabled:d,onClick:a,children:n.cancel}),(0,$.jsx)(g,{type:`submit`,variant:`primary`,disabled:i||d||!l.trim()||e.type===`focus`&&!s.trim(),children:n.saveConfirm})]})]});let _=e.type===`understanding`?e.understanding:null,v=_?_.explicitness===`explicit`?n.explicit:_.explicitness===`observed`?n.observed:n.inferred:n.inferred;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:[(0,$.jsx)(`span`,{className:`font-medium text-accent`,children:e.type===`focus`?n.focusCandidate:n.understandingCandidate}),(0,$.jsx)(`span`,{children:`·`}),(0,$.jsxs)(`span`,{children:[n.confidence,` `,m]}),_?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{children:`·`}),(0,$.jsx)(`span`,{children:je[_.kind][t]})]}):null]}),e.type===`focus`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`h2`,{className:`mt-4 text-lg font-semibold leading-7 text-fg`,children:e.focus.title}),(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:e.focus.summary})]}):(0,$.jsx)(`p`,{className:`mt-4 text-lg font-semibold leading-8 text-fg`,children:e.understanding.statement}),(0,$.jsx)(`p`,{className:`mt-4 text-xs text-fg-subtle`,children:v})]})}function ot(e){let t=(0,Q.c)(56),{open:n,onOpenChange:r,language:i,t:a,onCreated:o}=e,[l,u]=(0,Z.useState)(``),[d,f]=(0,Z.useState)(`preference`),p;t[0]!==d||t[1]!==o||t[2]!==r||t[3]!==l?(p=async e=>{e.preventDefault(),l.trim()&&(await le({statement:l,kind:d}),u(``),r(!1),await o())},t[0]=d,t[1]=o,t[2]=r,t[3]=l,t[4]=p):p=t[4];let m=p,_;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(v,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),t[5]=_):_=t[5];let y;t[6]===a.add?y=t[7]:(y=(0,$.jsx)(C,{className:`text-base font-semibold text-fg`,children:a.add}),t[6]=a.add,t[7]=y);let T;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,$.jsx)(h,{className:`size-4`}),t[8]=T):T=t[8];let E;t[9]===a.cancel?E=t[10]:(E=(0,$.jsx)(b,{asChild:!0,children:(0,$.jsx)(g,{type:`button`,variant:`ghost`,className:`size-8 p-0`,"aria-label":a.cancel,children:T})}),t[9]=a.cancel,t[10]=E);let D;t[11]!==y||t[12]!==E?(D=(0,$.jsxs)(`header`,{className:`flex items-start justify-between gap-3 border-b border-edge px-5 py-4`,children:[y,E]}),t[11]=y,t[12]=E,t[13]=D):D=t[13];let O;t[14]===a.statement?O=t[15]:(O=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:a.statement}),t[14]=a.statement,t[15]=O);let k;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(k=e=>u(e.target.value),t[16]=k):k=t[16];let A;t[17]===l?A=t[18]:(A=(0,$.jsx)(`textarea`,{autoFocus:!0,className:We,rows:4,value:l,onChange:k}),t[17]=l,t[18]=A);let j;t[19]!==O||t[20]!==A?(j=(0,$.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[O,A]}),t[19]=O,t[20]=A,t[21]=j):j=t[21];let M;t[22]===a.type?M=t[23]:(M=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:a.type}),t[22]=a.type,t[23]=M);let N,P;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(N=e=>f(e.target.value),P=Object.entries(je),t[24]=N,t[25]=P):(N=t[24],P=t[25]);let F;t[26]===i?F=t[27]:(F=P.map(e=>{let[t,n]=e;return(0,$.jsx)(c,{value:t,children:n[i]},t)}),t[26]=i,t[27]=F);let I;t[28]!==d||t[29]!==F?(I=(0,$.jsx)(s,{value:d,onChange:N,children:F}),t[28]=d,t[29]=F,t[30]=I):I=t[30];let L;t[31]!==M||t[32]!==I?(L=(0,$.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[M,I]}),t[31]=M,t[32]=I,t[33]=L):L=t[33];let R;t[34]!==j||t[35]!==L?(R=(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-5`,children:[j,L]}),t[34]=j,t[35]=L,t[36]=R):R=t[36];let z;t[37]===a.cancel?z=t[38]:(z=(0,$.jsx)(b,{asChild:!0,children:(0,$.jsx)(g,{type:`button`,children:a.cancel})}),t[37]=a.cancel,t[38]=z);let B;t[39]===l?B=t[40]:(B=l.trim(),t[39]=l,t[40]=B);let V=!B,H;t[41]!==a.create||t[42]!==V?(H=(0,$.jsx)(g,{type:`submit`,variant:`primary`,disabled:V,children:a.create}),t[41]=a.create,t[42]=V,t[43]=H):H=t[43];let U;t[44]!==z||t[45]!==H?(U=(0,$.jsxs)(`footer`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-3`,children:[z,H]}),t[44]=z,t[45]=H,t[46]=U):U=t[46];let W;t[47]!==m||t[48]!==R||t[49]!==U||t[50]!==D?(W=(0,$.jsxs)(x,{children:[_,(0,$.jsx)(S,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(30rem,calc(100vh-2rem))] w-[min(36rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`,children:(0,$.jsxs)(`form`,{className:`flex h-full min-h-0 flex-col`,onSubmit:m,children:[D,R,U]})})]}),t[47]=m,t[48]=R,t[49]=U,t[50]=D,t[51]=W):W=t[51];let G;return t[52]!==r||t[53]!==n||t[54]!==W?(G=(0,$.jsx)(w,{open:n,onOpenChange:r,children:W}),t[52]=r,t[53]=n,t[54]=W,t[55]=G):G=t[55],G}function st(e){let t=(0,Q.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,$.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge px-5 py-12 text-center text-sm leading-6 text-fg-muted`,children:n}),t[0]=n,t[1]=r),r}var ct=new Set([`profile`,`understanding`,`collaboration`,`sources`,`dreaming`,`privacy`]),lt=`w-full rounded-xl border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent/60 focus:ring-2 focus:ring-accent/20`,ut={en:{title:`You`,subtitle:`A living portrait, shaped together by you and xopc.`,profile:`Your portrait`,understanding:`Shared understanding`,collaboration:`Working together`,sources:`Sources`,dreaming:`Background review`,privacy:`Privacy`,portraitEyebrow:`YOU × XOPC`,portraitIntro:`This is how xopc currently understands you. It grows through your conversations and work — and you always have the final say.`,maintainedTogether:`Shaped together`,youDecide:`You decide what stays`,editProfile:`Edit basics`,talkAboutMe:`Add through conversation`,roleMissing:`Add what you do`,direction:`What matters now`,directionEmpty:`Add a direction so xopc can help keep important work moving.`,portraitUnderstanding:`What xopc understands`,portraitUnderstandingHint:`Confirmed context xopc can use across conversations.`,portraitRules:`How we work together`,portraitRulesHint:`The agreements xopc should follow when helping you.`,reviewWaiting:`waiting for your review`,seeAll:`See all`,addFirstUnderstanding:`Nothing confirmed yet. Tell xopc what matters to you, or review a suggestion when one appears.`,addFirstRule:`No working agreements yet. Add one to make collaboration feel more like yours.`,portraitControl:`How this portrait evolves`,portraitControlHint:`Manage where understanding comes from, how it is reviewed, and what is never retained.`,portraitLearn:`Learn how this portrait is formed`,advanced:`Portrait controls`,backToPortrait:`Back to your portrait`,controlSourcesHint:`See which conversations, connections, and explicit details shape xopc’s understanding.`,controlReviewHint:`Choose how xopc proposes updates and which changes require your confirmation.`,controlPrivacyHint:`Set the boundaries for sensitive content and long-term retention.`,controlTrust:`Inferred understanding is never activated automatically. You can review, correct, or remove it at any time.`,profileHint:`Facts you provide directly. These are available across conversations.`,callName:`What should xopc call you?`,callNamePlaceholder:`For example: Alex, Joyce, or Dr. Chen`,role:`Your role`,rolePlaceholder:`For example: product designer, founder, or engineer`,primaryGoal:`What are you mainly trying to achieve?`,primaryGoalPlaceholder:`The outcome you want xopc to optimize for`,pronouns:`Pronouns (optional)`,pronounsPlaceholder:`For example: she/her, he/him, they/them`,timezone:`Timezone`,locale:`Language / locale`,detect:`Use this device`,add:`Add`,cancel:`Cancel`,delete:`Delete`,confirmDelete:`Delete now`,rulesHint:`Explicit instructions for how xopc should collaborate with you. Rules outrank inferred understanding.`,addRule:`Add rule`,ruleStatement:`How should xopc work with you?`,category:`Category`,disable:`Disable`,enable:`Enable`,emptyRules:`No working agreements yet.`,sourcesHint:`Review every granted source, its latest learning result, access mode, and retention. Revoking stops future learning.`,manageSources:`Connect another source`,authorizedSources:`Authorized sources`,connectorsTitle:`Connectors`,openConnector:`Open connector`,noSources:`No sources are authorized.`,noConnectors:`No connectors are installed.`,connected:`Connected`,unavailable:`Needs attention`,revoke:`Revoke source`,revokeHint:`Review the impact before revoking this source`,revoking:`Revoking…`,revokeDone:`Source revoked.`,revokeImpact:`This source exclusively supports {{count}} context objects. Keeping them removes them from planning until reviewed.`,deleteDerived:`Revoke and delete`,retainDerived:`Revoke and keep for review`,refresh:`Update`,refreshing:`Updating…`,refreshStarted:`Update started.`,actionFailed:`Action failed`,once:`One-time`,continuous:`Continuous`,localOnly:`Local only`,derivedOnly:`Derived understanding only`,sourceQueued:`Queued`,sourceRunning:`Learning`,sourceCompleted:`Learned`,sourcePartial:`Partially learned`,sourceFailed:`Learning failed`,sourceNotRun:`Not collected yet`,sourceItems:`items reviewed`,sourceCandidates:`candidates formed`,sourceAccountUnavailable:`The connected account is unavailable. Reconnect it and try again.`,sourceSyncFailed:`This source could not be synchronized. Try updating it again.`,sourceAnalysisFailed:`Content was collected, but deeper understanding could not be completed. Try again later.`,contentReadTitle:`Additional deeper reading`,contentReadHint:`These items still need content to add useful context. Select up to 5 for one bounded read.`,readSelected:`Read selected`,reading:`Reading…`,contentReadDone:`Selected content was read and indexed.`,dreamingHint:`A deterministic daily review checks expiry, contradictory evidence, and corroborated candidates. It never auto-activates an inference.`,mode:`Background review`,on:`On — propose for review`,off:`Off`,reviewTime:`Daily review time`,evidenceThreshold:`Supporting evidence required`,scanLimit:`Maximum items per run`,lastRun:`Last review`,neverRun:`Not run yet`,runCompleted:`Completed`,runFailed:`Failed`,runRunning:`Running`,runItems:`items`,privacyHint:`Choose how generic memory providers handle sensitive content. Structured user understanding applies stricter rules of its own.`,sensitivePolicy:`Sensitive memory writes`,policyDeny:`Do not store`,policyConfirm:`Ask before storing`,policyAllow:`Store when relevant`,privacyWarning:`Secret and regulated content is never stored as structured user understanding, regardless of this setting.`,error:`Could not load your context.`,retry:`Try again`},zh:{title:`你`,subtitle:`一份由你和 xopc 共同塑造、持续生长的画像。`,profile:`你的画像`,understanding:`共同理解`,collaboration:`协作方式`,sources:`数据来源`,dreaming:`后台复核`,privacy:`隐私`,portraitEyebrow:`YOU × XOPC`,portraitIntro:`这是 xopc 此刻对你的理解。它会在对话与共事中逐渐丰富,而你始终拥有最终决定权。`,maintainedTogether:`由你与 xopc 共同维护`,youDecide:`你决定什么被保留`,editProfile:`编辑基本信息`,talkAboutMe:`在对话中补充`,roleMissing:`补充你的角色`,direction:`此刻重要的事`,directionEmpty:`写下你此刻的方向,让 xopc 帮你持续推动真正重要的事。`,portraitUnderstanding:`xopc 对你的理解`,portraitUnderstandingHint:`已经确认、可以在不同对话中帮助你的上下文。`,portraitRules:`我们如何一起工作`,portraitRulesHint:`xopc 在帮助你时应该遵循的约定。`,reviewWaiting:`条等待你确认`,seeAll:`查看全部`,addFirstUnderstanding:`还没有已确认的理解。你可以直接告诉 xopc 什么对你重要,或在它形成建议后确认。`,addFirstRule:`还没有协作约定。添加后,xopc 会更像你熟悉的搭档。`,portraitControl:`这份画像如何更新`,portraitControlHint:`管理理解从哪里来、如何复核,以及哪些内容永远不会被保留。`,portraitLearn:`了解这份画像如何形成`,advanced:`画像管理`,backToPortrait:`返回你的画像`,controlSourcesHint:`查看哪些对话、连接与明确告知的内容塑造了 xopc 的理解。`,controlReviewHint:`决定 xopc 如何提出更新,以及哪些变化需要你确认。`,controlPrivacyHint:`设定敏感内容与长期保留的边界。`,controlTrust:`推断出的理解不会自动生效。你可以随时复核、修正或删除。`,profileHint:`由你直接提供的事实,会在不同对话中使用。`,callName:`希望 xopc 如何称呼你?`,callNamePlaceholder:`例如:Mic、Joyce、张老师`,role:`你的角色`,rolePlaceholder:`例如:产品设计师、创业者、工程师`,primaryGoal:`你目前最想达成什么?`,primaryGoalPlaceholder:`希望 xopc 优先帮助你实现的结果`,pronouns:`代词(可选)`,pronounsPlaceholder:`例如:she/her、he/him、they/them`,timezone:`时区`,locale:`语言 / 地区`,detect:`使用本机时区`,add:`添加`,cancel:`取消`,delete:`删除`,confirmDelete:`确认删除`,rulesHint:`你明确设定的协作方式。协作约定的优先级高于推断出的理解。`,addRule:`添加约定`,ruleStatement:`希望 xopc 如何与你协作?`,category:`类别`,disable:`停用`,enable:`启用`,emptyRules:`还没有协作约定。`,sourcesHint:`查看每项授权最近一次学习结果、访问方式与保留策略;撤销后将停止后续学习。`,manageSources:`连接其他来源`,authorizedSources:`已授权数据来源`,connectorsTitle:`连接器`,openConnector:`打开连接器`,noSources:`尚未授权任何来源。`,noConnectors:`尚未安装连接器。`,connected:`已连接`,unavailable:`需要处理`,revoke:`撤销来源`,revokeHint:`撤销前先查看影响范围`,revoking:`正在撤销…`,revokeDone:`已撤销来源。`,revokeImpact:`此来源是 {{count}} 个上下文对象的唯一依据。若保留,它们会先退出规划,等待复核。`,deleteDerived:`撤销并删除`,retainDerived:`撤销并保留待复核`,refresh:`更新`,refreshing:`正在更新…`,refreshStarted:`更新任务已开始。`,actionFailed:`操作失败`,once:`仅一次`,continuous:`持续更新`,localOnly:`仅本地处理`,derivedOnly:`仅保留派生理解`,sourceQueued:`等待中`,sourceRunning:`正在理解`,sourceCompleted:`理解完成`,sourcePartial:`部分完成`,sourceFailed:`理解失败`,sourceNotRun:`尚未采集`,sourceItems:`项已检查`,sourceCandidates:`项候选理解`,sourceAccountUnavailable:`连接的账号不可用,请重新连接后重试。`,sourceSyncFailed:`该来源同步失败,请再次更新。`,sourceAnalysisFailed:`内容已采集,但深入理解未完成,请稍后重试。`,contentReadTitle:`补充深入读取`,contentReadHint:`这些条目还需要正文才能形成有用上下文。你可以选择最多 5 项进行一次有界读取。`,readSelected:`读取所选内容`,reading:`正在读取…`,contentReadDone:`已读取并索引所选内容。`,dreamingHint:`每天进行一次确定性复核,检查过期、矛盾证据和得到佐证的候选理解;推断内容不会自动生效。`,mode:`后台复核`,on:`开启并生成待审核项`,off:`关闭`,reviewTime:`每日复核时间`,evidenceThreshold:`所需支持证据数`,scanLimit:`每次最多检查`,lastRun:`最近一次复核`,neverRun:`尚未运行`,runCompleted:`已完成`,runFailed:`失败`,runRunning:`运行中`,runItems:`项`,privacyHint:`选择通用记忆服务如何处理敏感内容;结构化用户理解有独立且更严格的规则。`,sensitivePolicy:`敏感记忆写入`,policyDeny:`不保存`,policyConfirm:`保存前询问`,policyAllow:`相关时允许保存`,privacyWarning:`无论这里如何设置,秘密和受监管内容都不会保存为结构化用户理解。`,error:`无法加载用户上下文。`,retry:`重试`}},dt={communication:{en:`Communication`,zh:`沟通`},execution:{en:`Execution`,zh:`执行`},boundary:{en:`Boundary`,zh:`边界`},routine:{en:`Routine`,zh:`习惯`},proactive:{en:`Proactive help`,zh:`主动协助`}};function ft(e){let t=(0,Q.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,$.jsx)(`section`,{className:`rounded-2xl border border-edge bg-surface-panel p-4 sm:p-5`,children:n}),t[0]=n,t[1]=r),r}function pt(e){let t=(0,Q.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,$.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge px-5 py-10 text-center text-sm text-fg-muted`,children:n}),t[0]=n,t[1]=r),r}function mt(e){let t=(0,Q.c)(33),{open:n,onOpenChange:r,title:i,description:a,submitLabel:o,cancelLabel:s,submitDisabled:c,onSubmit:l,children:u}=e,d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,$.jsx)(v,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),t[0]=d):d=t[0];let f;t[1]===i?f=t[2]:(f=(0,$.jsx)(C,{className:`text-base font-semibold text-fg`,children:i}),t[1]=i,t[2]=f);let p;t[3]===a?p=t[4]:(p=(0,$.jsx)(y,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:a}),t[3]=a,t[4]=p);let m;t[5]!==f||t[6]!==p?(m=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[f,p]}),t[5]=f,t[6]=p,t[7]=m):m=t[7];let _;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(h,{className:`size-4`}),t[8]=_):_=t[8];let T;t[9]===s?T=t[10]:(T=(0,$.jsx)(b,{asChild:!0,children:(0,$.jsx)(g,{type:`button`,variant:`ghost`,className:`size-8 shrink-0 p-0`,"aria-label":s,children:_})}),t[9]=s,t[10]=T);let E;t[11]!==m||t[12]!==T?(E=(0,$.jsxs)(`header`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge px-5 py-4`,children:[m,T]}),t[11]=m,t[12]=T,t[13]=E):E=t[13];let D;t[14]===u?D=t[15]:(D=(0,$.jsx)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-5`,children:u}),t[14]=u,t[15]=D);let O;t[16]===s?O=t[17]:(O=(0,$.jsx)(b,{asChild:!0,children:(0,$.jsx)(g,{type:`button`,children:s})}),t[16]=s,t[17]=O);let k;t[18]!==c||t[19]!==o?(k=(0,$.jsx)(g,{type:`submit`,variant:`primary`,disabled:c,children:o}),t[18]=c,t[19]=o,t[20]=k):k=t[20];let A;t[21]!==k||t[22]!==O?(A=(0,$.jsxs)(`footer`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-3`,children:[O,k]}),t[21]=k,t[22]=O,t[23]=A):A=t[23];let j;t[24]!==l||t[25]!==A||t[26]!==E||t[27]!==D?(j=(0,$.jsxs)(x,{children:[d,(0,$.jsx)(S,{className:`fixed left-1/2 top-1/2 z-[90] h-[min(30rem,calc(100vh-2rem))] w-[min(36rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`,children:(0,$.jsxs)(`form`,{className:`flex h-full min-h-0 flex-col`,onSubmit:l,children:[E,D,A]})})]}),t[24]=l,t[25]=A,t[26]=E,t[27]=D,t[28]=j):j=t[28];let M;return t[29]!==r||t[30]!==n||t[31]!==j?(M=(0,$.jsx)(w,{open:n,onOpenChange:r,children:j}),t[29]=r,t[30]=n,t[31]=j,t[32]=M):M=t[32],M}function ht(e){return JSON.stringify(e)}function gt(e){let t=(0,Q.c)(10),[n,r]=(0,Z.useState)(e),i;t[0]===e?i=t[1]:(i=ht(e),t[0]=e,t[1]=i);let a=(0,Z.useRef)(i),o;t[2]===e?o=t[3]:(o=ht(e),t[2]=e,t[3]=o);let s=o,c,l;t[4]!==e||t[5]!==s?(c=()=>{if(s===a.current)return;let t=a.current;a.current=s,r(n=>ht(n)===t?e:n)},l=[e,s],t[4]=e,t[5]=s,t[6]=c,t[7]=l):(c=t[6],l=t[7]),(0,Z.useEffect)(c,l);let u;return t[8]===n?u=t[9]:(u=[n,r],t[8]=n,t[9]=u),u}function _t(e){return{callName:e.callName,role:e.role,primaryGoal:e.primaryGoal,pronouns:e.pronouns,timezone:e.timezone,locale:e.locale}}function vt(){let e=(0,Q.c)(67),t=_(Ct),n=ut[t],[r,a]=i(),o;if(e[0]!==r){let t=r.get(`tab`);o=t&&ct.has(t)?t:`profile`,e[0]=r,e[1]=o}else o=e[1];let s=o,c=X(St),l=X(xt),{data:u,error:d,isLoading:f,mutate:p}=T(`/api/you`,G),m;e[2]!==l||e[3]!==c||e[4]!==n.subtitle||e[5]!==n.title?(m=()=>(c({startExtra:null,main:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h1`,{className:`text-base font-semibold text-fg`,children:n.title}),(0,$.jsx)(`p`,{className:`hidden text-xs text-fg-muted sm:block`,children:n.subtitle})]}),end:null}),l),e[2]=l,e[3]=c,e[4]=n.subtitle,e[5]=n.title,e[6]=m):m=e[6];let h;if(e[7]!==l||e[8]!==c||e[9]!==n?(h=[l,c,n],e[7]=l,e[8]=c,e[9]=n,e[10]=h):h=e[10],(0,Z.useEffect)(m,h),f){let t;return e[11]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`div`,{className:`space-y-4 p-4 sm:p-6`,children:[(0,$.jsx)(U,{className:`h-10 w-96 max-w-full`}),(0,$.jsx)(U,{className:`h-72 rounded-2xl`})]}),e[11]=t):t=e[11],t}if(d||!u){let t;e[12]===p?t=e[13]:(t=()=>void p(),e[12]=p,e[13]=t);let r;e[14]!==n.retry||e[15]!==t?(r=(0,$.jsx)(`button`,{className:`text-accent hover:underline`,onClick:t,children:n.retry}),e[14]=n.retry,e[15]=t,e[16]=r):r=e[16];let i;return e[17]!==n.error||e[18]!==r?(i=(0,$.jsx)(`div`,{className:`p-6`,children:(0,$.jsxs)(pt,{children:[n.error,` `,r]})}),e[17]=n.error,e[18]=r,e[19]=i):i=e[19],i}let v=s===`sources`||s===`dreaming`||s===`privacy`,y;e[20]!==v||e[21]!==u||e[22]!==a||e[23]!==n.advanced||e[24]!==n.backToPortrait||e[25]!==n.collaboration||e[26]!==n.profile||e[27]!==n.title||e[28]!==n.understanding||e[29]!==s?(y=v?(0,$.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-edge pb-4`,children:[(0,$.jsxs)(g,{variant:`ghost`,className:`-ml-2`,onClick:()=>a({tab:`profile`}),children:[(0,$.jsx)(I,{className:`size-4`}),n.backToPortrait]}),(0,$.jsx)(`span`,{className:`h-4 w-px bg-edge`,"aria-hidden":`true`}),(0,$.jsx)(`span`,{className:`text-sm font-medium text-fg-muted`,children:n.advanced})]}):(0,$.jsx)(xe,{ariaLabel:n.title,activeTab:s,onChange:e=>a({tab:e}),items:[{id:`profile`,label:n.profile,icon:he},{id:`understanding`,label:n.understanding,icon:F,count:u.understandings.filter(bt).length+u.focuses.filter(yt).length||void 0},{id:`collaboration`,label:n.collaboration,icon:H}]}),e[20]=v,e[21]=u,e[22]=a,e[23]=n.advanced,e[24]=n.backToPortrait,e[25]=n.collaboration,e[26]=n.profile,e[27]=n.title,e[28]=n.understanding,e[29]=s,e[30]=y):y=e[30];let b;e[31]!==u||e[32]!==t||e[33]!==p||e[34]!==a||e[35]!==n||e[36]!==s?(b=s===`profile`?(0,$.jsx)(wt,{data:u,language:t,t:n,onNavigate:e=>a({tab:e}),onProfileChanged:e=>p(t=>t&&{...t,profile:e},{revalidate:!1})}):null,e[31]=u,e[32]=t,e[33]=p,e[34]=a,e[35]=n,e[36]=s,e[37]=b):b=e[37];let x;e[38]!==u||e[39]!==t||e[40]!==p||e[41]!==s?(x=s===`understanding`?(0,$.jsx)(Ge,{focuses:u.focuses,understandings:u.understandings,language:t,onRefresh:()=>p()}):null,e[38]=u,e[39]=t,e[40]=p,e[41]=s,e[42]=x):x=e[42];let S;e[43]!==u||e[44]!==t||e[45]!==p||e[46]!==n||e[47]!==s?(S=s===`collaboration`?(0,$.jsx)(Pt,{rules:u.rules,language:t,t:n,onChanged:()=>p()}):null,e[43]=u,e[44]=t,e[45]=p,e[46]=n,e[47]=s,e[48]=S):S=e[48];let C;e[49]!==n||e[50]!==s?(C=s===`sources`?(0,$.jsx)(Lt,{t:n}):null,e[49]=n,e[50]=s,e[51]=C):C=e[51];let w;e[52]!==u||e[53]!==n||e[54]!==s?(w=s===`dreaming`?(0,$.jsx)(Rt,{lastRun:u.consolidation?.lastRun??null,t:n}):null,e[52]=u,e[53]=n,e[54]=s,e[55]=w):w=e[55];let E;e[56]!==n||e[57]!==s?(E=s===`privacy`?(0,$.jsx)(Bt,{t:n}):null,e[56]=n,e[57]=s,e[58]=E):E=e[58];let D;return e[59]!==y||e[60]!==b||e[61]!==x||e[62]!==S||e[63]!==C||e[64]!==w||e[65]!==E?(D=(0,$.jsxs)(`div`,{className:`mx-auto w-full max-w-6xl space-y-5 p-4 sm:p-6 lg:py-8`,children:[y,b,x,S,C,w,E]}),e[59]=y,e[60]=b,e[61]=x,e[62]=S,e[63]=C,e[64]=w,e[65]=E,e[66]=D):D=e[66],D}function yt(e){return e.status===`candidate`}function bt(e){return[`candidate`,`needs_review`,`stale`].includes(e.status)}function xt(e){return e.clearPageHeader}function St(e){return e.setPageHeader}function Ct(e){return e.language}function wt(e){let t=(0,Q.c)(179),{data:n,language:r,t:i,onNavigate:o,onProfileChanged:s}=e,[c,l]=(0,Z.useState)(!1),[u,d]=(0,Z.useState)(!1),f,p,m,h,_,v,y,b,x,S;if(t[0]!==n.focuses||t[1]!==n.profile.callName||t[2]!==n.profile.primaryGoal||t[3]!==n.profile.role||t[4]!==n.rules||t[5]!==n.understandings||t[6]!==r||t[7]!==o||t[8]!==i.addFirstRule||t[9]!==i.addFirstUnderstanding||t[10]!==i.advanced||t[11]!==i.direction||t[12]!==i.directionEmpty||t[13]!==i.editProfile||t[14]!==i.maintainedTogether||t[15]!==i.portraitEyebrow||t[16]!==i.portraitIntro||t[17]!==i.portraitRules||t[18]!==i.portraitRulesHint||t[19]!==i.portraitUnderstanding||t[20]!==i.portraitUnderstandingHint||t[21]!==i.reviewWaiting||t[22]!==i.roleMissing||t[23]!==i.seeAll||t[24]!==i.talkAboutMe||t[25]!==i.youDecide){let e=n.understandings.filter(Ot),s;t[36]===n.understandings?s=t[37]:(s=n.understandings.filter(Dt),t[36]=n.understandings,t[37]=s);let c=s.length,u;t[38]===n.focuses?u=t[39]:(u=n.focuses.filter(Et),t[38]=n.focuses,t[39]=u);let C=c+u.length,w=n.rules.filter(Tt),T,D;t[40]!==n.profile.callName||t[41]!==r?(T=n.profile.callName.trim()||(r===`zh`?`你`:`You`),D=[...T][0]?.toLocaleUpperCase()??`Y`,t[40]=n.profile.callName,t[41]=r,t[42]=T,t[43]=D):(T=t[42],D=t[43]);let k=D;x=`space-y-5`;let A;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,$.jsx)(`div`,{className:`absolute inset-x-0 top-0 h-px bg-gradient-to-r from-transparent via-accent/40 to-transparent`,"aria-hidden":`true`}),t[44]=A):A=t[44];let j;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,$.jsx)(E,{className:`size-3.5`}),t[45]=j):j=t[45];let P;t[46]===i.portraitEyebrow?P=t[47]:(P=(0,$.jsxs)(`div`,{className:`mb-7 flex items-center gap-2 text-[11px] font-semibold tracking-[0.18em] text-accent`,children:[j,i.portraitEyebrow]}),t[46]=i.portraitEyebrow,t[47]=P);let I;t[48]===k?I=t[49]:(I=(0,$.jsx)(`div`,{className:`flex size-16 shrink-0 items-center justify-center rounded-2xl border border-edge bg-surface-muted text-2xl font-semibold text-fg sm:size-20 sm:text-3xl`,children:k}),t[48]=k,t[49]=I);let L;t[50]===T?L=t[51]:(L=(0,$.jsx)(`h2`,{className:`truncate text-2xl font-semibold tracking-tight text-fg sm:text-3xl`,children:T}),t[50]=T,t[51]=L);let R;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(R=()=>l(!0),t[52]=R):R=t[52];let z;t[53]!==n.profile.role||t[54]!==i.roleMissing?(z=n.profile.role.trim()||i.roleMissing,t[53]=n.profile.role,t[54]=i.roleMissing,t[55]=z):z=t[55];let B;t[56]===z?B=t[57]:(B=(0,$.jsx)(`button`,{className:`mt-1 text-left text-sm text-fg-muted transition-colors hover:text-accent`,onClick:R,children:z}),t[56]=z,t[57]=B);let V;t[58]!==L||t[59]!==B?(V=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[L,B]}),t[58]=L,t[59]=B,t[60]=V):V=t[60];let U;t[61]!==I||t[62]!==V?(U=(0,$.jsxs)(`div`,{className:`flex items-center gap-4`,children:[I,V]}),t[61]=I,t[62]=V,t[63]=U):U=t[63];let W;t[64]===i.portraitIntro?W=t[65]:(W=(0,$.jsx)(`p`,{className:`mt-7 max-w-2xl text-base leading-7 text-fg-muted`,children:i.portraitIntro}),t[64]=i.portraitIntro,t[65]=W);let G;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,$.jsx)(`span`,{className:`size-1.5 rounded-full bg-success`}),t[66]=G):G=t[66];let K;t[67]===i.maintainedTogether?K=t[68]:(K=(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[G,i.maintainedTogether]}),t[67]=i.maintainedTogether,t[68]=K);let ee,q;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(ee=()=>d(!0),q=(0,$.jsx)(M,{className:`size-3.5`}),t[69]=ee,t[70]=q):(ee=t[69],q=t[70]);let ne;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,$.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),t[71]=ne):ne=t[71];let re;t[72]===i.advanced?re=t[73]:(re=(0,$.jsx)(`span`,{className:`font-medium text-accent`,children:i.advanced}),t[72]=i.advanced,t[73]=re);let ie;t[74]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,$.jsx)(O,{className:`size-3`}),t[74]=ie):ie=t[74];let ae;t[75]!==i.youDecide||t[76]!==re?(ae=(0,$.jsxs)(`button`,{className:`inline-flex items-center gap-1.5 rounded-md transition-colors hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/30`,onClick:ee,children:[q,i.youDecide,ne,re,ie]}),t[75]=i.youDecide,t[76]=re,t[77]=ae):ae=t[77];let J;t[78]!==K||t[79]!==ae?(J=(0,$.jsxs)(`div`,{className:`mt-6 flex flex-wrap items-center gap-x-5 gap-y-2 text-xs text-fg-subtle`,children:[K,ae]}),t[78]=K,t[79]=ae,t[80]=J):J=t[80];let oe;t[81]!==P||t[82]!==U||t[83]!==W||t[84]!==J?(oe=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[P,U,W,J]}),t[81]=P,t[82]=U,t[83]=W,t[84]=J,t[85]=oe):oe=t[85];let se;t[86]===i.direction?se=t[87]:(se=(0,$.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.12em] text-fg-subtle`,children:i.direction}),t[86]=i.direction,t[87]=se);let ce=`mt-4 text-base leading-7 ${n.profile.primaryGoal.trim()?`text-fg`:`text-fg-muted`}`,le;t[88]!==n.profile.primaryGoal||t[89]!==i.directionEmpty?(le=n.profile.primaryGoal.trim()||i.directionEmpty,t[88]=n.profile.primaryGoal,t[89]=i.directionEmpty,t[90]=le):le=t[90];let Y;t[91]!==ce||t[92]!==le?(Y=(0,$.jsx)(`p`,{className:ce,children:le}),t[91]=ce,t[92]=le,t[93]=Y):Y=t[93];let X;t[94]!==se||t[95]!==Y?(X=(0,$.jsxs)(`div`,{children:[se,Y]}),t[94]=se,t[95]=Y,t[96]=X):X=t[96];let de;t[97]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,$.jsx)(te,{className:`size-4`}),t[97]=de):de=t[97];let fe;t[98]===i.talkAboutMe?fe=t[99]:(fe=(0,$.jsx)(g,{variant:`primary`,asChild:!0,children:(0,$.jsxs)(a,{to:`/chat/new`,children:[de,i.talkAboutMe]})}),t[98]=i.talkAboutMe,t[99]=fe);let pe,me;t[100]===Symbol.for(`react.memo_cache_sentinel`)?(pe=()=>l(!0),me=(0,$.jsx)(ue,{className:`size-4`}),t[100]=pe,t[101]=me):(pe=t[100],me=t[101]);let he;t[102]===i.editProfile?he=t[103]:(he=(0,$.jsxs)(g,{onClick:pe,children:[me,i.editProfile]}),t[102]=i.editProfile,t[103]=he);let ge;t[104]!==fe||t[105]!==he?(ge=(0,$.jsxs)(`div`,{className:`mt-8 flex flex-wrap gap-2`,children:[fe,he]}),t[104]=fe,t[105]=he,t[106]=ge):ge=t[106];let _e;t[107]!==X||t[108]!==ge?(_e=(0,$.jsxs)(`div`,{className:`flex flex-col justify-between rounded-2xl border border-edge bg-surface-base/70 p-5 sm:p-6`,children:[X,ge]}),t[107]=X,t[108]=ge,t[109]=_e):_e=t[109],t[110]!==oe||t[111]!==_e?(S=(0,$.jsxs)(`section`,{className:`relative overflow-hidden rounded-3xl border border-edge bg-surface-panel`,children:[A,(0,$.jsxs)(`div`,{className:`grid gap-8 px-5 py-7 sm:px-8 sm:py-9 lg:grid-cols-[minmax(0,1fr)_20rem] lg:gap-12 lg:px-10 lg:py-11`,children:[oe,_e]})]}),t[110]=oe,t[111]=_e,t[112]=S):S=t[112],y=`grid gap-5 lg:grid-cols-2`;let ve;t[113]===Symbol.for(`react.memo_cache_sentinel`)?(ve=(0,$.jsx)(F,{className:`size-4`}),t[113]=ve):ve=t[113];let ye;t[114]===o?ye=t[115]:(ye=()=>o(`understanding`),t[114]=o,t[115]=ye);let be;t[116]===Symbol.for(`react.memo_cache_sentinel`)?(be=(0,$.jsx)(O,{className:`size-3.5`}),t[116]=be):be=t[116];let xe;t[117]!==i.seeAll||t[118]!==ye?(xe=(0,$.jsxs)(`button`,{className:`inline-flex items-center gap-1 text-xs font-medium text-accent hover:underline`,onClick:ye,children:[i.seeAll,be]}),t[117]=i.seeAll,t[118]=ye,t[119]=xe):xe=t[119];let Z;t[120]!==o||t[121]!==C||t[122]!==i.reviewWaiting?(Z=C?(0,$.jsxs)(`button`,{className:`mb-4 flex w-full items-center justify-between rounded-xl border border-accent/20 bg-accent-soft px-3 py-2.5 text-left text-xs text-accent transition-colors hover:border-accent/40`,onClick:()=>o(`understanding`),children:[(0,$.jsxs)(`span`,{children:[(0,$.jsx)(E,{className:`mr-1.5 inline size-3.5`}),C,` `,i.reviewWaiting]}),(0,$.jsx)(N,{className:`size-3.5`})]}):null,t[120]=o,t[121]=C,t[122]=i.reviewWaiting,t[123]=Z):Z=t[123];let Q=e.length?(0,$.jsx)(`div`,{className:`space-y-1`,children:e.slice(0,4).map(e=>(0,$.jsxs)(`div`,{className:`group flex gap-3 rounded-xl px-2 py-2.5 transition-colors hover:bg-surface-hover`,children:[(0,$.jsx)(`span`,{className:`mt-2 size-1.5 shrink-0 rounded-full bg-accent/70`}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:e.statement}),(0,$.jsx)(`p`,{className:`mt-0.5 text-[11px] text-fg-subtle`,children:je[e.kind][r]})]})]},e.id))}):(0,$.jsx)(`p`,{className:`py-5 text-sm leading-6 text-fg-muted`,children:i.addFirstUnderstanding});t[124]!==i.portraitUnderstanding||t[125]!==i.portraitUnderstandingHint||t[126]!==xe||t[127]!==Z||t[128]!==Q?(b=(0,$.jsxs)(kt,{icon:ve,title:i.portraitUnderstanding,description:i.portraitUnderstandingHint,action:xe,children:[Z,Q]}),t[124]=i.portraitUnderstanding,t[125]=i.portraitUnderstandingHint,t[126]=xe,t[127]=Z,t[128]=Q,t[129]=b):b=t[129],f=kt,t[130]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(H,{className:`size-4`}),t[130]=p):p=t[130],m=i.portraitRules,h=i.portraitRulesHint;let Se;t[131]===o?Se=t[132]:(Se=()=>o(`collaboration`),t[131]=o,t[132]=Se);let Ce;t[133]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=(0,$.jsx)(O,{className:`size-3.5`}),t[133]=Ce):Ce=t[133],t[134]!==i.seeAll||t[135]!==Se?(_=(0,$.jsxs)(`button`,{className:`inline-flex items-center gap-1 text-xs font-medium text-accent hover:underline`,onClick:Se,children:[i.seeAll,Ce]}),t[134]=i.seeAll,t[135]=Se,t[136]=_):_=t[136],v=w.length?(0,$.jsx)(`div`,{className:`space-y-1`,children:w.slice(0,4).map(e=>(0,$.jsxs)(`div`,{className:`flex gap-3 rounded-xl px-2 py-2.5 transition-colors hover:bg-surface-hover`,children:[(0,$.jsx)(`span`,{className:`mt-2 size-1.5 shrink-0 rounded-full bg-fg-subtle`}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:e.statement}),(0,$.jsx)(`p`,{className:`mt-0.5 text-[11px] text-fg-subtle`,children:dt[e.category][r]})]})]},e.id))}):(0,$.jsx)(`p`,{className:`py-5 text-sm leading-6 text-fg-muted`,children:i.addFirstRule}),t[0]=n.focuses,t[1]=n.profile.callName,t[2]=n.profile.primaryGoal,t[3]=n.profile.role,t[4]=n.rules,t[5]=n.understandings,t[6]=r,t[7]=o,t[8]=i.addFirstRule,t[9]=i.addFirstUnderstanding,t[10]=i.advanced,t[11]=i.direction,t[12]=i.directionEmpty,t[13]=i.editProfile,t[14]=i.maintainedTogether,t[15]=i.portraitEyebrow,t[16]=i.portraitIntro,t[17]=i.portraitRules,t[18]=i.portraitRulesHint,t[19]=i.portraitUnderstanding,t[20]=i.portraitUnderstandingHint,t[21]=i.reviewWaiting,t[22]=i.roleMissing,t[23]=i.seeAll,t[24]=i.talkAboutMe,t[25]=i.youDecide,t[26]=f,t[27]=p,t[28]=m,t[29]=h,t[30]=_,t[31]=v,t[32]=y,t[33]=b,t[34]=x,t[35]=S}else f=t[26],p=t[27],m=t[28],h=t[29],_=t[30],v=t[31],y=t[32],b=t[33],x=t[34],S=t[35];let C;t[137]!==f||t[138]!==p||t[139]!==m||t[140]!==h||t[141]!==_||t[142]!==v?(C=(0,$.jsx)(f,{icon:p,title:m,description:h,action:_,children:v}),t[137]=f,t[138]=p,t[139]=m,t[140]=h,t[141]=_,t[142]=v,t[143]=C):C=t[143];let w;t[144]!==C||t[145]!==y||t[146]!==b?(w=(0,$.jsxs)(`div`,{className:y,children:[b,C]}),t[144]=C,t[145]=y,t[146]=b,t[147]=w):w=t[147];let T;t[148]===Symbol.for(`react.memo_cache_sentinel`)?(T=()=>d(!0),t[148]=T):T=t[148];let D;t[149]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,$.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-xl bg-surface-muted text-fg-muted`,children:(0,$.jsx)(z,{className:`size-4`})}),t[149]=D):D=t[149];let k;t[150]===i.portraitLearn?k=t[151]:(k=(0,$.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:i.portraitLearn}),t[150]=i.portraitLearn,t[151]=k);let A;t[152]===i.portraitControlHint?A=t[153]:(A=(0,$.jsx)(`span`,{className:`mt-0.5 block text-xs leading-5 text-fg-muted`,children:i.portraitControlHint}),t[152]=i.portraitControlHint,t[153]=A);let j;t[154]!==k||t[155]!==A?(j=(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[k,A]}),t[154]=k,t[155]=A,t[156]=j):j=t[156];let P;t[157]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,$.jsx)(O,{className:`size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5`}),t[157]=P):P=t[157];let I;t[158]===j?I=t[159]:(I=(0,$.jsxs)(`button`,{className:`group flex w-full items-center gap-4 rounded-2xl border border-edge bg-surface-panel px-5 py-4 text-left transition-colors hover:bg-surface-hover sm:px-6`,onClick:T,children:[D,j,P]}),t[158]=j,t[159]=I);let L;t[160]!==n.profile||t[161]!==c||t[162]!==r||t[163]!==s||t[164]!==i?(L=(0,$.jsx)(jt,{open:c,onOpenChange:l,profile:n.profile,language:r,t:i,onChanged:s}),t[160]=n.profile,t[161]=c,t[162]=r,t[163]=s,t[164]=i,t[165]=L):L=t[165];let R;t[166]===o?R=t[167]:(R=e=>{d(!1),o(e)},t[166]=o,t[167]=R);let B;t[168]!==u||t[169]!==i||t[170]!==R?(B=(0,$.jsx)(At,{open:u,onOpenChange:d,t:i,onNavigate:R}),t[168]=u,t[169]=i,t[170]=R,t[171]=B):B=t[171];let V;return t[172]!==w||t[173]!==I||t[174]!==L||t[175]!==B||t[176]!==x||t[177]!==S?(V=(0,$.jsxs)(`div`,{className:x,children:[S,w,I,L,B]}),t[172]=w,t[173]=I,t[174]=L,t[175]=B,t[176]=x,t[177]=S,t[178]=V):V=t[178],V}function Tt(e){return e.status===`active`}function Et(e){return e.status===`candidate`}function Dt(e){return[`candidate`,`needs_review`,`stale`].includes(e.status)}function Ot(e){return e.status===`active`}function kt(e){let t=(0,Q.c)(20),{icon:n,title:r,description:i,action:a,children:o}=e,s;t[0]===n?s=t[1]:(s=(0,$.jsx)(`span`,{className:`mt-0.5 flex size-8 shrink-0 items-center justify-center rounded-xl bg-surface-muted text-fg-muted`,children:n}),t[0]=n,t[1]=s);let c;t[2]===r?c=t[3]:(c=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:r}),t[2]=r,t[3]=c);let l;t[4]!==a||t[5]!==c?(l=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[c,a]}),t[4]=a,t[5]=c,t[6]=l):l=t[6];let u;t[7]===i?u=t[8]:(u=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:i}),t[7]=i,t[8]=u);let d;t[9]!==l||t[10]!==u?(d=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[l,u]}),t[9]=l,t[10]=u,t[11]=d):d=t[11];let f;t[12]!==s||t[13]!==d?(f=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[s,d]}),t[12]=s,t[13]=d,t[14]=f):f=t[14];let p;t[15]===o?p=t[16]:(p=(0,$.jsx)(`div`,{className:`mt-4 border-t border-edge pt-3`,children:o}),t[15]=o,t[16]=p);let m;return t[17]!==f||t[18]!==p?(m=(0,$.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-panel p-5 sm:p-6`,children:[f,p]}),t[17]=f,t[18]=p,t[19]=m):m=t[19],m}function At(e){let t=(0,Q.c)(47),{open:n,onOpenChange:r,t:i,onNavigate:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsx)(P,{className:`size-4`}),t[0]=o):o=t[0];let s;t[1]!==i.controlSourcesHint||t[2]!==i.sources?(s={tab:`sources`,icon:o,label:i.sources,description:i.controlSourcesHint},t[1]=i.controlSourcesHint,t[2]=i.sources,t[3]=s):s=t[3];let c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(J,{className:`size-4`}),t[4]=c):c=t[4];let l;t[5]!==i.controlReviewHint||t[6]!==i.dreaming?(l={tab:`dreaming`,icon:c,label:i.dreaming,description:i.controlReviewHint},t[5]=i.controlReviewHint,t[6]=i.dreaming,t[7]=l):l=t[7];let u;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,$.jsx)(M,{className:`size-4`}),t[8]=u):u=t[8];let d;t[9]!==i.controlPrivacyHint||t[10]!==i.privacy?(d={tab:`privacy`,icon:u,label:i.privacy,description:i.controlPrivacyHint},t[9]=i.controlPrivacyHint,t[10]=i.privacy,t[11]=d):d=t[11];let f;t[12]!==s||t[13]!==l||t[14]!==d?(f=[s,l,d],t[12]=s,t[13]=l,t[14]=d,t[15]=f):f=t[15];let p=f,m;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(v,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),t[16]=m):m=t[16];let _;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(`div`,{className:`mb-3 flex size-9 items-center justify-center rounded-xl bg-accent-soft text-accent`,children:(0,$.jsx)(z,{className:`size-4`})}),t[17]=_):_=t[17];let T;t[18]===i.portraitControl?T=t[19]:(T=(0,$.jsx)(C,{className:`text-lg font-semibold tracking-tight text-fg`,children:i.portraitControl}),t[18]=i.portraitControl,t[19]=T);let E;t[20]===i.portraitControlHint?E=t[21]:(E=(0,$.jsx)(y,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:i.portraitControlHint}),t[20]=i.portraitControlHint,t[21]=E);let D;t[22]!==T||t[23]!==E?(D=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[_,T,E]}),t[22]=T,t[23]=E,t[24]=D):D=t[24];let k;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,$.jsx)(h,{className:`size-4`}),t[25]=k):k=t[25];let A;t[26]===i.cancel?A=t[27]:(A=(0,$.jsx)(b,{asChild:!0,children:(0,$.jsx)(g,{variant:`ghost`,className:`size-8 shrink-0 p-0`,"aria-label":i.cancel,children:k})}),t[26]=i.cancel,t[27]=A);let j;t[28]!==D||t[29]!==A?(j=(0,$.jsxs)(`header`,{className:`flex shrink-0 items-start justify-between gap-4 border-b border-edge px-5 py-5 sm:px-6 sm:py-6`,children:[D,A]}),t[28]=D,t[29]=A,t[30]=j):j=t[30];let N;t[31]!==p||t[32]!==a?(N=(0,$.jsx)(`div`,{className:`space-y-3`,children:p.map(e=>(0,$.jsxs)(`button`,{className:`group flex w-full items-start gap-4 rounded-2xl border border-edge bg-surface-base p-4 text-left transition-colors hover:border-edge-strong hover:bg-surface-hover`,onClick:()=>a(e.tab),children:[(0,$.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-xl bg-surface-muted text-fg-muted transition-colors group-hover:text-accent`,children:e.icon}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.label}),(0,$.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:e.description})]}),(0,$.jsx)(O,{className:`mt-2.5 size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5`})]},e.tab))}),t[31]=p,t[32]=a,t[33]=N):N=t[33];let F;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,$.jsx)(M,{className:`mt-0.5 size-4 shrink-0 text-success`}),t[34]=F):F=t[34];let I;t[35]===i.controlTrust?I=t[36]:(I=(0,$.jsxs)(`div`,{className:`mt-6 flex gap-3 rounded-2xl bg-surface-muted p-4`,children:[F,(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:i.controlTrust})]}),t[35]=i.controlTrust,t[36]=I);let L;t[37]!==N||t[38]!==I?(L=(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-4 sm:p-6`,children:[N,I]}),t[37]=N,t[38]=I,t[39]=L):L=t[39];let R;t[40]!==j||t[41]!==L?(R=(0,$.jsxs)(x,{children:[m,(0,$.jsx)(S,{className:`fixed inset-y-0 right-0 z-[90] h-full w-[min(30rem,100vw)] overflow-hidden border-l border-edge bg-surface-panel shadow-popover outline-none sm:rounded-l-2xl`,children:(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[j,L]})})]}),t[40]=j,t[41]=L,t[42]=R):R=t[42];let B;return t[43]!==r||t[44]!==n||t[45]!==R?(B=(0,$.jsx)(w,{open:n,onOpenChange:r,children:R}),t[43]=r,t[44]=n,t[45]=R,t[46]=B):B=t[46],B}function jt(e){let t=(0,Q.c)(26),{open:n,onOpenChange:r,profile:i,language:a,t:o,onChanged:s}=e,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(v,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),t[0]=c):c=t[0];let l;t[1]===o.editProfile?l=t[2]:(l=(0,$.jsx)(C,{className:`text-base font-semibold text-fg`,children:o.editProfile}),t[1]=o.editProfile,t[2]=l);let u;t[3]===o.profileHint?u=t[4]:(u=(0,$.jsx)(y,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:o.profileHint}),t[3]=o.profileHint,t[4]=u);let d;t[5]!==l||t[6]!==u?(d=(0,$.jsxs)(`div`,{children:[l,u]}),t[5]=l,t[6]=u,t[7]=d):d=t[7];let f;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsx)(h,{className:`size-4`}),t[8]=f):f=t[8];let p;t[9]===o.cancel?p=t[10]:(p=(0,$.jsx)(b,{asChild:!0,children:(0,$.jsx)(g,{variant:`ghost`,className:`size-8 shrink-0 p-0`,"aria-label":o.cancel,children:f})}),t[9]=o.cancel,t[10]=p);let m;t[11]!==d||t[12]!==p?(m=(0,$.jsxs)(`header`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge px-5 py-4 sm:px-6`,children:[d,p]}),t[11]=d,t[12]=p,t[13]=m):m=t[13];let _;t[14]!==a||t[15]!==s||t[16]!==i||t[17]!==o?(_=(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5 sm:p-6`,children:(0,$.jsx)(Mt,{profile:i,language:a,t:o,onChanged:s,bare:!0})}),t[14]=a,t[15]=s,t[16]=i,t[17]=o,t[18]=_):_=t[18];let T;t[19]!==m||t[20]!==_?(T=(0,$.jsxs)(x,{children:[c,(0,$.jsx)(S,{className:`fixed left-1/2 top-1/2 z-[90] h-[min(42rem,calc(100vh-2rem))] w-[min(44rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`,children:(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[m,_]})})]}),t[19]=m,t[20]=_,t[21]=T):T=t[21];let E;return t[22]!==r||t[23]!==n||t[24]!==T?(E=(0,$.jsx)(w,{open:n,onOpenChange:r,children:T}),t[22]=r,t[23]=n,t[24]=T,t[25]=E):E=t[25],E}function Mt(e){let t=(0,Q.c)(80),{profile:n,language:r,t:i,onChanged:a,bare:o}=e,s=o===void 0?!1:o,c;t[0]===n?c=t[1]:(c=_t(n),t[0]=n,t[1]=c);let l=c,[u,d]=gt(l),f;t[2]===u?f=t[3]:(f=ht(u),t[2]=u,t[3]=f);let p;t[4]===l?p=t[5]:(p=ht(l),t[4]=l,t[5]=p);let m=f!==p,h;t[6]!==a||t[7]!==n?(h=async e=>{await a((await ae({...e,accessibility:n.accessibility})).profile)},t[6]=a,t[7]=n,t[8]=h):h=t[8];let _;t[9]!==u||t[10]!==m||t[11]!==h?(_={value:u,dirty:m,delayMs:500,onSave:h},t[9]=u,t[10]=m,t[11]=h,t[12]=_):_=t[12];let v=ye(_),y;t[13]!==u||t[14]!==d?(y=(e,t,n)=>(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:t}),(0,$.jsx)(`input`,{className:lt,placeholder:n,value:u[e],onChange:t=>d(n=>({...n,[e]:t.target.value}))})]}),t[13]=u,t[14]=d,t[15]=y):y=t[15];let b=y,x=v.onBlurCapture,S;t[16]!==b||t[17]!==i.callName||t[18]!==i.callNamePlaceholder?(S=b(`callName`,i.callName,i.callNamePlaceholder),t[16]=b,t[17]=i.callName,t[18]=i.callNamePlaceholder,t[19]=S):S=t[19];let C;t[20]!==b||t[21]!==i.role||t[22]!==i.rolePlaceholder?(C=b(`role`,i.role,i.rolePlaceholder),t[20]=b,t[21]=i.role,t[22]=i.rolePlaceholder,t[23]=C):C=t[23];let w;t[24]===i.primaryGoal?w=t[25]:(w=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:i.primaryGoal}),t[24]=i.primaryGoal,t[25]=w);let T;t[26]===d?T=t[27]:(T=e=>d(t=>({...t,primaryGoal:e.target.value})),t[26]=d,t[27]=T);let E;t[28]!==u.primaryGoal||t[29]!==i.primaryGoalPlaceholder||t[30]!==T?(E=(0,$.jsx)(`textarea`,{className:lt,rows:3,placeholder:i.primaryGoalPlaceholder,value:u.primaryGoal,onChange:T}),t[28]=u.primaryGoal,t[29]=i.primaryGoalPlaceholder,t[30]=T,t[31]=E):E=t[31];let D;t[32]!==w||t[33]!==E?(D=(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm sm:col-span-2`,children:[w,E]}),t[32]=w,t[33]=E,t[34]=D):D=t[34];let O;t[35]!==b||t[36]!==r||t[37]!==i.pronouns||t[38]!==i.pronounsPlaceholder?(O=r===`en`?b(`pronouns`,i.pronouns,i.pronounsPlaceholder):null,t[35]=b,t[36]=r,t[37]=i.pronouns,t[38]=i.pronounsPlaceholder,t[39]=O):O=t[39];let k;t[40]===i.timezone?k=t[41]:(k=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:i.timezone}),t[40]=i.timezone,t[41]=k);let A;t[42]===d?A=t[43]:(A=e=>d(t=>({...t,timezone:e.target.value})),t[42]=d,t[43]=A);let j;t[44]!==u.timezone||t[45]!==A?(j=(0,$.jsx)(`input`,{className:`${lt} min-w-0 flex-1`,value:u.timezone,onChange:A}),t[44]=u.timezone,t[45]=A,t[46]=j):j=t[46];let M;t[47]===d?M=t[48]:(M=()=>d(Nt),t[47]=d,t[48]=M);let N;t[49]!==i.detect||t[50]!==M?(N=(0,$.jsx)(g,{className:`shrink-0 whitespace-nowrap`,onClick:M,children:i.detect}),t[49]=i.detect,t[50]=M,t[51]=N):N=t[51];let P;t[52]!==j||t[53]!==N?(P=(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[j,N]}),t[52]=j,t[53]=N,t[54]=P):P=t[54];let F;t[55]!==k||t[56]!==P?(F=(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[k,P]}),t[55]=k,t[56]=P,t[57]=F):F=t[57];let I;t[58]!==b||t[59]!==i.locale?(I=b(`locale`,i.locale),t[58]=b,t[59]=i.locale,t[60]=I):I=t[60];let L;t[61]!==S||t[62]!==C||t[63]!==D||t[64]!==O||t[65]!==F||t[66]!==I?(L=(0,$.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[S,C,D,O,F,I]}),t[61]=S,t[62]=C,t[63]=D,t[64]=O,t[65]=F,t[66]=I,t[67]=L):L=t[67];let R;t[68]!==v.error||t[69]!==v.status?(R=(0,$.jsx)(`div`,{className:`mt-5 flex justify-end`,children:(0,$.jsx)(ve,{status:v.status,error:v.error})}),t[68]=v.error,t[69]=v.status,t[70]=R):R=t[70];let z;t[71]!==v.onBlurCapture||t[72]!==L||t[73]!==R?(z=(0,$.jsxs)(`div`,{onBlurCapture:x,children:[L,R]}),t[71]=v.onBlurCapture,t[72]=L,t[73]=R,t[74]=z):z=t[74];let B=z;if(s)return B;let V;t[75]===i.profileHint?V=t[76]:(V=(0,$.jsx)(`p`,{className:`mb-5 text-sm leading-6 text-fg-muted`,children:i.profileHint}),t[75]=i.profileHint,t[76]=V);let H;return t[77]!==B||t[78]!==V?(H=(0,$.jsxs)(ft,{children:[V,B]}),t[77]=B,t[78]=V,t[79]=H):H=t[79],H}function Nt(e){return{...e,timezone:ie()}}function Pt(e){let t=(0,Q.c)(80),{rules:n,language:r,t:i,onChanged:a}=e,[o,l]=(0,Z.useState)(!1),[u,d]=(0,Z.useState)(``),[f,p]=(0,Z.useState)(`communication`),[h,_]=(0,Z.useState)(null),v,y,b,x,S,C;if(t[0]!==o||t[1]!==f||t[2]!==h||t[3]!==r||t[4]!==a||t[5]!==n||t[6]!==u||t[7]!==i.add||t[8]!==i.addRule||t[9]!==i.cancel||t[10]!==i.category||t[11]!==i.collaboration||t[12]!==i.confirmDelete||t[13]!==i.delete||t[14]!==i.disable||t[15]!==i.emptyRules||t[16]!==i.enable||t[17]!==i.ruleStatement||t[18]!==i.rulesHint){let e=n.filter(Ft),w;t[25]!==f||t[26]!==a||t[27]!==u?(w=async e=>{e.preventDefault(),u.trim()&&(await q({statement:u,category:f}),d(``),l(!1),await a())},t[25]=f,t[26]=a,t[27]=u,t[28]=w):w=t[28];let T=w;x=`space-y-5`;let E;t[29]===i.rulesHint?E=t[30]:(E=(0,$.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:i.rulesHint}),t[29]=i.rulesHint,t[30]=E);let D,O;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(O=()=>l(!0),D=(0,$.jsx)(m,{className:`size-4`}),t[31]=D,t[32]=O):(D=t[31],O=t[32]);let k;t[33]===i.addRule?k=t[34]:(k=(0,$.jsxs)(g,{variant:`primary`,onClick:O,children:[D,i.addRule]}),t[33]=i.addRule,t[34]=k),t[35]!==k||t[36]!==E?(S=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[E,k]}),t[35]=k,t[36]=E,t[37]=S):S=t[37];let A=i.addRule,j=i.rulesHint,M=i.add,N=i.cancel,P;t[38]===u?P=t[39]:(P=u.trim(),t[38]=u,t[39]=P);let F=!P,I;t[40]===i.ruleStatement?I=t[41]:(I=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:i.ruleStatement}),t[40]=i.ruleStatement,t[41]=I);let L;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(L=e=>d(e.target.value),t[42]=L):L=t[42];let R;t[43]!==u||t[44]!==i.ruleStatement?(R=(0,$.jsx)(`textarea`,{autoFocus:!0,className:lt,rows:4,placeholder:i.ruleStatement,value:u,onChange:L}),t[43]=u,t[44]=i.ruleStatement,t[45]=R):R=t[45];let z;t[46]!==I||t[47]!==R?(z=(0,$.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[I,R]}),t[46]=I,t[47]=R,t[48]=z):z=t[48];let B;t[49]===i.category?B=t[50]:(B=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:i.category}),t[49]=i.category,t[50]=B);let H,U;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(H=e=>p(e.target.value),U=Object.entries(dt),t[51]=H,t[52]=U):(H=t[51],U=t[52]);let W;t[53]===r?W=t[54]:(W=U.map(e=>{let[t,n]=e;return(0,$.jsx)(c,{value:t,children:n[r]},t)}),t[53]=r,t[54]=W);let G;t[55]!==f||t[56]!==W?(G=(0,$.jsx)(s,{value:f,onChange:H,children:W}),t[55]=f,t[56]=W,t[57]=G):G=t[57];let K;t[58]!==B||t[59]!==G?(K=(0,$.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[B,G]}),t[58]=B,t[59]=G,t[60]=K):K=t[60],t[61]!==o||t[62]!==T||t[63]!==i.add||t[64]!==i.addRule||t[65]!==i.cancel||t[66]!==i.rulesHint||t[67]!==F||t[68]!==z||t[69]!==K?(C=(0,$.jsxs)(mt,{open:o,onOpenChange:l,title:A,description:j,submitLabel:M,cancelLabel:N,submitDisabled:F,onSubmit:T,children:[z,K]}),t[61]=o,t[62]=T,t[63]=i.add,t[64]=i.addRule,t[65]=i.cancel,t[66]=i.rulesHint,t[67]=F,t[68]=z,t[69]=K,t[70]=C):C=t[70],v=`space-y-2`,y=(0,$.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[i.collaboration,` · `,e.length]}),b=e.length?(0,$.jsx)(`div`,{className:`divide-y divide-edge overflow-hidden rounded-2xl border border-edge bg-surface-panel`,children:e.map(e=>(0,$.jsxs)(`article`,{className:`flex flex-col gap-2 px-4 py-3 sm:flex-row sm:items-start sm:gap-4 sm:px-5`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`p`,{className:`text-sm leading-6 ${e.status===`disabled`?`text-fg-subtle line-through`:`text-fg`}`,children:e.statement}),(0,$.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-2 text-[11px] text-fg-subtle`,children:[(0,$.jsx)(`span`,{children:dt[e.category][r]}),(0,$.jsx)(`span`,{children:`·`}),(0,$.jsxs)(`span`,{children:[`P`,e.priority]}),e.status===`disabled`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{children:`·`}),(0,$.jsx)(`span`,{children:i.disable})]}):null]})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-1 sm:justify-end`,children:[(0,$.jsx)(g,{variant:`ghost`,onClick:async()=>{await V(e.id,{status:e.status===`active`?`disabled`:`active`}),await a()},children:e.status===`active`?i.disable:i.enable}),(0,$.jsxs)(g,{variant:`ghost`,className:`text-danger`,onClick:async()=>{if(h!==e.id){_(e.id);return}await se(e.id),_(null),await a()},children:[(0,$.jsx)(re,{className:`size-3.5`}),h===e.id?i.confirmDelete:i.delete]})]})]},e.id))}):(0,$.jsx)(pt,{children:i.emptyRules}),t[0]=o,t[1]=f,t[2]=h,t[3]=r,t[4]=a,t[5]=n,t[6]=u,t[7]=i.add,t[8]=i.addRule,t[9]=i.cancel,t[10]=i.category,t[11]=i.collaboration,t[12]=i.confirmDelete,t[13]=i.delete,t[14]=i.disable,t[15]=i.emptyRules,t[16]=i.enable,t[17]=i.ruleStatement,t[18]=i.rulesHint,t[19]=v,t[20]=y,t[21]=b,t[22]=x,t[23]=S,t[24]=C}else v=t[19],y=t[20],b=t[21],x=t[22],S=t[23],C=t[24];let w;t[71]!==v||t[72]!==y||t[73]!==b?(w=(0,$.jsxs)(`section`,{className:v,children:[y,b]}),t[71]=v,t[72]=y,t[73]=b,t[74]=w):w=t[74];let T;return t[75]!==x||t[76]!==S||t[77]!==C||t[78]!==w?(T=(0,$.jsxs)(`div`,{className:x,children:[S,C,w]}),t[75]=x,t[76]=S,t[77]=C,t[78]=w,t[79]=T):T=t[79],T}function Ft(e){return e.status!==`archived`}async function It(){let[e,t,n]=await Promise.all([de(),R(),A()]);return{...e,connectors:t,catalog:n}}function Lt({t:e}){let{data:t,error:n,isLoading:r,mutate:i}=T(`you-understanding-sources`,It,{refreshInterval:5e3}),{data:o=[],mutate:s}=T(`you-connected-content-candidates`,ne),[c,l]=(0,Z.useState)(null),[d,f]=(0,Z.useState)(null),[m,h]=(0,Z.useState)(null),[_,v]=(0,Z.useState)([]),[y,b]=(0,Z.useState)(!1),[x,S]=(0,Z.useState)(null);if(r)return(0,$.jsx)(U,{className:`h-64 rounded-2xl`});if(n)return(0,$.jsxs)(pt,{children:[e.error,` `,(0,$.jsx)(`button`,{className:`text-accent hover:underline`,onClick:()=>void i(),children:e.retry})]});let C=t?.grants??[],w=t?.connectors??[],E=new Map((t?.catalog??[]).map(e=>[e.id,e])),k=t?.latestRuns??{},A=t=>t?t.status===`completed`?e.sourceCompleted:t.status===`partial`?e.sourcePartial:t.status===`failed`||t.status===`canceled`?e.sourceFailed:t.status===`running`?e.sourceRunning:e.sourceQueued:e.sourceNotRun,j=e=>e?e.status===`completed`?`bg-success-soft text-success`:e.status===`partial`?`bg-warning-soft text-warning`:e.status===`failed`||e.status===`canceled`?`bg-danger/10 text-danger`:`bg-accent-soft text-accent-fg`:`bg-surface-muted text-fg-muted`,M=t=>t===`connected_account_unavailable`?e.sourceAccountUnavailable:t===`connected_source_sync_failed`?e.sourceSyncFailed:t===`connected_source_analysis_failed`?e.sourceAnalysisFailed:t,N=e=>{let t=e.displayName.trim().toLocaleLowerCase(),n=w.find(e=>e.displayName.trim().toLocaleLowerCase()===t);return n?E.get(n.connectorId):[...E.values()].find(n=>n.displayName.trim().toLocaleLowerCase()===t||e.sourceKey.toLocaleLowerCase().includes(n.id.toLocaleLowerCase()))},P=t=>`${e.actionFailed}: ${t instanceof Error?t.message:String(t)}`,F=async t=>{S(null),f(null),l({grantId:t.id,kind:`refresh`});try{await D(t.id),await i().catch(()=>void 0),S({tone:`success`,message:`${t.displayName}: ${e.refreshStarted}`})}catch(e){S({tone:`error`,message:P(e)})}finally{l(null)}},I=async(t,n)=>{if(d!==t.id){try{let e=await ge(t.id);f(t.id),h({grantId:t.id,impact:e.impact}),S(null)}catch(e){S({tone:`error`,message:P(e)})}return}if(n){l({grantId:t.id,kind:`revoke`});try{await fe(t.id,{derived:n,raw:`delete`}),await i().catch(()=>void 0),f(null),h(null),S({tone:`success`,message:`${t.displayName}: ${e.revokeDone}`})}catch(e){S({tone:`error`,message:P(e)})}finally{l(null)}}},L=async()=>{if(_.length){b(!0),S(null);try{let t=await B(_);t.result.failed.length?S({tone:`error`,message:t.result.failed.map(e=>e.error).join(`; `)}):S({tone:`success`,message:e.contentReadDone}),v([]),await s()}catch(e){S({tone:`error`,message:P(e)})}finally{b(!1)}}};return(0,$.jsxs)(`div`,{className:`space-y-5`,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,$.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:e.sourcesHint}),(0,$.jsx)(g,{asChild:!0,variant:`primary`,children:(0,$.jsxs)(a,{to:`/connectors?understanding=1&returnTo=%2Fyou%3Ftab%3Dsources`,children:[e.manageSources,(0,$.jsx)(u,{className:`size-4`})]})})]}),x?(0,$.jsx)(`p`,{role:`status`,"aria-live":`polite`,className:`rounded-xl px-3 py-2 text-sm ${x.tone===`success`?`bg-success-soft text-success`:`bg-danger/10 text-danger`}`,children:x.message}):null,(0,$.jsxs)(`section`,{className:`space-y-2`,children:[(0,$.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[e.authorizedSources,` · `,C.length]}),C.length?(0,$.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:C.map(t=>{let n=N(t),r=k[t.id],i=typeof r?.metadata.candidatesCreated==`number`?r.metadata.candidatesCreated:0,a=M(r?.errorMessage??(typeof r?.metadata.semanticError==`string`?r.metadata.semanticError:void 0));return(0,$.jsxs)(`article`,{className:`flex min-h-28 flex-wrap items-start gap-3 rounded-2xl border border-edge bg-surface-panel p-4`,children:[n?(0,$.jsx)(pe,{connector:n,size:`sm`}):(0,$.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg border border-edge bg-surface-base`,children:(0,$.jsx)(ce,{className:`size-4 text-fg-muted`})}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,$.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:t.displayName}),(0,$.jsx)(`span`,{className:`shrink-0 rounded-full px-2 py-0.5 text-[11px] ${j(r)}`,children:A(r)})]}),(0,$.jsxs)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:[t.accessMode===`continuous`?e.continuous:e.once,` · `,t.processingPolicy===`local_only`?e.localOnly:t.retentionPolicy===`derived_only`?e.derivedOnly:t.retentionPolicy]}),r?(0,$.jsxs)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:[r.itemsSeen,` `,e.sourceItems,i?` · ${i} ${e.sourceCandidates}`:``,` · `,new Date(r.completedAt??r.startedAt).toLocaleString()]}):t.lastCollectedAt?(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:new Date(t.lastCollectedAt).toLocaleString()}):null,a?(0,$.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-danger`,title:a,children:a}):null]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-1`,children:[t.accessMode===`continuous`?(0,$.jsx)(g,{variant:`ghost`,disabled:c!==null,"aria-busy":c?.grantId===t.id&&c.kind===`refresh`,onClick:()=>void F(t),children:c?.grantId===t.id&&c.kind===`refresh`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(p,{className:`size-4 animate-spin`}),e.refreshing]}):e.refresh}):null,(0,$.jsx)(g,{variant:`ghost`,className:`text-danger`,title:e.revokeHint,"aria-label":`${e.revoke}: ${t.displayName}`,disabled:c!==null,"aria-busy":c?.grantId===t.id&&c.kind===`revoke`,onClick:()=>{d===t.id?(f(null),h(null)):I(t)},children:c?.grantId===t.id&&c.kind===`revoke`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(p,{className:`size-4 animate-spin`}),e.revoking]}):d===t.id?e.cancel:e.revoke})]}),m?.grantId===t.id?(0,$.jsxs)(`div`,{className:`basis-full rounded-xl border border-edge bg-surface-base p-3`,children:[(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:e.revokeImpact.replace(`{{count}}`,String(m.impact.derivedCount))}),(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap justify-end gap-2`,children:[(0,$.jsx)(g,{variant:`ghost`,onClick:()=>{f(null),h(null)},children:e.cancel}),(0,$.jsx)(g,{variant:`ghost`,onClick:()=>void I(t,`retain`),children:e.retainDerived}),(0,$.jsx)(g,{variant:`primary`,onClick:()=>void I(t,`delete`),children:e.deleteDerived})]})]}):null]},t.id)})}):(0,$.jsx)(pt,{children:e.noSources})]}),o.length?(0,$.jsxs)(`section`,{className:`space-y-2`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.contentReadTitle}),(0,$.jsx)(`p`,{className:`mt-1 max-w-2xl text-xs leading-5 text-fg-muted`,children:e.contentReadHint})]}),(0,$.jsx)(g,{variant:`primary`,disabled:!_.length||y,onClick:()=>void L(),children:y?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(p,{className:`size-4 animate-spin`}),e.reading]}):`${e.readSelected} · ${_.length}`})]}),(0,$.jsx)(`div`,{className:`divide-y divide-edge overflow-hidden rounded-2xl border border-edge bg-surface-panel`,children:o.map(e=>{let t=_.includes(e.sourceItemId),n=_.length>=5&&!t;return(0,$.jsxs)(`label`,{className:`flex items-center gap-3 px-4 py-3 ${n?`opacity-50`:`cursor-pointer hover:bg-surface-hover`}`,children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`size-4 rounded border-edge accent-[var(--color-accent)]`,checked:t,disabled:n||y,onChange:t=>v(n=>t.target.checked?[...n,e.sourceItemId]:n.filter(t=>t!==e.sourceItemId))}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`p`,{className:`truncate text-sm text-fg`,children:e.title}),(0,$.jsxs)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:[e.toolkit===`gmail`?`Gmail`:`Google Drive`,e.occurredAt?` · ${new Date(e.occurredAt).toLocaleDateString()}`:``]})]})]},e.sourceItemId)})})]}):null,(0,$.jsxs)(`section`,{className:`space-y-2`,children:[(0,$.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[e.connectorsTitle,` · `,w.length]}),w.length?(0,$.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:w.map(t=>{let n=t.enabled&&(t.status===`connected`||t.connectionStatus===`connected`||t.authStatus===`connected`),r=E.get(t.connectorId);return(0,$.jsxs)(a,{to:`/connectors?tab=connected&instance=${encodeURIComponent(t.instanceId)}`,"aria-label":`${e.openConnector}: ${t.displayName}`,className:`group flex min-h-24 items-center gap-3 rounded-2xl border border-edge bg-surface-panel p-4 transition-colors hover:border-edge-strong hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,children:[(0,$.jsx)(pe,{connector:r??{displayName:t.displayName}}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:t.displayName}),(0,$.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:t.connectorId})]}),(0,$.jsx)(`span`,{className:`shrink-0 rounded-full px-2 py-1 text-xs ${n?`bg-success-soft text-success`:`bg-warning-soft text-warning`}`,children:n?e.connected:e.unavailable}),(0,$.jsx)(O,{className:`size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5`})]},t.instanceId)})}):(0,$.jsx)(pt,{children:e.noConnectors})]})]})}function Rt(e){let t=(0,Q.c)(115),{lastRun:n,t:r}=e,{data:i,error:a,isLoading:o,mutate:l}=T(`you-context-settings`,me),u=i?.dreaming??null,[d,f]=gt(u),p;t[0]!==d||t[1]!==u?(p=d&&u&&ht(d)!==ht(u),t[0]=d,t[1]=u,t[2]=p):p=t[2];let m=!!p,h;t[3]===l?h=t[4]:(h=async e=>{await k({dreaming:e}),await l()},t[3]=l,t[4]=h);let _;t[5]!==d||t[6]!==m||t[7]!==h?(_={value:d,dirty:m,delayMs:500,onSave:h},t[5]=d,t[6]=m,t[7]=h,t[8]=_):_=t[8];let v=ye(_);if(a){let e;t[9]===l?e=t[10]:(e=()=>void l(),t[9]=l,t[10]=e);let n;t[11]!==r.retry||t[12]!==e?(n=(0,$.jsx)(`button`,{className:`text-accent hover:underline`,onClick:e,children:r.retry}),t[11]=r.retry,t[12]=e,t[13]=n):n=t[13];let i;return t[14]!==r.error||t[15]!==n?(i=(0,$.jsxs)(pt,{children:[r.error,` `,n]}),t[14]=r.error,t[15]=n,t[16]=i):i=t[16],i}if(o||!d){let e;return t[17]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(U,{className:`h-72 rounded-2xl`}),t[17]=e):e=t[17],e}let y=n?.status===`completed`?r.runCompleted:n?.status===`failed`?r.runFailed:r.runRunning,b;t[18]===r.dreamingHint?b=t[19]:(b=(0,$.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:r.dreamingHint}),t[18]=r.dreamingHint,t[19]=b);let x=v.onBlurCapture,S;t[20]===r.mode?S=t[21]:(S=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:r.mode}),t[20]=r.mode,t[21]=S);let C;t[22]===f?C=t[23]:(C=e=>f(t=>t&&{...t,mode:e.target.value}),t[22]=f,t[23]=C);let w;t[24]===r.on?w=t[25]:(w=(0,$.jsx)(c,{value:`review`,children:r.on}),t[24]=r.on,t[25]=w);let E;t[26]===r.off?E=t[27]:(E=(0,$.jsx)(c,{value:`off`,children:r.off}),t[26]=r.off,t[27]=E);let D;t[28]!==d.mode||t[29]!==E||t[30]!==C||t[31]!==w?(D=(0,$.jsxs)(s,{value:d.mode,onChange:C,children:[w,E]}),t[28]=d.mode,t[29]=E,t[30]=C,t[31]=w,t[32]=D):D=t[32];let O;t[33]!==D||t[34]!==S?(O=(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[S,D]}),t[33]=D,t[34]=S,t[35]=O):O=t[35];let A;t[36]===r.reviewTime?A=t[37]:(A=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:r.reviewTime}),t[36]=r.reviewTime,t[37]=A);let j;t[38]===f?j=t[39]:(j=e=>f(t=>t&&{...t,schedule:{time:e.target.value}}),t[38]=f,t[39]=j);let M;t[40]!==d.schedule.time||t[41]!==j?(M=(0,$.jsx)(`input`,{type:`time`,className:lt,value:d.schedule.time,onChange:j}),t[40]=d.schedule.time,t[41]=j,t[42]=M):M=t[42];let N;t[43]!==A||t[44]!==M?(N=(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[A,M]}),t[43]=A,t[44]=M,t[45]=N):N=t[45];let P;t[46]===r.timezone?P=t[47]:(P=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:r.timezone}),t[46]=r.timezone,t[47]=P);let F=d.timezone??``,I,L;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(I=ie(),L=ie(),t[48]=I,t[49]=L):(I=t[48],L=t[49]);let R,z;t[50]===f?(R=t[51],z=t[52]):(R=e=>f(t=>t&&{...t,timezone:e}),z=e=>f(t=>t&&{...t,timezone:e.target.value||void 0}),t[50]=f,t[51]=R,t[52]=z);let B;t[53]!==F||t[54]!==R||t[55]!==z?(B=(0,$.jsx)(be,{className:`${lt} min-w-0 flex-1`,value:F,placeholder:I,suggestion:L,onAcceptSuggestion:R,onChange:z}),t[53]=F,t[54]=R,t[55]=z,t[56]=B):B=t[56];let V;t[57]===f?V=t[58]:(V=()=>f(zt),t[57]=f,t[58]=V);let H;t[59]!==r.detect||t[60]!==V?(H=(0,$.jsx)(g,{className:`shrink-0 whitespace-nowrap`,onClick:V,children:r.detect}),t[59]=r.detect,t[60]=V,t[61]=H):H=t[61];let W;t[62]!==B||t[63]!==H?(W=(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[B,H]}),t[62]=B,t[63]=H,t[64]=W):W=t[64];let G;t[65]!==P||t[66]!==W?(G=(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm sm:col-span-2`,children:[P,W]}),t[65]=P,t[66]=W,t[67]=G):G=t[67];let K;t[68]===r.evidenceThreshold?K=t[69]:(K=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:r.evidenceThreshold}),t[68]=r.evidenceThreshold,t[69]=K);let ee;t[70]===f?ee=t[71]:(ee=e=>f(t=>t&&{...t,minEvidenceSources:Number(e.target.value)}),t[70]=f,t[71]=ee);let q;t[72]!==d.minEvidenceSources||t[73]!==ee?(q=(0,$.jsx)(`input`,{type:`number`,min:2,max:10,className:lt,value:d.minEvidenceSources,onChange:ee}),t[72]=d.minEvidenceSources,t[73]=ee,t[74]=q):q=t[74];let te;t[75]!==K||t[76]!==q?(te=(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[K,q]}),t[75]=K,t[76]=q,t[77]=te):te=t[77];let ne;t[78]===r.scanLimit?ne=t[79]:(ne=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:r.scanLimit}),t[78]=r.scanLimit,t[79]=ne);let re;t[80]===f?re=t[81]:(re=e=>f(t=>t&&{...t,limit:Number(e.target.value)}),t[80]=f,t[81]=re);let ae;t[82]!==d.limit||t[83]!==re?(ae=(0,$.jsx)(`input`,{type:`number`,min:1,max:2e3,className:lt,value:d.limit,onChange:re}),t[82]=d.limit,t[83]=re,t[84]=ae):ae=t[84];let J;t[85]!==ne||t[86]!==ae?(J=(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[ne,ae]}),t[85]=ne,t[86]=ae,t[87]=J):J=t[87];let oe;t[88]!==O||t[89]!==N||t[90]!==G||t[91]!==te||t[92]!==J?(oe=(0,$.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[O,N,G,te,J]}),t[88]=O,t[89]=N,t[90]=G,t[91]=te,t[92]=J,t[93]=oe):oe=t[93];let se;t[94]!==v.error||t[95]!==v.status?(se=(0,$.jsx)(`div`,{className:`mt-5 flex justify-end`,children:(0,$.jsx)(ve,{status:v.status,error:v.error})}),t[94]=v.error,t[95]=v.status,t[96]=se):se=t[96];let ce;t[97]!==v.onBlurCapture||t[98]!==oe||t[99]!==se?(ce=(0,$.jsx)(ft,{children:(0,$.jsxs)(`div`,{onBlurCapture:x,children:[oe,se]})}),t[97]=v.onBlurCapture,t[98]=oe,t[99]=se,t[100]=ce):ce=t[100];let le;t[101]===r.lastRun?le=t[102]:(le=(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:r.lastRun}),t[101]=r.lastRun,t[102]=le);let Y;t[103]!==n||t[104]!==y||t[105]!==r.neverRun||t[106]!==r.runItems?(Y=n?(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-sm text-fg-muted`,children:[(0,$.jsx)(`span`,{children:y}),(0,$.jsx)(`span`,{children:`·`}),(0,$.jsx)(`time`,{children:new Date(n.startedAt).toLocaleString()}),typeof n.metrics.scanned==`number`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{children:`·`}),(0,$.jsxs)(`span`,{children:[String(n.metrics.scanned),` `,r.runItems]})]}):null]}):(0,$.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:r.neverRun}),t[103]=n,t[104]=y,t[105]=r.neverRun,t[106]=r.runItems,t[107]=Y):Y=t[107];let X;t[108]!==le||t[109]!==Y?(X=(0,$.jsxs)(ft,{children:[le,Y]}),t[108]=le,t[109]=Y,t[110]=X):X=t[110];let ue;return t[111]!==ce||t[112]!==X||t[113]!==b?(ue=(0,$.jsxs)(`div`,{className:`space-y-5`,children:[b,ce,X]}),t[111]=ce,t[112]=X,t[113]=b,t[114]=ue):ue=t[114],ue}function zt(e){return e&&{...e,timezone:ie()}}function Bt(e){let t=(0,Q.c)(49),{t:n}=e,{data:r,error:i,isLoading:a,mutate:o}=T(`you-context-settings`,me),l=r?.privacy.sensitiveWritePolicy??null,[u,d]=gt(l),f=!!(u&&l&&u!==l),p;t[0]===o?p=t[1]:(p=async e=>{await k({privacy:{sensitiveWritePolicy:e}}),await o()},t[0]=o,t[1]=p);let m;t[2]!==u||t[3]!==f||t[4]!==p?(m={value:u,dirty:f,delayMs:350,onSave:p},t[2]=u,t[3]=f,t[4]=p,t[5]=m):m=t[5];let h=ye(m);if(i){let e;t[6]===o?e=t[7]:(e=()=>void o(),t[6]=o,t[7]=e);let r;t[8]!==n.retry||t[9]!==e?(r=(0,$.jsx)(`button`,{className:`text-accent hover:underline`,onClick:e,children:n.retry}),t[8]=n.retry,t[9]=e,t[10]=r):r=t[10];let i;return t[11]!==n.error||t[12]!==r?(i=(0,$.jsxs)(pt,{children:[n.error,` `,r]}),t[11]=n.error,t[12]=r,t[13]=i):i=t[13],i}if(a||!u){let e;return t[14]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(U,{className:`h-56 rounded-2xl`}),t[14]=e):e=t[14],e}let g;t[15]===n.privacyHint?g=t[16]:(g=(0,$.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:n.privacyHint}),t[15]=n.privacyHint,t[16]=g);let _;t[17]===n.sensitivePolicy?_=t[18]:(_=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:n.sensitivePolicy}),t[17]=n.sensitivePolicy,t[18]=_);let v;t[19]===d?v=t[20]:(v=e=>d(e.target.value),t[19]=d,t[20]=v);let y;t[21]===n.policyDeny?y=t[22]:(y=(0,$.jsx)(c,{value:`deny`,children:n.policyDeny}),t[21]=n.policyDeny,t[22]=y);let b;t[23]===n.policyConfirm?b=t[24]:(b=(0,$.jsx)(c,{value:`confirm`,children:n.policyConfirm}),t[23]=n.policyConfirm,t[24]=b);let x;t[25]===n.policyAllow?x=t[26]:(x=(0,$.jsx)(c,{value:`allow`,children:n.policyAllow}),t[25]=n.policyAllow,t[26]=x);let S;t[27]!==u||t[28]!==v||t[29]!==y||t[30]!==b||t[31]!==x?(S=(0,$.jsxs)(s,{value:u,onChange:v,children:[y,b,x]}),t[27]=u,t[28]=v,t[29]=y,t[30]=b,t[31]=x,t[32]=S):S=t[32];let C;t[33]!==S||t[34]!==_?(C=(0,$.jsxs)(`label`,{className:`block max-w-xl space-y-1.5 text-sm`,children:[_,S]}),t[33]=S,t[34]=_,t[35]=C):C=t[35];let w;t[36]===n.privacyWarning?w=t[37]:(w=(0,$.jsx)(`p`,{className:`mt-3 max-w-2xl text-xs leading-5 text-fg-subtle`,children:n.privacyWarning}),t[36]=n.privacyWarning,t[37]=w);let E;t[38]!==h.error||t[39]!==h.status?(E=(0,$.jsx)(`div`,{className:`mt-5 flex justify-end`,children:(0,$.jsx)(ve,{status:h.status,error:h.error})}),t[38]=h.error,t[39]=h.status,t[40]=E):E=t[40];let D;t[41]!==h.onBlurCapture||t[42]!==C||t[43]!==w||t[44]!==E?(D=(0,$.jsx)(ft,{children:(0,$.jsxs)(`div`,{onBlurCapture:h.onBlurCapture,children:[C,w,E]})}),t[41]=h.onBlurCapture,t[42]=C,t[43]=w,t[44]=E,t[45]=D):D=t[45];let O;return t[46]!==D||t[47]!==g?(O=(0,$.jsxs)(`div`,{className:`space-y-5`,children:[g,D]}),t[46]=D,t[47]=g,t[48]=O):O=t[48],O}export{vt as UserContextPage};
|