@xopcai/xopc 0.0.227 → 0.0.229
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-BevwE16n.js → activity-store-M0nAY5XB.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-BggVQrEZ.js → agent-avatar-dicebear-CsFAJTIN.js} +1 -1
- package/dist/gateway/static/root/assets/agents-DA4b6_0C.js +68 -0
- package/dist/gateway/static/root/assets/{api-Bx_BpIt8.js → api-BywYxpaS.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-BtKP9n2r.js → app-management-settings-panel-7KcMWuah.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-BoH2NAUX.js → appearance-settings-Cqlw7Fif.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-CsnhdGZ2.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-DnceUyxm.js → archive-plugin-7_DXaMTP.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-Bh8_9gkr.js → attachment-load-q4pDpqkF.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-ZKeAAVxD.js → automations-page-BuTqjKGX.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-CD0E2ThS.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-Cy9er6w-.js → binary-plugins-DUce1Bsc.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-Cc0wWvNX.js → block-editor-D8Ejp-QR.js} +3 -3
- package/dist/gateway/static/root/assets/browser-settings-page-CY1k3MMd.js +8 -0
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-BS7rpLLl.js → browser-workflow-inputs-8NC2qDRF.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-BdBVUZXm.js → browser-workflows-page-BDvZbR9v.js} +2 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-D1VfotHQ.js +7 -0
- package/dist/gateway/static/root/assets/{capability-presets-api-D1Lqz0Tt.js → capability-presets-api-o0y9WgAI.js} +1 -1
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-DXHqRLpU.js +3 -0
- package/dist/gateway/static/root/assets/{channel-recipient-api-CGuEl-l2.js → channel-recipient-api-C5ABr73b.js} +1 -1
- package/dist/gateway/static/root/assets/channels-settings-DrFL57M_.js +1 -0
- package/dist/gateway/static/root/assets/channels-status-swr-38FsOnR0.js +1 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-CdX_7aQh.js → chat-terminal-dock-h1CKexNz.js} +2 -2
- package/dist/gateway/static/root/assets/connectors-page-DUAyfFCF.js +2 -0
- package/dist/gateway/static/root/assets/{cron-expression-BnSQc4Ek.js → cron-expression-DlaQQOId.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-BbuG7zQ_.js → date-picker-8R1sXJKb.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-snZeqOmG.js → dependency-picker-CWur0821.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-DJQ8JoR1.js → desktop-pet-Knl-zNDU.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-B9txsRtv.js → desktop-pet-settings-CAQMLVtd.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-D7WKWkNB.js → directory-picker-path-field-Caaz4Rw5.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-D_7cOCj2.js → extension-debug-page-B965Mc15.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-Bwu47iUb.js → extension-page-C0UnkBi5.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-Dwg4dSZM.js → extension-settings-page-BUSIAZCR.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-jURUSte_.js → gateway-config-api-DkH0eEgy.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-6SQXF1yR.js → gateway-config-swr-BWGjnmDl.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-UklJOMLX.js → gateway-settings-BBgLDm6I.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-DqWaxyvZ.js → gateway-startup-retry-B_zrtccP.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-Djs_nduD.js → heartbeat-settings-BtEHVXWD.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-5SU2TNJj.js +1 -0
- package/dist/gateway/static/root/assets/{image-generation-api-Bxmt6LEr.js → image-generation-api-YKP2me5Z.js} +1 -1
- package/dist/gateway/static/root/assets/index-BNWhgmjs.js +70 -0
- package/dist/gateway/static/root/assets/index-D_hrEKXM.css +2 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-ByVsCH3d.js → keyboard-shortcuts-settings-CsRz8NrS.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-DYPEUgpP.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-D19R-xsz.js → local-apps-page-CTBNUG4a.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-Ci1Qi0Q-.js → locale-store-CXhjfe4q.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-B0P7rG2B.js +2 -0
- package/dist/gateway/static/root/assets/{management-settings-G0y7zmfY.js → management-settings-YqUAEwQo.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-split-B69d2HWt.js → markdown-split-dxpSCXb8.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-DD_PgVue.css → markdown-view-CLzTdVLW.css} +1 -1
- package/dist/gateway/static/root/assets/markdown-view-DvM5PWEH.js +201 -0
- package/dist/gateway/static/root/assets/{media-plugins-6TWEQgN_.js → media-plugins-CJ00i1Lg.js} +1 -1
- package/dist/gateway/static/root/assets/messages-BMdD0LWk.js +3 -0
- package/dist/gateway/static/root/assets/{notes-api-DLsnnZCS.js → notes-api-BFsOGYkd.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-CkRJJKDm.js → notes-page-DEnbnkIt.js} +1 -1
- package/dist/gateway/static/root/assets/notes-workbench-DmVYu_Oc.js +4 -0
- package/dist/gateway/static/root/assets/{product-open-page-HxArIvoN.js → product-open-page-BHxo9U95.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-DV2nGmsq.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-BNIFwFfc.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-lEar5FOV.js → registry-api-BFZrVYfy.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-DLXqKiA_.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-Bf03UNGD.js → runtime-tools-settings-panel-BpQ2GI-0.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-CIXMBgx5.js → schema-form-HE1G26Lx.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-DWaXf_25.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-JFCbnCL2.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-DgdB26mE.js → settings-form-section-CXAn0Xhy.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-efk5W6lG.js → settings-loading-skeleton-DsFu7Bcv.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-BHVf4gEP.js → settings-page-C4iib9nO.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-WK0dGNMv.js → setup-status-panel-BA83Wr1d.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-Cod-w2qm.js → share-preview-page-BOGl3s6M.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-CUqQ31gt.js → shares-settings-Q2MdGaBi.js} +1 -1
- package/dist/gateway/static/root/assets/skill-reload-api-cFtfVeFU.js +1 -0
- package/dist/gateway/static/root/assets/{skills-page-DwCcipqK.js → skills-page-CdaFtNw9.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page.utils-3WSbtl3S.js → skills-page.utils-DYaAddUL.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-C5VxqC_s.js → system-settings-panel-Co7gilRd.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-5B1pswu8.js +1 -0
- package/dist/gateway/static/root/assets/{theme-store-Dd89g_ki.js → theme-store-DOdCjyuw.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-CeV8VJh2.js → use-autosave-DnnZtMpA.js} +1 -1
- package/dist/gateway/static/root/assets/user-context-page-Dr1FKjXv.js +1 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-EmJ-8aZu.js → voice-api-key-field-wetUpi3i.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-zsk6E3Mi.js → work-discovery-overlay-tbTWASJJ.js} +1 -1
- package/dist/gateway/static/root/assets/workflow-run-setup-panel-Dy0fDs8w.js +3 -0
- package/dist/gateway/static/root/assets/workflows-page-IVP3GSkI.js +5 -0
- package/dist/gateway/static/root/index.html +12 -12
- package/dist/gateway/static/root/notification-sw.js +1 -1
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/notifications.js +56 -0
- package/dist/packages/gateway-contract/src/turn-outcome.js +114 -0
- package/dist/src/agent/agent-instance-gateway.d.ts +1 -1
- package/dist/src/agent/agent-manager.d.ts +1 -1
- package/dist/src/agent/agent-manager.js +18 -3
- package/dist/src/agent/background-review/prompts.d.ts +8 -2
- package/dist/src/agent/background-review/prompts.js +25 -12
- package/dist/src/agent/background-review/run-background-review.d.ts +7 -2
- package/dist/src/agent/background-review/run-background-review.js +175 -160
- package/dist/src/agent/lifecycle/timeout-wrapper.d.ts +1 -0
- package/dist/src/agent/lifecycle/timeout-wrapper.js +7 -6
- package/dist/src/agent/mcp/mcp-transport-config.d.ts +1 -1
- package/dist/src/agent/mcp/mcp-transport-config.js +1 -1
- package/dist/src/agent/memory/index.d.ts +1 -1
- package/dist/src/agent/memory/index.js +2 -2
- package/dist/src/agent/memory/manager.d.ts +1 -11
- package/dist/src/agent/memory/manager.js +0 -16
- package/dist/src/agent/memory/understanding/service.d.ts +0 -11
- package/dist/src/agent/memory/understanding/service.js +7 -173
- package/dist/src/agent/memory/user-context-coordinator.d.ts +1 -3
- package/dist/src/agent/memory/user-context-coordinator.js +3 -66
- package/dist/src/agent/orchestration/agent-orchestrator.js +1 -1
- package/dist/src/agent/orchestration/run-agent-turn-with-timeout.d.ts +2 -2
- package/dist/src/agent/orchestration/run-agent-turn-with-timeout.js +4 -4
- package/dist/src/agent/service/direct-turn-helpers.js +1 -1
- package/dist/src/agent/tools/create-share-tool.js +14 -1
- package/dist/src/agent/tools/exec-command.js +3 -3
- package/dist/src/agent/tools/execute-code-tool.js +1 -1
- package/dist/src/agent/tools/executor.js +2 -2
- package/dist/src/agent/tools/image-generate-tool.js +12 -0
- package/dist/src/agent/tools/send-media.js +11 -0
- package/dist/src/agent/tools/xopc-use-tool.js +1 -1
- package/dist/src/cli/command-loaders.js +1 -0
- package/dist/src/cli/command-manifest.js +4 -0
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/history.d.ts +1 -0
- package/dist/src/cli/commands/history.js +50 -0
- package/dist/src/config/agent-profile.js +1 -1
- package/dist/src/config/schema.d.ts +4 -0
- package/dist/src/config/schema.js +1 -0
- package/dist/src/connectors/connected-source-understanding.js +35 -21
- package/dist/src/connectors/learning-coordinator.js +1 -42
- package/dist/src/gateway/agents-admin.js +1 -1
- package/dist/src/gateway/chat-stream/mapper.d.ts +2 -0
- package/dist/src/gateway/chat-stream/mapper.js +5 -0
- package/dist/src/gateway/chat-stream/protocol.d.ts +3 -2
- package/dist/src/gateway/chat-stream/turn-outcome-collector.d.ts +16 -0
- package/dist/src/gateway/chat-stream/turn-outcome-collector.js +111 -0
- package/dist/src/gateway/hono/lib/static-ui.js +7 -5
- package/dist/src/gateway/hono/routes/index.js +2 -0
- package/dist/src/gateway/hono/routes/mobile.js +18 -40
- package/dist/src/gateway/hono/routes/notifications.d.ts +3 -0
- package/dist/src/gateway/hono/routes/notifications.js +45 -0
- package/dist/src/gateway/hono/routes/sessions.js +31 -0
- package/dist/src/gateway/hono/routes/tasks.js +1 -1
- package/dist/src/gateway/hono/routes/understanding-sources.js +4 -1
- package/dist/src/gateway/hono/routes/you.js +29 -11
- package/dist/src/gateway/service/agent-runner.js +6 -2
- package/dist/src/gateway/service/run-gateway-agent.js +58 -2
- package/dist/src/gateway/service/sessions-api.d.ts +6 -0
- package/dist/src/gateway/service/sessions-api.js +60 -3
- package/dist/src/gateway/service.d.ts +2 -2
- package/dist/src/gateway/service.js +8 -7
- package/dist/src/history/ctx/exporter.d.ts +14 -0
- package/dist/src/history/ctx/exporter.js +99 -0
- package/dist/src/history/ctx/format.d.ts +25 -0
- package/dist/src/history/ctx/format.js +282 -0
- package/dist/src/knowledge/index.d.ts +0 -1
- package/dist/src/knowledge/index.js +1 -2
- package/dist/src/media/session-references.d.ts +6 -0
- package/dist/src/media/session-references.js +24 -3
- package/dist/src/notifications/device-store.d.ts +16 -0
- package/dist/src/notifications/device-store.js +96 -0
- package/dist/src/notifications/planner.d.ts +6 -0
- package/dist/src/notifications/planner.js +160 -0
- package/dist/src/notifications/service.d.ts +18 -0
- package/dist/src/notifications/service.js +184 -0
- package/dist/src/notifications/store.d.ts +53 -0
- package/dist/src/notifications/store.js +184 -0
- package/dist/src/notifications/types.d.ts +29 -0
- package/dist/src/notifications/types.js +14 -0
- package/dist/src/session/client-history.d.ts +3 -1
- package/dist/src/session/client-history.js +13 -0
- package/dist/src/session/index.d.ts +1 -1
- package/dist/src/session/manager.d.ts +1 -0
- package/dist/src/session/manager.js +6 -0
- package/dist/src/session/store.d.ts +15 -0
- package/dist/src/session/store.js +58 -0
- package/dist/src/storage/sqlite/index.d.ts +2 -2
- package/dist/src/storage/sqlite/index.js +3 -3
- package/dist/src/storage/sqlite/migrations/136_product_notifications.sql +79 -0
- package/dist/src/storage/sqlite/migrations/137_understanding_status_audit.sql +71 -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/schema.js +1 -1
- package/dist/src/storage/sqlite/session-input-repository.d.ts +5 -0
- package/dist/src/storage/sqlite/session-input-repository.js +9 -1
- package/dist/src/storage/sqlite/user-context-repository.d.ts +16 -4
- package/dist/src/storage/sqlite/user-context-repository.js +56 -12
- package/dist/src/tasks/index.js +2 -2
- package/dist/src/tasks/task-application-service.js +42 -6
- package/dist/src/tasks/task-change-events.d.ts +9 -0
- package/dist/src/tasks/task-change-events.js +17 -1
- package/dist/src/tasks/task-outbox-dispatcher.js +5 -1
- package/dist/src/tasks/task-run-dispatcher.js +4 -2
- package/dist/src/tasks/task-run-repository.js +13 -0
- package/dist/src/user-context/config.d.ts +8 -0
- package/dist/src/user-context/config.js +3 -0
- package/dist/src/user-context/consolidation.js +16 -4
- package/dist/src/user-context/extraction/executor.d.ts +22 -0
- package/dist/src/user-context/extraction/executor.js +142 -0
- package/dist/src/user-context/extraction/registry.d.ts +1 -1
- package/dist/src/user-context/extraction/registry.js +5 -34
- package/dist/src/user-context/extraction/repair.js +4 -1
- package/dist/src/user-context/extraction/semantic.d.ts +18 -0
- package/dist/src/user-context/extraction/semantic.js +148 -0
- package/dist/src/user-context/understandingQuality.js +4 -0
- package/dist/src/work-discovery/analyzer.js +9 -4
- package/dist/src/work-discovery/service.d.ts +1 -0
- package/dist/src/work-discovery/service.js +5 -4
- package/dist/src/work-discovery/types.d.ts +1 -0
- package/package.json +14 -8
- package/dist/gateway/static/root/assets/agents-TJpjRHnr.js +0 -68
- package/dist/gateway/static/root/assets/apps-page-CZ4Da51l.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-2Y00PvJU.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-CbJD27_j.js +0 -8
- package/dist/gateway/static/root/assets/capabilities-settings-panel-Dv8y6OuP.js +0 -7
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-TZmjzWzt.js +0 -3
- package/dist/gateway/static/root/assets/channels-settings-g-68dutA.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-D7KsAeWh.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-DXA0rAvQ.js +0 -2
- package/dist/gateway/static/root/assets/home-page-i6bXCHdo.js +0 -1
- package/dist/gateway/static/root/assets/index-BBBE89vm.css +0 -2
- package/dist/gateway/static/root/assets/index-BsD5wygl.js +0 -74
- package/dist/gateway/static/root/assets/local-app-workbench-page-BCKEDMlP.js +0 -2
- package/dist/gateway/static/root/assets/logs-page-Cy9YQK7j.js +0 -2
- package/dist/gateway/static/root/assets/markdown-view-CBM-v2ph.js +0 -69
- package/dist/gateway/static/root/assets/mermaid-render-BbqDc_LQ.js +0 -134
- package/dist/gateway/static/root/assets/messages-CtOJwGW3.js +0 -3
- package/dist/gateway/static/root/assets/notes-workbench-B10T3hGX.js +0 -4
- package/dist/gateway/static/root/assets/project-detail-page-DsqRlgsy.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-Bu2PN8OK.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-CXACdJ2f.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-CS2knWDT.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-ByFGk0q_.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-DweAPjI8.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-DEj-BFMP.js +0 -1
- package/dist/gateway/static/root/assets/user-context-page-f7yh7aD5.js +0 -1
- package/dist/gateway/static/root/assets/workflow-run-setup-panel-CBAYvm3G.js +0 -3
- package/dist/gateway/static/root/assets/workflows-page-BN0JmHrG.js +0 -5
- package/dist/src/agent/memory/understanding/correction.d.ts +0 -3
- package/dist/src/agent/memory/understanding/correction.js +0 -39
- package/dist/src/knowledge/connected-understanding-pipeline.d.ts +0 -17
- package/dist/src/knowledge/connected-understanding-pipeline.js +0 -278
- package/dist/src/mobile/notification-service.d.ts +0 -9
- package/dist/src/mobile/notification-service.js +0 -156
- package/dist/src/mobile/notification-store.d.ts +0 -28
- package/dist/src/mobile/notification-store.js +0 -132
- package/dist/src/mobile/notification-types.d.ts +0 -37
- package/dist/src/mobile/notification-types.js +0 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./createLucideIcon-DPHK1VkS.js";import{t as a}from"./markdown-view-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./createLucideIcon-DPHK1VkS.js";import{t as a}from"./markdown-view-DvM5PWEH.js";import{t as o}from"./cn-JdwAhgNB.js";import{l as s,o as c,r as l,s as u}from"./locale-store-CXhjfe4q.js";var d=i(`image-off`,[[`line`,{x1:`2`,x2:`22`,y1:`2`,y2:`22`,key:`a6p6uj`}],[`path`,{d:`M10.41 10.41a2 2 0 1 1-2.83-2.83`,key:`1bzlo9`}],[`line`,{x1:`13.5`,x2:`6`,y1:`13.5`,y2:`21`,key:`1q0aeu`}],[`line`,{x1:`18`,x2:`21`,y1:`12`,y2:`15`,key:`5mozeu`}],[`path`,{d:`M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59`,key:`mmje98`}],[`path`,{d:`M21 15V5a2 2 0 0 0-2-2H9`,key:`43el77`}]]),f=`xopc-attachment`,p=/^xopc-attachment:\/\/notes\/([^/]+)\/([^/?#]+)$/i,m=/^\/api\/notes\/([^/]+)\/media\/([^/?#]+)$/i;function h(e,t){return`${f}://notes/${encodeURIComponent(e)}/${encodeURIComponent(t)}`}function g(e,t){let n=e.trim();if(!n)return null;let r=n.split(`?`)[0],i=r.match(p),a=r.match(m),o=i??a;if(!o)return null;let s=decodeURIComponent(o[1]),c=decodeURIComponent(o[2]);return t&&s!==t?null:{noteId:s,attachmentId:c}}function _(e,t){return`/api/notes/${encodeURIComponent(e)}/media/${encodeURIComponent(t)}`}var v=e(t(),1),y=n(),b=new Map,x=``;function S(e,t,n){return`${n}:${e}:${t}`}function C(){let e=s.getState().token??``;if(e!==x){for(let e of b.values())e.objectUrl&&URL.revokeObjectURL(e.objectUrl);b.clear(),x=e}}async function w(e,t){C();let n=S(e,t,s.getState().token??``),r=b.get(n);return r||(r={blob:(async()=>{let n=await c(l(_(e,t)));if(n.status===401&&s.getState().onUnauthorized(),!n.ok)throw Error(`HTTP ${n.status}`);return n.blob()})(),objectUrl:null,refCount:0},b.set(n,r)),r.blob}async function T(e,t){C();let n=S(e,t,s.getState().token??``),r=b.get(n);if(r||(r={blob:w(e,t),objectUrl:null,refCount:0},b.set(n,r)),!r.objectUrl){let e=await r.blob;r.objectUrl=URL.createObjectURL(e)}return r.refCount+=1,r.objectUrl}function E(e,t){C();let n=S(e,t,s.getState().token??``),r=b.get(n);r&&(r.refCount=Math.max(0,r.refCount-1),r.refCount===0&&r.objectUrl&&(URL.revokeObjectURL(r.objectUrl),r.objectUrl=null,b.delete(n)))}function D(e,t){return h(e,t)}function O(e){if(e<60)return`Voice · ${e}s`;let t=Math.floor(e/60),n=e%60;return`Voice · ${t}:${String(n).padStart(2,`0`)}`}async function k(e){let t=await e.json().catch(()=>({}));return typeof t.error==`string`?t.error:`HTTP ${e.status}`}async function A(e,t){let n=s.getState().token,r=new Headers;n&&r.set(`Authorization`,`Bearer ${n}`);let i=await fetch(e,{method:`POST`,headers:r,body:t});if(i.status===401&&s.getState().onUnauthorized(),!i.ok)throw Error(await k(i));return i.json()}var j=r();function ee(e){let t=(0,y.c)(39),n,r,i,a,s,c,l;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],s=t[5],c=t[6],l=t[7]):({src:c,expectedNoteId:r,alt:l,className:n,onClick:i,onLoadFailed:a,...s}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=s,t[6]=c,t[7]=l);let u=l===void 0?``:l,f;t[8]!==r||t[9]!==c?(f=g(c,r),t[8]=r,t[9]=c,t[10]=f):f=t[10];let p=f,[m,h]=(0,v.useState)(p?null:c),[_,b]=(0,v.useState)(!1),x,S;if(t[11]!==a||t[12]!==p||t[13]!==c?(x=()=>{if(b(!1),!p){h(c);return}let e=!1;return h(null),T(p.noteId,p.attachmentId).then(t=>{e||h(t)}).catch(()=>{e||(b(!0),a?.())}),()=>{e=!0,E(p.noteId,p.attachmentId)}},S=[c,p,a],t[11]=a,t[12]=p,t[13]=c,t[14]=x,t[15]=S):(x=t[14],S=t[15]),(0,v.useEffect)(x,S),_){let e;t[16]===n?e=t[17]:(e=o(`flex items-center justify-center bg-surface-hover text-fg-muted`,n),t[16]=n,t[17]=e);let r=!u,i;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,j.jsx)(d,{className:`size-5`}),t[18]=i):i=t[18];let a;return t[19]!==e||t[20]!==r?(a=(0,j.jsx)(`div`,{className:e,"aria-hidden":r,children:i}),t[19]=e,t[20]=r,t[21]=a):a=t[21],a}if(!m){let e;t[22]===n?e=t[23]:(e=o(`animate-pulse bg-surface-hover`,n),t[22]=n,t[23]=e);let r=!u,i;return t[24]!==e||t[25]!==r?(i=(0,j.jsx)(`div`,{className:e,"aria-hidden":r}),t[24]=e,t[25]=r,t[26]=i):i=t[26],i}let C;t[27]!==m||t[28]!==i?(C=i?()=>i(m):void 0,t[27]=m,t[28]=i,t[29]=C):C=t[29];let w;t[30]===a?w=t[31]:(w=()=>{b(!0),a?.()},t[30]=a,t[31]=w);let D;return t[32]!==u||t[33]!==n||t[34]!==m||t[35]!==s||t[36]!==C||t[37]!==w?(D=(0,j.jsx)(`img`,{...s,src:m,alt:u,className:n,onClick:C,onError:w}),t[32]=u,t[33]=n,t[34]=m,t[35]=s,t[36]=C,t[37]=w,t[38]=D):D=t[38],D}function M(e){return e.replace(/xopc-attachment:\/\/notes\/([^/]+)\/([^)\s]+)/gi,`/api/notes/$1/media/$2`)}function N(e,t){let n=[];return e.querySelectorAll(`.markdown-body img`).forEach(e=>{let r=g(e.getAttribute(`src`)??``,t);if(!r)return;let i=!1;T(r.noteId,r.attachmentId).then(t=>{i||(e.src=t)}).catch(()=>{e.classList.add(`note-media-load-failed`)}),n.push(()=>{i=!0,E(r.noteId,r.attachmentId)})}),e.querySelectorAll(`.markdown-body a`).forEach(e=>{let r=g(e.getAttribute(`href`)??``,t);if(!r)return;let i=document.createElement(`audio`);i.controls=!0,i.className=`note-media-audio mt-2 w-full max-w-md`,e.replaceWith(i);let a=!1;T(r.noteId,r.attachmentId).then(e=>{a||(i.src=e)}).catch(()=>{i.remove()}),n.push(()=>{a=!0,E(r.noteId,r.attachmentId)})}),()=>{for(let e of n)e()}}function P(e){let t=(0,y.c)(17),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({content:n,noteId:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let o=(0,v.useRef)(null),s;t[4]===r?s=t[5]:(s=()=>{let e=o.current;if(e)return N(e,r)},t[4]=r,t[5]=s);let c;t[6]!==n||t[7]!==r?(c=[n,r],t[6]=n,t[7]=r,t[8]=c):c=t[8],(0,v.useLayoutEffect)(s,c);let l;t[9]===n?l=t[10]:(l=M(n),t[9]=n,t[10]=l);let u;t[11]===i.className?u=t[12]:(u=[`markdown-note`,i.className].filter(Boolean),t[11]=i.className,t[12]=u);let d=u.join(` `),f;return t[13]!==i||t[14]!==l||t[15]!==d?(f=(0,j.jsx)(`div`,{ref:o,children:(0,j.jsx)(a,{content:l,...i,className:d})}),t[13]=i,t[14]=l,t[15]=d,t[16]=f):f=t[16],f}async function F(e={}){let t=new URLSearchParams;e.status&&t.set(`status`,e.status),e.kind&&t.set(`kind`,e.kind),e.tag&&t.set(`tag`,e.tag),e.projectId&&t.set(`projectId`,e.projectId),e.pinned!==void 0&&t.set(`pinned`,String(e.pinned)),e.search&&t.set(`search`,e.search),e.limit&&t.set(`limit`,String(e.limit)),e.offset&&t.set(`offset`,String(e.offset)),e.sortBy&&t.set(`sortBy`,e.sortBy),e.sortOrder&&t.set(`sortOrder`,e.sortOrder);let n=t.toString();return u(l(`/api/notes${n?`?${n}`:``}`))}async function I(e,t=`web`){return(await u(l(`/api/notes/quick-capture`),{method:`POST`,body:JSON.stringify({text:e,channel:t})})).note}async function L(e){return(await u(l(`/api/notes`),{method:`POST`,body:JSON.stringify({markdown:e.markdown,title:e.title,kind:e.kind,tags:e.tags,projectId:e.projectId,pinned:e.pinned,channel:e.channel??`web`})})).note}async function R(e){let t=await c(l(`/api/notes/${encodeURIComponent(e)}`));if(t.status===404)return null;let n=await t.json();if(!t.ok)throw Error(n.error||`HTTP ${t.status}`);return n.note??null}async function z(e,t){return(await u(l(`/api/notes/${encodeURIComponent(e)}`),{method:`PATCH`,body:JSON.stringify(t)})).note}async function B(e){await u(l(`/api/notes/${encodeURIComponent(e)}`),{method:`DELETE`})}async function V(e){return u(l(`/api/notes/${encodeURIComponent(e)}/shares`))}async function H(e,t){return u(l(`/api/notes/${encodeURIComponent(e)}/shares`),{method:`POST`,body:JSON.stringify(t)})}async function U(e,t,n){await u(l(`/api/notes/${encodeURIComponent(e)}/shares/${encodeURIComponent(t)}/refresh`),{method:`POST`,body:JSON.stringify(n)})}async function W(e){return u(l(`/api/notes/${encodeURIComponent(e)}/catalyze`),{method:`POST`})}async function G(e,t){return(await u(l(`/api/notes/${encodeURIComponent(e)}/catalysis-feedback`),{method:`POST`,body:JSON.stringify({feedback:t})})).note}async function K(e,t={}){return u(l(`/api/notes/${encodeURIComponent(e)}/chat`),{method:`POST`,body:JSON.stringify(t.forceNew?{forceNew:!0}:{})})}async function q(e){return(await u(l(`/api/notes/${encodeURIComponent(e)}/threads`))).items}async function J(e){return u(l(`/api/notes/${encodeURIComponent(e)}/context-status`))}async function Y(e){return u(l(`/api/notes/${encodeURIComponent(e)}/context-rebuild`),{method:`POST`})}async function X(e,t,n){return(await u(l(`/api/notes/${encodeURIComponent(e)}/append`),{method:`POST`,body:JSON.stringify({content:t,heading:n})})).note}async function Z(e,t={}){return(await u(l(`/api/notes/task`),{method:`POST`,body:JSON.stringify({title:e,channel:`web`,priority:t.priority,sourceSessionKey:t.sourceSessionKey||void 0,sourceNoteId:t.sourceNoteId||void 0})})).note}async function Q(e,t){let n=new FormData;return n.append(`file`,t),(await A(l(`/api/notes/${encodeURIComponent(e)}/media`),n)).attachment}async function $(e,t){let n=new FormData;return n.append(`file`,e),t?.markdown&&n.append(`markdown`,t.markdown),n.append(`channel`,t?.channel??`web`),t?.kind&&n.append(`kind`,t.kind),t?.duration!==void 0&&n.append(`duration`,String(t.duration)),(await A(l(`/api/notes`),n)).note}async function te(e,t=`web`){let n=await $(e,{channel:t}),r=n.attachments?.find(e=>e.type===`image`)??n.attachments?.[0];if(!r)return n;let i=`})`;return n.markdown!==i&&(n=await z(n.id,{markdown:i})),n}async function ne(e,t,n=`web`){let r=await $(e,{channel:n,kind:`voice`,duration:t}),i=r.attachments?.find(e=>e.type===`audio`)??r.attachments?.[0];if(!i)return r;let a=`[${O(t)}](${D(r.id,i.id)})`;return r.markdown!==a&&(r=await z(r.id,{markdown:a,kind:`voice`})),r}async function re(e){return(await u(l(`/api/notes/${encodeURIComponent(e)}/history`))).entries}async function ie(e,t){return(await u(l(`/api/notes/${encodeURIComponent(e)}/history/${t}`))).snapshot}async function ae(e,t){return(await u(l(`/api/notes/${encodeURIComponent(e)}/history/restore`),{method:`POST`,body:JSON.stringify({timestamp:t})})).note}export{g as A,Q as C,T as D,D as E,E as O,z as S,ee as T,ne as _,Z as a,U as b,J as c,V as d,q as f,te as g,I as h,H as i,d as j,h as k,ie as l,K as m,W as n,B as o,F as p,L as r,R as s,X as t,re as u,Y as v,P as w,ae as x,G as y};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{d as n}from"./chunk-KS7C4IRE-BaASWQor.js";import{t as r}from"./notes-workbench-
|
|
1
|
+
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{d as n}from"./chunk-KS7C4IRE-BaASWQor.js";import{t as r}from"./notes-workbench-DmVYu_Oc.js";var i=e(),a=t();function o(){let e=(0,i.c)(2),{noteId:t}=n(),o;return e[0]===t?o=e[1]:(o=(0,a.jsx)(r,{selectedNoteId:t,basePath:`/notes`,managePageHeader:!0,showLibrary:!0,allowMediaCapture:!0,listWidthStorageKey:`xopc.notes.listWidth`}),e[0]=t,e[1]=o),o}export{o as NotesPage};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/block-editor-D8Ejp-QR.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-BNWhgmjs.js","assets/preload-helper-zJ_50EbN.js","assets/Combination-14nmIgxH.js","assets/vendor-react-BOUWij0V.js","assets/dist-CxGUk8J-.js","assets/dist-DaxPZj9e.js","assets/floating-ui.dom-B7uQOZZW.js","assets/markdown-view-DvM5PWEH.js","assets/dist-BPoKqzeH.js","assets/chunk-KS7C4IRE-BaASWQor.js","assets/createLucideIcon-DPHK1VkS.js","assets/download-Dk-ZjtO6.js","assets/plus-Q2yW6OE7.js","assets/x-B_N4OPjy.js","assets/locale-store-CXhjfe4q.js","assets/messages-BMdD0LWk.js","assets/cn-JdwAhgNB.js","assets/product-delivery-tRr-7IxY.js","assets/schemas-zIBW3wiV.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/markdown-view-CLzTdVLW.css","assets/dist-J_ySZvz0.js","assets/vendor-swr-BIWyz7Rc.js","assets/check-DUBLcKHA.js","assets/popover-select-CccGri5Y.js","assets/settings-shell-dialog-layer-BU3UuiJr.js","assets/circle-check-C23XjkUj.js","assets/copy-Dv6d4Dvw.js","assets/ellipsis-0k4rZLoy.js","assets/external-link-DjqjBmc3.js","assets/eye-off-DEAzt3g1.js","assets/eye-CABVeTq0.js","assets/file-code-corner-byQA1VfD.js","assets/globe-DSSGFWFn.js","assets/notes-api-BFsOGYkd.js","assets/loader-circle-CifKLtgG.js","assets/rotate-cw-LIg3Am9S.js","assets/search-DA7gz22f.js","assets/middleware-Pd0e8Igk.js","assets/tool-activity-R8V9l6nk.js","assets/button-CSEbl4zT.js","assets/registry-api-BFZrVYfy.js","assets/gateway-startup-retry-B_zrtccP.js","assets/config-reload-event-Bjh2zoKp.js","assets/gateway-config-swr-BWGjnmDl.js","assets/electron-env-DH5wF8X8.js","assets/form-field-width-DJw_jULe.js","assets/interaction-BmQogeqz.js","assets/is-masked-secret-DOkL5b_X.js","assets/activity-store-M0nAY5XB.js","assets/theme-store-DOdCjyuw.js","assets/index-D_hrEKXM.css","assets/vendor-codemirror-DRr7hFaD.js","assets/with-selector-aYPsXwdl.js","assets/block-editor-D4ZIVQbk.css","assets/markdown-editor-TWGaF7Xa.js","assets/code-editor-dFzqyDXS.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-zJ_50EbN.js";import{l as a}from"./chunk-KS7C4IRE-BaASWQor.js";import{t as o}from"./check-DUBLcKHA.js";import{n as s,r as c}from"./popover-select-CccGri5Y.js";import{t as l}from"./circle-check-C23XjkUj.js";import{t as u}from"./copy-Dv6d4Dvw.js";import{t as d}from"./external-link-DjqjBmc3.js";import{t as f}from"./eye-CABVeTq0.js";import{D as p,O as m,S as h,T as g,_,b as v,c as y,d as b,f as x,g as S,h as C,i as w,j as T,k as E,l as D,m as O,n as k,o as A,p as j,r as M,s as N,u as P,v as F,w as ee,x as I,y as te}from"./notes-api-BFsOGYkd.js";import{t as L}from"./loader-circle-CifKLtgG.js";import{t as ne}from"./plus-Q2yW6OE7.js";import{t as R}from"./search-DA7gz22f.js";import{t as z}from"./x-B_N4OPjy.js";import{t as B}from"./cn-JdwAhgNB.js";import{t as V}from"./button-CSEbl4zT.js";import{t as H}from"./messages-BMdD0LWk.js";import{l as re,n as U}from"./locale-store-CXhjfe4q.js";import{i as ie}from"./theme-store-DOdCjyuw.js";import{a as W,i as ae,n as oe,o as se,r as ce,s as le,t as ue}from"./dist-BPoKqzeH.js";import{i as de}from"./vendor-swr-BIWyz7Rc.js";import{$l as fe,$r as pe,$s as me,As as he,Ds as G,El as ge,Fs as _e,Hs as K,Ji as ve,Jn as q,Jr as ye,Kr as J,Os as Y,Rs as be,Tc as xe,Vc as Se,Vs as Ce,Xi as X,Xr as we,Ya as Te,Yr as Ee,Ys as De,Zc as Oe,Zr as ke,_o as Ae,ao as je,au as Me,c as Ne,d as Pe,du as Fe,ei as Ie,el as Le,fc as Re,fu as ze,gc as Be,gl as Ve,hu as He,kc as Ue,ks as We,l as Ge,lu as Ke,mc as qe,nc as Je,ni as Ye,no as Xe,pc as Ze,qr as Qe,s as $e,ti as et,u as tt,uc as nt,vc as rt,yl as it}from"./index-BNWhgmjs.js";var Z=n(),Q=e(t(),1),$=r(),at=(0,Q.createContext)(null);function ot(){let e=(0,Z.c)(1),t=(0,Q.useContext)(at);if(!t){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={openImage:st},e[0]=t):t=e[0],t}return t}function st(){}function ct(e){let t=(0,Z.c)(22),{children:n,closeLabel:r}=e,i=r===void 0?`Close`:r,[a,o]=(0,Q.useState)(null),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(e,t)=>{o({src:e,alt:t})},t[0]=s):s=t[0];let c=s,l;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(l={openImage:c},t[1]=l):l=t[1];let u=l,d=a!==null,f;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=e=>{e||o(null)},t[2]=f):f=t[2];let p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(W,{className:`fixed inset-0 z-[70] bg-scrim/90 backdrop-blur-sm`}),t[3]=p):p=t[3];let m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=B(`fixed inset-0 z-[71] flex items-center justify-center p-4 outline-none`,`data-[state=open]:animate-in data-[state=closed]:animate-out`),t[4]=m):m=t[4];let h=a?.alt||`Image preview`,g;t[5]===h?g=t[6]:(g=(0,$.jsx)(le,{className:`sr-only`,children:h}),t[5]=h,t[6]=g);let _;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(z,{className:`size-5`,"aria-hidden":!0}),t[7]=_):_=t[7];let v;t[8]===i?v=t[9]:(v=(0,$.jsx)(oe,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,"aria-label":i,className:`absolute right-4 top-4 z-10 rounded-lg bg-surface-panel/80 p-2 text-fg-muted backdrop-blur transition-colors hover:bg-surface-hover hover:text-fg`,children:_})}),t[8]=i,t[9]=v);let y;t[10]===a?y=t[11]:(y=a?(0,$.jsx)(`img`,{src:a.src,alt:a.alt??``,className:`max-h-[min(90vh,900px)] max-w-[min(95vw,1200px)] rounded-lg object-contain shadow-lg`}):null,t[10]=a,t[11]=y);let b;t[12]!==v||t[13]!==y||t[14]!==g?(b=(0,$.jsxs)(se,{children:[p,(0,$.jsxs)(ce,{className:m,"aria-describedby":void 0,children:[g,v,y]})]}),t[12]=v,t[13]=y,t[14]=g,t[15]=b):b=t[15];let x;t[16]!==b||t[17]!==d?(x=(0,$.jsx)(ue,{open:d,onOpenChange:f,children:b}),t[16]=b,t[17]=d,t[18]=x):x=t[18];let S;return t[19]!==n||t[20]!==x?(S=(0,$.jsxs)(at.Provider,{value:u,children:[n,x]}),t[19]=n,t[20]=x,t[21]=S):S=t[21],S}function lt(e){let t=(0,Z.c)(15),{noteId:n,attachmentId:r,className:i}=e,[a,o]=(0,Q.useState)(!1),s;t[0]!==r||t[1]!==n?(s=E(n,r),t[0]=r,t[1]=n,t[2]=s):s=t[2];let c=s;if(a){let e;t[3]===i?e=t[4]:(e=B(`flex size-12 shrink-0 items-center justify-center rounded-lg border border-edge-subtle bg-surface-hover text-fg-muted`,i),t[3]=i,t[4]=e);let n;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(T,{className:`size-4`}),t[5]=n):n=t[5];let r;return t[6]===e?r=t[7]:(r=(0,$.jsx)(`div`,{className:e,"aria-hidden":!0,children:n}),t[6]=e,t[7]=r),r}let l;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>o(!0),t[8]=l):l=t[8];let u;t[9]===i?u=t[10]:(u=B(`size-12 shrink-0 rounded-lg border border-edge-subtle bg-surface-hover object-cover`,i),t[9]=i,t[10]=u);let d;return t[11]!==n||t[12]!==c||t[13]!==u?(d=(0,$.jsx)(g,{src:c,expectedNoteId:n,alt:``,loading:`lazy`,draggable:!1,onLoadFailed:l,className:u}),t[11]=n,t[12]=c,t[13]=u,t[14]=d):d=t[14],d}var ut=6e4,dt=36e5,ft=864e5;function pt(e){let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}function mt(e,t,n){let r=t-e;if(r<ut)return n.justNow;if(r<dt){let e=Math.floor(r/ut);return n.minutesAgo.replace(`{{n}}`,String(e))}let i=pt(t);if(e>=i)return n.today+` `+new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`});if(e>=i-ft)return n.yesterday+` `+new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`});if(r<7*ft){let e=Math.floor(r/ft);return n.daysAgo.replace(`{{n}}`,String(e))}return new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function ht(e,t,n){let r=pt(t);if(e>=r)return n.today;if(e>=r-ft)return n.yesterday;let i=new Date(e),a=new Date(t);return i.getFullYear()===a.getFullYear()?i.toLocaleDateString(void 0,{month:`long`,day:`numeric`}):i.toLocaleDateString(void 0,{year:`numeric`,month:`long`,day:`numeric`})}function gt(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}function _t(e){if(!Number.isFinite(e)||e<0)return`0:00`;let t=Math.floor(e/60),n=Math.floor(e%60);return`${t}:${String(n).padStart(2,`0`)}`}function vt(e){let t=(0,Z.c)(38),{noteId:n,attachmentId:r,durationSec:i,className:a}=e,{playing:o,loading:s,currentTime:c,duration:l,noteId:u,attachmentId:d}=Ye(),f=Ye(bt),p=u===n&&d===r,m=p&&o,h=p&&s,g=p?c:0,_=p&&l>0?l:i??0,v=_>0?Math.min(g/_*100,100):0,y;t[0]!==r||t[1]!==i||t[2]!==n||t[3]!==f?(y=e=>{e.stopPropagation(),f(n,r,i)},t[0]=r,t[1]=i,t[2]=n,t[3]=f,t[4]=y):y=t[4];let b=y,x;t[5]!==r||t[6]!==i||t[7]!==n||t[8]!==f?(x=e=>{(e.key===`Enter`||e.key===` `)&&(e.stopPropagation(),e.preventDefault(),f(n,r,i))},t[5]=r,t[6]=i,t[7]=n,t[8]=f,t[9]=x):x=t[9];let S=x,C;t[10]===a?C=t[11]:(C=B(`flex items-center gap-2`,a),t[10]=a,t[11]=C);let w=m?`bg-accent text-white`:`bg-accent/10 text-accent hover:bg-accent/20`,T;t[12]===w?T=t[13]:(T=B(`flex size-7 shrink-0 items-center justify-center rounded-full transition-colors`,w),t[12]=w,t[13]=T);let E=m?`Pause`:`Play`,D;t[14]!==h||t[15]!==m?(D=h?(0,$.jsx)(L,{className:`size-3.5 animate-spin`}):m?(0,$.jsx)(Be,{className:`size-3.5`}):(0,$.jsx)(nt,{className:`size-3.5 ml-0.5`}),t[14]=h,t[15]=m,t[16]=D):D=t[16];let O;t[17]!==b||t[18]!==S||t[19]!==T||t[20]!==E||t[21]!==D?(O=(0,$.jsx)(`button`,{type:`button`,onClick:b,onKeyDown:S,className:T,"aria-label":E,children:D}),t[17]=b,t[18]=S,t[19]=T,t[20]=E,t[21]=D,t[22]=O):O=t[22];let k=`${v}%`,A;t[23]===k?A=t[24]:(A=(0,$.jsx)(`div`,{className:`h-1 w-full overflow-hidden rounded-full bg-accent/10`,children:(0,$.jsx)(`div`,{className:`h-full rounded-full bg-accent transition-[width] duration-200 ease-linear`,style:{width:k}})}),t[23]=k,t[24]=A);let j;t[25]!==_||t[26]!==p||t[27]!==g?(j=_t(p&&g>0?g:_),t[25]=_,t[26]=p,t[27]=g,t[28]=j):j=t[28];let M;t[29]===j?M=t[30]:(M=(0,$.jsx)(`span`,{className:`text-[10px] tabular-nums text-fg-muted`,children:j}),t[29]=j,t[30]=M);let N;t[31]!==A||t[32]!==M?(N=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[A,M]}),t[31]=A,t[32]=M,t[33]=N):N=t[33];let P;return t[34]!==N||t[35]!==C||t[36]!==O?(P=(0,$.jsxs)(`div`,{className:C,onClick:yt,children:[O,N]}),t[34]=N,t[35]=C,t[36]=O,t[37]=P):P=t[37],P}function yt(e){return e.stopPropagation()}function bt(e){return e.toggle}function xt(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function St(e){let t=(0,Z.c)(88),{note:n,selected:r,onPress:i,onPin:a,onArchive:o,onDelete:s,labels:c,timeLabels:l}=e,u=r===void 0?!1:r,d;t[0]!==c||t[1]!==n?(d=xt(n,c),t[0]=c,t[1]=n,t[2]=d):d=t[2];let f=d,p=!n.snippet?.trim(),[m]=(0,Q.useState)(Et),h;t[3]!==n.createdAt||t[4]!==m||t[5]!==l?(h=mt(n.createdAt,m,l),t[3]=n.createdAt,t[4]=m,t[5]=l,t[6]=h):h=t[6];let g=h,_,v;t[7]!==n.id||t[8]!==i?(_=()=>i(n.id),v=e=>{e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),i(n.id))},t[7]=n.id,t[8]=i,t[9]=_,t[10]=v):(_=t[9],v=t[10]);let y=u?`bg-surface-active hover:bg-surface-active`:`bg-transparent hover:bg-surface-panel/70`,b;t[11]===y?b=t[12]:(b=B(`group relative flex cursor-pointer flex-col gap-2 overflow-hidden rounded-lg px-3 py-2.5`,`transition-colors duration-150 ease-out`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-rail`,y),t[11]=y,t[12]=b);let x=u?`true`:void 0,S;t[13]===u?S=t[14]:(S=u?(0,$.jsx)(`span`,{className:`pointer-events-none absolute inset-y-2 left-0 w-0.5 rounded-r-pill bg-accent`,"aria-hidden":!0}):null,t[13]=u,t[14]=S);let C;t[15]!==n.coverAttachmentId||t[16]!==n.id||t[17]!==n.kind||t[18]!==n.voiceAttachmentId||t[19]!==n.voiceDurationSec?(C=n.coverAttachmentId?(0,$.jsx)(lt,{noteId:n.id,attachmentId:n.coverAttachmentId}):n.kind===`voice`&&n.voiceAttachmentId?(0,$.jsx)(vt,{noteId:n.id,attachmentId:n.voiceAttachmentId,durationSec:n.voiceDurationSec,className:`mt-0.5 w-28 shrink-0`}):null,t[15]=n.coverAttachmentId,t[16]=n.id,t[17]=n.kind,t[18]=n.voiceAttachmentId,t[19]=n.voiceDurationSec,t[20]=C):C=t[20];let w;t[21]===n.title?w=t[22]:(w=n.title&&(0,$.jsx)(`h3`,{className:`mb-0.5 truncate text-sm font-semibold text-fg`,children:n.title}),t[21]=n.title,t[22]=w);let T=n.title?`text-fg-muted`:p?`italic text-fg-muted`:`text-fg`,E;t[23]===T?E=t[24]:(E=B(`truncate text-sm leading-5`,T),t[23]=T,t[24]=E);let D;t[25]!==f||t[26]!==E?(D=(0,$.jsx)(`p`,{className:E,children:f}),t[25]=f,t[26]=E,t[27]=D):D=t[27];let O;t[28]!==w||t[29]!==D?(O=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[w,D]}),t[28]=w,t[29]=D,t[30]=O):O=t[30];let k;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,$.jsx)(it,{className:`size-4`}),t[31]=k):k=t[31];let A;t[32]===c.actions?A=t[33]:(A=(0,$.jsx)(ke,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,onClick:Tt,className:`shrink-0 rounded-md p-1 text-fg-muted opacity-100 transition-opacity hover:bg-surface-panel focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent lg:opacity-0 lg:group-hover:opacity-100 lg:focus-visible:opacity-100`,"aria-label":c.actions,title:c.actions,children:k})}),t[32]=c.actions,t[33]=A);let j;t[34]!==n.id||t[35]!==n.pinned||t[36]!==a?(j=()=>a(n.id,!n.pinned),t[34]=n.id,t[35]=n.pinned,t[36]=a,t[37]=j):j=t[37];let M;t[38]===n.pinned?M=t[39]:(M=n.pinned?(0,$.jsx)(Re,{className:`size-4`}):(0,$.jsx)(Ze,{className:`size-4`}),t[38]=n.pinned,t[39]=M);let N=n.pinned?c.unpin:c.pin,P;t[40]!==j||t[41]!==M||t[42]!==N?(P=(0,$.jsxs)(Qe,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:j,children:[M,N]}),t[40]=j,t[41]=M,t[42]=N,t[43]=P):P=t[43];let F;t[44]!==n.id||t[45]!==o?(F=()=>o(n.id),t[44]=n.id,t[45]=o,t[46]=F):F=t[46];let ee;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,$.jsx)(ze,{className:`size-4`}),t[47]=ee):ee=t[47];let I;t[48]!==c.archive||t[49]!==F?(I=(0,$.jsxs)(Qe,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:F,children:[ee,c.archive]}),t[48]=c.archive,t[49]=F,t[50]=I):I=t[50];let te;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,$.jsx)(we,{className:`my-1 h-px bg-edge-subtle`}),t[51]=te):te=t[51];let L;t[52]!==n.id||t[53]!==s?(L=()=>s(n.id),t[52]=n.id,t[53]=s,t[54]=L):L=t[54];let ne;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,$.jsx)(Y,{className:`size-4`}),t[55]=ne):ne=t[55];let R;t[56]!==c.delete||t[57]!==L?(R=(0,$.jsxs)(Qe,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-red-500 outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:L,children:[ne,c.delete]}),t[56]=c.delete,t[57]=L,t[58]=R):R=t[58];let z;t[59]!==P||t[60]!==I||t[61]!==R?(z=(0,$.jsx)(ye,{children:(0,$.jsxs)(J,{className:`z-50 min-w-[140px] rounded-xl border border-edge bg-surface-panel p-1 shadow-lg`,sideOffset:4,align:`end`,onClick:wt,children:[P,I,te,R]})}),t[59]=P,t[60]=I,t[61]=R,t[62]=z):z=t[62];let V;t[63]!==A||t[64]!==z?(V=(0,$.jsxs)(Ee,{children:[A,z]}),t[63]=A,t[64]=z,t[65]=V):V=t[65];let H;t[66]!==C||t[67]!==O||t[68]!==V?(H=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[C,O,V]}),t[66]=C,t[67]=O,t[68]=V,t[69]=H):H=t[69];let re;t[70]===n.pinned?re=t[71]:(re=n.pinned&&(0,$.jsx)(`span`,{className:`inline-flex items-center gap-1 rounded-md bg-accent/10 px-1.5 py-0.5 text-xs font-medium text-accent`,children:(0,$.jsx)(Ze,{className:`size-3`})}),t[70]=n.pinned,t[71]=re);let U;t[72]===n.tags?U=t[73]:(U=n.tags?.slice(0,2).map(Ct),t[72]=n.tags,t[73]=U);let ie;t[74]===g?ie=t[75]:(ie=(0,$.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:g}),t[74]=g,t[75]=ie);let W;t[76]!==re||t[77]!==U||t[78]!==ie?(W=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[re,U,ie]}),t[76]=re,t[77]=U,t[78]=ie,t[79]=W):W=t[79];let ae;return t[80]!==H||t[81]!==W||t[82]!==_||t[83]!==v||t[84]!==b||t[85]!==x||t[86]!==S?(ae=(0,$.jsxs)(`article`,{role:`button`,tabIndex:0,onClick:_,onKeyDown:v,className:b,"aria-current":x,children:[S,H,W]}),t[80]=H,t[81]=W,t[82]=_,t[83]=v,t[84]=b,t[85]=x,t[86]=S,t[87]=ae):ae=t[87],ae}function Ct(e){return(0,$.jsx)(`span`,{className:`max-w-24 truncate rounded-md bg-surface-hover px-1.5 py-0.5 text-xs text-fg-muted`,children:e},e)}function wt(e){return e.stopPropagation()}function Tt(e){return e.stopPropagation()}function Et(){return Date.now()}function Dt(e){let t=(0,Z.c)(45),{title:n,description:r,prompt:i,coverage:o,className:s,variant:c}=e,u=c===void 0?`card`:c,d=U(At),f=H(d).automations.suggestions,p=H(d).automations,m=a(),h;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(h={revalidateOnFocus:!1,refreshInterval:15e3},t[0]=h):h=t[0];let{data:g}=de(o?`automation-suggestion-coverage`:null,kt,h),_=o?g?.automations.find(e=>tt(e,o)):void 0,v=_?Ne(_,p):[];if(u===`titleAction`){if(_){let e;t[1]===s?e=t[2]:(e=B(`flex min-w-0 items-center gap-2 rounded-lg border border-emerald-500/25 bg-emerald-500/10 px-2.5 py-1.5`,s),t[1]=s,t[2]=e);let n;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(l,{className:`size-3.5 shrink-0 text-emerald-700 dark:text-emerald-300`,"aria-hidden":!0}),t[3]=n):n=t[3];let r;return t[4]===m?r=t[5]:(r=()=>m(`/automations`),t[4]=m,t[5]=r),(0,$.jsxs)(`section`,{className:e,children:[n,(0,$.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-fg`,children:f.coveredTitle}),(0,$.jsx)(V,{variant:`ghost`,className:`h-7 shrink-0 rounded-md px-2 text-xs`,onClick:r,children:f.manage})]})}let e;t[6]===s?e=t[7]:(e=B(`flex min-w-0 items-center gap-2 rounded-lg bg-surface-panel px-2.5 py-1.5 shadow-surface`,s),t[6]=s,t[7]=e);let a;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(Se,{className:`size-3.5 shrink-0 text-accent`,"aria-hidden":!0}),t[8]=a):a=t[8];let o;t[9]!==r||t[10]!==n?(o=(0,$.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-fg`,title:r,children:n}),t[9]=r,t[10]=n,t[11]=o):o=t[11];let c;t[12]!==m||t[13]!==i?(c=()=>{m(`/automations?${new URLSearchParams({draft:i,autogenerate:`1`}).toString()}`)},t[12]=m,t[13]=i,t[14]=c):c=t[14];let u;return t[15]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,$.jsx)(K,{className:`size-3.5`,"aria-hidden":!0}),t[15]=u):u=t[15],(0,$.jsxs)(`section`,{className:e,children:[a,o,(0,$.jsxs)(V,{variant:`secondary`,className:`h-7 shrink-0 rounded-md px-2 text-xs`,onClick:c,children:[u,f.setup]})]})}if(_){let e;t[16]===s?e=t[17]:(e=B(`rounded-lg border border-emerald-500/25 bg-emerald-500/10 p-3`,s),t[16]=s,t[17]=e);let n;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(l,{className:`mt-0.5 size-4 shrink-0 text-emerald-700 dark:text-emerald-300`,"aria-hidden":!0}),t[18]=n):n=t[18];let r;t[19]===m?r=t[20]:(r=()=>m(`/automations`),t[19]=m,t[20]=r);let i;return t[21]!==f||t[22]!==r?(i=(0,$.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,$.jsx)(V,{variant:`ghost`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:r,children:f.manage})}),t[21]=f,t[22]=r,t[23]=i):i=t[23],(0,$.jsxs)(`section`,{className:e,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[n,(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:f.coveredTitle}),(0,$.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:Ge(f.coveredDescription,{name:_.name})})]})]}),(0,$.jsxs)(`div`,{className:`mt-2 rounded-md bg-surface-base/55 px-2.5 py-2`,children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg`,children:p.explain.whyCovered}),(0,$.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:v.map(Ot)})]}),i]})}let y;t[24]===s?y=t[25]:(y=B(`rounded-lg bg-surface-panel p-3 shadow-surface`,s),t[24]=s,t[25]=y);let b;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(Se,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),t[26]=b):b=t[26];let x;t[27]===n?x=t[28]:(x=(0,$.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n}),t[27]=n,t[28]=x);let S;t[29]===r?S=t[30]:(S=(0,$.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:r}),t[29]=r,t[30]=S);let C;t[31]!==x||t[32]!==S?(C=(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[b,(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[x,S]})]}),t[31]=x,t[32]=S,t[33]=C):C=t[33];let w;t[34]!==m||t[35]!==i?(w=()=>{m(`/automations?${new URLSearchParams({draft:i,autogenerate:`1`}).toString()}`)},t[34]=m,t[35]=i,t[36]=w):w=t[36];let T;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,$.jsx)(K,{className:`size-3.5`,"aria-hidden":!0}),t[37]=T):T=t[37];let E;t[38]!==f.create||t[39]!==w?(E=(0,$.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,$.jsxs)(V,{variant:`secondary`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:w,children:[T,f.create]})}),t[38]=f.create,t[39]=w,t[40]=E):E=t[40];let D;return t[41]!==E||t[42]!==y||t[43]!==C?(D=(0,$.jsxs)(`section`,{className:y,children:[C,E]}),t[41]=E,t[42]=y,t[43]=C,t[44]=D):D=t[44],D}function Ot(e){return(0,$.jsx)(`span`,{className:`rounded-full bg-surface-panel px-2 py-0.5 text-xs text-fg-muted`,children:e},e)}function kt(){return Pe.list()}function At(e){return e.language}function jt(e){let t=(0,Z.c)(4),{values:n}=e;if(n.length===0)return null;let r;t[0]===n?r=t[1]:(r=n.map(Mt),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,$.jsx)(`ul`,{className:`list-disc space-y-1 pl-5`,children:r}),t[2]=r,t[3]=i),i}function Mt(e,t){return(0,$.jsx)(`li`,{children:e},`${t}:${e}`)}function Nt(e){let t=(0,Z.c)(10),{noteId:n,attachmentId:r,label:i,unavailableLabel:a}=e,[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(!1),u,d;if(t[0]!==r||t[1]!==n?(u=()=>{let e=!1,t=!1;return s(null),l(!1),p(n,r).then(i=>{if(e=!0,t){m(n,r);return}s(i)}).catch(()=>{t||l(!0)}),()=>{t=!0,e&&m(n,r)}},d=[r,n],t[0]=r,t[1]=n,t[2]=u,t[3]=d):(u=t[2],d=t[3]),(0,Q.useEffect)(u,d),c){let e;return t[4]===a?e=t[5]:(e=(0,$.jsx)(`p`,{className:`text-xs text-danger`,children:a}),t[4]=a,t[5]=e),e}if(!o){let e;return t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Xe,{className:`h-10 w-full max-w-md`}),t[6]=e):e=t[6],e}let f;return t[7]!==i||t[8]!==o?(f=(0,$.jsx)(`audio`,{controls:!0,preload:`metadata`,src:o,className:`w-full max-w-md`,"aria-label":i}),t[7]=i,t[8]=o,t[9]=f):f=t[9],f}function Pt(e){let t=(0,Z.c)(39),{noteId:n}=e,r=H(U(Lt)).notes.discussionCapture,i,a;t[0]===n?(i=t[1],a=t[2]):(i=[`note-discussion-document`,n],a=()=>q(n),t[0]=n,t[1]=i,t[2]=a);let o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o={revalidateOnFocus:!1},t[3]=o):o=t[3];let{data:s,mutate:c}=de(i,a,o),u,d;if(t[4]===c?(u=t[5],d=t[6]):(u=()=>{let e=e=>{let t=e.detail;t&&c(e=>{if(!e||e.discussion.id!==t.discussionId)return e;let n=e.transcript.segments.filter(e=>e.sequence!==t.segment.sequence).concat(t.segment).sort(It);return{...e,discussion:{...e.discussion,transcriptRevision:t.transcriptRevision},transcript:{...e.transcript,revision:t.transcriptRevision,segments:n,text:t.text,stats:t.stats}}},{revalidate:!1})},t=()=>void c();return window.addEventListener(`discussion-segment-updated`,e),window.addEventListener(`discussion-updated`,t),()=>{window.removeEventListener(`discussion-segment-updated`,e),window.removeEventListener(`discussion-updated`,t)}},d=[c],t[4]=c,t[5]=u,t[6]=d),(0,Q.useEffect)(u,d),!s)return null;let{discussion:f,transcript:p}=s,m=s.organization?.organization,h=[`stopping`,`sealing`,`organizing`].includes(f.status),g=p.stats.uploaded+p.stats.transcribing,_=p.stats.failed>0?r.failedSegments.replace(`{{count}}`,String(p.stats.failed)):g>0?r.processingSegments.replace(`{{count}}`,String(g)):h?r.finalizing:f.status===`completed`?r.transcriptReady:null,v;t[7]!==r.actionItems||t[8]!==r.decisions||t[9]!==r.openQuestions||t[10]!==r.organization||t[11]!==r.risks||t[12]!==m?(v=m?(0,$.jsxs)(`section`,{className:`border-b border-edge-subtle px-6 py-5`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-sm font-semibold text-accent-fg`,children:[(0,$.jsx)(K,{className:`size-4`,"aria-hidden":!0}),r.organization]}),(0,$.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:m.summary}),(0,$.jsxs)(`div`,{className:`mt-4 grid gap-4 text-sm leading-6 text-fg sm:grid-cols-2 xl:grid-cols-1`,children:[m.decisions.length>0?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`font-medium`,children:r.decisions}),(0,$.jsx)(jt,{values:m.decisions})]}):null,m.actionItems.length>0?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`font-medium`,children:r.actionItems}),(0,$.jsx)(jt,{values:m.actionItems.map(Ft)})]}):null,m.risks.length>0?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`font-medium`,children:r.risks}),(0,$.jsx)(jt,{values:m.risks})]}):null,m.openQuestions.length>0?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`font-medium`,children:r.openQuestions}),(0,$.jsx)(jt,{values:m.openQuestions})]}):null]})]}):null,t[7]=r.actionItems,t[8]=r.decisions,t[9]=r.openQuestions,t[10]=r.organization,t[11]=r.risks,t[12]=m,t[13]=v):v=t[13];let y;t[14]!==r.recordingAudio||t[15]!==r.recordingUnavailable||t[16]!==f.audioAttachmentId||t[17]!==n?(y=f.audioAttachmentId?(0,$.jsxs)(`section`,{className:`border-b border-edge-subtle px-6 py-4`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,$.jsx)(xe,{className:`size-4 text-accent`,"aria-hidden":!0}),r.recordingAudio]}),(0,$.jsx)(Nt,{noteId:n,attachmentId:f.audioAttachmentId,label:r.recordingAudio,unavailableLabel:r.recordingUnavailable})]}):null,t[14]=r.recordingAudio,t[15]=r.recordingUnavailable,t[16]=f.audioAttachmentId,t[17]=n,t[18]=y):y=t[18];let b;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(xe,{className:`size-4 text-accent`,"aria-hidden":!0}),t[19]=b):b=t[19];let x=f.status===`recording`?r.draftTranscript:r.fullTranscript,S;t[20]===x?S=t[21]:(S=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[b,x]}),t[20]=x,t[21]=S);let C;t[22]===f.status?C=t[23]:(C=f.status===`needs_attention`?(0,$.jsx)(G,{className:`size-3.5 text-danger`}):f.status===`completed`?(0,$.jsx)(l,{className:`size-3.5 text-success`}):null,t[22]=f.status,t[23]=C);let w=f.status===`needs_attention`?f.failureMessage:_,T;t[24]!==C||t[25]!==w?(T=(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-fg-muted`,children:[C,w]}),t[24]=C,t[25]=w,t[26]=T):T=t[26];let E;t[27]!==S||t[28]!==T?(E=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[S,T]}),t[27]=S,t[28]=T,t[29]=E):E=t[29];let D=p.text||r.waitingTranscript,O;t[30]===D?O=t[31]:(O=(0,$.jsx)(`div`,{className:`mt-3 max-h-48 overflow-y-auto whitespace-pre-wrap text-sm leading-6 text-fg-muted xl:max-h-none xl:overflow-visible`,children:D}),t[30]=D,t[31]=O);let k;t[32]!==E||t[33]!==O?(k=(0,$.jsxs)(`section`,{className:`px-6 py-4`,children:[E,O]}),t[32]=E,t[33]=O,t[34]=k):k=t[34];let A;return t[35]!==k||t[36]!==v||t[37]!==y?(A=(0,$.jsxs)(`aside`,{className:`max-h-[45%] shrink-0 overflow-y-auto border-b border-edge-subtle xl:h-full xl:max-h-none xl:w-[clamp(20rem,34%,27rem)] xl:border-r xl:border-b-0`,children:[v,y,k]}),t[35]=k,t[36]=v,t[37]=y,t[38]=A):A=t[38],A}function Ft(e){return e.title}function It(e,t){return e.sequence-t.sequence}function Lt(e){return e.language}var Rt={edit:qe,ai_edit:K,sync:Je,restore:Fe};function zt(e,t){return{edit:t.triggerEdit,ai_edit:t.triggerAiEdit,sync:t.triggerSync,restore:t.triggerRestore}[e]??e}function Bt({noteId:e,activeTimestamp:t,onSelect:n,onClose:r,onRestored:i}){let a=H(U(e=>e.language)).notes,o=a,{data:s}=de(e?[`note-history`,e]:null,()=>P(e)),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(null),[f,p]=(0,Q.useState)(null),m=(0,Q.useCallback)(async t=>{l(!0),p(null);try{await I(e,t),d(null),i()}catch{p(a.restoreFailed)}finally{l(!1)}},[e,a.restoreSuccess,a.restoreFailed,i]),h=Date.now();return(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,$.jsx)(Le,{className:`size-4`,"aria-hidden":!0}),a.history]}),(0,$.jsx)(`button`,{type:`button`,onClick:r,className:`rounded-lg p-1 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:(0,$.jsx)(z,{className:`size-4`,"aria-hidden":!0})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[f?(0,$.jsx)(`p`,{className:`border-b border-danger/20 bg-danger-soft px-4 py-2 text-xs text-danger`,role:`alert`,children:f}):null,s?.length?(0,$.jsx)(`ul`,{className:`divide-y divide-edge`,children:s.map(e=>{let r=Rt[e.trigger]??qe,i=t===e.timestamp,s=u===e.timestamp;return(0,$.jsxs)(`li`,{children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>n(e),className:B(`w-full px-4 py-3 text-left transition-colors`,i?`bg-accent/10`:`hover:bg-surface-hover`),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(r,{className:`size-3.5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:zt(e.trigger,a)}),(0,$.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:mt(e.timestamp,h,o)})]}),e.snippet&&(0,$.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted/60`,children:e.snippet})]}),i&&(0,$.jsx)(`div`,{className:`border-t border-edge/50 px-4 py-2`,children:s?(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-xs text-fg-muted`,children:a.restoreConfirm}),(0,$.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),m(e.timestamp)},disabled:c,className:`shrink-0 rounded-lg bg-accent px-3 py-1 text-xs font-medium text-on-accent transition-colors hover:bg-accent/90 disabled:opacity-50`,children:c?`...`:a.restore}),(0,$.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),d(null)},className:`shrink-0 rounded-lg px-2 py-1 text-xs text-fg-muted hover:bg-surface-hover`,children:`Cancel`})]}):(0,$.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),d(e.timestamp)},className:`rounded-lg bg-surface-hover px-3 py-1 text-xs font-medium text-fg transition-colors hover:bg-accent hover:text-on-accent`,children:a.restore})})]},e.timestamp)})}):(0,$.jsxs)(`div`,{className:`px-4 py-8 text-center`,children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg-muted`,children:a.historyEmpty}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted/60`,children:a.historyEmptyDescription})]})]})]})}function Vt(e){let t=(0,Z.c)(10),{noteId:n,note:r,catalyzing:i,onCatalyze:o,onClose:s,noteThreads:c,openingChat:l,onOpenChat:u,onOpenNewChat:d}=e,f=H(U(Jt)).notes,p=a(),m=r?.aiDeep?.catalysis,h=m?.report??null,g;t[0]===n?g=t[1]:(g=n?[`note-agent-context-status`,n]:null,t[0]=n,t[1]=g);let _;t[2]===n?_=t[3]:(_=()=>y(n),t[2]=n,t[3]=_);let v;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(v={revalidateOnFocus:!1},t[4]=v):v=t[4];let{data:b,mutate:x,isLoading:S}=de(g,_,v),C;t[5]===n?C=t[6]:(C=async e=>{try{await te(n,e)}catch{}},t[5]=n,t[6]=C);let w=C,T;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,$.jsx)(K,{className:`size-4 text-accent`,"aria-hidden":!0}),t[7]=T):T=t[7];let E;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,$.jsx)(Ke,{className:`size-4 rotate-180`,"aria-hidden":!0}),t[8]=E):E=t[8];let D;return t[9]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,$.jsx)(Ue,{className:`size-4 text-accent`,"aria-hidden":!0}),t[9]=D):D=t[9],(0,$.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between border-b border-edge-subtle px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[T,(0,$.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:f.catalysisSectionTitle})]}),(0,$.jsx)(`button`,{type:`button`,onClick:s,"aria-label":f.lightboxClose,className:`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:E})]}),(0,$.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-4`,children:[(0,$.jsx)(`p`,{className:`mb-4 text-xs leading-relaxed text-fg-muted`,children:f.catalysisSectionDescription}),b?(0,$.jsxs)(`section`,{className:`mb-4 rounded-xl bg-surface-base p-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:f.contextStatusTitle}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>void x(()=>F(n),{revalidate:!1}),disabled:S,className:`rounded-md px-1.5 py-0.5 text-[11px] font-medium text-accent transition-colors hover:bg-accent/10 disabled:cursor-not-allowed disabled:opacity-50`,children:f.contextRebuild}),(0,$.jsx)(`span`,{className:B(`rounded-full px-2 py-0.5 text-[11px] font-medium`,b.status===`ready`?`bg-emerald-500/10 text-emerald-600 dark:text-emerald-300`:b.status===`partial`?`bg-amber-500/10 text-amber-600 dark:text-amber-300`:`bg-red-500/10 text-red-600 dark:text-red-300`),children:b.status})]}),(0,$.jsx)(`div`,{className:`mt-2 text-xs leading-relaxed text-fg-muted`,children:f.contextStatusDetail.replace(`{{attachments}}`,String(b.attachments.length)).replace(`{{tokens}}`,String(b.tokenEstimate??0))}),b.attachments.length>0?(0,$.jsx)(`div`,{className:`mt-3 space-y-1.5`,children:b.attachments.slice(0,5).map(qt)}):null]}):null,(0,$.jsx)(`button`,{type:`button`,onClick:o,disabled:i,className:`w-full rounded-lg bg-accent px-2.5 py-1.5 text-xs font-medium text-white transition-colors hover:bg-accent/90 disabled:cursor-not-allowed disabled:opacity-50`,children:i?f.processing:h?f.recatalyze:f.catalyzeAction}),h?(0,$.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:f.valueHypothesis}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg`,children:h.valueHypothesis})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:f.targetUsers}),(0,$.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:h.targetUsers.slice(0,5).map(Kt)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:f.keyQuestions}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:h.keyQuestions.slice(0,3).map(Gt)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:f.mvpPathLabel}),(0,$.jsx)(`ol`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:h.mvpPath.slice(0,3).map(Wt)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:f.risks}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:h.risks.slice(0,3).map(Ut)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:f.nextActions}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:h.nextActions.slice(0,4).map(Ht)})]}),(0,$.jsxs)(`div`,{className:`flex items-center justify-between border-t border-edge-subtle pt-3`,children:[(0,$.jsx)(`span`,{className:`text-xs text-fg-muted`,children:f.confidenceLabel.replace(`{{percent}}`,String(Math.round(h.confidence*100)))}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>void w(`helpful`),className:B(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,m?.feedback===`helpful`&&`bg-accent/10 text-accent`),"aria-label":f.feedbackHelpfulAria,children:(0,$.jsx)(We,{className:`size-3.5`,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>void w(`not_helpful`),className:B(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,m?.feedback===`not_helpful`&&`bg-accent/10 text-accent`),"aria-label":f.feedbackNotHelpfulAria,children:(0,$.jsx)(he,{className:`size-3.5`,"aria-hidden":!0})})]})]})]}):(0,$.jsx)(`div`,{className:`mt-4 rounded-lg border border-dashed border-edge-subtle px-3 py-6 text-center text-sm text-fg-muted`,children:f.noCatalysisReportHint}),(0,$.jsxs)(`section`,{className:`mt-6 rounded-xl bg-surface-base p-4`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[D,f.relatedThreadsTitle]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:f.relatedThreadsDescription})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:u,disabled:l,className:`rounded-lg border border-edge px-2.5 py-1.5 text-xs font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg disabled:cursor-not-allowed disabled:opacity-50`,children:l?f.openingChat:f.openThread}),(0,$.jsx)(`button`,{type:`button`,onClick:d,disabled:l,className:`rounded-lg bg-accent px-2.5 py-1.5 text-xs font-medium text-white transition-colors hover:bg-accent/90 disabled:cursor-not-allowed disabled:opacity-50`,children:f.newThread})]})]}),c.length>0?(0,$.jsx)(`div`,{className:`space-y-2`,children:c.slice(0,5).map(e=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>p(`/chat/${encodeURIComponent(e.key)}`),className:`w-full rounded-lg border border-edge-subtle px-3 py-2 text-left transition-colors hover:bg-surface-hover`,children:[(0,$.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.name||f.noteDiscussionFallback}),(0,$.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-muted`,children:f.messageCount.replace(`{{count}}`,String(e.messageCount??0))})]},e.key))}):(0,$.jsx)(`div`,{className:`rounded-lg border border-dashed border-edge-subtle px-3 py-5 text-center text-sm text-fg-muted`,children:f.noThreads})]})]})]})}function Ht(e){return(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`rounded bg-accent/10 px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-accent`,children:e.kind}),(0,$.jsx)(`span`,{children:e.text})]},`${e.kind}:${e.text}`)}function Ut(e){return(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`mt-2 size-1 shrink-0 rounded-full bg-fg-muted`}),(0,$.jsx)(`span`,{children:e})]},e)}function Wt(e,t){return(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsxs)(`span`,{className:`text-fg-muted`,children:[t+1,`.`]}),(0,$.jsx)(`span`,{children:e})]},e)}function Gt(e){return(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`mt-2 size-1 shrink-0 rounded-full bg-accent`}),(0,$.jsx)(`span`,{children:e})]},e)}function Kt(e){return(0,$.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg`,children:e},e)}function qt(e){return(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2 rounded-lg bg-surface-hover px-2 py-1.5 text-xs`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:e.fileName}),(0,$.jsx)(`span`,{className:`shrink-0 text-fg-muted`,children:e.status})]},e.attachmentId)}function Jt(e){return e.language}var Yt=[{value:`86400000`,zh:`24 小时`,en:`24 hours`},{value:`604800000`,zh:`7 天`,en:`7 days`},{value:`2592000000`,zh:`30 天`,en:`30 days`}];function Xt({open:e,onOpenChange:t,note:n}){let r=U(e=>e.language)===`zh`,i=r?$t:en,{data:a,mutate:l}=de(e?[`note-shares`,n.id]:null,()=>b(n.id)),[f,p]=(0,Q.useState)(new Set),[m,h]=(0,Q.useState)(`86400000`),[g,_]=(0,Q.useState)(``),[y,x]=(0,Q.useState)(``),[S,C]=(0,Q.useState)(!1),[T,E]=(0,Q.useState)(null),[D,O]=(0,Q.useState)(null),[k,A]=(0,Q.useState)(!1),[j,M]=(0,Q.useState)(null),N=(0,Q.useMemo)(()=>{let e=new Set;return n.markdown.replace(/xopc-attachment:\/\/notes\/([^/]+)\/([^\s)]+)/gi,(t,r,i)=>{try{decodeURIComponent(r)===n.id&&e.add(decodeURIComponent(i))}catch{}return t}),(n.attachments??[]).filter(t=>e.has(t.id))},[n.attachments,n.id,n.markdown]);(0,Q.useEffect)(()=>{e&&(p(new Set(N.map(e=>e.id))),O(null),A(!1),M(null))},[e,N]);let P=async()=>{C(!0),M(null);try{O((await w(n.id,{expectedNoteVersion:n.updatedAt,attachmentIds:[...f],ttlMs:Number(m),maxViews:g.trim()?Number(g):null,description:y.trim()||void 0})).payload.shareUrl),await l()}catch(e){M(e instanceof Error?e.message:String(e))}finally{C(!1)}},F=async(e,t)=>{E(e.id),M(null);try{t===`refresh`?await v(n.id,e.id,{expectedNoteVersion:n.updatedAt,attachmentIds:[...f]}):t===`extend`?await ve(e.id,864e5):await X(e.id),await l()}catch(e){M(e instanceof Error?e.message:String(e))}finally{E(null)}},ee=async e=>{await navigator.clipboard.writeText(e),A(!0),window.setTimeout(()=>A(!1),1500)};return(0,$.jsx)(ue,{open:e,onOpenChange:t,children:(0,$.jsxs)(se,{children:[(0,$.jsx)(W,{className:`fixed inset-0 z-[70] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(ce,{className:`fixed left-1/2 top-1/2 z-[71] flex h-[min(42rem,calc(100dvh-2rem))] w-[min(40rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-popover outline-none`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between border-b border-edge px-5 py-4`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(le,{className:`flex items-center gap-2 text-base font-semibold text-fg`,children:[(0,$.jsx)(De,{className:`size-4`}),i.title]}),(0,$.jsx)(ae,{className:`mt-1 text-xs text-fg-muted`,children:i.description})]}),(0,$.jsx)(oe,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,className:`rounded-md p-1.5 text-fg-muted hover:bg-surface-hover`,"aria-label":i.close,children:(0,$.jsx)(z,{className:`size-4`})})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[(0,$.jsxs)(`section`,{className:`rounded-lg border border-edge-subtle bg-surface-subtle p-4`,children:[(0,$.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n.title||i.untitled}),(0,$.jsx)(`p`,{className:`mt-2 line-clamp-4 whitespace-pre-wrap text-xs leading-5 text-fg-muted`,children:n.markdown||i.empty}),(0,$.jsx)(`p`,{className:`mt-3 text-xs text-fg-subtle`,children:i.privateExcluded})]}),N.length>0?(0,$.jsxs)(`section`,{className:`mt-5`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:i.attachments}),(0,$.jsx)(`div`,{className:`mt-2 grid gap-2`,children:N.map(e=>(0,$.jsxs)(`label`,{className:`flex items-center gap-3 rounded-lg border border-edge-subtle px-3 py-2 text-sm text-fg-muted`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:f.has(e.id),onChange:()=>p(t=>{let n=new Set(t);return n.has(e.id)?n.delete(e.id):n.add(e.id),n}),className:`accent-accent`}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.fileName}),(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:Qt(e.size)})]},e.id))})]}):null,(0,$.jsxs)(`section`,{className:`mt-5 grid gap-4 sm:grid-cols-2`,children:[(0,$.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[i.expires,(0,$.jsx)(s,{value:m,onChange:e=>h(e.target.value),children:Yt.map(e=>(0,$.jsx)(c,{value:e.value,children:r?e.zh:e.en},e.value))})]}),(0,$.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[i.maxViews,(0,$.jsx)(`input`,{type:`number`,min:1,max:1e3,value:g,onChange:e=>_(e.target.value),placeholder:i.unlimited,className:`h-9 rounded-md border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-accent`})]}),(0,$.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted sm:col-span-2`,children:[i.publicDescription,(0,$.jsx)(`input`,{value:y,onChange:e=>x(e.target.value),className:`h-9 rounded-md border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-accent`})]})]}),D?(0,$.jsx)(`div`,{className:`mt-5 rounded-lg border border-success/25 bg-success-soft p-3`,children:(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsx)(`input`,{readOnly:!0,value:D,className:`min-w-0 flex-1 bg-transparent text-xs text-fg outline-none`}),(0,$.jsxs)(V,{type:`button`,className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>void ee(D),children:[k?(0,$.jsx)(o,{className:`size-4`}):(0,$.jsx)(u,{className:`size-4`}),k?i.copied:i.copy]}),(0,$.jsxs)(V,{type:`button`,className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>window.open(D,`_blank`,`noopener,noreferrer`),children:[(0,$.jsx)(d,{className:`size-4`}),i.open]})]})}):null,j?(0,$.jsx)(`p`,{className:`mt-4 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-sm text-danger`,children:j}):null,(a?.items.length??0)>0?(0,$.jsxs)(`section`,{className:`mt-6 border-t border-edge pt-5`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:i.activeLinks}),(0,$.jsx)(`div`,{className:`mt-2 grid gap-2`,children:a.items.map(e=>(0,$.jsx)(Zt,{share:e,busy:T===e.id,t:i,onCopy:ee,onAction:F},e.id))})]}):null]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end gap-2 border-t border-edge px-5 py-3`,children:[(0,$.jsx)(oe,{asChild:!0,children:(0,$.jsx)(V,{type:`button`,variant:`ghost`,children:i.close})}),(0,$.jsxs)(V,{type:`button`,onClick:()=>void P(),disabled:S,children:[S?(0,$.jsx)(L,{className:`size-4 animate-spin`}):(0,$.jsx)(De,{className:`size-4`}),S?i.creating:i.create]})]})]})]})})}function Zt(e){let t=(0,Z.c)(68),{share:n,busy:r,t:i,onCopy:a,onAction:o}=e,s=n.revoked||n.expired,c=s&&`opacity-60`,l;t[0]===c?l=t[1]:(l=B(`rounded-lg border border-edge-subtle p-3`,c),t[0]=c,t[1]=l);let f=n.stale&&!s?i.stale:s?i.inactive:i.active,p;t[2]===f?p=t[3]:(p=(0,$.jsx)(`span`,{children:f}),t[2]=f,t[3]=p);let m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(`span`,{children:`·`}),t[4]=m):m=t[4];let h=n.maxViews===null?``:` / ${n.maxViews}`,g;t[5]!==n.viewCount||t[6]!==i.views||t[7]!==h?(g=(0,$.jsxs)(`span`,{children:[i.views,` `,n.viewCount,h]}),t[5]=n.viewCount,t[6]=i.views,t[7]=h,t[8]=g):g=t[8];let _;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(`span`,{children:`·`}),t[9]=_):_=t[9];let v;t[10]===n.expiresAt?v=t[11]:(v=new Date(n.expiresAt).toLocaleDateString(),t[10]=n.expiresAt,t[11]=v);let y;t[12]===v?y=t[13]:(y=(0,$.jsx)(`span`,{children:v}),t[12]=v,t[13]=y);let b;t[14]!==y||t[15]!==p||t[16]!==g?(b=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[p,m,g,_,y]}),t[14]=y,t[15]=p,t[16]=g,t[17]=b):b=t[17];let x;t[18]===n.shareUrl?x=t[19]:(x=(0,$.jsx)(`div`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:n.shareUrl}),t[18]=n.shareUrl,t[19]=x);let S;t[20]!==b||t[21]!==x?(S=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[b,x]}),t[20]=b,t[21]=x,t[22]=S):S=t[22];let C;t[23]===r?C=t[24]:(C=r?(0,$.jsx)(L,{className:`size-4 animate-spin text-fg-muted`}):null,t[23]=r,t[24]=C);let w;t[25]!==S||t[26]!==C?(w=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[S,C]}),t[25]=S,t[26]=C,t[27]=w):w=t[27];let T;t[28]!==a||t[29]!==n.shareUrl?(T=()=>void a(n.shareUrl),t[28]=a,t[29]=n.shareUrl,t[30]=T):T=t[30];let E;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,$.jsx)(u,{className:`size-3.5`}),t[31]=E):E=t[31];let D;t[32]!==i.copy||t[33]!==T?(D=(0,$.jsxs)(V,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:T,children:[E,i.copy]}),t[32]=i.copy,t[33]=T,t[34]=D):D=t[34];let O;t[35]===n.shareUrl?O=t[36]:(O=()=>window.open(n.shareUrl,`_blank`,`noopener,noreferrer`),t[35]=n.shareUrl,t[36]=O);let k;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,$.jsx)(d,{className:`size-3.5`}),t[37]=k):k=t[37];let A;t[38]!==i.open||t[39]!==O?(A=(0,$.jsxs)(V,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:O,children:[k,i.open]}),t[38]=i.open,t[39]=O,t[40]=A):A=t[40];let j;t[41]!==r||t[42]!==s||t[43]!==o||t[44]!==n||t[45]!==i.refresh?(j=n.stale&&!s?(0,$.jsxs)(V,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`refresh`),children:[(0,$.jsx)(Je,{className:`size-3.5`}),i.refresh]}):null,t[41]=r,t[42]=s,t[43]=o,t[44]=n,t[45]=i.refresh,t[46]=j):j=t[46];let M;t[47]!==r||t[48]!==s||t[49]!==o||t[50]!==n||t[51]!==i.extend?(M=s?null:(0,$.jsx)(V,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`extend`),children:i.extend}),t[47]=r,t[48]=s,t[49]=o,t[50]=n,t[51]=i.extend,t[52]=M):M=t[52];let N;t[53]!==r||t[54]!==o||t[55]!==n||t[56]!==i.revoke?(N=n.revoked?null:(0,$.jsxs)(V,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`revoke`),children:[(0,$.jsx)(Y,{className:`size-3.5`}),i.revoke]}),t[53]=r,t[54]=o,t[55]=n,t[56]=i.revoke,t[57]=N):N=t[57];let P;t[58]!==D||t[59]!==A||t[60]!==j||t[61]!==M||t[62]!==N?(P=(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:[D,A,j,M,N]}),t[58]=D,t[59]=A,t[60]=j,t[61]=M,t[62]=N,t[63]=P):P=t[63];let F;return t[64]!==w||t[65]!==l||t[66]!==P?(F=(0,$.jsxs)(`div`,{className:l,children:[w,P]}),t[64]=w,t[65]=l,t[66]=P,t[67]=F):F=t[67],F}function Qt(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}var $t={title:`分享笔记`,description:`创建一个无需登录即可查看的只读快照。`,close:`关闭`,untitled:`无标题笔记`,empty:`空笔记`,privateExcluded:`不会分享标签、AI 元数据、项目、讨论、历史版本或未引用附件。`,attachments:`包含的附件`,expires:`有效期`,maxViews:`最多查看次数`,unlimited:`不限`,publicDescription:`公开说明(可选)`,create:`创建分享链接`,creating:`创建中…`,copy:`复制`,copied:`已复制`,open:`打开`,activeLinks:`这条笔记的分享`,stale:`旧版本`,inactive:`已失效`,active:`有效`,views:`查看`,refresh:`更新快照`,extend:`延长 24 小时`,revoke:`撤销`},en={title:`Share Note`,description:`Create a read-only snapshot that opens without sign-in.`,close:`Close`,untitled:`Untitled Note`,empty:`Empty Note`,privateExcluded:`Tags, AI metadata, projects, discussions, history, and unreferenced attachments are excluded.`,attachments:`Included attachments`,expires:`Expires`,maxViews:`Maximum views`,unlimited:`Unlimited`,publicDescription:`Public description (optional)`,create:`Create share link`,creating:`Creating…`,copy:`Copy`,copied:`Copied`,open:`Open`,activeLinks:`Shares for this Note`,stale:`Older version`,inactive:`Inactive`,active:`Active`,views:`Views`,refresh:`Update snapshot`,extend:`Extend 24 hours`,revoke:`Revoke`},tn=()=>i(()=>import(`./block-editor-D8Ejp-QR.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56])),nn=()=>i(()=>import(`./markdown-editor-TWGaF7Xa.js`).then(e=>e.n),__vite__mapDeps([57,1,3,54,5,58])),rn=(0,Q.lazy)(()=>tn().then(e=>({default:e.BlockEditor}))),an=(0,Q.lazy)(()=>nn().then(e=>({default:e.MarkdownEditor})));function on(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col px-6 py-4`,"aria-busy":!0,children:[(0,$.jsx)(`div`,{className:`h-8 w-56 max-w-full animate-pulse rounded-md bg-surface-hover`}),(0,$.jsx)(`div`,{className:`mt-6 h-4 w-11/12 animate-pulse rounded bg-surface-hover`}),(0,$.jsx)(`div`,{className:`mt-3 h-4 w-9/12 animate-pulse rounded bg-surface-hover`}),(0,$.jsx)(`div`,{className:`mt-3 h-4 w-10/12 animate-pulse rounded bg-surface-hover`})]}),e[0]=t):t=e[0],t}function sn(e){let t=(0,Z.c)(14),{mode:n,onModeChange:r,labels:i}=e,a;t[0]===i.edit?a=t[1]:(a={id:`wysiwyg`,label:i.edit,Icon:Ve},t[0]=i.edit,t[1]=a);let o;t[2]===i.source?o=t[3]:(o={id:`source`,label:i.source,Icon:ge},t[2]=i.source,t[3]=o);let s;t[4]===i.preview?s=t[5]:(s={id:`preview`,label:i.preview,Icon:f},t[4]=i.preview,t[5]=s);let c;t[6]!==a||t[7]!==o||t[8]!==s?(c=[a,o,s],t[6]=a,t[7]=o,t[8]=s,t[9]=c):c=t[9];let l=c,u;return t[10]!==n||t[11]!==l||t[12]!==r?(u=(0,$.jsx)(`div`,{className:`flex items-center gap-0.5 rounded-lg border border-edge p-0.5`,children:l.map(e=>{let{id:t,label:i,Icon:a}=e;return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>r(t),onMouseEnter:()=>{t===`wysiwyg`&&tn(),t===`source`&&nn()},onFocus:()=>{t===`wysiwyg`&&tn(),t===`source`&&nn()},className:B(`inline-flex items-center gap-1 rounded-lg px-2 py-1 text-xs font-medium transition-colors`,n===t?`bg-surface-hover text-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:[(0,$.jsx)(a,{className:`size-3.5`,"aria-hidden":!0}),i]},t)})}),t[10]=n,t[11]=l,t[12]=r,t[13]=u):u=t[13],u}function cn(e){let t=(0,Z.c)(15),{noteId:n,onBack:r,onSaved:i,showBackButton:a,backButtonClassName:o,clearHeaderOnCleanup:s,onOpenSearch:c,autoFocus:l,onAutoFocusConsumed:u}=e,d=a===void 0?!0:a,f=s===void 0?!0:s,p=l===void 0?!1:l,m=U(ln),h;t[0]===m?h=t[1]:(h=H(m),t[0]=m,t[1]=h);let g=h.notes.lightboxClose,_;t[2]!==p||t[3]!==o||t[4]!==f||t[5]!==n||t[6]!==u||t[7]!==r||t[8]!==c||t[9]!==i||t[10]!==d?(_=(0,$.jsx)(un,{noteId:n,onBack:r,onSaved:i,showBackButton:d,backButtonClassName:o,clearHeaderOnCleanup:f,onOpenSearch:c,autoFocus:p,onAutoFocusConsumed:u}),t[2]=p,t[3]=o,t[4]=f,t[5]=n,t[6]=u,t[7]=r,t[8]=c,t[9]=i,t[10]=d,t[11]=_):_=t[11];let v;return t[12]!==g||t[13]!==_?(v=(0,$.jsx)(ct,{closeLabel:g,children:_}),t[12]=g,t[13]=_,t[14]=v):v=t[14],v}function ln(e){return e.language}function un({noteId:e,onBack:t,onSaved:n,showBackButton:r=!0,backButtonClassName:i,clearHeaderOnCleanup:o=!0,onOpenSearch:s,autoFocus:c=!1,onAutoFocusConsumed:l}){let u=U(e=>e.language),d=H(u).notes,f=H(u).automations.suggestions,p=a(),m=ie(e=>e.resolved)===`dark`,{openImage:g}=ot(),[_,v]=(0,Q.useState)(`wysiwyg`),[y,b]=(0,Q.useState)(null),[S,C]=(0,Q.useState)(null),[w,T]=(0,Q.useState)(!1),[E,A]=(0,Q.useState)(``),[j,M]=(0,Q.useState)(360),[P,F]=(0,Q.useState)(!1),[I,te]=(0,Q.useState)(!1),[L,ne]=(0,Q.useState)(!1),[z,V]=(0,Q.useState)(null),[re,W]=(0,Q.useState)(!1),[ae,oe]=(0,Q.useState)(null),se=(0,Q.useRef)(!1),ce=(0,Q.useRef)(!1),le=(0,Q.useRef)(null),ue=(0,Q.useRef)(null),fe=(0,Q.useRef)(null),me=(0,Q.useRef)(null),he=(0,Q.useRef)(null),G=(0,Q.useRef)(null),ge=(0,Q.useRef)(null),_e=(0,Q.useRef)(null),ve=(0,Q.useRef)(null),q=Ae(e=>e.setPageHeader),ye=Ae(e=>e.clearPageHeader),{data:J,mutate:Y}=de(e?[`note-detail`,e]:null,()=>N(e)),{data:be=[],mutate:xe}=de(e?[`note-threads`,e]:null,()=>x(e),{revalidateOnFocus:!1}),Se=S!==null;(0,Q.useEffect)(()=>{if(!e)return;let t=t=>{t.detail?.noteId===e&&Y()};return window.addEventListener(`note-updated`,t),()=>window.removeEventListener(`note-updated`,t)},[Y,e]),(0,Q.useEffect)(()=>{se.current=!1,A(``),C(null),b(null),ce.current=!1,ve.current=null},[e]),(0,Q.useEffect)(()=>{!J||se.current||(A(J.title??``),se.current=!0)},[J]),(0,Q.useEffect)(()=>{if(!c||!J||Se||ve.current===e)return;let t=window.requestAnimationFrame(()=>{_e.current?.focus(),l?.()});return ve.current=e,()=>window.cancelAnimationFrame(t)},[c,Se,J,e,l]);let Ce=J?new Date(J.createdAt).toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}):``,X=(0,Q.useMemo)(()=>r?(0,$.jsx)(`button`,{type:`button`,onClick:t,"aria-label":d.back,className:B(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,He,i),children:(0,$.jsx)(Ke,{className:`size-4`,"aria-hidden":!0})}):null,[i,d.back,t,r]),we=(0,Q.useCallback)(t=>{A(t),e&&(me.current=t,ue.current&&clearTimeout(ue.current),ue.current=setTimeout(async()=>{let t=me.current;if(me.current=null,t!==null){T(!0);try{await h(e,{title:t}),await Y(),n?.()}catch{}finally{T(!1)}}},600))},[e,Y,n]),Te=(0,Q.useMemo)(()=>(0,$.jsxs)(`div`,{className:B(`flex min-w-0 items-center gap-2`,He),children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,title:E||Ce||void 0,children:E||Ce}),w?(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted opacity-60`,children:d.saving}):null]}),[d.saving,w,Ce,E]),Ee=(0,Q.useCallback)(async(t=!1)=>{ne(!0),V(null);try{let n=await O(e,{forceNew:t});await Y(),await xe(),p(`/chat/${encodeURIComponent(n.sessionKey)}`)}catch(e){V(`${d.chatOpenFailedTitle}: ${e instanceof Error?e.message:d.chatOpenFailedMessage}`)}finally{ne(!1)}},[Y,xe,p,e,d.chatOpenFailedMessage,d.chatOpenFailedTitle]),Oe=(0,Q.useCallback)(async()=>{te(!0),V(null);try{await k(e),await Y()}catch(e){V(`${d.catalysisFailed}: ${e instanceof Error?e.message:d.chatOpenFailedMessage}`)}finally{te(!1)}},[Y,e]),ke=(0,Q.useCallback)(()=>{b(y===`breakdown`?null:`breakdown`),!J?.aiDeep?.catalysis?.report&&!I&&Oe()},[y,I,Oe,J?.aiDeep?.catalysis?.report]),je=(0,Q.useCallback)(()=>{let t=S?.markdown??fe.current??J?.markdown??``,n=S?.title??E,r=Ie([n,t].filter(Boolean).join(`
|
|
3
|
+
|
|
4
|
+
`));return{source:{type:`note`,id:e,title:n||d.titlePlaceholder},text:r,language:et(r,u)}},[u,d.titlePlaceholder,J?.markdown,e,S,E]),Me=(0,Q.useCallback)(async()=>{le.current&&clearTimeout(le.current),ue.current&&clearTimeout(ue.current),le.current=null,ue.current=null;let t=fe.current,r=me.current;fe.current=null,me.current=null;let i={};if(t!==null&&(i.markdown=t),r!==null&&(i.title=r),Object.keys(i).length===0)return J??null;T(!0);try{let t=await h(e,i);return await Y(t,{revalidate:!1}),n?.(),t}catch(e){return V(`${d.saveFailed}: ${e instanceof Error?e.message:d.saveFailedHint}`),null}finally{T(!1)}},[Y,d.saveFailed,d.saveFailedHint,J,e,n]),Ne=(0,Q.useCallback)(async()=>{V(null);let e=await Me();e&&(oe(e),W(!0))},[Me]),Pe=(0,Q.useMemo)(()=>(0,$.jsxs)(`div`,{className:B(`flex items-center gap-2`,He),children:[s?(0,$.jsx)(`button`,{type:`button`,onClick:s,"aria-label":d.searchDialogTitle,className:`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:(0,$.jsx)(R,{className:`size-4`,"aria-hidden":!0})}):null,(0,$.jsx)(pe,{input:je,labels:{read:d.readAloud,preparing:d.readAloudPreparing,pause:d.readAloudPause,resume:d.readAloudResume,retry:d.readAloudRetry},showLabel:!0}),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>void Ne(),className:`inline-flex items-center gap-1.5 rounded-lg border border-edge px-2.5 py-1.5 text-xs font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:[(0,$.jsx)(De,{className:`size-3.5`,"aria-hidden":!0}),u===`zh`?`分享`:`Share`]}),(0,$.jsxs)(`button`,{type:`button`,onClick:ke,disabled:I,"aria-label":d.catalysisSectionTitle,className:B(`inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-xs font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50`,y===`breakdown`?`bg-accent/10 text-accent`:`bg-accent/10 text-fg hover:bg-accent/15`),children:[(0,$.jsx)(K,{className:`size-3.5`,"aria-hidden":!0}),I?d.catalyzing:d.catalyzeButton]}),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>Ee(!1),disabled:L,className:B(`inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-xs font-medium transition-colors`,`border border-edge text-fg-muted hover:bg-surface-hover hover:text-fg disabled:cursor-not-allowed disabled:opacity-50`),children:[(0,$.jsx)(Ue,{className:`size-3.5`,"aria-hidden":!0}),L?d.openingChat:d.openChatButton]}),(0,$.jsx)(sn,{mode:_,onModeChange:v,labels:{edit:d.modeEdit,source:d.modeSource,preview:d.modePreview}}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>b(y===`history`?null:`history`),"aria-label":d.history,className:B(`rounded-lg p-1.5 transition-colors`,y===`history`?`bg-accent/10 text-accent`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:(0,$.jsx)(Le,{className:`size-4`,"aria-hidden":!0})})]}),[I,ke,Ee,_,d.history,d.modeEdit,d.modePreview,d.modeSource,L,y,s,d.searchDialogTitle,d.readAloud,d.readAloudPause,d.readAloudPreparing,d.readAloudResume,d.readAloudRetry,je,Ne,u]);(0,Q.useLayoutEffect)(()=>(q({startExtra:X,main:J?Te:null,end:J?Pe:null}),()=>{o&&ye()}),[o,ye,Pe,Te,X,J,q]);let Fe=(0,Q.useCallback)(t=>{e&&(fe.current=t,le.current&&clearTimeout(le.current),le.current=setTimeout(async()=>{let t=fe.current;if(fe.current=null,t!==null){T(!0),V(null);try{await h(e,{markdown:t}),await Y(),n?.()}catch(e){V(`${d.saveFailed}: ${e instanceof Error?e.message:d.saveFailedHint}`)}finally{T(!1)}}},600))},[e,Y,d.saveFailed,d.saveFailedHint,n]),Re=(0,Q.useCallback)(t=>{D(e,t.timestamp).then(e=>{e&&C(e)})},[e]),ze=(0,Q.useCallback)(()=>{b(null),C(null)},[]),Be=(0,Q.useCallback)(()=>{b(null),C(null),Y(),n?.()},[Y,n]);if((0,Q.useEffect)(()=>()=>{le.current&&clearTimeout(le.current),ue.current&&clearTimeout(ue.current);let t=fe.current,n=me.current;fe.current=null,me.current=null;let r={};t!==null&&(r.markdown=t),n!==null&&(r.title=n),Object.keys(r).length>0&&h(e,r)},[e]),J===void 0)return(0,$.jsx)(`div`,{className:`flex flex-1 items-center justify-center`,children:(0,$.jsx)(`div`,{className:`size-6 animate-spin rounded-full border-2 border-accent border-t-transparent`})});if(J===null)return(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 text-center`,children:[(0,$.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:d.notFoundTitle}),(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:d.notFoundDescription}),(0,$.jsx)(`button`,{type:`button`,onClick:t,className:`rounded-lg border border-edge px-3 py-1.5 text-sm font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:d.back})]});let Ve=Se?S.title??``:E,We=Se?S.markdown??``:J.markdown??``,Ge=new Date(J.createdAt).getTime(),qe=Number.isFinite(Ge)&&Date.now()-Ge<3600*1e3?(0,$.jsx)(Dt,{title:f.noteCreatedTitle,description:f.noteCreatedDescription,prompt:f.noteCreatedPrompt,coverage:{eventType:`note.created`,source:`notes`,eventPayload:{noteId:e}},variant:`titleAction`,className:`ml-3 hidden max-w-[18rem] shrink-0 md:flex`}):null;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 gap-3 p-4 sm:px-5`,children:[(0,$.jsxs)(`div`,{className:`mx-auto flex min-h-0 min-w-0 w-full max-w-[60rem] flex-1 flex-col`,children:[z?(0,$.jsx)(`p`,{className:`mb-3 shrink-0 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-sm text-danger`,role:`alert`,children:z}):null,(0,$.jsx)($e,{eventType:`note.created`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),(0,$.jsx)($e,{eventType:`note.updated`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),(0,$.jsxs)(`div`,{ref:he,className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel xl:flex-row`,children:[(0,$.jsx)(Pt,{noteId:e}),(0,$.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1`,children:Se?(0,$.jsxs)(`div`,{className:`h-full overflow-y-auto px-6 py-4`,children:[Ve&&(0,$.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg/70`,children:Ve}),We?(0,$.jsx)(ee,{noteId:e,content:We,className:`opacity-80`}):(0,$.jsx)(`p`,{className:`italic text-fg-muted`,children:d.emptyPreview})]}):(0,$.jsxs)($.Fragment,{children:[_===`wysiwyg`&&(0,$.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start px-6 pt-4`,children:[(0,$.jsx)(`input`,{ref:_e,type:`text`,value:E,onChange:e=>we(e.target.value),onCompositionStart:()=>{ce.current=!0},onCompositionEnd:()=>{ce.current=!1},onKeyDown:e=>{let t=e.nativeEvent;e.key===`Enter`&&!ce.current&&!t.isComposing&&(e.preventDefault(),(he.current?.querySelector(`.ProseMirror`))?.focus())},placeholder:d.titlePlaceholder,className:`min-w-0 flex-1 border-none bg-transparent text-2xl font-bold text-fg placeholder:text-fg-muted/40 focus:outline-none`}),qe]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(on,{}),children:(0,$.jsx)(rn,{initialContent:J.markdown??``,onChange:Fe,noteId:e},`wysiwyg-${e}`)})})]}),_===`source`&&(0,$.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start px-6 pt-4`,children:[(0,$.jsx)(`input`,{ref:_e,type:`text`,value:E,onChange:e=>we(e.target.value),placeholder:d.titlePlaceholder,className:`min-w-0 flex-1 border-none bg-transparent text-2xl font-bold text-fg placeholder:text-fg-muted/40 focus:outline-none`}),qe]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(on,{}),children:(0,$.jsx)(an,{initialContent:J.markdown??``,onChange:Fe,isDark:m},`source-${e}`)})})]}),_===`preview`&&(0,$.jsxs)(`div`,{className:`h-full overflow-y-auto px-6 py-4`,onClick:e=>{let t=e.target;t instanceof HTMLImageElement&&g(t.currentSrc||t.src,t.alt)},children:[E&&(0,$.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg`,children:E}),J.markdown?(0,$.jsx)(ee,{noteId:e,content:J.markdown,className:`[&_img]:cursor-zoom-in`}):(0,$.jsx)(`p`,{className:`italic text-fg-muted`,children:d.emptyPreview})]})]})})]})]}),(0,$.jsx)(`div`,{ref:G,className:B(`relative flex min-h-0 shrink-0 flex-col overflow-hidden`,!P&&`transition-[width] duration-300 ease-in-out`),style:{width:y?j:0},children:(0,$.jsxs)(`div`,{ref:ge,className:`flex min-h-0 flex-1 flex-col`,style:{width:j},children:[(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,onPointerDown:e=>{e.preventDefault();let t=e.currentTarget;t.setPointerCapture(e.pointerId),F(!0);let n=e.clientX,r=j,i=e.pointerId,a=0,o=j,s=j,c=()=>{a=0,s=o,y&&G.current?.style.setProperty(`width`,`${s}px`),ge.current?.style.setProperty(`width`,`${s}px`)},l=e=>{let t=r-(e.clientX-n);o=Math.max(280,Math.min(600,Math.round(t))),a===0&&(a=window.requestAnimationFrame(c))},u=()=>{a!==0&&(window.cancelAnimationFrame(a),c());try{t.releasePointerCapture(i)}catch{}F(!1),M(s),window.removeEventListener(`pointermove`,l),window.removeEventListener(`pointerup`,u),window.removeEventListener(`pointercancel`,u)};window.addEventListener(`pointermove`,l),window.addEventListener(`pointerup`,u),window.addEventListener(`pointercancel`,u)},className:B(`absolute left-0 top-0 z-10 h-full w-2 -translate-x-1/2 cursor-col-resize`,`before:content-[''] before:pointer-events-none before:absolute before:left-1/2 before:top-0 before:h-full before:w-px before:-translate-x-1/2`,`before:bg-transparent before:transition-[background-color] before:duration-150`,`hover:before:bg-edge/65 dark:hover:before:bg-edge/75`,P&&`before:!bg-edge/80 dark:before:!bg-edge/85`,`touch-none select-none`)}),(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel`,children:y===`history`?(0,$.jsx)(Bt,{noteId:e,activeTimestamp:S?.timestamp??null,onSelect:Re,onClose:ze,onRestored:Be}):y===`breakdown`?(0,$.jsx)(Vt,{noteId:e,note:J??null,catalyzing:I,onCatalyze:Oe,onClose:()=>b(null),noteThreads:be,openingChat:L,onOpenChat:()=>Ee(!1),onOpenNewChat:()=>Ee(!0)}):null})]})})]}),ae?(0,$.jsx)(Xt,{open:re,onOpenChange:W,note:ae}):null]})}var dn=3e4;function fn(){if(!(typeof MediaRecorder>`u`))return[`audio/webm;codecs=opus`,`audio/webm`,`audio/mp4`,`audio/ogg;codecs=opus`].find(e=>MediaRecorder.isTypeSupported(e))}function pn({placeholder:e,submitLabel:t,actionsLabel:n,imageLabel:r,voiceLabel:i,stopRecordingLabel:a,onCapture:o,onImagePick:s,onVoiceCapture:c,onVoiceError:l,recordingLabel:u,imageDisabled:d=!1,voiceDisabled:f=!1,onDiscussionCapture:p,discussionCaptureLabel:m}){let[h,g]=(0,Q.useState)(``),[_,v]=(0,Q.useState)(!1),[y,b]=(0,Q.useState)(!1),[x,S]=(0,Q.useState)(0),[C,w]=(0,Q.useState)(!1),T=(0,Q.useRef)(null),E=(0,Q.useRef)(null),D=(0,Q.useRef)(null),O=(0,Q.useRef)([]),k=(0,Q.useRef)(0),A=(0,Q.useRef)(null),j=(0,Q.useRef)(null),M=(0,Q.useCallback)(()=>{A.current&&=(clearInterval(A.current),null),j.current&&=(clearTimeout(j.current),null),D.current?.getTracks().forEach(e=>e.stop()),D.current=null,E.current=null,O.current=[],b(!1),S(0)},[]);(0,Q.useEffect)(()=>()=>M(),[M]);let N=(0,Q.useCallback)(async()=>{let e=E.current;if(!e||e.state!==`recording`)return;w(!0),await new Promise(t=>{e.addEventListener(`stop`,()=>t(),{once:!0}),e.stop()});let t=Math.max(1,Math.round((Date.now()-k.current)/1e3)),n=e.mimeType||fn()||`audio/webm`,r=new Blob(O.current,{type:n});if(M(),r.size>0&&c){let e=n.includes(`mp4`)?`m4a`:n.includes(`ogg`)?`ogg`:`webm`,i=new File([r],`voice-${Date.now()}.${e}`,{type:n});try{await c(i,t)}finally{w(!1)}return}w(!1)},[M,c]),P=(0,Q.useCallback)(async()=>{if(!(!c||C||y)){if(!navigator.mediaDevices?.getUserMedia||typeof MediaRecorder>`u`){l?.();return}try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});D.current=e;let t=fn(),n=t?new MediaRecorder(e,{mimeType:t}):new MediaRecorder(e);E.current=n,O.current=[],k.current=Date.now(),n.ondataavailable=e=>{e.data.size>0&&O.current.push(e.data)},n.start(),b(!0),S(0),A.current=setInterval(()=>{S(Math.round((Date.now()-k.current)/1e3))},250),j.current=setTimeout(()=>{N()},dn)}catch{M(),l?.()}}},[M,c,l,y,N,C]),F=(0,Q.useCallback)(async()=>{let e=h.trim();if(!(!e||_)){v(!0),g(``);try{await o(e)}catch{g(e)}finally{v(!1),T.current?.focus()}}},[h,_,o]),ee=(0,Q.useCallback)(e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),F())},[F]),I=_||C,te=!!(s||c||p);return(0,$.jsxs)(`div`,{className:B(`flex items-center gap-1.5 rounded-2xl border border-edge bg-surface-panel p-2 shadow-float dark:shadow-elevated`,`focus-within:border-accent focus-within:ring-1 focus-within:ring-accent`,y&&`border-danger ring-1 ring-danger/40`),"aria-busy":I,children:[y?(0,$.jsx)(`button`,{type:`button`,onClick:()=>void N(),disabled:C,className:`shrink-0 rounded-lg bg-danger-soft p-2 text-danger transition-colors hover:bg-danger-soft disabled:cursor-not-allowed disabled:opacity-50`,"aria-label":a,title:a,"aria-pressed":`true`,children:(0,$.jsx)(be,{className:`size-4 fill-current`,"aria-hidden":!0})}):te?(0,$.jsxs)(Ee,{children:[(0,$.jsx)(ke,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,disabled:I,className:`shrink-0 rounded-lg p-2 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-not-allowed disabled:opacity-50`,"aria-label":n,title:n,children:(0,$.jsx)(ne,{className:`size-4`,"aria-hidden":!0})})}),(0,$.jsx)(ye,{children:(0,$.jsxs)(J,{side:`top`,align:`start`,sideOffset:8,className:`z-50 min-w-44 rounded-xl border border-edge bg-surface-panel p-1 shadow-popover`,children:[s?(0,$.jsxs)(Qe,{disabled:d,onSelect:s,className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50`,children:[(0,$.jsx)(Oe,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),r]}):null,c?(0,$.jsxs)(Qe,{disabled:f,onSelect:()=>void P(),className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50`,children:[(0,$.jsx)(xe,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),i]}):null,p?(0,$.jsxs)(Qe,{onSelect:p,className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,children:[(0,$.jsx)(Me,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),m]}):null]})})]}):null,y?(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate py-1.5 text-sm text-danger`,children:u.replace(`{{seconds}}`,String(x))}):(0,$.jsx)(`textarea`,{ref:T,value:h,onChange:e=>g(e.target.value),onKeyDown:ee,placeholder:e,"aria-label":e,rows:1,disabled:I,className:`max-h-28 min-h-8 flex-1 resize-none overflow-y-auto bg-transparent py-1.5 text-sm leading-5 text-fg placeholder:text-fg-muted focus:outline-none disabled:opacity-60`,style:{fieldSizing:`content`}}),(0,$.jsx)(`button`,{type:`button`,disabled:!h.trim()||I||y,onClick:()=>void F(),"aria-label":t,title:t,className:B(`shrink-0 rounded-lg p-2 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,h.trim()&&!I&&!y?`bg-accent text-white hover:bg-accent-hover`:`text-fg-disabled`),children:(0,$.jsx)(me,{className:`size-4`,"aria-hidden":!0})})]})}var mn={statusFilter:`all`,kindFilter:`all`,pinnedOnly:!1},hn=240,gn=320,_n=520,vn=560;function yn(e){if(globalThis.localStorage===void 0)return gn;try{let t=globalThis.localStorage.getItem(e);if(!t)return gn;let n=Number(t);return Number.isFinite(n)?n:gn}catch{return gn}}function bn(e,t){if(globalThis.localStorage!==void 0)try{globalThis.localStorage.setItem(e,String(Math.round(t)))}catch{}}var xn={thought:_e,todo:Ce,voice:xe,media:Oe,bookmark:fe,mixed:_e,task:Ce};function Sn(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function Cn(e,t){return e.statusFilter===t.patch.statusFilter&&e.kindFilter===t.patch.kindFilter&&e.pinnedOnly===t.patch.pinnedOnly}function wn(e,t){return`${e.replace(/\/$/,``)}/${encodeURIComponent(t)}`}function Tn({selectedNoteId:e,basePath:t,managePageHeader:n=!1,showLibrary:r=!0,allowMediaCapture:i=!0,projectId:o,listTitle:l,listDescription:u,emptyText:d,emptyDescription:f,listWidthStorageKey:p=`xopc.notes.listWidth`}){let m=H(U(e=>e.language)).notes,g=!!re(e=>e.token),[v,y]=(0,Q.useReducer)(Te,mn),[b,x]=(0,Q.useState)(!1),[w,T]=(0,Q.useState)(``),[E,D]=(0,Q.useState)(0),[O,k]=(0,Q.useState)(()=>yn(p)),[N,P]=(0,Q.useState)(!1),[F,ee]=(0,Q.useState)(!1),[I,te]=(0,Q.useState)(!1),[L,V]=(0,Q.useState)(null),[ie,fe]=(0,Q.useState)(null),pe=(0,Q.useRef)(null),me=(0,Q.useRef)(null),[he]=(0,Q.useState)(()=>Date.now()),G=a(),ge=(0,Q.useCallback)(e=>{let t=pe.current?.clientWidth??window.innerWidth,n=Math.max(hn,t-vn);return Math.max(hn,Math.min(Math.min(_n,n),e))},[]),K=(0,Q.useCallback)(e=>{let t=ge(e);k(t),bn(p,t)},[ge,p]);(0,Q.useLayoutEffect)(()=>{k(e=>ge(e))},[ge]);let{data:ve,mutate:q,isLoading:ye}=de((0,Q.useMemo)(()=>g?[`notes-list`,o,v.statusFilter,v.kindFilter,v.pinnedOnly]:null,[g,o,v.statusFilter,v.kindFilter,v.pinnedOnly]),()=>j({status:v.statusFilter===`all`?void 0:v.statusFilter,kind:v.kindFilter===`all`?void 0:v.kindFilter,projectId:o,pinned:v.pinnedOnly?!0:void 0,limit:100,sortBy:`createdAt`,sortOrder:`desc`}),{keepPreviousData:!0}),J=ye&&!ve,Y=ve?.items??[],be=ve?.total??0,xe=w.trim(),{data:Se,isLoading:Ce}=de(g&&b&&xe?[`notes-search`,o,xe]:null,()=>j({search:xe,projectId:o,limit:30,sortBy:`updatedAt`,sortOrder:`desc`})),X=Se?.items??[],we=e?Y.some(t=>t.id===e):!0;(0,Q.useEffect)(()=>{D(0)},[xe]),(0,Q.useEffect)(()=>{E>=X.length&&D(Math.max(0,X.length-1))},[E,X.length]),(0,Q.useEffect)(()=>{let e=()=>{q()};return window.addEventListener(`note-updated`,e),()=>window.removeEventListener(`note-updated`,e)},[q]);let Ee=Ae(e=>e.setPageHeader),De=Ae(e=>e.clearPageHeader),Oe=m.noteCount.replace(`{{count}}`,String(be)),ke=!r&&be===0&&u?u:Oe,Me=m.searchDialogTitle,Ne=m.searchClose,Pe=m.searchClear,Fe=(0,Q.useMemo)(()=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>x(!0),className:B(`inline-flex h-9 items-center gap-2 rounded-lg border border-edge bg-surface-base px-3 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,He),"aria-label":Me,children:[(0,$.jsx)(R,{className:`size-4`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:Me})]}),[Me]);(0,Q.useLayoutEffect)(()=>{if(n)return g?(Ee({startExtra:null,main:(0,$.jsxs)(`div`,{className:B(`flex min-w-0 items-center gap-2`,He),children:[(0,$.jsx)(`h1`,{className:`min-w-0 truncate text-base font-semibold tracking-tight text-fg`,children:l??m.title}),Oe?(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:Oe}):null]}),end:Fe}),()=>De()):(De(),()=>De())},[De,g,Fe,l,n,m.title,Oe,e,Ee]);let Ie=(0,Q.useMemo)(()=>({justNow:m.justNow,minutesAgo:m.minutesAgo,today:m.today,yesterday:m.yesterday,daysAgo:m.daysAgo}),[m.justNow,m.minutesAgo,m.today,m.yesterday,m.daysAgo]),Le=(0,Q.useMemo)(()=>[{id:`recent`,label:m.viewRecent,patch:{statusFilter:`all`,kindFilter:`all`,pinnedOnly:!1}},{id:`inbox`,label:m.filterInbox,patch:{statusFilter:`inbox`,kindFilter:`all`,pinnedOnly:!1}},{id:`pinned`,label:m.pinned,patch:{statusFilter:`all`,kindFilter:`all`,pinnedOnly:!0}},{id:`tasks`,label:m.viewTasks,patch:{statusFilter:`all`,kindFilter:`todo`,pinnedOnly:!1}},{id:`voice`,label:m.kindVoice,patch:{statusFilter:`all`,kindFilter:`voice`,pinnedOnly:!1}},{id:`media`,label:m.kindMedia,patch:{statusFilter:`all`,kindFilter:`media`,pinnedOnly:!1}},{id:`bookmarks`,label:m.kindBookmark,patch:{statusFilter:`all`,kindFilter:`bookmark`,pinnedOnly:!1}},{id:`processed`,label:m.filterProcessed,patch:{statusFilter:`processed`,kindFilter:`all`,pinnedOnly:!1}},{id:`archive`,label:m.filterArchived,patch:{statusFilter:`archived`,kindFilter:`all`,pinnedOnly:!1}}],[m.filterArchived,m.filterInbox,m.filterProcessed,m.kindBookmark,m.kindMedia,m.kindVoice,m.pinned,m.viewRecent,m.viewTasks]),Re=Le.find(e=>Cn(v,e))??Le[0],ze=l??Re.label,Be=(0,Q.useCallback)(async e=>{V(null);try{let n=o?await M({markdown:e,kind:`thought`,projectId:o,channel:`web`}):await C(e,`web`);await q(),G(wn(t,n.id))}catch(e){throw V(`${m.quickCaptureFailed}: ${e instanceof Error?e.message:m.quickCaptureFailedHint}`),e}},[t,q,m.quickCaptureFailed,m.quickCaptureFailedHint,G,o]),Ve=(0,Q.useCallback)(async()=>{if(!I){te(!0),V(null);try{let e=await M({markdown:``,kind:`thought`,projectId:o,channel:`web`});y({type:`patch`,patch:mn}),await q(),fe(e.id),G(wn(t,e.id))}catch(e){V(`${m.createBlankFailed}: ${e instanceof Error?e.message:m.createBlankFailedHint}`)}finally{te(!1)}}},[t,I,q,m.createBlankFailed,m.createBlankFailedHint,G,o]),Ue=(0,Q.useCallback)(()=>{let e=document.createElement(`input`);e.type=`file`,e.accept=`image/*`,e.onchange=async()=>{let t=e.files?.[0];if(t)try{V(null),await S(t,`web`),await q()}catch(e){V(`${m.imageUploadFailed}: ${e instanceof Error?e.message:m.imageUploadFailedHint}`)}},e.click()},[q,m.imageUploadFailed,m.imageUploadFailedHint]),We=(0,Q.useCallback)(async(e,t)=>{try{V(null),await _(e,t,`web`),await q()}catch(e){V(`${m.voiceUploadFailed}: ${e instanceof Error?e.message:m.voiceUploadFailedHint}`)}},[q,m.voiceUploadFailed,m.voiceUploadFailedHint]),Ge=(0,Q.useCallback)(()=>{V(`${m.voiceCaptureFailed}: ${m.voiceCaptureFailedHint}`)},[m.voiceCaptureFailed,m.voiceCaptureFailedHint]),Ke=(0,Q.useCallback)(async(e,t)=>{await h(e,{pinned:t}),await q()},[q]),qe=(0,Q.useCallback)(async e=>{await h(e,{status:`archived`}),await q()},[q]),Je=(0,Q.useCallback)(async e=>{await A(e),await q()},[q]),Ye=(0,Q.useCallback)(e=>{G(wn(t,e))},[t,G]),Xe=(0,Q.useCallback)(e=>{G(wn(t,e)),x(!1)},[t,G]),Ze=(0,Q.useCallback)(e=>{if(X.length){if(e.key===`ArrowDown`)e.preventDefault(),D(e=>Math.min(X.length-1,e+1));else if(e.key===`ArrowUp`)e.preventDefault(),D(e=>Math.max(0,e-1));else if(e.key===`Enter`){e.preventDefault();let t=X[E]??X[0];t&&Xe(t.id)}}},[E,Xe,X]),Qe=(0,Q.useCallback)(e=>{e.preventDefault();let t=e.currentTarget,n=me.current;t.setPointerCapture(e.pointerId),P(!0);let r=pe.current?.clientWidth??window.innerWidth,i=Math.max(hn,r-vn),a=Math.min(_n,i),o=e=>Math.max(hn,Math.min(a,e)),s=e.clientX,c=o(O),l=e.pointerId,u=0,d=c,f=c;n&&(n.style.transition=`none`,n.style.width=`${c}px`);let m=()=>{u=0,f=d,n&&(n.style.width=`${f}px`)},h=e=>{d=o(c+e.clientX-s),u===0&&(u=window.requestAnimationFrame(m))},g=()=>{u!==0&&(window.cancelAnimationFrame(u),m());try{t.releasePointerCapture(l)}catch{}P(!1),pe.current?.style.setProperty(`--notes-list-width`,`${f}px`),n&&(n.style.removeProperty(`transition`),n.style.removeProperty(`width`)),k(f),bn(p,f),window.removeEventListener(`pointermove`,h),window.removeEventListener(`pointerup`,g),window.removeEventListener(`pointercancel`,g)};window.addEventListener(`pointermove`,h),window.addEventListener(`pointerup`,g),window.addEventListener(`pointercancel`,g)},[p,O]);(0,Q.useEffect)(()=>{let e=e=>{e.defaultPrevented||e.repeat||e.key.toLowerCase()!==`n`||!e.metaKey&&!e.ctrlKey||e.altKey||e.shiftKey||(e.preventDefault(),Ve())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[Ve]);let $e=(0,Q.useCallback)(e=>{e.key===`ArrowLeft`?(e.preventDefault(),K(O-16)):e.key===`ArrowRight`?(e.preventDefault(),K(O+16)):e.key===`Home`?(e.preventDefault(),K(hn)):e.key===`End`&&(e.preventDefault(),K(_n))},[K,O]);return g?(0,$.jsxs)(`div`,{ref:pe,className:`flex h-full min-h-0 w-full flex-1 overflow-hidden bg-surface-base`,style:{"--notes-list-width":`${O}px`},children:[(0,$.jsxs)(`section`,{ref:me,className:B(`relative flex min-h-0 w-full shrink-0 flex-col overflow-hidden border-r border-edge bg-surface-rail`,!N&&`lg:transition-[width] lg:duration-[280ms] lg:ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:lg:transition-none`,F?`lg:w-0 lg:min-w-0 lg:max-w-0 lg:pointer-events-none`:`lg:w-[var(--notes-list-width)]`,e&&`hidden lg:flex`),"aria-hidden":F?!0:void 0,children:[(0,$.jsxs)(`div`,{className:`shrink-0 border-b border-edge-subtle p-3`,children:[L?(0,$.jsx)(`p`,{className:`mb-3 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-xs text-danger`,role:`alert`,children:L}):null,(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[r?(0,$.jsx)(s,{value:Re.id,onChange:e=>{let t=Le.find(t=>t.id===e.target.value);t&&y({type:`patch`,patch:t.patch})},className:`-ml-1 h-7 w-full max-w-44 rounded-lg border border-transparent bg-transparent px-2 text-sm font-semibold text-fg transition-colors hover:border-edge hover:bg-surface-base focus:border-accent focus:bg-surface-base focus:outline-none focus:ring-1 focus:ring-accent`,"aria-label":m.libraryTitle,children:Le.map(e=>(0,$.jsx)(c,{value:e.id,children:e.label},e.id))}):(0,$.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:ze}),(0,$.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:ke})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>ee(!0),className:`hidden size-8 items-center justify-center rounded-lg text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent lg:inline-flex`,"aria-label":m.collapseNotesList,title:m.collapseNotesList,children:(0,$.jsx)(rt,{className:`size-4`,strokeWidth:1.5,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:Ve,disabled:I,className:`inline-flex size-8 items-center justify-center rounded-lg text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-not-allowed disabled:opacity-50`,"aria-label":m.createBlankNote,title:m.createBlankShortcut,children:(0,$.jsx)(ne,{className:`size-4`,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>x(!0),className:`inline-flex size-8 items-center justify-center rounded-lg text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":m.searchDialogTitle,title:m.searchDialogTitle,children:(0,$.jsx)(R,{className:`size-4`,"aria-hidden":!0})})]})]})]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-2 py-3 [scrollbar-gutter:stable]`,children:J?(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:[1,2,3,4].map(e=>(0,$.jsx)(`div`,{className:`h-20 animate-pulse rounded-lg bg-surface-hover`},e))}):Y.length===0?(0,$.jsxs)(`div`,{className:`flex h-full min-h-48 flex-col items-center justify-center gap-2 px-6 py-10 text-center`,children:[(0,$.jsx)(`span`,{className:`mb-1 inline-flex size-12 items-center justify-center rounded-xl border border-edge-subtle bg-surface-base text-fg-muted`,children:(0,$.jsx)(_e,{className:`size-6`,"aria-hidden":!0})}),(0,$.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:e&&!we?m.noteOutsideCurrentView:d??m.noNotes}),e&&!we?null:(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:f??m.noNotesDescription})]}):(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e&&!we?(0,$.jsx)(`div`,{className:`mb-2 rounded-lg border border-edge-subtle bg-surface-base px-3 py-2 text-xs leading-5 text-fg-muted`,children:m.noteOutsideCurrentView}):null,Y.map((t,n)=>{let r=n>0?gt(Y[n-1].createdAt):null;return(0,$.jsxs)(`div`,{children:[gt(t.createdAt)!==r&&(0,$.jsx)(`div`,{className:B(`px-3 pb-1.5 pt-2 text-xs font-medium text-fg-muted`,n===0&&`pt-0`),children:ht(t.createdAt,he,Ie)}),(0,$.jsx)(St,{note:t,selected:t.id===e,onPress:Ye,onPin:Ke,onArchive:qe,onDelete:Je,timeLabels:Ie,labels:{pin:m.pin,unpin:m.unpin,archive:m.archive,delete:m.delete,actions:m.noteActions,imageNote:m.imageNote,noText:m.noText}})]},t.id)})]})}),(0,$.jsx)(`div`,{className:`shrink-0 border-t border-edge-subtle p-3`,children:(0,$.jsx)(pn,{placeholder:m.quickCapturePlaceholder,submitLabel:m.quickCaptureSubmit,actionsLabel:m.quickCaptureActions,imageLabel:m.quickCaptureImage,voiceLabel:m.quickCaptureVoice,stopRecordingLabel:m.stopRecording,onCapture:Be,onImagePick:i?Ue:void 0,onVoiceCapture:i?We:void 0,onVoiceError:Ge,recordingLabel:m.recording,discussionCaptureLabel:m.discussionCapture.title,onDiscussionCapture:()=>je(o)})})]}),(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":m.resizeNotesList,"aria-valuemin":hn,"aria-valuemax":_n,"aria-valuenow":Math.round(O),tabIndex:0,onPointerDown:Qe,onDoubleClick:()=>K(gn),onKeyDown:$e,title:m.resizeNotesList,className:B(`group relative z-10 hidden shrink-0 cursor-col-resize touch-none select-none items-center justify-center bg-surface-base lg:flex`,`lg:transition-[width,opacity] lg:duration-[280ms] lg:ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:lg:transition-none`,F?`lg:w-0 lg:opacity-0 lg:pointer-events-none`:`lg:w-2 lg:opacity-100`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-0`),children:(0,$.jsx)(`span`,{"aria-hidden":!0,className:B(`h-full w-px bg-edge transition-[background-color,transform] duration-150`,`group-hover:bg-accent/70 group-focus-visible:bg-accent`,N&&`bg-accent scale-x-[2]`)})}),(0,$.jsxs)(`section`,{className:B(`relative min-w-0 flex-1 bg-surface-base`,!e&&`hidden lg:flex`),children:[F?(0,$.jsx)(`button`,{type:`button`,onClick:()=>ee(!1),className:`absolute left-3 top-3 z-10 hidden size-8 items-center justify-center rounded-lg border border-edge bg-surface-base text-fg-muted shadow-surface transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent lg:inline-flex`,"aria-label":m.expandNotesList,title:m.expandNotesList,children:(0,$.jsx)(rt,{className:`size-4`,strokeWidth:1.5,"aria-hidden":!0})}):null,e?(0,$.jsx)(cn,{noteId:e,onBack:()=>G(t),onSaved:()=>void q(),backButtonClassName:`lg:hidden`,clearHeaderOnCleanup:!1,onOpenSearch:()=>x(!0),autoFocus:e===ie,onAutoFocusConsumed:()=>fe(null)}):(0,$.jsx)(`div`,{className:`flex h-full min-h-0 flex-1 items-center justify-center px-8 text-center`,children:(0,$.jsxs)(`div`,{className:`max-w-sm`,children:[(0,$.jsx)(_e,{className:`mx-auto size-9 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`h2`,{className:`mt-4 text-base font-semibold text-fg`,children:m.emptyEditorTitle}),(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:m.emptyEditorDescription}),(0,$.jsxs)(`button`,{type:`button`,onClick:Ve,disabled:I,className:`mt-5 inline-flex items-center gap-2 rounded-lg bg-accent px-3 py-2 text-sm font-medium text-white transition-colors hover:bg-accent-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-not-allowed disabled:opacity-50`,children:[(0,$.jsx)(ne,{className:`size-4`,"aria-hidden":!0}),I?m.creatingBlankNote:m.createBlankNote]})]})})]}),(0,$.jsx)(ue,{open:b,onOpenChange:x,children:(0,$.jsxs)(se,{children:[(0,$.jsx)(W,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(ce,{className:`fixed left-1/2 top-24 z-[90] w-[min(36rem,calc(100vw-2rem))] -translate-x-1/2 overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,$.jsx)(le,{className:`text-sm font-semibold text-fg`,children:Me}),(0,$.jsx)(ae,{className:`sr-only`,children:m.searchPlaceholder}),(0,$.jsx)(oe,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,className:`inline-flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":Ne,children:(0,$.jsx)(z,{className:`size-4`,"aria-hidden":!0})})})]}),(0,$.jsxs)(`div`,{className:`p-4`,children:[(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(R,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`input`,{type:`search`,value:w,onChange:e=>T(e.target.value),onKeyDown:Ze,placeholder:m.searchPlaceholder,className:`w-full rounded-lg border border-edge bg-surface-base py-2 pl-9 pr-10 text-sm text-fg placeholder:text-fg-muted focus:border-accent focus:outline-none focus:ring-1 focus:ring-accent`}),w?(0,$.jsx)(`button`,{type:`button`,onClick:()=>T(``),className:`absolute right-2 top-1/2 inline-flex size-7 -translate-y-1/2 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":Pe,children:(0,$.jsx)(z,{className:`size-3.5`,"aria-hidden":!0})}):null]}),(0,$.jsx)(`div`,{className:`mt-4 max-h-[min(28rem,calc(100vh-14rem))] overflow-y-auto [scrollbar-gutter:stable]`,children:xe?Ce&&!Se?(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:[1,2,3].map(e=>(0,$.jsx)(`div`,{className:`h-16 animate-pulse rounded-lg bg-surface-hover`},e))}):X.length===0?(0,$.jsxs)(`div`,{className:`flex min-h-40 flex-col items-center justify-center gap-2 px-6 text-center`,children:[(0,$.jsx)(_e,{className:`size-7 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:m.searchNoResults}),(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:m.searchNoResultsDescription})]}):(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`p`,{className:`px-2 pb-1 text-xs text-fg-muted`,children:m.searchResultsCount.replace(`{{count}}`,String(Se?.total??X.length))}),X.map((e,t)=>{let n=xn[e.kind]||_e,r=Sn(e,{imageNote:m.imageNote,noText:m.noText});return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>Xe(e.id),onMouseEnter:()=>D(t),className:B(`flex w-full items-start gap-3 rounded-lg px-3 py-2.5 text-left transition-colors`,t===E?`bg-surface-active`:`hover:bg-surface-hover`),children:[(0,$.jsx)(n,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.title||r}),(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:mt(e.updatedAt,he,Ie)})]}),e.title?(0,$.jsx)(`span`,{className:`mt-0.5 block line-clamp-2 text-xs leading-5 text-fg-muted`,children:r}):null,e.tags?.length?(0,$.jsx)(`span`,{className:`mt-1 flex min-w-0 flex-wrap gap-1`,children:e.tags.slice(0,3).map(e=>(0,$.jsx)(`span`,{className:`max-w-24 truncate rounded-md bg-surface-hover px-1.5 py-0.5 text-xs text-fg-muted`,children:e},e))}):null]})]},e.id)})]}):(0,$.jsxs)(`div`,{className:`flex min-h-40 flex-col items-center justify-center gap-2 px-6 text-center`,children:[(0,$.jsx)(R,{className:`size-7 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:m.searchEmptyTitle}),(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:m.searchEmptyDescription})]})})]})]})]})})]}):(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 p-8 text-center`,children:[(0,$.jsx)(_e,{className:`size-10 text-fg-muted`}),(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:m.needToken})]})}export{ot as n,Tn as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{c as n,r,t as i}from"./chunk-KS7C4IRE-BaASWQor.js";import{n as a}from"./locale-store-
|
|
1
|
+
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{c as n,r,t as i}from"./chunk-KS7C4IRE-BaASWQor.js";import{n as a}from"./locale-store-CXhjfe4q.js";import{i as o}from"./vendor-swr-BIWyz7Rc.js";import{a as s,r as c}from"./product-delivery-tRr-7IxY.js";import{no as l}from"./index-BNWhgmjs.js";import{n as u}from"./api-BywYxpaS.js";var d=e();function f(e){return e.installationState===`installed`&&e.enabled&&e.status===`installed`?`/extensions/${encodeURIComponent(e.extensionId)}`:`/local-apps/${encodeURIComponent(e.id)}`}var p=t();function m(){let e=(0,d.c)(14),t=n(),i=a(h)===`zh`,m=c(`xopc://open${t.search}`),_=m?.kind===`local_app`?m.id:null,{data:v,error:y}=o(_?[`local-app-open`,_]:null,()=>u(_));if(!m){let t=i?`这个打开链接无效。`:`This open link is invalid.`,n;return e[0]!==t||e[1]!==i?(n=(0,p.jsx)(g,{message:t,zh:i}),e[0]=t,e[1]=i,e[2]=n):n=e[2],n}if(m.kind!==`local_app`){let t=s({...m,title:m.id,capabilities:[`open`]}),n;return e[3]!==t||e[4]!==i?(n=t?(0,p.jsx)(r,{to:t,replace:!0}):(0,p.jsx)(g,{message:i?`这个内容无法在应用中打开。`:`This content cannot be opened in the app.`,zh:i}),e[3]=t,e[4]=i,e[5]=n):n=e[5],n}if(y){let t=typeof y==`object`&&y&&`status`in y&&y.status===404?i?`找不到这个本地应用,它可能已被删除。`:`This local app was not found and may have been deleted.`:y instanceof Error?y.message:i?`无法打开这个本地应用。`:`Unable to open this local app.`,n;return e[6]!==t||e[7]!==i?(n=(0,p.jsx)(g,{message:t,zh:i}),e[6]=t,e[7]=i,e[8]=n):n=e[8],n}if(v){let t;e[9]===v?t=e[10]:(t=f(v),e[9]=v,e[10]=t);let n;return e[11]===t?n=e[12]:(n=(0,p.jsx)(r,{to:t,replace:!0}),e[11]=t,e[12]=n),n}let b;return e[13]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,p.jsxs)(`div`,{className:`flex w-full flex-col gap-4 px-3 py-6 sm:px-5 xl:px-6`,"aria-busy":!0,children:[(0,p.jsx)(l,{className:`h-6 w-48`}),(0,p.jsx)(l,{className:`h-32 rounded-xl`})]}),e[13]=b):b=e[13],b}function h(e){return e.language}function g(e){let t=(0,d.c)(7),{message:n,zh:r}=e,a;t[0]===n?a=t[1]:(a=(0,p.jsx)(`p`,{children:n}),t[0]=n,t[1]=a);let o=r?`查看本地应用`:`View local apps`,s;t[2]===o?s=t[3]:(s=(0,p.jsx)(i,{className:`mt-3 inline-flex font-medium text-accent hover:underline`,to:`/local-apps`,children:o}),t[2]=o,t[3]=s);let c;return t[4]!==a||t[5]!==s?(c=(0,p.jsxs)(`div`,{className:`m-6 rounded-xl border border-danger/30 bg-danger-soft p-4 text-sm text-danger`,role:`alert`,children:[a,s]}),t[4]=a,t[5]=s,t[6]=c):c=t[6],c}export{m as ProductOpenPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{d as i,l as a,p as o,t as s}from"./chunk-KS7C4IRE-BaASWQor.js";import{t as c}from"./check-DUBLcKHA.js";import{d as l,f as u,l as d,n as f,p,r as m,t as h,u as g}from"./popover-select-CccGri5Y.js";import{t as _}from"./circle-check-C23XjkUj.js";import{t as v}from"./copy-Dv6d4Dvw.js";import{t as y}from"./download-Dk-ZjtO6.js";import{t as b}from"./external-link-DjqjBmc3.js";import{d as x,p as S}from"./markdown-view-DvM5PWEH.js";import{t as C}from"./plus-Q2yW6OE7.js";import{t as w}from"./search-DA7gz22f.js";import{t as T}from"./x-B_N4OPjy.js";import{t as E}from"./cn-JdwAhgNB.js";import{t as D}from"./button-CSEbl4zT.js";import{t as O}from"./copy-to-clipboard-HOJ79TWv.js";import{t as k}from"./messages-BMdD0LWk.js";import{n as A,r as j,s as M}from"./locale-store-CXhjfe4q.js";import{a as N,c as P,i as F,n as I,o as L,r as R,s as z,t as ee}from"./dist-BPoKqzeH.js";import{$a as te,$c as B,Aa as V,Ai as H,Ba as U,Cs as ne,Da as re,Dc as W,Fa as ie,Gc as ae,Gl as oe,Ha as G,Hs as K,Ia as se,L as ce,La as q,Ma as le,Mc as ue,Ml as de,Na as fe,Oa as J,Ol as pe,Os as me,Pa as he,Ps as ge,Q as _e,R as ve,Ra as ye,U as be,Ua as xe,Ul as Se,Un as Ce,V as we,Va as Te,Vl as Ee,Vn as De,Wa as Oe,Wc as ke,Wi as Ae,Wl as je,Xs as Me,Z as Ne,Zs as Pe,_c as Fe,_o as Ie,bs as Le,cl as Re,cu as ze,da as Be,do as Ve,ec as He,el as Ue,fa as We,fc as Ge,fs as Ke,fu as qe,ga as Je,gr as Ye,gt as Xe,ha as Ze,hl as Qe,it as $e,ja as et,ka as tt,la as nt,ll as rt,lr as it,lu as at,ma as ot,ml as st,no as ct,oa as lt,ol as ut,pa as dt,pc as ft,ql as pt,qs as mt,sa as ht,tc as gt,ua as _t,uo as vt,wl as yt,wr as bt,za as xt,zc as St,zl as Ct}from"./index-BNWhgmjs.js";import{t as wt}from"./notes-workbench-DmVYu_Oc.js";import{n as Tt,t as Et}from"./use-autosave-DnnZtMpA.js";import{t as Dt}from"./page-tabs-BaEQMYm_.js";import{t as Ot}from"./directory-picker-path-field-Caaz4Rw5.js";import{t as kt}from"./date-picker-8R1sXJKb.js";import{t as At}from"./automations-workspace-CD0E2ThS.js";import{i as jt,p as Mt,s as Nt}from"./skills-page.utils-DYaAddUL.js";import{t as Pt}from"./dependency-picker-CWur0821.js";import{c as Ft,l as It,n as Lt,o as Rt,r as zt,t as Bt}from"./style-TIDOdKy0.js";var Y=e(t(),1),Vt=n();function Ht(e){return M(j(`/api/projects/${encodeURIComponent(e)}/skills`))}function Ut(e,t){return M(j(`/api/projects/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}`))}function Wt(e,t){return M(j(`/api/projects/${encodeURIComponent(e)}/workspace-trust`),{method:`PATCH`,body:JSON.stringify({trusted:t})})}function Gt(e,t){let n=new FormData;return n.set(`file`,t),M(j(`/api/projects/${encodeURIComponent(e)}/skills/upload`),{method:`POST`,body:n})}function Kt(e,t,n={}){return M(j(`/api/projects/${encodeURIComponent(e)}/skills/marketplace/install`),{method:`POST`,body:JSON.stringify({name:t,...n})})}function qt(e,t){return M(j(`/api/projects/${encodeURIComponent(e)}/skills/source/install`),{method:`POST`,body:JSON.stringify({source:t})})}function Jt(e,t){return M(j(`/api/projects/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}`),{method:`DELETE`})}var X=r();function Yt({projectId:e,copy:t}){let[n,r]=(0,Y.useState)([]),[i,a]=(0,Y.useState)([]),[o,s]=(0,Y.useState)([]),[c,d]=(0,Y.useState)([]),[f,m]=(0,Y.useState)([]),[_,v]=(0,Y.useState)(``),[b,x]=(0,Y.useState)(null),[S,O]=(0,Y.useState)(!1),[k,A]=(0,Y.useState)(!0),[j,M]=(0,Y.useState)(!1),[P,F]=(0,Y.useState)(null),[te,B]=(0,Y.useState)(``),[V,H]=(0,Y.useState)(null),[U,re]=(0,Y.useState)(null),[W,ie]=(0,Y.useState)(``),[ae,G]=(0,Y.useState)(1),[K,ce]=(0,Y.useState)(null),[q,le]=(0,Y.useState)(!1),[de,fe]=(0,Y.useState)(``),[J,pe]=(0,Y.useState)(``),me=(0,Y.useRef)(null),he=(0,Y.useCallback)(async()=>{A(!0),B(``);try{let t=await Ht(e);r(t.items),a(t.inheritedItems),s(t.sources),d(t.diagnostics)}catch(e){B(e instanceof Error?e.message:String(e))}finally{A(!1)}},[e]);(0,Y.useEffect)(()=>{he()},[he]),(0,Y.useEffect)(()=>{let t=!1;return se(e).then(e=>{t||m(e)}).catch(()=>{t||m([])}),()=>{t=!0}},[e]),(0,Y.useEffect)(()=>{if(!_){x(null);return}let e=f.find(e=>e.key===_),t=!1;return x(null),B(``),O(!0),bt(e?.agentId??e?.routing?.agentId,_,!0).then(e=>{t||x(e)}).catch(e=>{t||B(e instanceof Error?e.message:String(e))}).finally(()=>{t||O(!1)}),()=>{t=!0}},[_,f]),(0,Y.useEffect)(()=>{if(V!==`marketplace`)return;let e=new AbortController,t=window.setTimeout(()=>{le(!0),fe(``),Mt({q:W,page:ae,pageSize:8,sort:`downloads`,signal:e.signal}).then(ce).catch(t=>{e.signal.aborted||fe(t instanceof Error?t.message:String(t))}).finally(()=>{e.signal.aborted||le(!1)})},250);return()=>{window.clearTimeout(t),e.abort()}},[V,ae,W]);async function _e(e,t){M(!0),F(t??null),B(``);try{await e(),H(null),pe(``),await he()}catch(e){B(e instanceof Error?e.message:String(e))}finally{M(!1),F(null)}}async function ve(t){B(``);try{re((await Ut(e,t)).skill)}catch(e){B(e instanceof Error?e.message:String(e))}}async function ye(n){if(n.removable&&window.confirm(t.removeConfirm.replace(`{{name}}`,n.name))){M(!0);try{await Jt(e,n.directoryId),await he()}catch(e){B(e instanceof Error?e.message:String(e))}finally{M(!1)}}}async function be(){M(!0),B(``);try{await Wt(e,!0),await he()}catch(e){B(e instanceof Error?e.message:String(e))}finally{M(!1)}}let xe=o.find(e=>e.origin===`agents-workspace`),Ce=new Map(b?.skills.map(e=>[e.name,e]));return(0,X.jsxs)(`section`,{id:`project-panel-skills`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-skills`,className:`grid content-start gap-4`,children:[(0,X.jsxs)(`div`,{className:`rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.title}),(0,X.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:t.description})]}),(0,X.jsxs)(u,{children:[(0,X.jsx)(p,{asChild:!0,children:(0,X.jsxs)(D,{type:`button`,children:[(0,X.jsx)(C,{className:`size-4`,"aria-hidden":!0}),t.add,(0,X.jsx)(oe,{className:`size-3.5`,"aria-hidden":!0})]})}),(0,X.jsx)(l,{children:(0,X.jsxs)(g,{align:`end`,sideOffset:8,className:`z-50 w-72 rounded-lg border border-edge bg-surface-panel p-1.5 shadow-xl`,children:[(0,X.jsx)($t,{icon:ge,title:t.marketplace,hint:t.marketplaceHint,onClick:()=>H(`marketplace`)}),(0,X.jsx)($t,{icon:ut,title:t.source,hint:t.sourceHint,onClick:()=>H(`source`)}),(0,X.jsx)($t,{icon:ne,title:t.upload,hint:t.uploadHint,onClick:()=>me.current?.click()})]})})]}),(0,X.jsx)(`input`,{ref:me,type:`file`,accept:`.zip,application/zip`,className:`hidden`,onChange:t=>{let n=t.target.files?.[0];n&&_e(()=>Gt(e,n)),t.target.value=``}})]}),o.length?(0,X.jsx)(`div`,{className:`mt-3 grid gap-2 rounded-md border border-edge-subtle bg-surface-base p-3`,children:o.map(e=>(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-xs`,children:[(0,X.jsx)(`span`,{className:`font-medium text-fg`,children:e.origin===`xopc-workspace`?t.xopcSource:t.agentsSource}),e.writable?null:(0,X.jsx)(`span`,{className:`rounded bg-surface-hover px-1.5 py-0.5 text-fg-muted`,children:t.sourceReadOnly}),(0,X.jsx)(`span`,{className:`text-fg-subtle`,children:en(t,e.state)}),(0,X.jsxs)(`span`,{className:`min-w-0 break-all font-mono text-fg-subtle`,children:[t.path,`: `,e.rootDir]})]},e.origin))}):null]}),te?(0,X.jsx)(`p`,{className:`rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:te}):null,xe?.state===`untrusted`?(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 rounded-lg border border-amber-500/30 bg-amber-500/10 px-4 py-3`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,X.jsx)(ue,{className:`mt-0.5 size-4 shrink-0 text-amber-700 dark:text-amber-300`,"aria-hidden":!0}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.trustTitle}),(0,X.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.trustHint})]})]}),(0,X.jsxs)(D,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>void be(),children:[(0,X.jsx)(mt,{className:`size-4`,"aria-hidden":!0}),j?t.trusting:t.trustAction]})]}):null,c.some(e=>e.type!==`skipped`)?(0,X.jsxs)(`div`,{className:`rounded-lg border border-amber-500/30 bg-amber-500/10 px-4 py-3`,children:[(0,X.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.diagnosticsTitle}),(0,X.jsx)(`ul`,{className:`mt-2 grid gap-1 text-xs leading-5 text-fg-muted`,children:c.filter(e=>e.type!==`skipped`).map((e,t)=>(0,X.jsx)(`li`,{children:e.message},`${e.type}:${e.path??``}:${t}`))})]}):null,f.length?(0,X.jsxs)(`div`,{className:`flex flex-wrap items-end justify-between gap-3 rounded-lg border border-edge bg-surface-panel p-4`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.sessionViewLabel}),(0,X.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:S?t.sessionLoading:_?b?.agentId:t.sessionViewAll})]}),(0,X.jsx)(h,{value:_,options:f.map(e=>({value:e.key,label:e.name?.trim()||`${t.sessionFallback} · ${e.key.slice(-12)}`})),placeholder:t.sessionViewAll,emptyLabel:t.sessionViewAll,triggerClassName:`w-[min(24rem,calc(100vw-3rem))]`,onChange:v})]}):null,k?(0,X.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:[0,1,2].map(e=>(0,X.jsx)(ct,{className:`h-36 rounded-lg`},e))}):n.length?(0,X.jsx)(Xt,{title:t.localTitle,items:n,copy:t,busy:j,availabilityByName:Ce,onPreview:ve,onRemove:ye}):(0,X.jsxs)(`div`,{className:`rounded-lg border border-dashed border-edge bg-surface-panel px-6 py-12 text-center`,children:[(0,X.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.empty}),(0,X.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:t.emptyHint})]}),!k&&i.length?(0,X.jsx)(Xt,{title:t.inheritedTitle,hint:t.inheritedHint,items:i,copy:t,busy:j,availabilityByName:Ce,onPreview:ve,onRemove:ye}):null,(0,X.jsx)(ee,{open:V!==null,onOpenChange:e=>{e||H(null)},children:(0,X.jsxs)(L,{children:[(0,X.jsx)(N,{className:`fixed inset-0 z-50 bg-black/45`}),(0,X.jsxs)(R,{className:E(`fixed left-1/2 top-1/2 z-50 flex -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-xl`,V===`marketplace`?`h-[min(46rem,calc(100vh-2rem))] w-[min(58rem,calc(100vw-2rem))]`:`h-[min(22rem,calc(100vh-2rem))] w-[min(36rem,calc(100vw-2rem))]`),children:[(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-5 py-4`,children:[(0,X.jsx)(z,{className:`text-base font-semibold text-fg`,children:V===`marketplace`?t.marketplace:t.source}),(0,X.jsx)(I,{asChild:!0,children:(0,X.jsx)(D,{type:`button`,variant:`ghost`,className:`size-9 p-0`,children:(0,X.jsx)(T,{className:`size-4`})})})]}),(0,X.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:V===`marketplace`?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.marketplace}),(0,X.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.marketplaceHint}),(0,X.jsxs)(`div`,{className:`relative mt-3`,children:[(0,X.jsx)(w,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,X.jsx)(`input`,{className:`h-10 w-full rounded-md border border-edge bg-surface-base pl-9 pr-3 text-sm outline-none focus:border-accent`,value:W,onChange:e=>{ie(e.target.value),G(1)},placeholder:t.marketplacePlaceholder,autoFocus:!0})]}),de?(0,X.jsx)(`p`,{className:`mt-3 text-sm text-red-600 dark:text-red-300`,children:de}):null,q&&!K?(0,X.jsx)(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[0,1,2,3].map(e=>(0,X.jsx)(ct,{className:`h-32 rounded-lg`},e))}):K?.items.length?(0,X.jsx)(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:K.items.map(r=>{let i=r.providerId??K.provider,a=jt(r,i),o=n.some(e=>e.origin===`xopc-workspace`&&(e.directoryId===r.id||e.directoryId===a||e.name===r.name)),s=P===a;return(0,X.jsxs)(`article`,{className:`group flex min-h-32 gap-3 rounded-lg border border-edge bg-surface-base p-3`,children:[(0,X.jsx)(Nt,{name:r.name,className:`size-10`}),(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,X.jsx)(`h4`,{className:`truncate text-sm font-semibold text-fg`,children:r.name}),(0,X.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:r.description||`—`}),(0,X.jsxs)(`div`,{className:`mt-auto flex items-end justify-between gap-2 pt-2`,children:[(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs text-fg-subtle`,children:[(0,X.jsx)(y,{className:`size-3.5`,"aria-hidden":!0}),t.marketplaceDownloads,` `,r.downloads]}),(0,X.jsx)(D,{type:`button`,className:`h-8 px-2.5 text-xs`,variant:o?`secondary`:`primary`,disabled:j||o,onClick:()=>void _e(()=>Kt(e,a,{provider:i}),a),children:o?t.marketplaceInstalled:s?t.installing:t.install})]})]})]},`${i??`default`}:${r.id}`)})}):q?null:(0,X.jsx)(`p`,{className:`mt-6 text-center text-sm text-fg-muted`,children:t.marketplaceEmpty}),K&&K.meta.totalPages>1?(0,X.jsxs)(`div`,{className:`mt-3 flex items-center justify-between border-t border-edge-subtle pt-3`,children:[(0,X.jsx)(`span`,{className:`text-xs text-fg-muted`,children:t.marketplacePage.replace(`{{page}}`,String(K.meta.page)).replace(`{{total}}`,String(K.meta.totalPages))}),(0,X.jsxs)(`div`,{className:`flex gap-2`,children:[(0,X.jsxs)(D,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:q||ae<=1,onClick:()=>G(e=>Math.max(1,e-1)),children:[(0,X.jsx)(je,{className:`size-4`}),t.marketplacePrevious]}),(0,X.jsxs)(D,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:q||ae>=K.meta.totalPages,onClick:()=>G(e=>e+1),children:[t.marketplaceNext,(0,X.jsx)(Se,{className:`size-4`})]})]})]}):null]}):(0,X.jsxs)(`section`,{className:`flex h-full flex-col`,children:[(0,X.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:t.sourceHint}),(0,X.jsx)(`input`,{className:`mt-4 h-10 w-full rounded-md border border-edge bg-surface-base px-3 text-sm outline-none focus:border-accent`,value:J,onChange:e=>pe(e.target.value),placeholder:t.sourcePlaceholder,autoFocus:!0}),(0,X.jsxs)(`div`,{className:`mt-auto flex justify-end gap-2 border-t border-edge pt-4`,children:[(0,X.jsx)(I,{asChild:!0,children:(0,X.jsx)(D,{type:`button`,variant:`secondary`,children:t.close})}),(0,X.jsx)(D,{type:`button`,disabled:j||!J.trim(),onClick:()=>void _e(()=>qt(e,J.trim())),children:j?t.installing:t.install})]})]})})]})]})}),(0,X.jsx)(ee,{open:!!U,onOpenChange:e=>{e||re(null)},children:(0,X.jsxs)(L,{children:[(0,X.jsx)(N,{className:`fixed inset-0 z-50 bg-black/45`}),(0,X.jsxs)(R,{className:`fixed left-1/2 top-1/2 z-50 flex h-[min(42rem,calc(100vh-2rem))] w-[min(48rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-xl`,children:[(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-5 py-4`,children:[(0,X.jsx)(z,{className:`text-base font-semibold text-fg`,children:U?.name}),(0,X.jsx)(I,{asChild:!0,children:(0,X.jsx)(D,{type:`button`,variant:`ghost`,className:`size-9 p-0`,children:(0,X.jsx)(T,{className:`size-4`})})})]}),(0,X.jsx)(`pre`,{className:`min-h-0 flex-1 overflow-auto whitespace-pre-wrap p-5 text-sm leading-6 text-fg-muted`,children:U?.bodyMarkdown})]})]})})]})}function Xt(e){let t=(0,Vt.c)(25),{title:n,hint:r,items:i,copy:a,busy:o,availabilityByName:s,onPreview:c,onRemove:l}=e,u;t[0]===n?u=t[1]:(u=(0,X.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n}),t[0]=n,t[1]=u);let d;t[2]===r?d=t[3]:(d=r?(0,X.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:r}):null,t[2]=r,t[3]=d);let f;t[4]!==u||t[5]!==d?(f=(0,X.jsxs)(`div`,{children:[u,d]}),t[4]=u,t[5]=d,t[6]=f):f=t[6];let p;if(t[7]!==s||t[8]!==o||t[9]!==a||t[10]!==i||t[11]!==c||t[12]!==l){let e;t[14]!==s||t[15]!==o||t[16]!==a||t[17]!==c||t[18]!==l?(e=e=>{let t=e.effective?s.get(e.name):void 0;return(0,X.jsxs)(`article`,{className:E(`flex min-h-36 flex-col rounded-lg border border-edge bg-surface-panel p-4`,!e.effective&&`opacity-70`),children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(qe,{className:`size-4 text-accent-fg`,"aria-hidden":!0}),(0,X.jsx)(`h4`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:e.name})]}),(0,X.jsx)(`p`,{className:`mt-2 line-clamp-2 flex-1 text-sm leading-5 text-fg-muted`,children:e.description||e.directoryId}),(0,X.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5 text-[11px] text-fg-subtle`,children:[(0,X.jsx)(`span`,{className:`rounded-md bg-surface-hover/70 px-2 py-0.5`,children:Zt(a,e.origin)}),e.writable?null:(0,X.jsx)(`span`,{className:`rounded-md bg-surface-hover/70 px-2 py-0.5`,children:a.sourceReadOnly}),e.effective?null:(0,X.jsx)(`span`,{className:`rounded-md bg-amber-500/10 px-2 py-0.5 text-amber-800 dark:text-amber-200`,children:a.shadowed}),t?(0,X.jsx)(`span`,{className:E(`rounded-md px-2 py-0.5`,t.availableForCurrentAgent?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-amber-500/10 text-amber-800 dark:text-amber-200`),children:Qt(a,t)}):null]}),(0,X.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-2`,children:[(0,X.jsxs)(D,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:()=>void c(e.key),children:[(0,X.jsx)(b,{className:`size-3.5`,"aria-hidden":!0}),a.view]}),e.removable?(0,X.jsxs)(D,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs text-red-600`,disabled:o,onClick:()=>void l(e),children:[(0,X.jsx)(me,{className:`size-3.5`,"aria-hidden":!0}),a.remove]}):null]})]},e.key)},t[14]=s,t[15]=o,t[16]=a,t[17]=c,t[18]=l,t[19]=e):e=t[19],p=i.map(e),t[7]=s,t[8]=o,t[9]=a,t[10]=i,t[11]=c,t[12]=l,t[13]=p}else p=t[13];let m;t[20]===p?m=t[21]:(m=(0,X.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:p}),t[20]=p,t[21]=m);let h;return t[22]!==f||t[23]!==m?(h=(0,X.jsxs)(`section`,{className:`grid gap-3`,children:[f,m]}),t[22]=f,t[23]=m,t[24]=h):h=t[24],h}function Zt(e,t){switch(t){case`xopc-workspace`:return e.xopcSource;case`agents-workspace`:return e.agentsSource;case`xopc-global`:case`custom-global`:return e.globalXopcSource;case`agents-global`:return e.globalAgentsSource;case`bundled`:return e.bundledSource;case`extra`:return e.extraSource}}function Qt(e,t){if(t.availableForCurrentAgent)return e.sessionAvailable;switch(t.unavailableReason){case`agent-denied`:return e.sessionUnavailableAgent;case`disabled`:return e.sessionUnavailableDisabled;case`requirements-unmet`:return e.sessionUnavailableRequirements;case`model-invocation-disabled`:return e.sessionUnavailableModel;case`tool-gated`:return e.sessionUnavailableTools;default:return e.sessionUnavailableAgent}}function $t(e){let t=(0,Vt.c)(13),{icon:n,title:r,hint:i,onClick:a}=e,o;t[0]===n?o=t[1]:(o=(0,X.jsx)(n,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`,"aria-hidden":!0}),t[0]=n,t[1]=o);let s;t[2]===r?s=t[3]:(s=(0,X.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:r}),t[2]=r,t[3]=s);let c;t[4]===i?c=t[5]:(c=(0,X.jsx)(`span`,{className:`mt-0.5 block text-xs leading-5 text-fg-muted`,children:i}),t[4]=i,t[5]=c);let l;t[6]!==s||t[7]!==c?(l=(0,X.jsxs)(`span`,{className:`min-w-0`,children:[s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;return t[9]!==a||t[10]!==o||t[11]!==l?(u=(0,X.jsx)(d,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,className:`flex w-full items-start gap-3 rounded-md px-3 py-2.5 text-left hover:bg-surface-hover`,onClick:a,children:[o,l]})}),t[9]=a,t[10]=o,t[11]=l,t[12]=u):u=t[12],u}function en(e,t){switch(t){case`active`:return e.sourceStateActive;case`missing`:return e.sourceStateMissing;case`disabled`:return e.sourceStateDisabled;case`untrusted`:return e.sourceStateUntrusted;case`invalid`:return e.sourceStateInvalid}}var tn=[`backlog`,`ready`,`active`,`review`,`closed`];function nn(e){return{backlog:e.filter(e=>e.phase===`backlog`),ready:e.filter(e=>e.phase===`ready`),active:e.filter(e=>e.phase===`active`),review:e.filter(e=>e.phase===`review`),closed:e.filter(e=>e.phase===`closed`)}}function rn(e,t){if(e.phase!==t){if(e.phase===`closed`&&t!==`closed`&&e.allowedCommands.includes(`reopen`))return`reopen_${t}`;if(t===`closed`&&e.phase===`review`&&e.allowedCommands.includes(`close`))return`complete`;if(t!==`closed`&&e.allowedCommands.includes(`move`))return`move_${t}`}}function an(e){if(e.allowedCommands.includes(`resolve_wait`))return`resume`;if(e.allowedCommands.includes(`mark_ready`))return`ready`;if(e.allowedCommands.includes(`start`))return`run`;if(e.allowedCommands.includes(`request_review`))return`review`;if(e.phase===`review`&&e.allowedCommands.includes(`close`))return`complete`;if(e.allowedCommands.includes(`reopen`))return`reopen`;if(e.allowedCommands.includes(`add_wait`))return`pause`}function on(e){let t=new Map,n=new Map;for(let r of e)t.set(r.dependencyTaskId,[...t.get(r.dependencyTaskId)??[],r.dependentTaskId]),n.set(r.dependentTaskId,[...n.get(r.dependentTaskId)??[],r.dependencyTaskId]);return{outgoing:t,incoming:n}}function sn(e,t){let n=new Set(e.map(e=>e.id)),{outgoing:r,incoming:i}=on(t.filter(e=>n.has(e.dependencyTaskId)&&n.has(e.dependentTaskId))),a=new Map(e.map(e=>[e.id,i.get(e.id)?.length??0])),o=new Map(e.map(e=>[e.id,0])),s=e.filter(e=>a.get(e.id)===0).sort((e,t)=>t.updatedAt-e.updatedAt).map(e=>e.id);for(let e=0;e<s.length;e+=1){let t=s[e];for(let e of r.get(t)??[]){o.set(e,Math.max(o.get(e)??0,(o.get(t)??0)+1));let n=(a.get(e)??1)-1;a.set(e,n),n===0&&s.push(e)}}let c=new Map;for(let t of e){let e=o.get(t.id)??0;c.set(e,[...c.get(e)??[],t.id])}let l=new Map;for(let[e,t]of c)t.forEach((t,n)=>l.set(t,{x:e*300,y:n*136}));return l}function cn(e,t){let{incoming:n}=on(t),r=new Set(e.filter(e=>e.operationalState===`blocked`).map(e=>e.id)),i=[...r];for(let e=0;e<i.length;e+=1)for(let t of n.get(i[e])??[])r.has(t)||(r.add(t),i.push(t));return r}function ln(e,t){let{incoming:n,outgoing:r}=on(t),i=new Set([e]);for(let t of[n,r]){let n=[e],r=new Set(n);for(let e=0;e<n.length;e+=1)for(let a of t.get(n[e])??[])r.has(a)||(r.add(a),i.add(a),n.push(a))}return i}var un={backlog:`border-edge`,ready:`border-edge`,active:`border-accent ring-2 ring-accent/15`,review:`border-amber-400/80`,closed:`border-emerald-400/60`};function dn(e){let t=(0,Vt.c)(25),{data:n,selected:r}=e,i=n.task,a=i.operationalState===`waiting`||i.operationalState===`blocked`,o=un[i.phase],s=r&&`ring-2 ring-accent/30`,c=n.dimmed&&`opacity-30`,l;t[0]!==o||t[1]!==s||t[2]!==c?(l=E(`group w-56 rounded-xl border bg-surface-panel p-3 shadow-surface transition-opacity`,o,s,c),t[0]=o,t[1]=s,t[2]=c,t[3]=l):l=t[3];let u;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,X.jsx)(zt,{type:`target`,position:It.Left,className:`!size-3 !border-2 !border-surface-panel !bg-accent opacity-60 transition-opacity group-hover:opacity-100`}),t[4]=u):u=t[4];let d;t[5]===i.title?d=t[6]:(d=(0,X.jsx)(`strong`,{className:`line-clamp-2 min-w-0 text-sm font-medium leading-5 text-fg`,children:i.title}),t[5]=i.title,t[6]=d);let f;t[7]===a?f=t[8]:(f=a?(0,X.jsx)(B,{className:`mt-0.5 size-3.5 shrink-0 text-violet-600 dark:text-violet-300`,"aria-hidden":!0}):null,t[7]=a,t[8]=f);let p;t[9]!==d||t[10]!==f?(p=(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[d,f]}),t[9]=d,t[10]=f,t[11]=p):p=t[11];let m;t[12]===n.phaseLabel?m=t[13]:(m=(0,X.jsx)(`span`,{children:n.phaseLabel}),t[12]=n.phaseLabel,t[13]=m);let h;t[14]!==a||t[15]!==i.blockedBy?(h=a&&i.blockedBy.length>0?(0,X.jsx)(`span`,{children:i.blockedBy.length}):null,t[14]=a,t[15]=i.blockedBy,t[16]=h):h=t[16];let g;t[17]!==h||t[18]!==m?(g=(0,X.jsxs)(`div`,{className:`mt-2 flex items-center justify-between gap-2 text-[11px] text-fg-subtle`,children:[m,h]}),t[17]=h,t[18]=m,t[19]=g):g=t[19];let _;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,X.jsx)(zt,{type:`source`,position:It.Right,className:`!size-3 !border-2 !border-surface-panel !bg-accent opacity-60 transition-opacity group-hover:opacity-100`}),t[20]=_):_=t[20];let v;return t[21]!==g||t[22]!==l||t[23]!==p?(v=(0,X.jsxs)(`div`,{className:l,children:[u,p,g,_]}),t[21]=g,t[22]=l,t[23]=p,t[24]=v):v=t[24],v}var fn={taskNode:dn};function pn(e){let t=(0,Vt.c)(90),{tasks:n,dependencyEdges:r,returnTo:i,copy:a,onDependenciesChange:o}=e,[c,l]=(0,Y.useState)(!1),[u,d]=(0,Y.useState)(!1),[f,p]=(0,Y.useState)(),[m,h]=(0,Y.useState)(),g=(0,Y.useRef)(null),_;t[0]!==r||t[1]!==n?(_=cn(n,r),t[0]=r,t[1]=n,t[2]=_):_=t[2];let v=_,y;t[3]!==v||t[4]!==u||t[5]!==c||t[6]!==n?(y=u?n.filter(e=>v.has(e.id)):c?n:n.filter(Z),t[3]=v,t[4]=u,t[5]=c,t[6]=n,t[7]=y):y=t[7];let x=y,S;t[8]===x?S=t[9]:(S=new Set(x.map(bn)),t[8]=x,t[9]=S);let C=S,w;if(t[10]!==r||t[11]!==C){let e;t[13]===C?e=t[14]:(e=e=>C.has(e.dependencyTaskId)&&C.has(e.dependentTaskId),t[13]=C,t[14]=e),w=r.filter(e),t[10]=r,t[11]=C,t[12]=w}else w=t[12];let T=w,O;t[15]!==T||t[16]!==x?(O=sn(x,T),t[15]=T,t[16]=x,t[17]=O):O=t[17];let k=O,A;t[18]!==f||t[19]!==T?(A=f?ln(f,T):void 0,t[18]=f,t[19]=T,t[20]=A):A=t[20];let j=A,M;t[21]===f?M=t[22]:(M=e=>e.id===f,t[21]=f,t[22]=M);let N=x.find(M),P;t[23]===x?P=t[24]:(P=new Map(x.map(yn)),t[23]=x,t[24]=P);let F=P,I;if(t[25]!==a.phases||t[26]!==k||t[27]!==j||t[28]!==x){let e;t[30]!==a.phases||t[31]!==k||t[32]!==j?(e=e=>({id:e.id,type:`taskNode`,position:k.get(e.id)??{x:0,y:0},data:{task:e,phaseLabel:a.phases[e.phase],dimmed:!!(j&&!j.has(e.id))}}),t[30]=a.phases,t[31]=k,t[32]=j,t[33]=e):e=t[33],I=x.map(e),t[25]=a.phases,t[26]=k,t[27]=j,t[28]=x,t[29]=I}else I=t[29];let L=I,R;if(t[34]!==j||t[35]!==F||t[36]!==T){let e;t[38]!==j||t[39]!==F?(e=e=>{let t=F.get(e.dependencyTaskId),n=t?.phase===`closed`&&t.resolution===`done`,r=!!(j&&(!j.has(e.dependencyTaskId)||!j.has(e.dependentTaskId)));return{id:`${e.dependencyTaskId}:${e.dependentTaskId}`,source:e.dependencyTaskId,target:e.dependentTaskId,markerEnd:{type:Ft.ArrowClosed},style:{stroke:n?`var(--color-edge-strong)`:`var(--color-accent)`,strokeWidth:n?1.25:1.75,opacity:r?.18:1,strokeDasharray:n?`5 5`:void 0}}},t[38]=j,t[39]=F,t[40]=e):e=t[40],R=T.map(e),t[34]=j,t[35]=F,t[36]=T,t[37]=R}else R=t[37];let z=R,ee,te;t[41]!==f||t[42]!==C?(ee=()=>{f&&!C.has(f)&&p(void 0)},te=[f,C],t[41]=f,t[42]=C,t[43]=ee,t[44]=te):(ee=t[43],te=t[44]),(0,Y.useEffect)(ee,te);let B,V;t[45]!==z||t[46]!==m?(B=()=>{m&&!z.some(e=>e.id===m)&&h(void 0)},V=[z,m],t[45]=z,t[46]=m,t[47]=B,t[48]=V):(B=t[47],V=t[48]),(0,Y.useEffect)(B,V);let H;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(H=()=>{let e=window.requestAnimationFrame(()=>{g.current?.fitView({padding:.2,minZoom:.35,maxZoom:1,duration:250})});return()=>window.cancelAnimationFrame(e)},t[49]=H):H=t[49];let U;t[50]!==u||t[51]!==c||t[52]!==x.length?(U=[u,c,x.length],t[50]=u,t[51]=c,t[52]=x.length,t[53]=U):U=t[53],(0,Y.useEffect)(H,U);let ne;t[54]===f?ne=t[55]:(ne=()=>{f&&g.current?.fitView({nodes:[{id:f}],padding:1.5,minZoom:.7,maxZoom:1,duration:250})},t[54]=f,t[55]=ne);let re=ne,W;t[56]!==r||t[57]!==o?(W=e=>{if(!e.source||!e.target||e.source===e.target)return;let t=r.filter(t=>t.dependentTaskId===e.target).map(vn);t.includes(e.source)||o(e.target,[...t,e.source])},t[56]=r,t[57]=o,t[58]=W):W=t[58];let ie=W,ae;t[59]!==r||t[60]!==o||t[61]!==m?(ae=()=>{if(!m)return;let e=r.find(e=>`${e.dependencyTaskId}:${e.dependentTaskId}`===m);e&&(h(void 0),o(e.dependentTaskId,r.filter(t=>t.dependentTaskId===e.dependentTaskId&&t.dependencyTaskId!==e.dependencyTaskId).map(_n)))},t[59]=r,t[60]=o,t[61]=m,t[62]=ae):ae=t[62];let oe=ae,G;t[63]===a.connectHint?G=t[64]:(G=(0,X.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a.connectHint}),t[63]=a.connectHint,t[64]=G);let K=u?`secondary`:`ghost`,se;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(se=()=>d(gn),t[65]=se):se=t[65];let ce=u?a.allTasks:a.blockedChains,q;t[66]!==u||t[67]!==K||t[68]!==ce?(q=(0,X.jsx)(D,{type:`button`,variant:K,className:`h-8 rounded-lg px-2.5 text-xs`,"aria-pressed":u,onClick:se,children:ce}),t[66]=u,t[67]=K,t[68]=ce,t[69]=q):q=t[69];let le;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(le=()=>l(hn),t[70]=le):le=t[70];let ue=c?a.hideCompleted:a.showCompleted,de;t[71]!==u||t[72]!==c||t[73]!==ue?(de=(0,X.jsx)(D,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,"aria-pressed":c,onClick:le,disabled:u,children:ue}),t[71]=u,t[72]=c,t[73]=ue,t[74]=de):de=t[74];let fe=N?(0,X.jsxs)(D,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,onClick:re,children:[(0,X.jsx)(st,{className:`size-3.5`,"aria-hidden":!0}),a.locateTask]}):null,J;t[75]!==a.removeDependency||t[76]!==oe||t[77]!==m?(J=m?(0,X.jsx)(D,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs text-danger`,onClick:oe,children:a.removeDependency}):null,t[75]=a.removeDependency,t[76]=oe,t[77]=m,t[78]=J):J=t[78];let pe;t[79]!==q||t[80]!==de||t[81]!==fe||t[82]!==J?(pe=(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[q,de,fe,J]}),t[79]=q,t[80]=de,t[81]=fe,t[82]=J,t[83]=pe):pe=t[83];let me;t[84]!==G||t[85]!==pe?(me=(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 border-b border-edge bg-surface-panel px-3 py-2.5`,children:[G,pe]}),t[84]=G,t[85]=pe,t[86]=me):me=t[86];let he=x.length>0?(0,X.jsxs)(`div`,{className:E(`grid h-[min(42rem,calc(100vh-14rem))] min-h-[28rem]`,N&&`lg:grid-cols-[minmax(0,1fr)_18rem]`),children:[(0,X.jsxs)(Rt,{nodes:L,edges:z,nodeTypes:fn,nodesDraggable:!1,nodesConnectable:!0,elementsSelectable:!0,onNodeClick:(e,t)=>p(t.id),onEdgeClick:(e,t)=>h(t.id),onConnect:ie,onPaneClick:()=>{p(void 0),h(void 0)},onInit:e=>{g.current=e},fitView:!0,minZoom:.25,maxZoom:1.25,panOnScroll:!0,zoomOnDoubleClick:!1,proOptions:{hideAttribution:!0},children:[(0,X.jsx)(Bt,{color:`var(--color-edge)`,gap:22,size:1}),(0,X.jsx)(Lt,{showInteractive:!1,className:`!border-edge !bg-surface-panel !shadow-surface`})]}),N?(0,X.jsxs)(`aside`,{className:`overflow-y-auto border-t border-edge bg-surface-panel p-4 lg:border-l lg:border-t-0`,children:[(0,X.jsx)(`p`,{className:`text-xs font-medium text-accent-fg`,children:a.phases[N.phase]}),(0,X.jsx)(`h3`,{className:`mt-2 text-sm font-semibold leading-6 text-fg`,children:N.title}),N.operationalState===`blocked`&&N.blockedBy.length>0?(0,X.jsxs)(`div`,{className:`mt-4 rounded-lg bg-violet-500/8 p-3`,children:[(0,X.jsx)(`p`,{className:`text-xs font-medium text-violet-700 dark:text-violet-300`,children:a.blockedBy.replace(`{{count}}`,String(N.blockedBy.length))}),(0,X.jsx)(`ul`,{className:`mt-2 space-y-1 text-xs leading-5 text-fg-muted`,children:N.blockedBy.map(mn)})]}):null,(0,X.jsxs)(s,{to:De(i,N.id),className:`mt-4 inline-flex items-center gap-1.5 text-xs font-medium text-accent-fg hover:underline`,children:[(0,X.jsx)(b,{className:`size-3.5`,"aria-hidden":!0}),a.openTask]})]}):null]}):(0,X.jsx)(`div`,{className:`flex min-h-72 items-center justify-center px-6 text-center text-sm text-fg-muted`,children:a.empty}),ge;return t[87]!==me||t[88]!==he?(ge=(0,X.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-base/40`,children:[me,he]}),t[87]=me,t[88]=he,t[89]=ge):ge=t[89],ge}function mn(e){return(0,X.jsx)(`li`,{children:e.title},e.id)}function hn(e){return!e}function gn(e){return!e}function _n(e){return e.dependencyTaskId}function vn(e){return e.dependencyTaskId}function yn(e){return[e.id,e]}function bn(e){return e.id}function Z(e){return e.phase!==`closed`}function xn({policy:e,copy:t,onSave:n}){let[r,i]=(0,Y.useState)(!1),[a,o]=(0,Y.useState)(e.mode),[s,c]=(0,Y.useState)(Math.round(e.confidenceThreshold*100)),[l,u]=(0,Y.useState)(!!e.quietHours),[d,p]=(0,Y.useState)(e.quietHours?.startHour??22),[h,g]=(0,Y.useState)(e.quietHours?.endHour??8),[_,v]=(0,Y.useState)(e.quietHours?.timezone??Intl.DateTimeFormat().resolvedOptions().timeZone),[y,b]=(0,Y.useState)(e.allowedActions.includes(`create_project_task`)),[x,S]=(0,Y.useState)(!1),[C,w]=(0,Y.useState)();(0,Y.useEffect)(()=>{o(e.mode),c(Math.round(e.confidenceThreshold*100)),u(!!e.quietHours),p(e.quietHours?.startHour??22),g(e.quietHours?.endHour??8),v(e.quietHours?.timezone??Intl.DateTimeFormat().resolvedOptions().timeZone),b(e.allowedActions.includes(`create_project_task`))},[e]);let E=async()=>{S(!0),w(void 0);try{await n({mode:a,confidenceThreshold:s/100,quietHours:l?{startHour:d,endHour:h,timezone:_}:null,allowedActions:y?[`create_project_task`]:[]}),i(!1)}catch(e){w(e instanceof Error?e.message:t.saveFailed)}finally{S(!1)}};return(0,X.jsxs)(ee,{open:r,onOpenChange:e=>{x||i(e)},children:[(0,X.jsx)(P,{asChild:!0,children:(0,X.jsxs)(D,{type:`button`,variant:`ghost`,className:`h-9 gap-2 px-2.5 text-xs`,children:[(0,X.jsx)(Pe,{className:`size-3.5`,"aria-hidden":!0}),t.modes[e.mode]]})}),(0,X.jsxs)(L,{children:[(0,X.jsx)(N,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,X.jsxs)(R,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(36rem,calc(100vh-2rem))] w-[min(34rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,X.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge px-5 py-4`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(z,{className:`text-base font-semibold text-fg`,children:t.title}),(0,X.jsx)(F,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:t.description})]}),(0,X.jsx)(I,{asChild:!0,children:(0,X.jsx)(D,{type:`button`,variant:`ghost`,className:`size-9 p-0`,disabled:x,children:(0,X.jsx)(T,{className:`size-4`,"aria-hidden":!0})})})]}),(0,X.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-5 overflow-y-auto px-5 py-4`,children:[(0,X.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,X.jsx)(`span`,{className:`font-medium text-fg-muted`,children:t.mode}),(0,X.jsx)(f,{value:a,onChange:e=>o(e.target.value),children:Object.entries(t.modes).map(([e,t])=>(0,X.jsx)(m,{value:e,children:t},e))})]}),(0,X.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,X.jsxs)(`span`,{className:`font-medium text-fg-muted`,children:[t.confidence,` · `,s,`%`]}),(0,X.jsx)(`input`,{type:`range`,min:`50`,max:`100`,step:`5`,value:s,onChange:e=>c(Number(e.target.value)),className:`accent-accent`})]}),(0,X.jsxs)(`div`,{className:`rounded-lg border border-edge p-3`,children:[(0,X.jsxs)(`label`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,X.jsx)(`input`,{type:`checkbox`,checked:l,onChange:e=>u(e.target.checked)}),t.quietHours]}),l?(0,X.jsxs)(`div`,{className:`mt-3 grid grid-cols-2 gap-3`,children:[(0,X.jsxs)(`label`,{className:`grid gap-1 text-xs text-fg-muted`,children:[t.quietStart,(0,X.jsx)(`input`,{type:`number`,min:`0`,max:`23`,value:d,onChange:e=>p(Number(e.target.value)),className:`rounded-lg border border-edge bg-surface-base px-3 py-2 text-fg`})]}),(0,X.jsxs)(`label`,{className:`grid gap-1 text-xs text-fg-muted`,children:[t.quietEnd,(0,X.jsx)(`input`,{type:`number`,min:`0`,max:`23`,value:h,onChange:e=>g(Number(e.target.value)),className:`rounded-lg border border-edge bg-surface-base px-3 py-2 text-fg`})]}),(0,X.jsxs)(`label`,{className:`col-span-2 grid gap-1 text-xs text-fg-muted`,children:[t.timezone,(0,X.jsx)(`input`,{value:_,onChange:e=>v(e.target.value),className:`rounded-lg border border-edge bg-surface-base px-3 py-2 text-fg`})]})]}):null]}),(0,X.jsxs)(`label`,{className:`flex items-start gap-3 rounded-lg border border-edge p-3`,children:[(0,X.jsx)(`input`,{type:`checkbox`,className:`mt-1`,checked:y,onChange:e=>b(e.target.checked)}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:t.allowTaskCreation}),(0,X.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:t.allowTaskCreationDescription})]})]})]}),(0,X.jsxs)(`div`,{className:`shrink-0 border-t border-edge px-5 py-3`,children:[C?(0,X.jsx)(`p`,{className:`mb-2 text-xs text-danger`,children:C}):null,(0,X.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,X.jsx)(I,{asChild:!0,children:(0,X.jsx)(D,{type:`button`,variant:`ghost`,disabled:x,children:t.cancel})}),(0,X.jsx)(D,{type:`button`,variant:`primary`,disabled:x||!_.trim()||d<0||d>23||h<0||h>23,onClick:()=>void E(),children:x?t.saving:t.save})]})]})]})]})]})}function Sn(e){return e instanceof Element?!!e.closest(`a,button,input,select,textarea,[contenteditable="true"],[draggable="true"],[data-board-pan-skip="true"]`):!0}var Cn={backlog:Ct,ready:Ct,active:St,review:Le,closed:_},wn={backlog:`bg-surface-hover text-fg-muted`,ready:`bg-surface-panel text-fg-muted`,active:`bg-accent-soft text-accent-fg`,review:`bg-amber-500/10 text-amber-700 dark:text-amber-300`,closed:`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`};function Tn(e){return e===`running`||e===`queued`?`border-accent/20 bg-accent-soft text-accent-fg`:e===`verifying`?`border-emerald-500/20 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`waiting`?`border-amber-500/20 bg-amber-500/10 text-amber-700 dark:text-amber-300`:e===`blocked`?`border-violet-500/20 bg-violet-500/10 text-violet-700 dark:text-violet-300`:`border-edge-subtle bg-surface-hover text-fg-muted`}function En(e){return e===`passed`?`border-emerald-500/20 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`failed`?`border-red-500/20 bg-red-500/10 text-red-700 dark:text-red-300`:`border-edge-subtle bg-surface-hover text-fg-muted`}function Q(e){let t=(0,Vt.c)(83),{task:n,returnTo:r,copy:i,busy:a,onAction:o,onDragStart:c,onDropBefore:l}=e,u,d,f,p,m,h,g,v,y,b,x,S,C,w,T,D;t[0]!==c||t[1]!==l||t[2]!==r||t[3]!==n?(m=an(n),h=m!==`review`&&n.allowedCommands.includes(`request_review`)?`review`:void 0,f=n.phase===`closed`,p=!!(n.dueAt&&n.dueAt<Date.now()&&!f),d=f?_:de,v=n.priority!==`normal`,g=v||n.operationalState!==`idle`||!!n.latestVerification||n.acceptanceCriteriaCount>0||!!n.dueAt||!!n.nextCheckAt,x=!0,t[20]!==c||t[21]!==n.id?(S=e=>{e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,n.id),c(n.id)},t[20]=c,t[21]=n.id,t[22]=S):S=t[22],t[23]===c?C=t[24]:(C=()=>c(``),t[23]=c,t[24]=C),w=On,t[25]!==l||t[26]!==n.id?(T=e=>{e.preventDefault(),e.stopPropagation(),l(n.id)},t[25]=l,t[26]=n.id,t[27]=T):T=t[27],D=`group relative min-h-max min-w-0 shrink-0 overflow-hidden rounded-xl border border-edge-subtle bg-surface-base shadow-surface transition-[border-color,box-shadow] hover:border-edge focus-within:border-accent/40`,u=s,t[28]!==r||t[29]!==n.id?(y=De(r,n.id),t[28]=r,t[29]=n.id,t[30]=y):y=t[30],b=E(`block min-w-0 p-3 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,h?`pr-19`:m&&`pr-11`),t[0]=c,t[1]=l,t[2]=r,t[3]=n,t[4]=u,t[5]=d,t[6]=f,t[7]=p,t[8]=m,t[9]=h,t[10]=g,t[11]=v,t[12]=y,t[13]=b,t[14]=x,t[15]=S,t[16]=C,t[17]=w,t[18]=T,t[19]=D):(u=t[4],d=t[5],f=t[6],p=t[7],m=t[8],h=t[9],g=t[10],v=t[11],y=t[12],b=t[13],x=t[14],S=t[15],C=t[16],w=t[17],T=t[18],D=t[19]);let O=f?`text-emerald-600 dark:text-emerald-400`:`text-fg-subtle`,k;t[31]===O?k=t[32]:(k=E(`mt-0.5 size-4 shrink-0`,O),t[31]=O,t[32]=k);let A;t[33]!==d||t[34]!==k?(A=(0,X.jsx)(d,{className:k,"aria-hidden":!0}),t[33]=d,t[34]=k,t[35]=A):A=t[35];let j=f?`text-fg-subtle`:`text-fg`,M;t[36]===j?M=t[37]:(M=E(`min-w-0 break-words text-sm font-semibold leading-5`,j),t[36]=j,t[37]=M);let N;t[38]!==M||t[39]!==n.title?(N=(0,X.jsx)(`h3`,{className:M,children:n.title}),t[38]=M,t[39]=n.title,t[40]=N):N=t[40];let P;t[41]!==A||t[42]!==N?(P=(0,X.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[A,N]}),t[41]=A,t[42]=N,t[43]=P):P=t[43];let F;t[44]!==i||t[45]!==n.attention||t[46]!==n.blockedBy||t[47]!==n.operationalState?(F=n.operationalState===`blocked`&&n.blockedBy.length>0?(0,X.jsxs)(`div`,{className:`ml-6.5 mt-2.5 rounded-lg bg-violet-500/8 px-2.5 py-2 text-xs text-violet-700 dark:text-violet-300`,children:[(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 font-medium`,children:[(0,X.jsx)(B,{className:`size-3.5`,"aria-hidden":!0}),i.blockedBy.replace(`{{count}}`,String(n.blockedBy.length))]}),(0,X.jsx)(`p`,{className:`mt-1 line-clamp-2 leading-5 text-fg-muted`,children:n.blockedBy.map(Dn).join(`、`)})]}):n.attention[0]?(0,X.jsxs)(`p`,{className:`ml-6.5 mt-2.5 flex items-start gap-1.5 text-xs leading-5 text-fg-muted`,children:[(0,X.jsx)(Ee,{className:`mt-0.5 size-3.5 shrink-0 text-amber-600 dark:text-amber-400`,"aria-hidden":!0}),(0,X.jsx)(`span`,{className:`line-clamp-2`,children:n.attention[0].summary})]}):null,t[44]=i,t[45]=n.attention,t[46]=n.blockedBy,t[47]=n.operationalState,t[48]=F):F=t[48];let I;t[49]!==i||t[50]!==p||t[51]!==g||t[52]!==v||t[53]!==n.acceptanceCriteriaCount||t[54]!==n.dueAt||t[55]!==n.latestVerification||t[56]!==n.nextCheckAt||t[57]!==n.operationalState||t[58]!==n.priority?(I=g?(0,X.jsxs)(`div`,{className:`ml-6.5 mt-2.5 flex flex-wrap items-center gap-1.5 text-[11px]`,children:[v?(0,X.jsx)(`span`,{className:E(`inline-flex min-h-6 items-center rounded-md border px-2 font-medium`,n.priority===`critical`?`border-red-500/20 bg-red-500/10 text-red-700 dark:text-red-300`:n.priority===`high`?`border-amber-500/20 bg-amber-500/10 text-amber-700 dark:text-amber-300`:`border-edge-subtle bg-surface-hover text-fg-muted`),children:i.priorityOptions[n.priority]}):null,n.operationalState===`idle`?null:(0,X.jsx)(`span`,{className:E(`inline-flex min-h-6 items-center rounded-md border px-2 font-medium`,Tn(n.operationalState)),children:i.operationalStates[n.operationalState]}),n.latestVerification?(0,X.jsx)(`span`,{className:E(`inline-flex min-h-6 items-center rounded-md border px-2 font-medium`,En(n.latestVerification)),children:i.verification[n.latestVerification]}):null,n.acceptanceCriteriaCount>0?(0,X.jsxs)(`span`,{className:`inline-flex min-h-6 items-center gap-1 rounded-md border border-edge-subtle bg-surface-hover px-2 text-fg-muted`,children:[(0,X.jsx)(St,{className:`size-3`,"aria-hidden":!0}),i.acceptanceCriteria.replace(`{{count}}`,String(n.acceptanceCriteriaCount))]}):null,n.dueAt?(0,X.jsxs)(`span`,{className:E(`inline-flex min-h-6 items-center gap-1 rounded-md border px-2`,p?`border-red-500/20 bg-red-500/10 text-red-700 dark:text-red-300`:`border-edge-subtle bg-surface-hover text-fg-muted`),children:[(0,X.jsx)(pt,{className:`size-3`,"aria-hidden":!0}),H(new Date(n.dueAt))]}):null,n.nextCheckAt?(0,X.jsxs)(`span`,{className:`inline-flex min-h-6 items-center gap-1 rounded-md border border-accent/20 bg-accent-soft px-2 text-accent-fg`,children:[(0,X.jsx)(pt,{className:`size-3`,"aria-hidden":!0}),H(new Date(n.nextCheckAt))]}):null]}):null,t[49]=i,t[50]=p,t[51]=g,t[52]=v,t[53]=n.acceptanceCriteriaCount,t[54]=n.dueAt,t[55]=n.latestVerification,t[56]=n.nextCheckAt,t[57]=n.operationalState,t[58]=n.priority,t[59]=I):I=t[59];let L;t[60]!==u||t[61]!==y||t[62]!==P||t[63]!==F||t[64]!==I||t[65]!==b?(L=(0,X.jsxs)(u,{to:y,className:b,children:[P,F,I]}),t[60]=u,t[61]=y,t[62]=P,t[63]=F,t[64]=I,t[65]=b,t[66]=L):L=t[66];let R;t[67]!==a||t[68]!==i||t[69]!==o||t[70]!==m||t[71]!==h||t[72]!==n?(R=m?(0,X.jsxs)(`div`,{className:`absolute right-2.5 top-2.5 z-10 flex items-center gap-1 opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100 [@media(hover:none)]:opacity-100`,children:[h?(0,X.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>o(n,h),className:`inline-flex size-7 items-center justify-center rounded-md bg-surface-hover text-fg-muted hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-wait disabled:opacity-50`,"aria-label":i.actions[h],title:i.actions[h],children:(0,X.jsx)(Le,{className:`size-3.5`,"aria-hidden":!0})}):null,(0,X.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>o(n,m),className:`inline-flex size-7 items-center justify-center rounded-md bg-accent-soft text-accent-fg hover:bg-accent-soft/80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-wait disabled:opacity-50`,"aria-label":i.actions[m],title:i.actions[m],children:(0,X.jsx)(ze,{className:`size-3.5`,"aria-hidden":!0})})]}):null,t[67]=a,t[68]=i,t[69]=o,t[70]=m,t[71]=h,t[72]=n,t[73]=R):R=t[73];let z;return t[74]!==L||t[75]!==R||t[76]!==x||t[77]!==S||t[78]!==C||t[79]!==w||t[80]!==T||t[81]!==D?(z=(0,X.jsxs)(`article`,{draggable:x,onDragStart:S,onDragEnd:C,onDragOver:w,onDrop:T,className:D,children:[L,R]}),t[74]=L,t[75]=R,t[76]=x,t[77]=S,t[78]=C,t[79]=w,t[80]=T,t[81]=D,t[82]=z):z=t[82],z}function Dn(e){return e.title}function On(e){e.preventDefault(),e.stopPropagation()}function kn({tasks:e,dependencyEdges:t,monitoring:n,returnTo:r,copy:i,onAction:a,onReorder:o,onUndoMove:s,onDependenciesChange:c,onMonitoringChange:l,onCreate:u,actionBusyId:d,ref:p}){let h=(0,Y.useRef)(null),g=(0,Y.useRef)(null),[_,v]=(0,Y.useState)(null),[y,b]=(0,Y.useState)(!1),[x,S]=(0,Y.useState)(null),[C,w]=(0,Y.useState)(`board`),[T,O]=(0,Y.useState)(!1),[j,M]=(0,Y.useState)(()=>crypto.randomUUID()),[P,te]=(0,Y.useState)(``),[B,V]=(0,Y.useState)(`normal`),[H,U]=(0,Y.useState)(``),[ne,re]=(0,Y.useState)([]),[W,ie]=(0,Y.useState)(!1),[ae,oe]=(0,Y.useState)(null),G=$e({chat:k(A(e=>e.language)).chat}),K=nn(e),se=e.filter(e=>e.phase!==`closed`),ce=(e,t)=>void a(e,t),q=async(t,n)=>{let r=e.find(e=>e.id===_);if(v(null),!r||r.id===n)return;let i=K[r.phase],s=i.findIndex(e=>e.id===r.id),c=s>=0?i[s+1]?.id??null:null;if(r.phase===t&&c===n)return;let l=rn(r,t);r.phase!==t&&!l||l&&!await a(r,l)||await o(r.id,n)&&S({taskId:r.id,phase:r.phase,beforeTaskId:c})},le=async e=>{e.preventDefault();let t=P.trim();if(!(!t||W)){ie(!0),oe(null);try{let e=H?new Date(`${H}T23:59:59.999`).getTime():void 0;await u({requestId:j,objective:t,priority:B,dependsOnTaskIds:ne,attachments:G.wireAttachmentsPayload(),...e===void 0?{}:{dueAt:e}}),te(``),V(`normal`),U(``),re([]),G.clearAttachments(),M(crypto.randomUUID()),O(!1)}catch(e){oe(e instanceof Error?e.message:i.createFailed)}finally{ie(!1)}}},ue=()=>{M(crypto.randomUUID()),te(``),V(`normal`),U(``),re([]),G.clearAttachments(),oe(null),O(!0)};(0,Y.useImperativeHandle)(p,()=>({openCreate:ue})),(0,Y.useEffect)(()=>{if(!x)return;let e=window.setTimeout(()=>S(null),6e3);return()=>window.clearTimeout(e)},[x]);let de=(0,Y.useCallback)(e=>{let t=g.current;!t||t.pointerId!==e.pointerId||(g.current=null,b(!1),e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))},[]),fe=(0,Y.useCallback)(e=>{if(e.button!==0||Sn(e.target))return;let t=h.current;t&&(g.current={pointerId:e.pointerId,startX:e.clientX,scrollLeft:t.scrollLeft,active:!1},e.currentTarget.setPointerCapture(e.pointerId))},[]),J=(0,Y.useCallback)(e=>{let t=g.current,n=h.current;if(!t||!n||t.pointerId!==e.pointerId)return;let r=e.clientX-t.startX;!t.active&&Math.abs(r)<5||(t.active||(t.active=!0,b(!0)),e.preventDefault(),n.scrollLeft=t.scrollLeft-r)},[]);return(0,X.jsxs)(`section`,{id:`project-panel-board`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-board`,className:`flex h-full min-h-0 flex-col overflow-hidden`,children:[(0,X.jsxs)(`div`,{className:`mb-4 flex shrink-0 flex-wrap items-start justify-between gap-3`,children:[(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:i.title}),(0,X.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:i.description})]}),(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,X.jsx)(xn,{policy:n,copy:i.monitoring,onSave:l}),(0,X.jsxs)(`div`,{className:`flex rounded-lg border border-edge bg-surface-panel p-0.5`,children:[(0,X.jsxs)(`button`,{type:`button`,"aria-pressed":C===`board`,onClick:()=>w(`board`),className:E(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium`,C===`board`?`bg-surface-hover text-fg`:`text-fg-muted hover:text-fg`),children:[(0,X.jsx)(ke,{className:`size-3.5`,"aria-hidden":!0}),i.views.board]}),(0,X.jsxs)(`button`,{type:`button`,"aria-pressed":C===`graph`,onClick:()=>w(`graph`),className:E(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium`,C===`graph`?`bg-surface-hover text-fg`:`text-fg-muted hover:text-fg`),children:[(0,X.jsx)(ut,{className:`size-3.5`,"aria-hidden":!0}),i.views.graph]})]})]})]}),C===`board`?(0,X.jsx)(`div`,{ref:h,className:E(`min-h-0 w-full min-w-0 flex-1 overflow-x-auto overflow-y-hidden overscroll-x-contain pb-2 [scrollbar-width:thin]`,y?`cursor-grabbing select-none`:`cursor-grab`),onPointerDown:fe,onPointerMove:J,onPointerUp:de,onPointerCancel:de,onLostPointerCapture:e=>{g.current?.pointerId===e.pointerId&&(g.current=null,b(!1))},children:(0,X.jsx)(`div`,{className:`grid h-full min-h-0 min-w-[103rem] grid-cols-5 gap-3`,children:tn.map(t=>{let n=Cn[t],a=K[t];return(0,X.jsxs)(`section`,{onDragOver:n=>{let r=e.find(e=>e.id===_);r&&(r.phase===t||rn(r,t))&&n.preventDefault()},onDrop:e=>{e.preventDefault(),q(t,null)},className:`flex min-h-0 min-w-0 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-muted/70 p-2.5`,children:[(0,X.jsxs)(`header`,{className:`mb-2.5 flex shrink-0 items-center gap-2 px-0.5`,children:[(0,X.jsxs)(`div`,{className:E(`flex items-center gap-1.5 rounded-md px-2 py-1`,wn[t]),children:[(0,X.jsx)(n,{className:`size-3.5`,"aria-hidden":!0}),(0,X.jsx)(`h3`,{className:`text-sm font-semibold`,children:i.phases[t]})]}),(0,X.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:a.length})]}),(0,X.jsx)(`div`,{className:`min-h-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-y-contain pr-1 [scrollbar-gutter:stable] [scrollbar-width:thin]`,children:(0,X.jsx)(`div`,{className:`flex flex-col gap-2`,children:a.map(e=>(0,X.jsx)(Q,{task:e,returnTo:r,copy:i,busy:d===e.id,onAction:ce,onDragStart:v,onDropBefore:e=>void q(t,e)},e.id))})})]},t)})})}):(0,X.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,X.jsx)(pn,{tasks:e,dependencyEdges:t,returnTo:r,copy:{...i.graph,phases:i.phases},onDependenciesChange:c})}),(0,X.jsx)(ee,{open:T,onOpenChange:e=>{W||O(e)},children:(0,X.jsxs)(L,{children:[(0,X.jsx)(N,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,X.jsxs)(R,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(40rem,calc(100vh-2rem))] w-[min(38rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,X.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,X.jsx)(z,{className:`text-base font-semibold text-fg`,children:i.createTitle}),(0,X.jsx)(F,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:i.createDescription})]}),(0,X.jsxs)(`form`,{className:`flex min-h-0 flex-1 flex-col`,onSubmit:e=>void le(e),children:[(0,X.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,X.jsxs)(`div`,{className:`grid gap-2 text-sm`,children:[(0,X.jsx)(`label`,{htmlFor:`project-task-objective`,className:`font-medium text-fg-muted`,children:i.objective}),(0,X.jsxs)(`div`,{className:E(`overflow-hidden rounded-lg border border-edge bg-surface-base transition-colors focus-within:border-accent`,G.isDragging&&`border-accent bg-accent-soft/30`),onDragOver:e=>{e.preventDefault(),W||G.setIsDragging(!0)},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||G.setIsDragging(!1)},onDrop:e=>{e.preventDefault(),G.setIsDragging(!1),W||G.processFiles(Array.from(e.dataTransfer.files))},children:[(0,X.jsx)(`textarea`,{id:`project-task-objective`,autoFocus:!0,className:`min-h-28 w-full resize-y bg-transparent px-3 py-3 text-sm leading-6 text-fg outline-none placeholder:text-fg-subtle`,value:P,onChange:e=>{te(e.target.value),oe(null)},placeholder:i.objectivePlaceholder,maxLength:12e3,disabled:W}),(0,X.jsx)(Xe,{attachments:G.attachments,topPadded:!1,onRemove:e=>{W||G.removeAttachment(e)}}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 border-t border-edge-subtle px-2.5 py-2`,children:[(0,X.jsxs)(D,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:W,onClick:()=>G.fileInputRef.current?.click(),children:[(0,X.jsx)(Fe,{className:`size-3.5`,"aria-hidden":!0}),i.addFiles]}),(0,X.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:i.attachmentsDescription}),(0,X.jsx)(`input`,{ref:G.fileInputRef,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{G.processFiles(Array.from(e.target.files??[])),e.currentTarget.value=``}})]})]})]}),(0,X.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,X.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,X.jsx)(`span`,{className:`font-medium text-fg-muted`,children:i.priority}),(0,X.jsx)(f,{value:B,onChange:e=>V(e.target.value),disabled:W,children:[`low`,`normal`,`high`,`critical`].map(e=>(0,X.jsx)(m,{value:e,children:i.priorityOptions[e]},e))})]}),(0,X.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,X.jsxs)(`span`,{className:`font-medium text-fg-muted`,children:[i.dueDate,` `,(0,X.jsx)(`span`,{className:`font-normal text-fg-subtle`,children:i.optional})]}),(0,X.jsx)(kt,{className:`min-h-10 bg-surface-base`,value:H,onChange:U,disabled:W,ariaLabel:i.dueDate})]})]}),(0,X.jsxs)(`fieldset`,{className:`grid gap-2`,children:[(0,X.jsxs)(`legend`,{className:`text-sm font-medium text-fg-muted`,children:[i.dependencies,` `,(0,X.jsx)(`span`,{className:`font-normal text-fg-subtle`,children:i.optional})]}),(0,X.jsx)(`p`,{className:`text-xs leading-5 text-fg-subtle`,children:i.dependenciesDescription}),(0,X.jsx)(Pt,{candidates:se,selectedIds:ne,disabled:W,onChange:re,labels:{link:i.linkDependencies,linked:i.linkedDependencies,searchPlaceholder:i.dependencySearchPlaceholder,noMatches:i.noDependencyMatches,noCandidates:i.noDependencyCandidates,remove:i.removeDependency}})]}),ae?(0,X.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:ae}):null]}),(0,X.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,X.jsx)(I,{asChild:!0,children:(0,X.jsx)(D,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:W,children:i.cancel})}),(0,X.jsx)(D,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:W||!P.trim(),children:W?i.creating:i.create})]})]})]})]})}),x?(0,X.jsxs)(`div`,{role:`status`,className:`fixed bottom-5 left-1/2 z-50 flex -translate-x-1/2 items-center gap-4 rounded-lg border border-edge bg-surface-panel px-4 py-3 text-sm text-fg shadow-float`,children:[(0,X.jsx)(`span`,{children:i.moved}),(0,X.jsx)(`button`,{type:`button`,className:`font-medium text-accent-fg hover:underline`,onClick:()=>{let e=x;S(null),s(e.taskId,e.phase,e.beforeTaskId).then(t=>{t||S(e)})},children:i.undo})]}):null]})}var An=new Set([{id:`overview`,icon:ae},{id:`tasks`,icon:yt},{id:`automations`,icon:Ke},{id:`files`,icon:Re},{id:`notes`,icon:Qe},{id:`skills`,icon:K},{id:`sessions`,icon:W},{id:`progress`,icon:Ue},{id:`settings`,icon:Me}].map(e=>e.id)),jn=`xopc.projectFiles.panelWidthPx`,Mn=320,Nn=220,Pn=560;function Fn(e,t){return e.name!==t.name||e.description!==(t.description??``)||e.status!==t.status||e.defaultAgentId!==(t.defaultAgentId??``)||e.brief!==(t.brief??``)||e.instructions!==(t.instructions??``)}function In(e){return Math.min(Pn,Math.max(Nn,Math.round(e)))}function Ln(){try{let e=window.localStorage.getItem(jn);if(e==null)return Mn;let t=Number.parseInt(e,10);return Number.isFinite(t)?In(t):Mn}catch{return Mn}}function Rn(e){try{window.localStorage.setItem(jn,String(In(e)))}catch{}}function zn(e){return!!(e&&An.has(e))}function Bn(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function Vn(e,t=``){if(!e)return t;let n=new Date(e);return Number.isNaN(n.getTime())?String(e):H(n)}function Hn(e){return e===`active`?`bg-accent-soft text-accent-fg`:e===`done`?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`paused`?`bg-amber-500/10 text-amber-700 dark:text-amber-300`:e===`archived`?`bg-surface-muted text-fg-subtle`:`bg-surface-hover text-fg-muted`}function Un(e){let t=(0,Vt.c)(8),{label:n,hint:r,children:i}=e,a;t[0]===n?a=t[1]:(a=(0,X.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=r?(0,X.jsx)(`span`,{className:`text-xs leading-5 text-fg-subtle`,children:r}):null,t[2]=r,t[3]=o);let s;return t[4]!==i||t[5]!==a||t[6]!==o?(s=(0,X.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[a,i,o]}),t[4]=i,t[5]=a,t[6]=o,t[7]=s):s=t[7],s}function Wn(e=!1){return E(`w-full rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,e?`min-h-24 py-2 leading-5`:`min-h-10`)}function Gn(e){let t=(0,Vt.c)(10),{label:n,value:r,mono:i}=e,a=i===void 0?!1:i,o;t[0]===n?o=t[1]:(o=(0,X.jsx)(`div`,{className:`text-xs font-medium text-fg-subtle`,children:n}),t[0]=n,t[1]=o);let s=a&&`font-mono text-xs`,c;t[2]===s?c=t[3]:(c=E(`mt-1 min-w-0 truncate text-sm text-fg`,s),t[2]=s,t[3]=c);let l;t[4]!==c||t[5]!==r?(l=(0,X.jsx)(`div`,{className:c,title:r,children:r}),t[4]=c,t[5]=r,t[6]=l):l=t[6];let u;return t[7]!==o||t[8]!==l?(u=(0,X.jsxs)(`div`,{className:`min-w-0 rounded-md bg-surface-base px-3 py-2`,children:[o,l]}),t[7]=o,t[8]=l,t[9]=u):u=t[9],u}function Kn(e){return[e.name,e.slug,e.workspaceRoot,e.description,e.brief].filter(Boolean).join(` `).toLowerCase()}function $(e){let t=e.lastActiveAt??e.updatedAt??e.createdAt,n=t?new Date(t).getTime():0;return Number.isFinite(n)?n:0}function qn(e){return e.trim().replace(/[\\/]+$/,``).split(/[\\/]/).filter(Boolean).pop()??``}function Jn(e){let t=e?.body;return t?.code===`workspace_root_missing`&&t.workspaceRoot?t.workspaceRoot:null}function Yn(e){let t=e.actor;return t.name?t.name:t.agentId?t.agentId:t.id?t.id:t.sessionKey?t.sessionKey:t.kind}function Xn(e){return e.primaryObject.title?.trim()||e.primaryObject.id}function Zn(e){let t=e.source;return t.toolCallId?`${t.kind} · ${t.toolCallId}`:t.runId?`${t.kind} · ${t.runId}`:t.requestId?`${t.kind} · ${t.requestId}`:t.kind}function Qn(e){let t=e.sourceChannel?.trim();if(t)return $n(t);let n=e.key.split(`:`).filter(Boolean),r=(n[0]?.toLowerCase()===`agent`?n.slice(2).join(`:`):e.key).split(`:`)[0]?.split(/[-_]/)[0]?.trim();return $n(r||``)}function $n(e){let t=e.trim().toLowerCase();return t?t===`tui`?`TUI`:t===`acp`?`ACP`:t===`webchat`?`Webchat`:t:``}function er(e){let t=e.payload.changes;if(Array.isArray(t)&&t.length)return t.filter(e=>typeof e==`string`).join(`, `);let n=e.payload.contentPreview;if(typeof n==`string`&&n.trim())return n.trim();let r=e.payload.title??e.payload.name;return typeof r==`string`&&r.trim()?r.trim():``}function tr(e){return e.map(e=>({name:e.name,path:e.path,absolutePath:e.absolutePath,isDirectory:e.type===`directory`,children:e.type===`directory`?[]:void 0}))}function nr(e,t,n){return e.map(e=>e.path===t?{...e,children:n}:e.isDirectory&&e.children?.length?{...e,children:nr(e.children,t,n)}:e)}function rr({currentProject:e,pm:t,projectsText:n,wd:r}){let i=a(),[o,s]=(0,Y.useState)(!1),[d,f]=(0,Y.useState)([e]),[m,h]=(0,Y.useState)(``),[_,v]=(0,Y.useState)(!1),[y,b]=(0,Y.useState)(null),[x,S]=(0,Y.useState)(!1),[T,O]=(0,Y.useState)(`new`),[k,A]=(0,Y.useState)(``),[j,M]=(0,Y.useState)(``),[P,te]=(0,Y.useState)(!1),[B,V]=(0,Y.useState)(null),[H,U]=(0,Y.useState)(null),ne=(0,Y.useCallback)(async()=>{v(!0),b(null);try{let t=await q({limit:100});f(n=>{let r=new Map;r.set(e.id,e);for(let e of n)r.set(e.id,e);for(let e of t.items)r.set(e.id,e);return Array.from(r.values())})}catch(e){b(e instanceof Error?e.message:String(e))}finally{v(!1)}},[e]);(0,Y.useEffect)(()=>{f(t=>[e,...t.filter(t=>t.id!==e.id)])},[e]),(0,Y.useEffect)(()=>{o&&ne()},[ne,o]);let re=(0,Y.useMemo)(()=>{let t=m.trim().toLowerCase().split(/\s+/).filter(Boolean);return d.filter(t=>t.id!==e.id).filter(e=>{if(t.length===0)return!0;let n=Kn(e);return t.every(e=>n.includes(e))}).sort((e,t)=>$(t)-$(e))},[e.id,d,m]),W=e=>t.statuses[e.status]??e.status,ie=e=>e.workspaceRoot||e.effectiveWorkspaceRoot||e.description||e.brief||t.common.defaultWorkspace,ae=e=>{O(e),A(``),M(``),V(null),S(!0),s(!1)},G=(0,Y.useCallback)(async(e={})=>{let t=j.trim(),n=k.trim()||(T===`directory`?qn(t):``);if(n){te(!0),V(null),U(null);try{let r=await J({name:n,...t?{workspaceRoot:t}:{},...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}});S(!1),A(``),M(``),f(e=>[r,...e.filter(e=>e.id!==r.id)]),i(`/projects/${encodeURIComponent(r.id)}`)}catch(e){let t=Jn(e);t?(U(t),S(!1)):V(e instanceof Error?e.message:String(e))}finally{te(!1)}}},[T,k,i,j]),K=(0,Y.useCallback)(e=>{e.preventDefault(),G()},[G]),se=(0,Y.useCallback)(()=>{G({createWorkspaceRoot:!0})},[G]),ce=(0,Y.useCallback)(()=>{U(null),S(!0)},[]),le=e=>{M(e),T===`directory`&&!k.trim()&&A(qn(e))},ue=(e,t)=>(0,X.jsxs)(`button`,{type:`button`,className:E(`grid w-full grid-cols-[1rem_minmax(0,1fr)_auto] items-center gap-2 rounded-md p-2 text-left hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,t&&`bg-accent-soft/55 hover:bg-accent-soft/70`),onClick:()=>{s(!1),t||i(`/projects/${encodeURIComponent(e.id)}`)},children:[(0,X.jsx)(c,{className:E(`size-4 text-accent-fg`,!t&&`invisible`),"aria-hidden":!0}),(0,X.jsxs)(`span`,{className:`min-w-0`,children:[(0,X.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:e.name}),(0,X.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:ie(e)})]}),(0,X.jsx)(`span`,{className:E(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,Hn(e.status)),children:W(e)})]},e.id);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(u,{open:o,onOpenChange:s,children:[(0,X.jsx)(p,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,className:`group flex max-w-full min-w-0 items-center gap-2 rounded-lg px-2 py-1 text-left hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,"aria-label":t.projectSwitcher.switchProject,title:t.projectSwitcher.switchProject,children:[(0,X.jsxs)(`span`,{className:`min-w-0`,children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,X.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:e.name}),(0,X.jsx)(`span`,{className:E(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,Hn(e.status)),children:W(e)})]}),(0,X.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:ie(e)})]}),(0,X.jsx)(oe,{className:`size-4 shrink-0 text-fg-subtle transition-transform group-data-[state=open]:rotate-180`,"aria-hidden":!0})]})}),(0,X.jsx)(l,{children:(0,X.jsxs)(g,{side:`bottom`,align:`start`,sideOffset:6,className:`z-[70] w-[min(26rem,calc(100vw-2rem))] overflow-hidden rounded-xl border border-edge bg-surface-panel p-1.5 shadow-popover outline-none`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,X.jsxs)(`label`,{className:`relative block`,children:[(0,X.jsx)(w,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,X.jsx)(`input`,{type:`search`,className:`h-9 w-full rounded-lg border border-edge bg-surface-base pl-9 pr-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`,value:m,onChange:e=>h(e.target.value),placeholder:t.projectSwitcher.searchPlaceholder,"aria-label":t.projectSwitcher.searchPlaceholder})]}),(0,X.jsxs)(`div`,{className:`mt-1 max-h-[min(54vh,24rem)] overflow-y-auto pr-0.5 [scrollbar-gutter:stable]`,children:[(0,X.jsx)(`div`,{className:`px-2 pb-1 pt-2 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.projectSwitcher.current}),ue(e,!0),(0,X.jsx)(`div`,{className:`px-2 pb-1 pt-3 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.projectSwitcher.recent}),y?(0,X.jsx)(`div`,{className:`p-2 text-xs text-red-600 dark:text-red-400`,children:y}):null,_&&re.length===0?(0,X.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.loading}):null,!_&&re.length===0?(0,X.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.noMatches}):null,re.map(e=>ue(e,!1))]}),(0,X.jsxs)(`div`,{className:`mt-1 border-t border-edge-subtle pt-1`,children:[(0,X.jsxs)(`button`,{type:`button`,className:`flex h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm text-fg hover:bg-surface-hover`,onClick:()=>ae(`new`),children:[(0,X.jsx)(C,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.newProject})]}),(0,X.jsxs)(`button`,{type:`button`,className:`flex h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm text-fg hover:bg-surface-hover`,onClick:()=>ae(`directory`),children:[(0,X.jsx)(Re,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.openDirectory})]}),(0,X.jsxs)(`button`,{type:`button`,className:`flex h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm text-fg hover:bg-surface-hover`,onClick:()=>{s(!1),i(`/projects`)},children:[(0,X.jsx)(Me,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.manageProjects})]})]})]})})]}),(0,X.jsx)(ee,{open:x,onOpenChange:e=>!P&&S(e),children:(0,X.jsxs)(L,{children:[(0,X.jsx)(N,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,X.jsxs)(R,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(32rem,calc(100vh-2rem))] w-[min(40rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,X.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,X.jsx)(z,{className:`text-base font-semibold text-fg`,children:T===`directory`?t.projectSwitcher.createFromDirectoryTitle:n.createTitle}),(0,X.jsx)(F,{className:`mt-1 text-sm text-fg-muted`,children:T===`directory`?t.projectSwitcher.createFromDirectoryDescription:n.createDescription})]}),(0,X.jsxs)(`form`,{onSubmit:K,className:`flex min-h-0 flex-1 flex-col`,children:[(0,X.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[B?(0,X.jsx)(`div`,{className:`rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:B}):null,(0,X.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,X.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.projectName}),(0,X.jsx)(`input`,{className:`min-h-10 rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`,value:k,onChange:e=>A(e.target.value),placeholder:`xopc`})]}),(0,X.jsxs)(`div`,{className:`grid gap-1.5 text-sm`,children:[(0,X.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.workspaceRoot}),(0,X.jsx)(Ot,{value:j,onChange:le,disabled:P,wd:r,placeholder:n.workspacePlaceholder,inputClassName:`min-h-10 rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`}),(0,X.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.workspaceHint})]})]}),(0,X.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,X.jsx)(I,{asChild:!0,children:(0,X.jsx)(D,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:P,children:n.cancel})}),(0,X.jsxs)(D,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:P||!(k.trim()||T===`directory`&&qn(j)),children:[(0,X.jsx)(C,{className:`size-4`,"aria-hidden":!0}),n.create]})]})]})]})]})}),(0,X.jsx)(ee,{open:!!H,onOpenChange:e=>{e||U(null)},children:(0,X.jsxs)(L,{children:[(0,X.jsx)(N,{className:`fixed inset-0 z-[100] bg-scrim backdrop-blur-[2px]`}),(0,X.jsxs)(R,{className:`fixed left-1/2 top-1/2 z-[110] flex w-[min(30rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,X.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,X.jsx)(z,{className:`text-base font-semibold text-fg`,children:n.workspaceMissingTitle}),(0,X.jsx)(F,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:H?Bn(n.workspaceMissingDescription,{workspace:H}):null})]}),H?(0,X.jsx)(`div`,{className:`px-5 py-4`,children:(0,X.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-surface-muted px-3 py-2 text-sm text-fg-muted`,children:[(0,X.jsx)(Re,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:H})]})}):null,(0,X.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,X.jsx)(D,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:ce,disabled:P,children:n.workspaceMissingBack}),(0,X.jsxs)(D,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:se,disabled:P,children:[(0,X.jsx)(rt,{className:`size-4`,"aria-hidden":!0}),n.workspaceMissingCreate]})]})]})]})})]})}function ir(){let{projectId:e=``,tabId:t,noteId:n}=i(),r=a(),[c]=o(),l=A(e=>e.language),u=k(l),d=u.chat.workingDirectory,p=u.projectDetailPage,h=u.projectsPage,g=Ie(e=>e.setPageHeader),_=Ie(e=>e.clearPageHeader),[y,b]=(0,Y.useState)(null),[j,M]=(0,Y.useState)(null),[P,B]=(0,Y.useState)([]),[H,ne]=(0,Y.useState)(``),[oe,q]=(0,Y.useState)([]),[ue,de]=(0,Y.useState)(0),[J,ge]=(0,Y.useState)(!1),[Se,ke]=(0,Y.useState)(!1),[je,Pe]=(0,Y.useState)(!1),[Fe,Le]=(0,Y.useState)([]),ze=(0,Y.useRef)(new Set),[Xe,$e]=(0,Y.useState)(null),[st,pt]=(0,Y.useState)(Ln),[mt,bt]=(0,Y.useState)(!1),[St,Ct]=(0,Y.useState)(!1),[kt,jt]=(0,Y.useState)(``),[Mt,Nt]=(0,Y.useState)([]),[Pt,Ft]=(0,Y.useState)(!1),[It,Lt]=(0,Y.useState)(null),[Rt,zt]=(0,Y.useState)(!1),[Bt,Vt]=(0,Y.useState)(null),[Ht,Ut]=(0,Y.useState)([]),[Wt,Gt]=(0,Y.useState)(``),[Kt,qt]=(0,Y.useState)(!0),[Jt,Xt]=(0,Y.useState)(!1),[Zt,Qt]=(0,Y.useState)(!1),[$t,en]=(0,Y.useState)(null),[tn,nn]=(0,Y.useState)(!1),[rn,an]=(0,Y.useState)(`fixed`),[on,sn]=(0,Y.useState)(``),[cn,ln]=(0,Y.useState)(null),[un,dn]=(0,Y.useState)(!1),[fn,pn]=(0,Y.useState)(!1),[mn,hn]=(0,Y.useState)(!1),[gn,_n]=(0,Y.useState)(null),vn=(0,Y.useRef)(null),yn=(0,Y.useRef)(!1),[bn,Z]=(0,Y.useState)(null),[xn,Sn]=(0,Y.useState)({title:``,reason:``}),[Cn,wn]=(0,Y.useState)({name:``,description:``,status:`active`,defaultAgentId:``,workspaceRoot:``,brief:``,instructions:``}),Tn=(0,Y.useRef)(Cn),En=`overview`,Q=n?`notes`:zn(t)?t:En,Dn=(0,Y.useMemo)(()=>x(c.get(`returnTo`),`/projects`,[`/chat`]),[c]),On=(0,Y.useCallback)(t=>{if(!e)return`/projects`;let n=`/projects/${encodeURIComponent(e)}/${t}`;return Dn===`/projects`?n:S(n,Dn)},[Dn,e]),An=(0,Y.useCallback)(t=>{e&&r(On(t))},[r,e,On]),jn=(0,Y.useCallback)(()=>{if(Q===`tasks`&&vn.current){vn.current.openCreate();return}yn.current=!0,An(`tasks`)},[An,Q]);(0,Y.useEffect)(()=>{Q!==`tasks`||!yn.current||(yn.current=!1,vn.current?.openCreate())},[Q]);let Mn=(0,Y.useCallback)(t=>{e&&r(On(t),{replace:!0})},[r,e,On]),Nn=(0,Y.useCallback)((e,t)=>{Mn(e),r(t)},[r,Mn]),Pn=(0,Y.useCallback)(e=>t=>{t.defaultPrevented||t.button!==0||t.metaKey||t.altKey||t.ctrlKey||t.shiftKey||Mn(e)},[Mn]),Kn=(0,Y.useCallback)(e=>e.startsWith(`/chat/`)?`sessions`:e.startsWith(`/notes`)?`notes`:Q,[Q]);(0,Y.useEffect)(()=>{!e||!t||zn(t)||r(On(En),{replace:!0})},[En,r,e,On,t]),(0,Y.useEffect)(()=>{if(!e)return;let t=!1;return qt(!0),Z(null),Promise.all([le(e),ie(e),se(e),Ye().catch(()=>null)]).then(([e,n,r,i])=>{if(t)return;b(e),M(n),B(r),Ut(i?.agents??[]),Gt(e.defaultAgentId??``);let a={name:e.name,description:e.description??``,status:e.status,defaultAgentId:e.defaultAgentId??``,workspaceRoot:e.workspaceRoot??``,brief:e.brief??``,instructions:e.instructions??``};Tn.current=a,wn(a)}).catch(e=>{t||Z(e instanceof Error?e.message:String(e))}).finally(()=>{t||qt(!1)}),()=>{t=!0}},[e]);let $=(0,Y.useCallback)(async()=>{e&&M(await ie(e))},[e]);(0,Y.useEffect)(()=>{let t,n=n=>{let r=vt.safeParse(n.detail);!r.success||r.data.projectId!==e||(window.clearTimeout(t),t=window.setTimeout(()=>void $(),120))},r=n=>{let r=Ve.safeParse(n.detail);!r.success||r.data.projectId!==e||(window.clearTimeout(t),t=window.setTimeout(()=>void $(),120))};return window.addEventListener(`task-changed-v2`,n),window.addEventListener(`task-deleted-v1`,r),()=>{window.clearTimeout(t),window.removeEventListener(`task-changed-v2`,n),window.removeEventListener(`task-deleted-v1`,r)}},[e,$]);let qn=(0,Y.useCallback)(async(e,t)=>{_n(e.id),Z(null);try{let n=await be(e.id),r=t.startsWith(`move_`)?{type:`move`,phase:t.slice(5)}:t.startsWith(`reopen_`)?{type:`reopen`,phase:t.slice(7)}:t===`ready`?{type:`mark_ready`}:t===`run`?{type:`start`,executor:{kind:`agent`,agentId:n.task.delegateAgentId??(await we(e.id)).agentId}}:t===`pause`?{type:`add_wait`,wait:{kind:`paused`,reason:`Paused by user`,condition:{}}}:t===`review`?{type:`request_review`}:t===`complete`?{type:`close`,resolution:`done`}:t===`reopen`?{type:`reopen`,phase:`ready`}:{type:`resolve_wait`,waitId:n.waits[0]?.id??``};if(r.type===`resolve_wait`&&!r.waitId)throw Error(`No active wait to resolve`);return await ce(e.id,r,n.task.version),await $(),!0}catch(e){return await $().catch(()=>void 0),Z(e instanceof Error?e.message:p.board.actionFailed),!1}finally{_n(null)}},[j,p.board.actionFailed,$]),$n=(0,Y.useCallback)(async t=>{e&&(Z(null),await ve({idempotencyKey:t.requestId,title:t.objective,projectId:e,priority:t.priority,dueAt:t.dueAt,locale:l,contract:{objective:t.objective,expectedOutputs:[],acceptanceCriteria:[],constraints:[],approvalRequired:[],assumptions:[],risks:[],acceptancePolicy:`manual`,outputDestinations:[]},dependencies:t.dependsOnTaskIds,context:t.attachments.map((e,t)=>({targetKind:`file`,targetId:e.uri??e.name??`attachment-${t+1}`,role:`input`,title:e.name,pinned:!0,retrievalPolicy:{},metadata:{mimeType:e.mimeType,size:e.size,data:e.data}})),authorityGrants:[],activation:{mode:`capture`,phase:`backlog`}}),await $())},[l,e,$]),ir=(0,Y.useCallback)(async(e,t)=>{_n(e),Z(null);try{return await Ne(e,t,(await be(e)).task.version),await $(),!0}catch(e){return await $().catch(()=>void 0),Z(e instanceof Error?e.message:p.board.actionFailed),!1}finally{_n(null)}},[p.board.actionFailed,$]),ar=(0,Y.useCallback)(async(e,t,n)=>{_n(e),Z(null);try{let r=await be(e);return r.task.phase!==t&&(r=await ce(e,r.task.phase===`closed`?{type:`reopen`,phase:t===`closed`?`ready`:t}:t===`closed`?{type:`close`,resolution:`done`}:{type:`move`,phase:t},r.task.version)),await Ne(e,n,r.task.version),await $(),!0}catch(e){return await $().catch(()=>void 0),Z(e instanceof Error?e.message:p.board.actionFailed),!1}finally{_n(null)}},[p.board.actionFailed,$]),or=(0,Y.useCallback)(async(e,t)=>{_n(e),Z(null);try{await _e(e,t,(await be(e)).task.version),await $()}catch(e){await $().catch(()=>void 0),Z(e instanceof Error?e.message:p.board.actionFailed)}finally{_n(null)}},[p.board.actionFailed,$]),sr=(0,Y.useCallback)(async t=>{if(e){Z(null);try{await Oe(e,t),await $()}catch(e){throw Z(e instanceof Error?e.message:p.board.actionFailed),e}}},[p.board.actionFailed,e,$]),cr=(0,Y.useCallback)(async()=>{if(y){ge(!0),Z(null);try{let e=await fe(y.id,{includeRelated:Se,limit:100});q(e.items),de(e.total)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{ge(!1)}}},[y,Se]);(0,Y.useEffect)(()=>{Q===`progress`&&cr()},[cr,Q]);let lr=(0,Y.useCallback)(async()=>{if(!y?.effectiveWorkspaceRoot?.trim()){Le([]),ze.current.clear(),Vt(null);return}zt(!0),Vt(null),ze.current.clear();try{Le(tr((await he(y.id,``)).entries)),ze.current.add(``)}catch(e){Le([]),ze.current.clear(),Vt(e instanceof Error?e.message:String(e))}finally{zt(!1)}},[y]),ur=(0,Y.useCallback)(async e=>{if(!(!y?.effectiveWorkspaceRoot?.trim()||ze.current.has(e))){ze.current.add(e),Vt(null);try{let t=await he(y.id,e);Le(n=>nr(n,e,tr(t.entries)))}catch(t){ze.current.delete(e),Vt(t instanceof Error?t.message:String(t))}}},[y]);(0,Y.useEffect)(()=>{Q===`files`&&lr()},[lr,Q]);let dr=kt.trim();(0,Y.useEffect)(()=>{if(Q!==`files`||!y||!St||!dr){Nt([]),Ft(!1),Lt(null);return}let e=!1;Ft(!0),Lt(null),Nt([]);let t=window.setTimeout(()=>{Te(y.id,dr,50).then(t=>{e||Nt(t)}).catch(t=>{e||Lt(t instanceof Error?t.message:String(t))}).finally(()=>{e||Ft(!1)})},180);return()=>{e=!0,window.clearTimeout(t)}},[dr,y,St,Q]);let fr=(0,Y.useCallback)(async()=>{if(y){pn(!0),Z(null);try{let e=await V(y.id);Nn(`sessions`,`/chat/${encodeURIComponent(e.key)}`)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{pn(!1)}}},[Nn,y]),pr=(0,Y.useCallback)(async()=>{if(!y)return;let[e,t]=await Promise.all([le(y.id),ie(y.id)]);M(t),b(e)},[y]),mr=(0,Y.useCallback)(async e=>{if(e.preventDefault(),!(!y||!xn.title.trim())){hn(!0),Z(null);try{await tt(y.id,{title:xn.title.trim(),reason:xn.reason.trim()||void 0}),Sn({title:``,reason:``}),await pr()}catch(e){Z(e instanceof Error?e.message:String(e))}finally{hn(!1)}}},[xn.reason,xn.title,y,pr]),hr=(0,Y.useMemo)(()=>(0,X.jsx)(s,{to:Dn,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":Dn===`/projects`?p.backToProjects:u.sidebar.back,children:(0,X.jsx)(at,{className:`size-4`,"aria-hidden":!0})}),[Dn,u.sidebar.back,p.backToProjects]),gr=(0,Y.useMemo)(()=>y?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(D,{asChild:!0,variant:`secondary`,className:`h-9 rounded-lg`,children:(0,X.jsxs)(s,{to:`/workflows?tab=library&projectId=${encodeURIComponent(y.id)}`,children:[(0,X.jsx)(ut,{className:`size-4`,"aria-hidden":!0}),p.common.runWorkflow]})}),(0,X.jsxs)(D,{variant:`secondary`,className:`h-9 rounded-lg`,onClick:jn,children:[(0,X.jsx)(C,{className:`size-4`,"aria-hidden":!0}),p.board.create]}),(0,X.jsxs)(D,{variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>void fr(),disabled:fn,children:[(0,X.jsx)(W,{className:`size-4`,"aria-hidden":!0}),p.common.newChat]})]}):null,[jn,p.board.create,p.common.newChat,p.common.runWorkflow,y,fr,fn]);(0,Y.useLayoutEffect)(()=>(g({startExtra:hr,main:y?(0,X.jsx)(rr,{currentProject:y,pm:p,projectsText:h,wd:d}):(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:p.fallbackTitle}),(0,X.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:p.fallbackContext})]}),end:gr}),()=>_()),[_,gr,hr,p,y,h,g,d]);function _r(e){b(t=>t?{...t,...e}:null),Gt(e.defaultAgentId??``),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}async function vr(e=Tn.current){if(!(!y||!Fn(e,y))){Z(null),en(null);try{let t=await xe(y.id,{name:e.name.trim(),status:e.status,description:e.description,defaultAgentId:e.defaultAgentId,brief:e.brief,instructions:e.instructions});_r(t);let n=Tn.current,r={...n,name:n.name===e.name?t.name:n.name,description:n.description===e.description?t.description??``:n.description,status:n.status===e.status?t.status:n.status,defaultAgentId:n.defaultAgentId===e.defaultAgentId?t.defaultAgentId??``:n.defaultAgentId,brief:n.brief===e.brief?t.brief??``:n.brief,instructions:n.instructions===e.instructions?t.instructions??``:n.instructions};Tn.current=r,wn(r)}catch(e){let t=Jn(e);throw t?en(t):Z(e instanceof Error?e.message:String(e)),e}}}function yr(e){e.preventDefault(),Mr.flush()}function br(e,t=!1){let n={...Tn.current,...e};Tn.current=n,wn(n),t&&Mr.saveNow(n)}let xr=(0,Y.useCallback)(()=>{if(!y)return;let e=y.workspaceRoot?.trim()??``;an(e?`fixed`:`follow`),sn(e||y.effectiveWorkspaceRoot||``),nn(!0)},[y]);async function Sr(e={}){if(!y)return;let t=rn===`fixed`?on.trim():``;if(!(rn===`fixed`&&!t)){Xt(!0),Z(null),en(null);try{let n=await xe(y.id,{workspaceRoot:t,...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}});_r(n),br({workspaceRoot:n.workspaceRoot??``}),nn(!1),en(null)}catch(e){let t=Jn(e);t?(en(t),nn(!1)):Z(e instanceof Error?e.message:String(e))}finally{Xt(!1)}}}async function Cr(){if(!(!y||cn)){ln(`pin`),Z(null);try{_r(y.pinnedAt?await G(y.id):await ye(y.id))}catch(e){Z(e instanceof Error?e.message:String(e))}finally{ln(null)}}}async function wr(){if(!(!y||cn)){ln(`archive`),Z(null);try{let e=y.status===`archived`?await xt(y.id):await re(y.id);_r(e),br({status:e.status})}catch(e){Z(e instanceof Error?e.message:String(e))}finally{ln(null)}}}async function Tr(){if(y){dn(!0),Z(null);try{await et(y.id),Qt(!1),r(`/projects`)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{dn(!1)}}}async function Er(){if(!(!y||je)){Pe(!0),Z(null);try{await U(y.id)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Pe(!1)}}}let Dr=(0,Y.useCallback)(e=>{$e(e)},[]),Or=(0,Y.useCallback)((e,t)=>{t||$e(e)},[]),kr=(0,Y.useCallback)(async(e,t,n)=>{let r=y?.id;if(r)switch(e){case`preview`:t.isDirectory||$e(t.path);break;case`download`:if(t.isDirectory)return;try{let e=ht(t.path);if(nt(lt(e))!==`text`){let n=await We(t.path,{projectId:r}),i=te(e)??`application/octet-stream`;_t(e,await n.arrayBuffer(),i)}else{let{content:n}=await dt(t.path,{projectId:r});Be(e,n)}}catch(e){Je(`warning`,e instanceof Error?e.message:String(e),void 0,{duration:4e3})}break;case`copyPath`:try{await O(t.absolutePath??t.path)&&Je(`success`,u.workspace.pathCopied,void 0,{duration:2500})}catch{Je(`warning`,u.clipboard.copyFailed,void 0,{duration:4e3})}break;case`openDefault`:if(!t.absolutePath||!window.electronAPI?.shell?.openPath)return;await window.electronAPI.shell.openPath(t.absolutePath);break;case`openWith`:if(!t.absolutePath||!window.electronAPI?.shell?.chooseAppAndOpenPath)return;await window.electronAPI.shell.chooseAppAndOpenPath(t.absolutePath);break;case`openWithApp`:if(!t.absolutePath||!n||!window.electronAPI?.shell?.openPathWithApp)return;await window.electronAPI.shell.openPathWithApp(t.absolutePath,n);break;case`revealInFolder`:if(!t.absolutePath||!window.electronAPI?.shell?.showItemInFolder)return;await window.electronAPI.shell.showItemInFolder(t.absolutePath);break;default:break}},[u.clipboard.copyFailed,u.workspace.pathCopied,y?.id]),Ar=(0,Y.useCallback)(e=>{if(!window.matchMedia(`(min-width: 1024px)`).matches)return;e.preventDefault();let t=e.currentTarget,n=t.closest(`[data-project-files-grid]`);if(!n)return;t.setPointerCapture(e.pointerId),bt(!0);let r=e.clientX,i=st,a=e.pointerId,o=0,s=i,c=i,l=()=>{o=0,c=s,n.style.setProperty(`--project-files-panel-width`,`${c}px`)},u=e=>{s=In(i+(e.clientX-r)),o===0&&(o=window.requestAnimationFrame(l))},d=()=>{o!==0&&(window.cancelAnimationFrame(o),l());try{t.releasePointerCapture(a)}catch{}bt(!1),pt(c),Rn(c),window.removeEventListener(`pointermove`,u),window.removeEventListener(`pointerup`,d),window.removeEventListener(`pointercancel`,d)};window.addEventListener(`pointermove`,u),window.addEventListener(`pointerup`,d),window.addEventListener(`pointercancel`,d)},[st]);(0,Y.useEffect)(()=>{Q!==`files`&&$e(null)},[e,Q]);let jr=!!(y&&Fn(Cn,y)),Mr=Et({value:y?Cn:null,dirty:jr,onSave:vr,validate:e=>e.name.trim()?null:p.settings.nameRequired});if(Kt)return(0,X.jsx)(`main`,{className:`w-full flex-1 p-3 text-sm text-fg-muted sm:px-5 sm:py-4 xl:px-6`,children:p.loading});if(!y)return(0,X.jsxs)(`main`,{className:`w-full flex-1 p-3 sm:px-5 sm:py-4 xl:px-6`,children:[(0,X.jsxs)(s,{to:Dn,className:`inline-flex items-center gap-2 text-sm text-accent-fg hover:underline`,children:[(0,X.jsx)(at,{className:`size-4`,"aria-hidden":!0}),Dn===`/projects`?p.backToProjects:u.sidebar.back]}),(0,X.jsx)(`p`,{className:`mt-6 rounded-lg bg-surface-panel p-4 shadow-surface text-sm text-fg-muted`,children:bn||p.notFound})]});let Nr=P.slice(0,6),Pr=j?.blockers??[],Fr=j?.tasks.filter(e=>e.phase!==`closed`)??[],Ir=e=>p.statuses[e]??e,Lr=e=>Bn(p.common.messages,{count:e}),Rr=H.trim().toLowerCase(),zr=Rr?P.filter(e=>{let t=Vn(e.updatedAt),n=e.routing?.agentId||e.agentId||p.common.agent,r=e.name?.trim()||p.sessions.fallbackTitle,i=Lr(e.messageCount??0),a=Qn(e);return[r,e.key,n,a,t,i].filter(Boolean).join(` `).toLowerCase().includes(Rr)}):P,Br=P.length>0&&zr.length===0,Vr=Ht.find(e=>e.id===y.defaultAgentId)?.name||y.defaultAgentId||p.settings.globalDefaultAgent,Hr=Ht.find(e=>e.id===Cn.defaultAgentId),Ur=y.workspaceRoot?.trim()||``,Wr=y.status===`archived`,Gr=!!y.pinnedAt,Kr=!Ur,qr=Ur||Hr?.workspace||y.effectiveWorkspaceRoot||p.common.defaultWorkspace,Jr=rn===`fixed`?on.trim()||p.settings.workspacePlaceholder:Hr?.workspace||y.effectiveWorkspaceRoot||p.common.defaultWorkspace,Yr=(rn===`fixed`?on.trim():``)!==Ur&&(rn===`follow`||!!on.trim()),Xr=[{id:`overview`,icon:ae,label:p.tabs.overview},{id:`tasks`,icon:yt,label:p.tabs.tasks},{id:`automations`,icon:Ke,label:p.tabs.automations},{id:`files`,icon:Re,label:p.tabs.files},{id:`notes`,icon:Qe,label:p.tabs.notes},{id:`skills`,icon:K,label:p.tabs.skills},{id:`sessions`,icon:W,label:p.tabs.sessions},{id:`progress`,icon:Ue,label:p.tabs.progress}];async function Zr(){if(!qr)return;let e=await O(qr);Je(e?`success`:`warning`,e?u.workspace.pathCopied:u.clipboard.copyFailed,void 0,{duration:e?2500:4e3})}function Qr(){en(null),nn(!0)}return(0,X.jsxs)(`main`,{className:`flex h-full min-h-0 w-full flex-1 flex-col overflow-hidden p-3 sm:px-5 sm:py-4 xl:px-6`,children:[(0,X.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3`,children:[(0,X.jsx)(Dt,{items:Xr,activeTab:Q,onChange:An,ariaLabel:p.navAria,tabIdPrefix:`project-primary-tab`,className:`min-w-0 flex-1`}),(0,X.jsxs)(D,{id:`project-primary-tab-settings`,type:`button`,variant:Q===`settings`?`secondary`:`ghost`,className:`h-9 shrink-0 rounded-lg px-3`,"aria-current":Q===`settings`?`page`:void 0,onClick:()=>An(`settings`),children:[(0,X.jsx)(Me,{className:`size-4`,"aria-hidden":!0}),p.tabs.settings,jr?(0,X.jsx)(`span`,{className:`size-1.5 rounded-full bg-amber-500`,"aria-label":p.settings.unsavedChanges}):null]})]}),bn?(0,X.jsx)(`p`,{className:`mt-3 shrink-0 rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:bn}):null,(0,X.jsxs)(`div`,{className:E(`mt-3 min-h-0 flex-1`,Q===`overview`?`overflow-y-auto pr-1 [scrollbar-gutter:stable] xl:overflow-hidden xl:pr-0`:Q===`tasks`?`overflow-hidden`:`overflow-y-auto pr-1 [scrollbar-gutter:stable]`),children:[Q===`overview`?(0,X.jsxs)(`section`,{id:`project-panel-overview`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-overview`,className:`grid min-h-full gap-4 xl:h-full xl:min-h-0 xl:grid-cols-[minmax(0,1fr)_20rem] xl:overflow-hidden`,children:[(0,X.jsxs)(`div`,{className:`grid min-w-0 content-start gap-4 xl:min-h-0 xl:overflow-y-auto xl:pr-1 xl:[scrollbar-gutter:stable]`,children:[(0,X.jsx)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel p-4 shadow-surface`,children:(0,X.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.overview.directionTitle}),(0,X.jsx)(`p`,{className:`mt-1 max-w-3xl text-sm leading-6 text-fg-muted`,children:y.outcome||j?.digest.summary||y.description||y.brief||p.overview.directionFallback}),j?.digest.recommendedAction?(0,X.jsx)(`p`,{className:`mt-2 max-w-3xl text-sm font-medium leading-6 text-fg`,children:Bn(p.overview.recommendedNext,{action:j.digest.recommendedAction})}):null]}),(0,X.jsx)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:(0,X.jsxs)(D,{type:`button`,variant:`secondary`,onClick:()=>void Er(),disabled:je,children:[(0,X.jsx)(He,{className:`size-4`,"aria-hidden":!0}),je?p.overview.savingDigest:p.overview.saveDigest]})})]})}),(0,X.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel shadow-surface`,children:[(0,X.jsx)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.overview.nextActions})}),(0,X.jsx)(`div`,{className:`divide-y divide-edge`,children:Fr.length?Fr.map(e=>(0,X.jsxs)(s,{to:De(On(`overview`),e.id),className:`block px-4 py-3 hover:bg-surface-hover`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,X.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title}),(0,X.jsxs)(`span`,{className:`shrink-0 rounded-full bg-surface-muted px-2 py-0.5 text-xs font-medium text-fg-muted`,children:[e.phase,` · `,e.operationalState]})]}),e.attention[0]?(0,X.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm leading-5 text-fg-muted`,children:e.attention[0].summary}):null]},e.id)):(0,X.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:p.overview.noNextActions})})]}),j?.recentResults.length?(0,X.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel shadow-surface`,children:[(0,X.jsx)(`div`,{className:`border-b border-edge px-4 py-3`,children:(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.overview.recentResults})}),(0,X.jsx)(`div`,{className:`divide-y divide-edge`,children:j.recentResults.slice(0,5).map(({taskId:e,taskTitle:t,receipt:n})=>(0,X.jsxs)(s,{to:De(On(`overview`),e),className:`block px-4 py-3 hover:bg-surface-hover`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,X.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:t}),(0,X.jsxs)(`span`,{className:`shrink-0 rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg-muted`,children:[n.status,` · `,n.verification.status]})]}),(0,X.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm leading-5 text-fg-muted`,children:n.summary})]},n.runId))})]}):null,(0,X.jsxs)(`div`,{className:`grid min-w-0 gap-4 md:grid-cols-2`,children:[(0,X.jsxs)(`div`,{className:`rounded-lg bg-surface-panel shadow-surface`,children:[(0,X.jsx)(`div`,{className:`border-b border-edge px-4 py-3`,children:(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.overview.milestones})}),(0,X.jsx)(`div`,{className:`divide-y divide-edge`,children:y.milestones.length?y.milestones.map(e=>(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-4 py-3`,children:[(0,X.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title}),(0,X.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:e.status})]},e.id)):(0,X.jsx)(`p`,{className:`px-4 py-5 text-sm text-fg-muted`,children:p.overview.noMilestones})})]}),(0,X.jsxs)(`div`,{className:`rounded-lg bg-surface-panel shadow-surface`,children:[(0,X.jsx)(`div`,{className:`border-b border-edge px-4 py-3`,children:(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.overview.projectUpdates})}),(0,X.jsx)(`div`,{className:`divide-y divide-edge`,children:y.recentUpdates.length?y.recentUpdates.slice(0,3).map(e=>(0,X.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,X.jsx)(`p`,{className:`text-sm leading-5 text-fg`,children:e.summary}),(0,X.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.health})]},e.id)):(0,X.jsx)(`p`,{className:`px-4 py-5 text-sm text-fg-muted`,children:p.overview.noProjectUpdates})})]})]})]}),(0,X.jsxs)(`aside`,{className:`grid min-w-0 content-start gap-4 xl:min-h-0 xl:overflow-y-auto xl:pr-1 xl:[scrollbar-gutter:stable]`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.overview.attention}),Pr.length?(0,X.jsx)(`div`,{className:`mt-3 grid gap-3`,children:Pr.map(e=>{let t=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,X.jsx)(Ee,{className:`size-4 text-amber-600 dark:text-amber-300`,"aria-hidden":!0}),(0,X.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title})]}),(0,X.jsxs)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:[p.overview.attentionKinds[e.kind]??e.kind,e.detail?` · ${e.detail}`:e.status?` · ${Ir(e.status)}`:``]})]});return e.href?(0,X.jsx)(s,{to:e.href,onClick:Pn(Kn(e.href)),className:`min-w-0 rounded-md bg-surface-base p-3 hover:bg-surface-hover`,children:t},e.id):(0,X.jsx)(`div`,{className:`min-w-0 rounded-md bg-surface-base p-3`,children:t},e.id)})}):(0,X.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:p.overview.noBlockedTasks}),(0,X.jsxs)(`form`,{onSubmit:mr,className:`mt-4 flex gap-2 border-t border-edge pt-4`,children:[(0,X.jsx)(`input`,{className:`min-h-9 min-w-0 flex-1 rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,value:xn.title,onChange:e=>Sn(t=>({...t,title:e.target.value})),placeholder:p.overview.blockerTitlePlaceholder}),(0,X.jsx)(D,{type:`submit`,variant:`secondary`,className:`shrink-0 rounded-lg px-3`,disabled:mn||!xn.title.trim(),"aria-label":mn?p.overview.addingBlocker:p.overview.addBlocker,title:mn?p.overview.addingBlocker:p.overview.addBlocker,children:(0,X.jsx)(C,{className:`size-4`,"aria-hidden":!0})})]})]}),(0,X.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel shadow-surface`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,X.jsx)(pe,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,X.jsx)(`h2`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:p.overview.recentSessions})]}),(0,X.jsx)(`button`,{type:`button`,className:`shrink-0 text-xs font-medium text-accent-fg hover:underline`,onClick:()=>An(`sessions`),children:p.common.viewAll})]}),(0,X.jsx)(`div`,{className:`divide-y divide-edge`,children:Nr.length?Nr.map(e=>(0,X.jsxs)(s,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:Pn(`sessions`),className:`block px-4 py-3 hover:bg-surface-hover`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,X.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.name||e.key}),(0,X.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:Vn(e.updatedAt)})]}),(0,X.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:e.agentId||p.common.agent})]},e.key)):(0,X.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:p.overview.noSessions})})]})]})]}):null,Q===`tasks`?(0,X.jsx)(kn,{ref:vn,tasks:j?.tasks??[],dependencyEdges:j?.dependencyEdges??[],monitoring:j?.monitoring??{projectId:e??``,mode:`observe`,allowedActions:[],confidenceThreshold:.75,scenarios:[],configured:!1},returnTo:On(`tasks`),copy:p.board,onAction:qn,onReorder:ir,onUndoMove:ar,onDependenciesChange:or,onMonitoringChange:sr,onCreate:$n,actionBusyId:gn}):null,Q===`automations`?(0,X.jsx)(`section`,{id:`project-panel-automations`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-automations`,className:`grid min-h-full content-start gap-4`,children:(0,X.jsx)(At,{projectId:y.id,embedded:!0,title:p.automations.title,subtitle:p.automations.hint})}):null,Q===`notes`?(0,X.jsx)(`section`,{id:`project-panel-notes`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-notes`,className:`flex h-full min-h-[28rem] overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:(0,X.jsx)(wt,{selectedNoteId:n,basePath:`/projects/${encodeURIComponent(y.id)}/notes`,showLibrary:!1,allowMediaCapture:!1,projectId:y.id,listTitle:p.notes.title,listDescription:p.notes.hint,emptyText:p.notes.emptyTitle,emptyDescription:p.notes.emptyDescription,listWidthStorageKey:`xopc.projectNotes.listWidth.${y.id}`})}):null,Q===`skills`?(0,X.jsx)(Yt,{projectId:y.id,copy:p.skills}):null,Q===`files`?(0,X.jsx)(`section`,{id:`project-panel-files`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-files`,className:`flex h-full min-h-[28rem] flex-col`,children:(0,X.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:y.effectiveWorkspaceRoot?(0,X.jsxs)(`div`,{"data-project-files-grid":!0,className:E(`grid min-h-0 flex-1 grid-cols-1 overflow-hidden lg:grid-cols-[var(--project-files-panel-width)_6px_minmax(0,1fr)]`,mt&&`cursor-col-resize select-none`),style:{"--project-files-panel-width":`${st}px`},children:[(0,X.jsxs)(`aside`,{className:`flex min-h-0 flex-col border-b border-edge lg:border-b-0 lg:border-r`,children:[(0,X.jsxs)(`div`,{className:`flex h-11 items-center gap-1 border-b border-edge bg-surface-muted/50 px-3 text-sm`,children:[(0,X.jsx)(Ae,{workspacePath:qr}),(0,X.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-1`,children:[(0,X.jsx)(`button`,{type:`button`,className:E(`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,St&&`bg-surface-hover text-fg`),onClick:()=>Ct(!0),"aria-label":p.files.search,title:p.files.search,"aria-pressed":St,children:(0,X.jsx)(w,{className:`size-3.5`,"aria-hidden":!0})}),(0,X.jsx)(Ze,{className:`size-7 shrink-0 rounded-md p-0`,loading:Rt,label:u.cron.refresh,onClick:()=>void lr()})]})]}),St?(0,X.jsx)(`div`,{className:`shrink-0 border-b border-edge bg-surface-muted/40 px-3 py-2`,children:(0,X.jsxs)(`div`,{className:`flex h-8 items-center gap-2 rounded-md border border-edge bg-surface-panel px-2 focus-within:border-accent focus-within:ring-2 focus-within:ring-accent/20`,children:[(0,X.jsx)(w,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,X.jsx)(`input`,{type:`text`,role:`searchbox`,value:kt,onChange:e=>jt(e.target.value),placeholder:p.files.searchPlaceholder,"aria-label":p.files.searchPlaceholder,className:`min-w-0 flex-1 bg-transparent text-xs text-fg outline-none placeholder:text-fg-subtle`}),(0,X.jsx)(`button`,{type:`button`,className:`flex size-6 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":p.files.clearSearch,title:p.files.clearSearch,onClick:()=>{jt(``),Ct(!1)},children:(0,X.jsx)(T,{className:`size-3.5`,"aria-hidden":!0})})]})}):null,Bt?(0,X.jsx)(`div`,{className:`border-b border-edge bg-red-500/10 px-4 py-3 text-sm text-red-700 dark:text-red-300`,children:Bt}):null,dr?(0,X.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto py-2`,children:Pt?(0,X.jsxs)(`div`,{className:`space-y-2 px-3 py-1`,children:[(0,X.jsx)(ct,{className:`h-11 w-full`}),(0,X.jsx)(ct,{className:`h-11 w-full`}),(0,X.jsx)(ct,{className:`h-11 w-full`})]}):It?(0,X.jsxs)(`p`,{className:`px-3 py-2 text-xs text-red-600 dark:text-red-400`,children:[u.workspace.loadError,`: `,It]}):Mt.length===0?(0,X.jsx)(`p`,{className:`px-3 py-2 text-xs text-fg-muted`,children:p.files.noSearchResults}):Mt.map(e=>(0,X.jsxs)(`button`,{type:`button`,className:E(`flex w-full min-w-0 items-center gap-2 px-3 py-2 text-left hover:bg-surface-hover`,Xe===e.path&&`bg-accent-soft text-accent-fg`),onClick:()=>$e(e.path),title:e.path,children:[(0,X.jsx)(Qe,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,X.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`span`,{className:`block truncate text-sm text-fg`,children:e.name}),(0,X.jsx)(`span`,{className:`block truncate text-xs text-fg-subtle`,children:e.path})]})]},e.path))}):Rt&&Fe.length===0?(0,X.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:p.files.loading}):(0,X.jsx)(ot,{tree:Fe,selectedPath:Xe,onSelectFile:Dr,onSelectEntry:Or,onExpandDir:e=>void ur(e),onAction:kr,actionLabels:{preview:u.workspace.preview,download:u.workspace.download,copyPath:u.workspace.copyPath,openDefault:u.workspace.openSystemApp,openWith:u.workspace.openWith,revealInFolder:u.workspace.revealInFolder,recommendedApps:u.workspace.recommendedApps},emptyHint:p.files.emptyDirectory})]}),(0,X.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":p.files.resizeHandle,className:E(`hidden cursor-col-resize touch-none items-stretch justify-center bg-surface-panel transition-colors hover:bg-surface-hover lg:flex`,mt&&`bg-surface-hover`),onPointerDown:Ar,children:(0,X.jsx)(`div`,{className:`my-3 w-px rounded-full bg-edge-strong/70`})}),(0,X.jsx)(`div`,{className:`min-h-0 min-w-0 overflow-hidden bg-surface-base`,children:Xe?(0,X.jsx)(Ce,{filePath:Xe,projectId:y.id,agentId:y.defaultAgentId||Wt||void 0,onClose:()=>$e(null)}):(0,X.jsx)(`div`,{className:`flex h-full min-h-[18rem] items-center justify-center px-6 text-center`,children:(0,X.jsxs)(`div`,{className:`max-w-sm`,children:[(0,X.jsx)(Re,{className:`mx-auto size-8 text-fg-subtle`,"aria-hidden":!0}),(0,X.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:p.files.previewEmptyTitle}),(0,X.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:p.files.previewEmptyDescription})]})})})]}):(0,X.jsxs)(`div`,{className:`grid gap-3 px-4 py-8 text-sm text-fg-muted`,children:[(0,X.jsx)(`p`,{children:p.files.needWorkspace}),(0,X.jsx)(`div`,{children:(0,X.jsx)(D,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:()=>An(`settings`),children:p.files.openSettings})})]})})}):null,Q===`sessions`?(0,X.jsxs)(`section`,{id:`project-panel-sessions`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-sessions`,className:`grid min-h-full content-start gap-3`,children:[P.length?(0,X.jsxs)(`label`,{className:`relative flex min-h-9 w-full max-w-lg cursor-text items-center rounded-lg bg-surface-panel py-1.5 pl-9 pr-9 shadow-surface`,children:[(0,X.jsx)(w,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-disabled`,"aria-hidden":!0}),(0,X.jsx)(`input`,{type:`search`,enterKeyHint:`search`,value:H,onChange:e=>ne(e.currentTarget.value),placeholder:p.sessions.searchPlaceholder,"aria-label":p.sessions.searchPlaceholder,className:`min-w-0 flex-1 appearance-none border-0 bg-transparent py-0.5 text-sm leading-normal text-fg caret-current placeholder:text-fg-disabled focus:border-0 focus:shadow-none focus:outline-none focus:ring-0 focus-visible:outline-none`}),H?(0,X.jsx)(`button`,{type:`button`,className:`absolute right-2 top-1/2 inline-flex size-6 -translate-y-1/2 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,"aria-label":p.sessions.clearSearch,onClick:()=>ne(``),children:(0,X.jsx)(T,{className:`size-3.5`,"aria-hidden":!0})}):null]}):null,zr.length?(0,X.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:zr.map(e=>{let t=Vn(e.updatedAt),n=e.routing?.agentId||e.agentId||p.common.agent,r=Qn(e),i=e.name?.trim()||p.sessions.fallbackTitle,a=Lr(e.messageCount??0);return(0,X.jsxs)(s,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:Pn(`sessions`),className:`group flex min-h-[8.75rem] min-w-0 flex-col rounded-lg bg-surface-panel p-4 shadow-surface transition-colors hover:bg-surface-hover/45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,X.jsx)(`span`,{className:`mt-0.5 flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-base text-fg-muted`,children:(0,X.jsx)(W,{className:`size-4`,"aria-hidden":!0})}),(0,X.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,X.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-sm font-semibold text-fg`,children:i}),r?(0,X.jsx)(`span`,{className:`shrink-0 rounded-md bg-surface-base px-2 py-0.5 text-[11px] font-medium leading-5 text-fg-muted`,children:r}):null]})})]}),(0,X.jsxs)(`div`,{className:`mt-auto grid gap-2 pt-4 text-xs text-fg-muted`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,X.jsxs)(`span`,{className:`min-w-0 max-w-full truncate rounded-md bg-surface-base px-2 py-1`,children:[p.sessions.agent,`: `,n]}),(0,X.jsx)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:a})]}),t?(0,X.jsxs)(`span`,{className:`truncate rounded-md bg-surface-base px-2 py-1`,children:[p.sessions.updated,`: `,t]}):null]})]},e.key)})}):Br?(0,X.jsx)(`div`,{className:`grid gap-1 rounded-lg bg-surface-panel px-4 py-8 text-center shadow-surface`,children:(0,X.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:p.sessions.noMatches})}):(0,X.jsx)(`div`,{className:`grid gap-1 rounded-lg bg-surface-panel px-4 py-8 text-center shadow-surface`,children:(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:p.sessions.emptyTitle}),(0,X.jsx)(`p`,{className:`mx-auto mt-1 max-w-md text-sm leading-6 text-fg-muted`,children:p.sessions.emptyDescription})]})})]}):null,Q===`progress`?(0,X.jsxs)(`section`,{id:`project-panel-progress`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-progress`,className:`grid min-h-full content-start gap-3`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.progress.title}),(0,X.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:Bn(p.progress.count,{count:ue})})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsxs)(`label`,{className:`inline-flex min-h-9 items-center gap-2 rounded-lg bg-surface-panel px-3 text-sm text-fg-muted shadow-surface`,children:[(0,X.jsx)(`input`,{type:`checkbox`,checked:Se,onChange:e=>ke(e.currentTarget.checked),className:`size-4 rounded border-edge text-accent focus:ring-accent/30`}),p.progress.includeRelated]}),(0,X.jsxs)(D,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg px-3`,onClick:()=>void cr(),disabled:J,children:[(0,X.jsx)(gt,{className:E(`size-4`,J&&`animate-spin`),"aria-hidden":!0}),p.common.refresh]})]})]}),(0,X.jsx)(`div`,{className:`overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:J&&oe.length===0?(0,X.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:p.progress.loading}):oe.length?(0,X.jsx)(`div`,{className:`divide-y divide-edge`,children:oe.map(e=>{let t=p.progress.types[e.type]??e.type,n=p.progress.objectKinds[e.primaryObject.kind]??e.primaryObject.kind,r=er(e),i=e.relatedProjects.length>0&&!e.scopes.some(e=>e.scopeKind===`project`&&e.scopeId===y.id);return(0,X.jsxs)(`article`,{className:`grid gap-2 px-4 py-3`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-start justify-between gap-3`,children:[(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,X.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:t}),i?(0,X.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-xs font-medium text-fg-muted`,children:p.progress.related}):null]}),(0,X.jsxs)(`p`,{className:`mt-1 min-w-0 truncate text-sm text-fg-muted`,children:[n,`: `,Xn(e)]})]}),(0,X.jsx)(`time`,{className:`shrink-0 text-xs text-fg-subtle`,dateTime:new Date(e.createdAt).toISOString(),children:Vn(e.createdAt)})]}),r?(0,X.jsx)(`p`,{className:`line-clamp-2 text-sm leading-5 text-fg-muted`,children:r}):null,(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2 text-xs text-fg-subtle`,children:[(0,X.jsxs)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:[p.progress.actor,`: `,Yn(e)]}),(0,X.jsxs)(`span`,{className:`max-w-full truncate rounded-md bg-surface-base px-2 py-1`,children:[p.progress.source,`: `,Zn(e)]})]})]},e.id)})}):(0,X.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:p.progress.empty})})]}):null,Q===`settings`?(0,X.jsxs)(`form`,{id:`project-panel-settings`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-settings`,onSubmit:yr,onBlurCapture:Mr.onBlurCapture,className:`grid min-h-full content-start gap-4 pb-1`,children:[(0,X.jsxs)(`section`,{className:`flex min-w-0 items-start justify-between gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.summaryTitle}),(0,X.jsx)(`p`,{className:`mt-1 max-w-3xl text-sm leading-6 text-fg-muted`,children:p.settings.summaryHint})]}),(0,X.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-2`,children:[(0,X.jsx)(`span`,{className:E(`rounded-full px-2 py-0.5 text-xs font-medium`,Hn(Cn.status)),children:p.settings.statuses[Cn.status]}),(0,X.jsx)(Tt,{status:Mr.status,error:Mr.error})]})]}),(0,X.jsxs)(`div`,{className:`grid items-start gap-4 xl:grid-cols-[minmax(0,1fr)_22rem]`,children:[(0,X.jsxs)(`div`,{className:`grid gap-4`,children:[(0,X.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.detailsTitle}),(0,X.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:p.settings.detailsHint})]}),(0,X.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,X.jsx)(Un,{label:p.settings.name,children:(0,X.jsx)(`input`,{className:Wn(),value:Cn.name,onChange:e=>br({name:e.target.value})})}),(0,X.jsx)(Un,{label:p.settings.defaultAgent,children:(0,X.jsxs)(f,{className:Wn(),value:Cn.defaultAgentId,onChange:e=>br({defaultAgentId:e.target.value},!0),children:[(0,X.jsx)(m,{value:``,children:p.settings.globalDefaultAgent}),Ht.map(e=>(0,X.jsx)(m,{value:e.id,children:it(e,u.agentsSettings)},e.id))]})}),(0,X.jsx)(Un,{label:p.settings.status,children:Wr?(0,X.jsx)(`div`,{className:`grid min-h-10 content-center rounded-md border border-edge bg-surface-muted px-3 text-sm text-fg-muted`,children:p.settings.statuses.archived}):(0,X.jsxs)(f,{className:Wn(),value:Cn.status===`archived`?`active`:Cn.status,onChange:e=>br({status:e.target.value},!0),children:[(0,X.jsx)(m,{value:`active`,children:p.settings.statuses.active}),(0,X.jsx)(m,{value:`paused`,children:p.settings.statuses.paused})]})}),(0,X.jsx)(Un,{label:p.settings.description,hint:p.settings.descriptionHint,children:(0,X.jsx)(`textarea`,{className:Wn(!0),value:Cn.description,onChange:e=>br({description:e.target.value})})})]})]}),(0,X.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.projectGuidanceTitle}),(0,X.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:p.settings.projectGuidanceHint})]}),(0,X.jsx)(Un,{label:p.settings.brief,hint:p.settings.briefHint,children:(0,X.jsx)(`textarea`,{className:Wn(!0),value:Cn.brief,onChange:e=>br({brief:e.target.value})})}),(0,X.jsx)(Un,{label:p.settings.instructions,hint:p.settings.instructionsHint,children:(0,X.jsx)(`textarea`,{className:Wn(!0),value:Cn.instructions,onChange:e=>br({instructions:e.target.value})})})]})]}),(0,X.jsxs)(`aside`,{className:`grid gap-4 xl:sticky xl:top-0`,children:[(0,X.jsxs)(`section`,{className:`grid gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.workspaceRoot}),(0,X.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:p.settings.workspaceIndependentHint})]}),(0,X.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,X.jsx)(`span`,{className:`w-fit rounded-md bg-surface-muted px-2 py-0.5 text-xs font-medium text-fg-muted`,children:Kr?p.settings.workspaceModeFollow:p.settings.workspaceModeFixed}),(0,X.jsx)(`div`,{className:`break-all font-mono text-xs leading-5 text-fg`,title:qr,children:qr}),(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,X.jsxs)(D,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:()=>void Zr(),children:[(0,X.jsx)(v,{className:`size-4`,"aria-hidden":!0}),p.settings.copyWorkspacePath]}),(0,X.jsx)(Ae,{workspacePath:qr}),(0,X.jsxs)(D,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:xr,children:[(0,X.jsx)(rt,{className:`size-4`,"aria-hidden":!0}),p.settings.migrateWorkspace]})]})]})]}),(0,X.jsxs)(`section`,{className:`grid gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.currentProjectTitle}),(0,X.jsxs)(`div`,{className:`grid gap-2`,children:[(0,X.jsx)(Gn,{label:p.settings.defaultAgent,value:Vr}),(0,X.jsx)(Gn,{label:p.settings.pinState,value:Gr?p.settings.pinned:p.settings.notPinned}),(0,X.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,X.jsx)(Gn,{label:p.settings.createdAt,value:Vn(y.createdAt)||p.common.never}),(0,X.jsx)(Gn,{label:p.settings.updatedAt,value:Vn(y.updatedAt)||p.common.never})]})]})]}),(0,X.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.managementTitle}),(0,X.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:p.settings.managementHint})]}),(0,X.jsxs)(`div`,{className:`grid gap-3`,children:[(0,X.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:Gr?p.settings.pinnedTitle:p.settings.pinTitle}),(0,X.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:p.settings.pinHint})]}),(0,X.jsxs)(D,{type:`button`,variant:`ghost`,className:`w-fit rounded-lg`,disabled:cn===`pin`,onClick:()=>void Cr(),children:[Gr?(0,X.jsx)(Ge,{className:`size-4`,"aria-hidden":!0}):(0,X.jsx)(ft,{className:`size-4`,"aria-hidden":!0}),Gr?p.settings.unpinProject:p.settings.pinProject]})]}),(0,X.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:Wr?p.settings.restoreTitle:p.settings.archiveTitle}),(0,X.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:Wr?p.settings.restoreHint:p.settings.archiveHint})]}),(0,X.jsxs)(D,{type:`button`,variant:Wr?`primary`:`ghost`,className:`w-fit rounded-lg`,disabled:cn===`archive`,onClick:()=>void wr(),children:[Wr?(0,X.jsx)(gt,{className:`size-4`,"aria-hidden":!0}):(0,X.jsx)(qe,{className:`size-4`,"aria-hidden":!0}),Wr?p.settings.restoreProject:p.settings.archiveProject]})]})]})]}),(0,X.jsxs)(`section`,{className:`grid gap-3 rounded-lg border border-red-500/20 bg-red-500/5 p-4`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-red-700 dark:text-red-300`,children:p.settings.dangerTitle}),(0,X.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-red-700/80 dark:text-red-200/80`,children:p.settings.dangerHint})]}),(0,X.jsxs)(D,{type:`button`,variant:`ghost`,className:`w-fit text-red-600 hover:bg-red-500/10 hover:text-red-700 focus-visible:ring-red-500 dark:text-red-400 dark:hover:text-red-300`,onClick:()=>Qt(!0),children:[(0,X.jsx)(me,{className:`size-4`,"aria-hidden":!0}),p.settings.deleteConfirmAction]})]})]})]})]}):null]}),(0,X.jsx)(ee,{open:Zt,onOpenChange:e=>{un||Qt(e)},children:(0,X.jsxs)(L,{children:[(0,X.jsx)(N,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,X.jsxs)(R,{className:`fixed left-1/2 top-1/2 z-[90] w-[min(28rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-edge bg-surface-panel p-5 shadow-float focus:outline-none`,children:[(0,X.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,X.jsx)(`span`,{className:`mt-0.5 flex size-9 shrink-0 items-center justify-center rounded-lg bg-red-500/10 text-red-600 dark:text-red-400`,children:(0,X.jsx)(Ee,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0})}),(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(z,{className:`text-base font-semibold text-fg`,children:p.settings.deleteConfirmTitle}),(0,X.jsx)(F,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:y?Bn(p.settings.deleteConfirm,{name:y.name}):p.settings.deleteConfirmFallback})]})]}),(0,X.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,X.jsx)(I,{asChild:!0,children:(0,X.jsx)(D,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:un,children:p.common.cancel})}),(0,X.jsxs)(D,{type:`button`,variant:`ghost`,className:`rounded-lg text-red-600 hover:bg-red-500/10 hover:text-red-700 focus-visible:ring-red-500 dark:text-red-400 dark:hover:text-red-300`,disabled:un||!y,onClick:()=>void Tr(),children:[(0,X.jsx)(me,{className:`size-4`,"aria-hidden":!0}),p.settings.deleteConfirmAction]})]})]})]})}),(0,X.jsx)(ee,{open:tn,onOpenChange:e=>{Jt||nn(e)},children:(0,X.jsxs)(L,{children:[(0,X.jsx)(N,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,X.jsxs)(R,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(34rem,calc(100vh-2rem))] w-[min(36rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,X.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,X.jsx)(z,{className:`text-base font-semibold text-fg`,children:p.settings.workspaceMigrationTitle}),(0,X.jsx)(F,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:p.settings.workspaceMigrationDescription})]}),(0,X.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,X.jsxs)(`div`,{className:`grid gap-2 text-sm`,children:[(0,X.jsx)(`span`,{className:`font-medium text-fg-muted`,children:p.settings.workspaceMode}),(0,X.jsxs)(`div`,{className:`grid gap-2 md:grid-cols-2`,children:[(0,X.jsxs)(`label`,{className:E(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2`,rn===`fixed`?`border-accent bg-accent-soft/40 text-fg`:`border-edge bg-surface-base text-fg-muted`),children:[(0,X.jsx)(`input`,{type:`radio`,className:`mt-0.5 size-4`,checked:rn===`fixed`,onChange:()=>an(`fixed`),disabled:Jt}),(0,X.jsxs)(`span`,{className:`min-w-0`,children:[(0,X.jsx)(`span`,{className:`block font-medium`,children:p.settings.workspaceModeFixed}),(0,X.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:p.settings.workspaceMigrationFixedHint})]})]}),(0,X.jsxs)(`label`,{className:E(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2`,rn===`follow`?`border-accent bg-accent-soft/40 text-fg`:`border-edge bg-surface-base text-fg-muted`),children:[(0,X.jsx)(`input`,{type:`radio`,className:`mt-0.5 size-4`,checked:rn===`follow`,onChange:()=>an(`follow`),disabled:Jt}),(0,X.jsxs)(`span`,{className:`min-w-0`,children:[(0,X.jsx)(`span`,{className:`block font-medium`,children:p.settings.workspaceModeFollow}),(0,X.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:p.settings.workspaceHint})]})]})]})]}),rn===`fixed`?(0,X.jsx)(Ot,{value:on,onChange:sn,disabled:Jt,wd:d,placeholder:p.settings.workspacePlaceholder,inputClassName:Wn(),autoFocus:!0}):null,(0,X.jsx)(`div`,{className:`rounded-lg border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-sm leading-6 text-amber-800 dark:text-amber-200`,children:p.settings.workspaceMigrationImpact}),(0,X.jsx)(`div`,{className:`rounded-lg bg-surface-muted px-3 py-2 text-xs leading-5 text-fg-subtle`,children:Bn(p.settings.workspaceCurrent,{workspace:Jr})})]}),(0,X.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,X.jsx)(I,{asChild:!0,children:(0,X.jsx)(D,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:Jt,children:p.common.cancel})}),(0,X.jsxs)(D,{type:`button`,variant:`primary`,className:`rounded-lg`,disabled:Jt||!Yr,onClick:()=>void Sr(),children:[(0,X.jsx)(rt,{className:`size-4`,"aria-hidden":!0}),p.settings.workspaceMigrationConfirm]})]})]})]})}),(0,X.jsx)(ee,{open:!!$t,onOpenChange:e=>{e||en(null)},children:(0,X.jsxs)(L,{children:[(0,X.jsx)(N,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,X.jsxs)(R,{className:`fixed left-1/2 top-1/2 z-[90] flex w-[min(30rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,X.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,X.jsx)(z,{className:`text-base font-semibold text-fg`,children:p.settings.workspaceMissingTitle}),(0,X.jsx)(F,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:$t?Bn(p.settings.workspaceMissingDescription,{workspace:$t}):null})]}),$t?(0,X.jsx)(`div`,{className:`px-5 py-4`,children:(0,X.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-surface-muted px-3 py-2 text-sm text-fg-muted`,children:[(0,X.jsx)(Re,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:$t})]})}):null,(0,X.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,X.jsx)(D,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:Qr,disabled:Jt,children:p.settings.workspaceMissingBack}),(0,X.jsxs)(D,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:()=>void Sr({createWorkspaceRoot:!0}),disabled:Jt,children:[(0,X.jsx)(rt,{className:`size-4`,"aria-hidden":!0}),p.settings.workspaceMissingCreate]})]})]})]})})]})}export{ir as ProjectDetailPage};
|