@xopcai/xopc 0.0.249 → 0.0.250
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/{activity-store-B759R_qf.js → activity-store-DfBjTSo9.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-BUu7EnwM.js → agent-avatar-dicebear-BN6FJXkJ.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-C7rZH1A2.js +1 -0
- package/dist/gateway/static/root/assets/{agents-DK9HjHO0.js → agents-CgGaoo4z.js} +1 -1
- package/dist/gateway/static/root/assets/{api-Cg0v7Lpn.js → api-zxpcJfgj.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-C9DkCW_d.js → app-management-settings-panel-D2gMshuS.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-CFggS95Y.js → appearance-settings-wMu0jSKx.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-jOvT-fzU.js → apps-page-KF1Gnv36.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-BQrilVVv.js → archive-plugin-u6EE3JV8.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-BG0BliqV.js → attachment-load-DbJurnv-.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-Bo4RiTkh.js → automations-page-Ew_e5HDn.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-Ch-ldu35.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-BCnyNU0C.js → binary-plugins-DtDFNfPM.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-Db8DlVvg.js → block-editor-CnAwmabq.js} +50 -50
- package/dist/gateway/static/root/assets/browser-settings-page-DtVhsHJW.js +8 -0
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-C71vfl0b.js → browser-workflow-inputs-BX1-uM9L.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-vvmSYKsO.js → browser-workflows-page-CcbUOWDF.js} +2 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel--sXeylhe.js +7 -0
- package/dist/gateway/static/root/assets/channels-settings-AXSBDujZ.js +1 -0
- package/dist/gateway/static/root/assets/{channels-status-swr-CKyV3jY5.js → channels-status-swr-CX-yWwLD.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-terminal-dock-B1Xd6OFB.js → chat-terminal-dock-CryTDNdD.js} +2 -2
- package/dist/gateway/static/root/assets/connectors-page-HBHUWohz.js +2 -0
- package/dist/gateway/static/root/assets/{cron-expression-D-F9vjtE.js → cron-expression-ji5aWrjG.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-B2OoYvic.js → date-picker-Dro_w3eX.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-BiGx9Sbj.js → dependency-picker-Ce19KKnX.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-BNMRqipe.js → desktop-pet-DsSi-3uZ.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-DeYbIV7A.js → desktop-pet-settings-8WQ4woJy.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-COyn05ub.js → extension-debug-page-CgvEBfLZ.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-oH43chS2.js → extension-page-DkznBbMj.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-BMO59994.js → extension-settings-page-BOjhchK2.js} +1 -1
- package/dist/gateway/static/root/assets/files-BArWTfr7.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-config-api-cimpViGk.js → gateway-config-api-OEruhhX3.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-BGdHwT4e.js → gateway-config-swr-CMNbl0FZ.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-BHJtnSic.js → gateway-settings-BgH3A0LO.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-CuaM3b4c.js → gateway-startup-retry-CR7Xg8As.js} +1 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-C97naDkO.js +1 -0
- package/dist/gateway/static/root/assets/home-page-BBKKme4G.js +1 -0
- package/dist/gateway/static/root/assets/{image-generation-api-D7duj7Uj.js → image-generation-api-C5mn73ca.js} +1 -1
- package/dist/gateway/static/root/assets/index-BcaF-dgQ.js +72 -0
- package/dist/gateway/static/root/assets/{index-DGeGmj4k.css → index-DAryGvZ7.css} +1 -1
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-D8Zw_lYd.js → keyboard-shortcuts-settings-BYhfzsqe.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-eBFVWmtH.js → local-app-workbench-page-DNncc2tn.js} +2 -2
- package/dist/gateway/static/root/assets/{local-apps-page-CvPDPRwb.js → local-apps-page-vBlknU7C.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-zEL8bkwx.js → locale-store-CF4erhjB.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-ClvcWlL6.js → logs-page-CizZInrT.js} +2 -2
- package/dist/gateway/static/root/assets/{management-settings-D8moh99U.js → management-settings-Dnx6mSNe.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-split-D7V3j0vE.js → markdown-split-DtBtcHWi.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-DGRN-8wP.js → markdown-view-CQvzsE24.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-BLaE5b1Y.js → media-plugins-DrMYeHe7.js} +1 -1
- package/dist/gateway/static/root/assets/messages-Cf5hpZE6.js +3 -0
- package/dist/gateway/static/root/assets/{mobile-pairing-wizard-DiVDuCxl.js → mobile-pairing-wizard-AKgGy3Kx.js} +1 -1
- package/dist/gateway/static/root/assets/note-detail-panel-Bw3jD9Jf.js +5 -0
- package/dist/gateway/static/root/assets/notes-page-Dpqq7Z-J.js +8 -0
- package/dist/gateway/static/root/assets/{page-tabs-BFMGjA60.js → page-tabs-CX9T71by.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-DNEWZN7H.js → preview-open-alternatives-DvEHoimN.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-Co5u7asH.js → product-open-page-COcr_NUJ.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-BuT6MCTs.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-DXWMxOjf.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-Cg92zSod.js → registry-api-BsRBlji7.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-7rBCUWzZ.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-C0ByNmlV.js → runtime-tools-settings-panel-CQ13P-mS.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-Dq_VQpuY.js → schema-form-BUVyTpZj.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-gmEOYNb4.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-DYYoJcl7.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-CZu6FX4k.js → settings-form-section-DVY-8_B9.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-S8ekeUZd.js → settings-page-CdiVYyTl.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-BdVmwXMv.js → setup-status-panel-BhenBnUj.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-D2fEidbn.js → share-preview-page-C88YLKm4.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-Dq7xIj0_.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-MDI9Lz6z.js +1 -0
- package/dist/gateway/static/root/assets/{skills-page-AYiPlgZE.js → skills-page-DLir1nM0.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page.utils-DGzl-ib-.js → skills-page.utils-BMZAfS3G.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-5Xd5mIiR.js → system-settings-panel-BM8ivYan.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-P0_RldWv.js +1 -0
- package/dist/gateway/static/root/assets/{theme-store-ZVClZKQ0.js → theme-store-BOgkc_9D.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-CdZN1Jin.js → tunnel-api-DemxChjo.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-czRI0NBc.js → use-autosave-CV3Ui5hu.js} +1 -1
- package/dist/gateway/static/root/assets/user-model-page-CxfnoRVn.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-8YEvA3cU.js → voice-api-key-field-CUoCi4Sq.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-CopF64lY.js → voice-config-api-C-ryeIxj.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-keLtqYYJ.js → work-discovery-overlay-BhDlkCMB.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-Dy5WgYMO.js → workflow-run-setup-panel-D8CcPc_C.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-Bxn2Dc16.js +5 -0
- package/dist/gateway/static/root/index.html +11 -11
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/user-message-display.js +18 -0
- package/dist/src/agent/agent-instance-gateway.d.ts +1 -1
- package/dist/src/agent/agent-manager.d.ts +9 -9
- package/dist/src/agent/agent-manager.js +46 -28
- package/dist/src/agent/background-review/prompts.d.ts +1 -1
- package/dist/src/agent/background-review/prompts.js +11 -2
- package/dist/src/agent/context/audit.d.ts +3 -1
- package/dist/src/agent/context/audit.js +32 -6
- package/dist/src/agent/context/coordinator.d.ts +6 -1
- package/dist/src/agent/context/coordinator.js +14 -13
- package/dist/src/agent/context/execution-context.d.ts +6 -47
- package/dist/src/agent/context/execution-context.js +79 -15
- package/dist/src/agent/context/execution-context.types.d.ts +50 -0
- package/dist/src/agent/context/execution-context.types.js +1 -0
- package/dist/src/agent/context/execution-scope.d.ts +5 -1
- package/dist/src/agent/context/execution-scope.js +6 -2
- package/dist/src/agent/context/project-context.d.ts +3 -0
- package/dist/src/agent/context/project-context.js +5 -3
- package/dist/src/agent/external-tools/index.d.ts +1 -0
- package/dist/src/agent/external-tools/index.js +1 -0
- package/dist/src/agent/external-tools/memory-provider.d.ts +1 -0
- package/dist/src/agent/external-tools/memory-provider.js +1 -0
- package/dist/src/agent/inbound/attachment-pipeline.js +5 -1
- package/dist/src/agent/memory/compaction-promotion.d.ts +1 -0
- package/dist/src/agent/memory/compaction-promotion.js +7 -2
- package/dist/src/agent/memory/index.d.ts +1 -1
- package/dist/src/agent/memory/index.js +3 -3
- package/dist/src/agent/memory/memory-config.d.ts +0 -5
- package/dist/src/agent/memory/memory-config.js +1 -8
- package/dist/src/agent/orchestration/context-overflow.js +1 -0
- package/dist/src/agent/service/direct-turn-helpers.d.ts +2 -2
- package/dist/src/agent/service/direct-turn-helpers.js +2 -2
- package/dist/src/agent/service/process-direct-streaming.js +3 -4
- package/dist/src/agent/tools/factory.d.ts +1 -0
- package/dist/src/agent/tools/factory.js +37 -7
- package/dist/src/agent/tools/knowledge-memory-tool.d.ts +6 -0
- package/dist/src/agent/tools/knowledge-memory-tool.js +81 -26
- package/dist/src/agent/tools/session-search-tool.d.ts +1 -0
- package/dist/src/agent/tools/session-search-tool.js +7 -0
- package/dist/src/agent/tools/user-context-tool.d.ts +2 -0
- package/dist/src/agent/tools/user-context-tool.js +21 -4
- package/dist/src/automations/service/automation-service.d.ts +2 -1
- package/dist/src/automations/service/automation-service.js +6 -2
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/connectors/connection-recovery-service.d.ts +1 -0
- package/dist/src/connectors/connection-recovery-service.js +46 -22
- package/dist/src/files/file-service.js +4 -1
- package/dist/src/gateway/hono/routes/connectors.js +17 -3
- package/dist/src/gateway/hono/routes/files.js +23 -2
- package/dist/src/gateway/hono/routes/tasks.js +1 -1
- package/dist/src/gateway/security/gateway-scopes.js +2 -0
- package/dist/src/gateway/service/agent-runner.js +1 -1
- package/dist/src/gateway/service/run-gateway-agent.js +1 -1
- package/dist/src/gateway/service/session-input-coordinator.js +1 -1
- package/dist/src/gateway/service.js +8 -4
- package/dist/src/knowledge-memory/domain.d.ts +1 -0
- package/dist/src/knowledge-memory/index.js +2 -2
- package/dist/src/knowledge-memory/repository.d.ts +4 -1
- package/dist/src/knowledge-memory/repository.js +16 -2
- package/dist/src/notifications/planner.js +7 -3
- package/dist/src/proactive/actions/service.d.ts +0 -1
- package/dist/src/proactive/actions/service.js +1 -10
- package/dist/src/proactive/execution/context.d.ts +6 -8
- package/dist/src/proactive/execution/context.js +78 -32
- package/dist/src/proactive/execution/insight.d.ts +4 -1
- package/dist/src/proactive/execution/insight.js +5 -2
- package/dist/src/proactive/execution/repository.d.ts +1 -0
- package/dist/src/proactive/execution/repository.js +9 -1
- package/dist/src/proactive/execution/types.d.ts +0 -1
- package/dist/src/proactive/execution/worker.js +7 -5
- package/dist/src/proactive/inbox/repository.js +8 -2
- package/dist/src/proactive/inbox/service.js +2 -2
- package/dist/src/proactive/inbox/types.d.ts +1 -0
- package/dist/src/proactive/inbox/worker.d.ts +1 -0
- package/dist/src/proactive/inbox/worker.js +7 -0
- package/dist/src/proactive/index.d.ts +1 -0
- package/dist/src/proactive/index.js +2 -1
- package/dist/src/proactive/maintenance.d.ts +4 -0
- package/dist/src/proactive/maintenance.js +21 -0
- package/dist/src/proactive/scenarios/repository.d.ts +1 -1
- package/dist/src/proactive/scenarios/repository.js +10 -3
- package/dist/src/proactive/scenarios/types.d.ts +7 -0
- package/dist/src/proactive/service.d.ts +7 -0
- package/dist/src/proactive/service.js +17 -1
- package/dist/src/projects/project-service.d.ts +2 -1
- package/dist/src/projects/project-service.js +3 -2
- package/dist/src/session/index.js +1 -1
- package/dist/src/session/store.js +5 -2
- package/dist/src/storage/sqlite/collaboration-rule-repository.d.ts +3 -1
- package/dist/src/storage/sqlite/collaboration-rule-repository.js +1 -1
- package/dist/src/storage/sqlite/config-repository.js +1 -1
- package/dist/src/storage/sqlite/connection-wait-repository.js +2 -2
- package/dist/src/storage/sqlite/index.js +2 -2
- package/dist/src/storage/sqlite/migrations/151_proactive_scope_cleanup.sql +6 -0
- package/dist/src/storage/sqlite/migrations/152_proactive_scenario_contract.sql +140 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +3 -3
- package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
- package/dist/src/storage/sqlite/row-mappers.js +2 -2
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/storage/sqlite/session-input-repository.js +1 -1
- package/dist/src/storage/sqlite/session-instance-repository.d.ts +2 -0
- package/dist/src/storage/sqlite/session-instance-repository.js +6 -0
- package/dist/src/storage/sqlite/session-repository.d.ts +1 -1
- package/dist/src/storage/sqlite/session-repository.js +3 -5
- package/dist/src/storage/sqlite/transcript-repository.js +2 -1
- package/dist/src/tasks/home-query-service.js +35 -13
- package/dist/src/tasks/project-monitoring-service.d.ts +2 -0
- package/dist/src/tasks/project-monitoring-service.js +4 -1
- package/dist/src/tui/backends/embedded-backend.js +1 -1
- package/dist/src/user-context/access-policy.d.ts +11 -0
- package/dist/src/user-context/access-policy.js +26 -0
- package/dist/src/user-model/capture/executor.d.ts +10 -0
- package/dist/src/user-model/capture/executor.js +99 -3
- package/dist/src/user-model/capture/semantic.d.ts +18 -0
- package/dist/src/user-model/capture/semantic.js +72 -6
- package/dist/src/user-model/goals.d.ts +4 -0
- package/dist/src/user-model/goals.js +4 -2
- package/package.json +3 -3
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-C1rXNUAG.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-BKjKTlW8.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-Dzq18pO1.js +0 -8
- package/dist/gateway/static/root/assets/capabilities-settings-panel-DW4SBQf4.js +0 -7
- package/dist/gateway/static/root/assets/channels-settings-57OGuewD.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-CT_I3kbR.js +0 -2
- package/dist/gateway/static/root/assets/files-D6vf3S30.js +0 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-DNhrZHqx.js +0 -1
- package/dist/gateway/static/root/assets/home-page-BiHwiBnQ.js +0 -1
- package/dist/gateway/static/root/assets/index-aBs0EfQB.js +0 -72
- package/dist/gateway/static/root/assets/messages-W5P19VTF.js +0 -11
- package/dist/gateway/static/root/assets/note-detail-panel-CEEvR-fV.js +0 -5
- package/dist/gateway/static/root/assets/notes-page-BLqgXNCx.js +0 -8
- package/dist/gateway/static/root/assets/project-detail-page-CIiFJ5tk.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-B3UF-Pfm.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-BUtpkJPG.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-UgJmG-V4.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-DDCzpdkl.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-BdsqnCYj.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-ghzAQKna.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-BQAUaCDD.js +0 -1
- package/dist/gateway/static/root/assets/user-model-page-W3GTm6nA.js +0 -2
- package/dist/gateway/static/root/assets/workflows-page-BbAV3h7n.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{p as i}from"./chunk-KS7C4IRE-BaASWQor.js";import{a,n as o,o as s,r as c,s as l,t as u}from"./dist-CpzYSoz7.js";import{n as d,r as f}from"./popover-select-C-Hj-nXR.js";import{t as p}from"./download-Dk-ZjtO6.js";import{t as m}from"./plus-Q2yW6OE7.js";import{t as h}from"./x-B_N4OPjy.js";import{t as g}from"./messages-W5P19VTF.js";import{a as _,n as v,r as y,s as b}from"./locale-store-zEL8bkwx.js";import{t as x}from"./cn-JdwAhgNB.js";import{i as S}from"./vendor-swr-BIWyz7Rc.js";import{t as C}from"./button-CtTvuElV.js";import{n as w,r as T}from"./gateway-config-swr-BGdHwT4e.js";import{t as E}from"./skeleton-BwbyijEw.js";import{i as ee,o as D}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{n as O,t as k}from"./registry-api-Cg92zSod.js";import{Ai as A,As as j,Di as M,Fi as N,Go as P,Ht as F,Ii as I,Jc as L,Mi as R,Ni as z,Oi as B,P as V,Qs as H,Ut as U,Vl as W,Wo as G,Yc as K,Zc as te,_c as ne,_l as re,aa as q,gs as ie,ia as ae,jc as oe,ji as se,kc as J,ki as ce,kl as le,ma as ue,nc as de,no as Y,oa as fe,vc as pe,vu as me,yu as he,z as ge}from"./index-aBs0EfQB.js";import{n as _e,t as ve}from"./settings-form-section-CZu6FX4k.js";import{n as ye,t as be}from"./use-autosave-czRI0NBc.js";import{t as xe}from"./page-tabs-BFMGjA60.js";import{t as Se}from"./settings-advanced-gate-DDCzpdkl.js";var X=e(t(),1),Ce=n(),Z=r();function we(e){let t=new Date(e),n=Math.floor((new Date().getTime()-t.getTime())/(1e3*60*60*24));return n===0?t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}):n===1?`Yesterday`:n<7?t.toLocaleDateString([],{weekday:`short`}):t.toLocaleDateString([],{month:`short`,day:`numeric`})}function Te(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function Ee(e){let t=(0,Ce.c)(105),{session:n,variant:r,labels:i,sessionAgentId:a,sessionAgentAvatar:o,onOpen:s,onAction:c}=e,l;t[0]!==i.unnamedSession||t[1]!==n.name?(l=n.name?.trim()||i.unnamedSession,t[0]=i.unnamedSession,t[1]=n.name,t[2]=l):l=t[2];let u=l,d;t[3]===n.name?d=t[4]:(d=n.name?.trim(),t[3]=n.name,t[4]=d);let f=!!d,m=n.status===`archived`,h=n.status===`pinned`,g=r===`list`&&`sm:flex-row sm:items-center sm:gap-4`,_;t[5]===g?_=t[6]:(_=x(`group flex min-w-0 w-full max-w-full cursor-pointer flex-col rounded-xl bg-surface-base text-left transition-colors duration-150 ease-out`,`hover:bg-surface-hover active:scale-[0.99]`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,g),t[5]=g,t[6]=_);let v;t[7]===s?v=t[8]:(v=e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),s())},t[7]=s,t[8]=v);let y=r===`list`&&`sm:py-3`,b;t[9]===y?b=t[10]:(b=x(`flex min-w-0 items-start justify-between gap-2 bg-surface-hover/35 px-3 py-2 dark:bg-surface-hover/25`,y),t[9]=y,t[10]=b);let S;t[11]===n.sourceChannel?S=t[12]:(S=(0,Z.jsx)(`div`,{className:`flex min-w-0 items-center gap-2`,children:(0,Z.jsx)(`span`,{className:`truncate text-[11px] font-medium uppercase tracking-wide text-fg-subtle`,children:n.sourceChannel})}),t[11]=n.sourceChannel,t[12]=S);let C;t[13]===h?C=t[14]:(C=h?(0,Z.jsx)(pe,{className:`size-3.5 text-accent-fg`,strokeWidth:1.75,"aria-hidden":!0}):null,t[13]=h,t[14]=C);let w;t[15]===n.updatedAt?w=t[16]:(w=we(n.updatedAt),t[15]=n.updatedAt,t[16]=w);let T;t[17]===w?T=t[18]:(T=(0,Z.jsx)(`span`,{children:w}),t[17]=w,t[18]=T);let E;t[19]!==T||t[20]!==C?(E=(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5 text-xs text-fg-muted`,children:[C,T]}),t[19]=T,t[20]=C,t[21]=E):E=t[21];let ee;t[22]!==E||t[23]!==b||t[24]!==S?(ee=(0,Z.jsxs)(`div`,{className:b,children:[S,E]}),t[22]=E,t[23]=b,t[24]=S,t[25]=ee):ee=t[25];let D=r===`list`&&`sm:py-3`,O;t[26]===D?O=t[27]:(O=x(`min-w-0 flex-1 px-3 py-2`,D),t[26]=D,t[27]=O);let k=r===`list`&&`sm:items-start`,A;t[28]===k?A=t[29]:(A=x(`flex gap-3`,k),t[28]=k,t[29]=A);let M;t[30]!==o||t[31]!==a?(M=(0,Z.jsx)(V,{agentId:a,avatar:o,size:40,className:`size-10 shrink-0 ring-1 ring-edge/60 dark:ring-edge`}),t[30]=o,t[31]=a,t[32]=M):M=t[32];let N;t[33]===u?N=t[34]:(N=(0,Z.jsx)(`div`,{className:`min-w-0 max-w-full truncate text-sm font-semibold text-fg`,title:u,children:u}),t[33]=u,t[34]=N);let P;t[35]!==n.key||t[36]!==f?(P=f?(0,Z.jsx)(`div`,{className:`mt-0.5 min-w-0 max-w-full truncate font-mono text-[11px] text-fg-subtle`,title:n.key,children:n.key}):null,t[35]=n.key,t[36]=f,t[37]=P):P=t[37];let F;t[38]!==N||t[39]!==P?(F=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[N,P]}),t[38]=N,t[39]=P,t[40]=F):F=t[40];let I;t[41]!==A||t[42]!==M||t[43]!==F?(I=(0,Z.jsxs)(`div`,{className:A,children:[M,F]}),t[41]=A,t[42]=M,t[43]=F,t[44]=I):I=t[44];let L;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsx)(oe,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[45]=L):L=t[45];let R;t[46]===n.messageCount?R=t[47]:(R=(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[L,n.messageCount]}),t[46]=n.messageCount,t[47]=R);let z;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Z.jsx)(ie,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[48]=z):z=t[48];let B;t[49]===n.estimatedTokens?B=t[50]:(B=Te(n.estimatedTokens),t[49]=n.estimatedTokens,t[50]=B);let H;t[51]===B?H=t[52]:(H=(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[z,B]}),t[51]=B,t[52]=H);let U;t[53]!==R||t[54]!==H?(U=(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-3 text-xs text-fg-muted`,children:[R,H]}),t[53]=R,t[54]=H,t[55]=U):U=t[55];let W;t[56]===n.tags?W=t[57]:(W=n.tags.length>0?(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:[n.tags.slice(0,3).map(ke),n.tags.length>3?(0,Z.jsxs)(`span`,{className:`text-[11px] text-fg-disabled`,children:[`+`,n.tags.length-3]}):null]}):null,t[56]=n.tags,t[57]=W);let K;t[58]!==O||t[59]!==I||t[60]!==U||t[61]!==W?(K=(0,Z.jsxs)(`div`,{className:O,children:[I,U,W]}),t[58]=O,t[59]=I,t[60]=U,t[61]=W,t[62]=K):K=t[62];let te;t[63]===c?te=t[64]:(te=()=>c(`continue`),t[63]=c,t[64]=te);let re;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Z.jsx)(oe,{className:`size-4`,strokeWidth:1.75}),t[65]=re):re=t[65];let q;t[66]!==i.continueChat||t[67]!==te?(q=(0,Z.jsx)(`button`,{type:`button`,className:G,title:i.continueChat,"aria-label":i.continueChat,onClick:te,children:re}),t[66]=i.continueChat,t[67]=te,t[68]=q):q=t[68];let ae;t[69]!==m||t[70]!==i.archive||t[71]!==i.unarchive||t[72]!==c?(ae=m?(0,Z.jsx)(`button`,{type:`button`,className:G,title:i.unarchive,"aria-label":i.unarchive,onClick:()=>c(`unarchive`),children:(0,Z.jsx)(he,{className:`size-4`,strokeWidth:1.75})}):(0,Z.jsx)(`button`,{type:`button`,className:G,title:i.archive,"aria-label":i.archive,onClick:()=>c(`archive`),children:(0,Z.jsx)(me,{className:`size-4`,strokeWidth:1.75})}),t[69]=m,t[70]=i.archive,t[71]=i.unarchive,t[72]=c,t[73]=ae):ae=t[73];let se;t[74]!==h||t[75]!==i.pin||t[76]!==i.unpin||t[77]!==c?(se=h?(0,Z.jsx)(`button`,{type:`button`,className:G,title:i.unpin,"aria-label":i.unpin,onClick:()=>c(`unpin`),children:(0,Z.jsx)(ne,{className:`size-4`,strokeWidth:1.75})}):(0,Z.jsx)(`button`,{type:`button`,className:G,title:i.pin,"aria-label":i.pin,onClick:()=>c(`pin`),children:(0,Z.jsx)(pe,{className:`size-4`,strokeWidth:1.75})}),t[74]=h,t[75]=i.pin,t[76]=i.unpin,t[77]=c,t[78]=se):se=t[78];let J;t[79]===c?J=t[80]:(J=()=>c(`export`),t[79]=c,t[80]=J);let ce;t[81]===Symbol.for(`react.memo_cache_sentinel`)?(ce=(0,Z.jsx)(p,{className:`size-4`,strokeWidth:1.75}),t[81]=ce):ce=t[81];let le;t[82]!==i.export||t[83]!==J?(le=(0,Z.jsx)(`button`,{type:`button`,className:G,title:i.export,"aria-label":i.export,onClick:J,children:ce}),t[82]=i.export,t[83]=J,t[84]=le):le=t[84];let ue;t[85]===Symbol.for(`react.memo_cache_sentinel`)?(ue=x(G,`text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-950/40`),t[85]=ue):ue=t[85];let de;t[86]===c?de=t[87]:(de=()=>c(`delete`),t[86]=c,t[87]=de);let Y;t[88]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,Z.jsx)(j,{className:`size-4`,strokeWidth:1.75}),t[88]=Y):Y=t[88];let fe;t[89]!==i.delete||t[90]!==de?(fe=(0,Z.jsx)(`button`,{type:`button`,className:ue,title:i.delete,"aria-label":i.delete,onClick:de,children:Y}),t[89]=i.delete,t[90]=de,t[91]=fe):fe=t[91];let ge;t[92]!==q||t[93]!==ae||t[94]!==se||t[95]!==le||t[96]!==fe?(ge=(0,Z.jsxs)(`div`,{role:`group`,className:`flex flex-wrap items-center gap-0.5 border-t border-edge-subtle/80 bg-surface-hover/25 p-2 dark:border-edge-subtle`,onClick:Oe,onKeyDown:De,children:[q,ae,se,le,fe]}),t[92]=q,t[93]=ae,t[94]=se,t[95]=le,t[96]=fe,t[97]=ge):ge=t[97];let _e;return t[98]!==s||t[99]!==ee||t[100]!==K||t[101]!==_||t[102]!==ge||t[103]!==v?(_e=(0,Z.jsxs)(`div`,{role:`button`,tabIndex:0,className:_,onClick:s,onKeyDown:v,children:[ee,K,ge]}),t[98]=s,t[99]=ee,t[100]=K,t[101]=_,t[102]=ge,t[103]=v,t[104]=_e):_e=t[104],_e}function De(e){return e.stopPropagation()}function Oe(e){return e.stopPropagation()}function ke(e){return(0,Z.jsx)(`span`,{className:`max-w-full break-words rounded-md bg-surface-hover px-1.5 py-0.5 text-[11px] text-fg-muted`,children:e},e)}function Ae(e,t){return e.routing?.agentId?.trim().toLowerCase()||t.trim().toLowerCase()||`main`}function je(e,t){return t.find(t=>t.id===e)?.avatar}var Me={enabled:!0,triggerThreshold:.8,reserveTokens:8192,minMessagesBeforeCompact:10,keepRecentTokens:2e4,recentTurnsPreserve:3,summaryMaxTokens:2e3,summaryChunkTokens:24e3,summaryTimeoutMs:18e4,summaryRetries:2,qualityGuard:!0,gapAudit:!0,minToolResultKeepChars:1e3,maxActiveTranscriptBytes:2e6,postCompactionSections:[`Session Startup`,`Red Lines`]};function Ne(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Pe(e,t,n,r=1/0){return typeof e==`number`&&Number.isFinite(e)&&e>=n&&e<=r?e:t}function Q(e,t,n,r=1/0){return Number.isInteger(e)&&e>=n&&e<=r?e:t}function Fe(e){let t=Ne(e)?e:{},n=Ne(t.userContext)?t.userContext:{},r=Ne(n.contextPlanning)?n.contextPlanning:{},i=Ne(r.compaction)?r.compaction:{},a=Me,o=typeof i.model==`string`&&i.model.trim()?i.model.trim():void 0,s=Array.isArray(i.postCompactionSections)&&i.postCompactionSections.length<=12&&i.postCompactionSections.every(e=>typeof e==`string`&&e.trim())?[...new Set(i.postCompactionSections.map(e=>e.trim()))]:[...a.postCompactionSections];return{enabled:typeof i.enabled==`boolean`?i.enabled:a.enabled,triggerThreshold:Pe(i.triggerThreshold,a.triggerThreshold,.1,.98),reserveTokens:Q(i.reserveTokens,a.reserveTokens,1024),minMessagesBeforeCompact:Q(i.minMessagesBeforeCompact,a.minMessagesBeforeCompact,2),keepRecentTokens:Q(i.keepRecentTokens,a.keepRecentTokens,1e3),recentTurnsPreserve:Q(i.recentTurnsPreserve,a.recentTurnsPreserve,1,12),summaryMaxTokens:Q(i.summaryMaxTokens,a.summaryMaxTokens,256),summaryChunkTokens:Q(i.summaryChunkTokens,a.summaryChunkTokens,1e3),summaryTimeoutMs:Q(i.summaryTimeoutMs,a.summaryTimeoutMs,1e3,6e5),summaryRetries:Q(i.summaryRetries,a.summaryRetries,0,5),qualityGuard:typeof i.qualityGuard==`boolean`?i.qualityGuard:a.qualityGuard,gapAudit:typeof i.gapAudit==`boolean`?i.gapAudit:a.gapAudit,...o?{model:o}:{},minToolResultKeepChars:Q(i.minToolResultKeepChars,a.minToolResultKeepChars,200),maxActiveTranscriptBytes:Q(i.maxActiveTranscriptBytes,a.maxActiveTranscriptBytes,64e3),postCompactionSections:s}}function Ie(e){return e.triggerThreshold<.1||e.triggerThreshold>.98?`triggerThreshold`:!Number.isInteger(e.reserveTokens)||e.reserveTokens<1024?`reserveTokens`:!Number.isInteger(e.minMessagesBeforeCompact)||e.minMessagesBeforeCompact<2?`minMessagesBeforeCompact`:!Number.isInteger(e.keepRecentTokens)||e.keepRecentTokens<1e3?`keepRecentTokens`:!Number.isInteger(e.recentTurnsPreserve)||e.recentTurnsPreserve<1||e.recentTurnsPreserve>12?`recentTurnsPreserve`:!Number.isInteger(e.summaryMaxTokens)||e.summaryMaxTokens<256?`summaryMaxTokens`:!Number.isInteger(e.summaryChunkTokens)||e.summaryChunkTokens<1e3?`summaryChunkTokens`:!Number.isInteger(e.summaryTimeoutMs)||e.summaryTimeoutMs<1e3||e.summaryTimeoutMs>6e5?`summaryTimeoutMs`:!Number.isInteger(e.summaryRetries)||e.summaryRetries<0||e.summaryRetries>5?`summaryRetries`:e.model!==void 0&&!e.model.trim()?`model`:!Number.isInteger(e.minToolResultKeepChars)||e.minToolResultKeepChars<200?`minToolResultKeepChars`:!Number.isInteger(e.maxActiveTranscriptBytes)||e.maxActiveTranscriptBytes<64e3?`maxActiveTranscriptBytes`:e.postCompactionSections.length>12||e.postCompactionSections.some(e=>!e.trim())?`postCompactionSections`:null}function Le(e){let t={...e,...e.model?.trim()?{model:e.model.trim()}:{}};return e.model?.trim()||delete t.model,{userContext:{contextPlanning:{compaction:t}}}}async function Re(e){await _(y(`/api/config`),{method:`PATCH`,body:JSON.stringify(Le(e))}),await w()}var ze=128e3,Be={balanced:Me,preserve:{...Me,triggerThreshold:.88,keepRecentTokens:32e3,recentTurnsPreserve:5,maxActiveTranscriptBytes:4e6},early:{...Me,triggerThreshold:.65,reserveTokens:12e3,minMessagesBeforeCompact:6,keepRecentTokens:12e3,recentTurnsPreserve:2}},Ve=ae();function He(){return x(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg disabled:cursor-not-allowed disabled:opacity-55`,Y,`dark:border-edge`)}function Ue(e){let{enabled:t,model:n,postCompactionSections:r,...i}=e;return JSON.stringify(i)}function We(e){let t=Ue(e);for(let[e,n]of Object.entries(Be))if(t===Ue(n))return e;return`custom`}function Ge(e){return e>=1e6?`${(e/1e6).toFixed(e%1e6==0?0:1)}m`:e>=1e3?`${(e/1e3).toFixed(e%1e3==0?0:1)}k`:String(e)}function $(e){let t=(0,Ce.c)(20),{id:n,label:r,hint:i,value:a,min:o,max:s,step:c,disabled:l,onChange:u}=e,d=c===void 0?1:c,f;t[0]!==n||t[1]!==r?(f=(0,Z.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,htmlFor:n,children:r}),t[0]=n,t[1]=r,t[2]=f):f=t[2];let p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=He(),t[3]=p):p=t[3];let m;t[4]===u?m=t[5]:(m=e=>{if(!e.target.value.trim())return;let t=Number(e.target.value);Number.isFinite(t)&&u(t)},t[4]=u,t[5]=m);let h;t[6]!==l||t[7]!==n||t[8]!==s||t[9]!==o||t[10]!==d||t[11]!==m||t[12]!==a?(h=(0,Z.jsx)(`input`,{id:n,type:`number`,min:o,max:s,step:d,disabled:l,className:p,value:a,onChange:m}),t[6]=l,t[7]=n,t[8]=s,t[9]=o,t[10]=d,t[11]=m,t[12]=a,t[13]=h):h=t[13];let g;t[14]===i?g=t[15]:(g=i?(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:i}):null,t[14]=i,t[15]=g);let _;return t[16]!==f||t[17]!==h||t[18]!==g?(_=(0,Z.jsxs)(`div`,{children:[f,h,g]}),t[16]=f,t[17]=h,t[18]=g,t[19]=_):_=t[19],_}function Ke(e){let t=(0,Ce.c)(19),{label:n,hint:r,checked:i,disabled:a,onChange:o}=e,s=a?`cursor-not-allowed opacity-55`:`cursor-pointer`,c;t[0]===s?c=t[1]:(c=x(`flex items-start gap-2 text-sm text-fg`,s),t[0]=s,t[1]=c);let l;t[2]===o?l=t[3]:(l=e=>o(e.target.checked),t[2]=o,t[3]=l);let u;t[4]!==i||t[5]!==a||t[6]!==l?(u=(0,Z.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:i,disabled:a,onChange:l}),t[4]=i,t[5]=a,t[6]=l,t[7]=u):u=t[7];let d;t[8]===n?d=t[9]:(d=(0,Z.jsx)(`span`,{className:`font-medium`,children:n}),t[8]=n,t[9]=d);let f;t[10]===r?f=t[11]:(f=(0,Z.jsx)(`span`,{className:`mt-0.5 block text-xs text-fg-subtle`,children:r}),t[10]=r,t[11]=f);let p;t[12]!==d||t[13]!==f?(p=(0,Z.jsxs)(`span`,{children:[d,f]}),t[12]=d,t[13]=f,t[14]=p):p=t[14];let m;return t[15]!==c||t[16]!==u||t[17]!==p?(m=(0,Z.jsxs)(`label`,{className:c,children:[u,p]}),t[15]=c,t[16]=u,t[17]=p,t[18]=m):m=t[18],m}function qe({hasToken:e}){let t=g(v(e=>e.language)).sessions.compaction,{data:n,isLoading:r}=T(e),{data:i=[],isLoading:a}=S(e?k:null,O,{revalidateOnFocus:!1}),o=(0,X.useMemo)(()=>n?.payload?.config===void 0?null:Fe(n.payload.config),[n]),[s,c]=(0,X.useReducer)(Ve,{form:null,baseline:null}),[l,u]=(0,X.useState)(``),d=(0,X.useRef)(!1),f=(0,X.useRef)(s.form);f.current=s.form;let p=(0,X.useRef)(null);q({enabled:e,parsed:o,dirty:d.current,trackedParsedRef:p,dispatch:c,onResetDirty:()=>{d.current=!1}});let _=s.form,y=s.baseline,b=!!(_&&y&&JSON.stringify(_)!==JSON.stringify(y)),w=(0,X.useCallback)(e=>{d.current=!0,c({type:`patch`,patch:e})},[]),ee=(0,X.useCallback)(e=>({enabled:t.enabled,triggerThreshold:t.triggerThreshold,reserveTokens:t.reserveTokens,minMessagesBeforeCompact:t.minMessagesBeforeCompact,keepRecentTokens:t.keepRecentTokens,recentTurnsPreserve:t.recentTurnsPreserve,summaryMaxTokens:t.summaryMaxTokens,summaryChunkTokens:t.summaryChunkTokens,summaryTimeoutMs:t.summaryTimeoutSeconds,summaryRetries:t.summaryRetries,qualityGuard:t.qualityGuard,gapAudit:t.gapAudit,model:t.summaryModel,minToolResultKeepChars:t.minToolResultKeepChars,maxActiveTranscriptBytes:t.maxActiveTranscriptMb,postCompactionSections:t.postCompactionSections})[e],[t]),D=be({value:_,dirty:b,onSave:(0,X.useCallback)(async e=>{try{await Re(e),c({type:`saved`,value:e}),d.current=!!(f.current&&JSON.stringify(f.current)!==JSON.stringify(e))}catch(e){throw Error(e instanceof Error?e.message:t.saveError)}},[t.saveError]),validate:e=>{let n=Ie(e);return n?t.invalidValue.replace(`{{field}}`,ee(n)):null}});if(!e||!_)return r?(0,Z.jsx)(ve,{children:(0,Z.jsxs)(`div`,{className:`space-y-3`,"aria-busy":!0,children:[(0,Z.jsx)(E,{className:`h-5 w-48`}),(0,Z.jsx)(E,{className:`h-20 w-full rounded-xl`}),(0,Z.jsx)(E,{className:`h-36 w-full rounded-xl`})]})}):null;let A=We(_),j=Math.max(0,ze-_.reserveTokens),M=Math.min(Math.floor(ze*_.triggerThreshold),j),N=Math.min(100,M/ze*100),F=Math.min(100,j/ze*100),I=_.model?i.find(e=>e.id===_.model):void 0,L=I?.contextWindow&&_.summaryChunkTokens+_.summaryMaxTokens+4096>I.contextWindow,R=_.keepRecentTokens+_.reserveTokens>M,z=Math.round(_.summaryTimeoutMs*(_.summaryRetries+1)/1e3),B=e=>{let t=Be[e];w({...t,..._.model?{model:_.model}:{model:void 0},postCompactionSections:_.postCompactionSections})},V={balanced:{title:t.presetBalanced,hint:t.presetBalancedHint},preserve:{title:t.presetPreserve,hint:t.presetPreserveHint},early:{title:t.presetEarly,hint:t.presetEarlyHint}},H=()=>{let e=l.trim();!e||_.postCompactionSections.includes(e)||_.postCompactionSections.length>=12||(w({postCompactionSections:[..._.postCompactionSections,e]}),u(``))};return(0,Z.jsxs)(ve,{onBlurCapture:D.onBlurCapture,children:[(0,Z.jsx)(_e,{icon:J,title:t.title,subtitle:t.hint,trailing:(0,Z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(ye,{status:D.status,error:D.error}),(0,Z.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 text-sm font-medium text-fg`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:_.enabled,onChange:e=>w({enabled:e.target.checked})}),_.enabled?t.enabled:t.disabled]})]})}),D.error?(0,Z.jsx)(`p`,{className:`mb-4 rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-700 dark:border-red-900 dark:bg-red-950/40 dark:text-red-300`,role:`alert`,children:D.error}):null,_.enabled?null:(0,Z.jsx)(`p`,{className:`mb-4 rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:border-amber-800 dark:bg-amber-950/40 dark:text-amber-100`,children:t.disabledWarning}),(0,Z.jsxs)(`fieldset`,{disabled:!_.enabled,className:`space-y-5 disabled:opacity-60`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.presetTitle}),(0,Z.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:t.presetHint})]}),A===`custom`?(0,Z.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-1 text-[11px] font-medium text-fg-muted`,children:t.presetCustom}):null]}),(0,Z.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-3`,children:[`balanced`,`preserve`,`early`].map(e=>(0,Z.jsxs)(`button`,{type:`button`,"aria-pressed":A===e,className:x(`rounded-xl border px-3 py-3 text-left`,P.transition,P.focusRingPanel,A===e?`border-accent/50 bg-accent-soft text-accent-fg`:`border-edge bg-surface-panel text-fg hover:bg-surface-hover`),onClick:()=>B(e),children:[(0,Z.jsx)(`span`,{className:`block text-sm font-medium`,children:V[e].title}),(0,Z.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:V[e].hint})]},e))})]}),(0,Z.jsxs)(`div`,{className:`rounded-xl border border-edge-subtle bg-surface-hover/35 p-4 dark:border-edge`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.budgetPreview}),(0,Z.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:t.budgetPreviewHint})]}),(0,Z.jsx)(`span`,{className:`rounded-full bg-surface-panel px-2.5 py-1 font-mono text-xs text-fg-muted`,children:t.previewModel128k})]}),(0,Z.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`div`,{className:`mb-1 flex justify-between gap-3 text-xs text-fg-muted`,children:[(0,Z.jsx)(`span`,{children:t.compactionTrigger}),(0,Z.jsx)(`span`,{className:`font-mono text-fg`,children:Ge(M)})]}),(0,Z.jsx)(`div`,{className:`h-2 overflow-hidden rounded-full bg-surface-active`,children:(0,Z.jsx)(`div`,{className:`h-full rounded-full bg-accent`,style:{width:`${N}%`}})})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`div`,{className:`mb-1 flex justify-between gap-3 text-xs text-fg-muted`,children:[(0,Z.jsx)(`span`,{children:t.hardInputLimit}),(0,Z.jsx)(`span`,{className:`font-mono text-fg`,children:Ge(j)})]}),(0,Z.jsx)(`div`,{className:`h-2 overflow-hidden rounded-full bg-surface-active`,children:(0,Z.jsx)(`div`,{className:`h-full rounded-full bg-fg-subtle`,style:{width:`${F}%`}})})]})]}),(0,Z.jsx)(`p`,{className:`mt-3 text-xs text-fg-subtle`,children:t.budgetFormula})]}),(0,Z.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Z.jsx)($,{id:`compaction-trigger-threshold`,label:t.triggerThreshold,hint:t.triggerThresholdHint,value:Number((_.triggerThreshold*100).toFixed(2)),min:10,max:98,step:.1,onChange:e=>w({triggerThreshold:e/100})}),(0,Z.jsx)($,{id:`compaction-reserve-tokens`,label:t.reserveTokens,hint:t.reserveTokensHint.replace(`{{tokens}}`,Ge(_.reserveTokens)),value:_.reserveTokens,min:1024,step:1024,onChange:e=>w({reserveTokens:Math.floor(e)})}),(0,Z.jsx)($,{id:`compaction-recent-turns`,label:t.recentTurnsPreserve,hint:t.recentTurnsPreserveHint,value:_.recentTurnsPreserve,min:1,max:12,onChange:e=>w({recentTurnsPreserve:Math.floor(e)})}),(0,Z.jsx)($,{id:`compaction-keep-recent-tokens`,label:t.keepRecentTokens,hint:t.keepRecentTokensHint.replace(`{{tokens}}`,Ge(_.keepRecentTokens)),value:_.keepRecentTokens,min:1e3,step:1e3,onChange:e=>w({keepRecentTokens:Math.floor(e)})})]}),R?(0,Z.jsx)(`p`,{className:`rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:border-amber-800 dark:bg-amber-950/40 dark:text-amber-100`,children:t.retentionWarning}):null,(0,Z.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.summaryModel}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 gap-2`,children:[(0,Z.jsx)(ge,{value:_.model??``,disabled:!_.enabled,placeholder:t.summaryModelInherited,searchPlaceholder:t.summaryModelSearch,noMatches:t.summaryModelNoMatches,models:i,modelsLoading:a,className:`min-w-0 flex-1 justify-between`,contentAlign:`start`,showProviderSettingsFooter:!0,onChange:e=>w({model:e})}),_.model?(0,Z.jsx)(C,{type:`button`,variant:`secondary`,onClick:()=>w({model:void 0}),children:t.summaryModelUseSession}):null]}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:t.summaryModelHint})]}),(0,Z.jsx)(Ke,{label:t.qualityGuard,hint:t.qualityGuardHint,checked:_.qualityGuard,onChange:e=>w({qualityGuard:e})}),(0,Z.jsx)(Ke,{label:t.gapAudit,hint:t.gapAuditHint,checked:_.gapAudit,onChange:e=>w({gapAudit:e})})]}),_.qualityGuard?null:(0,Z.jsx)(`p`,{className:`rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:border-amber-800 dark:bg-amber-950/40 dark:text-amber-100`,children:t.qualityGuardWarning}),(0,Z.jsx)(Se,{children:(0,Z.jsxs)(`div`,{className:`space-y-5 border-t border-edge pt-5`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:t.advancedTitle}),(0,Z.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:t.advancedHint})]}),(0,Z.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Z.jsx)($,{id:`compaction-min-messages`,label:t.minMessagesBeforeCompact,hint:t.minMessagesBeforeCompactHint,value:_.minMessagesBeforeCompact,min:2,onChange:e=>w({minMessagesBeforeCompact:Math.floor(e)})}),(0,Z.jsx)($,{id:`compaction-max-transcript-mb`,label:t.maxActiveTranscriptMb,hint:t.maxActiveTranscriptMbHint,value:Number((_.maxActiveTranscriptBytes/1e6).toFixed(3)),min:.064,step:.1,onChange:e=>w({maxActiveTranscriptBytes:Math.max(64e3,Math.round(e*1e6))})}),(0,Z.jsx)($,{id:`compaction-summary-max-tokens`,label:t.summaryMaxTokens,hint:t.summaryMaxTokensHint,value:_.summaryMaxTokens,min:256,step:256,onChange:e=>w({summaryMaxTokens:Math.floor(e)})}),(0,Z.jsx)($,{id:`compaction-summary-chunk-tokens`,label:t.summaryChunkTokens,hint:t.summaryChunkTokensHint,value:_.summaryChunkTokens,min:1e3,step:1e3,onChange:e=>w({summaryChunkTokens:Math.floor(e)})}),(0,Z.jsx)($,{id:`compaction-summary-timeout`,label:t.summaryTimeoutSeconds,hint:t.summaryTimeoutSecondsHint.replace(`{{seconds}}`,String(z)),value:_.summaryTimeoutMs/1e3,min:1,max:600,onChange:e=>w({summaryTimeoutMs:Math.round(e*1e3)})}),(0,Z.jsx)($,{id:`compaction-summary-retries`,label:t.summaryRetries,hint:t.summaryRetriesHint,value:_.summaryRetries,min:0,max:5,onChange:e=>w({summaryRetries:Math.floor(e)})}),(0,Z.jsx)($,{id:`compaction-min-tool-result-chars`,label:t.minToolResultKeepChars,hint:t.minToolResultKeepCharsHint,value:_.minToolResultKeepChars,min:200,step:100,onChange:e=>w({minToolResultKeepChars:Math.floor(e)})})]}),L?(0,Z.jsx)(`p`,{className:`rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:border-amber-800 dark:bg-amber-950/40 dark:text-amber-100`,children:t.summaryBudgetWarning}):null,(0,Z.jsxs)(`div`,{className:`border-t border-edge pt-5`,children:[(0,Z.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.postCompactionSections}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:t.postCompactionSectionsHint}),_.postCompactionSections.length>0?(0,Z.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:_.postCompactionSections.map(e=>(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-lg border border-edge bg-surface-panel px-2.5 py-1.5 text-xs text-fg`,children:[e,(0,Z.jsx)(`button`,{type:`button`,className:x(`text-fg-muted hover:text-fg`,P.press),"aria-label":t.removeSection.replace(`{{section}}`,e),onClick:()=>w({postCompactionSections:_.postCompactionSections.filter(t=>t!==e)}),children:(0,Z.jsx)(h,{className:`size-3.5`,"aria-hidden":!0})})]},e))}):(0,Z.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:t.postCompactionSectionsEmpty}),(0,Z.jsxs)(`div`,{className:`mt-3 flex gap-2`,children:[(0,Z.jsx)(`input`,{className:He(),value:l,maxLength:120,disabled:_.postCompactionSections.length>=12,placeholder:t.postCompactionSectionsPlaceholder,onChange:e=>u(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),H())}}),(0,Z.jsxs)(C,{type:`button`,variant:`secondary`,disabled:!l.trim()||_.postCompactionSections.length>=12,onClick:H,children:[(0,Z.jsx)(m,{className:`size-4`,"aria-hidden":!0}),t.addSection]})]})]})]})})]})]})}function Je(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ye(e){return e===`main`||e===`per-peer`||e===`per-channel-peer`||e===`per-account-channel-peer`?e:`main`}function Xe(e){let t=Je(e)?e:{},n=Je(t.session)?t.session:{},r=Je(n.storage)?n.storage:{},i=typeof r.pruneAfterDays==`number`&&Number.isFinite(r.pruneAfterDays)?Math.max(0,Math.floor(r.pruneAfterDays)):typeof r.pruneAfterMs==`number`&&Number.isFinite(r.pruneAfterMs)?Math.max(0,Math.round(r.pruneAfterMs/864e5)):null,a=typeof r.maxEntries==`number`&&Number.isFinite(r.maxEntries)?Math.max(1,Math.floor(r.maxEntries)):null;return{dmScope:Ye(n.dmScope),pruneAfterDays:i,maxEntries:a}}async function Ze(e){await _(y(`/api/config`),{method:`PATCH`,body:JSON.stringify({session:{dmScope:e.dmScope,storage:{pruneAfterMs:e.pruneAfterDays===null?null:e.pruneAfterDays*864e5,maxEntries:e.maxEntries}}})}),w()}function Qe(){return x(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,Y,`dark:border-edge`)}var $e=ae();function et({hasToken:e}){let t=g(v(e=>e.language)).sessions.config,{data:n,isLoading:r}=T(e),i=(0,X.useMemo)(()=>n?.payload?.config===void 0?null:Xe(n.payload.config),[n]),[a,o]=(0,X.useReducer)($e,{form:null,baseline:null}),s=a.form,c=a.baseline,l=(0,X.useRef)(!1),u=(0,X.useRef)(s);u.current=s;let p=(0,X.useRef)(null);q({enabled:e,parsed:i,dirty:l.current,trackedParsedRef:p,dispatch:o,onResetDirty:()=>{l.current=!1}});let m=!!(s&&c&&JSON.stringify(s)!==JSON.stringify(c)),h=(0,X.useCallback)(e=>{l.current=!0,o({type:`patch`,patch:e})},[]),_=be({value:s,dirty:m,onSave:(0,X.useCallback)(async e=>{try{await Ze(e),o({type:`saved`,value:e}),l.current=!!(u.current&&JSON.stringify(u.current)!==JSON.stringify(e))}catch(e){throw Error(e instanceof Error?e.message:t.saveError)}},[t.saveError])});return!e||!s?r?(0,Z.jsx)(ve,{children:(0,Z.jsxs)(`div`,{className:`space-y-3`,"aria-busy":!0,children:[(0,Z.jsx)(E,{className:`h-5 w-40`}),(0,Z.jsx)(E,{className:`h-24 w-full rounded-xl`})]})}):null:(0,Z.jsxs)(ve,{onBlurCapture:_.onBlurCapture,children:[(0,Z.jsx)(_e,{icon:le,title:t.title,subtitle:t.hint,trailing:(0,Z.jsx)(ye,{status:_.status,error:_.error})}),(0,Z.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Z.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,Z.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.dmScope}),(0,Z.jsxs)(d,{className:Qe(),value:s.dmScope,onChange:e=>h({dmScope:e.target.value}),children:[(0,Z.jsx)(f,{value:`main`,children:t.dmScopeMain}),(0,Z.jsx)(f,{value:`per-peer`,children:t.dmScopePerPeer}),(0,Z.jsx)(f,{value:`per-channel-peer`,children:t.dmScopePerChannelPeer}),(0,Z.jsx)(f,{value:`per-account-channel-peer`,children:t.dmScopePerAccountChannelPeer})]}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:t.dmScopeHint})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.pruneAfterDays}),(0,Z.jsx)(`input`,{type:`number`,min:0,className:Qe(),value:s.pruneAfterDays??``,placeholder:t.unsetPlaceholder,onChange:e=>{let t=e.target.value.trim();h({pruneAfterDays:t===``?null:Math.max(0,Math.floor(Number(t)||0))})}})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.maxEntries}),(0,Z.jsx)(`input`,{type:`number`,min:1,className:Qe(),value:s.maxEntries??``,placeholder:t.unsetPlaceholder,onChange:e=>{let t=e.target.value.trim();h({maxEntries:t===``?null:Math.max(1,Math.floor(Number(t)||1))})}})]})]})]})}function tt(e){if(typeof e==`string`)return e.length>2e3?`${e.slice(0,2e3)}…`:e;try{let t=JSON.stringify(e,null,2);return t.length>2e3?`${t.slice(0,2e3)}…`:t}catch{return String(e)}}function nt(e){let t=(0,Ce.c)(60),{open:n,loading:r,session:i,sessionAgentId:d,sessionAgentAvatar:f,labels:p,onClose:m,onArchive:g,onUnarchive:_,onPin:v,onUnpin:y,onExport:b,onDelete:S}=e,w=i?.status===`archived`,T=i?.status===`pinned`,E;t[0]===m?E=t[1]:(E=e=>!e&&m(),t[0]=m,t[1]=E);let O;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Z.jsx)(a,{className:x(`xopc-dialog-overlay fixed inset-0 bg-scrim`,D)}),t[2]=O):O=t[2];let k;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(k=x(`xopc-drawer-right fixed right-0 top-0 flex size-full max-w-lg flex-col border-l border-edge bg-surface-panel shadow-popover outline-none`,ee,`dark:border-edge`),t[3]=k):k=t[3];let A;t[4]!==i||t[5]!==f||t[6]!==d?(A=i&&d?(0,Z.jsx)(V,{agentId:d,avatar:f,size:40,className:`size-10 shrink-0 ring-1 ring-edge/60 dark:ring-edge`}):null,t[4]=i,t[5]=f,t[6]=d,t[7]=A):A=t[7];let j;t[8]!==p.unnamedSession||t[9]!==i?.name?(j=i?.name?.trim()||p.unnamedSession,t[8]=p.unnamedSession,t[9]=i?.name,t[10]=j):j=t[10];let M;t[11]===j?M=t[12]:(M=(0,Z.jsx)(l,{className:`min-w-0 flex-1 truncate text-base font-semibold tracking-tight text-fg`,children:j}),t[11]=j,t[12]=M);let N;t[13]!==A||t[14]!==M?(N=(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-3`,children:[A,M]}),t[13]=A,t[14]=M,t[15]=N):N=t[15];let P;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(h,{className:`size-5`,strokeWidth:1.75}),t[16]=P):P=t[16];let F;t[17]===p.close?F=t[18]:(F=(0,Z.jsx)(o,{asChild:!0,children:(0,Z.jsx)(C,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":p.close,children:P})}),t[17]=p.close,t[18]=F);let I;t[19]!==N||t[20]!==F?(I=(0,Z.jsxs)(`div`,{className:`flex min-w-0 shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3 dark:border-edge`,children:[N,F]}),t[19]=N,t[20]=F,t[21]=I):I=t[21];let L;t[22]!==p.detailLoading||t[23]!==p.detailMessages||t[24]!==r||t[25]!==i?(L=r?(0,Z.jsx)(`p`,{className:`text-sm text-fg-muted`,children:p.detailLoading}):i?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`dl`,{className:`mb-4 grid gap-2 text-xs text-fg-muted`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`text-fg-disabled`,children:`Key`}),(0,Z.jsx)(`dd`,{className:`mt-0.5 break-all font-mono text-fg`,children:i.key})]}),(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-4`,children:(0,Z.jsxs)(`span`,{children:[i.messageCount,` msgs · `,i.estimatedTokens,` tok`]})})]}),(0,Z.jsx)(`h3`,{className:`mb-2 text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:p.detailMessages}),(0,Z.jsx)(`ul`,{className:`space-y-3`,children:i.messages.map(rt)})]}):null,t[22]=p.detailLoading,t[23]=p.detailMessages,t[24]=r,t[25]=i,t[26]=L):L=t[26];let R;t[27]===L?R=t[28]:(R=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:L}),t[27]=L,t[28]=R);let z;t[29]!==p.detailExport||t[30]!==b?(z=(0,Z.jsx)(C,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:b,children:p.detailExport}),t[29]=p.detailExport,t[30]=b,t[31]=z):z=t[31];let B;t[32]!==w||t[33]!==p.archive||t[34]!==p.unarchive||t[35]!==g||t[36]!==_?(B=w?(0,Z.jsx)(C,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:_,children:p.unarchive}):(0,Z.jsx)(C,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:g,children:p.archive}),t[32]=w,t[33]=p.archive,t[34]=p.unarchive,t[35]=g,t[36]=_,t[37]=B):B=t[37];let H;t[38]!==T||t[39]!==p.pin||t[40]!==p.unpin||t[41]!==v||t[42]!==y?(H=T?(0,Z.jsx)(C,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:y,children:p.unpin}):(0,Z.jsx)(C,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:v,children:p.pin}),t[38]=T,t[39]=p.pin,t[40]=p.unpin,t[41]=v,t[42]=y,t[43]=H):H=t[43];let U;t[44]!==p.delete||t[45]!==S?(U=(0,Z.jsx)(C,{type:`button`,variant:`secondary`,className:`text-sm text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-950/40`,onClick:S,children:p.delete}),t[44]=p.delete,t[45]=S,t[46]=U):U=t[46];let W;t[47]!==z||t[48]!==B||t[49]!==H||t[50]!==U?(W=(0,Z.jsx)(`div`,{className:`shrink-0 border-t border-edge px-4 py-3 dark:border-edge`,children:(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[z,B,H,U]})}),t[47]=z,t[48]=B,t[49]=H,t[50]=U,t[51]=W):W=t[51];let G;t[52]!==I||t[53]!==R||t[54]!==W?(G=(0,Z.jsxs)(s,{children:[O,(0,Z.jsxs)(c,{className:k,"aria-describedby":void 0,children:[I,R,W]})]}),t[52]=I,t[53]=R,t[54]=W,t[55]=G):G=t[55];let K;return t[56]!==n||t[57]!==E||t[58]!==G?(K=(0,Z.jsx)(u,{open:n,onOpenChange:E,children:G}),t[56]=n,t[57]=E,t[58]=G,t[59]=K):K=t[59],K}function rt(e){return(0,Z.jsxs)(`li`,{className:`rounded-lg border border-edge-subtle bg-surface-hover/50 p-2 dark:border-edge`,children:[(0,Z.jsx)(`div`,{className:`mb-1 text-[10px] font-medium uppercase text-fg-subtle`,children:e.role}),(0,Z.jsx)(`pre`,{className:`max-h-40 overflow-auto whitespace-pre-wrap break-words font-mono text-[11px] leading-relaxed text-fg-muted`,children:tt(e.content)})]},`${e.timestamp??``}-${e.role}-${tt(e.content).slice(0,24)}`)}var it=20;function at(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}var ot=new Set([`all`,`active`,`pinned`,`archived`]),st=new Set([`grid`,`list`]),ct=[`sessions`,`settings`];function lt(e){return e&&ct.includes(e)?e:`sessions`}function ut(e,t){return t===`sessions`?e.tabsSessions:e.tabsSettings}function dt(e,t){return t===`sessions`?e.tabsSessionsHint:e.tabsSettingsHint}function ft(e){let t=(0,Ce.c)(7),{s:n,activeTab:r,onChange:i}=e,a;t[0]===n?a=t[1]:(a=ct.map(e=>({id:e,label:ut(n,e),icon:e===`sessions`?te:H})),t[0]=n,t[1]=a);let o=a,s;return t[2]!==r||t[3]!==o||t[4]!==i||t[5]!==n.tabsAriaLabel?(s=(0,Z.jsx)(xe,{items:o,activeTab:r,onChange:i,ariaLabel:n.tabsAriaLabel,tabIdPrefix:`sessions-tab`,panelIdPrefix:`sessions-panel`}),t[2]=r,t[3]=o,t[4]=i,t[5]=n.tabsAriaLabel,t[6]=s):s=t[6],s}function pt(e){let t=(0,Ce.c)(10),{s:n,id:r,activeTab:i,plain:a,children:o}=e,s=a===void 0?!1:a;if(i!==r)return null;let c=`sessions-panel-${r}`,l=`sessions-tab-${r}`,u=s?`contents`:`rounded-2xl bg-surface-base px-4 py-5 sm:px-5`,d;t[0]!==o||t[1]!==r||t[2]!==s||t[3]!==n?(d=s?o:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`mb-5`,children:[(0,Z.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:ut(n,r)}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:dt(n,r)})]}),(0,Z.jsx)(`div`,{className:`space-y-4`,children:o})]}),t[0]=o,t[1]=r,t[2]=s,t[3]=n,t[4]=d):d=t[4];let f;return t[5]!==c||t[6]!==l||t[7]!==u||t[8]!==d?(f=(0,Z.jsx)(`section`,{id:c,role:`tabpanel`,"aria-labelledby":l,className:u,children:d}),t[5]=c,t[6]=l,t[7]=u,t[8]=d,t[9]=f):f=t[9],f}function mt(e){let t=e.get(`status`),n=e.get(`view`);return{searchInput:e.get(`q`)??``,debouncedSearch:(e.get(`q`)??``).trim(),statusFilter:ot.has(t)?t:`all`,viewMode:st.has(n)?n:`grid`,channelFilter:(e.get(`channel`)??``).trim(),sessions:[],loading:!1,error:null,hasMore:!1,stats:null,detailOpen:!1,detailLoading:!1,detailSession:null,confirmOpen:!1,confirmKey:null}}function ht(){let e=g(v(e=>e.language)),t=e.sessions,n=b(e=>e.token),r=!!n,{data:o,mutate:d}=S(r?[`gateway-chat-agents`,n]:null,ue,{revalidateOnFocus:!1}),f=o?.defaultId??`main`,p=o?.items??[],[m,h]=i(),_=lt(m.get(`tab`)),y=(0,X.useCallback)(e=>{let t=new URLSearchParams(m);e===`sessions`?t.delete(`tab`):t.set(`tab`,e),h(t,{replace:!0})},[m,h]),[w,T]=(0,X.useReducer)(fe,m,mt),{searchInput:E,debouncedSearch:O,statusFilter:k,viewMode:j,channelFilter:V,sessions:H,loading:G,error:ne,hasMore:q,stats:ie,detailOpen:ae,detailLoading:oe,detailSession:J,confirmOpen:le,confirmKey:Y}=w;(0,X.useEffect)(()=>{let e=setTimeout(()=>{let e=E.trim();O!==e&&T({type:`patch`,patch:{debouncedSearch:e}})},300);return()=>clearTimeout(e)},[E,O]);let he=m.toString(),ge=(0,X.useRef)(he);if(ge.current!==he){ge.current=he;let e=m.get(`q`)??``,t=m.get(`status`),n=m.get(`view`),r=(m.get(`channel`)??``).trim(),i=ot.has(t)?t:`all`,a=st.has(n)?n:`grid`,o=e.trim();T({type:`patch`,patch:{...E===e?{}:{searchInput:e},...O===o?{}:{debouncedSearch:o},...k===i?{}:{statusFilter:i},...j===a?{}:{viewMode:a},...V===r?{}:{channelFilter:r}}})}(0,X.useEffect)(()=>{let e=new URLSearchParams(m),t=O.trim();t?e.set(`q`,t):e.delete(`q`),k===`all`?e.delete(`status`):e.set(`status`,k),j===`grid`?e.delete(`view`):e.set(`view`,j),V?e.set(`channel`,V):e.delete(`channel`),e.toString()!==m.toString()&&h(e,{replace:!0})},[O,m,h,k,j,V]),(0,X.useEffect)(()=>{if(!r||_!==`sessions`)return;let e=!1;return(async()=>{T({type:`patch`,patch:{loading:!0,error:null}});try{let t=await R({limit:it,offset:0,...O?{search:O}:{},...k===`all`?{}:{status:k},...V?{channel:V}:{}});if(e)return;T({type:`patch`,patch:{sessions:t.items,hasMore:t.hasMore}})}catch(n){e||T({type:`patch`,patch:{error:n instanceof Error?n.message:t.loadError}})}finally{e||T({type:`patch`,patch:{loading:!1}})}})(),()=>{e=!0}},[r,_,O,k,V,t.loadError]),(0,X.useEffect)(()=>{!r||_!==`sessions`||se().then(e=>T({type:`patch`,patch:{stats:e}})).catch(()=>{})},[r,_]),(0,X.useEffect)(()=>{if(!r||_!==`sessions`)return;let e=()=>void d();return window.addEventListener(`config-reload`,e),()=>window.removeEventListener(`config-reload`,e)},[r,_,d]),(0,X.useEffect)(()=>{if(!r||_!==`sessions`)return;let e=e=>{let t=e.detail;!t?.key||t.name===void 0||T({type:`patch`,patch:{sessions:H.map(e=>e.key===t.key?{...e,name:t.name}:e),detailSession:J&&J.key===t.key?{...J,name:t.name}:J}})};return window.addEventListener(`session-updated`,e),()=>{window.removeEventListener(`session-updated`,e)}},[r,_,H,J]);let _e=(0,X.useCallback)(async()=>{if(!(!r||G||!q)){T({type:`patch`,patch:{loading:!0,error:null}});try{let e=await R({limit:it,offset:H.length,...O?{search:O}:{},...k===`all`?{}:{status:k},...V?{channel:V}:{}});T({type:`patch`,patch:{sessions:[...H,...e.items],hasMore:e.hasMore}})}catch(e){T({type:`patch`,patch:{error:e instanceof Error?e.message:t.loadError}})}finally{T({type:`patch`,patch:{loading:!1}})}}},[r,G,q,H.length,O,k,V,t.loadError]),ve=(0,X.useCallback)((e,t)=>{T({type:`patch`,patch:{sessions:H.map(n=>n.key===e?{...n,status:t}:n),detailSession:J&&J.key===e?{...J,status:t}:J}})},[H,J]),ye=(0,X.useCallback)(async e=>{T({type:`patch`,patch:{detailOpen:!0,detailLoading:!0,detailSession:null}});try{T({type:`patch`,patch:{detailSession:await A(e)}})}catch{T({type:`patch`,patch:{detailOpen:!1}})}finally{T({type:`patch`,patch:{detailLoading:!1}})}},[]),be=e=>{ye(e)},xe=async(e,t)=>{if(t===`continue`){window.dispatchEvent(new CustomEvent(`navigate-to-chat`,{detail:{sessionKey:e},bubbles:!0}));return}if(t===`delete`){T({type:`patch`,patch:{confirmKey:e,confirmOpen:!0}});return}try{switch(t){case`archive`:await M(e),ve(e,`archived`);break;case`unarchive`:await N(e),ve(e,`active`);break;case`pin`:await z(e),ve(e,`pinned`);break;case`unpin`:await I(e),ve(e,`active`);break;case`export`:{let t=await ce(e),n=new Blob([t],{type:`application/json`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`session-${e.replace(/[^a-z0-9]/gi,`_`)}.json`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(r);break}default:break}se().then(e=>T({type:`patch`,patch:{stats:e}})).catch(()=>{})}catch{}},Se=async e=>{try{await B(e),T({type:`patch`,patch:{sessions:H.filter(t=>t.key!==e),detailSession:J?.key===e?null:J,...J?.key===e?{detailOpen:!1}:{}}}),se().then(e=>T({type:`patch`,patch:{stats:e}})).catch(()=>{})}catch{}},Ce={continueChat:t.continueChat,archive:t.archive,unarchive:t.unarchive,pin:t.pin,unpin:t.unpin,export:t.export,delete:t.delete,unnamedSession:e.chat.newSession},we={close:t.close,detailLoading:t.detailLoading,detailMessages:t.detailMessages,detailExport:t.detailExport,archive:t.archive,unarchive:t.unarchive,pin:t.pin,unpin:t.unpin,delete:t.delete,unnamedSession:e.chat.newSession},Te=[{key:`all`,label:t.filterAll,icon:te},{key:`active`,label:t.filterActive,icon:W},{key:`pinned`,label:t.filterPinned,icon:pe},{key:`archived`,label:t.filterArchived,icon:me}],De=(()=>{let e=Object.entries(ie?.byChannel??{}).sort((e,t)=>t[1]-e[1]).slice(0,6).map(([e])=>e),t=new Set(e);for(let n of[`telegram`,`weixin`,`feishu`])t.has(n)||(e.push(n),t.add(n));return e.slice(0,8)})();return r?(0,Z.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-x-hidden bg-surface-panel`,children:[(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-6 px-3 py-6 sm:px-5 xl:px-6`,children:[(0,Z.jsx)(`header`,{className:`flex flex-col gap-2`,children:(0,Z.jsx)(`h1`,{className:`text-lg font-semibold tracking-tight text-fg`,children:t.title})}),(0,Z.jsx)(ft,{s:t,activeTab:_,onChange:y}),(0,Z.jsx)(pt,{s:t,id:`settings`,activeTab:_,plain:!0,children:(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[(0,Z.jsx)(qe,{hasToken:r}),(0,Z.jsx)(et,{hasToken:r})]})}),(0,Z.jsxs)(pt,{s:t,id:`sessions`,activeTab:_,plain:!0,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3 lg:flex-row lg:items-center lg:justify-between`,children:[(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:Te.map(({key:e,label:t,icon:n})=>(0,Z.jsxs)(`button`,{type:`button`,"aria-pressed":k===e,onClick:()=>T({type:`patch`,patch:{statusFilter:e}}),className:x(`inline-flex items-center gap-1.5 rounded-xl px-3 py-2 text-sm font-medium`,P.transition,P.focusRingPanel,k===e?`bg-accent-soft text-accent-fg`:`bg-surface-base text-fg-muted hover:bg-surface-hover hover:text-fg dark:bg-surface-hover/35`),children:[(0,Z.jsx)(n,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t]},e))}),(0,Z.jsxs)(`div`,{className:`flex w-full min-w-0 items-center gap-2 rounded-xl bg-surface-base px-3 py-2 transition-colors lg:max-w-md dark:bg-surface-hover/40`,children:[(0,Z.jsx)(de,{className:`size-4 shrink-0 text-fg-disabled`,strokeWidth:1.75,"aria-hidden":!0}),(0,Z.jsx)(`input`,{type:`search`,value:E,onChange:e=>T({type:`patch`,patch:{searchInput:e.target.value}}),placeholder:t.searchPlaceholder,"data-debounced-query":O||void 0,className:`min-w-0 flex-1 border-0 bg-transparent text-sm text-fg placeholder:text-fg-disabled focus:outline-none focus:ring-0`})]})]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-xs font-medium text-fg-subtle`,children:t.filterChannelLabel}),(0,Z.jsx)(`button`,{type:`button`,"aria-pressed":!V,onClick:()=>T({type:`patch`,patch:{channelFilter:``}}),className:x(`inline-flex items-center rounded-xl px-3 py-2 text-sm font-medium`,P.transition,P.focusRingPanel,V?`bg-surface-base text-fg-muted hover:bg-surface-hover hover:text-fg dark:bg-surface-hover/35`:`bg-accent-soft text-accent-fg`),children:t.filterChannelAll}),De.map(e=>(0,Z.jsxs)(`button`,{type:`button`,"aria-pressed":V===e,onClick:()=>T({type:`patch`,patch:{channelFilter:e}}),className:x(`inline-flex items-center rounded-xl px-3 py-2 text-sm font-medium`,P.transition,P.focusRingPanel,V===e?`bg-accent-soft text-accent-fg`:`bg-surface-base text-fg-muted hover:bg-surface-hover hover:text-fg dark:bg-surface-hover/35`),children:[e,ie?.byChannel?.[e]==null?null:(0,Z.jsx)(`span`,{className:`ml-2 rounded-full bg-surface-hover px-2 py-0.5 text-[11px] text-fg-subtle`,children:ie.byChannel[e]})]},e))]}),ie?(0,Z.jsx)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-4`,children:[[ie.totalSessions,t.totalSessions],[ie.activeSessions,t.activeSessions],[ie.pinnedSessions,t.pinnedSessions],[ie.archivedSessions,t.archivedSessions]].map(([e,t])=>(0,Z.jsxs)(`div`,{className:`rounded-xl bg-surface-base p-3 dark:bg-surface-hover/30`,children:[(0,Z.jsx)(`div`,{className:`text-lg font-semibold tabular-nums text-fg`,children:e}),(0,Z.jsx)(`div`,{className:`text-xs text-fg-muted`,children:t})]},t))}):null,ne?(0,Z.jsx)(`div`,{className:`rounded-lg border border-edge bg-red-50 px-3 py-2 text-sm text-red-700 dark:border-edge dark:bg-red-950/40 dark:text-red-300`,children:ne}):null,(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Z.jsx)(`p`,{className:`text-xs text-fg-muted`,children:at(t.sessionCount,{count:H.length})}),(0,Z.jsxs)(`div`,{className:U,role:`group`,"aria-label":t.layoutToggleGroup,children:[(0,Z.jsx)(C,{type:`button`,variant:`segmented`,title:t.gridView,"aria-pressed":j===`grid`,onClick:()=>T({type:`patch`,patch:{viewMode:`grid`}}),className:x(F,`size-7 p-0`,j===`grid`&&`bg-surface-panel shadow-sm dark:bg-surface-panel dark:shadow-sm dark:ring-1 dark:ring-edge-strong/40`,j===`grid`&&`text-accent-fg`),children:(0,Z.jsx)(K,{className:`size-3.5`,strokeWidth:1.5})}),(0,Z.jsx)(C,{type:`button`,variant:`segmented`,title:t.listView,"aria-pressed":j===`list`,onClick:()=>T({type:`patch`,patch:{viewMode:`list`}}),className:x(F,`size-9 p-0`,j===`list`&&`bg-surface-panel shadow-sm dark:bg-surface-panel dark:shadow-sm dark:ring-1 dark:ring-edge-strong/40`,j===`list`&&`text-accent-fg`),children:(0,Z.jsx)(L,{className:`size-3.5`,strokeWidth:1.5})})]})]}),G&&H.length===0?(0,Z.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:Array.from({length:6}).map((e,t)=>(0,Z.jsx)(`div`,{className:`h-40 animate-pulse rounded-xl bg-surface-hover/60 dark:bg-surface-hover/40`},t))}):H.length===0?(0,Z.jsxs)(`div`,{className:`flex flex-col items-center justify-center rounded-2xl bg-surface-base py-16 text-center dark:bg-surface-hover/25`,children:[(0,Z.jsx)(re,{className:`mb-3 size-12 text-fg-disabled`,strokeWidth:1.25,"aria-hidden":!0}),(0,Z.jsx)(`p`,{className:`text-base font-semibold text-fg`,children:t.noSessions}),(0,Z.jsx)(`p`,{className:`mt-1 max-w-sm text-sm text-fg-muted`,children:t.noSessionsDescription}),(0,Z.jsx)(C,{variant:`primary`,className:`mt-6`,onClick:()=>{window.dispatchEvent(new CustomEvent(`navigate-to-chat`,{detail:{sessionKey:``},bubbles:!0}))},children:t.startNewChat})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:x(`grid min-w-0 gap-3`,j===`grid`?`sm:grid-cols-2 lg:grid-cols-3`:`grid-cols-1`),"data-debounced-query":O||void 0,children:H.map(e=>{let t=Ae(e,f);return(0,Z.jsx)(Ee,{session:e,variant:j,labels:Ce,sessionAgentId:t,sessionAgentAvatar:je(t,p),onOpen:()=>be(e.key),onAction:t=>void xe(e.key,t)},e.key)})}),q?(0,Z.jsx)(`div`,{className:`flex justify-center pt-2`,children:(0,Z.jsx)(C,{type:`button`,variant:`secondary`,disabled:G,onClick:()=>void _e(),children:t.loadMore})}):null]})]})]}),(0,Z.jsx)(nt,{open:ae,loading:oe,session:J,sessionAgentId:J?Ae(J,f):void 0,sessionAgentAvatar:J?je(Ae(J,f),p):void 0,labels:we,onClose:()=>{T({type:`patch`,patch:{detailOpen:!1,detailSession:null}})},onArchive:()=>J&&void xe(J.key,`archive`),onUnarchive:()=>J&&void xe(J.key,`unarchive`),onPin:()=>J&&void xe(J.key,`pin`),onUnpin:()=>J&&void xe(J.key,`unpin`),onExport:()=>J&&void xe(J.key,`export`),onDelete:()=>J&&T({type:`patch`,patch:{confirmKey:J.key,confirmOpen:!0}})}),(0,Z.jsx)(u,{open:le,onOpenChange:e=>T({type:`patch`,patch:{confirmOpen:e}}),children:(0,Z.jsxs)(s,{children:[(0,Z.jsx)(a,{className:x(`xopc-dialog-overlay fixed inset-0 bg-scrim`,D)}),(0,Z.jsxs)(c,{className:x(`xopc-dialog-content fixed left-1/2 top-1/2 w-[min(100%-2rem,24rem)] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-edge bg-surface-panel p-4 shadow-popover dark:border-edge`,ee),children:[(0,Z.jsx)(l,{className:`text-base font-semibold text-fg`,children:t.deleteSessionTitle}),(0,Z.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:Y?at(t.deleteSessionMessage,{name:H.find(e=>e.key===Y)?.name?.trim()||e.chat.newSession}):``}),(0,Z.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,Z.jsx)(C,{type:`button`,variant:`secondary`,onClick:()=>T({type:`patch`,patch:{confirmOpen:!1}}),children:t.cancel}),(0,Z.jsx)(C,{type:`button`,variant:`primary`,className:`bg-red-600 hover:bg-red-700`,onClick:()=>{Y&&Se(Y),T({type:`patch`,patch:{confirmOpen:!1,confirmKey:null}})},children:t.delete})]})]})]})})]}):(0,Z.jsx)(`div`,{className:`w-full px-3 py-16 text-center text-sm text-fg-muted sm:px-5 xl:px-6`,children:t.needToken})}export{ht as SessionsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{bn as e}from"./index-aBs0EfQB.js";function t(t){let{children:n,fallback:r}=t,i=r===void 0?null:r;return e()?n:i}export{t};
|
|
@@ -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{a,n as o,o as s,r as c,s as l,t as u}from"./dist-CpzYSoz7.js";import{t as d}from"./check-DUBLcKHA.js";import{n as f,r as p}from"./popover-select-C-Hj-nXR.js";import{t as m}from"./copy-Dv6d4Dvw.js";import{t as h}from"./loader-circle-CifKLtgG.js";import{t as g}from"./plus-Q2yW6OE7.js";import{t as _}from"./x-B_N4OPjy.js";import{t as v}from"./copy-to-clipboard-HOJ79TWv.js";import{t as y}from"./messages-W5P19VTF.js";import{a as b,n as x,r as S,s as C}from"./locale-store-zEL8bkwx.js";import{t as w}from"./cn-JdwAhgNB.js";import{i as ee}from"./vendor-swr-BIWyz7Rc.js";import{t as T}from"./button-CtTvuElV.js";import{n as E,r as D}from"./gateway-config-swr-BGdHwT4e.js";import{t as O}from"./skeleton-BwbyijEw.js";import{$r as te,As as k,Ei as A,Ll as j,Ls as M,Ql as N,Sl as P,_l as F,ai as I,ci as ne,dn as re,ii as L,jc as ie,li as R,mn as ae,no as oe,oa as z,oi as se,ri as B,sc as ce,si as V,ti as le,ui as H,wi as ue}from"./index-aBs0EfQB.js";import{n as de,r as U,t as fe}from"./settings-page-layout-BRQNel6r.js";import{t as pe}from"./settings-loading-skeleton-CAmWMaOT.js";import{t as W}from"./settings-form-section-CZu6FX4k.js";import{t as me}from"./page-tabs-BFMGjA60.js";var G=e(t(),1),he=n(),K={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`],noteEnabled:!0,noteMaxTotalSizeMb:250,noteMaxAttachmentCount:50,siteEnabled:!0,siteDefaultTtlHours:24,siteMaxTtlDays:30,maxActiveSites:50,siteMaxRootDirSizeMb:1024,siteMaxFileCount:2e4};function ge(){return structuredClone(K)}var q=36e5,J=864e5,Y=1048576;function _e(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function X(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 ve(e){let t=_e(e)?e:{},n=_e(t.gateway)?t.gateway:{},r=_e(n.share)?n.share:{},i=_e(r.directory)?r.directory:{},a=_e(r.note)?r.note:{},o=_e(n.siteShare)?n.siteShare:{},s=_e(o.static)?o.static:{},c=typeof r.defaultTtlMs==`number`&&Number.isFinite(r.defaultTtlMs)?Math.floor(r.defaultTtlMs):K.defaultTtlHours*q,l=typeof r.maxTtlMs==`number`&&Number.isFinite(r.maxTtlMs)?Math.floor(r.maxTtlMs):K.maxTtlDays*J,u=typeof r.maxFileSize==`number`&&Number.isFinite(r.maxFileSize)?Math.floor(r.maxFileSize):K.maxFileSizeMb*Y,d=typeof i.maxFolderSize==`number`&&Number.isFinite(i.maxFolderSize)?Math.floor(i.maxFolderSize):K.directoryMaxFolderSizeMb*Y,f=typeof o.defaultTtlMs==`number`&&Number.isFinite(o.defaultTtlMs)?Math.floor(o.defaultTtlMs):K.siteDefaultTtlHours*q,p=typeof o.maxTtlMs==`number`&&Number.isFinite(o.maxTtlMs)?Math.floor(o.maxTtlMs):K.siteMaxTtlDays*J,m=typeof s.maxRootDirSize==`number`&&Number.isFinite(s.maxRootDirSize)?Math.floor(s.maxRootDirSize):K.siteMaxRootDirSizeMb*Y,h=typeof a.maxTotalSize==`number`&&Number.isFinite(a.maxTotalSize)?Math.floor(a.maxTotalSize):K.noteMaxTotalSizeMb*Y;return{enabled:r.enabled!==!1,defaultTtlHours:Math.max(1,Math.round(c/q)),maxTtlDays:Math.max(1,Math.round(l/J)),maxActiveShares:typeof r.maxActiveShares==`number`&&Number.isFinite(r.maxActiveShares)?Math.max(1,Math.min(1e4,Math.floor(r.maxActiveShares))):K.maxActiveShares,maxFileSizeMb:Math.max(1,Math.round(u/Y)),directoryMaxFolderSizeMb:Math.max(1,Math.round(d/Y)),directoryMaxFileCount:typeof i.maxFileCount==`number`&&Number.isFinite(i.maxFileCount)?Math.max(1,Math.min(1e5,Math.floor(i.maxFileCount))):K.directoryMaxFileCount,inlinePreviewMimes:X(r.inlinePreviewMimes,32).length?X(r.inlinePreviewMimes,32):[...K.inlinePreviewMimes],noteEnabled:a.enabled!==!1,noteMaxTotalSizeMb:Math.max(1,Math.round(h/Y)),noteMaxAttachmentCount:typeof a.maxAttachmentCount==`number`&&Number.isFinite(a.maxAttachmentCount)?Math.max(0,Math.min(500,Math.floor(a.maxAttachmentCount))):K.noteMaxAttachmentCount,siteEnabled:o.enabled!==!1,siteDefaultTtlHours:Math.max(1,Math.round(f/q)),siteMaxTtlDays:Math.max(1,Math.round(p/J)),maxActiveSites:typeof o.maxActiveSites==`number`&&Number.isFinite(o.maxActiveSites)?Math.max(1,Math.min(1e3,Math.floor(o.maxActiveSites))):K.maxActiveSites,siteMaxRootDirSizeMb:Math.max(1,Math.round(m/Y)),siteMaxFileCount:typeof s.maxFileCount==`number`&&Number.isFinite(s.maxFileCount)?Math.max(1,Math.min(1e5,Math.floor(s.maxFileCount))):K.siteMaxFileCount}}function Z(e){let t=e.defaultTtlHours*q,n=e.maxTtlDays*J,r=e.siteDefaultTtlHours*q,i=e.siteMaxTtlDays*J;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.`:e.noteMaxTotalSizeMb<1||e.noteMaxTotalSizeMb>2048?`Maximum Note snapshot size must be between 1 MB and 2 GB.`:e.noteMaxAttachmentCount<0||e.noteMaxAttachmentCount>500?`Maximum Note attachment count must be between 0 and 500.`: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 ye(e){let t=Z(e);if(t)throw Error(t);await b(S(`/api/config`),{method:`PATCH`,body:JSON.stringify({gateway:{share:{enabled:e.enabled,defaultTtlMs:e.defaultTtlHours*q,maxTtlMs:e.maxTtlDays*J,maxActiveShares:e.maxActiveShares,maxFileSize:e.maxFileSizeMb*Y,inlinePreviewMimes:e.inlinePreviewMimes,directory:{maxFolderSize:e.directoryMaxFolderSizeMb*Y,maxFileCount:e.directoryMaxFileCount},note:{enabled:e.noteEnabled,maxTotalSize:e.noteMaxTotalSizeMb*Y,maxAttachmentCount:e.noteMaxAttachmentCount}},siteShare:{enabled:e.siteEnabled,defaultTtlMs:e.siteDefaultTtlHours*q,maxTtlMs:e.siteMaxTtlDays*J,maxActiveSites:e.maxActiveSites,static:{maxRootDirSize:e.siteMaxRootDirSizeMb*Y,maxFileCount:e.siteMaxFileCount}}}})}),E()}var Q=r();function be(){return w(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,oe,`dark:border-edge`)}function xe({hasToken:e}){let t=y(x(e=>e.language)).sharesSettings,{data:n,isLoading:r}=D(e),i=(0,G.useMemo)(()=>n?.payload?.config===void 0?null:structuredClone(ve(n.payload.config)),[n]),a=(0,G.useRef)(!1),[o,s]=(0,G.useState)(null),[c,l]=(0,G.useState)(!1),[u,d]=(0,G.useState)(null),[f,p]=(0,G.useState)(!1),m=o??i,h=i,g=(0,G.useMemo)(()=>!m||!h?!1:JSON.stringify(m)!==JSON.stringify(h),[m,h]),_=(0,G.useCallback)(e=>{a.current=!0,s(t=>{let n=t??h;return n?{...n,...e}:null})},[h]),v=(0,G.useCallback)(async()=>{if(!(!m||c)){l(!0),d(null),p(!1);try{await ye(m),a.current=!1,s(null),p(!0),window.setTimeout(()=>p(!1),2500)}catch(e){d(e instanceof Error?e.message:t.policySaveError)}finally{l(!1)}}},[m,c,t.policySaveError]),b=(0,G.useCallback)(()=>{a.current=!1,s(null),d(null),p(!1)},[]);return!e||!m?r?(0,Q.jsx)(W,{children:(0,Q.jsx)(pe,{rows:2})}):null:(0,Q.jsxs)(W,{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)(T,{type:`button`,variant:`secondary`,disabled:c,onClick:()=>_(ge()),children:t.policyUseRecommended}),(0,Q.jsx)(T,{type:`button`,variant:`secondary`,disabled:!g||c,onClick:b,children:t.policyDiscard}),(0,Q.jsx)(T,{type:`button`,variant:`primary`,disabled:!g||c,onClick:()=>void v(),children:c?t.policySaving:t.policySave})]})]}),g?(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)(Se,{t,form:m,onChange:_})]})}function Se(e){let t=(0,he.c)(189),{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 C=!r.enabled,w;t[47]===i?w=t[48]:(w=e=>i({directoryMaxFolderSizeMb:e}),t[47]=i,t[48]=w);let ee;t[49]!==r.directoryMaxFolderSizeMb||t[50]!==n.policyDirectoryMaxFolderSizeHint||t[51]!==n.policyDirectoryMaxFolderSizeMb||t[52]!==C||t[53]!==w?(ee=(0,Q.jsx)($,{id:`share-directory-max-size-mb`,label:n.policyDirectoryMaxFolderSizeMb,hint:n.policyDirectoryMaxFolderSizeHint,value:r.directoryMaxFolderSizeMb,min:1,max:10240,disabled:C,onChange:w}),t[49]=r.directoryMaxFolderSizeMb,t[50]=n.policyDirectoryMaxFolderSizeHint,t[51]=n.policyDirectoryMaxFolderSizeMb,t[52]=C,t[53]=w,t[54]=ee):ee=t[54];let T=!r.enabled,E;t[55]===i?E=t[56]:(E=e=>i({directoryMaxFileCount:e}),t[55]=i,t[56]=E);let D;t[57]!==r.directoryMaxFileCount||t[58]!==n.policyDirectoryMaxFileCount||t[59]!==n.policyDirectoryMaxFileCountHint||t[60]!==T||t[61]!==E?(D=(0,Q.jsx)($,{id:`share-directory-max-files`,label:n.policyDirectoryMaxFileCount,hint:n.policyDirectoryMaxFileCountHint,value:r.directoryMaxFileCount,min:1,max:1e5,disabled:T,onChange:E}),t[57]=r.directoryMaxFileCount,t[58]=n.policyDirectoryMaxFileCount,t[59]=n.policyDirectoryMaxFileCountHint,t[60]=T,t[61]=E,t[62]=D):D=t[62];let O;t[63]!==g||t[64]!==y||t[65]!==S||t[66]!==ee||t[67]!==D||t[68]!==p?(O=(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[p,g,y,S,ee,D]}),t[63]=g,t[64]=y,t[65]=S,t[66]=ee,t[67]=D,t[68]=p,t[69]=O):O=t[69];let te=!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]!==te||t[75]!==k?(A=(0,Q.jsx)(Ce,{t:n,values:r.inlinePreviewMimes,disabled:te,onChange:k}),t[72]=r.inlinePreviewMimes,t[73]=n,t[74]=te,t[75]=k,t[76]=A):A=t[76];let j;t[77]!==O||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,O,A]}),t[77]=O,t[78]=A,t[79]=s,t[80]=u,t[81]=j):j=t[81];let M;t[82]===n.policyNoteSection?M=t[83]:(M=(0,Q.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.policyNoteSection}),t[82]=n.policyNoteSection,t[83]=M);let N;t[84]===n.policyNoteSectionHint?N=t[85]:(N=(0,Q.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:n.policyNoteSectionHint}),t[84]=n.policyNoteSectionHint,t[85]=N);let P;t[86]!==M||t[87]!==N?(P=(0,Q.jsxs)(`div`,{className:`mb-4`,children:[M,N]}),t[86]=M,t[87]=N,t[88]=P):P=t[88];let F;t[89]===i?F=t[90]:(F=e=>i({noteEnabled:e.target.checked}),t[89]=i,t[90]=F);let I;t[91]!==r.noteEnabled||t[92]!==F?(I=(0,Q.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:r.noteEnabled,onChange:F}),t[91]=r.noteEnabled,t[92]=F,t[93]=I):I=t[93];let ne;t[94]!==n.policyNoteEnabled||t[95]!==I?(ne=(0,Q.jsxs)(`label`,{className:`mb-4 flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[I,n.policyNoteEnabled]}),t[94]=n.policyNoteEnabled,t[95]=I,t[96]=ne):ne=t[96];let re=!r.enabled||!r.noteEnabled,L;t[97]===i?L=t[98]:(L=e=>i({noteMaxTotalSizeMb:e}),t[97]=i,t[98]=L);let ie;t[99]!==r.noteMaxTotalSizeMb||t[100]!==n.policyNoteMaxTotalSizeHint||t[101]!==n.policyNoteMaxTotalSizeMb||t[102]!==re||t[103]!==L?(ie=(0,Q.jsx)($,{id:`share-note-max-size-mb`,label:n.policyNoteMaxTotalSizeMb,hint:n.policyNoteMaxTotalSizeHint,value:r.noteMaxTotalSizeMb,min:1,max:2048,disabled:re,onChange:L}),t[99]=r.noteMaxTotalSizeMb,t[100]=n.policyNoteMaxTotalSizeHint,t[101]=n.policyNoteMaxTotalSizeMb,t[102]=re,t[103]=L,t[104]=ie):ie=t[104];let R=!r.enabled||!r.noteEnabled,ae;t[105]===i?ae=t[106]:(ae=e=>i({noteMaxAttachmentCount:e}),t[105]=i,t[106]=ae);let oe;t[107]!==r.noteMaxAttachmentCount||t[108]!==n.policyNoteMaxAttachmentCount||t[109]!==n.policyNoteMaxAttachmentCountHint||t[110]!==R||t[111]!==ae?(oe=(0,Q.jsx)($,{id:`share-note-max-attachments`,label:n.policyNoteMaxAttachmentCount,hint:n.policyNoteMaxAttachmentCountHint,value:r.noteMaxAttachmentCount,min:0,max:500,disabled:R,onChange:ae}),t[107]=r.noteMaxAttachmentCount,t[108]=n.policyNoteMaxAttachmentCount,t[109]=n.policyNoteMaxAttachmentCountHint,t[110]=R,t[111]=ae,t[112]=oe):oe=t[112];let z;t[113]!==ie||t[114]!==oe?(z=(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[ie,oe]}),t[113]=ie,t[114]=oe,t[115]=z):z=t[115];let se;t[116]!==P||t[117]!==ne||t[118]!==z?(se=(0,Q.jsxs)(`div`,{className:`rounded-xl border border-edge bg-surface-muted/25 p-4`,children:[P,ne,z]}),t[116]=P,t[117]=ne,t[118]=z,t[119]=se):se=t[119];let B;t[120]===n.policySiteSection?B=t[121]:(B=(0,Q.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.policySiteSection}),t[120]=n.policySiteSection,t[121]=B);let ce;t[122]===n.policySiteSectionHint?ce=t[123]:(ce=(0,Q.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:n.policySiteSectionHint}),t[122]=n.policySiteSectionHint,t[123]=ce);let V;t[124]!==B||t[125]!==ce?(V=(0,Q.jsxs)(`div`,{className:`mb-4`,children:[B,ce]}),t[124]=B,t[125]=ce,t[126]=V):V=t[126];let le;t[127]===i?le=t[128]:(le=e=>i({siteEnabled:e.target.checked}),t[127]=i,t[128]=le);let H;t[129]!==r.siteEnabled||t[130]!==le?(H=(0,Q.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:r.siteEnabled,onChange:le}),t[129]=r.siteEnabled,t[130]=le,t[131]=H):H=t[131];let ue;t[132]!==n.policySiteEnabled||t[133]!==H?(ue=(0,Q.jsxs)(`label`,{className:`mb-4 flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[H,n.policySiteEnabled]}),t[132]=n.policySiteEnabled,t[133]=H,t[134]=ue):ue=t[134];let de=!r.siteEnabled,U;t[135]===i?U=t[136]:(U=e=>i({siteDefaultTtlHours:e}),t[135]=i,t[136]=U);let fe;t[137]!==r.siteDefaultTtlHours||t[138]!==n.policySiteDefaultTtlHint||t[139]!==n.policySiteDefaultTtlHours||t[140]!==de||t[141]!==U?(fe=(0,Q.jsx)($,{id:`site-share-default-ttl-hours`,label:n.policySiteDefaultTtlHours,hint:n.policySiteDefaultTtlHint,value:r.siteDefaultTtlHours,min:1,max:168,disabled:de,onChange:U}),t[137]=r.siteDefaultTtlHours,t[138]=n.policySiteDefaultTtlHint,t[139]=n.policySiteDefaultTtlHours,t[140]=de,t[141]=U,t[142]=fe):fe=t[142];let pe=!r.siteEnabled,W;t[143]===i?W=t[144]:(W=e=>i({siteMaxTtlDays:e}),t[143]=i,t[144]=W);let me;t[145]!==r.siteMaxTtlDays||t[146]!==n.policySiteMaxTtlDays||t[147]!==n.policySiteMaxTtlHint||t[148]!==pe||t[149]!==W?(me=(0,Q.jsx)($,{id:`site-share-max-ttl-days`,label:n.policySiteMaxTtlDays,hint:n.policySiteMaxTtlHint,value:r.siteMaxTtlDays,min:1,max:30,disabled:pe,onChange:W}),t[145]=r.siteMaxTtlDays,t[146]=n.policySiteMaxTtlDays,t[147]=n.policySiteMaxTtlHint,t[148]=pe,t[149]=W,t[150]=me):me=t[150];let G=!r.siteEnabled,K;t[151]===i?K=t[152]:(K=e=>i({maxActiveSites:e}),t[151]=i,t[152]=K);let ge;t[153]!==r.maxActiveSites||t[154]!==n.policyMaxActiveSites||t[155]!==n.policyMaxActiveSitesHint||t[156]!==G||t[157]!==K?(ge=(0,Q.jsx)($,{id:`site-share-max-active`,label:n.policyMaxActiveSites,hint:n.policyMaxActiveSitesHint,value:r.maxActiveSites,min:1,max:1e3,disabled:G,onChange:K}),t[153]=r.maxActiveSites,t[154]=n.policyMaxActiveSites,t[155]=n.policyMaxActiveSitesHint,t[156]=G,t[157]=K,t[158]=ge):ge=t[158];let q=!r.siteEnabled,J;t[159]===i?J=t[160]:(J=e=>i({siteMaxRootDirSizeMb:e}),t[159]=i,t[160]=J);let Y;t[161]!==r.siteMaxRootDirSizeMb||t[162]!==n.policySiteMaxRootDirSizeHint||t[163]!==n.policySiteMaxRootDirSizeMb||t[164]!==q||t[165]!==J?(Y=(0,Q.jsx)($,{id:`site-share-max-root-size-mb`,label:n.policySiteMaxRootDirSizeMb,hint:n.policySiteMaxRootDirSizeHint,value:r.siteMaxRootDirSizeMb,min:1,max:10240,disabled:q,onChange:J}),t[161]=r.siteMaxRootDirSizeMb,t[162]=n.policySiteMaxRootDirSizeHint,t[163]=n.policySiteMaxRootDirSizeMb,t[164]=q,t[165]=J,t[166]=Y):Y=t[166];let _e=!r.siteEnabled,X;t[167]===i?X=t[168]:(X=e=>i({siteMaxFileCount:e}),t[167]=i,t[168]=X);let ve;t[169]!==r.siteMaxFileCount||t[170]!==n.policySiteMaxFileCount||t[171]!==n.policySiteMaxFileCountHint||t[172]!==_e||t[173]!==X?(ve=(0,Q.jsx)($,{id:`site-share-max-files`,label:n.policySiteMaxFileCount,hint:n.policySiteMaxFileCountHint,value:r.siteMaxFileCount,min:1,max:1e5,disabled:_e,onChange:X}),t[169]=r.siteMaxFileCount,t[170]=n.policySiteMaxFileCount,t[171]=n.policySiteMaxFileCountHint,t[172]=_e,t[173]=X,t[174]=ve):ve=t[174];let Z;t[175]!==fe||t[176]!==me||t[177]!==ge||t[178]!==Y||t[179]!==ve?(Z=(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[fe,me,ge,Y,ve]}),t[175]=fe,t[176]=me,t[177]=ge,t[178]=Y,t[179]=ve,t[180]=Z):Z=t[180];let ye;t[181]!==V||t[182]!==ue||t[183]!==Z?(ye=(0,Q.jsxs)(`div`,{className:`rounded-xl border border-edge bg-surface-muted/25 p-4`,children:[V,ue,Z]}),t[181]=V,t[182]=ue,t[183]=Z,t[184]=ye):ye=t[184];let be;return t[185]!==j||t[186]!==se||t[187]!==ye?(be=(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[j,se,ye]}),t[185]=j,t[186]=se,t[187]=ye,t[188]=be):be=t[188],be}function $(e){let t=(0,he.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=w(be(),`max-w-xs font-mono text-xs`),t[3]=d):d=t[3];let f;t[4]!==s||t[5]!==o||t[6]!==l?(f=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]=f):f=t[7];let p;t[8]!==c||t[9]!==n||t[10]!==s||t[11]!==o||t[12]!==f||t[13]!==a?(p=(0,Q.jsx)(`input`,{id:n,type:`number`,min:o,max:s,disabled:c,className:d,value:a,onChange:f}),t[8]=c,t[9]=n,t[10]=s,t[11]=o,t[12]=f,t[13]=a,t[14]=p):p=t[14];let m;t[15]===i?m=t[16]:(m=(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:i}),t[15]=i,t[16]=m);let h;return t[17]!==u||t[18]!==p||t[19]!==m?(h=(0,Q.jsxs)(`div`,{children:[u,p,m]}),t[17]=u,t[18]=p,t[19]=m,t[20]=h):h=t[20],h}function Ce(e){let t=(0,he.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 f;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(f=w(be(),`font-mono text-xs`),t[13]=f):f=t[13];let p=i||r.length>=32,m;t[14]===s?m=t[15]:(m=e=>{e.key===`Enter`&&(e.preventDefault(),s(e.target.value),e.target.value=``)},t[14]=s,t[15]=m);let h;t[16]!==n.policyMimePlaceholder||t[17]!==p||t[18]!==m?(h=(0,Q.jsx)(`input`,{className:f,placeholder:n.policyMimePlaceholder,disabled:p,onKeyDown:m}),t[16]=n.policyMimePlaceholder,t[17]=p,t[18]=m,t[19]=h):h=t[19];let g;return t[20]!==c||t[21]!==l||t[22]!==d||t[23]!==h?(g=(0,Q.jsxs)(`div`,{className:`space-y-2 border-t border-edge pt-4`,children:[c,l,d,h]}),t[20]=c,t[21]=l,t[22]=d,t[23]=h,t[24]=g):g=t[24],g}function we(e){let t=(0,he.c)(70),{open:n,onOpenChange:r,onConfirm:i,initialPath:d,selectKind:m,sessionKey:g,agentId:v}=e,b=m===void 0?`any`:m,S=y(x(De)),E=S.workspace,D=S.sharesSettings,O=te(Ee),{data:k}=ee(C(Te)?`picker-agents-list`:null,ae),A;bb0:{let e;t[0]===v?e=t[1]:(e=v?.trim(),t[0]=v,t[1]=e);let n=e;if(n){A=n;break bb0}let r;t[2]===O?r=t[3]:(r=O.trim(),t[2]=O,t[3]=r);let i=r;if(i){A=i;break bb0}if(k?.defaultId){A=k.defaultId;break bb0}if(k?.agents?.[0]?.id){A=k.agents[0].id;break bb0}A=``}let j=A,[M,N]=(0,G.useState)(j),P,I;t[4]===j?(P=t[5],I=t[6]):(P=()=>{N(j)},I=[j],t[4]=j,t[5]=P,t[6]=I),(0,G.useEffect)(P,I);let{tree:ne,loading:L,error:ie,loadRoot:R,loadChildren:oe,reset:z}=le(M,g??null),se;t[7]===d?se=t[8]:(se=d?{path:d,isDirectory:!1}:null,t[7]=d,t[8]=se);let[B,V]=(0,G.useState)(se),H;t[9]!==d||t[10]!==R||t[11]!==n||t[12]!==z||t[13]!==V?(H=()=>{if(!n){z(),V(d?{path:d,isDirectory:!1}:null);return}R()},t[9]=d,t[10]=R,t[11]=n,t[12]=z,t[13]=V,t[14]=H):H=t[14];let de;t[15]!==d||t[16]!==R||t[17]!==n||t[18]!==M||t[19]!==z||t[20]!==g?(de=[n,M,g,R,z,d],t[15]=d,t[16]=R,t[17]=n,t[18]=M,t[19]=z,t[20]=g,t[21]=de):de=t[21],(0,G.useEffect)(H,de);let U;t[22]===oe?U=t[23]:(U=e=>{oe(e)},t[22]=oe,t[23]=U);let fe=U,pe=B!==null&&(b===`any`||b===`file`&&!B.isDirectory||b===`directory`&&B.isDirectory),W;bb1:{if(!B){W=D.pickerHintNone;break bb1}if(b===`file`&&B.isDirectory){W=D.pickerHintNeedsFile;break bb1}if(b===`directory`&&!B.isDirectory){W=D.pickerHintNeedsDirectory;break bb1}W=`${B.isDirectory?`📁`:`📄`} ${B.path}`}let me=W,K=k?.agents??[],ge;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,Q.jsx)(a,{className:`fixed inset-0 z-[70] bg-scrim backdrop-blur-[2px]`}),t[24]=ge):ge=t[24];let q;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(q=w(`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]=q):q=t[25];let J;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,Q.jsx)(F,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),t[26]=J):J=t[26];let Y=S.cron.refresh,_e=S.cron.refresh,X;t[27]===R?X=t[28]:(X=()=>void R(),t[27]=R,t[28]=X);let ve=L&&`animate-spin`,Z;t[29]===ve?Z=t[30]:(Z=w(`size-4`,ve),t[29]=ve,t[30]=Z);let ye;t[31]===Z?ye=t[32]:(ye=(0,Q.jsx)(ce,{className:Z,"aria-hidden":!0}),t[31]=Z,t[32]=ye);let be;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(be=(0,Q.jsx)(_,{className:`size-4`}),t[33]=be):be=t[33];let xe;t[34]!==ie||t[35]!==E.loadError?(xe=ie?(0,Q.jsxs)(`p`,{className:`shrink-0 px-4 py-2 text-xs text-red-600 dark:text-red-400`,children:[E.loadError,`: `,ie]}):null,t[34]=ie,t[35]=E.loadError,t[36]=xe):xe=t[36];let Se;t[37]!==fe||t[38]!==L||t[39]!==B?.path||t[40]!==V||t[41]!==E.emptyDir||t[42]!==E.title||t[43]!==ne?(Se=L&&ne.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)(h,{className:`size-4 animate-spin`}),E.title,`…`]}):(0,Q.jsx)(ue,{tree:ne,selectedPath:B?.path??null,onSelectFile:e=>V({path:e,isDirectory:!1}),onSelectEntry:(e,t)=>V({path:e,isDirectory:t}),onExpandDir:fe,onAction:void 0,emptyHint:E.emptyDir}),t[37]=fe,t[38]=L,t[39]=B?.path,t[40]=V,t[41]=E.emptyDir,t[42]=E.title,t[43]=ne,t[44]=Se):Se=t[44];let $;t[45]!==xe||t[46]!==Se?($=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:[xe,Se]}),t[45]=xe,t[46]=Se,t[47]=$):$=t[47];let Ce;t[48]===me?Ce=t[49]:(Ce=(0,Q.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-xs text-fg-muted`,children:me}),t[48]=me,t[49]=Ce);let we;t[50]===r?we=t[51]:(we=()=>r(!1),t[50]=r,t[51]=we);let Oe;t[52]!==D.cancel||t[53]!==we?(Oe=(0,Q.jsx)(T,{type:`button`,variant:`ghost`,onClick:we,children:D.cancel}),t[52]=D.cancel,t[53]=we,t[54]=Oe):Oe=t[54];let ke=!pe,Ae;t[55]!==i||t[56]!==r||t[57]!==M||t[58]!==B?(Ae=()=>{B&&(i({...B,agentId:M}),r(!1))},t[55]=i,t[56]=r,t[57]=M,t[58]=B,t[59]=Ae):Ae=t[59];let je;t[60]!==D.pickerConfirm||t[61]!==ke||t[62]!==Ae?(je=(0,Q.jsx)(T,{type:`button`,disabled:ke,onClick:Ae,children:D.pickerConfirm}),t[60]=D.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]!==Ce||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:[Ce,Me]}),t[67]=Ce,t[68]=Me,t[69]=Ne):Ne=t[69],(0,Q.jsx)(u,{open:n,onOpenChange:r,children:(0,Q.jsxs)(s,{children:[ge,(0,Q.jsxs)(c,{className:q,children:[(0,Q.jsxs)(`div`,{className:`flex h-11 shrink-0 items-center gap-2 border-b border-edge px-4`,children:[J,(0,Q.jsx)(l,{className:`min-w-0 flex-1 truncate text-base font-semibold text-fg`,children:D.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:Y,"aria-label":_e,disabled:L,onClick:X,children:ye}),(0,Q.jsx)(o,{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":E.close,children:be})})]}),K.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:D.pickerAgentLabel}),(0,Q.jsx)(f,{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:M,onChange:e=>{N(e.target.value),V(null)},children:K.map(e=>(0,Q.jsxs)(p,{value:e.id,children:[re(e,S.agentsSettings),e.id===k?.defaultId?` ★`:``]},e.id))})]}):null,$,Ne]})]})})}function Te(e){return e.token}function Ee(e){return e.agentId}function De(e){return e.language}var Oe=[`shares`,`policy`];function ke(e){let t=(e??``).trim();return Oe.includes(t)?t:`shares`}function Ae(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 je(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 Me=[{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 Ne(){let e=(0,he.c)(24),t=x(Fe),n=y(t).sharesSettings,r=!!C(Pe),[a,o]=i(),s;e[0]===a?s=e[1]:(s=ke(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)(U,{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=Oe.map(e=>({id:e,label:d[e]})),p;e[4]!==n.subtitle||e[5]!==n.title?(p=(0,Q.jsx)(de,{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)(me,{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)(Ie,{t:n,language:t}):(0,Q.jsx)(xe,{hasToken:r}),e[12]=c,e[13]=r,e[14]=t,e[15]=n,e[16]=h):h=e[16];let g;e[17]!==c||e[18]!==h?(g=(0,Q.jsx)(fe,{id:c,activeTab:c,tabIdPrefix:`shares-tab`,panelIdPrefix:`shares-panel`,showHeading:!1,children:h}),e[17]=c,e[18]=h,e[19]=g):g=e[19];let _;return e[20]!==p||e[21]!==m||e[22]!==g?(_=(0,Q.jsxs)(U,{children:[p,m,g]}),e[20]=p,e[21]=m,e[22]=g,e[23]=_):_=e[23],_}function Pe(e){return e.token}function Fe(e){return e.language}function Ie(e){let t=(0,he.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}=ee(`shares-list`,se,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,f]=(0,G.useState)(!1),p;bb0:{if(d){p=u;break bb0}let e;t[3]===u?e=t[4]:(e=u.filter(Ve),t[3]=u,t[4]=e),p=e}let m=p,h;t[5]===u?h=t[6]:(h=u.filter(Be),t[5]=u,t[6]=h);let g=h.length,_;t[7]===u?_=t[8]:(_=u.filter(ze),t[7]=u,t[8]=_);let v=_.length,y;t[9]===c?y=t[10]:(y=()=>void c(),t[9]=c,t[10]=y);let b;t[11]!==n||t[12]!==y?(b=(0,Q.jsx)(Ue,{t:n,onCreated:y}),t[11]=n,t[12]=y,t[13]=b):b=t[13];let x=d?n.allSharesTitle:n.listTitle,S;t[14]===g?S=t[15]:(S=g>0&&(0,Q.jsxs)(`span`,{className:`ml-2 text-xs font-normal text-fg-muted`,children:[`(`,g,`)`]}),t[14]=g,t[15]=S);let C;t[16]!==x||t[17]!==S?(C=(0,Q.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[x,S]}),t[16]=x,t[17]=S,t[18]=C):C=t[18];let E;t[19]===c?E=t[20]:(E=()=>void c(),t[19]=c,t[20]=E);let D=s&&`animate-spin`,O;t[21]===D?O=t[22]:(O=w(`size-3.5`,D),t[21]=D,t[22]=O);let te;t[23]===O?te=t[24]:(te=(0,Q.jsx)(ce,{className:O}),t[23]=O,t[24]=te);let k;t[25]!==s||t[26]!==E||t[27]!==te?(k=(0,Q.jsx)(T,{type:`button`,variant:`ghost`,className:`px-2 py-1`,onClick:E,disabled:s,children:te}),t[25]=s,t[26]=E,t[27]=te,t[28]=k):k=t[28];let A;t[29]!==v||t[30]!==d||t[31]!==n.hideExpired||t[32]!==n.showExpired?(A=v>0&&(0,Q.jsx)(`button`,{type:`button`,className:`text-xs text-accent hover:underline`,onClick:()=>f(Re),children:d?n.hideExpired:n.showExpired}),t[29]=v,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]!==C||t[38]!==j?(M=(0,Q.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[C,j]}),t[37]=C,t[38]=j,t[39]=M):M=t[39];let N;t[40]!==a||t[41]!==o||t[42]!==m||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(Le)}):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)(T,{type:`button`,variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>void c(),children:n.retry})]}):m.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:m.map(e=>(0,Q.jsx)(Ge,{share:e,t:n,language:r,onRevoked:()=>void c(),onExtended:()=>void c()},e.id))}),t[40]=a,t[41]=o,t[42]=m,t[43]=s,t[44]=r,t[45]=c,t[46]=n,t[47]=N):N=t[47];let P;t[48]!==v||t[49]!==c||t[50]!==d||t[51]!==n?(P=v>0&&d&&(0,Q.jsx)(Ke,{t:n,onCleaned:()=>void c()}),t[48]=v,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)(W,{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]!==b?(I=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[b,F]}),t[57]=F,t[58]=b,t[59]=I):I=t[59],I}function Le(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)(O,{className:`h-4 w-2/3`}),(0,Q.jsx)(O,{className:`mt-2 h-3 w-1/2`})]}),(0,Q.jsx)(O,{className:`h-7 w-20 rounded-md`})]})},t)}function Re(e){return!e}function ze(e){return e.expired||e.revoked}function Be(e){return!e.expired&&!e.revoked}function Ve(e){return!e.expired&&!e.revoked}var He={expanded:!0,path:``,isDirectory:!1,agentId:``,ttlMs:864e5,maxViews:null,description:``,directoryMode:`browse`,creating:!1,result:null,errorMsg:null,resultDialogOpen:!1,pickerOpen:!1};function Ue({t:e,onCreated:t}){let[n,r]=(0,G.useReducer)(z,He),{expanded:i,path:a,isDirectory:o,agentId:s,ttlMs:c,maxViews:l,description:u,directoryMode:d,creating:m,result:_,errorMsg:v,resultDialogOpen:y,pickerOpen:b}=n,x=(0,G.useCallback)(async()=>{if(a.trim()){r({type:`patch`,patch:{creating:!0,errorMsg:null,result:null}});try{r({type:`patch`,patch:{result:(await L({path:a.trim(),ttlMs:c,maxViews:l,description:u.trim()||void 0,...s?{agentId:s}:{},...o?{kind:`directory`,directoryMode:d}:{}})).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,o,s,c,l,u,d,t]),S=(0,G.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)(W,{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:w(`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:o?`📁`:`📄`}),(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)(T,{type:`button`,variant:`ghost`,onClick:()=>r({type:`patch`,patch:{pickerOpen:!0}}),children:[(0,Q.jsx)(P,{className:`size-4`}),a?e.pathBrowseChange:e.pathBrowse]})]})]}),o?(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)(f,{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:d,onChange:e=>r({type:`patch`,patch:{directoryMode:e.target.value===`zip-only`?`zip-only`:`browse`}}),children:[(0,Q.jsx)(p,{value:`browse`,children:e.directoryModeBrowse}),(0,Q.jsx)(p,{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)(f,{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:c,onChange:e=>r({type:`patch`,patch:{ttlMs:Number(e.target.value)}}),children:Me.map(t=>(0,Q.jsx)(p,{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)(f,{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:l??`unlimited`,onChange:e=>r({type:`patch`,patch:{maxViews:e.target.value===`unlimited`?null:Number(e.target.value)}}),children:[(0,Q.jsx)(p,{value:`unlimited`,children:e.maxViewsUnlimited}),(0,Q.jsx)(p,{value:`1`,children:`1`}),(0,Q.jsx)(p,{value:`5`,children:`5`}),(0,Q.jsx)(p,{value:`10`,children:`10`}),(0,Q.jsx)(p,{value:`50`,children:`50`}),(0,Q.jsx)(p,{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:u,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)(T,{type:`button`,disabled:m||!a.trim(),onClick:()=>void x(),children:[m?(0,Q.jsx)(h,{className:`size-4 animate-spin`}):(0,Q.jsx)(g,{className:`size-4`}),m?e.creating:e.createButton]}),(0,Q.jsx)(T,{type:`button`,variant:`ghost`,onClick:()=>{S(),r({type:`patch`,patch:{expanded:!1}})},children:e.cancel})]}),v&&(0,Q.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:v})]}),(0,Q.jsx)(R,{open:y,onOpenChange:e=>{r({type:`patch`,patch:{resultDialogOpen:e,...e?{}:{result:null}}})},result:_}),(0,Q.jsx)(we,{open:b,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)(T,{type:`button`,onClick:()=>r({type:`patch`,patch:{expanded:!0}}),className:`self-start`,children:[(0,Q.jsx)(g,{className:`size-4`}),e.createTitle]})}var We={revokeOpen:!1,revoking:!1,linksOpen:!1,urlCopied:!1,copyFailed:!1,extending:!1};function Ge({share:e,t,language:n,onRevoked:r,onExtended:i}){let[a,o]=(0,G.useReducer)(z,We),{revokeOpen:s,revoking:c,linksOpen:l,urlCopied:u,copyFailed:f,extending:p}=a,g=!e.expired&&!e.revoked,_=e.revoked?t.statusRevoked:e.expired?t.statusExpired:t.statusActive,y=e.revoked?`text-red-600 dark:text-red-400`:e.expired?`text-fg-subtle`:`text-emerald-600 dark:text-emerald-400`,b=(0,G.useCallback)(async()=>{o({type:`patch`,patch:{revokeOpen:!1,revoking:!0}});try{await V(e.id),r()}catch{}finally{o({type:`patch`,patch:{revoking:!1}})}},[e.id,r]),x=(0,G.useCallback)(async()=>{if(o({type:`patch`,patch:{linksOpen:!0,copyFailed:!1}}),!await v(e.shareUrl)){o({type:`patch`,patch:{copyFailed:!0}}),window.setTimeout(()=>o({type:`patch`,patch:{copyFailed:!1}}),2500);return}o({type:`patch`,patch:{urlCopied:!0}}),window.setTimeout(()=>o({type:`patch`,patch:{urlCopied:!1}}),2e3)},[e.shareUrl]),S=(0,G.useCallback)(async()=>{o({type:`patch`,patch:{extending:!0}});try{await I(e.id,864e5),i()}catch{}finally{o({type:`patch`,patch:{extending:!1}})}},[e.id,i]),C=`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:w(`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":l,"aria-controls":C,onClick:()=>o({type:`patch`,patch:{linksOpen:!l}}),children:[(0,Q.jsx)(N,{className:w(`mt-0.5 size-4 shrink-0 text-fg-muted transition-transform`,l?`rotate-0`:`-rotate-90`),"aria-hidden":!0}),e.kind===`note`?(0,Q.jsx)(M,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}):e.kind===`session`?(0,Q.jsx)(ie,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}):(0,Q.jsx)(P,{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:w(`text-xs font-medium`,y),children:_})]}),(0,Q.jsx)(`p`,{className:`truncate text-xs text-fg-subtle`,children:e.kind===`note`?n===`zh`?`笔记快照 · 版本 ${e.snapshotRevision??1}`:`Note snapshot · revision ${e.snapshotRevision??1}`:e.kind===`session`?n===`zh`?`会话快照 · ${e.messageCount??0} 条消息 · 版本 ${e.snapshotRevision??1}`:`Conversation snapshot · ${e.messageCount??0} messages · revision ${e.snapshotRevision??1}`: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:Ae(e.fileSize)}),(0,Q.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,Q.jsx)(j,{className:`size-3`}),e.expired?n===`zh`?`已过期`:`expired`:je(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:g&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(T,{type:`button`,variant:`ghost`,className:`px-2 py-1`,title:t.copyUrl,onClick:()=>void x(),children:u?(0,Q.jsx)(d,{className:`size-3.5 text-emerald-500`}):(0,Q.jsx)(m,{className:`size-3.5`})}),(0,Q.jsx)(T,{type:`button`,variant:`ghost`,className:`px-2 py-1`,onClick:()=>void S(),disabled:p,title:t.extend,children:p?(0,Q.jsx)(h,{className:`size-3.5 animate-spin`}):(0,Q.jsx)(j,{className:`size-3.5`})}),(0,Q.jsx)(T,{type:`button`,variant:`ghost`,className:`px-2 py-1 text-red-600 hover:text-red-700 dark:text-red-400`,onClick:()=>o({type:`patch`,patch:{revokeOpen:!0}}),disabled:c,children:c?(0,Q.jsx)(h,{className:`size-3.5 animate-spin`}):(0,Q.jsx)(k,{className:`size-3.5`})})]})})]}),g&&l?(0,Q.jsxs)(`div`,{id:C,className:`mt-3 bg-surface-base/45 py-3 pl-7 pr-3`,children:[(0,Q.jsx)(H,{shareUrl:e.shareUrl,lanUrl:e.lanUrl,reachability:e.reachability,compact:!0}),f?(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)(ne,{reachability:e.reachability})})]}):null]}),(0,Q.jsx)(A,{open:s,title:t.revokeConfirmTitle,description:t.revokeConfirmBody,confirmLabel:t.revokeConfirmLabel,cancelLabel:t.cancel,destructive:!0,onConfirm:()=>void b(),onCancel:()=>o({type:`patch`,patch:{revokeOpen:!1}})})]})}function Ke({t:e,onCleaned:t}){let[n,r]=(0,G.useState)(!1),[i,a]=(0,G.useState)(!1),o=(0,G.useCallback)(async()=>{r(!1),a(!0);try{await B(),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)(T,{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)(h,{className:`size-3.5 animate-spin`}):(0,Q.jsx)(k,{className:`size-3.5`}),e.cleanExpired]})}),(0,Q.jsx)(A,{open:n,title:e.cleanExpiredConfirmTitle,description:e.cleanExpiredConfirmBody,confirmLabel:e.cleanExpiredConfirmLabel,cancelLabel:e.cancel,destructive:!0,onConfirm:()=>void o(),onCancel:()=>r(!1)})]})}export{Ne as SharesSettingsPanel};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-aKtaBQYM.js";import{i as t,r as n}from"./locale-store-zEL8bkwx.js";import{vn as r}from"./index-aBs0EfQB.js";var i=e({reloadSkills:()=>a});async function a(){let e=await t(n(`/api/skills/reload`),{method:`POST`});if(!e.ok)throw Error(await r(e))}export{i as n,a as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,i as n,n as r,t as i}from"./vendor-react-BOUWij0V.js";import{d as a,l as o,p as s,t as c}from"./chunk-KS7C4IRE-BaASWQor.js";import{i as l,n as u,o as d,r as f,s as p,t as m}from"./dist-CpzYSoz7.js";import{n as h,r as g}from"./popover-select-C-Hj-nXR.js";import{t as _}from"./circle-check-C23XjkUj.js";import{t as v}from"./external-link-DjqjBmc3.js";import{d as ee,p as te,t as ne}from"./markdown-view-DGRN-8wP.js";import{t as re}from"./x-B_N4OPjy.js";import{n as ie,s as y}from"./locale-store-zEL8bkwx.js";import{t as b}from"./cn-JdwAhgNB.js";import{t as x}from"./button-CtTvuElV.js";import{t as S}from"./skeleton-BwbyijEw.js";import{An as ae,Ba as C,Dn as w,Ei as oe,El as se,En as ce,Gi as le,Hl as ue,Jo as de,Ko as fe,On as T,P as pe,Qo as E,Qr as D,Tn as O,Vl as k,Wt as me,Yo as he,Zr as ge,_l as _e,cs as A,ds as ve,fs as j,gu as M,hc as N,jc as P,kn as F,ma as I,n as ye,nr as be,ns as xe,os as Se,ps as Ce,us as we,vl as Te,xc as Ee,zr as De}from"./index-aBs0EfQB.js";import{t as Oe}from"./date-picker-B2OoYvic.js";import{t as ke}from"./dependency-picker-BiGx9Sbj.js";var L=e(t(),1),Ae=e(n(),1),R=r();function je(e,t,n,r){return!!(e&&t!==e.version&&n!==e.value&&r!==n)}function Me(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 z=i();function Ne(e,t){return(t===`zh`?{backlog:`待规划`,ready:`就绪`,active:`进行中`,review:`待验收`,closed:`已完成`}:{backlog:`Backlog`,ready:`Ready`,active:`Active`,review:`Review`,closed:`Completed`})[e]}function Pe(){let e=(0,R.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,z.jsxs)(`div`,{className:`space-y-4`,"aria-busy":!0,children:[(0,z.jsx)(S,{className:`h-32 rounded-2xl`}),(0,z.jsx)(S,{className:`h-52 rounded-2xl`}),(0,z.jsx)(S,{className:`h-40 rounded-2xl`})]}),e[0]=t):t=e[0],t}function Fe(e){if(e===void 0)return``;let t=new Date(e);return new Date(t.getTime()-t.getTimezoneOffset()*6e4).toISOString().slice(0,10)}function Ie(e){return e?new Date(`${e}T23:59:59.999`).getTime():null}var B=[`backlog`,`ready`,`active`,`review`,`closed`],V=[`low`,`normal`,`high`,`critical`],Le=(0,L.memo)(function(e){let t=(0,R.c)(20),{value:n,disabled:r,canMove:i,canApprove:a,canReopen:o,language:s,label:c,onChange:l}=e,u;t[0]!==a||t[1]!==i||t[2]!==o||t[3]!==n?(u=e=>e!==n&&(e===`closed`?!a:n===`closed`?!o:!i),t[0]=a,t[1]=i,t[2]=o,t[3]=n,t[4]=u):u=t[4];let d=u,f;t[5]===c?f=t[6]:(f=(0,z.jsx)(`span`,{children:c}),t[5]=c,t[6]=f);let p;t[7]===l?p=t[8]:(p=e=>l(e.target.value),t[7]=l,t[8]=p);let m;t[9]!==s||t[10]!==d?(m=B.map(e=>(0,z.jsx)(g,{value:e,disabled:d(e),children:Ne(e,s)},e)),t[9]=s,t[10]=d,t[11]=m):m=t[11];let _;t[12]!==r||t[13]!==p||t[14]!==m||t[15]!==n?(_=(0,z.jsx)(h,{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:p,children:m}),t[12]=r,t[13]=p,t[14]=m,t[15]=n,t[16]=_):_=t[16];let v;return t[17]!==f||t[18]!==_?(v=(0,z.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[f,_]}),t[17]=f,t[18]=_,t[19]=v):v=t[19],v}),Re=(0,L.memo)(function(e){let t=(0,R.c)(14),{value:n,disabled:r,label:i,labels:a,onChange:o}=e,s;t[0]===i?s=t[1]:(s=(0,z.jsx)(`span`,{children:i}),t[0]=i,t[1]=s);let c;t[2]===o?c=t[3]:(c=e=>o(e.target.value),t[2]=o,t[3]=c);let l;t[4]===a?l=t[5]:(l=V.map(e=>(0,z.jsx)(g,{value:e,children:a[e]},e)),t[4]=a,t[5]=l);let u;t[6]!==r||t[7]!==c||t[8]!==l||t[9]!==n?(u=(0,z.jsx)(h,{triggerClassName:`border-0 bg-surface-hover shadow-none focus-visible:ring-2 focus-visible:ring-accent/30`,contentClassName:`border-0`,value:n,disabled:r,onChange:c,children:l}),t[6]=r,t[7]=c,t[8]=l,t[9]=n,t[10]=u):u=t[10];let d;return t[11]!==s||t[12]!==u?(d=(0,z.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[s,u]}),t[11]=s,t[12]=u,t[13]=d):d=t[13],d}),ze=(0,L.memo)(function(e){let t=(0,R.c)(10),{value:n,disabled:r,label:i,onChange:a}=e,o;t[0]===i?o=t[1]:(o=(0,z.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,z.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,z.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}),Be=(0,L.memo)(function(e){let t=(0,R.c)(17),{value:n,disabled:r,label:i,unassignedLabel:a,agents:o,onChange:s}=e,c;t[0]===i?c=t[1]:(c=(0,z.jsx)(`span`,{children:i}),t[0]=i,t[1]=c);let l;t[2]===s?l=t[3]:(l=e=>s(e.target.value),t[2]=s,t[3]=l);let u;t[4]===a?u=t[5]:(u=(0,z.jsx)(g,{value:``,disabled:!0,children:a}),t[4]=a,t[5]=u);let d;t[6]===o?d=t[7]:(d=o.map(rt),t[6]=o,t[7]=d);let f;t[8]!==r||t[9]!==l||t[10]!==u||t[11]!==d||t[12]!==n?(f=(0,z.jsxs)(h,{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:l,children:[u,d]}),t[8]=r,t[9]=l,t[10]=u,t[11]=d,t[12]=n,t[13]=f):f=t[13];let p;return t[14]!==c||t[15]!==f?(p=(0,z.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[c,f]}),t[14]=c,t[15]=f,t[16]=p):p=t[16],p}),Ve=(0,L.memo)(function(e){let t=(0,R.c)(8),{candidates:n,selected:r,disabled:i,labels:a,onChange:o}=e,s;t[0]===r?s=t[1]:(s=r.map(it),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,z.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)),He=`xopc.taskDetail.chatPanelPercent`,Ue=42;function We(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?Ue:Math.min(r,Math.max(n,e))}function Ge(){try{let e=Number(window.localStorage.getItem(He));return Number.isFinite(e)&&e>=30&&e<=60?e:Ue}catch{return Ue}}function Ke(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 H(e){let t=(0,R.c)(9),{items:n,empty:r,verificationByCriterion:i}=e;if(n.length===0){let e;return t[0]===r?e=t[1]:(e=(0,z.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,z.jsxs)(`li`,{className:`flex gap-2 text-sm leading-6 text-fg`,children:[(0,z.jsx)(t===`passed`?_:t===`failed`?ue:k,{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,z.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,z.jsx)(`ul`,{className:`space-y-2`,children:a}),t[7]=a,t[8]=o),o}function qe({taskId:e,presentation:t,backgroundPath:n,onDeleted:r}){let[i]=s(),a=o(),l=ie(e=>e.language),u=y(e=>e.token),d=(0,L.useMemo)(()=>Ce(l),[l]),f=C(e=>e.setPageHeader),p=C(e=>e.clearPageHeader),m=D(e=>e.open),h=D(e=>e.sessionKeyOverride),g=D(e=>e.openForSession),re=be(e=>e.setOpen),{data:S,error:ue,mutate:k,lastChange:me,conversationLoading:ge,conversationError:Oe}=fe(e),[ke,R]=(0,L.useState)(null),[Ne,B]=(0,L.useState)(null),[V,qe]=(0,L.useState)(()=>new Set),[Je,Ye]=(0,L.useState)([]),[U,Xe]=(0,L.useState)(null),[Ze,Qe]=(0,L.useState)([]),[$e,W]=(0,L.useState)(!1),[et,tt]=(0,L.useState)(``),[nt,G]=(0,L.useState)(!1),[rt,it]=(0,L.useState)(``),[at,ot]=(0,L.useState)(Ge),[st,ct]=(0,L.useState)(!1),lt=(0,L.useRef)(null),ut=(0,L.useRef)(!1),dt=(0,L.useRef)(!1),ft=(0,L.useRef)(``),pt=(0,L.useRef)(null),mt=(0,L.useRef)(null),ht=(0,L.useRef)(null),gt=(0,L.useRef)(S),[_t,K]=(0,L.useState)(null),[vt,yt]=(0,L.useState)(null),[bt,xt]=(0,L.useState)(!1),St=(0,L.useMemo)(()=>({link:d.linkDependencies,linked:d.linkedDependencies,searchPlaceholder:d.dependencySearchPlaceholder,noMatches:d.noDependencyMatches,noCandidates:d.noDependencyCandidates,remove:d.removeDependency}),[d.dependencySearchPlaceholder,d.linkDependencies,d.linkedDependencies,d.noDependencyCandidates,d.noDependencyMatches,d.removeDependency]),Ct=S?.dependencies.map(e=>`${e.id}:${e.title}`).join(`\0`)??``,wt=(0,L.useMemo)(()=>ee(i.get(`returnTo`),`/`,[`/projects`,`/chat`,`/notes`,`/tasks`]),[i]);gt.current=S;let q=(0,L.useCallback)((e,t)=>{qe(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r})},[]);(0,L.useEffect)(()=>{B(null),K(null),W(!1),G(!1),yt(null),xt(!1)},[e]),(0,L.useEffect)(()=>{let e=!0;return I().then(t=>{e&&Qe(t.items)}).catch(()=>void 0),()=>{e=!1}},[u]),(0,L.useEffect)(()=>{if(!me||me.source===`user`)return;yt(me);let e=window.setTimeout(()=>yt(null),3500);return()=>window.clearTimeout(e)},[me]),(0,L.useEffect)(()=>{let t=S?.task.projectId,n=S?.dependencies??[];if(!t){ht.current=null,Xe(null),Ye(n);return}ht.current!==t&&(ht.current=t,Xe(null));let r=!0;return le(t).then(t=>{if(!r)return;Xe(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});Ye([...i.values()])}).catch(()=>{r&&Ye(n)}),()=>{r=!1}},[Ct,S?.task.projectId,e]);let J=(0,L.useCallback)(async(t,n=`command`)=>{let r=gt.current;if(r){q(n,!0),B(null);try{await k(await he(e,t,r.task.version),{revalidate:!1})}catch{B(d.actionFailed)}finally{q(n,!1)}}},[d.actionFailed,k,q,e]),Y=(0,L.useCallback)(async(t,n)=>{let r=gt.current;if(!r)return!1;n&&q(n,!0),B(null);try{return await k(A(e,t,r.task.version),{optimisticData:Me(r,t),populateCache:!0,revalidate:!1,rollbackOnError:!0}),!0}catch{return B(d.actionFailed),!1}finally{n&&q(n,!1)}},[d.actionFailed,k,q,e]),Tt=async()=>{if(!S)return;if(ut.current){ut.current=!1;return}let e=et.trim(),t=pt.current;if(je(t,S.task.version,S.task.title,e)){K(`title`);return}if(!e||e===S.task.title){tt(S.task.title),W(!1);return}await Y({title:e})&&(K(null),W(!1))},Et=async()=>{if(!S)return;if(dt.current){dt.current=!1;return}let e=rt.trim(),t=mt.current;if(je(t,S.task.version,S.task.body??``,e)){K(`description`);return}if(rt===ft.current||e===(S.task.body??``).trim()){G(!1);return}await Y({body:e||null})&&(K(null),G(!1))},Dt=(0,L.useCallback)(async e=>{let t=gt.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]),Ot=(0,L.useCallback)(e=>{Y({priority:e},`priority`)},[Y]),kt=(0,L.useCallback)(e=>{Y({dueAt:Ie(e)},`dueAt`)},[Y]),At=(0,L.useCallback)(e=>{ot(e);try{window.localStorage.setItem(He,String(e))}catch{}},[]),jt=(0,L.useCallback)(e=>{if(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`&&e.key!==`Home`)return;e.preventDefault();let t=lt.current?.clientWidth??0;At(We(e.key===`Home`?Ue:at+(e.key===`ArrowLeft`?2:-2),t))},[at,At]),Mt=(0,L.useCallback)(e=>{if(!window.matchMedia(`(min-width: 1024px)`).matches)return;let t=lt.current;if(!t)return;e.preventDefault();let n=e.currentTarget,r=e.pointerId;n.setPointerCapture(r),ct(!0);let i=at,a=0,o=()=>{a=0,t.style.setProperty(`--task-chat-panel-width`,`${i}%`)},s=e=>{let n=t.getBoundingClientRect();i=We((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{}ct(!1),At(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)},[at,At]),Nt=(0,L.useCallback)(async t=>{let n=gt.current;if(n){q(`dependencies`,!0),B(null);try{await k(await we(e,t,n.task.version),{revalidate:!1})}catch{B(d.dependencyUpdateFailed)}finally{q(`dependencies`,!1)}}},[d.dependencyUpdateFailed,k,q,e]),Pt=(0,L.useCallback)(async t=>{let n=gt.current;if(!(!n||!t||t===n.conversation.currentExecutorAgentId)){q(`delegateAgentId`,!0),B(null);try{await k(await xe(e,t,n.task.version),{revalidate:!1})}catch{B(d.actionFailed)}finally{q(`delegateAgentId`,!1)}}},[d.actionFailed,k,q,e]),Ft=(0,L.useCallback)(async()=>{q(`delete`,!0),B(null);try{await E(e),r?r():a(wt,{replace:!0})}catch(e){B(e instanceof Error?e.message:d.actionFailed)}finally{q(`delete`,!1)}},[d.actionFailed,a,r,wt,q,e]);if((0,L.useLayoutEffect)(()=>{if(t!==`modal`)return f({startExtra:(0,z.jsx)(c,{to:wt,className:`flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover`,"aria-label":d.backToWork,children:(0,z.jsx)(M,{className:`size-4`})}),main:S?(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsx)(`p`,{className:`truncate text-sm font-semibold text-fg`,children:U?`${U} / ${d.taskLabel}`:d.taskLabel}),(0,z.jsx)(`p`,{className:`text-xs text-fg-muted`,children:d.detailStatuses[Ke(S)]})]}):null,end:(0,z.jsx)(`div`,{ref:R,className:`flex min-w-0 items-center justify-end`})}),p},[p,d.backToWork,d.detailStatuses,d.taskLabel,S,t,U,wt,f]),ue&&!S)return(0,z.jsx)(`div`,{className:t===`modal`?`p-5 text-sm text-danger`:`mx-auto max-w-3xl p-6 text-sm text-danger`,children:d.taskNotFound});if(!S)return(0,z.jsx)(`div`,{className:t===`modal`?`p-5`:`mx-auto max-w-4xl p-4 sm:p-6`,children:(0,z.jsx)(Pe,{})});let It=S.waits[0],Lt=It?.kind===`paused`?It:void 0,X=S.receipts[0],Rt=d.detailStatuses[Ke(S)],zt=d.detailStatusDescriptions[Ke(S)],Bt=S.task.body?.trim()||S.task.contract?.objective.trim(),Vt=new Map(X?.verification.checks.map(e=>[e.criterion,e.status])),Ht=S.allowedCommands.includes(`mark_ready`),Ut=S.allowedCommands.includes(`start`),Wt=S.allowedCommands.includes(`add_wait`),Gt=S.task.phase===`review`&&S.allowedCommands.includes(`close`),Kt=S.allowedCommands.includes(`reopen`),Z=S.conversation.activeSessionKey,qt=S.conversation.currentExecutorAgentId??S.task.delegateAgentId??S.task.ownerId,Jt=Ze.find(e=>e.id===qt),Yt=!!(Z&&m&&h===Z),Xt=S.attention.some(e=>e.kind===`input_required`||e.kind===`approval_required`),Zt=S.task.contract?.acceptanceCriteria??[],Qt=Zt.filter(e=>Vt.get(e)===`passed`).length,$t=S.task.contract?.expectedOutputs??[],en=S.task.contract?.constraints??[],tn=S.task.contract?.approvalRequired??[],nn=S.task.contract?.assumptions??[],rn=S.task.contract?.risks??[],Q=(...e)=>!!vt?.changedFields.some(t=>e.includes(t)),an=e=>t===`modal`&&n?j(n,e):te(`/tasks/${e}`,wt),on=S.allowedCommands.includes(`move`),$=V.has(`command`),sn=V.has(`delete`),cn=S.runs.find(e=>[`queued`,`running`,`waiting`,`verifying`].includes(e.status)),ln=cn!==void 0,un=(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[Ht?(0,z.jsxs)(x,{variant:`primary`,disabled:$,onClick:()=>void J({type:`mark_ready`}),children:[(0,z.jsx)(N,{className:`size-4`}),d.scheduleTask]}):null,Lt?(0,z.jsxs)(x,{variant:`primary`,disabled:$,onClick:()=>void J({type:`resolve_wait`,waitId:Lt.id}),children:[(0,z.jsx)(N,{className:`size-4`}),d.resumeTask]}):null,!It&&Ut&&qt?(0,z.jsxs)(x,{variant:`primary`,disabled:$,onClick:()=>void J({type:`start`,executor:{kind:`agent`,agentId:qt}}),children:[(0,z.jsx)(N,{className:`size-4`}),d.runTask]}):null,Gt?(0,z.jsxs)(x,{variant:`primary`,disabled:$,onClick:()=>void J({type:`close`,resolution:`done`}),children:[(0,z.jsx)(_,{className:`size-4`}),d.approveTask]}):null,Kt?(0,z.jsxs)(x,{variant:`primary`,disabled:$,onClick:()=>void J({type:`reopen`,phase:`ready`}),children:[(0,z.jsx)(N,{className:`size-4`}),d.reopenTask]}):null,!It&&Wt?(0,z.jsxs)(x,{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,z.jsx)(Ee,{className:`size-4`}),d.pauseTask]}):null,(0,z.jsxs)(T,{children:[(0,z.jsx)(ae,{asChild:!0,children:(0,z.jsx)(x,{type:`button`,variant:`ghost`,className:`size-9 p-0`,disabled:$||sn,"aria-label":d.moreActions,children:(0,z.jsx)(se,{className:`size-4`,"aria-hidden":!0})})}),(0,z.jsx)(w,{children:(0,z.jsxs)(O,{align:`end`,sideOffset:6,className:`z-[100] min-w-44 rounded-lg border border-edge bg-surface-panel p-1 shadow-popover`,children:[cn?(0,z.jsx)(ce,{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),B(null),k(de(e,cn.id,cn.version),{revalidate:!1}).catch(()=>B(d.actionFailed)).finally(()=>q(`command`,!1))},children:d.cancelActiveRun}):null,cn?(0,z.jsx)(F,{className:`my-1 h-px bg-edge`}):null,S.task.phase===`closed`?null:(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(ce,{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:d.cancelTask}),(0,z.jsx)(F,{className:`my-1 h-px bg-edge`})]}),(0,z.jsx)(ce,{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(ln){B(d.deleteActiveTaskBlocked);return}xt(!0)},children:d.deleteTask})]})})]})]}),Z&&t!==`modal`?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(x,{type:`button`,variant:`ghost`,className:b(`h-8 shrink-0 px-2 text-xs`,Yt&&`bg-surface-hover text-fg`),"aria-label":l===`zh`?`项目文件`:`Project files`,"aria-pressed":Yt,onClick:()=>{re(Z,!1),g(Z)},children:[(0,z.jsx)(_e,{className:`size-3.5`,"aria-hidden":!0}),l===`zh`?`文件`:`Files`]}),(0,z.jsx)(x,{asChild:!0,variant:`ghost`,className:`h-8 shrink-0 px-2 text-xs`,children:(0,z.jsxs)(c,{to:ve(e),children:[(0,z.jsx)(v,{className:`size-3.5`}),l===`zh`?`全屏`:`Full screen`]})})]}):null]});return(0,z.jsxs)(`div`,{ref:lt,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`} ${st?`lg:cursor-col-resize lg:select-none`:``}`,style:{"--task-chat-panel-width":`${at}%`},children:[t===`page`&&ke?(0,Ae.createPortal)(un,ke):null,(0,z.jsxs)(`section`,{className:`task-detail-scroll min-w-0 flex-1 overflow-y-auto overscroll-contain p-5 sm:p-6`,children:[(0,z.jsxs)(`header`,{className:b(`px-4 pb-5`,Q(`title`)&&`task-detail-live-update`),children:[(0,z.jsx)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:(0,z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:[U?(0,z.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,z.jsx)(Te,{className:`size-3.5`,"aria-hidden":!0}),U]}):null,(0,z.jsx)(`span`,{children:`/`}),(0,z.jsx)(`span`,{children:d.taskLabel}),vt?(0,z.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent-fg`,role:`status`,children:vt.source===`agent`?l===`zh`?`Agent 刚刚更新`:`Updated by Agent`:l===`zh`?`执行结果已同步`:`Execution result synced`}):null]}),$e?(0,z.jsx)(`input`,{autoFocus:!0,"data-task-inline-editor":!0,value:et,onChange:e=>tt(e.target.value),onBlur:()=>void Tt(),onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur(),e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),ut.current=!0,tt(S.task.title),W(!1),queueMicrotask(()=>{ut.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,z.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:()=>{pt.current={value:S.task.title,version:S.task.version},K(null),tt(S.task.title),W(!0)},children:(0,z.jsx)(`h1`,{className:`text-2xl font-semibold leading-8 text-fg`,children:S.task.title})}),_t===`title`?(0,z.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-warning`,role:`alert`,children:[(0,z.jsx)(`span`,{children:l===`zh`?`Agent 在你编辑期间更新了标题。`:`The Agent updated the title while you were editing.`}),(0,z.jsx)(`button`,{type:`button`,className:`rounded-md bg-surface-hover px-2 py-1 text-fg`,onClick:()=>{tt(S.task.title),K(null),W(!1)},children:l===`zh`?`使用 Agent 版本`:`Use Agent version`}),(0,z.jsx)(`button`,{type:`button`,className:`rounded-md bg-accent-soft px-2 py-1 text-accent-fg`,onClick:()=>void Y({title:et.trim()}).then(e=>{e&&(K(null),W(!1))}),children:l===`zh`?`保留我的修改`:`Keep my changes`})]}):null]})}),Ne?(0,z.jsx)(`p`,{className:`mt-3 text-sm text-danger`,children:Ne}):null]}),(0,z.jsxs)(`div`,{className:`mt-5 flex flex-col gap-5`,children:[(0,z.jsxs)(`main`,{className:`order-2 min-w-0 space-y-5`,children:[(0,z.jsxs)(`section`,{className:b(`rounded-xl bg-surface-panel p-4`,Q(`body`)&&`task-detail-live-update`),children:[(0,z.jsx)(`h2`,{className:`font-medium text-fg`,children:d.taskDescription}),nt?(0,z.jsx)(`textarea`,{autoFocus:!0,"data-task-inline-editor":!0,rows:6,value:rt,onChange:e=>it(e.target.value),onBlur:()=>void Et(),onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),dt.current=!0,it(S.task.body??S.task.contract?.objective??``),G(!1),queueMicrotask(()=>{dt.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,z.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=S.task.body??S.task.contract?.objective??``;ft.current=e,mt.current={value:S.task.body??``,version:S.task.version},K(null),it(e),G(!0)},children:(0,z.jsx)(`span`,{className:`whitespace-pre-wrap text-sm leading-6 text-fg-muted`,children:Bt&&Bt!==S.task.title?Bt:d.noTaskDescription})}),_t===`description`?(0,z.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-warning`,role:`alert`,children:[(0,z.jsx)(`span`,{children:l===`zh`?`Agent 在你编辑期间更新了描述。`:`The Agent updated the description while you were editing.`}),(0,z.jsx)(`button`,{type:`button`,className:`rounded-md bg-surface-hover px-2 py-1 text-fg`,onClick:()=>{it(S.task.body??``),K(null),G(!1)},children:l===`zh`?`使用 Agent 版本`:`Use Agent version`}),(0,z.jsx)(`button`,{type:`button`,className:`rounded-md bg-accent-soft px-2 py-1 text-accent-fg`,onClick:()=>void Y({body:rt.trim()||null}).then(e=>{e&&(K(null),G(!1))}),children:l===`zh`?`保留我的修改`:`Keep my changes`})]}):null]}),S.attention.length>0?(0,z.jsxs)(`section`,{className:b(`rounded-xl bg-warning/10 p-4`,Q(`attention`)&&`task-detail-live-update`),children:[(0,z.jsx)(`h3`,{className:`font-medium text-fg`,children:Xt?d.needsAttention:d.waitingStatus}),(0,z.jsx)(`ul`,{className:`mt-3 space-y-2 text-sm text-fg-muted`,children:S.attention.map((e,t)=>(0,z.jsx)(`li`,{children:e.summary},`${e.kind}-${t}`))})]}):null,(0,z.jsxs)(`section`,{className:b(`rounded-xl bg-surface-panel p-4`,Q(`contract`)&&`task-detail-live-update`),children:[(0,z.jsx)(`h2`,{className:`font-medium text-fg`,children:d.taskDefinition}),(0,z.jsxs)(`div`,{className:`mt-5`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,z.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:d.successDefinition}),Zt.length>0?(0,z.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:d.criteriaProgress.replace(`{{verified}}`,String(Qt)).replace(`{{total}}`,String(Zt.length))}):null]}),(0,z.jsx)(`div`,{className:`mt-3`,children:(0,z.jsx)(H,{items:Zt,empty:d.noDefinition,verificationByCriterion:Vt})})]}),$t.length>0?(0,z.jsxs)(`div`,{className:`mt-5 rounded-lg bg-surface-hover p-4`,children:[(0,z.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:d.expectedOutputs}),(0,z.jsx)(`div`,{className:`mt-3`,children:(0,z.jsx)(H,{items:$t,empty:d.noDefinition})})]}):null,en.length>0?(0,z.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,z.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:d.constraints}),(0,z.jsx)(`div`,{className:`mt-3`,children:(0,z.jsx)(H,{items:en,empty:d.noDefinition})})]}):null,tn.length>0?(0,z.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,z.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:d.approvalRequired}),(0,z.jsx)(`div`,{className:`mt-3`,children:(0,z.jsx)(H,{items:tn,empty:d.noDefinition})})]}):null,nn.length>0?(0,z.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,z.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:d.contextAssumptions}),(0,z.jsx)(`div`,{className:`mt-3`,children:(0,z.jsx)(H,{items:nn,empty:d.noDefinition})})]}):null,rn.length>0?(0,z.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,z.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:d.contextRisks}),(0,z.jsx)(`div`,{className:`mt-3`,children:(0,z.jsx)(H,{items:rn,empty:d.noDefinition})})]}):null]}),X?(0,z.jsxs)(`section`,{className:b(`rounded-xl bg-surface-panel p-4`,Q(`runs`,`receipts`)&&`task-detail-live-update`),children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,z.jsx)(`h2`,{className:`font-medium text-fg`,children:d.latestResult}),(0,z.jsx)(ne,{content:X.summary,compact:!0,className:`mt-2 text-sm leading-6 text-fg`})]}),(0,z.jsxs)(`span`,{className:`rounded-full bg-surface-hover px-2.5 py-1 text-xs text-fg-muted`,children:[d.receiptStatuses[X.status],` · `,d.verificationStatuses[X.verification.status]]})]}),X.remainingWork.length>0?(0,z.jsxs)(`div`,{className:`mt-4`,children:[(0,z.jsx)(`h3`,{className:`text-xs font-medium text-fg-muted`,children:d.remainingWork}),(0,z.jsx)(`div`,{className:`mt-2`,children:(0,z.jsx)(H,{items:X.remainingWork,empty:d.noRemainingWork})})]}):null,X.nextAction?(0,z.jsxs)(`div`,{className:`mt-4 rounded-lg bg-surface-hover p-3`,children:[(0,z.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:d.nextAction}),(0,z.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:X.nextAction})]}):null,(0,z.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2`,children:[(0,z.jsx)(x,{className:`border-0 bg-surface-hover px-2 py-1 text-xs shadow-none`,variant:`secondary`,onClick:()=>void Se(X.runId,`helpful`),children:d.doneWell}),(0,z.jsx)(x,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>void Se(X.runId,`not_helpful`),children:d.needsFix}),X.evidence.filter(e=>e.uri).map(e=>(0,z.jsxs)(`a`,{className:`ml-auto inline-flex items-center gap-1 text-xs text-accent hover:underline`,href:e.uri,children:[(0,z.jsx)(v,{className:`size-3`}),e.title]},`${e.title}-${e.uri}`))]}),S.receipts.length>1?(0,z.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,z.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted`,children:d.executionHistory.replace(`{{count}}`,String(S.receipts.length-1))}),(0,z.jsx)(`div`,{className:`mt-3 space-y-3`,children:S.receipts.slice(1).map(e=>(0,z.jsx)(`article`,{className:`rounded-lg bg-surface-active p-3`,children:(0,z.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,z.jsx)(`p`,{className:`text-sm text-fg`,children:e.summary}),(0,z.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:d.receiptStatuses[e.status]})]})},e.runId))})]}):null]}):null,S.context.length>0?(0,z.jsxs)(`section`,{className:b(`rounded-xl bg-surface-panel p-4`,Q(`context`)&&`task-detail-live-update`),children:[(0,z.jsx)(`h2`,{className:`font-medium text-fg`,children:d.contextUsed}),(0,z.jsx)(`ul`,{className:`mt-4 grid gap-2 sm:grid-cols-2`,children:S.context.map(e=>(0,z.jsxs)(`li`,{className:`min-w-0 rounded-lg bg-surface-hover p-2.5`,children:[(0,z.jsxs)(`span`,{className:`text-[11px] text-fg-subtle`,children:[d.contextRoleLabels[e.role],` · `,d.contextKindLabels[e.targetKind]]}),e.targetKind===`url`&&/^https?:\/\//.test(e.targetId)?(0,z.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,z.jsx)(`p`,{className:`mt-1 break-words text-sm text-fg`,children:e.title??e.targetId})]},e.id))})]}):null]}),(0,z.jsxs)(`aside`,{className:`order-1 min-w-0 space-y-4`,children:[(0,z.jsxs)(`section`,{className:b(`rounded-xl bg-surface-subtle p-4`,Q(`phase`,`resolution`,`priority`,`dueAt`,`delegateAgentId`)&&`task-detail-live-update`),children:[(0,z.jsx)(`h2`,{className:`font-medium text-fg`,children:d.taskProperties}),(0,z.jsxs)(`div`,{className:`mt-4 grid gap-4 sm:grid-cols-2`,children:[(0,z.jsx)(Le,{value:S.task.phase,disabled:V.has(`phase`),canMove:on,canApprove:Gt,canReopen:Kt,language:l,label:d.taskPhase,onChange:Dt}),(0,z.jsx)(Re,{value:S.task.priority,disabled:V.has(`priority`),label:d.priority,labels:d.priorityLabels,onChange:Ot}),(0,z.jsx)(ze,{value:Fe(S.task.dueAt),disabled:V.has(`dueAt`),label:d.dueDate,onChange:kt}),(0,z.jsx)(Be,{value:S.conversation.currentExecutorAgentId??``,disabled:V.has(`delegateAgentId`),label:d.executorLabel,unassignedLabel:d.unassigned,agents:Ze,onChange:Pt}),U?(0,z.jsxs)(`div`,{className:`grid gap-1 text-xs text-fg-muted`,children:[(0,z.jsx)(`span`,{children:d.projectLabel}),(0,z.jsxs)(`span`,{className:`flex items-center gap-1.5 rounded-lg bg-surface-hover px-3 py-2 text-sm text-fg`,children:[(0,z.jsx)(Te,{className:`size-3.5`}),U]})]}):null]}),(0,z.jsxs)(`div`,{className:`mt-4 rounded-lg bg-surface-hover p-3 text-xs leading-5 text-fg-subtle`,children:[(0,z.jsx)(`p`,{children:Rt}),(0,z.jsx)(`p`,{children:zt}),(0,z.jsx)(`p`,{className:`mt-2`,children:d.updatedAt.replace(`{{date}}`,De(S.task.updatedAt,l))})]})]}),(0,z.jsxs)(`section`,{className:b(`rounded-xl bg-surface-panel p-4`,Q(`dependencies`)&&`task-detail-live-update`),children:[(0,z.jsx)(`h2`,{className:`font-medium text-fg`,children:d.taskRelations}),(0,z.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:d.dependencies}),(0,z.jsx)(Ve,{candidates:Je,selected:S.dependencies,disabled:V.has(`dependencies`),labels:St,onChange:Nt})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:d.dependents}),S.dependents.length>0?(0,z.jsx)(`div`,{className:`space-y-1.5`,children:S.dependents.map(e=>(0,z.jsx)(c,{to:an(e.id),className:`block rounded-lg bg-surface-hover p-2.5 text-sm text-accent hover:underline`,children:e.title},e.id))}):(0,z.jsx)(`p`,{className:`text-sm text-fg-subtle`,children:d.noDependents})]})]})]})]})]})]}),(0,z.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(at),tabIndex:0,onPointerDown:Mt,onKeyDown:jt,onDoubleClick:()=>At(Ue),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 ${st?`bg-surface-hover`:``}`,children:(0,z.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,z.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,z.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-3 bg-surface-subtle px-4 py-3.5`,children:[(0,z.jsx)(`div`,{className:`min-w-0`,children:(0,z.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[qt?(0,z.jsx)(pe,{agentId:qt,avatar:Jt?.avatar,size:28,className:`shrink-0`}):null,(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:l===`zh`?`Agent 执行与对话`:`Agent execution and chat`}),(0,z.jsxs)(`p`,{className:`mt-0.5 truncate text-xs text-fg-muted`,children:[Jt?.name??qt??d.unassigned,` · `,Rt]})]})]})}),t===`modal`?un:null]}),Z?(0,z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,z.jsx)(ye,{embedded:!0,sessionKey:Z,taskId:e})}):ge?(0,z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,z.jsxs)(`div`,{className:`max-w-xs`,children:[(0,z.jsx)(P,{className:`mx-auto size-8 animate-pulse text-fg-subtle`}),(0,z.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:l===`zh`?`正在创建任务会话`:`Creating task conversation`})]})}):Oe?(0,z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,z.jsxs)(`div`,{className:`max-w-xs`,children:[(0,z.jsx)(P,{className:`mx-auto size-8 text-danger`}),(0,z.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:l===`zh`?`任务会话创建失败`:`Could not create task conversation`}),(0,z.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:Oe instanceof Error?Oe.message:String(Oe)})]})}):(0,z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,z.jsxs)(`div`,{className:`max-w-xs`,children:[(0,z.jsx)(P,{className:`mx-auto size-8 text-fg-subtle`}),(0,z.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:l===`zh`?`等待任务会话`:`Waiting for a task conversation`}),(0,z.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,z.jsx)(oe,{open:bt,title:d.deleteTaskTitle,description:d.deleteTaskDescription.replace(`{{title}}`,S.task.title),confirmLabel:d.confirmDeleteTask,cancelLabel:d.keepTask,destructive:!0,onConfirm:()=>{xt(!1),Ft()},onCancel:()=>xt(!1)})]})}function Je(){let e=(0,R.c)(2),{taskId:t}=a(),n=t===void 0?``:t,r;return e[0]===n?r=e[1]:(r=(0,z.jsx)(qe,{taskId:n,presentation:`page`}),e[0]=n,e[1]=r),r}function Ye(e){let t=(0,R.c)(58),{taskId:n,backgroundPath:r,onClose:i}=e,a=ie(G),{data:o}=fe(n),s=o?.conversation.activeSessionKey??null,h=D(nt),g=D(tt),_=D(et),ee=D(W),te=be($e),ne=ge(Qe),y=ge(Ze),x=h?g:0,S;t[0]!==i||t[1]!==y?(S=e=>{e||(y(null),i())},t[0]=i,t[1]=y,t[2]=S):S=t[2];let ae=a===`zh`?`关闭任务详情`:`Close task details`,C;t[3]!==i||t[4]!==y?(C=()=>{y(null),i()},t[3]=i,t[4]=y,t[5]=C):C=t[5];let w;t[6]!==ae||t[7]!==C?(w=(0,z.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":ae,onClick:C}),t[6]=ae,t[7]=C,t[8]=w):w=t[8];let oe=h?`true`:`false`,se=`${x/2}px`,ce=`${x}px`,le;t[9]!==se||t[10]!==ce?(le={"--task-detail-workspace-offset":se,"--task-detail-workspace-width":ce},t[9]=se,t[10]=ce,t[11]=le):le=t[11];let ue=le,de=a===`zh`?`任务详情`:`Task details`,T;t[12]===de?T=t[13]:(T=(0,z.jsx)(p,{className:`font-medium text-fg`,children:de}),t[12]=de,t[13]=T);let pe=a===`zh`?`查看并操作任务详情`:`View and manage task details`,E;t[14]===pe?E=t[15]:(E=(0,z.jsx)(l,{className:`sr-only`,children:pe}),t[14]=pe,t[15]=E);let O;t[16]!==s||t[17]!==a||t[18]!==ee||t[19]!==te||t[20]!==n||t[21]!==h||t[22]!==_?(O=s?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`button`,{type:`button`,className:b(`flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,h&&_===s&&`bg-surface-hover text-fg`),"aria-label":a===`zh`?`项目文件`:`Project files`,title:a===`zh`?`项目文件`:`Project files`,"aria-pressed":h&&_===s,onClick:()=>{te(s,!1),ee(s)},children:(0,z.jsx)(_e,{className:`size-4`,"aria-hidden":!0})}),(0,z.jsx)(c,{to:ve(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,z.jsx)(v,{className:`size-4`,"aria-hidden":!0})})]}):null,t[16]=s,t[17]=a,t[18]=ee,t[19]=te,t[20]=n,t[21]=h,t[22]=_,t[23]=O):O=t[23];let k=a===`zh`?`关闭任务详情`:`Close task details`,he;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(he=(0,z.jsx)(re,{className:`size-4`,"aria-hidden":!0}),t[24]=he):he=t[24];let A;t[25]===k?A=t[26]:(A=(0,z.jsx)(u,{className:`flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":k,children:he}),t[25]=k,t[26]=A);let j;t[27]!==O||t[28]!==A?(j=(0,z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[O,A]}),t[27]=O,t[28]=A,t[29]=j):j=t[29];let M;t[30]!==T||t[31]!==E||t[32]!==j?(M=(0,z.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-3 bg-surface-panel px-5 py-3.5`,children:[T,E,j]}),t[30]=T,t[31]=E,t[32]=j,t[33]=M):M=t[33];let N;t[34]!==i||t[35]!==y?(N=()=>{y(null),i()},t[34]=i,t[35]=y,t[36]=N):N=t[36];let P;t[37]!==r||t[38]!==N||t[39]!==n?(P=(0,z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,z.jsx)(qe,{taskId:n,presentation:`modal`,backgroundPath:r,onDeleted:N})}),t[37]=r,t[38]=N,t[39]=n,t[40]=P):P=t[40];let F;t[41]!==M||t[42]!==P||t[43]!==oe||t[44]!==ue?(F=(0,z.jsxs)(f,{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":oe,style:ue,onEscapeKeyDown:Xe,onInteractOutside:U,children:[M,P]}),t[41]=M,t[42]=P,t[43]=oe,t[44]=ue,t[45]=F):F=t[45];let I;t[46]!==ne||t[47]!==h||t[48]!==g||t[49]!==_?(I=ne?(0,z.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:h?g:0},children:(0,z.jsx)(me,{allowOutsideChat:!0,sessionKey:_??void 0})}):null,t[46]=ne,t[47]=h,t[48]=g,t[49]=_,t[50]=I):I=t[50];let ye;t[51]!==F||t[52]!==I||t[53]!==w?(ye=(0,z.jsxs)(d,{children:[w,F,I]}),t[51]=F,t[52]=I,t[53]=w,t[54]=ye):ye=t[54];let xe;return t[55]!==S||t[56]!==ye?(xe=(0,z.jsx)(m,{modal:!1,open:!0,onOpenChange:S,children:ye}),t[55]=S,t[56]=ye,t[57]=xe):xe=t[57],xe}function U(e){let t=e.detail.originalEvent.target;t instanceof Element&&t.closest(`#app-workspace-panel, [data-task-modal-backdrop]`)&&e.preventDefault()}function Xe(e){let t=e.target;t instanceof HTMLElement&&t.closest(`[data-task-inline-editor]`)&&e.preventDefault()}function Ze(e){return e.setPath}function Qe(e){return e.path}function $e(e){return e.setOpen}function W(e){return e.openForSession}function et(e){return e.sessionKeyOverride}function tt(e){return e.widthPx}function nt(e){return e.open}function G(e){return e.language}function rt(e){return(0,z.jsx)(g,{value:e.id,children:e.name||e.id},e.id)}function it(e){return e.id}export{Ye as TaskDetailModal,Je as TaskDetailPage};
|
|
@@ -1,2 +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{a as i,i as a,n as o,o as s,r as c,s as l,t as u}from"./dist-CpzYSoz7.js";import{t as d}from"./check-DUBLcKHA.js";import{n as f,r as p}from"./popover-select-C-Hj-nXR.js";import{t as m}from"./loader-circle-CifKLtgG.js";import{t as h}from"./x-B_N4OPjy.js";import{n as g}from"./locale-store-zEL8bkwx.js";import{i as _}from"./vendor-swr-BIWyz7Rc.js";import{t as v}from"./button-CtTvuElV.js";import{t as y}from"./skeleton-BwbyijEw.js";import{Ba as b,Cs as x,Fc as S,Ml as C,Pc as w,Qc as T,Ql as E,Rl as D,Ws as O,at as ee,ct as te,cu as ne,fl as re,it as ie,kl as ae,nc as oe,nt as se,nu as k,ot as ce,rt as A,sc as le,st as ue,tu as de,vu as j,ws as fe,yc as M}from"./index-aBs0EfQB.js";import{t as pe}from"./page-tabs-BFMGjA60.js";var N=n(),P=e(t(),1),F=r(),I={en:{pageTitle:`You`,pageSubtitle:`A living portrait shaped by you and xopc.`,overview:`Your portrait`,understanding:`Shared understanding`,knowledge:`Work memory`,portraitEyebrow:`YOU × XOPC`,portraitIntro:`Your explicit profile stays clear and editable. xopc builds a separate shared understanding through conversations and work.`,editProfile:`Edit basics`,callName:`What should xopc call you?`,callNamePlaceholder:`For example: Alex, Joyce, or Dr. Chen`,role:`Your role`,rolePlaceholder:`For example: founder, designer, or engineer`,pronouns:`Pronouns (optional)`,pronounsPlaceholder:`For example: she/her, he/him, they/them`,timezone:`Timezone`,locale:`Language / locale`,useDeviceTimezone:`Use this device`,notProvided:`Not provided`,editProfileHint:`These are facts you provide directly. They remain separate from xopc’s observations and inferences.`,saveProfile:`Save`,saving:`Saving…`,explicit:`You told me`,explicitHint:`Facts and preferences you stated directly`,learned:`Learned together`,learnedHint:`Patterns formed from our work`,pending:`To confirm together`,pendingHint:`Items that need your judgment`,confirmTogether:`Confirm together`,confirmHint:`These may affect future behavior. Confirm them, correct the wording, or tell me not to use them.`,nothingToConfirm:`Nothing needs your confirmation right now.`,importantNow:`What matters now`,noPriority:`No current priority has been set.`,otherGoals:`Other active outcomes`,howWeWork:`How we work together`,howWeWorkHint:`Your standing instructions for how I should communicate and act.`,noRules:`No collaboration preferences yet.`,recent:`Recently formed understanding`,recentHint:`The most useful current facts, with their origin and time horizon.`,seeAll:`See all`,workMemory:`What I remember from the work`,workMemoryHint:`Project facts, decisions, lessons, and open questions stay separate from facts about you.`,items:`items`,maintenanceReady:`Memory upkeep is enabled and waiting for its first run.`,maintenanceComplete:`Memory was last organized`,maintenanceFailed:`The latest memory upkeep needs attention`,refresh:`Refresh`,aboutYouTitle:`A view you can correct`,aboutYouHint:`This is working context, not a fixed profile. Every item can be corrected or retired.`,identity:`Who you are`,preferences:`Preferences and working rhythm`,relationships:`People and relationships`,currentState:`Current context`,insights:`My current read`,emptyGroup:`No understanding has formed here yet.`,correct:`Correct`,stopUsing:`Stop using`,confirm:`Confirm`,notTrue:`Not true`,save:`Save correction`,cancel:`Cancel`,correctionPlaceholder:`Write the accurate version…`,searchPlaceholder:`Search work memory…`,allMemory:`All work memory`,memoryLibraryHint:`Only distilled facts, decisions, lessons, commitments, and open questions appear here. Source records stay with their connector.`,noKnowledge:`No work memory has formed yet.`,noKnowledgeMatch:`No work memory matches this search.`,archive:`Archive`,showMore:`Show more`,expand:`Show details`,collapse:`Hide details`,disable:`Disable`,disabled:`Not in use`,enable:`Enable`,loadFailed:`Could not load your understanding.`,tryAgain:`Try again`,actionFailed:`The change could not be saved. Please try again.`},zh:{pageTitle:`你`,pageSubtitle:`一份由你和 xopc 共同塑造、持续生长的画像。`,overview:`你的画像`,understanding:`共同理解`,knowledge:`工作记忆`,portraitEyebrow:`YOU × XOPC`,portraitIntro:`你明确提供的基本信息会被清晰呈现并由你直接编辑;xopc 在对话与共事中形成的理解则单独维护。`,editProfile:`编辑基本信息`,callName:`希望 xopc 如何称呼你?`,callNamePlaceholder:`例如:Mic、Joyce、张老师`,role:`你的角色`,rolePlaceholder:`例如:创业者、产品设计师、工程师`,pronouns:`代词(可选)`,pronounsPlaceholder:`例如:she/her、he/him、they/them`,timezone:`时区`,locale:`语言 / 地区`,useDeviceTimezone:`使用本机时区`,notProvided:`未填写`,editProfileHint:`这些是由你直接提供的事实,与 xopc 的观察和推断分开维护。`,saveProfile:`保存`,saving:`正在保存…`,explicit:`你告诉我的`,explicitHint:`你明确表达的事实与偏好`,learned:`协作中学到的`,learnedHint:`从实际协作中形成的认识`,pending:`等待一起确认`,pendingHint:`需要由你判断的内容`,confirmTogether:`一起确认`,confirmHint:`这些理解可能影响之后的行为。你可以确认、修正,或告诉我以后不要使用。`,nothingToConfirm:`目前没有需要你确认的理解。`,importantNow:`此刻重要`,noPriority:`还没有设置当前优先事项。`,otherGoals:`其他进行中的目标`,howWeWork:`我们怎样协作`,howWeWorkHint:`你对沟通方式和执行行为的长期约定。`,noRules:`还没有形成协作偏好。`,recent:`最近形成的理解`,recentHint:`最值得使用的当前认识,同时说明它来自哪里、适用多久。`,seeAll:`查看全部`,workMemory:`我在工作中记住的`,workMemoryHint:`项目事实、决定、经验和待解问题,与“关于你”的理解分别管理。`,items:`条`,maintenanceReady:`记忆整理已经启用,正在等待首次运行。`,maintenanceComplete:`最近一次记忆整理于`,maintenanceFailed:`最近一次记忆整理需要处理`,refresh:`刷新`,aboutYouTitle:`一份可以共同修正的理解`,aboutYouHint:`它是协作中的工作认知,不是给你定型的档案。每一条都能修正或停止使用。`,identity:`关于你是谁`,preferences:`偏好与工作节奏`,relationships:`重要的人与关系`,currentState:`当前状态`,insights:`我形成的判断`,emptyGroup:`这里还没有形成理解。`,correct:`修正`,stopUsing:`不再使用`,confirm:`确认`,notTrue:`不是这样`,save:`保存修正`,cancel:`取消`,correctionPlaceholder:`写下更准确的说法…`,searchPlaceholder:`搜索工作记忆…`,allMemory:`全部工作记忆`,memoryLibraryHint:`这里只显示提炼后的事实、决定、经验、承诺和待解问题;邮件、日历与文档原文保留在对应来源中。`,noKnowledge:`还没有形成工作记忆。`,noKnowledgeMatch:`没有符合搜索条件的工作记忆。`,archive:`归档`,showMore:`显示更多`,expand:`查看详情`,collapse:`收起详情`,disable:`停用`,disabled:`已停用`,enable:`启用`,loadFailed:`无法载入对你的理解。`,tryAgain:`重试`,actionFailed:`修改没有保存,请重试。`}},L=[`candidate`,`needs_review`,`conflicted`,`stale`],me=new Set([`identity.call_name`,`identity.role`,`identity.pronouns`,`preference.timezone`,`preference.locale`]),he=[`project_fact`,`workspace_fact`,`decision`,`task_lesson`,`commitment`,`open_question`,`episode`,`note`];function R(e,t,n=!1){return e?new Intl.DateTimeFormat(t===`zh`?`zh-CN`:`en`,{dateStyle:`medium`,...n?{timeStyle:`short`}:{}}).format(e):null}function z(e){return typeof e==`string`&&e.trim()?e.trim():void 0}function ge(e){return{callName:z(e.profile.callName)??``,role:z(e.profile.role)??``,pronouns:z(e.profile.pronouns)??``,timezone:z(e.profile.timezone)??``,locale:z(e.profile.locale)??``}}function _e(e,t){return{"zh-CN":{en:`Simplified Chinese`,zh:`简体中文`},"zh-TW":{en:`Traditional Chinese`,zh:`繁体中文`},"en-US":{en:`English (US)`,zh:`英语(美国)`},"en-GB":{en:`English (UK)`,zh:`英语(英国)`},"ja-JP":{en:`Japanese`,zh:`日语`}}[e]?.[t]??e}function ve(e){return Array.from(e.trim()).slice(0,2).join(``).toLocaleUpperCase()}function B(e,t){return(t===`zh`?{user_explicit:`你告诉我的`,user_observed:`从协作中观察到`,system_inferred:`我形成的判断`,external_untrusted:`来自连接的信息`}:{user_explicit:`You told me`,user_observed:`Observed while working together`,system_inferred:`My current read`,external_untrusted:`From connected information`})[e.authority]}function V(e,t){if(e.validTo){let n=R(e.validTo,t);return t===`zh`?`适用至 ${n}`:`Applies until ${n}`}return(t===`zh`?{stable:`长期有效`,slow:`会随时间复核`,dynamic:`近期状态`,event:`特定阶段`}:{stable:`Long-term`,slow:`Reviewed over time`,dynamic:`Current context`,event:`Specific period`})[e.volatility]}function ye(e,t){let n=R(e,t);return t===`zh`?`当前安排至 ${n}`:`Current plan through ${n}`}function be(e,t){return e.authority===`user_explicit`?null:e.confidence>=.85?t===`zh`?`把握较高`:`High confidence`:e.confidence>=.65?t===`zh`?`把握中等`:`Medium confidence`:t===`zh`?`仍需确认`:`Needs confirmation`}function H(e,t){return(t===`zh`?{global:`所有协作`,agent:`当前智能体`,workspace:`当前工作区`,project:`当前项目`,session:`当前会话`}:{global:`All work`,agent:`This agent`,workspace:`This workspace`,project:`This project`,session:`This conversation`})[e.type]}function U(e,t){return(t===`zh`?{project_fact:`项目事实`,workspace_fact:`工作区事实`,decision:`已经决定`,task_lesson:`工作经验`,commitment:`承诺与约定`,open_question:`待解问题`,episode:`重要经历`,note:`其他记录`}:{project_fact:`Project facts`,workspace_fact:`Workspace facts`,decision:`Decisions`,task_lesson:`Lessons`,commitment:`Commitments`,open_question:`Open questions`,episode:`Episodes`,note:`Notes`})[e]}function xe(e,t,n){if(e)return e.targetType===`goal`?t.find(t=>t.id===e.targetId)?.title:/^[0-9a-f]{8}-[0-9a-f-]{20,}$/i.test(e.targetId)?(n===`zh`?{project:`当前项目`,task:`当前任务`,assertion:`一项待处理的理解`,topic:`当前主题`}:{project:`Current project`,task:`Current task`,assertion:`An understanding to address`,topic:`Current topic`})[e.targetType]:e.targetId}function W(e){let t=(0,N.c)(14),{title:n,hint:r,action:i,children:a,className:o}=e,s=`rounded-xl border border-edge bg-surface-panel shadow-surface ${o===void 0?``:o}`,c;t[0]===n?c=t[1]:(c=(0,F.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n}),t[0]=n,t[1]=c);let l;t[2]===r?l=t[3]:(l=r?(0,F.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm leading-5 text-fg-muted`,children:r}):null,t[2]=r,t[3]=l);let u;t[4]!==c||t[5]!==l?(u=(0,F.jsxs)(`div`,{children:[c,l]}),t[4]=c,t[5]=l,t[6]=u):u=t[6];let d;t[7]!==i||t[8]!==u?(d=(0,F.jsxs)(`header`,{className:`flex items-start justify-between gap-4 border-b border-edge-subtle px-5 py-4`,children:[u,i]}),t[7]=i,t[8]=u,t[9]=d):d=t[9];let f;return t[10]!==a||t[11]!==s||t[12]!==d?(f=(0,F.jsxs)(`section`,{className:s,children:[d,a]}),t[10]=a,t[11]=s,t[12]=d,t[13]=f):f=t[13],f}function G(e){let t=(0,N.c)(7),{icon:n,children:r}=e,i;t[0]===n?i=t[1]:(i=(0,F.jsx)(`span`,{className:`text-fg-subtle`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=(0,F.jsx)(`p`,{children:r}),t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,F.jsxs)(`div`,{className:`flex min-h-32 flex-col items-center justify-center gap-2 px-5 py-8 text-center text-sm text-fg-muted`,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function Se({open:e,profile:t,language:n,saving:r,onOpenChange:d,onSave:g}){let _=I[n],[y,b]=(0,P.useState)(t);(0,P.useEffect)(()=>{e&&b(t)},[e,t]);let x=e=>{e.preventDefault(),g({callName:y.callName.trim(),role:y.role.trim(),pronouns:y.pronouns.trim(),timezone:y.timezone.trim(),locale:y.locale.trim()})},S=(e,t,n)=>(0,F.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,F.jsx)(`span`,{className:`font-medium text-fg`,children:t}),(0,F.jsx)(`input`,{value:y[e],onChange:t=>b(n=>({...n,[e]:t.target.value})),placeholder:n,className:`h-10 w-full rounded-xl border border-edge bg-surface-base px-3 text-sm text-fg outline-none transition placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`})]}),C=[`zh-CN`,`zh-TW`,`en-US`,`en-GB`,`ja-JP`];return y.locale&&!C.includes(y.locale)&&C.push(y.locale),(0,F.jsx)(u,{open:e,onOpenChange:d,children:(0,F.jsxs)(s,{children:[(0,F.jsx)(i,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,F.jsx)(c,{className:`fixed left-1/2 top-1/2 z-[90] h-[min(40rem,calc(100vh-2rem))] w-[min(42rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`,children:(0,F.jsxs)(`form`,{className:`flex h-full min-h-0 flex-col`,onSubmit:x,children:[(0,F.jsxs)(`header`,{className:`flex shrink-0 items-start justify-between gap-4 border-b border-edge px-5 py-4 sm:px-6`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(l,{className:`font-semibold text-fg`,children:_.editProfile}),(0,F.jsx)(a,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:_.editProfileHint})]}),(0,F.jsx)(o,{asChild:!0,children:(0,F.jsx)(v,{variant:`ghost`,className:`size-8 shrink-0 p-0`,"aria-label":_.cancel,children:(0,F.jsx)(h,{className:`size-4`})})})]}),(0,F.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5 sm:p-6`,children:(0,F.jsxs)(`div`,{className:`grid gap-5 sm:grid-cols-2`,children:[S(`callName`,_.callName,_.callNamePlaceholder),S(`role`,_.role,_.rolePlaceholder),S(`pronouns`,_.pronouns,_.pronounsPlaceholder),(0,F.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,F.jsx)(`span`,{className:`font-medium text-fg`,children:_.locale}),(0,F.jsxs)(f,{value:y.locale,onChange:e=>b(t=>({...t,locale:e.target.value})),children:[(0,F.jsx)(p,{value:``,children:_.notProvided}),C.map(e=>(0,F.jsx)(p,{value:e,children:_e(e,n)},e))]})]}),(0,F.jsxs)(`label`,{className:`grid gap-1.5 text-sm sm:col-span-2`,children:[(0,F.jsx)(`span`,{className:`font-medium text-fg`,children:_.timezone}),(0,F.jsxs)(`div`,{className:`flex gap-2`,children:[(0,F.jsx)(`input`,{value:y.timezone,onChange:e=>b(t=>({...t,timezone:e.target.value})),placeholder:A(),className:`h-10 min-w-0 flex-1 rounded-xl border border-edge bg-surface-base px-3 text-sm text-fg outline-none transition placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`}),(0,F.jsx)(v,{className:`shrink-0 whitespace-nowrap`,onClick:()=>b(e=>({...e,timezone:A()})),children:_.useDeviceTimezone})]})]})]})}),(0,F.jsxs)(`footer`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-3 sm:px-6`,children:[(0,F.jsx)(o,{asChild:!0,children:(0,F.jsx)(v,{disabled:r,children:_.cancel})}),(0,F.jsxs)(v,{type:`submit`,variant:`primary`,disabled:r,children:[r?(0,F.jsx)(m,{className:`size-4 animate-spin`}):null,r?_.saving:_.saveProfile]})]})]})})]})})}function Ce(e){let t=(0,N.c)(28),{item:n,language:r,busy:i,editing:a,draft:o,onDraftChange:s,onEdit:c,onCancel:l,onAction:u,onCorrect:f}=e,p=I[r],m;t[0]===n.status?m=t[1]:(m=L.includes(n.status),t[0]=n.status,t[1]=m);let g=m,_;t[2]!==n||t[3]!==r?(_=be(n,r),t[2]=n,t[3]=r,t[4]=_):_=t[4];let y=_,b=`rounded-xl border p-4 ${g?`border-edge-strong bg-surface-base`:`border-edge bg-surface-panel`}`,x;t[5]!==i||t[6]!==y||t[7]!==o||t[8]!==a||t[9]!==n||t[10]!==r||t[11]!==g||t[12]!==u||t[13]!==l||t[14]!==f||t[15]!==s||t[16]!==c||t[17]!==p.cancel||t[18]!==p.confirm||t[19]!==p.correct||t[20]!==p.correctionPlaceholder||t[21]!==p.notTrue||t[22]!==p.save||t[23]!==p.stopUsing?(x=a?(0,F.jsxs)(`div`,{className:`space-y-3`,children:[(0,F.jsx)(`label`,{className:`sr-only`,htmlFor:`assertion-${n.id}`,children:p.correctionPlaceholder}),(0,F.jsx)(`textarea`,{id:`assertion-${n.id}`,value:o,onChange:e=>s(e.target.value),placeholder:p.correctionPlaceholder,className:`min-h-24 w-full resize-y rounded-xl border border-edge bg-surface-base px-3 py-2.5 text-sm leading-6 text-fg outline-none transition focus:border-accent focus:ring-2 focus:ring-accent/20`,autoFocus:!0}),(0,F.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,F.jsx)(v,{variant:`ghost`,className:`h-8`,onClick:l,children:p.cancel}),(0,F.jsx)(v,{variant:`primary`,className:`h-8`,disabled:!o.trim()||i,onClick:f,children:p.save})]})]}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:n.statement}),(0,F.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-3 gap-y-1.5 text-xs text-fg-subtle`,children:[(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,F.jsx)(w,{className:`size-3.5`}),B(n,r)]}),(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,F.jsx)(D,{className:`size-3.5`}),V(n,r)]}),n.scope.type===`global`?null:(0,F.jsx)(`span`,{children:H(n.scope,r)}),y?(0,F.jsx)(`span`,{children:y}):null]}),(0,F.jsx)(`div`,{className:`mt-4 flex flex-wrap justify-end gap-1.5`,children:g?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(v,{variant:`secondary`,className:`h-8 gap-1.5 px-2.5`,disabled:i,onClick:()=>u(`active`),children:[(0,F.jsx)(d,{className:`size-3.5`}),p.confirm]}),(0,F.jsxs)(v,{variant:`ghost`,className:`h-8 gap-1.5 px-2.5`,disabled:i,onClick:c,children:[(0,F.jsx)(M,{className:`size-3.5`}),p.correct]}),(0,F.jsxs)(v,{variant:`ghost`,className:`h-8 gap-1.5 px-2.5`,disabled:i,onClick:()=>u(`rejected`),children:[(0,F.jsx)(h,{className:`size-3.5`}),p.notTrue]})]}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(v,{variant:`ghost`,className:`h-8 gap-1.5 px-2.5`,disabled:i,onClick:c,children:[(0,F.jsx)(M,{className:`size-3.5`}),p.correct]}),(0,F.jsxs)(v,{variant:`ghost`,className:`h-8 gap-1.5 px-2.5`,disabled:i,onClick:()=>u(`archived`),children:[(0,F.jsx)(j,{className:`size-3.5`}),p.stopUsing]})]})})]}),t[5]=i,t[6]=y,t[7]=o,t[8]=a,t[9]=n,t[10]=r,t[11]=g,t[12]=u,t[13]=l,t[14]=f,t[15]=s,t[16]=c,t[17]=p.cancel,t[18]=p.confirm,t[19]=p.correct,t[20]=p.correctionPlaceholder,t[21]=p.notTrue,t[22]=p.save,t[23]=p.stopUsing,t[24]=x):x=t[24];let S;return t[25]!==b||t[26]!==x?(S=(0,F.jsx)(`article`,{className:b,children:x}),t[25]=b,t[26]=x,t[27]=S):S=t[27],S}function we(e){let t=(0,N.c)(16),{rule:n,language:r,busy:i,onToggle:a}=e,o=I[r],s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,F.jsx)(re,{className:`mt-0.5 size-4 shrink-0 text-fg-subtle`}),t[0]=s):s=t[0];let c;t[1]===n.statement?c=t[2]:(c=(0,F.jsx)(`p`,{className:`min-w-0 flex-1 text-sm leading-6 text-fg`,children:n.statement}),t[1]=n.statement,t[2]=c);let l;t[3]!==n.status||t[4]!==o.disabled?(l=n.status===`disabled`?(0,F.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:o.disabled}):null,t[3]=n.status,t[4]=o.disabled,t[5]=l):l=t[5];let u=n.status===`active`?o.disable:o.enable,d;t[6]!==i||t[7]!==a||t[8]!==u?(d=(0,F.jsx)(v,{variant:`ghost`,className:`h-8`,disabled:i,onClick:a,children:u}),t[6]=i,t[7]=a,t[8]=u,t[9]=d):d=t[9];let f;t[10]!==l||t[11]!==d?(f=(0,F.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-1`,children:[l,d]}),t[10]=l,t[11]=d,t[12]=f):f=t[12];let p;return t[13]!==c||t[14]!==f?(p=(0,F.jsxs)(`div`,{className:`flex items-start gap-3 border-t border-edge-subtle px-5 py-3 first:border-t-0`,children:[s,c,f]}),t[13]=c,t[14]=f,t[15]=p):p=t[15],p}function Te(e){let t=(0,N.c)(39),{item:n,language:r,busy:i,expanded:a,onToggle:o,onArchive:s}=e,c=I[r],l=n.updatedAt??n.createdAt,u;t[0]!==r||t[1]!==l?(u=R(l,r),t[0]=r,t[1]=l,t[2]=u):u=t[2];let d=u,f;t[3]===n.content?f=t[4]:(f=n.content.length>96||n.content.includes(`
|
|
2
|
-
`),t[3]=n.content,t[4]=f);let p=f,m;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,F.jsx)(ne,{className:`mt-1 size-4 shrink-0 text-fg-subtle`}),t[5]=m):m=t[5];let h=`whitespace-pre-wrap text-sm leading-6 text-fg ${a?``:`line-clamp-2`}`,g;t[6]!==n.content||t[7]!==h?(g=(0,F.jsx)(`p`,{className:h,children:n.content}),t[6]=n.content,t[7]=h,t[8]=g):g=t[8];let _;t[9]!==n.scope||t[10]!==r?(_=H(n.scope,r),t[9]=n.scope,t[10]=r,t[11]=_):_=t[11];let y;t[12]===_?y=t[13]:(y=(0,F.jsx)(`span`,{children:_}),t[12]=_,t[13]=y);let b;t[14]===d?b=t[15]:(b=d?(0,F.jsx)(`span`,{children:d}):null,t[14]=d,t[15]=b);let x;t[16]!==y||t[17]!==b?(x=(0,F.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-fg-subtle`,children:[y,b]}),t[16]=y,t[17]=b,t[18]=x):x=t[18];let S;t[19]!==x||t[20]!==g?(S=(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[g,x]}),t[19]=x,t[20]=g,t[21]=S):S=t[21];let C;t[22]!==p||t[23]!==a||t[24]!==o||t[25]!==c.collapse||t[26]!==c.expand?(C=p?(0,F.jsxs)(v,{variant:`ghost`,className:`h-8 gap-1 px-2`,onClick:o,children:[(0,F.jsx)(`span`,{className:`hidden sm:inline`,children:a?c.collapse:c.expand}),(0,F.jsx)(E,{className:`size-3.5 transition-transform ${a?`rotate-180`:``}`})]}):null,t[22]=p,t[23]=a,t[24]=o,t[25]=c.collapse,t[26]=c.expand,t[27]=C):C=t[27];let w;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,F.jsx)(j,{className:`size-3.5`}),t[28]=w):w=t[28];let T;t[29]!==i||t[30]!==s||t[31]!==c.archive?(T=(0,F.jsx)(v,{variant:`ghost`,className:`size-8 shrink-0 p-0`,disabled:i,onClick:s,"aria-label":c.archive,title:c.archive,children:w}),t[29]=i,t[30]=s,t[31]=c.archive,t[32]=T):T=t[32];let D;t[33]!==C||t[34]!==T?(D=(0,F.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[C,T]}),t[33]=C,t[34]=T,t[35]=D):D=t[35];let O;return t[36]!==S||t[37]!==D?(O=(0,F.jsx)(`article`,{className:`group border-t border-edge-subtle px-5 py-4 first:border-t-0 sm:px-6`,children:(0,F.jsxs)(`div`,{className:`flex items-start gap-3`,children:[m,S,D]})}),t[36]=S,t[37]=D,t[38]=O):O=t[38],O}function Ee(){let e=g(e=>e.language),t=I[e],n=b(e=>e.setPageHeader),r=b(e=>e.clearPageHeader),{data:i,error:a,isLoading:o,mutate:s}=_(`/api/user-model`,ie),[c,l]=(0,P.useState)(`overview`),[u,f]=(0,P.useState)(),[p,m]=(0,P.useState)(),[E,A]=(0,P.useState)(),[j,M]=(0,P.useState)(``),[N,z]=(0,P.useState)(``),[B,V]=(0,P.useState)(24),[be,H]=(0,P.useState)(),[Ee,K]=(0,P.useState)(!1);(0,P.useEffect)(()=>(n({startExtra:null,main:(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`h1`,{className:`text-base font-semibold text-fg`,children:t.pageTitle}),(0,F.jsx)(`p`,{className:`hidden text-xs text-fg-muted sm:block`,children:t.pageSubtitle})]}),end:null}),r),[r,n,t]);let q=async(e,n)=>{f(e),m(void 0);try{await n(),await s()}catch{m(t.actionFailed)}finally{f(void 0)}},De=(e,t)=>{q(e.id,()=>ee(e.id,t))},Oe=e=>{q(e.id,async()=>{await se(e.id,j.trim()),A(void 0),M(``)})},ke=async e=>{f(`profile`),m(void 0);try{await te(e),await s(),K(!1)}catch{m(t.actionFailed)}finally{f(void 0)}};if(o)return(0,F.jsxs)(`div`,{className:`mx-auto w-full max-w-6xl space-y-5 p-4 sm:p-6 lg:py-8`,children:[(0,F.jsx)(y,{className:`h-10 w-72 rounded-xl`}),(0,F.jsx)(y,{className:`h-72 rounded-xl`}),(0,F.jsxs)(`div`,{className:`grid gap-5 lg:grid-cols-2`,children:[(0,F.jsx)(y,{className:`h-80 rounded-xl`}),(0,F.jsx)(y,{className:`h-80 rounded-xl`})]})]});if(a||!i)return(0,F.jsxs)(`div`,{className:`mx-auto flex min-h-72 max-w-xl flex-col items-center justify-center gap-3 p-6 text-center`,children:[(0,F.jsx)(k,{className:`size-6 text-fg-subtle`}),(0,F.jsx)(`p`,{className:`text-sm text-danger`,children:t.loadFailed}),(0,F.jsx)(v,{onClick:()=>void s(),children:t.tryAgain})]});let J=[...i.assertions].sort((e,t)=>{let n=Number(L.includes(t.status))-Number(L.includes(e.status));if(n)return n;let r=e.declaredImportance??e.inferredImportance;return(t.declaredImportance??t.inferredImportance)-r||t.recordedAt-e.recordedAt}).filter(e=>!me.has(e.predicate)),Y=ge(i),Ae=Y.callName||(e===`zh`?`你`:`You`),je=J.filter(e=>L.includes(e.status)),Me=J.filter(e=>e.status===`active`),Ne=Me.filter(e=>e.authority===`user_explicit`).length,Pe=Me.length-Ne,Fe=i.priorities.filter(e=>e.status===`active`&&e.validTo>Date.now()),X=Fe.find(e=>e.rank===`primary`)??Fe[0],Ie=xe(X,i.goals,e),Le=X?.targetType===`goal`?i.goals.find(e=>e.id===X.targetId):void 0,Re=i.goals.filter(e=>e.status===`active`||e.status===`paused`).filter(e=>X?.targetType!==`goal`||e.id!==X.targetId),ze=i.rules.filter(e=>e.status!==`archived`),Be=[...Me].sort((e,t)=>t.recordedAt-e.recordedAt),Z=i.knowledge.filter(e=>e.status!==`archived`&&e.status!==`rejected`),Ve=N.trim().toLocaleLowerCase(),Q=Z.filter(t=>!Ve||t.content.toLocaleLowerCase().includes(Ve)||U(t.kind,e).toLocaleLowerCase().includes(Ve)),He=[{key:`identity`,title:t.identity,icon:x,items:J.filter(e=>e.kind===`identity`)},{key:`preferences`,title:t.preferences,icon:C,items:J.filter(e=>[`preference`,`value`,`routine`,`capability`].includes(e.kind))},{key:`relationships`,title:t.relationships,icon:re,items:J.filter(e=>e.kind===`relationship`)},{key:`current`,title:t.currentState,icon:D,items:J.filter(e=>e.kind===`current_state`)},{key:`insights`,title:t.insights,icon:O,items:J.filter(e=>e.kind===`derived_insight`)}].filter(e=>e.items.length>0),Ue=he.map(e=>({kind:e,count:Z.filter(t=>t.kind===e).length})).filter(e=>e.count>0),We=Q.slice(0,B),Ge=he.map(e=>({kind:e,items:We.filter(t=>t.kind===e),totalCount:Q.filter(t=>t.kind===e).length})).filter(e=>e.items.length>0),$=t=>(0,F.jsx)(Ce,{item:t,language:e,busy:u===t.id,editing:E===t.id,draft:E===t.id?j:``,onDraftChange:M,onEdit:()=>{A(t.id),M(t.statement)},onCancel:()=>{A(void 0),M(``)},onAction:e=>De(t,e),onCorrect:()=>Oe(t)},t.id),Ke=i.maintenance.lastRun?R(i.maintenance.lastRun.finishedAt??i.maintenance.lastRun.startedAt,e,!0):null,qe=i.maintenance.lastRun?i.maintenance.lastRun.status===`completed`?`${t.maintenanceComplete} ${Ke}`:t.maintenanceFailed:t.maintenanceReady;return(0,F.jsxs)(`div`,{className:`mx-auto w-full max-w-6xl space-y-5 p-4 sm:p-6 lg:py-8`,children:[(0,F.jsx)(pe,{items:[{id:`overview`,label:t.overview,icon:O},{id:`understanding`,label:t.understanding,icon:x,count:J.length},{id:`knowledge`,label:t.knowledge,icon:ne,count:Z.length}],activeTab:c,onChange:l,ariaLabel:t.pageTitle,tabIdPrefix:`understanding-tab`,panelIdPrefix:`understanding-panel`}),p?(0,F.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl border border-danger bg-danger-soft px-4 py-3 text-sm text-danger`,children:[(0,F.jsx)(`span`,{children:p}),(0,F.jsx)(`button`,{type:`button`,onClick:()=>m(void 0),"aria-label":t.cancel,children:(0,F.jsx)(h,{className:`size-4`})})]}):null,c===`overview`?(0,F.jsxs)(`div`,{id:`understanding-panel-overview`,role:`tabpanel`,"aria-labelledby":`understanding-tab-overview`,className:`space-y-5`,children:[(0,F.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-surface`,children:[(0,F.jsxs)(`div`,{className:`grid gap-8 px-5 py-7 sm:px-8 sm:py-9 lg:grid-cols-[minmax(0,1fr)_21rem] lg:gap-10`,children:[(0,F.jsxs)(`div`,{className:`min-w-0`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-semibold tracking-[0.16em] text-accent-fg`,children:[(0,F.jsx)(O,{className:`size-3.5`}),(0,F.jsx)(`span`,{children:t.portraitEyebrow})]}),(0,F.jsxs)(`div`,{className:`mt-6 flex items-center gap-4`,children:[(0,F.jsx)(`div`,{className:`flex size-16 shrink-0 items-center justify-center rounded-2xl border border-edge bg-surface-active text-lg font-semibold text-fg sm:size-20 sm:text-xl`,children:ve(Ae)}),(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsx)(`h2`,{className:`truncate text-2xl font-semibold tracking-tight text-fg sm:text-3xl`,children:Ae}),(0,F.jsx)(`p`,{className:`mt-1 truncate text-sm text-fg-muted`,children:Y.role||t.notProvided})]}),(0,F.jsxs)(v,{className:`shrink-0`,onClick:()=>K(!0),children:[(0,F.jsx)(fe,{className:`size-4`}),t.editProfile]})]}),(0,F.jsx)(`p`,{className:`mt-6 max-w-2xl text-sm leading-6 text-fg-muted`,children:t.portraitIntro}),(0,F.jsx)(`div`,{className:`mt-6 overflow-hidden rounded-xl border border-edge bg-edge-subtle`,children:(0,F.jsx)(`div`,{className:`grid gap-px sm:grid-cols-3`,children:[{icon:T,label:t.locale,value:Y.locale?_e(Y.locale,e):t.notProvided},{icon:S,label:t.timezone,value:Y.timezone||t.notProvided},{icon:x,label:t.pronouns,value:Y.pronouns||t.notProvided}].map(({icon:e,label:t,value:n})=>(0,F.jsxs)(`div`,{className:`bg-surface-panel px-4 py-3.5`,children:[(0,F.jsxs)(`p`,{className:`flex items-center gap-1.5 text-xs text-fg-subtle`,children:[(0,F.jsx)(e,{className:`size-3.5`}),t]}),(0,F.jsx)(`p`,{className:`mt-1.5 truncate text-sm font-medium text-fg`,children:n})]},t))})})]}),(0,F.jsxs)(`div`,{className:`flex min-h-52 flex-col rounded-xl border border-edge bg-surface-base p-5 sm:p-6`,children:[(0,F.jsx)(`p`,{className:`text-xs font-semibold tracking-wide text-fg-subtle`,children:t.importantNow}),Ie?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`p`,{className:`mt-4 text-xl font-semibold leading-7 tracking-tight text-fg`,children:Ie}),Le?.desiredOutcome?(0,F.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:Le.desiredOutcome}):null,X?(0,F.jsx)(`p`,{className:`mt-4 text-xs text-fg-subtle`,children:ye(X.validTo,e)}):null]}):(0,F.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-2 py-6 text-center text-sm text-fg-muted`,children:[(0,F.jsx)(de,{className:`size-5 text-fg-subtle`}),(0,F.jsx)(`span`,{children:t.noPriority})]}),Re.length?(0,F.jsxs)(`div`,{className:`mt-5 border-t border-edge pt-4`,children:[(0,F.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:t.otherGoals}),(0,F.jsx)(`div`,{className:`mt-2 space-y-2`,children:Re.slice(0,3).map(e=>(0,F.jsx)(`p`,{className:`text-sm text-fg`,children:e.title},e.id))})]}):null]})]}),(0,F.jsx)(`div`,{className:`grid border-t border-edge-subtle sm:grid-cols-3`,children:[{icon:w,label:t.explicit,hint:t.explicitHint,count:Ne},{icon:k,label:t.learned,hint:t.learnedHint,count:Pe},{icon:d,label:t.pending,hint:t.pendingHint,count:je.length}].map(({icon:e,label:t,hint:n,count:r},i)=>(0,F.jsxs)(`div`,{className:`flex gap-3 px-5 py-4 sm:px-6 ${i?`border-t border-edge-subtle sm:border-l sm:border-t-0`:``}`,children:[(0,F.jsx)(e,{className:`mt-0.5 size-4 shrink-0 text-fg-subtle`}),(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`p`,{className:`text-sm font-medium text-fg`,children:[(0,F.jsx)(`span`,{className:`mr-1.5 text-lg tabular-nums`,children:r}),t]}),(0,F.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:n})]})]},t))})]}),je.length?(0,F.jsx)(W,{title:t.confirmTogether,hint:t.confirmHint,children:(0,F.jsx)(`div`,{className:`grid gap-3 p-4 lg:grid-cols-2`,children:je.map($)})}):null,(0,F.jsx)(W,{title:t.howWeWork,hint:t.howWeWorkHint,children:ze.length?ze.map(t=>(0,F.jsx)(we,{rule:t,language:e,busy:u===t.id,onToggle:()=>void q(t.id,()=>ue(t.id,t.status===`active`?`disabled`:`active`))},t.id)):(0,F.jsx)(G,{icon:(0,F.jsx)(re,{className:`size-5`}),children:t.noRules})}),(0,F.jsx)(W,{title:t.recent,hint:t.recentHint,action:(0,F.jsx)(v,{variant:`ghost`,className:`h-8 shrink-0`,onClick:()=>l(`understanding`),children:t.seeAll}),children:Be.length?(0,F.jsx)(`div`,{className:`grid gap-3 p-4 lg:grid-cols-2`,children:Be.slice(0,6).map($)}):(0,F.jsx)(G,{icon:(0,F.jsx)(k,{className:`size-5`}),children:t.emptyGroup})}),(0,F.jsx)(W,{title:t.workMemory,hint:t.workMemoryHint,action:(0,F.jsx)(v,{variant:`ghost`,className:`h-8 shrink-0`,onClick:()=>l(`knowledge`),children:t.seeAll}),children:Ue.length?(0,F.jsx)(`div`,{className:`grid gap-px bg-edge-subtle sm:grid-cols-2 lg:grid-cols-4`,children:Ue.slice(0,4).map(({kind:t,count:n})=>(0,F.jsxs)(`div`,{className:`bg-surface-panel px-5 py-4`,children:[(0,F.jsx)(`p`,{className:`text-2xl font-semibold tabular-nums text-fg`,children:n}),(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:U(t,e)})]},t))}):(0,F.jsx)(G,{icon:(0,F.jsx)(ae,{className:`size-5`}),children:t.noKnowledge})}),(0,F.jsxs)(`footer`,{className:`flex items-center justify-between gap-4 px-1 pb-2 text-xs text-fg-subtle`,children:[(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,F.jsx)(le,{className:`size-3.5`}),qe]}),(0,F.jsxs)(v,{variant:`ghost`,className:`h-8 gap-1.5 px-2.5`,onClick:()=>void s(),children:[(0,F.jsx)(le,{className:`size-3.5`}),t.refresh]})]})]}):null,c===`understanding`?(0,F.jsxs)(`div`,{id:`understanding-panel-understanding`,role:`tabpanel`,"aria-labelledby":`understanding-tab-understanding`,className:`space-y-5`,children:[(0,F.jsx)(`div`,{className:`rounded-xl border border-edge bg-surface-panel px-5 py-5 shadow-surface sm:px-6`,children:(0,F.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,F.jsx)(k,{className:`mt-0.5 size-5 shrink-0 text-accent-fg`}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`h2`,{className:`font-semibold text-fg`,children:t.aboutYouTitle}),(0,F.jsx)(`p`,{className:`mt-1 max-w-3xl text-sm leading-6 text-fg-muted`,children:t.aboutYouHint})]})]})}),He.length?He.map(({key:e,title:t,icon:n,items:r})=>(0,F.jsx)(W,{title:t,action:(0,F.jsx)(n,{className:`size-4 text-fg-subtle`}),children:(0,F.jsx)(`div`,{className:`grid gap-3 p-4 lg:grid-cols-2`,children:r.map($)})},e)):(0,F.jsx)(`div`,{className:`rounded-xl border border-edge bg-surface-panel shadow-surface`,children:(0,F.jsx)(G,{icon:(0,F.jsx)(k,{className:`size-5`}),children:t.emptyGroup})})]}):null,c===`knowledge`?(0,F.jsxs)(`div`,{id:`understanding-panel-knowledge`,role:`tabpanel`,"aria-labelledby":`understanding-tab-knowledge`,className:`space-y-4`,children:[(0,F.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-xl border border-edge bg-surface-panel p-4 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,F.jsxs)(`div`,{className:`max-w-2xl`,children:[(0,F.jsx)(`h2`,{className:`font-semibold text-fg`,children:t.allMemory}),(0,F.jsxs)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:[Z.length,` `,t.items,` · `,t.memoryLibraryHint]})]}),(0,F.jsxs)(`label`,{className:`relative block sm:w-80`,children:[(0,F.jsx)(oe,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`}),(0,F.jsx)(`span`,{className:`sr-only`,children:t.searchPlaceholder}),(0,F.jsx)(`input`,{type:`search`,value:N,onChange:e=>{z(e.target.value),V(24)},placeholder:t.searchPlaceholder,className:`h-10 w-full rounded-xl border border-edge bg-surface-base pl-9 pr-3 text-sm text-fg outline-none transition placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`})]})]}),Q.length?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`div`,{className:`space-y-4`,children:Ge.map(({kind:t,items:n,totalCount:r})=>(0,F.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-surface`,children:[(0,F.jsxs)(`header`,{className:`flex items-center justify-between border-b border-edge-subtle px-5 py-3 sm:px-6`,children:[(0,F.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:U(t,e)}),(0,F.jsx)(`span`,{className:`text-xs tabular-nums text-fg-subtle`,children:r})]}),(0,F.jsx)(`div`,{children:n.map(t=>(0,F.jsx)(Te,{item:t,language:e,busy:u===t.id,expanded:be===t.id,onToggle:()=>H(e=>e===t.id?void 0:t.id),onArchive:()=>void q(t.id,()=>ce(t.id,`archived`))},t.id))})]},t))}),Q.length>B?(0,F.jsx)(`div`,{className:`flex justify-center pt-2`,children:(0,F.jsx)(v,{onClick:()=>V(e=>e+24),children:t.showMore})}):null]}):(0,F.jsx)(`div`,{className:`rounded-xl border border-edge bg-surface-panel shadow-surface`,children:(0,F.jsx)(G,{icon:(0,F.jsx)(oe,{className:`size-5`}),children:N.trim()?t.noKnowledgeMatch:t.noKnowledge})})]}):null,(0,F.jsx)(Se,{open:Ee,profile:Y,language:e,saving:u===`profile`,onOpenChange:K,onSave:e=>void ke(e)})]})}export{Ee as UserModelPage};
|