@xopcai/xopc 0.0.176 → 0.0.178
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-DsFM1upC.js → activity-store-BzGX__8I.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-DvdMLOga.js → agent-avatar-dicebear-BzxntcaZ.js} +1 -1
- package/dist/gateway/static/root/assets/agents-DC9F12Kw.js +2 -0
- package/dist/gateway/static/root/assets/{api-BdPLCCBm.js → api-hi6f2Xtp.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-DMLDOHul.js → app-management-settings-panel-fTY1F7ac.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-DbI9foFR.js → appearance-settings-BZ-IxQfB.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-5bKr05Fa.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-Dfdxuwvb.js → archive-plugin-ZSLLG8wB.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-Dn3RlnYD.js → attachment-load-D4YktqIF.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-suggestion-card-Bc0Y7A9u.js → automation-suggestion-card-B7mxFRtf.js} +1 -1
- package/dist/gateway/static/root/assets/automations-page-Dg6dmt5g.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-0XtB-xC0.js → binary-plugins-BIkPxfxj.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-C4fXWbEE.js → block-editor-Q3v_YQom.js} +6 -6
- package/dist/gateway/static/root/assets/{browser-settings-page-lC86-drr.js → browser-settings-page-BHoo6Rpq.js} +4 -4
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-CZmzNymN.js → browser-workflow-inputs-M5lTEW1I.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-CBYM9HqG.js → browser-workflows-page-B3T1KYk4.js} +2 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-BlsqN8Fu.js +7 -0
- package/dist/gateway/static/root/assets/{capability-presets-api-BiJxmmhW.js → capability-presets-api-DE09c0VB.js} +1 -1
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-DJeT8_B4.js +1 -0
- package/dist/gateway/static/root/assets/{channel-recipient-api-BKTUZDp-.js → channel-recipient-api-CFR5FBfS.js} +1 -1
- package/dist/gateway/static/root/assets/channels-settings-C4VVjYEm.js +1 -0
- package/dist/gateway/static/root/assets/channels-status-swr-vdf8kB16.js +1 -0
- package/dist/gateway/static/root/assets/{connector-logo-Pr4RIKjj.js → connector-logo-B1mD-3pM.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-DNcrDThX.js +2 -0
- package/dist/gateway/static/root/assets/desktop-pet-B1urphOZ.js +1 -0
- package/dist/gateway/static/root/assets/{desktop-pet-settings-CEQacUDF.js → desktop-pet-settings-DTL6J3EP.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-DWnxdZtc.js → directory-picker-path-field-BYQJ2XUS.js} +1 -1
- package/dist/gateway/static/root/assets/{dreaming-settings-D2e2w2Ho.js → dreaming-settings-BXcb8fwx.js} +3 -3
- package/dist/gateway/static/root/assets/{extension-debug-page-BLjTGbv3.js → extension-debug-page-O1Xu1r4Q.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-D2_UC6hy.js → extension-page-C2Jraq8l.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-BsH6o_PX.js → extension-settings-page-DcXQDTpG.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-C-DkC6UJ.js → gateway-config-api-DmPIZrvg.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-DEOGiimF.js → gateway-settings-DmObBx9b.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-BlSLh1TF.js → gateway-startup-retry-BZEkOdPm.js} +1 -1
- package/dist/gateway/static/root/assets/{goal-create-dialog-CSFcRE_N.js → goal-create-dialog-BRhmmBe9.js} +1 -1
- package/dist/gateway/static/root/assets/goal-detail-page-C1k7_s_O.js +4 -0
- package/dist/gateway/static/root/assets/{goals-config-api-CcdS9qek.js → goals-config-api-Fwu1wjEP.js} +1 -1
- package/dist/gateway/static/root/assets/{goals-page-BAcErdch.js → goals-page-hOu9uA3q.js} +2 -2
- package/dist/gateway/static/root/assets/{goals-settings-BY7crl0z.js → goals-settings-DY-JjvHz.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-DtTkS0gs.js → heartbeat-settings-BtKu2NWT.js} +1 -1
- package/dist/gateway/static/root/assets/{image-generation-api-WGgkbwDZ.js → image-generation-api-05Gg8wsU.js} +1 -1
- package/dist/gateway/static/root/assets/{index-2UImfRDC.js → index-C0CGebQ1.js} +65 -65
- package/dist/gateway/static/root/assets/index-eqq25gvV.css +1 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-C5lpWQ3f.js → keyboard-shortcuts-settings-CfmDR9Sc.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-EjsNT7nJ.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-b05wWvXG.js → local-apps-page-Df8BW1A_.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-sToMfHX_.js → locale-store-CTwSy7yW.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-cDE1jLJv.js → logs-page-Dswjlraa.js} +3 -3
- package/dist/gateway/static/root/assets/{markdown-split-0gPVst5y.js → markdown-split-B3FvKbaP.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-Rxyq_KTm.js → media-plugins-DsjrvvB6.js} +1 -1
- package/dist/gateway/static/root/assets/messages-DP6tPKk-.js +3 -0
- package/dist/gateway/static/root/assets/{notes-page-DRhNDl_Q.js → notes-page-tuzIwy3c.js} +1 -1
- package/dist/gateway/static/root/assets/notes-workbench-DSh3-hMY.js +4 -0
- package/dist/gateway/static/root/assets/{page-tabs-cOEOQqHh.js → page-tabs-ke9s4nYi.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-BopOLFvu.js → preview-open-alternatives-Cp1eI4S9.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-DWVPmmOq.js → product-open-page-dXQCMAtH.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-D0QPRHR_.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-CI5Vz62F.js +1 -0
- package/dist/gateway/static/root/assets/remote-access-hub-S1jpzBS5.js +1 -0
- package/dist/gateway/static/root/assets/{save-bar-controls-BfZmKe1t.js → save-bar-controls-Bl30zjHc.js} +1 -1
- package/dist/gateway/static/root/assets/{schedule-field-Cpi4jCRV.js → schedule-field-DqhmXQKo.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-OXFkcZQe.js → schema-form-DkUCy6vf.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-CTm66k7h.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-CU52AUVD.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-BwqkZCHJ.js → settings-form-section-C6ZbNpdy.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-BbqH_S3Y.js → settings-loading-skeleton-Bk58_cr7.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-BoxC-JSa.js → settings-page-k8iE_NdX.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-Ddu2iGaW.js → settings-page-layout-DgFSya2e.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-z1Lwv0js.js → setup-status-panel-B_KDlyZA.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-CVazOFjy.js → share-preview-page-CV7nL_J9.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-DK6XK95e.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-Bvv_u4ii.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-BGHvVbay.js +2 -0
- package/dist/gateway/static/root/assets/{skills-page.utils-DgyB1tSo.js → skills-page.utils-kahBIHg0.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-BoLSQL65.js → system-settings-panel-JV3-MG5F.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-CBNcGOfj.js → theme-store-DFLyzoLO.js} +1 -1
- package/dist/gateway/static/root/assets/{time-picker-gochWrny.js → time-picker-XwpxdZFr.js} +1 -1
- package/dist/gateway/static/root/assets/{typed-models-lib-DvRnr7YB.js → typed-models-lib-60Aqo-UJ.js} +1 -1
- package/dist/gateway/static/root/assets/{use-channel-catalog-CA9BFVB7.js → use-channel-catalog-CnTkHDnw.js} +1 -1
- package/dist/gateway/static/root/assets/user-context-page-DBCMk-Vn.js +1 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-v8tgylEZ.js → voice-api-key-field-CNa8qUgS.js} +1 -1
- package/dist/gateway/static/root/assets/work-discovery-page-C1UIdsCl.js +1 -0
- package/dist/gateway/static/root/assets/work-item-detail-page-DEAQepB8.js +1 -0
- package/dist/gateway/static/root/assets/work-page-D5qYmCTq.js +3 -0
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-CC3cJn5k.js → workflow-run-setup-panel-yV_x595t.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-yrK17ZZ5.js +11 -0
- package/dist/gateway/static/root/index.html +7 -7
- package/dist/package.js +1 -1
- package/dist/src/agent/embedded/model-runtime.js +3 -0
- package/dist/src/agent/embedded/run-for-session.js +18 -5
- package/dist/src/agent/embedded/run-turn.js +6 -3
- package/dist/src/agent/embedded/types.d.ts +2 -0
- package/dist/src/automations/service/automation-service.d.ts +3 -0
- package/dist/src/automations/service/automation-service.js +37 -7
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/gateway/lifecycle.js +1 -1
- package/dist/src/cli/commands/update.js +1 -1
- package/dist/src/connectors/composio-sessions.js +1 -1
- package/dist/src/gateway/hono/routes/home.d.ts +18 -2
- package/dist/src/gateway/hono/routes/home.js +19 -0
- package/dist/src/gateway/hono/routes/index.js +2 -2
- package/dist/src/gateway/hono/routes/local-apps.js +1 -1
- package/dist/src/gateway/hono/routes/proactive.d.ts +4 -0
- package/dist/src/gateway/hono/routes/proactive.js +157 -0
- package/dist/src/gateway/hono/routes/projects.js +2 -2
- package/dist/src/gateway/hono/routes/update.js +2 -2
- package/dist/src/gateway/index.js +1 -1
- package/dist/src/gateway/run-loop.js +1 -1
- package/dist/src/gateway/service.d.ts +10 -1
- package/dist/src/gateway/service.js +36 -36
- package/dist/src/infra/gateway-processes.js +1 -1
- package/dist/src/infra/update-restart.js +1 -1
- package/dist/src/infra/update-runner.js +2 -2
- package/dist/src/infra/update-startup.js +1 -1
- package/dist/src/mcp/channel-bridge.js +1 -1
- package/dist/src/mobile/notification-service.d.ts +1 -0
- package/dist/src/mobile/notification-service.js +38 -18
- package/dist/src/mobile/notification-types.d.ts +2 -2
- package/dist/src/proactive/events/envelope.d.ts +2 -0
- package/dist/src/proactive/events/envelope.js +54 -0
- package/dist/src/proactive/events/publisher.d.ts +4 -0
- package/dist/src/proactive/events/repository.d.ts +9 -0
- package/dist/src/proactive/events/repository.js +62 -0
- package/dist/src/proactive/events/types.d.ts +44 -0
- package/dist/src/proactive/events/types.js +15 -0
- package/dist/src/proactive/execution/agent-executor.d.ts +16 -0
- package/dist/src/proactive/execution/agent-executor.js +104 -0
- package/dist/src/proactive/execution/context.d.ts +31 -0
- package/dist/src/proactive/execution/context.js +72 -0
- package/dist/src/proactive/execution/insight.d.ts +4 -0
- package/dist/src/proactive/execution/insight.js +74 -0
- package/dist/src/proactive/execution/repository.d.ts +23 -0
- package/dist/src/proactive/execution/repository.js +122 -0
- package/dist/src/proactive/execution/types.d.ts +54 -0
- package/dist/src/proactive/execution/types.js +1 -0
- package/dist/src/proactive/execution/worker.d.ts +15 -0
- package/dist/src/proactive/execution/worker.js +96 -0
- package/dist/src/proactive/inbox/repository.d.ts +24 -0
- package/dist/src/proactive/inbox/repository.js +117 -0
- package/dist/src/proactive/inbox/service.d.ts +17 -0
- package/dist/src/proactive/inbox/service.js +22 -0
- package/dist/src/proactive/inbox/types.d.ts +38 -0
- package/dist/src/proactive/inbox/types.js +1 -0
- package/dist/src/proactive/inbox/worker.d.ts +12 -0
- package/dist/src/proactive/inbox/worker.js +56 -0
- package/dist/src/proactive/index.d.ts +17 -0
- package/dist/src/proactive/index.js +11 -0
- package/dist/src/proactive/routing/batch-repository.d.ts +27 -0
- package/dist/src/proactive/routing/batch-repository.js +56 -0
- package/dist/src/proactive/routing/matcher.d.ts +5 -0
- package/dist/src/proactive/routing/matcher.js +56 -0
- package/dist/src/proactive/routing/types.d.ts +44 -0
- package/dist/src/proactive/routing/types.js +1 -0
- package/dist/src/proactive/scenarios/prompt-composer.d.ts +14 -0
- package/dist/src/proactive/scenarios/prompt-composer.js +24 -0
- package/dist/src/proactive/scenarios/repository.d.ts +23 -0
- package/dist/src/proactive/scenarios/repository.js +162 -0
- package/dist/src/proactive/scenarios/service.d.ts +15 -0
- package/dist/src/proactive/scenarios/service.js +26 -0
- package/dist/src/proactive/scenarios/types.d.ts +36 -0
- package/dist/src/proactive/scenarios/types.js +1 -0
- package/dist/src/proactive/service.d.ts +18 -0
- package/dist/src/proactive/service.js +61 -0
- package/dist/src/projects/project-service.d.ts +3 -1
- package/dist/src/projects/project-service.js +62 -32
- package/dist/src/providers/provider-auth-service.js +3 -0
- package/dist/src/providers/register-bundled-oauth-flows.d.ts +2 -0
- package/dist/src/providers/register-bundled-oauth-flows.js +16 -0
- package/dist/src/session/store.d.ts +2 -0
- package/dist/src/session/store.js +30 -0
- package/dist/src/storage/sqlite/migrations/068_proactive_event_spine.sql +71 -0
- package/dist/src/storage/sqlite/migrations/069_proactive_scenario_control.sql +69 -0
- package/dist/src/storage/sqlite/migrations/070_proactive_execution.sql +55 -0
- package/dist/src/storage/sqlite/migrations/071_proactive_inbox.sql +45 -0
- package/dist/src/storage/sqlite/migrations/072_proactive_judgments.sql +14 -0
- package/dist/src/storage/sqlite/migrations/073_enable_default_proactive_scenarios.sql +13 -0
- package/dist/src/storage/sqlite/migrations/074_deduplicate_blocked_work_routing.sql +5 -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/work-discovery/thread-service.d.ts +1 -3
- package/dist/src/work-discovery/thread-service.js +13 -25
- package/dist/src/work-items/work-item-service.d.ts +3 -1
- package/dist/src/work-items/work-item-service.js +67 -36
- package/package.json +3 -11
- package/dist/gateway/static/root/assets/agents-BVjlpbeZ.js +0 -2
- package/dist/gateway/static/root/assets/api-Bop4IQRW.js +0 -1
- package/dist/gateway/static/root/assets/apps-page-njqxLWYD.js +0 -1
- package/dist/gateway/static/root/assets/automations-page-D-eweHZJ.js +0 -6
- package/dist/gateway/static/root/assets/capabilities-settings-panel-6tYNfHqJ.js +0 -7
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-Co-ymbd9.js +0 -1
- package/dist/gateway/static/root/assets/channels-settings-D46eVjaQ.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-BMRAO4zZ.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-Dw1eYbRi.js +0 -2
- package/dist/gateway/static/root/assets/copy-VueTIC2x.js +0 -1
- package/dist/gateway/static/root/assets/desktop-pet-B8cZuQUt.js +0 -1
- package/dist/gateway/static/root/assets/focus-detail-page-BBXUtxRB.js +0 -1
- package/dist/gateway/static/root/assets/goal-detail-page-VjRArfAJ.js +0 -4
- package/dist/gateway/static/root/assets/index-CS9sVShT.css +0 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-Cl0fcPL4.js +0 -2
- package/dist/gateway/static/root/assets/messages-CarlxqXV.js +0 -3
- package/dist/gateway/static/root/assets/notes-workbench-BKNBk0Uf.js +0 -4
- package/dist/gateway/static/root/assets/project-detail-page-BhjEXNQW.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-B80e69PH.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-CwdVob6H.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-BGt3Asj6.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BnTdM9Nn.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-C4lXuyQj.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-DSuIDkeI.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-xgZczqVe.js +0 -2
- package/dist/gateway/static/root/assets/user-context-page-CEfIy4WZ.js +0 -1
- package/dist/gateway/static/root/assets/work-discovery-page-B-3MClaf.js +0 -1
- package/dist/gateway/static/root/assets/work-item-detail-page-CEsFEdax.js +0 -1
- package/dist/gateway/static/root/assets/work-page-CT9AHnq6.js +0 -3
- package/dist/gateway/static/root/assets/workflows-page-C-1-_Zp1.js +0 -11
- package/dist/src/focuses/candidate-repository.d.ts +0 -15
- package/dist/src/focuses/candidate-repository.js +0 -91
- package/dist/src/focuses/index.d.ts +0 -7
- package/dist/src/focuses/index.js +0 -7
- package/dist/src/focuses/insight-repository.d.ts +0 -22
- package/dist/src/focuses/insight-repository.js +0 -77
- package/dist/src/focuses/prompts.d.ts +0 -2
- package/dist/src/focuses/prompts.js +0 -18
- package/dist/src/focuses/reconciler.d.ts +0 -5
- package/dist/src/focuses/reconciler.js +0 -26
- package/dist/src/focuses/repository.d.ts +0 -61
- package/dist/src/focuses/repository.js +0 -214
- package/dist/src/focuses/run-processor.d.ts +0 -18
- package/dist/src/focuses/run-processor.js +0 -162
- package/dist/src/focuses/service.d.ts +0 -42
- package/dist/src/focuses/service.js +0 -241
- package/dist/src/focuses/types.d.ts +0 -89
- package/dist/src/gateway/hono/routes/focuses.d.ts +0 -3
- package/dist/src/gateway/hono/routes/focuses.js +0 -319
- /package/dist/src/{focuses/types.js → proactive/events/publisher.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{d as n}from"./chunk-KS7C4IRE-BMhrPKJC.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-BMhrPKJC.js";import{t as r}from"./notes-workbench-DSh3-hMY.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-Q3v_YQom.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-C0CGebQ1.js","assets/preload-helper-zJ_50EbN.js","assets/Combination-14nmIgxH.js","assets/vendor-react-BOUWij0V.js","assets/dist-CxGUk8J-.js","assets/dist-C230izr8.js","assets/chunk-KS7C4IRE-BMhrPKJC.js","assets/vendor-swr-BIWyz7Rc.js","assets/createLucideIcon-DPHK1VkS.js","assets/check-DUBLcKHA.js","assets/circle-alert-BEjgurr2.js","assets/middleware-Pd0e8Igk.js","assets/locale-store-CTwSy7yW.js","assets/messages-DP6tPKk-.js","assets/cn-JdwAhgNB.js","assets/schemas-DgQq6Z5S.js","assets/product-delivery-BTRT9kCS.js","assets/config-reload-event-Bjh2zoKp.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/gateway-startup-retry-BZEkOdPm.js","assets/activity-store-BzGX__8I.js","assets/theme-store-DFLyzoLO.js","assets/index-eqq25gvV.css","assets/vendor-codemirror--gTq3YAI.js","assets/with-selector-aYPsXwdl.js","assets/block-editor-D4ZIVQbk.css","assets/markdown-editor-BvUebh3C.js","assets/code-editor-D4_k-6QN.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-BMhrPKJC.js";import{t as o}from"./cn-JdwAhgNB.js";import{t as s}from"./messages-DP6tPKk-.js";import{l as c,n as l}from"./locale-store-CTwSy7yW.js";import{i as u}from"./theme-store-DFLyzoLO.js";import{i as d}from"./vendor-swr-BIWyz7Rc.js";import{$n as f,Ac as p,Bc as m,Bo as h,Cc as g,Ci as _,Cl as v,Cr as y,Ei as b,Er as x,Fc as S,Fu as C,Go as w,Ho as T,Ic as E,Iu as D,Jc as O,Js as k,Kl as A,Ks as j,Mc as M,Ns as N,Nt as P,Nu as F,Pc as ee,Qc as I,Rc as L,Rl as te,Si as ne,Sl as re,Ti as ie,To as ae,Tu as oe,U as se,Ul as R,Uo as z,Vo as B,Wo as V,_ as ce,_r as H,ac as U,ar as le,bl as W,br as G,cr as ue,dr as de,ec as fe,er as pe,eu as K,fr as me,gc as he,gr as ge,hc as _e,hl as q,hr as J,is as ve,lr as ye,mr as Y,ns as be,oc as xe,or as Se,pr as Ce,qo as we,qs as Te,rc as Ee,ru as De,sr as Oe,tl as ke,tr as Ae,ur as je,vr as Me,wi as X,wr as Ne,xi as Pe,xr as Fe,yl as Ie,yr as Le,zo as Re,zu as ze}from"./index-C0CGebQ1.js";import{t as Be}from"./automation-suggestion-card-B7mxFRtf.js";var Z=n(),Q=e(t(),1),$=r(),Ve=(0,Q.createContext)(null);function He(){let e=(0,Z.c)(1),t=(0,Q.useContext)(Ve);if(!t){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={openImage:Ue},e[0]=t):t=e[0],t}return t}function Ue(){}function We(e){let t=(0,Z.c)(22),{children:n,closeLabel:r}=e,i=r===void 0?`Close`:r,[a,s]=(0,Q.useState)(null),c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(e,t)=>{s({src:e,alt:t})},t[0]=c):c=t[0];let l=c,u;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(u={openImage:l},t[1]=u):u=t[1];let d=u,f=a!==null,p;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(p=e=>{e||s(null)},t[2]=p):p=t[2];let m;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(z,{className:`fixed inset-0 z-[70] bg-scrim/90 backdrop-blur-sm`}),t[3]=m):m=t[3];let g;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(g=o(`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]=g):g=t[4];let _=a?.alt||`Image preview`,v;t[5]===_?v=t[6]:(v=(0,$.jsx)(w,{className:`sr-only`,children:_}),t[5]=_,t[6]=v);let y;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,$.jsx)(N,{className:`size-5`,"aria-hidden":!0}),t[7]=y):y=t[7];let b;t[8]===i?b=t[9]:(b=(0,$.jsx)(h,{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:y})}),t[8]=i,t[9]=b);let x;t[10]===a?x=t[11]:(x=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]=x);let S;t[12]!==b||t[13]!==x||t[14]!==v?(S=(0,$.jsxs)(V,{children:[m,(0,$.jsxs)(B,{className:g,"aria-describedby":void 0,children:[v,b,x]})]}),t[12]=b,t[13]=x,t[14]=v,t[15]=S):S=t[15];let C;t[16]!==S||t[17]!==f?(C=(0,$.jsx)(Re,{open:f,onOpenChange:p,children:S}),t[16]=S,t[17]=f,t[18]=C):C=t[18];let T;return t[19]!==n||t[20]!==C?(T=(0,$.jsxs)(Ve.Provider,{value:d,children:[n,C]}),t[19]=n,t[20]=C,t[21]=T):T=t[21],T}function Ge(e){let t=(0,Z.c)(15),{noteId:n,attachmentId:r,className:i}=e,[a,s]=(0,Q.useState)(!1),c;t[0]!==r||t[1]!==n?(c=x(n,r),t[0]=r,t[1]=n,t[2]=c):c=t[2];let l=c;if(a){let e;t[3]===i?e=t[4]:(e=o(`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)(re,{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 u;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>s(!0),t[8]=u):u=t[8];let d;t[9]===i?d=t[10]:(d=o(`size-12 shrink-0 rounded-lg border border-edge-subtle bg-surface-hover object-cover`,i),t[9]=i,t[10]=d);let f;return t[11]!==n||t[12]!==l||t[13]!==d?(f=(0,$.jsx)(Ne,{src:l,expectedNoteId:n,alt:``,loading:`lazy`,draggable:!1,onLoadFailed:u,className:d}),t[11]=n,t[12]=l,t[13]=d,t[14]=f):f=t[14],f}var Ke=6e4,qe=36e5,Je=864e5;function Ye(e){let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}function Xe(e,t,n){let r=t-e;if(r<Ke)return n.justNow;if(r<qe){let e=Math.floor(r/Ke);return n.minutesAgo.replace(`{{n}}`,String(e))}let i=Ye(t);if(e>=i)return n.today+` `+new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`});if(e>=i-Je)return n.yesterday+` `+new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`});if(r<7*Je){let e=Math.floor(r/Je);return n.daysAgo.replace(`{{n}}`,String(e))}return new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function Ze(e,t,n){let r=Ye(t);if(e>=r)return n.today;if(e>=r-Je)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 Qe(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}function $e(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 et(e){let t=(0,Z.c)(38),{noteId:n,attachmentId:r,durationSec:i,className:a}=e,{playing:s,loading:c,currentTime:l,duration:u,noteId:d,attachmentId:f}=Ae(),p=Ae(nt),m=d===n&&f===r,h=m&&s,g=m&&c,_=m?l:0,v=m&&u>0?u:i??0,y=v>0?Math.min(_/v*100,100):0,b;t[0]!==r||t[1]!==i||t[2]!==n||t[3]!==p?(b=e=>{e.stopPropagation(),p(n,r,i)},t[0]=r,t[1]=i,t[2]=n,t[3]=p,t[4]=b):b=t[4];let x=b,S;t[5]!==r||t[6]!==i||t[7]!==n||t[8]!==p?(S=e=>{(e.key===`Enter`||e.key===` `)&&(e.stopPropagation(),e.preventDefault(),p(n,r,i))},t[5]=r,t[6]=i,t[7]=n,t[8]=p,t[9]=S):S=t[9];let C=S,w;t[10]===a?w=t[11]:(w=o(`flex items-center gap-2`,a),t[10]=a,t[11]=w);let T=h?`bg-accent text-white`:`bg-accent/10 text-accent hover:bg-accent/20`,E;t[12]===T?E=t[13]:(E=o(`flex size-7 shrink-0 items-center justify-center rounded-full transition-colors`,T),t[12]=T,t[13]=E);let D=h?`Pause`:`Play`,O;t[14]!==g||t[15]!==h?(O=g?(0,$.jsx)(ke,{className:`size-3.5 animate-spin`}):h?(0,$.jsx)(L,{className:`size-3.5`}):(0,$.jsx)(M,{className:`size-3.5 ml-0.5`}),t[14]=g,t[15]=h,t[16]=O):O=t[16];let k;t[17]!==x||t[18]!==C||t[19]!==E||t[20]!==D||t[21]!==O?(k=(0,$.jsx)(`button`,{type:`button`,onClick:x,onKeyDown:C,className:E,"aria-label":D,children:O}),t[17]=x,t[18]=C,t[19]=E,t[20]=D,t[21]=O,t[22]=k):k=t[22];let A=`${y}%`,j;t[23]===A?j=t[24]:(j=(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:A}})}),t[23]=A,t[24]=j);let N;t[25]!==v||t[26]!==m||t[27]!==_?(N=$e(m&&_>0?_:v),t[25]=v,t[26]=m,t[27]=_,t[28]=N):N=t[28];let P;t[29]===N?P=t[30]:(P=(0,$.jsx)(`span`,{className:`text-[10px] tabular-nums text-fg-muted`,children:N}),t[29]=N,t[30]=P);let F;t[31]!==j||t[32]!==P?(F=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[j,P]}),t[31]=j,t[32]=P,t[33]=F):F=t[33];let ee;return t[34]!==F||t[35]!==w||t[36]!==k?(ee=(0,$.jsxs)(`div`,{className:w,onClick:tt,children:[k,F]}),t[34]=F,t[35]=w,t[36]=k,t[37]=ee):ee=t[37],ee}function tt(e){return e.stopPropagation()}function nt(e){return e.toggle}function rt(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function it(e){let t=(0,Z.c)(80),{note:n,selected:r,onPress:i,onPin:a,onArchive:s,onDelete:c,labels:l,timeLabels:u}=e,d=r===void 0?!1:r,f;t[0]!==l||t[1]!==n?(f=rt(n,l),t[0]=l,t[1]=n,t[2]=f):f=t[2];let p=f,m=!n.snippet?.trim(),[h]=(0,Q.useState)(ct),g;t[3]!==n.createdAt||t[4]!==h||t[5]!==u?(g=Xe(n.createdAt,h,u),t[3]=n.createdAt,t[4]=h,t[5]=u,t[6]=g):g=t[6];let v=g,y,x;t[7]!==n.id||t[8]!==i?(y=()=>i(n.id),x=e=>{(e.key===`Enter`||e.key===` `)&&i(n.id)},t[7]=n.id,t[8]=i,t[9]=y,t[10]=x):(y=t[9],x=t[10]);let C=d?`bg-surface-active hover:bg-surface-active`:`bg-surface-base hover:bg-surface-hover`,w;t[11]===C?w=t[12]:(w=o(`group relative flex cursor-pointer flex-col gap-2 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-panel`,C),t[11]=C,t[12]=w);let T=d?`true`:void 0,E;t[13]!==n.coverAttachmentId||t[14]!==n.id||t[15]!==n.kind||t[16]!==n.voiceAttachmentId||t[17]!==n.voiceDurationSec?(E=n.coverAttachmentId?(0,$.jsx)(Ge,{noteId:n.id,attachmentId:n.coverAttachmentId}):n.kind===`voice`&&n.voiceAttachmentId?(0,$.jsx)(et,{noteId:n.id,attachmentId:n.voiceAttachmentId,durationSec:n.voiceDurationSec,className:`mt-0.5 w-28 shrink-0`}):null,t[13]=n.coverAttachmentId,t[14]=n.id,t[15]=n.kind,t[16]=n.voiceAttachmentId,t[17]=n.voiceDurationSec,t[18]=E):E=t[18];let O;t[19]===n.title?O=t[20]:(O=n.title&&(0,$.jsx)(`h3`,{className:`mb-0.5 truncate text-sm font-semibold text-fg`,children:n.title}),t[19]=n.title,t[20]=O);let k=n.title?`text-fg-muted`:m?`italic text-fg-muted`:`text-fg`,M;t[21]===k?M=t[22]:(M=o(`truncate text-sm leading-5`,k),t[21]=k,t[22]=M);let N;t[23]!==p||t[24]!==M?(N=(0,$.jsx)(`p`,{className:M,children:p}),t[23]=p,t[24]=M,t[25]=N):N=t[25];let P;t[26]!==O||t[27]!==N?(P=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[O,N]}),t[26]=O,t[27]=N,t[28]=P):P=t[28];let F;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,$.jsx)(b,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,onClick:st,className:`shrink-0 rounded-md p-1 text-fg-muted opacity-0 transition-opacity group-hover:opacity-100 hover:bg-surface-panel focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":`Actions`,children:(0,$.jsx)(A,{className:`size-4`})})}),t[29]=F):F=t[29];let I;t[30]!==n.id||t[31]!==n.pinned||t[32]!==a?(I=()=>a(n.id,!n.pinned),t[30]=n.id,t[31]=n.pinned,t[32]=a,t[33]=I):I=t[33];let L;t[34]===n.pinned?L=t[35]:(L=n.pinned?(0,$.jsx)(ee,{className:`size-4`}):(0,$.jsx)(S,{className:`size-4`}),t[34]=n.pinned,t[35]=L);let te=n.pinned?l.unpin:l.pin,re;t[36]!==I||t[37]!==L||t[38]!==te?(re=(0,$.jsxs)(ne,{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:I,children:[L,te]}),t[36]=I,t[37]=L,t[38]=te,t[39]=re):re=t[39];let ae;t[40]!==n.id||t[41]!==s?(ae=()=>s(n.id),t[40]=n.id,t[41]=s,t[42]=ae):ae=t[42];let oe;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,$.jsx)(D,{className:`size-4`}),t[43]=oe):oe=t[43];let se;t[44]!==l.archive||t[45]!==ae?(se=(0,$.jsxs)(ne,{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:ae,children:[oe,l.archive]}),t[44]=l.archive,t[45]=ae,t[46]=se):se=t[46];let R;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,$.jsx)(ie,{className:`my-1 h-px bg-edge-subtle`}),t[47]=R):R=t[47];let z;t[48]!==n.id||t[49]!==c?(z=()=>c(n.id),t[48]=n.id,t[49]=c,t[50]=z):z=t[50];let B;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,$.jsx)(j,{className:`size-4`}),t[51]=B):B=t[51];let V;t[52]!==l.delete||t[53]!==z?(V=(0,$.jsxs)(ne,{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:z,children:[B,l.delete]}),t[52]=l.delete,t[53]=z,t[54]=V):V=t[54];let ce;t[55]!==re||t[56]!==se||t[57]!==V?(ce=(0,$.jsxs)(X,{children:[F,(0,$.jsx)(_,{children:(0,$.jsxs)(Pe,{className:`z-50 min-w-[140px] rounded-xl border border-edge bg-surface-panel p-1 shadow-lg`,sideOffset:4,align:`end`,onClick:ot,children:[re,se,R,V]})})]}),t[55]=re,t[56]=se,t[57]=V,t[58]=ce):ce=t[58];let H;t[59]!==P||t[60]!==ce||t[61]!==E?(H=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[E,P,ce]}),t[59]=P,t[60]=ce,t[61]=E,t[62]=H):H=t[62];let U;t[63]===n.pinned?U=t[64]:(U=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)(S,{className:`size-3`})}),t[63]=n.pinned,t[64]=U);let le;t[65]===n.tags?le=t[66]:(le=n.tags?.slice(0,2).map(at),t[65]=n.tags,t[66]=le);let W;t[67]===v?W=t[68]:(W=(0,$.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:v}),t[67]=v,t[68]=W);let G;t[69]!==U||t[70]!==le||t[71]!==W?(G=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[U,le,W]}),t[69]=U,t[70]=le,t[71]=W,t[72]=G):G=t[72];let ue;return t[73]!==H||t[74]!==G||t[75]!==y||t[76]!==x||t[77]!==w||t[78]!==T?(ue=(0,$.jsxs)(`article`,{role:`button`,tabIndex:0,onClick:y,onKeyDown:x,className:w,"aria-current":T,children:[H,G]}),t[73]=H,t[74]=G,t[75]=y,t[76]=x,t[77]=w,t[78]=T,t[79]=ue):ue=t[79],ue}function at(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 ot(e){return e.stopPropagation()}function st(e){return e.stopPropagation()}function ct(){return Date.now()}var lt={edit:E,ai_edit:xe,sync:g,restore:C};function ut(e,t){return{edit:t.triggerEdit,ai_edit:t.triggerAiEdit,sync:t.triggerSync,restore:t.triggerRestore}[e]??e}function dt({noteId:e,activeTimestamp:t,onSelect:n,onClose:r,onRestored:i}){let a=s(l(e=>e.language)).notes,c=a,{data:u}=d(e?[`note-history`,e]:null,()=>de(e)),[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(null),g=(0,Q.useCallback)(async t=>{p(!0);try{await G(e,t),h(null),i()}catch{we({type:`error`,title:a.restoreFailed})}finally{p(!1)}},[e,a.restoreSuccess,a.restoreFailed,i]),_=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)(v,{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)(N,{className:`size-4`,"aria-hidden":!0})})]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:u?.length?(0,$.jsx)(`ul`,{className:`divide-y divide-edge`,children:u.map(e=>{let r=lt[e.trigger]??E,i=t===e.timestamp,s=m===e.timestamp;return(0,$.jsxs)(`li`,{children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>n(e),className:o(`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:ut(e.trigger,a)}),(0,$.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:Xe(e.timestamp,_,c)})]}),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(),g(e.timestamp)},disabled:f,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:f?`...`:a.restore}),(0,$.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),h(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(),h(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 ft(e){let t=(0,Z.c)(10),{noteId:n,note:r,catalyzing:i,onCatalyze:c,onClose:u,noteThreads:f,openingChat:p,onOpenChat:m,onOpenNewChat:h}=e,g=s(l(yt)).notes,_=a(),v=r?.aiDeep?.catalysis,y=v?.report??null,b;t[0]===n?b=t[1]:(b=n?[`note-agent-context-status`,n]:null,t[0]=n,t[1]=b);let x;t[2]===n?x=t[3]:(x=()=>ye(n),t[2]=n,t[3]=x);let S;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(S={revalidateOnFocus:!1},t[4]=S):S=t[4];let{data:C,mutate:w,isLoading:T}=d(b,x,S),E;t[5]===n?E=t[6]:(E=async e=>{try{await Le(n,e)}catch{}},t[5]=n,t[6]=E);let D=E,O;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,$.jsx)(xe,{className:`size-4 text-accent`,"aria-hidden":!0}),t[7]=O):O=t[7];let A;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,$.jsx)(F,{className:`size-4 rotate-180`,"aria-hidden":!0}),t[8]=A):A=t[8];let j;return t[9]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,$.jsx)(I,{className:`size-4 text-accent`,"aria-hidden":!0}),t[9]=j):j=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:[O,(0,$.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:g.catalysisSectionTitle})]}),(0,$.jsx)(`button`,{type:`button`,onClick:u,"aria-label":g.lightboxClose,className:`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:A})]}),(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:g.catalysisSectionDescription}),C?(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:g.contextStatusTitle}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>void w(()=>Me(n),{revalidate:!1}),disabled:T,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:g.contextRebuild}),(0,$.jsx)(`span`,{className:o(`rounded-full px-2 py-0.5 text-[11px] font-medium`,C.status===`ready`?`bg-emerald-500/10 text-emerald-600 dark:text-emerald-300`:C.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:C.status})]}),(0,$.jsx)(`div`,{className:`mt-2 text-xs leading-relaxed text-fg-muted`,children:g.contextStatusDetail.replace(`{{attachments}}`,String(C.attachments.length)).replace(`{{tokens}}`,String(C.tokenEstimate??0))}),C.attachments.length>0?(0,$.jsx)(`div`,{className:`mt-3 space-y-1.5`,children:C.attachments.slice(0,5).map(vt)}):null]}):null,(0,$.jsx)(`button`,{type:`button`,onClick:c,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?g.processing:y?g.recatalyze:g.catalyzeAction}),y?(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:g.valueHypothesis}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg`,children:y.valueHypothesis})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:g.targetUsers}),(0,$.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:y.targetUsers.slice(0,5).map(_t)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:g.keyQuestions}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:y.keyQuestions.slice(0,3).map(gt)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:g.mvpPathLabel}),(0,$.jsx)(`ol`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:y.mvpPath.slice(0,3).map(ht)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:g.risks}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:y.risks.slice(0,3).map(mt)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:g.nextActions}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:y.nextActions.slice(0,4).map(pt)})]}),(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:g.confidenceLabel.replace(`{{percent}}`,String(Math.round(y.confidence*100)))}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>void D(`helpful`),className:o(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,v?.feedback===`helpful`&&`bg-accent/10 text-accent`),"aria-label":g.feedbackHelpfulAria,children:(0,$.jsx)(Te,{className:`size-3.5`,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>void D(`not_helpful`),className:o(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,v?.feedback===`not_helpful`&&`bg-accent/10 text-accent`),"aria-label":g.feedbackNotHelpfulAria,children:(0,$.jsx)(k,{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:g.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:[j,g.relatedThreadsTitle]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:g.relatedThreadsDescription})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:m,disabled:p,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:p?g.openingChat:g.openThread}),(0,$.jsx)(`button`,{type:`button`,onClick:h,disabled:p,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:g.newThread})]})]}),f.length>0?(0,$.jsx)(`div`,{className:`space-y-2`,children:f.slice(0,5).map(e=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>_(`/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||g.noteDiscussionFallback}),(0,$.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-muted`,children:g.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:g.noThreads})]})]})]})}function pt(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 mt(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 ht(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 _t(e){return(0,$.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg`,children:e},e)}function vt(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 yt(e){return e.language}var bt=()=>i(()=>import(`./block-editor-Q3v_YQom.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])),xt=()=>i(()=>import(`./markdown-editor-BvUebh3C.js`).then(e=>e.n),__vite__mapDeps([28,1,3,25,5,29])),St=(0,Q.lazy)(()=>bt().then(e=>({default:e.BlockEditor}))),Ct=(0,Q.lazy)(()=>xt().then(e=>({default:e.MarkdownEditor})));function wt(){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 Tt(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:te},t[0]=i.edit,t[1]=a);let s;t[2]===i.source?s=t[3]:(s={id:`source`,label:i.source,Icon:K},t[2]=i.source,t[3]=s);let c;t[4]===i.preview?c=t[5]:(c={id:`preview`,label:i.preview,Icon:R},t[4]=i.preview,t[5]=c);let l;t[6]!==a||t[7]!==s||t[8]!==c?(l=[a,s,c],t[6]=a,t[7]=s,t[8]=c,t[9]=l):l=t[9];let u=l,d;return t[10]!==n||t[11]!==u||t[12]!==r?(d=(0,$.jsx)(`div`,{className:`flex items-center gap-0.5 rounded-lg border border-edge p-0.5`,children:u.map(e=>{let{id:t,label:i,Icon:a}=e;return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>r(t),onMouseEnter:()=>{t===`wysiwyg`&&bt(),t===`source`&&xt()},onFocus:()=>{t===`wysiwyg`&&bt(),t===`source`&&xt()},className:o(`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]=u,t[12]=r,t[13]=d):d=t[13],d}function Et(e){let t=(0,Z.c)(15),{noteId:n,onBack:r,onSaved:i,showBackButton:a,backButtonClassName:o,clearHeaderOnCleanup:c,onOpenSearch:u,autoFocus:d,onAutoFocusConsumed:f}=e,p=a===void 0?!0:a,m=c===void 0?!0:c,h=d===void 0?!1:d,g=l(Dt),_;t[0]===g?_=t[1]:(_=s(g),t[0]=g,t[1]=_);let v=_.notes.lightboxClose,y;t[2]!==h||t[3]!==o||t[4]!==m||t[5]!==n||t[6]!==f||t[7]!==r||t[8]!==u||t[9]!==i||t[10]!==p?(y=(0,$.jsx)(Ot,{noteId:n,onBack:r,onSaved:i,showBackButton:p,backButtonClassName:o,clearHeaderOnCleanup:m,onOpenSearch:u,autoFocus:h,onAutoFocusConsumed:f}),t[2]=h,t[3]=o,t[4]=m,t[5]=n,t[6]=f,t[7]=r,t[8]=u,t[9]=i,t[10]=p,t[11]=y):y=t[11];let b;return t[12]!==v||t[13]!==y?(b=(0,$.jsx)(We,{closeLabel:v,children:y}),t[12]=v,t[13]=y,t[14]=b):b=t[14],b}function Dt(e){return e.language}function Ot({noteId:e,onBack:t,onSaved:n,showBackButton:r=!0,backButtonClassName:i,clearHeaderOnCleanup:c=!0,onOpenSearch:p,autoFocus:m=!1,onAutoFocusConsumed:h}){let g=l(e=>e.language),_=s(g).notes,b=s(g).automations.suggestions,x=a(),S=u(e=>e.resolved)===`dark`,{openImage:C}=He(),[w,T]=(0,Q.useState)(`wysiwyg`),[E,D]=(0,Q.useState)(null),[O,k]=(0,Q.useState)(null),[A,j]=(0,Q.useState)(!1),[M,N]=(0,Q.useState)(``),[P,ee]=(0,Q.useState)(360),[L,te]=(0,Q.useState)(!1),[ne,re]=(0,Q.useState)(!1),[ie,oe]=(0,Q.useState)(!1),R=(0,Q.useRef)(!1),z=(0,Q.useRef)(!1),B=(0,Q.useRef)(null),V=(0,Q.useRef)(null),H=(0,Q.useRef)(null),U=(0,Q.useRef)(null),W=(0,Q.useRef)(null),G=(0,Q.useRef)(null),de=(0,Q.useRef)(null),fe=(0,Q.useRef)(null),K=(0,Q.useRef)(null),ge=ae(e=>e.setPageHeader),_e=ae(e=>e.clearPageHeader),{data:q,mutate:J}=d(e?[`note-detail`,e]:null,()=>ue(e)),{data:ve=[],mutate:ye}=d(e?[`note-threads`,e]:null,()=>me(e),{revalidateOnFocus:!1}),be=O!==null;(0,Q.useEffect)(()=>{if(!e)return;let t=t=>{t.detail?.noteId===e&&J()};return window.addEventListener(`note-updated`,t),()=>window.removeEventListener(`note-updated`,t)},[J,e]),(0,Q.useEffect)(()=>{R.current=!1,N(``),k(null),D(null),z.current=!1,K.current=null},[e]),(0,Q.useEffect)(()=>{!q||R.current||(N(q.title??``),R.current=!0)},[q]),(0,Q.useEffect)(()=>{if(!m||!q||be||K.current===e)return;let t=window.requestAnimationFrame(()=>{fe.current?.focus(),h?.()});return K.current=e,()=>window.cancelAnimationFrame(t)},[m,be,q,e,h]);let Se=q?new Date(q.createdAt).toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}):``,Ce=(0,Q.useMemo)(()=>r?(0,$.jsx)(`button`,{type:`button`,onClick:t,"aria-label":_.back,className:o(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,ze,i),children:(0,$.jsx)(F,{className:`size-4`,"aria-hidden":!0})}):null,[i,_.back,t,r]),Te=(0,Q.useCallback)(t=>{N(t),e&&(U.current=t,V.current&&clearTimeout(V.current),V.current=setTimeout(async()=>{let t=U.current;if(U.current=null,t!==null){j(!0);try{await Fe(e,{title:t}),await J(),n?.()}catch{}finally{j(!1)}}},600))},[e,J,n]),Ee=(0,Q.useMemo)(()=>(0,$.jsxs)(`div`,{className:o(`flex min-w-0 items-center gap-2`,ze),children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,title:M||Se||void 0,children:M||Se}),A?(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted opacity-60`,children:_.saving}):null]}),[_.saving,A,Se,M]),De=(0,Q.useCallback)(async(t=!1)=>{oe(!0);try{let n=await Y(e,{forceNew:t});await J(),await ye(),x(`/chat/${encodeURIComponent(n.sessionKey)}`)}catch(e){we({type:`error`,title:_.chatOpenFailedTitle,message:e instanceof Error?e.message:_.chatOpenFailedMessage})}finally{oe(!1)}},[J,ye,x,e,_.chatOpenFailedMessage,_.chatOpenFailedTitle]),Oe=(0,Q.useCallback)(async()=>{re(!0);try{await le(e),await J()}catch(e){we({type:`error`,title:_.catalysisFailed,message:e instanceof Error?e.message:_.chatOpenFailedMessage})}finally{re(!1)}},[J,e]),ke=(0,Q.useCallback)(()=>{D(E===`breakdown`?null:`breakdown`),!q?.aiDeep?.catalysis?.report&&!ne&&Oe()},[E,ne,Oe,q?.aiDeep?.catalysis?.report]),Ae=(0,Q.useCallback)(()=>{let t=O?.markdown??H.current??q?.markdown??``,n=O?.title??M,r=f([n,t].filter(Boolean).join(`
|
|
3
|
+
|
|
4
|
+
`));return{source:{type:`note`,id:e,title:n||_.titlePlaceholder},text:r,language:pe(r,g)}},[g,_.titlePlaceholder,q?.markdown,e,O,M]),Me=(0,Q.useMemo)(()=>(0,$.jsxs)(`div`,{className:o(`flex items-center gap-2`,ze),children:[p?(0,$.jsx)(`button`,{type:`button`,onClick:p,"aria-label":_.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)(he,{className:`size-4`,"aria-hidden":!0})}):null,(0,$.jsx)(se,{input:Ae,labels:{read:_.readAloud,preparing:_.readAloudPreparing,pause:_.readAloudPause,resume:_.readAloudResume,retry:_.readAloudRetry},showLabel:!0}),(0,$.jsxs)(`button`,{type:`button`,onClick:ke,disabled:ne,"aria-label":_.catalysisSectionTitle,className:o(`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`,E===`breakdown`?`bg-accent/10 text-accent`:`bg-accent/10 text-fg hover:bg-accent/15`),children:[(0,$.jsx)(xe,{className:`size-3.5`,"aria-hidden":!0}),ne?_.catalyzing:_.catalyzeButton]}),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>De(!1),disabled:ie,className:o(`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)(I,{className:`size-3.5`,"aria-hidden":!0}),ie?_.openingChat:_.openChatButton]}),(0,$.jsx)(Tt,{mode:w,onModeChange:T,labels:{edit:_.modeEdit,source:_.modeSource,preview:_.modePreview}}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>D(E===`history`?null:`history`),"aria-label":_.history,className:o(`rounded-lg p-1.5 transition-colors`,E===`history`?`bg-accent/10 text-accent`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:(0,$.jsx)(v,{className:`size-4`,"aria-hidden":!0})})]}),[ne,ke,De,w,_.history,_.modeEdit,_.modePreview,_.modeSource,ie,E,p,_.searchDialogTitle,_.readAloud,_.readAloudPause,_.readAloudPreparing,_.readAloudResume,_.readAloudRetry,Ae]);(0,Q.useLayoutEffect)(()=>(ge({startExtra:Ce,main:q?Ee:null,end:q?Me:null}),()=>{c&&_e()}),[c,_e,Me,Ee,Ce,q,ge]);let X=(0,Q.useCallback)(t=>{e&&(H.current=t,B.current&&clearTimeout(B.current),B.current=setTimeout(async()=>{let t=H.current;if(H.current=null,t!==null){j(!0);try{await Fe(e,{markdown:t}),await J(),n?.()}catch(e){we({type:`error`,title:_.saveFailed,message:e instanceof Error?e.message:_.saveFailedHint})}finally{j(!1)}}},600))},[e,J,_.saveFailed,_.saveFailedHint,n]),Ne=(0,Q.useCallback)(t=>{je(e,t.timestamp).then(e=>{e&&k(e)})},[e]),Pe=(0,Q.useCallback)(()=>{D(null),k(null)},[]),Ie=(0,Q.useCallback)(()=>{D(null),k(null),J(),n?.()},[J,n]);if((0,Q.useEffect)(()=>()=>{B.current&&clearTimeout(B.current),V.current&&clearTimeout(V.current);let t=H.current,n=U.current;H.current=null,U.current=null;let r={};t!==null&&(r.markdown=t),n!==null&&(r.title=n),Object.keys(r).length>0&&Fe(e,r)},[e]),q===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(q===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:_.notFoundTitle}),(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:_.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:_.back})]});let Le=be?O.title??``:M,Re=be?O.markdown??``:q.markdown??``,Z=new Date(q.createdAt).getTime(),Ve=Number.isFinite(Z)&&Date.now()-Z<3600*1e3?(0,$.jsx)(Be,{title:b.noteCreatedTitle,description:b.noteCreatedDescription,prompt:b.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)(`div`,{className:`flex h-full min-h-0 gap-3 p-4 sm:px-5`,children:[(0,$.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,$.jsx)(ce,{eventType:`note.created`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),(0,$.jsx)(ce,{eventType:`note.updated`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),(0,$.jsx)(`div`,{ref:W,className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel`,children:be?(0,$.jsxs)(`div`,{className:`h-full overflow-y-auto px-6 py-4`,children:[Le&&(0,$.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg/70`,children:Le}),Re?(0,$.jsx)(y,{noteId:e,content:Re,className:`opacity-80`}):(0,$.jsx)(`p`,{className:`italic text-fg-muted`,children:_.emptyPreview})]}):(0,$.jsxs)($.Fragment,{children:[w===`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:fe,type:`text`,value:M,onChange:e=>Te(e.target.value),onCompositionStart:()=>{z.current=!0},onCompositionEnd:()=>{z.current=!1},onKeyDown:e=>{let t=e.nativeEvent;e.key===`Enter`&&!z.current&&!t.isComposing&&(e.preventDefault(),(W.current?.querySelector(`.ProseMirror`))?.focus())},placeholder:_.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`}),Ve]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(wt,{}),children:(0,$.jsx)(St,{initialContent:q.markdown??``,onChange:X,noteId:e},`wysiwyg-${e}`)})})]}),w===`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:fe,type:`text`,value:M,onChange:e=>Te(e.target.value),placeholder:_.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`}),Ve]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(wt,{}),children:(0,$.jsx)(Ct,{initialContent:q.markdown??``,onChange:X,isDark:S},`source-${e}`)})})]}),w===`preview`&&(0,$.jsxs)(`div`,{className:`h-full overflow-y-auto px-6 py-4`,onClick:e=>{let t=e.target;t instanceof HTMLImageElement&&C(t.currentSrc||t.src,t.alt)},children:[M&&(0,$.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg`,children:M}),q.markdown?(0,$.jsx)(y,{noteId:e,content:q.markdown,className:`[&_img]:cursor-zoom-in`}):(0,$.jsx)(`p`,{className:`italic text-fg-muted`,children:_.emptyPreview})]})]})})]}),(0,$.jsx)(`div`,{ref:G,className:o(`relative flex min-h-0 shrink-0 flex-col overflow-hidden`,!L&&`transition-[width] duration-300 ease-in-out`),style:{width:E?P:0},children:(0,$.jsxs)(`div`,{ref:de,className:`flex min-h-0 flex-1 flex-col`,style:{width:P},children:[(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,onPointerDown:e=>{e.preventDefault();let t=e.currentTarget;t.setPointerCapture(e.pointerId),te(!0);let n=e.clientX,r=P,i=e.pointerId,a=0,o=P,s=P,c=()=>{a=0,s=o,E&&G.current?.style.setProperty(`width`,`${s}px`),de.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{}te(!1),ee(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:o(`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`,L&&`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:E===`history`?(0,$.jsx)(dt,{noteId:e,activeTimestamp:O?.timestamp??null,onSelect:Ne,onClose:Pe,onRestored:Ie}):E===`breakdown`?(0,$.jsx)(ft,{noteId:e,note:q??null,catalyzing:ne,onCatalyze:Oe,onClose:()=>D(null),noteThreads:ve,openingChat:ie,onOpenChat:()=>De(!1),onOpenNewChat:()=>De(!0)}):null})]})})]})}var kt=3e4;function At(){if(!(typeof MediaRecorder>`u`))return[`audio/webm;codecs=opus`,`audio/webm`,`audio/mp4`,`audio/ogg;codecs=opus`].find(e=>MediaRecorder.isTypeSupported(e))}function jt({placeholder:e,sendLabel:t,onCapture:n,onImagePick:r,onVoiceCapture:i,recordingLabel:a=`Recording…`,imageDisabled:s=!1,voiceDisabled:c=!1}){let[l,u]=(0,Q.useState)(``),[d,f]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(0),[_,v]=(0,Q.useState)(!1),y=(0,Q.useRef)(null),b=(0,Q.useRef)(null),x=(0,Q.useRef)(null),S=(0,Q.useRef)([]),C=(0,Q.useRef)(0),w=(0,Q.useRef)(null),T=(0,Q.useRef)(null),E=(0,Q.useCallback)(()=>{w.current&&=(clearInterval(w.current),null),T.current&&=(clearTimeout(T.current),null),x.current?.getTracks().forEach(e=>e.stop()),x.current=null,b.current=null,S.current=[],m(!1),g(0)},[]);(0,Q.useEffect)(()=>()=>E(),[E]);let D=(0,Q.useCallback)(async()=>{let e=b.current;if(!e||e.state!==`recording`)return;v(!0),await new Promise(t=>{e.addEventListener(`stop`,()=>t(),{once:!0}),e.stop()});let t=Math.max(1,Math.round((Date.now()-C.current)/1e3)),n=e.mimeType||At()||`audio/webm`,r=new Blob(S.current,{type:n});if(E(),r.size>0&&i){let e=n.includes(`mp4`)?`m4a`:n.includes(`ogg`)?`ogg`:`webm`,a=new File([r],`voice-${Date.now()}.${e}`,{type:n});try{await i(a,t)}finally{v(!1)}return}v(!1)},[E,i]),k=(0,Q.useCallback)(async()=>{if(!(!i||_||p)&&!(!navigator.mediaDevices?.getUserMedia||typeof MediaRecorder>`u`))try{let e=await navigator.mediaDevices.getUserMedia({audio:!0}),t=At(),n=t?new MediaRecorder(e,{mimeType:t}):new MediaRecorder(e);x.current=e,b.current=n,S.current=[],C.current=Date.now(),n.ondataavailable=e=>{e.data.size>0&&S.current.push(e.data)},n.start(),m(!0),g(0),w.current=setInterval(()=>{g(Math.round((Date.now()-C.current)/1e3))},250),T.current=setTimeout(()=>{D()},kt)}catch{E()}},[E,i,p,D,_]),A=(0,Q.useCallback)(()=>{if(p){D();return}k()},[p,k,D]),j=(0,Q.useCallback)(async e=>{let t=l.trim();if(!(!t||d)){f(!0),u(``);try{await n(t,e)}catch{u(t)}finally{f(!1),y.current?.focus()}}},[l,d,n]),M=(0,Q.useCallback)(e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),j()),e.key===`Enter`&&e.shiftKey&&(e.preventDefault(),j({navigate:!1}))},[j]),N=d||_;return(0,$.jsxs)(`div`,{className:o(`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`,p&&`border-danger ring-1 ring-danger/40`),children:[r&&(0,$.jsx)(`button`,{type:`button`,onClick:r,disabled:N||s||p,className:`shrink-0 rounded-lg p-2 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg disabled:cursor-not-allowed disabled:opacity-50`,"aria-label":`Image`,children:(0,$.jsx)(W,{className:`size-4`})}),i&&(0,$.jsx)(`button`,{type:`button`,onClick:A,disabled:N||c||d,className:o(`shrink-0 rounded-lg p-2 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,p?`bg-danger-soft text-danger hover:bg-danger-soft`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),"aria-label":p?`Stop recording`:`Voice`,"aria-pressed":p,children:p?(0,$.jsx)(Ee,{className:`size-4 fill-current`}):(0,$.jsx)(O,{className:`size-4`})}),p?(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate py-1.5 text-sm text-danger`,children:a.replace(`{{seconds}}`,String(h))}):(0,$.jsx)(`textarea`,{ref:y,value:l,onChange:e=>u(e.target.value),onKeyDown:M,placeholder:e,rows:1,disabled:N,className:`min-h-8 flex-1 resize-none 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:!l.trim()||N||p,onClick:e=>void j({navigate:!e.shiftKey}),"aria-label":t,className:o(`shrink-0 rounded-lg p-2 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,l.trim()&&!N&&!p?`text-accent hover:bg-accent-soft`:`text-fg-disabled`),children:(0,$.jsx)(_e,{className:`size-4`})})]})}var Mt={statusFilter:`all`,kindFilter:`all`,pinnedOnly:!1},Nt=240,Pt=320,Ft=520,It=560;function Lt(e){if(globalThis.localStorage===void 0)return Pt;try{let t=globalThis.localStorage.getItem(e);if(!t)return Pt;let n=Number(t);return Number.isFinite(n)?n:Pt}catch{return Pt}}function Rt(e,t){if(globalThis.localStorage!==void 0)try{globalThis.localStorage.setItem(e,String(Math.round(t)))}catch{}}var zt={thought:fe,todo:U,voice:O,media:W,bookmark:oe,mixed:fe,task:U};function Bt(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function Vt(e,t){return e.statusFilter===t.patch.statusFilter&&e.kindFilter===t.patch.kindFilter&&e.pinnedOnly===t.patch.pinnedOnly}function Ht(e,t){return`${e.replace(/\/$/,``)}/${encodeURIComponent(t)}`}function Ut({selectedNoteId:e,basePath:t,managePageHeader:n=!1,showLibrary:r=!0,allowMediaCapture:i=!0,listTag:u,captureTags:f=[],listTitle:g,listDescription:_,emptyText:v,emptyDescription:y,listWidthStorageKey:b=`xopc.notes.listWidth`}){let x=s(l(e=>e.language)).notes,C=!!c(e=>e.token),[E,k]=(0,Q.useReducer)(P,Mt),[A,j]=(0,Q.useState)(!1),[M,F]=(0,Q.useState)(``),[ee,I]=(0,Q.useState)(0),[L,te]=(0,Q.useState)(()=>Lt(b)),[ne,re]=(0,Q.useState)(!1),[ie,se]=(0,Q.useState)(!1),[R,ce]=(0,Q.useState)(!1),[le,G]=(0,Q.useState)(null),ue=(0,Q.useRef)(null),de=(0,Q.useRef)(null),[pe]=(0,Q.useState)(()=>Date.now()),K=a(),me=(0,Q.useCallback)(e=>{let t=ue.current?.clientWidth??window.innerWidth,n=Math.max(Nt,t-It);return Math.max(Nt,Math.min(Math.min(Ft,n),e))},[]),_e=(0,Q.useCallback)(e=>{let t=me(e);te(t),Rt(b,t)},[me,b]);(0,Q.useLayoutEffect)(()=>{te(e=>me(e))},[me]);let{data:ye,mutate:Y,isLoading:xe}=d((0,Q.useMemo)(()=>C?[`notes-list`,u,E.statusFilter,E.kindFilter,E.pinnedOnly]:null,[C,u,E.statusFilter,E.kindFilter,E.pinnedOnly]),()=>Ce({status:E.statusFilter===`all`?void 0:E.statusFilter,kind:E.kindFilter===`all`?void 0:E.kindFilter,tag:u,pinned:E.pinnedOnly?!0:void 0,limit:100,sortBy:`createdAt`,sortOrder:`desc`}),{keepPreviousData:!0}),Te=xe&&!ye,Ee=ye?.items??[],ke=ye?.total??0,Ae=M.trim(),{data:je,isLoading:Me}=d(C&&A&&Ae?[`notes-search`,u,Ae]:null,()=>Ce({search:Ae,tag:u,limit:30,sortBy:`updatedAt`,sortOrder:`desc`})),X=je?.items??[],Ne=e?Ee.some(t=>t.id===e):!0;(0,Q.useEffect)(()=>{I(0)},[Ae]),(0,Q.useEffect)(()=>{ee>=X.length&&I(Math.max(0,X.length-1))},[ee,X.length]),(0,Q.useEffect)(()=>{let e=()=>{Y()};return window.addEventListener(`note-updated`,e),()=>window.removeEventListener(`note-updated`,e)},[Y]);let Pe=ae(e=>e.setPageHeader),Le=ae(e=>e.clearPageHeader),Be=ke>0?x.noteCount.replace(`{{count}}`,String(ke)):null,Z=x.searchDialogTitle,Ve=x.searchClose,He=x.searchClear,Ue=(0,Q.useMemo)(()=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>j(!0),className:o(`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`,ze),"aria-label":Z,children:[(0,$.jsx)(he,{className:`size-4`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:Z})]}),[Z]);(0,Q.useLayoutEffect)(()=>{if(n)return C?(Pe({startExtra:null,main:(0,$.jsxs)(`div`,{className:o(`flex min-w-0 items-center gap-2`,ze),children:[(0,$.jsx)(`h1`,{className:`min-w-0 truncate text-base font-semibold tracking-tight text-fg`,children:g??x.title}),Be?(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:Be}):null]}),end:Ue}),()=>Le()):(Le(),()=>Le())},[Le,C,Ue,g,n,x.title,Be,e,Pe]);let We=(0,Q.useMemo)(()=>({justNow:x.justNow,minutesAgo:x.minutesAgo,today:x.today,yesterday:x.yesterday,daysAgo:x.daysAgo}),[x.justNow,x.minutesAgo,x.today,x.yesterday,x.daysAgo]),Ge=(0,Q.useMemo)(()=>[{id:`recent`,label:x.viewRecent,description:x.viewRecentDescription,icon:De,patch:{statusFilter:`all`,kindFilter:`all`,pinnedOnly:!1}},{id:`inbox`,label:x.filterInbox,description:x.viewInboxDescription,icon:Ie,patch:{statusFilter:`inbox`,kindFilter:`all`,pinnedOnly:!1}},{id:`pinned`,label:x.pinned,description:x.viewPinnedDescription,icon:S,patch:{statusFilter:`all`,kindFilter:`all`,pinnedOnly:!0}},{id:`tasks`,label:x.viewTasks,description:x.viewTasksDescription,icon:U,patch:{statusFilter:`all`,kindFilter:`todo`,pinnedOnly:!1}},{id:`voice`,label:x.kindVoice,description:x.viewVoiceDescription,icon:O,patch:{statusFilter:`all`,kindFilter:`voice`,pinnedOnly:!1}},{id:`media`,label:x.kindMedia,description:x.viewMediaDescription,icon:W,patch:{statusFilter:`all`,kindFilter:`media`,pinnedOnly:!1}},{id:`bookmarks`,label:x.kindBookmark,description:x.viewBookmarksDescription,icon:oe,patch:{statusFilter:`all`,kindFilter:`bookmark`,pinnedOnly:!1}},{id:`processed`,label:x.filterProcessed,description:x.viewProcessedDescription,icon:q,patch:{statusFilter:`processed`,kindFilter:`all`,pinnedOnly:!1}},{id:`archive`,label:x.filterArchived,description:x.viewArchiveDescription,icon:D,patch:{statusFilter:`archived`,kindFilter:`all`,pinnedOnly:!1}}],[x.filterArchived,x.filterInbox,x.filterProcessed,x.kindBookmark,x.kindMedia,x.kindVoice,x.pinned,x.viewArchiveDescription,x.viewBookmarksDescription,x.viewInboxDescription,x.viewMediaDescription,x.viewPinnedDescription,x.viewProcessedDescription,x.viewRecent,x.viewRecentDescription,x.viewTasks,x.viewTasksDescription,x.viewVoiceDescription]),Ke=Ge.find(e=>Vt(E,e))??Ge[0],qe=g??Ke.label,Je=_??Ke.description,Ye=(0,Q.useCallback)(async(e,n)=>{let r=f.length?await Se({markdown:e,kind:`thought`,tags:f,channel:`web`}):await J(e,`web`);await Y(),n?.navigate!==!1&&K(Ht(t,r.id))},[t,f,Y,K]),$e=(0,Q.useCallback)(async()=>{if(!R){ce(!0);try{let e=await Se({markdown:``,kind:`thought`,tags:f,channel:`web`});k({type:`patch`,patch:Mt}),await Y(),G(e.id),K(Ht(t,e.id))}catch(e){we({type:`error`,title:x.createBlankFailed,message:e instanceof Error?e.message:x.createBlankFailedHint})}finally{ce(!1)}}},[t,f,R,Y,x.createBlankFailed,x.createBlankFailedHint,K]),et=(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{await ge(t,`web`),await Y()}catch(e){we({type:`error`,title:x.imageUploadFailed,message:e instanceof Error?e.message:x.imageUploadFailedHint})}},e.click()},[Y,x.imageUploadFailed,x.imageUploadFailedHint]),tt=(0,Q.useCallback)(async(e,t)=>{try{await H(e,t,`web`),await Y()}catch(e){we({type:`error`,title:x.voiceUploadFailed,message:e instanceof Error?e.message:x.voiceUploadFailedHint})}},[Y,x.voiceUploadFailed,x.voiceUploadFailedHint]),nt=(0,Q.useCallback)(async(e,t)=>{await Fe(e,{pinned:t}),await Y()},[Y]),rt=(0,Q.useCallback)(async e=>{await Fe(e,{status:`archived`}),await Y()},[Y]),at=(0,Q.useCallback)(async e=>{await Oe(e),await Y()},[Y]),ot=(0,Q.useCallback)(e=>{K(Ht(t,e))},[t,K]),st=(0,Q.useCallback)(e=>{K(Ht(t,e)),j(!1)},[t,K]),ct=(0,Q.useCallback)(e=>{if(X.length){if(e.key===`ArrowDown`)e.preventDefault(),I(e=>Math.min(X.length-1,e+1));else if(e.key===`ArrowUp`)e.preventDefault(),I(e=>Math.max(0,e-1));else if(e.key===`Enter`){e.preventDefault();let t=X[ee]??X[0];t&&st(t.id)}}},[ee,st,X]),lt=(0,Q.useCallback)(e=>{e.preventDefault();let t=e.currentTarget,n=de.current;t.setPointerCapture(e.pointerId),re(!0);let r=ue.current?.clientWidth??window.innerWidth,i=Math.max(Nt,r-It),a=Math.min(Ft,i),o=e=>Math.max(Nt,Math.min(a,e)),s=e.clientX,c=o(L),l=e.pointerId,u=0,d=c,f=c;n&&(n.style.transition=`none`,n.style.width=`${c}px`);let p=()=>{u=0,f=d,n&&(n.style.width=`${f}px`)},m=e=>{d=o(c+e.clientX-s),u===0&&(u=window.requestAnimationFrame(p))},h=()=>{u!==0&&(window.cancelAnimationFrame(u),p());try{t.releasePointerCapture(l)}catch{}re(!1),ue.current?.style.setProperty(`--notes-list-width`,`${f}px`),n&&(n.style.removeProperty(`transition`),n.style.removeProperty(`width`)),te(f),Rt(b,f),window.removeEventListener(`pointermove`,m),window.removeEventListener(`pointerup`,h),window.removeEventListener(`pointercancel`,h)};window.addEventListener(`pointermove`,m),window.addEventListener(`pointerup`,h),window.addEventListener(`pointercancel`,h)},[b,L]);(0,Q.useEffect)(()=>{let e=e=>{e.defaultPrevented||e.repeat||e.key.toLowerCase()!==`n`||!e.metaKey&&!e.ctrlKey||e.altKey||e.shiftKey||(e.preventDefault(),$e())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[$e]);let ut=(0,Q.useCallback)(e=>{e.key===`ArrowLeft`?(e.preventDefault(),_e(L-16)):e.key===`ArrowRight`?(e.preventDefault(),_e(L+16)):e.key===`Home`?(e.preventDefault(),_e(Nt)):e.key===`End`&&(e.preventDefault(),_e(Ft))},[_e,L]);return C?(0,$.jsxs)(`div`,{ref:ue,className:`flex h-full min-h-0 w-full flex-1 overflow-hidden bg-surface-panel`,style:{"--notes-list-width":`${L}px`},children:[(0,$.jsxs)(`section`,{ref:de,className:o(`relative flex min-h-0 w-full shrink-0 flex-col overflow-hidden bg-surface-panel`,!ne&&`lg:transition-[width] lg:duration-[280ms] lg:ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:lg:transition-none`,ie?`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":ie?!0:void 0,children:[(0,$.jsx)(`div`,{className:`shrink-0 border-b border-edge-subtle p-3`,children:(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[r?(0,$.jsx)(be,{value:Ke.id,onChange:e=>{let t=Ge.find(t=>t.id===e.target.value);t&&k({type:`patch`,patch:t.patch})},className:`-ml-1 block max-w-44 truncate rounded-lg border border-transparent bg-transparent px-1 py-0.5 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":x.libraryTitle,children:Ge.map(e=>(0,$.jsx)(ve,{value:e.id,children:e.label},e.id))}):(0,$.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:qe}),(0,$.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:Be??Je})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>se(!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":x.collapseNotesList,title:x.collapseNotesList,children:(0,$.jsx)(m,{className:`size-4`,strokeWidth:1.5,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:$e,disabled:R,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":x.createBlankNote,title:x.createBlankShortcut,children:(0,$.jsx)(p,{className:`size-4`,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>j(!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":x.searchDialogTitle,children:(0,$.jsx)(he,{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:Te?(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))}):Ee.length===0?(0,$.jsxs)(`div`,{className:`flex min-h-[min(40vh,20rem)] flex-col items-center justify-center gap-2 px-6 py-16 text-center`,children:[(0,$.jsx)(fe,{className:`size-8 text-fg-muted`}),(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg-muted`,children:e&&!Ne?x.noteOutsideCurrentView:v??x.noNotes}),e&&!Ne?null:(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:y??x.noNotesDescription})]}):(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e&&!Ne?(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:x.noteOutsideCurrentView}):null,Ee.map((t,n)=>{let r=n>0?Qe(Ee[n-1].createdAt):null;return(0,$.jsxs)(`div`,{children:[Qe(t.createdAt)!==r&&(0,$.jsx)(`div`,{className:o(`px-3 pb-1.5 pt-2 text-xs font-medium text-fg-muted`,n===0&&`pt-0`),children:Ze(t.createdAt,pe,We)}),(0,$.jsx)(it,{note:t,selected:t.id===e,onPress:ot,onPin:nt,onArchive:rt,onDelete:at,timeLabels:We,labels:{pin:x.pin,unpin:x.unpin,archive:x.archive,delete:x.delete,imageNote:x.imageNote,noText:x.noText}})]},t.id)})]})}),(0,$.jsx)(`div`,{className:`shrink-0 border-t border-edge-subtle p-3`,children:(0,$.jsx)(jt,{placeholder:x.quickCapturePlaceholder,sendLabel:x.send,onCapture:Ye,onImagePick:i?et:void 0,onVoiceCapture:i?tt:void 0,recordingLabel:x.recording})})]}),(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":x.resizeNotesList,"aria-valuemin":Nt,"aria-valuemax":Ft,"aria-valuenow":Math.round(L),tabIndex:0,onPointerDown:lt,onDoubleClick:()=>_e(Pt),onKeyDown:ut,title:x.resizeNotesList,className:o(`group relative hidden shrink-0 cursor-col-resize touch-none select-none items-center justify-center lg:flex`,`lg:transition-[width,opacity] lg:duration-[280ms] lg:ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:lg:transition-none`,ie?`lg:w-0 lg:opacity-0 lg:pointer-events-none`:`lg:w-3 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:o(`h-8 w-1 rounded-pill opacity-0 transition-[background-color,opacity,transform] duration-150`,`bg-edge-strong/55 group-hover:opacity-100 group-focus-visible:opacity-100`,`group-hover:scale-y-110 group-focus-visible:scale-y-110`,ne&&`bg-accent opacity-100 scale-y-125`)})}),(0,$.jsxs)(`section`,{className:o(`relative min-w-0 flex-1 bg-surface-panel`,!e&&`hidden lg:flex`),children:[ie?(0,$.jsx)(`button`,{type:`button`,onClick:()=>se(!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":x.expandNotesList,title:x.expandNotesList,children:(0,$.jsx)(m,{className:`size-4`,strokeWidth:1.5,"aria-hidden":!0})}):null,e?(0,$.jsx)(Et,{noteId:e,onBack:()=>K(t),onSaved:()=>void Y(),backButtonClassName:`lg:hidden`,clearHeaderOnCleanup:!1,onOpenSearch:()=>j(!0),autoFocus:e===le,onAutoFocusConsumed:()=>G(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)(fe,{className:`mx-auto size-9 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`h2`,{className:`mt-4 text-base font-semibold text-fg`,children:x.emptyEditorTitle}),(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:x.emptyEditorDescription}),(0,$.jsxs)(`button`,{type:`button`,onClick:$e,disabled:R,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)(p,{className:`size-4`,"aria-hidden":!0}),R?x.creatingBlankNote:x.createBlankNote]})]})})]}),(0,$.jsx)(Re,{open:A,onOpenChange:j,children:(0,$.jsxs)(V,{children:[(0,$.jsx)(z,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(B,{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)(w,{className:`text-sm font-semibold text-fg`,children:Z}),(0,$.jsx)(T,{className:`sr-only`,children:x.searchPlaceholder}),(0,$.jsx)(h,{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":Ve,children:(0,$.jsx)(N,{className:`size-4`,"aria-hidden":!0})})})]}),(0,$.jsxs)(`div`,{className:`p-4`,children:[(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(he,{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:M,onChange:e=>F(e.target.value),onKeyDown:ct,placeholder:x.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`}),M?(0,$.jsx)(`button`,{type:`button`,onClick:()=>F(``),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":He,children:(0,$.jsx)(N,{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:Ae?Me&&!je?(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)(fe,{className:`size-7 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:x.searchNoResults}),(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:x.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:x.searchResultsCount.replace(`{{count}}`,String(je?.total??X.length))}),X.map((e,t)=>{let n=zt[e.kind]||fe,r=Bt(e,{imageNote:x.imageNote,noText:x.noText});return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>st(e.id),onMouseEnter:()=>I(t),className:o(`flex w-full items-start gap-3 rounded-lg px-3 py-2.5 text-left transition-colors`,t===ee?`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:Xe(e.updatedAt,pe,We)})]}),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)(he,{className:`size-7 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:x.searchEmptyTitle}),(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:x.searchEmptyDescription})]})})]})]})]})})]}):(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 p-8 text-center`,children:[(0,$.jsx)(fe,{className:`size-10 text-fg-muted`}),(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:x.needToken})]})}export{He as n,Ut as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-JdwAhgNB.js";import{ws as a}from"./index-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-JdwAhgNB.js";import{ws as a}from"./index-C0CGebQ1.js";var o=n(),s=e(t(),1),c=r();function l(e){let t=(0,o.c)(40),{items:n,activeTab:r,onChange:l,ariaLabel:u,tabIdPrefix:d,panelIdPrefix:f,className:p,buttonClassName:m,selectedClassName:h,unselectedClassName:g,countClassName:_,onReorder:v}=e,y=h===void 0?`bg-accent-soft text-accent-fg`:h,b=g===void 0?`text-fg-muted hover:bg-surface-hover hover:text-fg`:g,[x,S]=(0,s.useState)(null),[C,w]=(0,s.useState)(null),T;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(T=()=>{S(null),w(null)},t[0]=T):T=t[0];let E=T,D;t[1]===p?D=t[2]:(D=i(`-mx-1 flex gap-1 overflow-x-auto px-1 pb-1`,p),t[1]=p,t[2]=D);let O;t[3]===v?O=t[4]:(O=e=>{if(!v)return;let t=e.relatedTarget;t instanceof Node&&e.currentTarget.contains(t)||w(null)},t[3]=v,t[4]=O);let k;t[5]!==r||t[6]!==n||t[7]!==l?(k=e=>{if(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`)return;e.preventDefault();let t=n.findIndex(e=>e.id===r);t<0||l(n[(t+(e.key===`ArrowRight`?1:-1)+n.length)%n.length].id)},t[5]=r,t[6]=n,t[7]=l,t[8]=k):k=t[8];let A;if(t[9]!==r||t[10]!==m||t[11]!==_||t[12]!==x||t[13]!==C||t[14]!==n||t[15]!==l||t[16]!==v||t[17]!==f||t[18]!==y||t[19]!==d||t[20]!==b){let e;t[22]!==r||t[23]!==m||t[24]!==_||t[25]!==x||t[26]!==C||t[27]!==l||t[28]!==v||t[29]!==f||t[30]!==y||t[31]!==d||t[32]!==b?(e=e=>{let{id:t,icon:n,label:o,count:s,suffix:u,title:p}=e,h=t===r,g=x===t,T=C?.id===t&&C.position===`before`,D=C?.id===t&&C.position===`after`;return(0,c.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":h,id:d?`${d}-${t}`:void 0,"aria-controls":f?`${f}-${t}`:void 0,"aria-grabbed":v?g:void 0,draggable:!!v,title:p,className:i(`relative inline-flex shrink-0 items-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium transition-colors`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,a.press,h?y:b,v&&`cursor-grab active:cursor-grabbing`,g&&`scale-[0.98] border border-edge bg-surface-active/60 opacity-55 shadow-surface`,(T||D)&&!g&&`bg-surface-hover text-fg`,m),onClick:()=>l(t),onDragStart:e=>{v&&(S(t),w(null),e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,t))},onDragOver:e=>{if(!v||!x)return;if(x===t){w(null);return}e.preventDefault(),e.dataTransfer.dropEffect=`move`;let n=e.currentTarget.getBoundingClientRect(),r=e.clientX<n.left+n.width/2?`before`:`after`;w(e=>e?.id===t&&e.position===r?e:{id:t,position:r})},onDrop:e=>{!v||!x||x===t||(e.preventDefault(),v(x,t,C?.id===t?C.position:`before`),E())},onDragEnd:E,children:[T?(0,c.jsx)(`span`,{className:`pointer-events-none absolute -left-0.5 top-1/2 h-5 w-0.5 -translate-y-1/2 rounded-full bg-accent shadow-[0_0_0_2px_var(--color-surface-panel)]`,"aria-hidden":!0}):null,n?(0,c.jsx)(n,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}):null,(0,c.jsx)(`span`,{children:o}),s==null?null:(0,c.jsx)(`span`,{className:i(`rounded-full bg-surface-hover px-1.5 py-0.5 text-[10px] tabular-nums text-fg-subtle`,_),children:s}),u,D?(0,c.jsx)(`span`,{className:`pointer-events-none absolute -right-0.5 top-1/2 h-5 w-0.5 -translate-y-1/2 rounded-full bg-accent shadow-[0_0_0_2px_var(--color-surface-panel)]`,"aria-hidden":!0}):null]},t)},t[22]=r,t[23]=m,t[24]=_,t[25]=x,t[26]=C,t[27]=l,t[28]=v,t[29]=f,t[30]=y,t[31]=d,t[32]=b,t[33]=e):e=t[33],A=n.map(e),t[9]=r,t[10]=m,t[11]=_,t[12]=x,t[13]=C,t[14]=n,t[15]=l,t[16]=v,t[17]=f,t[18]=y,t[19]=d,t[20]=b,t[21]=A}else A=t[21];let j;return t[34]!==u||t[35]!==D||t[36]!==O||t[37]!==k||t[38]!==A?(j=(0,c.jsx)(`nav`,{"aria-label":u,className:D,role:`tablist`,onDragLeave:O,onKeyDown:k,children:A}),t[34]=u,t[35]=D,t[36]=O,t[37]=k,t[38]=A,t[39]=j):j=t[39],j}export{l as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./cn-JdwAhgNB.js";import{
|
|
1
|
+
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./cn-JdwAhgNB.js";import{Jl as r,Ko as i,Wl as a,ws as o}from"./index-C0CGebQ1.js";var s=e(),c=t();function l(e){let t=(0,s.c)(31),{message:l,downloadLabel:u,onDownload:d,openSystemLabel:f,onOpenWithSystemApp:p,chooseAppLabel:m,onChooseOpenWithApp:h,canOpenWithSystemApp:g,canChooseOpenWithApp:_}=e,v=g===void 0?!0:g,y=_===void 0?!0:_,b;t[0]!==v||t[1]!==p||t[2]!==f?(b=i()&&v&&typeof p==`function`&&typeof f==`string`&&f.length>0,t[0]=v,t[1]=p,t[2]=f,t[3]=b):b=t[3];let x=b,S;t[4]!==y||t[5]!==m||t[6]!==h?(S=i()&&y&&typeof h==`function`&&typeof m==`string`&&m.length>0,t[4]=y,t[5]=m,t[6]=h,t[7]=S):S=t[7];let C=S,w;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(w=n(`flex flex-col gap-2 rounded-lg border border-edge-subtle bg-surface-hover/60 p-3 sm:flex-row sm:items-center sm:justify-between dark:border-edge`),t[8]=w):w=t[8];let T;t[9]===l?T=t[10]:(T=(0,c.jsx)(`p`,{className:`min-w-0 text-xs leading-relaxed text-fg-muted`,children:l}),t[9]=l,t[10]=T);let E;t[11]!==p||t[12]!==f||t[13]!==x?(E=x?(0,c.jsxs)(`button`,{type:`button`,className:n(`inline-flex items-center gap-1.5 rounded-md border border-edge bg-surface-panel px-3 py-1.5 text-xs font-medium text-fg shadow-sm dark:border-edge`,o.transition,o.press,o.focusRingPanel),onClick:()=>void p?.(),children:[(0,c.jsx)(a,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),f]}):null,t[11]=p,t[12]=f,t[13]=x,t[14]=E):E=t[14];let D;t[15]!==m||t[16]!==h||t[17]!==C?(D=C?(0,c.jsxs)(`button`,{type:`button`,className:n(`inline-flex items-center gap-1.5 rounded-md border border-edge bg-surface-panel px-3 py-1.5 text-xs font-medium text-fg shadow-sm dark:border-edge`,o.transition,o.press,o.focusRingPanel),onClick:()=>void h?.(),children:[(0,c.jsx)(a,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),m]}):null,t[15]=m,t[16]=h,t[17]=C,t[18]=D):D=t[18];let O;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(O=n(`inline-flex items-center gap-1.5 rounded-md border border-accent bg-accent px-3 py-1.5 text-xs font-medium text-white shadow-sm`,o.transition,o.press,o.focusRingPanel),t[19]=O):O=t[19];let k;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,c.jsx)(r,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),t[20]=k):k=t[20];let A;t[21]!==u||t[22]!==d?(A=(0,c.jsxs)(`button`,{type:`button`,className:O,onClick:d,children:[k,u]}),t[21]=u,t[22]=d,t[23]=A):A=t[23];let j;t[24]!==A||t[25]!==E||t[26]!==D?(j=(0,c.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[E,D,A]}),t[24]=A,t[25]=E,t[26]=D,t[27]=j):j=t[27];let M;return t[28]!==j||t[29]!==T?(M=(0,c.jsxs)(`div`,{className:w,children:[T,j]}),t[28]=j,t[29]=T,t[30]=M):M=t[30],M}export{l 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-BMhrPKJC.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-BMhrPKJC.js";import{n as a}from"./locale-store-CTwSy7yW.js";import{i as o}from"./vendor-swr-BIWyz7Rc.js";import{a as s,r as c}from"./product-delivery-BTRT9kCS.js";import{ro as l}from"./index-C0CGebQ1.js";import{n as u}from"./api-hi6f2Xtp.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,t as o}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as s}from"./check-DUBLcKHA.js";import{t as c}from"./circle-alert-BEjgurr2.js";import{t as l}from"./cn-JdwAhgNB.js";import{t as u}from"./copy-to-clipboard-HOJ79TWv.js";import{t as d}from"./messages-DP6tPKk-.js";import{l as f,n as p,o as m,r as h,s as g}from"./locale-store-CTwSy7yW.js";import{$i as _,$s as v,A as y,Aa as b,Ac as x,Al as S,As as C,Ba as w,Bo as T,C as E,Cl as D,F as O,Fc as k,Ga as A,Gl as j,Go as M,Gr as N,Ha as P,Ho as F,Hs as I,Ia as L,Iu as R,Jl as z,Ka as B,Ks as V,La as H,Ll as U,M as ee,Ma as te,Mc as W,Ml as ne,Ms as re,Na as ie,Nl as ae,Ns as oe,Nu as se,Oi as ce,Ot as G,Pa as le,Pc as ue,Qi as de,Qn as fe,Ra as pe,Rc as me,Rl as he,Rr as ge,To as _e,Ua as ve,Uo as ye,Va as be,Vo as xe,Wa as Se,Wl as Ce,Wo as we,Xa as Te,Xc as Ee,Xs as De,Za as Oe,Zi as ke,Zl as Ae,_u as je,a as Me,aa as Ne,c as Pe,cl as Fe,d as Ie,ea as Le,eo as Re,f as ze,fc as Be,fs as Ve,gc as He,gs as Ue,gu as We,h as Ge,hs as Ke,hu as qe,i as Je,ia as Ye,is as Xe,ja as Ze,ka as Qe,m as $e,ml as et,ms as tt,na as nt,ns as rt,nu as it,o as at,oa as ot,oc as st,ps as ct,pu as lt,qa as ut,ra as dt,rc as ft,ro as pt,rr as mt,s as ht,sa as gt,ta as _t,tt as vt,u as yt,vt as bt,x as xt,xc as St,yc as Ct,za as wt,zc as Tt,zo as Et}from"./index-C0CGebQ1.js";import{t as Dt}from"./notes-workbench-DSh3-hMY.js";import{t as Ot}from"./page-tabs-ke9s4nYi.js";import{t as kt}from"./directory-picker-path-field-BYQJ2XUS.js";import{t as At}from"./goals-config-api-Fwu1wjEP.js";import{n as jt,t as Mt}from"./goal-create-dialog-BRhmmBe9.js";import{f as Nt,o as Pt,r as Ft}from"./skills-page.utils-kahBIHg0.js";var K=e(t(),1),q=n();function It(e){return g(h(`/api/projects/${encodeURIComponent(e)}/skills`))}function Lt(e,t){return g(h(`/api/projects/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}`))}function Rt(e,t){let n=new FormData;return n.set(`file`,t),g(h(`/api/projects/${encodeURIComponent(e)}/skills/upload`),{method:`POST`,body:n})}function zt(e,t,n={}){return g(h(`/api/projects/${encodeURIComponent(e)}/skills/marketplace/install`),{method:`POST`,body:JSON.stringify({name:t,...n})})}function Bt(e,t){return g(h(`/api/projects/${encodeURIComponent(e)}/skills/source/install`),{method:`POST`,body:JSON.stringify({source:t})})}function Vt(e,t){return g(h(`/api/projects/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}`),{method:`DELETE`})}var J=r();function Ht({projectId:e,copy:t}){let[n,r]=(0,K.useState)([]),[i,a]=(0,K.useState)(``),[o,s]=(0,K.useState)(!0),[c,u]=(0,K.useState)(!1),[d,f]=(0,K.useState)(``),[p,m]=(0,K.useState)(null),[h,g]=(0,K.useState)(null),[_,y]=(0,K.useState)(``),[b,w]=(0,K.useState)(1),[E,D]=(0,K.useState)(null),[O,k]=(0,K.useState)(!1),[A,j]=(0,K.useState)(``),[N,P]=(0,K.useState)(``),F=(0,K.useRef)(null),L=(0,K.useCallback)(async()=>{s(!0),f(``);try{let t=await It(e);r(t.items),a(t.skillsRoot)}catch(e){f(e instanceof Error?e.message:String(e))}finally{s(!1)}},[e]);(0,K.useEffect)(()=>{L()},[L]),(0,K.useEffect)(()=>{if(p!==`marketplace`)return;let e=new AbortController,t=window.setTimeout(()=>{k(!0),j(``),Nt({q:_,page:b,pageSize:8,sort:`downloads`,signal:e.signal}).then(D).catch(t=>{e.signal.aborted||j(t instanceof Error?t.message:String(t))}).finally(()=>{e.signal.aborted||k(!1)})},250);return()=>{window.clearTimeout(t),e.abort()}},[p,b,_]);async function B(e){u(!0),f(``);try{await e(),m(null),P(``),await L()}catch(e){f(e instanceof Error?e.message:String(e))}finally{u(!1)}}async function H(t){f(``);try{g((await Lt(e,t)).skill)}catch(e){f(e instanceof Error?e.message:String(e))}}async function U(n){if(window.confirm(t.removeConfirm.replace(`{{name}}`,n.name))){u(!0);try{await Vt(e,n.id),await L()}catch(e){f(e instanceof Error?e.message:String(e))}finally{u(!1)}}}return(0,J.jsxs)(`section`,{id:`project-panel-skills`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-skills`,className:`grid content-start gap-4`,children:[(0,J.jsxs)(`div`,{className:`rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.title}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:t.description})]}),(0,J.jsxs)(Ke,{children:[(0,J.jsx)(Ue,{asChild:!0,children:(0,J.jsxs)(C,{type:`button`,children:[(0,J.jsx)(x,{className:`size-4`,"aria-hidden":!0}),t.add,(0,J.jsx)(je,{className:`size-3.5`,"aria-hidden":!0})]})}),(0,J.jsx)(tt,{children:(0,J.jsxs)(ct,{align:`end`,sideOffset:8,className:`z-50 w-72 rounded-lg border border-edge bg-surface-panel p-1.5 shadow-xl`,children:[(0,J.jsx)(Ut,{icon:v,title:t.marketplace,hint:t.marketplaceHint,onClick:()=>m(`marketplace`)}),(0,J.jsx)(Ut,{icon:S,title:t.source,hint:t.sourceHint,onClick:()=>m(`source`)}),(0,J.jsx)(Ut,{icon:I,title:t.upload,hint:t.uploadHint,onClick:()=>F.current?.click()})]})})]}),(0,J.jsx)(`input`,{ref:F,type:`file`,accept:`.zip,application/zip`,className:`hidden`,onChange:t=>{let n=t.target.files?.[0];n&&B(()=>Rt(e,n)),t.target.value=``}})]}),i?(0,J.jsxs)(`p`,{className:`mt-3 break-all font-mono text-xs text-fg-subtle`,children:[t.path,`: `,i]}):null]}),d?(0,J.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:d}):null,o?(0,J.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:[0,1,2].map(e=>(0,J.jsx)(pt,{className:`h-36 rounded-lg`},e))}):n.length?(0,J.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:n.map(e=>(0,J.jsxs)(`article`,{className:`flex min-h-36 flex-col rounded-lg border border-edge bg-surface-panel p-4`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(R,{className:`size-4 text-accent-fg`,"aria-hidden":!0}),(0,J.jsx)(`h3`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:e.name})]}),(0,J.jsx)(`p`,{className:`mt-2 line-clamp-2 flex-1 text-sm leading-5 text-fg-muted`,children:e.description||e.id}),(0,J.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-2`,children:[(0,J.jsxs)(C,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:()=>void H(e.id),children:[(0,J.jsx)(Ce,{className:`size-3.5`,"aria-hidden":!0}),t.view]}),(0,J.jsxs)(C,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs text-red-600`,disabled:c,onClick:()=>void U(e),children:[(0,J.jsx)(V,{className:`size-3.5`,"aria-hidden":!0}),t.remove]})]})]},e.id))}):(0,J.jsxs)(`div`,{className:`rounded-lg border border-dashed border-edge bg-surface-panel px-6 py-12 text-center`,children:[(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.empty}),(0,J.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:t.emptyHint})]}),(0,J.jsx)(Et,{open:p!==null,onOpenChange:e=>{e||m(null)},children:(0,J.jsxs)(we,{children:[(0,J.jsx)(ye,{className:`fixed inset-0 z-50 bg-black/45`}),(0,J.jsxs)(xe,{className:l(`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`,p===`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,J.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-5 py-4`,children:[(0,J.jsx)(M,{className:`text-base font-semibold text-fg`,children:p===`marketplace`?t.marketplace:t.source}),(0,J.jsx)(T,{asChild:!0,children:(0,J.jsx)(C,{type:`button`,variant:`ghost`,className:`size-9 p-0`,children:(0,J.jsx)(oe,{className:`size-4`})})})]}),(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:p===`marketplace`?(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.marketplace}),(0,J.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.marketplaceHint}),(0,J.jsxs)(`div`,{className:`relative mt-3`,children:[(0,J.jsx)(He,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,J.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:_,onChange:e=>{y(e.target.value),w(1)},placeholder:t.marketplacePlaceholder,autoFocus:!0})]}),A?(0,J.jsx)(`p`,{className:`mt-3 text-sm text-red-600 dark:text-red-300`,children:A}):null,O&&!E?(0,J.jsx)(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[0,1,2,3].map(e=>(0,J.jsx)(pt,{className:`h-32 rounded-lg`},e))}):E?.items.length?(0,J.jsx)(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:E.items.map(r=>{let i=r.providerId??E.provider,a=Ft(r,i),o=n.some(e=>e.id===r.id||e.id===a||e.name===r.name);return(0,J.jsxs)(`article`,{className:`group flex min-h-32 gap-3 rounded-lg border border-edge bg-surface-base p-3`,children:[(0,J.jsx)(Pt,{name:r.name,className:`size-10`}),(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,J.jsx)(`h4`,{className:`truncate text-sm font-semibold text-fg`,children:r.name}),(0,J.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:r.description||`—`}),(0,J.jsxs)(`div`,{className:`mt-auto flex items-end justify-between gap-2 pt-2`,children:[(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs text-fg-subtle`,children:[(0,J.jsx)(z,{className:`size-3.5`,"aria-hidden":!0}),t.marketplaceDownloads,` `,r.downloads]}),(0,J.jsx)(C,{type:`button`,className:`h-8 px-2.5 text-xs`,variant:o?`secondary`:`primary`,disabled:c||o,onClick:()=>void B(()=>zt(e,a,{provider:i})),children:o?t.marketplaceInstalled:c?t.installing:t.install})]})]})]},`${i??`default`}:${r.id}`)})}):O?null:(0,J.jsx)(`p`,{className:`mt-6 text-center text-sm text-fg-muted`,children:t.marketplaceEmpty}),E&&E.meta.totalPages>1?(0,J.jsxs)(`div`,{className:`mt-3 flex items-center justify-between border-t border-edge-subtle pt-3`,children:[(0,J.jsx)(`span`,{className:`text-xs text-fg-muted`,children:t.marketplacePage.replace(`{{page}}`,String(E.meta.page)).replace(`{{total}}`,String(E.meta.totalPages))}),(0,J.jsxs)(`div`,{className:`flex gap-2`,children:[(0,J.jsxs)(C,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:O||b<=1,onClick:()=>w(e=>Math.max(1,e-1)),children:[(0,J.jsx)(We,{className:`size-4`}),t.marketplacePrevious]}),(0,J.jsxs)(C,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:O||b>=E.meta.totalPages,onClick:()=>w(e=>e+1),children:[t.marketplaceNext,(0,J.jsx)(qe,{className:`size-4`})]})]})]}):null]}):(0,J.jsxs)(`section`,{className:`flex h-full flex-col`,children:[(0,J.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:t.sourceHint}),(0,J.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:N,onChange:e=>P(e.target.value),placeholder:t.sourcePlaceholder,autoFocus:!0}),(0,J.jsxs)(`div`,{className:`mt-auto flex justify-end gap-2 border-t border-edge pt-4`,children:[(0,J.jsx)(T,{asChild:!0,children:(0,J.jsx)(C,{type:`button`,variant:`secondary`,children:t.close})}),(0,J.jsx)(C,{type:`button`,disabled:c||!N.trim(),onClick:()=>void B(()=>Bt(e,N.trim())),children:c?t.installing:t.install})]})]})})]})]})}),(0,J.jsx)(Et,{open:!!h,onOpenChange:e=>{e||g(null)},children:(0,J.jsxs)(we,{children:[(0,J.jsx)(ye,{className:`fixed inset-0 z-50 bg-black/45`}),(0,J.jsxs)(xe,{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,J.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-5 py-4`,children:[(0,J.jsx)(M,{className:`text-base font-semibold text-fg`,children:h?.name}),(0,J.jsx)(T,{asChild:!0,children:(0,J.jsx)(C,{type:`button`,variant:`ghost`,className:`size-9 p-0`,children:(0,J.jsx)(oe,{className:`size-4`})})})]}),(0,J.jsx)(`pre`,{className:`min-h-0 flex-1 overflow-auto whitespace-pre-wrap p-5 text-sm leading-6 text-fg-muted`,children:h?.bodyMarkdown})]})]})})]})}function Ut(e){let t=(0,q.c)(13),{icon:n,title:r,hint:i,onClick:a}=e,o;t[0]===n?o=t[1]:(o=(0,J.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,J.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,J.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,J.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,J.jsx)(Ve,{asChild:!0,children:(0,J.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}var Wt=`application/x-xopc-work-item`,Gt=[`backlog`,`todo`,`in_progress`,`blocked`,`needs_input`,`in_review`,`done`],Kt=[`low`,`normal`,`high`,`urgent`];function qt(e){return e===`done`||e===`in_review`?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`blocked`||e===`needs_input`?`bg-red-500/10 text-red-700 dark:text-red-300`:e===`in_progress`?`bg-accent-soft text-accent-fg`:e===`backlog`||e===`todo`?`bg-amber-500/10 text-amber-700 dark:text-amber-300`:`bg-surface-muted text-fg-subtle`}function Jt(e){return e?bt(new Date(e)):``}function Yt(e){return!Number.isFinite(e)||e<=0?`0 B`:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(+(e<10*1024))} KB`:`${(e/(1024*1024)).toFixed(+(e<10*1024*1024))} MB`}function Xt(e){return`${e.name}:${e.size}:${e.lastModified}`}function Zt(e,t){return ke(e,t)!==`unsupported`}function Qt(e,t){return e.startsWith(`image/`)?`image`:e.startsWith(`audio/`)?`audio`:t===`image`||t===`audio`||t===`video`?t:`document`}function $t(e,t){return{id:e.id,name:e.fileName,type:Qt(e.mimeType,e.type),mimeType:e.mimeType,size:e.size,...t?{content:t,preview:e.mimeType.startsWith(`image/`)?t:void 0}:{}}}async function en(e,t){let n=_(e.name||`upload`,e.type||`application/octet-stream`),r=Te(await e.arrayBuffer());return{id:t,name:e.name||`upload`,type:Qt(n),mimeType:n,size:e.size,content:r,preview:n.startsWith(`image/`)?r:void 0}}function tn(e){let t=(0,q.c)(3),[n,r]=(0,K.useState)(``),i,a;return t[0]===e?(i=t[1],a=t[2]):(i=()=>{if(!e){r(``);return}let t=URL.createObjectURL(e);return r(t),()=>URL.revokeObjectURL(t)},a=[e],t[0]=e,t[1]=i,t[2]=a),(0,K.useEffect)(i,a),n}function nn(e,t){let n=(0,q.c)(5),[r,i]=(0,K.useState)(``),a,o;return n[0]!==t.id||n[1]!==t.mimeType||n[2]!==e?(a=()=>{if(!e||!t.mimeType.startsWith(`image/`)){i(``);return}let n=!1,r=``;return(async()=>{let a=await m(Ge(e,t.id));if(!a.ok||n)return;let o=await a.blob();n||(r=URL.createObjectURL(o),i(r))})().catch(()=>{n||i(``)}),()=>{n=!0,r&&URL.revokeObjectURL(r)}},o=[t.id,t.mimeType,e],n[0]=t.id,n[1]=t.mimeType,n[2]=e,n[3]=a,n[4]=o):(a=n[3],o=n[4]),(0,K.useEffect)(a,o),r}function rn(e){let t=(0,q.c)(11),{name:n,mimeType:r,thumbnailUrl:i,previewable:a,disabled:o,onOpen:s}=e,c;t[0]===r?c=t[1]:(c=r.startsWith(`image/`),t[0]=r,t[1]=c);let l=c,u;t[2]!==l||t[3]!==n||t[4]!==i?(u=l&&i?(0,J.jsx)(`img`,{src:i,alt:n,className:`size-10 rounded-md object-cover`}):(0,J.jsx)(`span`,{className:`inline-flex size-10 items-center justify-center rounded-md border border-edge bg-surface-muted`,children:(0,J.jsx)(he,{className:`size-4 text-fg-muted`,"aria-hidden":!0})}),t[2]=l,t[3]=n,t[4]=i,t[5]=u):u=t[5];let d=u;if(!a)return d;let f;return t[6]!==d||t[7]!==o||t[8]!==n||t[9]!==s?(f=(0,J.jsx)(`button`,{type:`button`,className:`shrink-0 rounded-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel disabled:cursor-wait disabled:opacity-70`,title:n,"aria-label":n,disabled:o,onClick:s,children:d}),t[6]=d,t[7]=o,t[8]=n,t[9]=s,t[10]=f):f=t[10],f}function Y(e){return e.kind===`chat`?`/chat/${encodeURIComponent(e.targetId)}`:e.kind===`goal`?`/goals/${encodeURIComponent(e.targetId)}`:e.kind===`workflow_run`?`/workflows?run=${encodeURIComponent(e.targetId)}`:e.kind===`automation`?`/automations?automationId=${encodeURIComponent(e.targetId)}`:`#`}function an(e){return e instanceof Element?!!e.closest(`a,button,input,select,textarea,[contenteditable="true"],[draggable="true"],[data-board-pan-skip="true"]`):!0}function on(e,t){return e.nextAction||e.blockedReason||e.description||t.noNextAction}function sn(e){let t=(0,q.c)(63),{item:n,dragging:r,onOpen:i,onToggleDone:a,onDragStart:s,onDragEnd:c,t:u}=e,d=n.status===`done`,f;t[0]!==n||t[1]!==s?(f=e=>s(n,e),t[0]=n,t[1]=s,t[2]=f):f=t[2];let p=u.dragToUpdate,m=r&&`opacity-50`,h;t[3]===m?h=t[4]:(h=l(`flex min-h-24 w-full min-w-0 max-w-full cursor-grab flex-col overflow-hidden rounded-lg bg-surface-panel p-3 shadow-surface transition-colors hover:bg-surface-hover active:cursor-grabbing`,m),t[3]=m,t[4]=h);let g=d?`border-success bg-success text-white`:`border-edge bg-surface-base hover:border-accent/50`,_;t[5]===g?_=t[6]:(_=l(`mt-0.5 inline-flex size-3.5 shrink-0 items-center justify-center rounded border transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,g),t[5]=g,t[6]=_);let v=d?u.markTodo:u.markDone,y=d?u.markTodo:u.markDone,b;t[7]!==n||t[8]!==a?(b=()=>a(n),t[7]=n,t[8]=a,t[9]=b):b=t[9];let x;t[10]===d?x=t[11]:(x=d?(0,J.jsx)(lt,{className:`size-3`,"aria-hidden":!0}):null,t[10]=d,t[11]=x);let S;t[12]!==x||t[13]!==_||t[14]!==v||t[15]!==y||t[16]!==b?(S=(0,J.jsx)(`button`,{type:`button`,className:_,"aria-label":v,title:y,onClick:b,children:x}),t[12]=x,t[13]=_,t[14]=v,t[15]=y,t[16]=b,t[17]=S):S=t[17];let C;t[18]!==n||t[19]!==i?(C=()=>i(n),t[18]=n,t[19]=i,t[20]=C):C=t[20];let w;t[21]===n.title?w=t[22]:(w=(0,J.jsx)(`h4`,{className:`min-w-0 flex-1 basis-0 text-sm font-medium leading-5 text-fg line-clamp-2`,children:n.title}),t[21]=n.title,t[22]=w);let T;t[23]!==n||t[24]!==u?(T=on(n,u),t[23]=n,t[24]=u,t[25]=T):T=t[25];let E;t[26]===T?E=t[27]:(E=(0,J.jsx)(`p`,{className:`mt-2 max-w-full break-words text-xs leading-5 text-fg-muted line-clamp-1`,children:T}),t[26]=T,t[27]=E);let D;t[28]!==C||t[29]!==w||t[30]!==E?(D=(0,J.jsxs)(`button`,{type:`button`,className:`min-w-0 flex-1 text-left`,onClick:C,children:[w,E]}),t[28]=C,t[29]=w,t[30]=E,t[31]=D):D=t[31];let O;t[32]!==S||t[33]!==D?(O=(0,J.jsxs)(`div`,{className:`flex min-w-0 max-w-full items-start gap-2`,children:[S,D]}),t[32]=S,t[33]=D,t[34]=O):O=t[34];let k;t[35]===n.status?k=t[36]:(k=l(`rounded-full px-2 py-0.5 text-[11px] font-medium`,qt(n.status)),t[35]=n.status,t[36]=k);let A=u.statuses[n.status],j;t[37]!==k||t[38]!==A?(j=(0,J.jsx)(`span`,{className:k,children:A}),t[37]=k,t[38]=A,t[39]=j):j=t[39];let M=u.priorities[n.priority],N;t[40]===M?N=t[41]:(N=(0,J.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-[11px] text-fg-muted`,children:M}),t[40]=M,t[41]=N);let P;t[42]===n.attachments?P=t[43]:(P=n.attachments?.length?(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-surface-muted px-2 py-0.5 text-[11px] text-fg-muted`,children:[(0,J.jsx)(Tt,{className:`size-3`,"aria-hidden":!0}),n.attachments.length]}):null,t[42]=n.attachments,t[43]=P);let F;t[44]===n.links?F=t[45]:(F=n.links?.length?(0,J.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-[11px] text-fg-muted`,children:n.links.length}):null,t[44]=n.links,t[45]=F);let I=`/work-items/${encodeURIComponent(n.id)}`,L;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,J.jsx)(Ce,{className:`size-3`,"aria-hidden":!0}),t[46]=L):L=t[46];let R;t[47]!==u.detail.openItem||t[48]!==I?(R=(0,J.jsxs)(o,{to:I,className:`ml-auto inline-flex shrink-0 items-center gap-1 rounded-full px-2 py-0.5 text-[11px] font-medium text-accent hover:bg-accent-soft hover:text-accent-fg`,children:[u.detail.openItem,L]}),t[47]=u.detail.openItem,t[48]=I,t[49]=R):R=t[49];let z;t[50]!==j||t[51]!==N||t[52]!==P||t[53]!==F||t[54]!==R?(z=(0,J.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5`,children:[j,N,P,F,R]}),t[50]=j,t[51]=N,t[52]=P,t[53]=F,t[54]=R,t[55]=z):z=t[55];let B;return t[56]!==c||t[57]!==u.dragToUpdate||t[58]!==f||t[59]!==O||t[60]!==z||t[61]!==h?(B=(0,J.jsxs)(`article`,{draggable:!0,onDragStart:f,onDragEnd:c,title:p,className:h,children:[O,z]}),t[56]=c,t[57]=u.dragToUpdate,t[58]=f,t[59]=O,t[60]=z,t[61]=h,t[62]=B):B=t[62],B}function cn(){let e=(0,q.c)(3),t,n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`div`,{className:`size-3.5 shrink-0 rounded-full bg-surface-muted`}),(0,J.jsx)(`div`,{className:`h-3 w-36 rounded bg-surface-muted`})]}),n=(0,J.jsx)(`div`,{className:`mt-3 h-3 w-48 rounded bg-surface-muted`}),e[0]=t,e[1]=n):(t=e[0],n=e[1]);let r;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,J.jsxs)(`article`,{className:`flex h-24 w-full min-w-0 max-w-full flex-col overflow-hidden rounded-lg bg-surface-panel px-3 pt-3 pb-0 shadow-surface`,children:[t,n,(0,J.jsxs)(`div`,{className:`mt-3 flex gap-1.5`,children:[(0,J.jsx)(`div`,{className:`h-5 w-16 rounded-full bg-surface-muted`}),(0,J.jsx)(`div`,{className:`h-5 w-10 rounded-full bg-surface-muted`})]})]}),e[2]=r):r=e[2],r}function ln(e){let t=(0,q.c)(44),{file:n,index:r,busy:i,previewBusy:a,t:o,onOpen:s,onRemove:c}=e,u,d,f,p;t[0]===n?(u=t[1],d=t[2],f=t[3],p=t[4]):(u=_(n.name||`upload`,n.type||`application/octet-stream`),d=Zt(n.name||`upload`,u),f=tn,p=u.startsWith(`image/`)?n:null,t[0]=n,t[1]=u,t[2]=d,t[3]=f,t[4]=p);let m=f(p),h=n.name||`upload`,g=i||a,v;t[5]!==n||t[6]!==s?(v=()=>s(n),t[5]=n,t[6]=s,t[7]=v):v=t[7];let y;t[8]!==u||t[9]!==d||t[10]!==h||t[11]!==g||t[12]!==v||t[13]!==m?(y=(0,J.jsx)(rn,{name:h,mimeType:u,thumbnailUrl:m,previewable:d,disabled:g,onOpen:v}),t[8]=u,t[9]=d,t[10]=h,t[11]=g,t[12]=v,t[13]=m,t[14]=y):y=t[14];let b=d?`rounded-md hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`:`cursor-default`,x;t[15]===b?x=t[16]:(x=l(`min-w-0 flex-1 text-left`,b),t[15]=b,t[16]=x);let S=!d||i||a,C;t[17]!==n||t[18]!==s?(C=()=>s(n),t[17]=n,t[18]=s,t[19]=C):C=t[19];let w=n.name||`upload`,T;t[20]===w?T=t[21]:(T=(0,J.jsx)(`div`,{className:`truncate font-medium text-fg`,children:w}),t[20]=w,t[21]=T);let E;t[22]===n.size?E=t[23]:(E=Yt(n.size),t[22]=n.size,t[23]=E);let D;t[24]===E?D=t[25]:(D=(0,J.jsx)(`div`,{className:`text-xs text-fg-subtle`,children:E}),t[24]=E,t[25]=D);let O;t[26]!==C||t[27]!==T||t[28]!==D||t[29]!==x||t[30]!==S?(O=(0,J.jsxs)(`button`,{type:`button`,className:x,disabled:S,onClick:C,children:[T,D]}),t[26]=C,t[27]=T,t[28]=D,t[29]=x,t[30]=S,t[31]=O):O=t[31];let k;t[32]!==r||t[33]!==c?(k=()=>c(r),t[32]=r,t[33]=c,t[34]=k):k=t[34];let A;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,J.jsx)(oe,{className:`size-3.5`,"aria-hidden":!0}),t[35]=A):A=t[35];let j;t[36]!==i||t[37]!==o.attachments.remove||t[38]!==k?(j=(0,J.jsx)(`button`,{type:`button`,className:`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,title:o.attachments.remove,"aria-label":o.attachments.remove,disabled:i,onClick:k,children:A}),t[36]=i,t[37]=o.attachments.remove,t[38]=k,t[39]=j):j=t[39];let M;return t[40]!==O||t[41]!==j||t[42]!==y?(M=(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 rounded-md border border-edge bg-surface-panel p-2 text-sm`,children:[y,O,j]}),t[40]=O,t[41]=j,t[42]=y,t[43]=M):M=t[43],M}function un(e){let t=(0,q.c)(56),{item:n,attachment:r,busy:i,previewBusy:a,t:o,onOpen:s,onDownload:c,onRemove:u}=e,d;t[0]!==r.fileName||t[1]!==r.mimeType?(d=Zt(r.fileName,r.mimeType),t[0]=r.fileName,t[1]=r.mimeType,t[2]=d):d=t[2];let f=d,p=nn(n.id,r),m=i||a,h;t[3]!==r||t[4]!==n||t[5]!==s?(h=()=>s(n,r),t[3]=r,t[4]=n,t[5]=s,t[6]=h):h=t[6];let g;t[7]!==r.fileName||t[8]!==r.mimeType||t[9]!==f||t[10]!==m||t[11]!==h||t[12]!==p?(g=(0,J.jsx)(rn,{name:r.fileName,mimeType:r.mimeType,thumbnailUrl:p,previewable:f,disabled:m,onOpen:h}),t[7]=r.fileName,t[8]=r.mimeType,t[9]=f,t[10]=m,t[11]=h,t[12]=p,t[13]=g):g=t[13];let _=f?`rounded-md hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`:`cursor-default`,v;t[14]===_?v=t[15]:(v=l(`min-w-0 flex-1 text-left`,_),t[14]=_,t[15]=v);let y=!f||i||a,b;t[16]!==r||t[17]!==n||t[18]!==s?(b=()=>s(n,r),t[16]=r,t[17]=n,t[18]=s,t[19]=b):b=t[19];let x;t[20]===r.fileName?x=t[21]:(x=(0,J.jsx)(`div`,{className:`truncate font-medium text-fg`,children:r.fileName}),t[20]=r.fileName,t[21]=x);let S=r.mimeType,C;t[22]===r.size?C=t[23]:(C=Yt(r.size),t[22]=r.size,t[23]=C);let w;t[24]!==r.mimeType||t[25]!==C?(w=(0,J.jsxs)(`div`,{className:`truncate text-xs text-fg-subtle`,children:[S,` · `,C]}),t[24]=r.mimeType,t[25]=C,t[26]=w):w=t[26];let T;t[27]!==w||t[28]!==v||t[29]!==y||t[30]!==b||t[31]!==x?(T=(0,J.jsxs)(`button`,{type:`button`,className:v,disabled:y,onClick:b,children:[x,w]}),t[27]=w,t[28]=v,t[29]=y,t[30]=b,t[31]=x,t[32]=T):T=t[32];let E;t[33]!==r||t[34]!==n||t[35]!==c?(E=()=>c(n,r),t[33]=r,t[34]=n,t[35]=c,t[36]=E):E=t[36];let D;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,J.jsx)(z,{className:`size-3.5`,"aria-hidden":!0}),t[37]=D):D=t[37];let O;t[38]!==i||t[39]!==o.attachments.download||t[40]!==E?(O=(0,J.jsx)(`button`,{type:`button`,className:`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,title:o.attachments.download,"aria-label":o.attachments.download,disabled:i,onClick:E,children:D}),t[38]=i,t[39]=o.attachments.download,t[40]=E,t[41]=O):O=t[41];let k;t[42]!==r||t[43]!==n||t[44]!==u?(k=()=>u(n,r),t[42]=r,t[43]=n,t[44]=u,t[45]=k):k=t[45];let A;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,J.jsx)(V,{className:`size-3.5`,"aria-hidden":!0}),t[46]=A):A=t[46];let j;t[47]!==i||t[48]!==o.attachments.remove||t[49]!==k?(j=(0,J.jsx)(`button`,{type:`button`,className:`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-danger`,title:o.attachments.remove,"aria-label":o.attachments.remove,disabled:i,onClick:k,children:A}),t[47]=i,t[48]=o.attachments.remove,t[49]=k,t[50]=j):j=t[50];let M;return t[51]!==T||t[52]!==O||t[53]!==j||t[54]!==g?(M=(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 rounded-md border border-edge bg-surface-panel p-2 text-sm`,children:[g,T,O,j]}),t[51]=T,t[52]=O,t[53]=j,t[54]=g,t[55]=M):M=t[55],M}function dn({mode:e,item:t,pendingFiles:n,busy:r,t:i,onPendingFilesChange:a,onUpload:o,onRemove:s,onDownload:c,onPreviewError:u}){let d=(0,K.useRef)(null),[p,h]=(0,K.useState)(!1),[g,_]=(0,K.useState)(!1),[v,y]=(0,K.useState)(null),[b,S]=(0,K.useState)(null),w=f(e=>e.token),T=t?.attachments??[];function E(r){if(!r.length)return;if(e===`detail`&&t){o(t,r);return}let i=new Set(n.map(Xt)),s=[...n];for(let e of r){let t=Xt(e);i.has(t)||(i.add(t),s.push(e))}a(s)}function D(e){a(n.filter((t,n)=>n!==e))}async function O(e){let t=Xt(e);S(`pending:${t}`);try{y(await en(e,`pending:${t}`)),_(!0)}catch(e){u(e instanceof Error?e.message:String(e))}finally{S(null)}}async function k(e,t){S(`saved:${t.id}`);try{let n=await m(Ge(e.id,t.id));if(!n.ok)throw Error(`HTTP ${n.status}`);y($t(t,Te(await n.arrayBuffer()))),_(!0)}catch(e){u(e instanceof Error?e.message:String(e))}finally{S(null)}}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`section`,{className:l(`grid gap-3 rounded-lg border border-edge bg-surface-base p-3`,p&&`border-accent bg-accent-soft/40`),onDragOver:e=>{e.preventDefault(),h(!0)},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||h(!1)},onDrop:e=>{e.preventDefault(),h(!1),E(Array.from(e.dataTransfer.files))},children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsxs)(`h3`,{className:`inline-flex min-w-0 items-center gap-2 text-sm font-semibold text-fg`,children:[(0,J.jsx)(Tt,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`truncate`,children:i.attachments.title})]}),(0,J.jsxs)(C,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:r,onClick:()=>d.current?.click(),children:[(0,J.jsx)(x,{className:`size-3.5`,"aria-hidden":!0}),i.attachments.add]}),(0,J.jsx)(`input`,{ref:d,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{E(Array.from(e.target.files??[])),e.currentTarget.value=``}})]}),n.length?(0,J.jsx)(`div`,{className:`grid gap-2`,children:n.map((e,t)=>(0,J.jsx)(ln,{file:e,index:t,busy:r,previewBusy:b===`pending:${Xt(e)}`,t:i,onOpen:e=>void O(e),onRemove:D},Xt(e)))}):null,t&&T.length?(0,J.jsx)(`div`,{className:`grid gap-2`,children:T.map(e=>(0,J.jsx)(un,{item:t,attachment:e,busy:r,previewBusy:b===`saved:${e.id}`,t:i,onOpen:(e,t)=>void k(e,t),onDownload:c,onRemove:s},e.id))}):null,!n.length&&!T.length?(0,J.jsx)(`p`,{className:`text-sm text-fg-muted`,children:i.attachments.empty}):null]}),(0,J.jsx)(G,{open:g,attachment:v,authToken:w,layerClassName:`z-[100]`,onClose:()=>{_(!1),y(null)}})]})}function fn(e){let t=(0,q.c)(169),{mode:n,item:r,initialStatus:i,events:a,busy:s,error:c,notice:u,t:d,onClose:f,onCreate:p,onSave:m,onStartChat:h,onCreateGoal:g,onAddAttachments:_,onRemoveAttachment:v,onDownloadAttachment:y,onPreviewError:b}=e,S=n!==null,[w,E]=(0,K.useState)(``),[D,O]=(0,K.useState)(``),[k,A]=(0,K.useState)(`todo`),[j,N]=(0,K.useState)(`normal`),[P,I]=(0,K.useState)(``),[L,R]=(0,K.useState)(``),z;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(z=[],t[0]=z):z=t[0];let[B,V]=(0,K.useState)(z),H,U;t[1]!==i||t[2]!==r||t[3]!==n?(H=()=>{if(n===`create`){E(``),O(``),A(i),N(`normal`),I(``),R(``),V([]);return}n===`detail`&&r&&(E(r.title),O(r.description??``),A(r.status),N(r.priority),I(r.nextAction??``),R(r.blockedReason??``),V([]))},U=[i,r,n],t[1]=i,t[2]=r,t[3]=n,t[4]=H,t[5]=U):(H=t[4],U=t[5]),(0,K.useEffect)(H,U);let ee;t[6]!==L||t[7]!==D||t[8]!==r||t[9]!==n||t[10]!==P||t[11]!==p||t[12]!==m||t[13]!==B||t[14]!==j||t[15]!==k||t[16]!==w?(ee=function(e){e.preventDefault();let t=w.trim();if(t){if(n===`create`){p({title:t,description:D.trim()||void 0,priority:j,status:k,nextAction:P.trim()||void 0,blockedReason:L.trim()||void 0,attachments:B});return}r&&m(r,{title:t,description:D.trim()||null,status:k,priority:j,nextAction:P.trim()||null,blockedReason:L.trim()||null})}},t[6]=L,t[7]=D,t[8]=r,t[9]=n,t[10]=P,t[11]=p,t[12]=m,t[13]=B,t[14]=j,t[15]=k,t[16]=w,t[17]=ee):ee=t[17];let te=ee,W;t[18]===f?W=t[19]:(W=e=>!e&&f(),t[18]=f,t[19]=W);let ne;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,J.jsx)(ye,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),t[20]=ne):ne=t[20];let re=n===`create`?d.create.title:r?.title||d.title,ie;t[21]===re?ie=t[22]:(ie=(0,J.jsx)(M,{className:`truncate text-base font-semibold text-fg`,children:re}),t[21]=re,t[22]=ie);let ae;t[23]===d.detail.description?ae=t[24]:(ae=(0,J.jsx)(F,{className:`mt-1 text-sm text-fg-muted`,children:d.detail.description}),t[23]=d.detail.description,t[24]=ae);let se;t[25]!==ie||t[26]!==ae?(se=(0,J.jsxs)(`div`,{className:`min-w-0`,children:[ie,ae]}),t[25]=ie,t[26]=ae,t[27]=se):se=t[27];let ce;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(ce=(0,J.jsx)(oe,{className:`size-4`,"aria-hidden":!0}),t[28]=ce):ce=t[28];let G;t[29]===s?G=t[30]:(G=(0,J.jsx)(T,{asChild:!0,children:(0,J.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`,disabled:s,children:ce})}),t[29]=s,t[30]=G);let le;t[31]!==se||t[32]!==G?(le=(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-3 border-b border-edge px-5 py-4`,children:[se,G]}),t[31]=se,t[32]=G,t[33]=le):le=t[33];let ue;t[34]===c?ue=t[35]:(ue=c?(0,J.jsx)(`div`,{className:`rounded-lg border border-danger/30 bg-danger-soft px-3 py-2 text-sm text-danger`,children:c}):null,t[34]=c,t[35]=ue);let de;t[36]!==c||t[37]!==u?(de=!c&&u?(0,J.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg border border-success/30 bg-success-soft px-3 py-2 text-sm text-fg`,role:`status`,"aria-live":`polite`,children:[(0,J.jsx)(lt,{className:`mt-0.5 size-4 shrink-0 text-success`,"aria-hidden":!0}),(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`div`,{className:`font-medium text-success`,children:u.title}),(0,J.jsx)(`div`,{className:`mt-1 text-fg-muted`,children:u.message})]})]}):null,t[36]=c,t[37]=u,t[38]=de):de=t[38];let fe;t[39]===d.create.titleLabel?fe=t[40]:(fe=(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:d.create.titleLabel}),t[39]=d.create.titleLabel,t[40]=fe);let pe;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(pe=e=>E(e.target.value),t[41]=pe):pe=t[41];let me;t[42]===w?me=t[43]:(me=(0,J.jsx)(`input`,{className:`h-10 rounded-lg border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,value:w,onChange:pe}),t[42]=w,t[43]=me);let he;t[44]!==fe||t[45]!==me?(he=(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[fe,me]}),t[44]=fe,t[45]=me,t[46]=he):he=t[46];let ge;t[47]===d.detail.status?ge=t[48]:(ge=(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:d.detail.status}),t[47]=d.detail.status,t[48]=ge);let _e;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(_e=e=>A(e.target.value),t[49]=_e):_e=t[49];let ve;t[50]===d.statuses?ve=t[51]:(ve=Gt.map(e=>(0,J.jsx)(Xe,{value:e,children:d.statuses[e]},e)),t[50]=d.statuses,t[51]=ve);let be;t[52]!==k||t[53]!==ve?(be=(0,J.jsx)(rt,{className:`h-10 rounded-lg border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,value:k,onChange:_e,children:ve}),t[52]=k,t[53]=ve,t[54]=be):be=t[54];let Se;t[55]!==ge||t[56]!==be?(Se=(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[ge,be]}),t[55]=ge,t[56]=be,t[57]=Se):Se=t[57];let Te;t[58]===d.create.priorityLabel?Te=t[59]:(Te=(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:d.create.priorityLabel}),t[58]=d.create.priorityLabel,t[59]=Te);let Oe;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=e=>N(e.target.value),t[60]=Oe):Oe=t[60];let ke;t[61]===d.priorities?ke=t[62]:(ke=Kt.map(e=>(0,J.jsx)(Xe,{value:e,children:d.priorities[e]},e)),t[61]=d.priorities,t[62]=ke);let Ae;t[63]!==j||t[64]!==ke?(Ae=(0,J.jsx)(rt,{className:`h-10 rounded-lg border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,value:j,onChange:Oe,children:ke}),t[63]=j,t[64]=ke,t[65]=Ae):Ae=t[65];let je;t[66]!==Te||t[67]!==Ae?(je=(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[Te,Ae]}),t[66]=Te,t[67]=Ae,t[68]=je):je=t[68];let Me;t[69]!==Se||t[70]!==je?(Me=(0,J.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[Se,je]}),t[69]=Se,t[70]=je,t[71]=Me):Me=t[71];let Ne;t[72]===d.create.descriptionLabel?Ne=t[73]:(Ne=(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:d.create.descriptionLabel}),t[72]=d.create.descriptionLabel,t[73]=Ne);let Pe;t[74]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=e=>O(e.target.value),t[74]=Pe):Pe=t[74];let Fe;t[75]===D?Fe=t[76]:(Fe=(0,J.jsx)(`textarea`,{className:`min-h-28 rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none focus:border-accent`,value:D,onChange:Pe}),t[75]=D,t[76]=Fe);let Ie;t[77]!==Ne||t[78]!==Fe?(Ie=(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[Ne,Fe]}),t[77]=Ne,t[78]=Fe,t[79]=Ie):Ie=t[79];let Le;t[80]!==s||t[81]!==r||t[82]!==n||t[83]!==_||t[84]!==y||t[85]!==b||t[86]!==v||t[87]!==B||t[88]!==d?(Le=(0,J.jsx)(dn,{mode:n,item:r,pendingFiles:B,busy:s,t:d,onPendingFilesChange:V,onUpload:_,onRemove:v,onDownload:y,onPreviewError:b}),t[80]=s,t[81]=r,t[82]=n,t[83]=_,t[84]=y,t[85]=b,t[86]=v,t[87]=B,t[88]=d,t[89]=Le):Le=t[89];let Re;t[90]!==L||t[91]!==n||t[92]!==P||t[93]!==k||t[94]!==d.blockedReason||t[95]!==d.nextAction?(Re=n===`detail`?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:d.nextAction}),(0,J.jsx)(`textarea`,{className:`min-h-20 rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none focus:border-accent`,value:P,onChange:e=>I(e.target.value)})]}),(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,J.jsx)(`span`,{className:l(`font-medium`,k===`blocked`||k===`needs_input`?`text-red-700 dark:text-red-300`:`text-fg-muted`),children:d.blockedReason}),(0,J.jsx)(`textarea`,{className:l(`min-h-20 rounded-lg border bg-surface-base px-3 py-2 text-sm text-fg outline-none focus:border-accent`,k===`blocked`||k===`needs_input`?`border-red-500/40`:`border-edge`),value:L,onChange:e=>R(e.target.value)})]})]}):null,t[90]=L,t[91]=n,t[92]=P,t[93]=k,t[94]=d.blockedReason,t[95]=d.nextAction,t[96]=Re):Re=t[96];let ze;t[97]!==ue||t[98]!==de||t[99]!==he||t[100]!==Me||t[101]!==Ie||t[102]!==Le||t[103]!==Re?(ze=(0,J.jsxs)(`div`,{className:`grid content-start gap-4`,children:[ue,de,he,Me,Ie,Le,Re]}),t[97]=ue,t[98]=de,t[99]=he,t[100]=Me,t[101]=Ie,t[102]=Le,t[103]=Re,t[104]=ze):ze=t[104];let Be;t[105]!==s||t[106]!==r||t[107]!==n||t[108]!==g||t[109]!==h||t[110]!==d.detail.actions||t[111]!==d.detail.createGoal||t[112]!==d.detail.openItem||t[113]!==d.detail.startChat?(Be=n===`detail`&&r?(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:d.detail.actions}),(0,J.jsxs)(`div`,{className:`mt-2 grid gap-2`,children:[(0,J.jsxs)(C,{type:`button`,variant:`secondary`,className:`justify-start rounded-lg`,disabled:s,onClick:()=>h(r),children:[(0,J.jsx)(Ee,{className:`size-4`,"aria-hidden":!0}),d.detail.startChat]}),(0,J.jsxs)(C,{type:`button`,variant:`secondary`,className:`justify-start rounded-lg`,disabled:s,onClick:()=>g(r),children:[(0,J.jsx)(De,{className:`size-4`,"aria-hidden":!0}),d.detail.createGoal]}),(0,J.jsx)(C,{asChild:!0,variant:`secondary`,className:`justify-start rounded-lg`,children:(0,J.jsxs)(o,{to:`/work-items/${encodeURIComponent(r.id)}`,children:[(0,J.jsx)(Ce,{className:`size-4`,"aria-hidden":!0}),d.detail.openItem]})})]})]}):null,t[105]=s,t[106]=r,t[107]=n,t[108]=g,t[109]=h,t[110]=d.detail.actions,t[111]=d.detail.createGoal,t[112]=d.detail.openItem,t[113]=d.detail.startChat,t[114]=Be):Be=t[114];let Ve;t[115]===d.detail.links?Ve=t[116]:(Ve=(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:d.detail.links}),t[115]=d.detail.links,t[116]=Ve);let He;t[117]!==r||t[118]!==d.detail.noLinks||t[119]!==d.linkKinds?(He=r?.links?.length?r.links.slice(0,6).map(e=>(0,J.jsxs)(o,{to:Y(e),className:`flex min-w-0 items-center justify-between gap-3 rounded-md px-2 py-1.5 hover:bg-surface-hover`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:e.title||e.targetId}),(0,J.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 text-xs text-fg-muted`,children:[d.linkKinds[e.kind],(0,J.jsx)(Ce,{className:`size-3.5`,"aria-hidden":!0})]})]},e.id)):(0,J.jsx)(`p`,{className:`text-sm text-fg-muted`,children:d.detail.noLinks}),t[117]=r,t[118]=d.detail.noLinks,t[119]=d.linkKinds,t[120]=He):He=t[120];let Ue;t[121]===He?Ue=t[122]:(Ue=(0,J.jsx)(`div`,{className:`mt-2 grid gap-2 text-sm`,children:He}),t[121]=He,t[122]=Ue);let We;t[123]!==Ve||t[124]!==Ue?(We=(0,J.jsxs)(`section`,{children:[Ve,Ue]}),t[123]=Ve,t[124]=Ue,t[125]=We):We=t[125];let Ge;t[126]===d.detail.activity?Ge=t[127]:(Ge=(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:d.detail.activity}),t[126]=d.detail.activity,t[127]=Ge);let Ke;t[128]!==a||t[129]!==d.detail.noActivity||t[130]!==d.eventTypes?(Ke=a.length?a.slice(0,5).map(e=>(0,J.jsxs)(`div`,{className:`text-sm`,children:[(0,J.jsx)(`div`,{className:`font-medium text-fg`,children:d.eventTypes[e.type]??e.type}),(0,J.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-subtle`,children:Jt(e.createdAt)})]},e.id)):(0,J.jsx)(`p`,{className:`text-sm text-fg-muted`,children:d.detail.noActivity}),t[128]=a,t[129]=d.detail.noActivity,t[130]=d.eventTypes,t[131]=Ke):Ke=t[131];let qe;t[132]===Ke?qe=t[133]:(qe=(0,J.jsx)(`div`,{className:`mt-2 grid gap-2`,children:Ke}),t[132]=Ke,t[133]=qe);let Je;t[134]!==Ge||t[135]!==qe?(Je=(0,J.jsxs)(`section`,{children:[Ge,qe]}),t[134]=Ge,t[135]=qe,t[136]=Je):Je=t[136];let Ye;t[137]!==Be||t[138]!==We||t[139]!==Je?(Ye=(0,J.jsxs)(`aside`,{className:`grid content-start gap-5`,children:[Be,We,Je]}),t[137]=Be,t[138]=We,t[139]=Je,t[140]=Ye):Ye=t[140];let Ze;t[141]!==ze||t[142]!==Ye?(Ze=(0,J.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-6 overflow-y-auto px-5 py-4 lg:grid-cols-[minmax(0,1fr)_16rem]`,children:[ze,Ye]}),t[141]=ze,t[142]=Ye,t[143]=Ze):Ze=t[143];let Qe;t[144]!==s||t[145]!==f||t[146]!==d.create.cancel?(Qe=(0,J.jsx)(C,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:f,disabled:s,children:d.create.cancel}),t[144]=s,t[145]=f,t[146]=d.create.cancel,t[147]=Qe):Qe=t[147];let $e;t[148]!==s||t[149]!==w?($e=s||!w.trim(),t[148]=s,t[149]=w,t[150]=$e):$e=t[150];let et;t[151]===n?et=t[152]:(et=n===`create`?(0,J.jsx)(x,{className:`size-4`,"aria-hidden":!0}):null,t[151]=n,t[152]=et);let tt=n===`create`?d.create.submit:d.detail.save,nt;t[153]!==$e||t[154]!==et||t[155]!==tt?(nt=(0,J.jsxs)(C,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:$e,children:[et,tt]}),t[153]=$e,t[154]=et,t[155]=tt,t[156]=nt):nt=t[156];let it;t[157]!==Qe||t[158]!==nt?(it=(0,J.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[Qe,nt]}),t[157]=Qe,t[158]=nt,t[159]=it):it=t[159];let at;t[160]!==te||t[161]!==le||t[162]!==Ze||t[163]!==it?(at=(0,J.jsxs)(we,{children:[ne,(0,J.jsx)(xe,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(86dvh,48rem)] w-[min(60rem,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,J.jsxs)(`form`,{onSubmit:te,className:`flex min-h-0 flex-1 flex-col`,children:[le,Ze,it]})})]}),t[160]=te,t[161]=le,t[162]=Ze,t[163]=it,t[164]=at):at=t[164];let ot;return t[165]!==S||t[166]!==W||t[167]!==at?(ot=(0,J.jsx)(Et,{open:S,onOpenChange:W,children:at}),t[165]=S,t[166]=W,t[167]=at,t[168]=ot):ot=t[168],ot}function pn({projectId:e,createRequestKey:t=0}){let n=a(),r=d(p(e=>e.language)).projectDetailPage.workItems,i=(0,K.useRef)(null),o=(0,K.useRef)(null),[s,c]=(0,K.useState)([]),[u,f]=(0,K.useState)(!0),[m,h]=(0,K.useState)(null),[g,_]=(0,K.useState)(null),[v,y]=(0,K.useState)(!1),[b,S]=(0,K.useState)(null),[w,T]=(0,K.useState)(null),[E,D]=(0,K.useState)(!1),[O,k]=(0,K.useState)(!1),[A,M]=(0,K.useState)(!1),[N,P]=(0,K.useState)(`todo`),[F,I]=(0,K.useState)(null),[L,R]=(0,K.useState)([]),z=(0,K.useCallback)(async(t=`replace`,n=0)=>{f(!0),h(null);try{let r=await Pe(e,{limit:100,offset:n});c(e=>t===`append`?[...e,...r.items]:r.items),k(r.hasMore)}catch(e){h(e instanceof Error?e.message:String(e))}finally{f(!1)}},[e]);(0,K.useEffect)(()=>{z(`replace`,0)},[z]),(0,K.useEffect)(()=>{t&&(I(null),R([]),h(null),_(null),P(`todo`),M(!0))},[t]);let B=(0,K.useMemo)(()=>Gt.map(e=>({status:e,title:r.statuses[e],items:s.filter(t=>t.status===e)})),[s,r.statuses]),V=(0,K.useCallback)(e=>{c(t=>t.map(t=>t.id===e.id?e:t)),I(t=>t?.id===e.id?e:t)},[]),H=(0,K.useCallback)(async(e,t)=>{y(!0),h(null),_(null);try{let n=await Ie(e.id,t);n.item.archivedAt?(c(e=>e.filter(e=>e.id!==n.item.id)),I(null)):(V(n.item),_({title:r.feedback.savedTitle,message:r.feedback.savedNext}))}catch(e){h(e instanceof Error?e.message:String(e))}finally{y(!1)}},[r.feedback.savedNext,r.feedback.savedTitle,V]),U=(0,K.useCallback)(async e=>{I(e),R([]),h(null),_(null);let t=await yt(e.id).catch(()=>null);t&&R(t.events)},[]),ee=(0,K.useCallback)(async t=>{y(!0),h(null),_(null);try{let n=await Je(e,t);c(e=>[n.item,...e]),M(!1),I(n.item),R((await yt(n.item.id).catch(()=>({events:[]}))).events),_({title:r.feedback.createdTitle,message:r.feedback.createdNext})}catch(e){h(e instanceof Error?e.message:String(e))}finally{y(!1)}},[e,r.feedback.createdNext,r.feedback.createdTitle]),te=(0,K.useCallback)(async(e,t)=>{if(t.length){y(!0),h(null),_(null);try{let n=await $e(e.id,t);V(n.item),R((await yt(n.item.id).catch(()=>({events:[]}))).events)}catch(e){h(e instanceof Error?e.message:String(e))}finally{y(!1)}}},[V]),W=(0,K.useCallback)(async(e,t)=>{y(!0),h(null),_(null);try{let n=await at(e.id,t.id);V(n.item),R((await yt(n.item.id).catch(()=>({events:[]}))).events)}catch(e){h(e instanceof Error?e.message:String(e))}finally{y(!1)}},[V]),ne=(0,K.useCallback)(async(e,t)=>{h(null),_(null);try{await ht(e.id,t)}catch(e){h(e instanceof Error?e.message:String(e))}},[]),re=(0,K.useCallback)(async e=>{y(!0),h(null),_(null);try{let t=await ze(e.id);V(t.item),await U(t.item),n(`/chat/${encodeURIComponent(t.session.key)}`)}catch(e){h(e instanceof Error?e.message:String(e))}finally{y(!1)}},[n,U,V]),ie=(0,K.useCallback)(async e=>{y(!0),h(null),_(null);try{let t=await Me(e.id);V(t.item),await U(t.item),n(`/goals/${encodeURIComponent(t.goal.id)}`)}catch(e){h(e instanceof Error?e.message:String(e))}finally{y(!1)}},[n,U,V]),ae=(0,K.useCallback)((e,t)=>{t.dataTransfer.effectAllowed=`move`,t.dataTransfer.setData(Wt,e.id),S(e.id)},[]),oe=(0,K.useCallback)((e,t)=>{t.preventDefault();let n=t.dataTransfer.getData(Wt)||b;T(null),S(null);let r=s.find(e=>e.id===n);!r||r.status===e||H(r,{status:e})},[b,s,H]),se=(0,K.useCallback)(e=>{H(e,{status:e.status===`done`?`todo`:`done`})},[H]),ce=(0,K.useCallback)(e=>{I(null),R([]),h(null),_(null),P(e),M(!0)},[]),G=(0,K.useCallback)(e=>{let t=o.current;!t||t.pointerId!==e.pointerId||(o.current=null,D(!1),e.currentTarget.hasPointerCapture?.(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))},[]),le=(0,K.useCallback)(e=>{if(e.button!==0||b||an(e.target))return;let t=i.current;t&&(o.current={pointerId:e.pointerId,startX:e.clientX,scrollLeft:t.scrollLeft,active:!1},e.currentTarget.setPointerCapture(e.pointerId))},[b]),ue=(0,K.useCallback)(e=>{let t=o.current,n=i.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,D(!0)),e.preventDefault(),n.scrollLeft=t.scrollLeft-r)},[]);return(0,J.jsxs)(`section`,{id:`project-panel-work-items`,role:`tabpanel`,"aria-labelledby":`project-tab-work-items`,className:`flex h-full min-h-0 flex-col`,children:[m?(0,J.jsx)(`div`,{className:`rounded-lg border border-red-500/30 bg-red-500/10 px-4 py-3 text-sm text-red-700 dark:text-red-300`,children:m}):null,(0,J.jsx)(`section`,{ref:i,className:l(`min-h-0 flex-1 overflow-x-auto rounded-lg p-2 transition-opacity`,u&&`opacity-60`,E?`cursor-grabbing select-none`:`cursor-grab`),"aria-label":r.boardAria,"aria-busy":u,onPointerDown:le,onPointerMove:ue,onPointerUp:G,onPointerCancel:G,onLostPointerCapture:e=>{o.current?.pointerId===e.pointerId&&(o.current=null,D(!1))},children:(0,J.jsx)(`div`,{className:`flex min-h-full min-w-max items-start gap-3 pr-4`,children:B.map(e=>(0,J.jsxs)(`section`,{className:l(`flex max-h-full w-72 min-w-72 max-w-72 shrink-0 flex-col overflow-y-auto rounded-lg bg-surface-base shadow-surface`,w===e.status&&`bg-surface-active`),"aria-label":e.title,onDragOver:t=>{b&&(t.preventDefault(),t.dataTransfer.dropEffect=`move`,T(e.status))},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||T(null)},onDrop:t=>oe(e.status,t),children:[(0,J.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-2 p-3`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,J.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:e.title}),(0,J.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:e.items.length})]}),(0,J.jsx)(j,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0})]}),(0,J.jsxs)(`div`,{className:`mx-2 mt-3 grid min-h-0 min-w-0 content-start gap-2 pb-2 pr-1 [scrollbar-gutter:stable]`,children:[e.items.length?e.items.map(e=>(0,J.jsx)(sn,{item:e,dragging:b===e.id,onOpen:U,onToggleDone:se,onDragStart:ae,onDragEnd:()=>{S(null),T(null)},t:r},e.id)):u?(0,J.jsxs)(`div`,{className:`grid gap-2 animate-pulse motion-reduce:animate-none`,children:[(0,J.jsx)(cn,{}),(0,J.jsx)(cn,{})]}):(0,J.jsx)(`div`,{className:`rounded-lg bg-surface-panel/70 px-3 py-6 text-center text-xs text-fg-subtle`,children:r.emptyColumn}),u?null:(0,J.jsx)(`button`,{type:`button`,className:`inline-flex h-8 w-full items-center justify-center rounded-lg bg-surface-panel/85 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-muted`,"aria-label":r.create.addToColumn.replace(`{{status}}`,e.title),title:r.create.addToColumn.replace(`{{status}}`,e.title),onClick:()=>ce(e.status),children:(0,J.jsx)(x,{className:`size-4`,"aria-hidden":!0})})]})]},e.status))})}),!u&&O?(0,J.jsx)(C,{type:`button`,variant:`secondary`,className:`justify-self-center`,onClick:()=>void z(`append`,s.length),children:r.loadMore}):null,(0,J.jsx)(fn,{mode:A?`create`:F?`detail`:null,item:F,initialStatus:N,events:L,busy:v,error:m,notice:g,t:r,onClose:()=>{M(!1),I(null),R([]),h(null),_(null)},onCreate:ee,onSave:(e,t)=>void H(e,t),onStartChat:re,onCreateGoal:ie,onAddAttachments:(e,t)=>void te(e,t),onRemoveAttachment:(e,t)=>void W(e,t),onDownloadAttachment:(e,t)=>void ne(e,t),onPreviewError:e=>{_(null),h(e)}})]})}var mn=[{id:`overview`,icon:et},{id:`work-items`,icon:Fe},{id:`sessions`,icon:Ee},{id:`goals`,icon:De},{id:`workflows`,icon:W},{id:`files`,icon:ne},{id:`activity`,icon:D},{id:`automations`,icon:re},{id:`notes`,icon:U},{id:`skills`,icon:st},{id:`settings`,icon:Be}],hn=new Set([`work-items`,`goals`,`workflows`,`automations`]),gn=new Set(mn.map(e=>e.id)),X=`xopc.projectFiles.panelWidthPx`,_n=320,vn=220,yn=560;function bn(e){return Math.min(yn,Math.max(vn,Math.round(e)))}function xn(){try{let e=window.localStorage.getItem(X);if(e==null)return _n;let t=Number.parseInt(e,10);return Number.isFinite(t)?bn(t):_n}catch{return _n}}function Sn(e){try{window.localStorage.setItem(X,String(bn(e)))}catch{}}function Cn(e){return!!(e&&gn.has(e))}function wn(e){return hn.has(e)}function Tn(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function En(e,t=``){if(!e)return t;let n=new Date(e);return Number.isNaN(n.getTime())?String(e):bt(n)}function Dn(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 On(e){return e===`succeeded`?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`failed`||e===`timeout`||e===`cancelled`?`bg-red-500/10 text-red-700 dark:text-red-300`:e===`running`||e===`queued`?`bg-accent-soft text-accent-fg`:`bg-surface-hover text-fg-muted`}function kn(e){let t=(0,q.c)(8),{label:n,hint:r,children:i}=e,a;t[0]===n?a=t[1]:(a=(0,J.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,J.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,J.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 An(e=!1){return l(`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 jn(e){let t=(0,q.c)(10),{label:n,value:r,mono:i}=e,a=i===void 0?!1:i,o;t[0]===n?o=t[1]:(o=(0,J.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=l(`mt-1 min-w-0 truncate text-sm text-fg`,s),t[2]=s,t[3]=c);let u;t[4]!==c||t[5]!==r?(u=(0,J.jsx)(`div`,{className:c,title:r,children:r}),t[4]=c,t[5]=r,t[6]=u):u=t[6];let d;return t[7]!==o||t[8]!==u?(d=(0,J.jsxs)(`div`,{className:`min-w-0 rounded-md bg-surface-base px-3 py-2`,children:[o,u]}),t[7]=o,t[8]=u,t[9]=d):d=t[9],d}function Mn(e){return[e.name,e.slug,e.workspaceRoot,e.description,e.brief].filter(Boolean).join(` `).toLowerCase()}function Nn(e){let t=e.lastActiveAt??e.updatedAt??e.createdAt,n=t?new Date(t).getTime():0;return Number.isFinite(n)?n:0}function Pn(e){return e.trim().replace(/[\\/]+$/,``).split(/[\\/]/).filter(Boolean).pop()??``}function Fn(e){let t=e?.body;return t?.code===`workspace_root_missing`&&t.workspaceRoot?t.workspaceRoot:null}function In(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 Ln(e){return e.primaryObject.title?.trim()||e.primaryObject.id}function Rn(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 zn(e){let t=e.sourceChannel?.trim();if(t)return Bn(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 Bn(r||``)}function Bn(e){let t=e.trim().toLowerCase();return t?t===`tui`?`TUI`:t===`acp`?`ACP`:t===`webchat`?`Webchat`:t:``}function Vn(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 Hn(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 Un(e,t,n){return e.map(e=>e.path===t?{...e,children:n}:e.isDirectory&&e.children?.length?{...e,children:Un(e.children,t,n)}:e)}function Wn({currentProject:e,pm:t,projectsText:n,wd:r}){let i=a(),[o,c]=(0,K.useState)(!1),[u,d]=(0,K.useState)([e]),[f,p]=(0,K.useState)(``),[m,h]=(0,K.useState)(!1),[g,_]=(0,K.useState)(null),[v,y]=(0,K.useState)(!1),[S,w]=(0,K.useState)(`new`),[E,D]=(0,K.useState)(``),[O,k]=(0,K.useState)(``),[A,j]=(0,K.useState)(!1),[N,P]=(0,K.useState)(null),[I,L]=(0,K.useState)(null),R=(0,K.useCallback)(async()=>{h(!0),_(null);try{let t=await be({limit:100});d(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){_(e instanceof Error?e.message:String(e))}finally{h(!1)}},[e]);(0,K.useEffect)(()=>{d(t=>[e,...t.filter(t=>t.id!==e.id)])},[e]),(0,K.useEffect)(()=>{o&&R()},[R,o]);let z=(0,K.useMemo)(()=>{let t=f.trim().toLowerCase().split(/\s+/).filter(Boolean);return u.filter(t=>t.id!==e.id).filter(e=>{if(t.length===0)return!0;let n=Mn(e);return t.every(e=>n.includes(e))}).sort((e,t)=>Nn(t)-Nn(e))},[e.id,u,f]),B=e=>t.statuses[e.status]??e.status,V=e=>e.workspaceRoot||e.effectiveWorkspaceRoot||e.description||e.brief||t.common.defaultWorkspace,H=e=>{w(e),D(``),k(``),P(null),y(!0),c(!1)},U=(0,K.useCallback)(async(e={})=>{let t=O.trim(),n=E.trim()||(S===`directory`?Pn(t):``);if(n){j(!0),P(null),L(null);try{let r=await b({name:n,...t?{workspaceRoot:t}:{},...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}});y(!1),D(``),k(``),d(e=>[r,...e.filter(e=>e.id!==r.id)]),i(`/projects/${encodeURIComponent(r.id)}`)}catch(e){let t=Fn(e);t?(L(t),y(!1)):P(e instanceof Error?e.message:String(e))}finally{j(!1)}}},[S,E,i,O]),ee=(0,K.useCallback)(e=>{e.preventDefault(),U()},[U]),te=(0,K.useCallback)(()=>{U({createWorkspaceRoot:!0})},[U]),W=(0,K.useCallback)(()=>{L(null),y(!0)},[]),re=e=>{k(e),S===`directory`&&!E.trim()&&D(Pn(e))},ie=(e,t)=>(0,J.jsxs)(`button`,{type:`button`,className:l(`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:()=>{c(!1),t||i(`/projects/${encodeURIComponent(e.id)}`)},children:[(0,J.jsx)(s,{className:l(`size-4 text-accent-fg`,!t&&`invisible`),"aria-hidden":!0}),(0,J.jsxs)(`span`,{className:`min-w-0`,children:[(0,J.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:e.name}),(0,J.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:V(e)})]}),(0,J.jsx)(`span`,{className:l(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,Dn(e.status)),children:B(e)})]},e.id);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(Ke,{open:o,onOpenChange:c,children:[(0,J.jsx)(Ue,{asChild:!0,children:(0,J.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,J.jsxs)(`span`,{className:`min-w-0`,children:[(0,J.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,J.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:e.name}),(0,J.jsx)(`span`,{className:l(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,Dn(e.status)),children:B(e)})]}),(0,J.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:V(e)})]}),(0,J.jsx)(je,{className:`size-4 shrink-0 text-fg-subtle transition-transform group-data-[state=open]:rotate-180`,"aria-hidden":!0})]})}),(0,J.jsx)(tt,{children:(0,J.jsxs)(ct,{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,J.jsxs)(`label`,{className:`relative block`,children:[(0,J.jsx)(He,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,J.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:f,onChange:e=>p(e.target.value),placeholder:t.projectSwitcher.searchPlaceholder,"aria-label":t.projectSwitcher.searchPlaceholder})]}),(0,J.jsxs)(`div`,{className:`mt-1 max-h-[min(54vh,24rem)] overflow-y-auto pr-0.5 [scrollbar-gutter:stable]`,children:[(0,J.jsx)(`div`,{className:`px-2 pb-1 pt-2 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.projectSwitcher.current}),ie(e,!0),(0,J.jsx)(`div`,{className:`px-2 pb-1 pt-3 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.projectSwitcher.recent}),g?(0,J.jsx)(`div`,{className:`p-2 text-xs text-red-600 dark:text-red-400`,children:g}):null,m&&z.length===0?(0,J.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.loading}):null,!m&&z.length===0?(0,J.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.noMatches}):null,z.map(e=>ie(e,!1))]}),(0,J.jsxs)(`div`,{className:`mt-1 border-t border-edge-subtle pt-1`,children:[(0,J.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:()=>H(`new`),children:[(0,J.jsx)(x,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.newProject})]}),(0,J.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:()=>H(`directory`),children:[(0,J.jsx)(ne,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.openDirectory})]}),(0,J.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:()=>{c(!1),i(`/projects`)},children:[(0,J.jsx)(Be,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.manageProjects})]})]})]})})]}),(0,J.jsx)(Et,{open:v,onOpenChange:e=>!A&&y(e),children:(0,J.jsxs)(we,{children:[(0,J.jsx)(ye,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(xe,{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,J.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,J.jsx)(M,{className:`text-base font-semibold text-fg`,children:S===`directory`?t.projectSwitcher.createFromDirectoryTitle:n.createTitle}),(0,J.jsx)(F,{className:`mt-1 text-sm text-fg-muted`,children:S===`directory`?t.projectSwitcher.createFromDirectoryDescription:n.createDescription})]}),(0,J.jsxs)(`form`,{onSubmit:ee,className:`flex min-h-0 flex-1 flex-col`,children:[(0,J.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[N?(0,J.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:N}):null,(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.projectName}),(0,J.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:E,onChange:e=>D(e.target.value),placeholder:`xopc`})]}),(0,J.jsxs)(`div`,{className:`grid gap-1.5 text-sm`,children:[(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.workspaceRoot}),(0,J.jsx)(kt,{value:O,onChange:re,disabled:A,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,J.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.workspaceHint})]})]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,J.jsx)(T,{asChild:!0,children:(0,J.jsx)(C,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:A,children:n.cancel})}),(0,J.jsxs)(C,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:A||!(E.trim()||S===`directory`&&Pn(O)),children:[(0,J.jsx)(x,{className:`size-4`,"aria-hidden":!0}),n.create]})]})]})]})]})}),(0,J.jsx)(Et,{open:!!I,onOpenChange:e=>{e||L(null)},children:(0,J.jsxs)(we,{children:[(0,J.jsx)(ye,{className:`fixed inset-0 z-[100] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(xe,{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,J.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,J.jsx)(M,{className:`text-base font-semibold text-fg`,children:n.workspaceMissingTitle}),(0,J.jsx)(F,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:I?Tn(n.workspaceMissingDescription,{workspace:I}):null})]}),I?(0,J.jsx)(`div`,{className:`px-5 py-4`,children:(0,J.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-surface-muted px-3 py-2 text-sm text-fg-muted`,children:[(0,J.jsx)(ne,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:I})]})}):null,(0,J.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,J.jsx)(C,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:W,disabled:A,children:n.workspaceMissingBack}),(0,J.jsxs)(C,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:te,disabled:A,children:[(0,J.jsx)(ae,{className:`size-4`,"aria-hidden":!0}),n.workspaceMissingCreate]})]})]})]})})]})}function Gn(){let{projectId:e=``,tabId:t,noteId:n}=i(),r=a(),s=d(p(e=>e.language)),f=s.chat.workingDirectory,m=s.projectDetailPage,h=s.projectsPage,g=_e(e=>e.setPageHeader),_=_e(e=>e.clearPageHeader),[v,b]=(0,K.useState)(null),[S,j]=(0,K.useState)(null),[I,z]=(0,K.useState)([]),[G,he]=(0,K.useState)(``),[be,Ce]=(0,K.useState)([]),[Te,je]=(0,K.useState)([]),[Me,Pe]=(0,K.useState)([]),[Ie,ze]=(0,K.useState)([]),[Ve,Ue]=(0,K.useState)([]),[We,Ge]=(0,K.useState)(!1),[Ke,qe]=(0,K.useState)(null),[Je,$e]=(0,K.useState)([]),[tt,at]=(0,K.useState)(0),[ct,lt]=(0,K.useState)(!1),[ht,yt]=(0,K.useState)(!1),[bt,Tt]=(0,K.useState)(!1),[Nt,Pt]=(0,K.useState)([]),Ft=(0,K.useRef)(new Set),[q,It]=(0,K.useState)(null),[Lt,Rt]=(0,K.useState)(xn),[zt,Bt]=(0,K.useState)(!1),[Vt,Ut]=(0,K.useState)(!1),[Wt,Gt]=(0,K.useState)(``),[Kt,qt]=(0,K.useState)([]),[Jt,Yt]=(0,K.useState)(!1),[Xt,Zt]=(0,K.useState)(null),[Qt,$t]=(0,K.useState)(!1),[en,tn]=(0,K.useState)(null),[nn,rn]=(0,K.useState)([]),[Y,an]=(0,K.useState)(``),[on,sn]=(0,K.useState)(!0),[cn,ln]=(0,K.useState)(!1),[un,dn]=(0,K.useState)(!1),[fn,mn]=(0,K.useState)(null),[hn,gn]=(0,K.useState)(!1),[X,_n]=(0,K.useState)(`fixed`),[vn,yn]=(0,K.useState)(``),[Mn,Nn]=(0,K.useState)(null),[Pn,Bn]=(0,K.useState)(!1),[Gn,Kn]=(0,K.useState)(!1),[qn,Jn]=(0,K.useState)(0),[Yn,Xn]=(0,K.useState)(!1),[Zn,Qn]=(0,K.useState)(null),[$n,er]=(0,K.useState)(!1),[tr,nr]=(0,K.useState)(!1),[rr,ir]=(0,K.useState)(!1),[ar,Z]=(0,K.useState)(null),[or,sr]=(0,K.useState)({defaultAgentId:``,agents:[],models:[],checklistDecomposePolicy:`empty_only`}),[cr,lr]=(0,K.useState)({title:``,reason:``}),[Q,ur]=(0,K.useState)({name:``,description:``,status:`active`,defaultAgentId:``,workspaceRoot:``,brief:``,instructions:``}),dr=`overview`,$=n?`notes`:Cn(t)?t:dr,fr=(0,K.useCallback)(t=>{e&&r(`/projects/${encodeURIComponent(e)}/${t}`)},[r,e]),pr=(0,K.useCallback)(t=>e?`/projects/${encodeURIComponent(e)}/${t}`:`/projects`,[e]),mr=(0,K.useCallback)(e=>{let t=pr(`goals`);return`/goals/${encodeURIComponent(e)}?returnTo=${encodeURIComponent(t)}`},[pr]),hr=(0,K.useCallback)(t=>{e&&r(pr(t),{replace:!0})},[r,e,pr]),gr=(0,K.useCallback)((e,t)=>{hr(e),r(t)},[r,hr]),_r=(0,K.useCallback)(e=>t=>{t.defaultPrevented||t.button!==0||t.metaKey||t.altKey||t.ctrlKey||t.shiftKey||hr(e)},[hr]),vr=(0,K.useCallback)(e=>e.startsWith(`/goals/`)?`goals`:e.startsWith(`/chat/`)?`sessions`:e.startsWith(`/workflows`)?`workflows`:e.startsWith(`/automations`)?`automations`:e.startsWith(`/notes`)?`notes`:$,[$]);(0,K.useEffect)(()=>{!e||!t||Cn(t)||r(`/projects/${encodeURIComponent(e)}/${dr}`,{replace:!0})},[dr,r,e,t]),(0,K.useEffect)(()=>{if(!e)return;let t=!1;return sn(!0),Z(null),Promise.all([wt(e),w(e),pe(e),N().catch(()=>null)]).then(([e,n,r,i])=>{if(t)return;let a=e.project;b(a),j(e),z(n),Ce(r),rn(i?.agents??[]),an(a.defaultAgentId??``),ur({name:a.name,description:a.description??``,status:a.status,defaultAgentId:a.defaultAgentId??``,workspaceRoot:a.workspaceRoot??``,brief:a.brief??``,instructions:a.instructions??``})}).catch(e=>{t||Z(e instanceof Error?e.message:String(e))}).finally(()=>{t||sn(!1)}),()=>{t=!0}},[e]),(0,K.useEffect)(()=>{let e=!1;async function t(){let[t,n,r]=await Promise.allSettled([N(),fe(),Re()]);e||sr(e=>{let i=t.status===`fulfilled`?t.value.defaultId:e.defaultAgentId,a=v?.defaultAgentId||Y||i,o=t.status===`fulfilled`?t.value.agents:e.agents,s=n.status===`fulfilled`?n.value:e.models,c=r.status===`fulfilled`?At(r.value.payload?.config).checklistDecomposePolicy:e.checklistDecomposePolicy;return{defaultAgentId:a,agents:o.length?o:[{id:a||`main`,workspace:``,profileDir:``,typedModels:{defaultRole:`deep`,preset:[],effective:[]},extends:[],isDefault:!0,skills:{preset:[]},tools:{presetDenied:[],entryDisable:[],effectiveDisable:[]}}],models:s,checklistDecomposePolicy:c}})}return t(),()=>{e=!0}},[v?.defaultAgentId,Y]);let yr=(0,K.useCallback)(async()=>{if(v){Xn(!0),Z(null);try{let[e,t]=await Promise.all([y(),ee(100,{ownerAgentId:Y||void 0,projectId:v.id})]);je(e),Pe(t)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Xn(!1)}}},[v,Y]);(0,K.useEffect)(()=>{v&&yr()},[v,yr]);let br=(0,K.useCallback)(async()=>{if(v){Ge(!0),Z(null);try{let[e,t]=await Promise.all([xt.list({projectId:v.id}),xt.runs(50,void 0,{projectId:v.id})]);ze(e.automations),Ue(t.runs)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Ge(!1)}}},[v]);(0,K.useEffect)(()=>{$===`automations`&&br()},[br,$]);let xr=(0,K.useCallback)(async()=>{if(v){lt(!0),Z(null);try{let e=await L(v.id,{includeRelated:ht,limit:100});$e(e.items),at(e.total)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{lt(!1)}}},[v,ht]);(0,K.useEffect)(()=>{$===`activity`&&xr()},[xr,$]);let Sr=(0,K.useCallback)(async e=>{qe(`run:${e.id}`),Z(null);try{await xt.runNow(e.id),await br()}catch(e){Z(e instanceof Error?e.message:String(e))}finally{qe(null)}},[br]),Cr=(0,K.useCallback)(async e=>{qe(`toggle:${e.id}`),Z(null);try{e.enabled?await xt.pause(e.id):await xt.resume(e.id),await br()}catch(e){Z(e instanceof Error?e.message:String(e))}finally{qe(null)}},[br]),wr=(0,K.useCallback)(async()=>{if(!v?.effectiveWorkspaceRoot?.trim()){Pt([]),Ft.current.clear(),tn(null);return}$t(!0),tn(null),Ft.current.clear();try{Pt(Hn((await H(v.id,``)).entries)),Ft.current.add(``)}catch(e){Pt([]),Ft.current.clear(),tn(e instanceof Error?e.message:String(e))}finally{$t(!1)}},[v]),Tr=(0,K.useCallback)(async e=>{if(!(!v?.effectiveWorkspaceRoot?.trim()||Ft.current.has(e))){Ft.current.add(e),tn(null);try{let t=await H(v.id,e);Pt(n=>Un(n,e,Hn(t.entries)))}catch(t){Ft.current.delete(e),tn(t instanceof Error?t.message:String(t))}}},[v]);(0,K.useEffect)(()=>{$===`files`&&wr()},[wr,$]);let Er=Wt.trim();(0,K.useEffect)(()=>{if($!==`files`||!v||!Vt||!Er){qt([]),Yt(!1),Zt(null);return}let e=!1;Yt(!0),Zt(null),qt([]);let t=window.setTimeout(()=>{A(v.id,Er,50).then(t=>{e||qt(t)}).catch(t=>{e||Zt(t instanceof Error?t.message:String(t))}).finally(()=>{e||Yt(!1)})},180);return()=>{e=!0,window.clearTimeout(t)}},[Er,v,Vt,$]);let Dr=(0,K.useCallback)(async()=>{if(v){Kn(!0),Z(null);try{let e=await ie(v.id);gr(`sessions`,`/chat/${encodeURIComponent(e.key)}`)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Kn(!1)}}},[gr,v]),Or=(0,K.useCallback)(()=>{fr(`work-items`),Jn(e=>e+1)},[fr]),kr=(0,K.useCallback)(async()=>{if(!v)return;let[e,t]=await Promise.all([wt(v.id),pe(v.id)]);j(e),b(e.project),Ce(t)},[v]),Ar=(0,K.useCallback)(async e=>{if(!v||!e.title.trim())return;let t=Number.parseInt(e.maxTurns,10),n=e.deadline?new Date(e.deadline).getTime():void 0;er(!0),Z(null);try{await te(v.id,{title:e.title.trim(),description:e.description.trim()||void 0,attachments:e.attachments.length?e.attachments:void 0,priority:e.priority,deadlineAt:Number.isFinite(n)?n:void 0,maxTurns:Number.isFinite(t)?t:void 0,agentId:e.agentId.trim()||void 0,judgeModelRef:e.judgeModelRef.trim()||void 0,contract:{objective:e.objective.trim()||e.title.trim(),scopeBoundary:e.scopeBoundary.trim()||void 0,evidencePlan:jt(e.evidencePlan),criteria:jt(e.checklist)}}),ir(!1),fr(`goals`),await kr()}catch(e){throw Z(e instanceof Error?e.message:String(e)),e}finally{er(!1)}},[fr,v,kr]),jr=(0,K.useCallback)(async e=>{if(e.preventDefault(),!(!v||!cr.title.trim())){nr(!0),Z(null);try{await Ze(v.id,{title:cr.title.trim(),reason:cr.reason.trim()||void 0}),lr({title:``,reason:``}),await kr()}catch(e){Z(e instanceof Error?e.message:String(e))}finally{nr(!1)}}},[cr.reason,cr.title,v,kr]),Mr=(0,K.useCallback)(async e=>{if(v){Qn(`retry:${e.id}`),Z(null);try{let t=await O(e.id,{ownerAgentId:Y||e.metadata?.agentId,projectId:e.metadata?.projectId||v.id});await yr(),gr(`workflows`,vt(t.runId,{ownerAgentId:Y||e.metadata?.agentId||v.defaultAgentId}))}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Qn(null)}}},[gr,v,yr,Y]),Nr=(0,K.useCallback)(async e=>{Qn(`cancel:${e.id}`),Z(null);try{await E(e.id,{ownerAgentId:Y||e.metadata?.agentId}),await yr()}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Qn(null)}},[yr,Y]),Pr=(0,K.useMemo)(()=>(0,J.jsx)(o,{to:`/projects`,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":m.backToProjects,children:(0,J.jsx)(se,{className:`size-4`,"aria-hidden":!0})}),[m.backToProjects]),Fr=(0,K.useMemo)(()=>v?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(C,{variant:`secondary`,className:`h-9 rounded-lg`,onClick:Or,children:[(0,J.jsx)(x,{className:`size-4`,"aria-hidden":!0}),m.workItems.create.header]}),(0,J.jsxs)(C,{variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>void Dr(),disabled:Gn,children:[(0,J.jsx)(Ee,{className:`size-4`,"aria-hidden":!0}),m.common.newChat]})]}):null,[Or,m.common.newChat,m.workItems.create.header,v,Dr,Gn]);(0,K.useLayoutEffect)(()=>(g({startExtra:Pr,main:v?(0,J.jsx)(Wn,{currentProject:v,pm:m,projectsText:h,wd:f}):(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:m.fallbackTitle}),(0,J.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:m.fallbackContext})]}),end:Fr}),()=>_()),[_,Fr,Pr,m,v,h,g,f]);function Ir(e){b(t=>t?{...t,...e}:null),j(t=>t?{...t,project:{...t.project,...e}}:null),an(e.defaultAgentId??``),ur(t=>({...t,name:e.name,description:e.description??``,status:e.status,defaultAgentId:e.defaultAgentId??``,workspaceRoot:e.workspaceRoot??``,brief:e.brief??``,instructions:e.instructions??``})),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}async function Lr(){if(!(!v||!Q.name.trim())){ln(!0),Z(null),mn(null);try{Ir(await ut(v.id,{name:Q.name.trim(),status:Q.status,description:Q.description,defaultAgentId:Q.defaultAgentId,brief:Q.brief,instructions:Q.instructions}))}catch(e){let t=Fn(e);t?mn(t):Z(e instanceof Error?e.message:String(e))}finally{ln(!1)}}}function Rr(e){e.preventDefault(),Lr()}let zr=(0,K.useCallback)(()=>{if(!v)return;let e=v.workspaceRoot?.trim()??``;_n(e?`fixed`:`follow`),yn(e||v.effectiveWorkspaceRoot||``),gn(!0)},[v]);async function Br(e={}){if(!v)return;let t=X===`fixed`?vn.trim():``;if(!(X===`fixed`&&!t)){ln(!0),Z(null),mn(null);try{Ir(await ut(v.id,{workspaceRoot:t,...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}})),gn(!1),mn(null)}catch(e){let t=Fn(e);t?(mn(t),gn(!1)):Z(e instanceof Error?e.message:String(e))}finally{ln(!1)}}}async function Vr(){if(!(!v||Mn)){Nn(`pin`),Z(null);try{Ir(v.pinnedAt?await B(v.id):await P(v.id))}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Nn(null)}}}async function Hr(){if(!(!v||Mn)){Nn(`archive`),Z(null);try{Ir(v.status===`archived`?await ve(v.id):await Qe(v.id))}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Nn(null)}}}async function Ur(){if(v){Bn(!0),Z(null);try{await le(v.id),dn(!1),r(`/projects`)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Bn(!1)}}}async function Wr(){if(!(!v||bt)){Tt(!0),Z(null);try{await Se(v.id)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Tt(!1)}}}let Gr=(0,K.useCallback)(e=>{It(e)},[]),Kr=(0,K.useCallback)((e,t)=>{t||It(e)},[]),qr=(0,K.useCallback)(async(e,t,n)=>{let r=v?.id;if(r)switch(e){case`preview`:t.isDirectory||It(t.path);break;case`download`:if(t.isDirectory)return;try{let e=de(t.path);if(Le(ke(e))!==`text`){let n=await dt(t.path,{projectId:r}),i=Oe(e)??`application/octet-stream`;_t(e,await n.arrayBuffer(),i)}else{let{content:n}=await Ye(t.path,{projectId:r});nt(e,n)}}catch(e){gt(`warning`,e instanceof Error?e.message:String(e),void 0,{duration:4e3})}break;case`copyPath`:try{await u(t.absolutePath??t.path)&>(`success`,s.workspace.pathCopied,void 0,{duration:2500})}catch{gt(`warning`,s.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}},[s.clipboard.copyFailed,s.workspace.pathCopied,v?.id]),Jr=(0,K.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=Lt,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=bn(i+(e.clientX-r)),o===0&&(o=window.requestAnimationFrame(l))},d=()=>{o!==0&&(window.cancelAnimationFrame(o),l());try{t.releasePointerCapture(a)}catch{}Bt(!1),Rt(c),Sn(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)},[Lt]);if((0,K.useEffect)(()=>{$!==`files`&&It(null)},[e,$]),on)return(0,J.jsx)(`main`,{className:`w-full flex-1 p-3 text-sm text-fg-muted sm:px-5 sm:py-4 xl:px-6`,children:m.loading});if(!v)return(0,J.jsxs)(`main`,{className:`w-full flex-1 p-3 sm:px-5 sm:py-4 xl:px-6`,children:[(0,J.jsxs)(o,{to:`/projects`,className:`inline-flex items-center gap-2 text-sm text-accent-fg hover:underline`,children:[(0,J.jsx)(se,{className:`size-4`,"aria-hidden":!0}),m.backToProjects]}),(0,J.jsx)(`p`,{className:`mt-6 rounded-lg bg-surface-panel p-4 shadow-surface text-sm text-fg-muted`,children:ar||m.notFound})]});let Yr=S?.recentSessions.length?S.recentSessions:v.recentSessions,Xr=S?.attentionItems??[],Zr=e=>m.statuses[e]??e,Qr=e=>Tn(m.common.messages,{count:e}),$r=G.trim().toLowerCase(),ei=$r?I.filter(e=>{let t=En(e.updatedAt),n=e.routing?.agentId||e.agentId||m.common.agent,r=e.name?.trim()||m.sessions.fallbackTitle,i=Qr(e.messageCount??0),a=zn(e);return[r,e.key,n,a,t,i].filter(Boolean).join(` `).toLowerCase().includes($r)}):I,ti=I.length>0&&ei.length===0,ni=nn.find(e=>e.id===Q.defaultAgentId)?.name||Q.defaultAgentId||m.settings.globalDefaultAgent,ri=nn.find(e=>e.id===Q.defaultAgentId),ii=v.workspaceRoot?.trim()||``,ai=v.status===`archived`,oi=!!v.pinnedAt,si=!ii,ci=ii||ri?.workspace||v.effectiveWorkspaceRoot||m.common.defaultWorkspace,li=X===`fixed`?vn.trim()||m.settings.workspacePlaceholder:ri?.workspace||v.effectiveWorkspaceRoot||m.common.defaultWorkspace,ui=(X===`fixed`?vn.trim():``)!==ii&&(X===`follow`||!!vn.trim()),di=[{id:`overview`,icon:et,label:m.tabs.overview},{id:`work`,icon:Fe,label:m.tabs.work},{id:`files`,icon:ne,label:m.tabs.files},{id:`notes`,icon:U,label:m.tabs.notes},{id:`skills`,icon:st,label:m.tabs.skills},{id:`sessions`,icon:Ee,label:m.tabs.sessions},{id:`activity`,icon:D,label:m.tabs.activity}],fi=[{id:`work-items`,icon:Fe,label:m.tabs.workItems},{id:`goals`,icon:De,label:m.tabs.goals},{id:`workflows`,icon:W,label:m.tabs.workflows},{id:`automations`,icon:re,label:m.tabs.automations}],pi=wn($)?`work`:$;async function mi(){if(!ci)return;let e=await u(ci);gt(e?`success`:`warning`,e?s.workspace.pathCopied:s.clipboard.copyFailed,void 0,{duration:e?2500:4e3})}function hi(){mn(null),gn(!0)}return(0,J.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,J.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3`,children:[(0,J.jsx)(Ot,{items:di,activeTab:pi,onChange:e=>fr(e===`work`?`work-items`:e),ariaLabel:m.navAria,tabIdPrefix:`project-primary-tab`,className:`min-w-0 flex-1`}),(0,J.jsxs)(C,{id:`project-primary-tab-settings`,type:`button`,variant:$===`settings`?`secondary`:`ghost`,className:`h-9 shrink-0 rounded-lg px-3`,"aria-current":$===`settings`?`page`:void 0,onClick:()=>fr(`settings`),children:[(0,J.jsx)(Be,{className:`size-4`,"aria-hidden":!0}),m.tabs.settings]})]}),ar?(0,J.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:ar}):null,wn($)?(0,J.jsx)(`div`,{className:`mt-3 shrink-0 rounded-xl border border-edge-subtle bg-surface-panel px-2 py-1 shadow-surface`,children:(0,J.jsx)(Ot,{items:fi,activeTab:$,onChange:fr,ariaLabel:m.workNavAria,tabIdPrefix:`project-work-tab`,panelIdPrefix:`project-panel`,buttonClassName:`h-8 px-2.5 py-1.5 text-xs`})}):null,(0,J.jsxs)(`div`,{className:l(`mt-3 min-h-0 flex-1`,$===`work-items`?`-mx-3 -mb-3 overflow-hidden sm:-mx-5 sm:-mb-4 xl:-mx-6`:$===`overview`?`overflow-y-auto pr-1 [scrollbar-gutter:stable] xl:overflow-hidden xl:pr-0`:`overflow-y-auto pr-1 [scrollbar-gutter:stable]`),children:[$===`overview`?(0,J.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,J.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,J.jsx)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel p-4 shadow-surface`,children:(0,J.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:m.overview.directionTitle}),(0,J.jsx)(`p`,{className:`mt-1 max-w-3xl text-sm leading-6 text-fg-muted`,children:S?.digest?.summary||S?.recommendedAction||v.description||v.brief||m.overview.directionFallback}),S?.digest?.nextAction?(0,J.jsx)(`p`,{className:`mt-2 max-w-3xl text-sm font-medium leading-6 text-fg`,children:Tn(m.overview.recommendedNext,{action:S.digest.nextAction})}):null]}),(0,J.jsx)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:(0,J.jsxs)(C,{type:`button`,variant:`secondary`,onClick:()=>void Wr(),disabled:bt,children:[(0,J.jsx)(Ct,{className:`size-4`,"aria-hidden":!0}),bt?m.overview.savingDigest:m.overview.saveDigest]})})]})}),(0,J.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel shadow-surface`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:m.overview.nextActions}),(0,J.jsxs)(C,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,onClick:()=>ir(!0),children:[(0,J.jsx)(x,{className:`size-4`,"aria-hidden":!0}),m.overview.goal]})]}),(0,J.jsx)(`div`,{className:`divide-y divide-edge`,children:S?.nextActions.length?S.nextActions.map(e=>(0,J.jsxs)(o,{to:mr(e.goalId),onClick:_r(`goals`),className:`block px-4 py-3 hover:bg-surface-hover`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title}),(0,J.jsx)(`span`,{className:l(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,Dn(e.status)),children:Zr(e.status)})]}),(0,J.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm leading-5 text-fg-muted`,children:e.nextAction})]},e.goalId)):(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:m.overview.noNextActions})})]})]}),(0,J.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,J.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:m.overview.attention}),Xr.length?(0,J.jsx)(`div`,{className:`mt-3 grid gap-3`,children:Xr.map(e=>{let t=(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,J.jsx)(c,{className:`size-4 text-amber-600 dark:text-amber-300`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title})]}),(0,J.jsxs)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:[m.overview.attentionKinds[e.kind]??e.kind,e.detail?` · ${e.detail}`:e.status?` · ${Zr(e.status)}`:``]})]});return e.href?(0,J.jsx)(o,{to:e.href,onClick:_r(vr(e.href)),className:`min-w-0 rounded-md bg-surface-base p-3 hover:bg-surface-hover`,children:t},e.id):(0,J.jsx)(`div`,{className:`min-w-0 rounded-md bg-surface-base p-3`,children:t},e.id)})}):(0,J.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:m.overview.noBlockedGoals}),(0,J.jsxs)(`form`,{onSubmit:jr,className:`mt-4 flex gap-2 border-t border-edge pt-4`,children:[(0,J.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:cr.title,onChange:e=>lr(t=>({...t,title:e.target.value})),placeholder:m.overview.blockerTitlePlaceholder}),(0,J.jsx)(C,{type:`submit`,variant:`secondary`,className:`shrink-0 rounded-lg px-3`,disabled:tr||!cr.title.trim(),"aria-label":tr?m.overview.addingBlocker:m.overview.addBlocker,title:tr?m.overview.addingBlocker:m.overview.addBlocker,children:(0,J.jsx)(x,{className:`size-4`,"aria-hidden":!0})})]})]}),(0,J.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel shadow-surface`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,J.jsx)(it,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,J.jsx)(`h2`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:m.overview.recentSessions})]}),(0,J.jsx)(`button`,{type:`button`,className:`shrink-0 text-xs font-medium text-accent-fg hover:underline`,onClick:()=>fr(`sessions`),children:m.common.viewAll})]}),(0,J.jsx)(`div`,{className:`divide-y divide-edge`,children:Yr.length?Yr.map(e=>(0,J.jsxs)(o,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:_r(`sessions`),className:`block px-4 py-3 hover:bg-surface-hover`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.name||e.key}),(0,J.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:En(e.updatedAt)})]}),(0,J.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:e.agentId||m.common.agent})]},e.key)):(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:m.overview.noSessions})})]})]})]}):null,$===`work-items`?(0,J.jsx)(`section`,{id:`project-panel-work-items`,className:`flex h-full min-h-0 flex-col`,role:`tabpanel`,"aria-labelledby":`project-work-tab-work-items`,children:(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,J.jsx)(pn,{projectId:v.id,createRequestKey:qn})})}):null,$===`workflows`?(0,J.jsxs)(`section`,{id:`project-panel-workflows`,role:`tabpanel`,"aria-labelledby":`project-work-tab-workflows`,className:`grid h-full min-h-[28rem] gap-4 xl:grid-cols-[minmax(0,1fr)_22rem]`,children:[(0,J.jsx)(`div`,{className:`min-h-0`,children:(0,J.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:m.workflows.runsTitle}),(0,J.jsx)(`p`,{className:`text-xs text-fg-muted`,children:m.workflows.runsHint})]}),(0,J.jsxs)(C,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg`,onClick:()=>void yr(),disabled:Yn,children:[(0,J.jsx)(St,{className:`size-4`,"aria-hidden":!0}),m.common.refresh]})]}),(0,J.jsx)(`div`,{className:`min-h-0 flex-1 divide-y divide-edge overflow-y-auto`,children:Yn&&Me.length===0?(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:m.workflows.loadingRuns}):Me.length?Me.map(e=>{let t=e.status===`queued`||e.status===`running`,n=e.status===`failed`||e.status===`timeout`||e.status===`cancelled`;return(0,J.jsxs)(`div`,{className:`grid gap-2 px-4 py-3 hover:bg-surface-hover`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsx)(`button`,{type:`button`,className:`min-w-0 truncate text-left text-sm font-medium text-fg hover:text-accent-fg`,onClick:()=>gr(`workflows`,vt(e.id,{ownerAgentId:Y||e.metadata?.agentId||v.defaultAgentId})),children:e.title||e.definitionId}),(0,J.jsx)(`span`,{className:l(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,On(e.status)),children:Zr(e.status)})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,J.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,children:Tn(m.workflows.runMeta,{definitionId:e.definitionId,done:e.metrics.doneAgentCount,total:e.metrics.agentCount,time:En(e.createdAtMs)})}),(0,J.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,J.jsx)(C,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,onClick:()=>gr(`workflows`,vt(e.id,{ownerAgentId:Y||e.metadata?.agentId||v.defaultAgentId})),children:m.common.open}),n?(0,J.jsxs)(C,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,disabled:Zn===`retry:${e.id}`,onClick:()=>void Mr(e),children:[(0,J.jsx)(St,{className:`size-3.5`,"aria-hidden":!0}),m.common.retry]}):null,t?(0,J.jsxs)(C,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,disabled:Zn===`cancel:${e.id}`,onClick:()=>void Nr(e),children:[(0,J.jsx)(ft,{className:`size-3.5`,"aria-hidden":!0}),m.common.cancel]}):null]})]})]},e.id)}):(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:m.workflows.emptyRuns})})]})}),(0,J.jsx)(`aside`,{className:`min-h-0`,children:(0,J.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:[(0,J.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-4 py-3`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:m.workflows.startTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:m.workflows.startHint})]}),(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-3`,children:(0,J.jsx)(`div`,{className:`grid gap-2`,children:Te.length?Te.map(e=>(0,J.jsxs)(`button`,{type:`button`,className:`grid gap-1 rounded-md bg-surface-base p-3 text-left hover:bg-surface-hover focus:outline-none focus:ring-2 focus:ring-accent/30`,onClick:()=>r(`/workflows/${e.id}?projectId=${encodeURIComponent(v.id)}${Y?`&agentId=${encodeURIComponent(Y)}`:``}`),children:[(0,J.jsxs)(`span`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,J.jsx)(W,{className:`size-4 text-accent-fg`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:e.title})]}),(0,J.jsx)(`span`,{className:`line-clamp-2 text-xs leading-5 text-fg-muted`,children:e.description||e.metadata.whenToUse||e.name})]},e.id)):(0,J.jsx)(`div`,{className:`px-1 py-3 text-sm text-fg-muted`,children:m.workflows.emptyDefinitions})})})]})})]}):null,$===`automations`?(0,J.jsxs)(`section`,{id:`project-panel-automations`,role:`tabpanel`,"aria-labelledby":`project-work-tab-automations`,className:`grid h-full min-h-[28rem] overflow-hidden gap-4 xl:grid-cols-[minmax(0,1fr)_22rem]`,children:[(0,J.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-col overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:m.automations.title}),(0,J.jsx)(`p`,{className:`text-xs text-fg-muted`,children:m.automations.hint})]}),(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsxs)(C,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg`,onClick:()=>void br(),disabled:We,children:[(0,J.jsx)(St,{className:`size-4`,"aria-hidden":!0}),m.common.refresh]}),(0,J.jsxs)(C,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>gr(`automations`,`/automations?projectId=${encodeURIComponent(v.id)}&action=create`),children:[(0,J.jsx)(x,{className:`size-4`,"aria-hidden":!0}),m.common.new]})]})]}),(0,J.jsx)(`div`,{className:`min-h-0 flex-1 divide-y divide-edge overflow-y-auto`,children:We&&Ie.length===0?(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:m.automations.loading}):Ie.length?Ie.map(e=>{let t=Ve.find(t=>t.automationId===e.id),n=e.state.runningRunId?Ve.find(t=>t.id===e.state.runningRunId):null;return(0,J.jsxs)(`div`,{className:`grid gap-2 px-4 py-3 hover:bg-surface-hover`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsx)(`button`,{type:`button`,className:`min-w-0 truncate text-left text-sm font-medium text-fg hover:text-accent-fg`,onClick:()=>gr(`automations`,`/automations?automation=${encodeURIComponent(e.id)}`),children:e.name}),(0,J.jsx)(`span`,{className:l(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,e.enabled?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-surface-hover text-fg-muted`),children:e.enabled?m.automations.enabled:m.automations.paused})]}),(0,J.jsx)(`p`,{className:`line-clamp-2 text-sm leading-5 text-fg-muted`,children:e.description||e.action.kind}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,J.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,children:Tn(m.common.lastRun,{trigger:e.trigger.kind,action:e.action.kind,time:t?En(t.createdAtMs):m.common.never})}),(0,J.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,J.jsxs)(C,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,disabled:Ke===`run:${e.id}`||!!n,onClick:()=>void Sr(e),children:[(0,J.jsx)(W,{className:`size-3.5`,"aria-hidden":!0}),m.automations.run]}),(0,J.jsxs)(C,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,disabled:Ke===`toggle:${e.id}`,onClick:()=>void Cr(e),children:[e.enabled?(0,J.jsx)(me,{className:`size-3.5`,"aria-hidden":!0}):(0,J.jsx)(W,{className:`size-3.5`,"aria-hidden":!0}),e.enabled?m.automations.pause:m.automations.resume]})]})]})]},e.id)}):(0,J.jsxs)(`div`,{className:`grid gap-3 px-4 py-6 text-sm text-fg-muted`,children:[(0,J.jsx)(`p`,{children:m.automations.empty}),(0,J.jsx)(`div`,{children:(0,J.jsxs)(C,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:()=>gr(`automations`,`/automations?projectId=${encodeURIComponent(v.id)}&action=create`),children:[(0,J.jsx)(re,{className:`size-4`,"aria-hidden":!0}),m.automations.create]})})]})})]}),(0,J.jsxs)(`aside`,{className:`grid min-h-0 min-w-0 content-start gap-4 overflow-y-auto pr-1 [scrollbar-gutter:stable]`,children:[(0,J.jsxs)(`div`,{className:`rounded-lg bg-surface-panel shadow-surface`,children:[(0,J.jsx)(`div`,{className:`border-b border-edge px-4 py-3`,children:(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:m.automations.recentRuns})}),(0,J.jsx)(`div`,{className:`divide-y divide-edge`,children:Ve.length?Ve.slice(0,8).map(e=>(0,J.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.automationName}),(0,J.jsx)(`span`,{className:l(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,On(e.status)),children:Zr(e.status)})]}),(0,J.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:En(e.createdAtMs)})]},e.id)):(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:m.automations.emptyRuns})})]}),(0,J.jsxs)(`div`,{className:`rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:m.automations.contextTitle}),(0,J.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:m.automations.contextHint}),(0,J.jsx)(`p`,{className:`mt-3 break-all text-xs text-fg-subtle`,children:v.workspaceRoot||v.effectiveWorkspaceRoot||m.common.defaultWorkspace})]})]})]}):null,$===`notes`?(0,J.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,J.jsx)(Dt,{selectedNoteId:n,basePath:`/projects/${encodeURIComponent(v.id)}/notes`,showLibrary:!1,allowMediaCapture:!1,listTag:`project:${v.id}`,captureTags:[`project:${v.id}`,v.slug],listTitle:m.notes.title,listDescription:m.notes.hint,emptyText:m.notes.emptyTitle,emptyDescription:m.notes.emptyDescription,listWidthStorageKey:`xopc.projectNotes.listWidth.${v.id}`})}):null,$===`skills`?(0,J.jsx)(Ht,{projectId:v.id,copy:m.skills}):null,$===`files`?(0,J.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,J.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:v.effectiveWorkspaceRoot?(0,J.jsxs)(`div`,{"data-project-files-grid":!0,className:l(`grid min-h-0 flex-1 grid-cols-1 overflow-hidden lg:grid-cols-[var(--project-files-panel-width)_6px_minmax(0,1fr)]`,zt&&`cursor-col-resize select-none`),style:{"--project-files-panel-width":`${Lt}px`},children:[(0,J.jsxs)(`aside`,{className:`flex min-h-0 flex-col border-b border-edge lg:border-b-0 lg:border-r`,children:[(0,J.jsxs)(`div`,{className:`flex h-11 items-center gap-1 border-b border-edge bg-surface-muted/50 px-3 text-sm`,children:[(0,J.jsx)(ce,{workspacePath:ci}),(0,J.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-1`,children:[(0,J.jsx)(`button`,{type:`button`,className:l(`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,Vt&&`bg-surface-hover text-fg`),onClick:()=>Ut(!0),"aria-label":m.files.search,title:m.files.search,"aria-pressed":Vt,children:(0,J.jsx)(He,{className:`size-3.5`,"aria-hidden":!0})}),(0,J.jsx)(ot,{className:`size-7 shrink-0 rounded-md p-0`,loading:Qt,label:s.cron.refresh,onClick:()=>void wr()})]})]}),Vt?(0,J.jsx)(`div`,{className:`shrink-0 border-b border-edge bg-surface-muted/40 px-3 py-2`,children:(0,J.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,J.jsx)(He,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,J.jsx)(`input`,{type:`text`,role:`searchbox`,value:Wt,onChange:e=>Gt(e.target.value),placeholder:m.files.searchPlaceholder,"aria-label":m.files.searchPlaceholder,className:`min-w-0 flex-1 bg-transparent text-xs text-fg outline-none placeholder:text-fg-subtle`}),(0,J.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":m.files.clearSearch,title:m.files.clearSearch,onClick:()=>{Gt(``),Ut(!1)},children:(0,J.jsx)(oe,{className:`size-3.5`,"aria-hidden":!0})})]})}):null,en?(0,J.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:en}):null,Er?(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto py-2`,children:Jt?(0,J.jsxs)(`div`,{className:`space-y-2 px-3 py-1`,children:[(0,J.jsx)(pt,{className:`h-11 w-full`}),(0,J.jsx)(pt,{className:`h-11 w-full`}),(0,J.jsx)(pt,{className:`h-11 w-full`})]}):Xt?(0,J.jsxs)(`p`,{className:`px-3 py-2 text-xs text-red-600 dark:text-red-400`,children:[s.workspace.loadError,`: `,Xt]}):Kt.length===0?(0,J.jsx)(`p`,{className:`px-3 py-2 text-xs text-fg-muted`,children:m.files.noSearchResults}):Kt.map(e=>(0,J.jsxs)(`button`,{type:`button`,className:l(`flex w-full min-w-0 items-center gap-2 px-3 py-2 text-left hover:bg-surface-hover`,q===e.path&&`bg-accent-soft text-accent-fg`),onClick:()=>It(e.path),title:e.path,children:[(0,J.jsx)(U,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,J.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`span`,{className:`block truncate text-sm text-fg`,children:e.name}),(0,J.jsx)(`span`,{className:`block truncate text-xs text-fg-subtle`,children:e.path})]})]},e.path))}):Qt&&Nt.length===0?(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:m.files.loading}):(0,J.jsx)(Ne,{tree:Nt,selectedPath:q,onSelectFile:Gr,onSelectEntry:Kr,onExpandDir:e=>void Tr(e),onAction:qr,actionLabels:{preview:s.workspace.preview,download:s.workspace.download,copyPath:s.workspace.copyPath,openDefault:s.workspace.openSystemApp,openWith:s.workspace.openWith,revealInFolder:s.workspace.revealInFolder,recommendedApps:s.workspace.recommendedApps},emptyHint:m.files.emptyDirectory})]}),(0,J.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":m.files.resizeHandle,className:l(`hidden cursor-col-resize touch-none items-stretch justify-center bg-surface-panel transition-colors hover:bg-surface-hover lg:flex`,zt&&`bg-surface-hover`),onPointerDown:Jr,children:(0,J.jsx)(`div`,{className:`my-3 w-px rounded-full bg-edge-strong/70`})}),(0,J.jsx)(`div`,{className:`min-h-0 min-w-0 overflow-hidden bg-surface-base`,children:q?(0,J.jsx)(mt,{filePath:q,projectId:v.id,agentId:v.defaultAgentId||Y||void 0,onClose:()=>It(null)}):(0,J.jsx)(`div`,{className:`flex h-full min-h-[18rem] items-center justify-center px-6 text-center`,children:(0,J.jsxs)(`div`,{className:`max-w-sm`,children:[(0,J.jsx)(ne,{className:`mx-auto size-8 text-fg-subtle`,"aria-hidden":!0}),(0,J.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:m.files.previewEmptyTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:m.files.previewEmptyDescription})]})})})]}):(0,J.jsxs)(`div`,{className:`grid gap-3 px-4 py-8 text-sm text-fg-muted`,children:[(0,J.jsx)(`p`,{children:m.files.needWorkspace}),(0,J.jsx)(`div`,{children:(0,J.jsx)(C,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:()=>fr(`settings`),children:m.files.openSettings})})]})})}):null,$===`sessions`?(0,J.jsxs)(`section`,{id:`project-panel-sessions`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-sessions`,className:`grid min-h-full content-start gap-3`,children:[I.length?(0,J.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,J.jsx)(He,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-disabled`,"aria-hidden":!0}),(0,J.jsx)(`input`,{type:`search`,enterKeyHint:`search`,value:G,onChange:e=>he(e.currentTarget.value),placeholder:m.sessions.searchPlaceholder,"aria-label":m.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`}),G?(0,J.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":m.sessions.clearSearch,onClick:()=>he(``),children:(0,J.jsx)(oe,{className:`size-3.5`,"aria-hidden":!0})}):null]}):null,ei.length?(0,J.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:ei.map(e=>{let t=En(e.updatedAt),n=e.routing?.agentId||e.agentId||m.common.agent,r=zn(e),i=e.name?.trim()||m.sessions.fallbackTitle,a=Qr(e.messageCount??0);return(0,J.jsxs)(o,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:_r(`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,J.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,J.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,J.jsx)(Ee,{className:`size-4`,"aria-hidden":!0})}),(0,J.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,J.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-sm font-semibold text-fg`,children:i}),r?(0,J.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,J.jsxs)(`div`,{className:`mt-auto grid gap-2 pt-4 text-xs text-fg-muted`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,J.jsxs)(`span`,{className:`min-w-0 max-w-full truncate rounded-md bg-surface-base px-2 py-1`,children:[m.sessions.agent,`: `,n]}),(0,J.jsx)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:a})]}),t?(0,J.jsxs)(`span`,{className:`truncate rounded-md bg-surface-base px-2 py-1`,children:[m.sessions.updated,`: `,t]}):null]})]},e.key)})}):ti?(0,J.jsx)(`div`,{className:`grid gap-1 rounded-lg bg-surface-panel px-4 py-8 text-center shadow-surface`,children:(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:m.sessions.noMatches})}):(0,J.jsx)(`div`,{className:`grid gap-1 rounded-lg bg-surface-panel px-4 py-8 text-center shadow-surface`,children:(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:m.sessions.emptyTitle}),(0,J.jsx)(`p`,{className:`mx-auto mt-1 max-w-md text-sm leading-6 text-fg-muted`,children:m.sessions.emptyDescription})]})})]}):null,$===`goals`?(0,J.jsxs)(`section`,{id:`project-panel-goals`,role:`tabpanel`,"aria-labelledby":`project-work-tab-goals`,className:`grid min-h-full content-start gap-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsx)(`div`,{children:(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:m.goals.title})}),(0,J.jsxs)(C,{type:`button`,variant:`primary`,className:`h-9 rounded-lg px-3`,disabled:$n,onClick:()=>ir(!0),children:[(0,J.jsx)(x,{className:`size-4`,"aria-hidden":!0}),m.goals.new]})]}),(0,J.jsx)(`div`,{className:`overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:be.length?be.map(e=>(0,J.jsxs)(o,{to:mr(e.id),onClick:_r(`goals`),className:`grid gap-1 border-b border-edge px-4 py-3 last:border-b-0 hover:bg-surface-hover`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title}),(0,J.jsx)(`span`,{className:l(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,Dn(e.status)),children:Zr(e.status)})]}),(0,J.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,children:e.nextAction||e.description||m.goals.noNextAction})]},e.id)):(0,J.jsx)(`p`,{className:`p-4 text-sm text-fg-muted`,children:m.goals.empty})})]}):null,$===`activity`?(0,J.jsxs)(`section`,{id:`project-panel-activity`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-activity`,className:`grid min-h-full content-start gap-3`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:m.activity.title}),(0,J.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:Tn(m.activity.count,{count:tt})})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.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,J.jsx)(`input`,{type:`checkbox`,checked:ht,onChange:e=>yt(e.currentTarget.checked),className:`size-4 rounded border-edge text-accent focus:ring-accent/30`}),m.activity.includeRelated]}),(0,J.jsxs)(C,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg px-3`,onClick:()=>void xr(),disabled:ct,children:[(0,J.jsx)(St,{className:l(`size-4`,ct&&`animate-spin`),"aria-hidden":!0}),m.common.refresh]})]})]}),(0,J.jsx)(`div`,{className:`overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:ct&&Je.length===0?(0,J.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:m.activity.loading}):Je.length?(0,J.jsx)(`div`,{className:`divide-y divide-edge`,children:Je.map(e=>{let t=m.activity.types[e.type]??e.type,n=m.activity.objectKinds[e.primaryObject.kind]??e.primaryObject.kind,r=Vn(e),i=e.relatedProjects.length>0&&!e.scopes.some(e=>e.scopeKind===`project`&&e.scopeId===v.id);return(0,J.jsxs)(`article`,{className:`grid gap-2 px-4 py-3`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-start justify-between gap-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:t}),i?(0,J.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-xs font-medium text-fg-muted`,children:m.activity.related}):null]}),(0,J.jsxs)(`p`,{className:`mt-1 min-w-0 truncate text-sm text-fg-muted`,children:[n,`: `,Ln(e)]})]}),(0,J.jsx)(`time`,{className:`shrink-0 text-xs text-fg-subtle`,dateTime:new Date(e.createdAt).toISOString(),children:En(e.createdAt)})]}),r?(0,J.jsx)(`p`,{className:`line-clamp-2 text-sm leading-5 text-fg-muted`,children:r}):null,(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2 text-xs text-fg-subtle`,children:[(0,J.jsxs)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:[m.activity.actor,`: `,In(e)]}),(0,J.jsxs)(`span`,{className:`max-w-full truncate rounded-md bg-surface-base px-2 py-1`,children:[m.activity.source,`: `,Rn(e)]})]})]},e.id)})}):(0,J.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:m.activity.empty})})]}):null,$===`settings`?(0,J.jsxs)(`form`,{id:`project-panel-settings`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-settings`,onSubmit:Rr,className:`grid min-h-full content-start gap-4`,children:[(0,J.jsxs)(`section`,{className:`grid gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:m.settings.summaryTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:m.settings.summaryHint})]}),(0,J.jsx)(`span`,{className:l(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,Dn(Q.status)),children:m.settings.statuses[Q.status]})]}),(0,J.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-5`,children:[(0,J.jsx)(jn,{label:m.settings.workspaceRoot,value:ci,mono:!0}),(0,J.jsx)(jn,{label:m.settings.defaultAgent,value:ni}),(0,J.jsx)(jn,{label:m.settings.pinState,value:oi?m.settings.pinned:m.settings.notPinned}),(0,J.jsx)(jn,{label:m.settings.createdAt,value:En(v.createdAt)||m.common.never}),(0,J.jsx)(jn,{label:m.settings.updatedAt,value:En(v.updatedAt)||m.common.never})]})]}),(0,J.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,J.jsx)(`div`,{children:(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:m.settings.detailsTitle})}),(0,J.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,J.jsx)(kn,{label:m.settings.name,children:(0,J.jsx)(`input`,{className:An(),value:Q.name,onChange:e=>ur(t=>({...t,name:e.target.value}))})}),(0,J.jsx)(kn,{label:m.settings.defaultAgent,children:(0,J.jsxs)(rt,{className:An(),value:Q.defaultAgentId,onChange:e=>ur(t=>({...t,defaultAgentId:e.target.value})),children:[(0,J.jsx)(Xe,{value:``,children:m.settings.globalDefaultAgent}),nn.map(e=>(0,J.jsx)(Xe,{value:e.id,children:ge(e,s.agentsSettings)},e.id))]})}),(0,J.jsx)(kn,{label:m.settings.status,children:ai?(0,J.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:m.settings.statuses.archived}):(0,J.jsxs)(rt,{className:An(),value:Q.status===`archived`?`active`:Q.status,onChange:e=>ur(t=>({...t,status:e.target.value})),children:[(0,J.jsx)(Xe,{value:`active`,children:m.settings.statuses.active}),(0,J.jsx)(Xe,{value:`paused`,children:m.settings.statuses.paused})]})}),(0,J.jsx)(kn,{label:m.settings.description,hint:m.settings.descriptionHint,children:(0,J.jsx)(`textarea`,{className:An(!0),value:Q.description,onChange:e=>ur(t=>({...t,description:e.target.value}))})})]})]}),(0,J.jsx)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:(0,J.jsxs)(`div`,{className:`grid gap-2 text-sm`,children:[(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:m.settings.workspaceRoot}),(0,J.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3 md:flex-row md:items-start md:justify-between`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:(0,J.jsx)(`span`,{className:`rounded-md bg-surface-muted px-2 py-0.5 text-xs font-medium text-fg-muted`,children:si?m.settings.workspaceModeFollow:m.settings.workspaceModeFixed})}),(0,J.jsx)(`div`,{className:`mt-2 break-all font-mono text-xs leading-5 text-fg`,title:ci,children:ci})]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:[(0,J.jsxs)(C,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:()=>void mi(),children:[(0,J.jsx)(Ae,{className:`size-4`,"aria-hidden":!0}),m.settings.copyWorkspacePath]}),(0,J.jsx)(ce,{workspacePath:ci}),(0,J.jsxs)(C,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:zr,children:[(0,J.jsx)(ae,{className:`size-4`,"aria-hidden":!0}),m.settings.migrateWorkspace]})]})]}),(0,J.jsx)(`p`,{className:`text-xs leading-5 text-fg-subtle`,children:m.settings.workspaceMigrationHint})]})]})}),(0,J.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:m.settings.projectGuidanceTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:m.settings.projectGuidanceHint})]}),(0,J.jsx)(kn,{label:m.settings.brief,hint:m.settings.briefHint,children:(0,J.jsx)(`textarea`,{className:An(!0),value:Q.brief,onChange:e=>ur(t=>({...t,brief:e.target.value}))})}),(0,J.jsx)(kn,{label:m.settings.instructions,hint:m.settings.instructionsHint,children:(0,J.jsx)(`textarea`,{className:An(!0),value:Q.instructions,onChange:e=>ur(t=>({...t,instructions:e.target.value}))})})]}),(0,J.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:m.settings.managementTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:m.settings.managementHint})]}),(0,J.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:[(0,J.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:oi?m.settings.pinnedTitle:m.settings.pinTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:m.settings.pinHint})]}),(0,J.jsxs)(C,{type:`button`,variant:`ghost`,className:`w-fit rounded-lg`,disabled:Mn===`pin`,onClick:()=>void Vr(),children:[oi?(0,J.jsx)(ue,{className:`size-4`,"aria-hidden":!0}):(0,J.jsx)(k,{className:`size-4`,"aria-hidden":!0}),oi?m.settings.unpinProject:m.settings.pinProject]})]}),(0,J.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:ai?m.settings.restoreTitle:m.settings.archiveTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:ai?m.settings.restoreHint:m.settings.archiveHint})]}),(0,J.jsxs)(C,{type:`button`,variant:ai?`primary`:`ghost`,className:`w-fit rounded-lg`,disabled:Mn===`archive`,onClick:()=>void Hr(),children:[ai?(0,J.jsx)(St,{className:`size-4`,"aria-hidden":!0}):(0,J.jsx)(R,{className:`size-4`,"aria-hidden":!0}),ai?m.settings.restoreProject:m.settings.archiveProject]})]})]})]}),(0,J.jsxs)(`section`,{className:`grid gap-3 rounded-lg border border-red-500/20 bg-red-500/5 p-4`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-red-700 dark:text-red-300`,children:m.settings.dangerTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-red-700/80 dark:text-red-200/80`,children:m.settings.dangerHint})]}),(0,J.jsxs)(C,{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:()=>dn(!0),children:[(0,J.jsx)(V,{className:`size-4`,"aria-hidden":!0}),m.settings.deleteConfirmAction]})]}),(0,J.jsx)(`div`,{className:`flex flex-wrap justify-end gap-2 border-t border-edge pt-4`,children:(0,J.jsxs)(C,{type:`submit`,variant:`primary`,disabled:cn||!Q.name.trim(),children:[(0,J.jsx)(Ct,{className:`size-4`,"aria-hidden":!0}),m.common.save]})})]}):null]}),(0,J.jsx)(Et,{open:un,onOpenChange:e=>{Pn||dn(e)},children:(0,J.jsxs)(we,{children:[(0,J.jsx)(ye,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(xe,{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,J.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,J.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,J.jsx)(c,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0})}),(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(M,{className:`text-base font-semibold text-fg`,children:m.settings.deleteConfirmTitle}),(0,J.jsx)(F,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:v?Tn(m.settings.deleteConfirm,{name:v.name}):m.settings.deleteConfirmFallback})]})]}),(0,J.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,J.jsx)(T,{asChild:!0,children:(0,J.jsx)(C,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:Pn,children:m.common.cancel})}),(0,J.jsxs)(C,{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:Pn||!v,onClick:()=>void Ur(),children:[(0,J.jsx)(V,{className:`size-4`,"aria-hidden":!0}),m.settings.deleteConfirmAction]})]})]})]})}),(0,J.jsx)(Et,{open:hn,onOpenChange:e=>{cn||gn(e)},children:(0,J.jsxs)(we,{children:[(0,J.jsx)(ye,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(xe,{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,J.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,J.jsx)(M,{className:`text-base font-semibold text-fg`,children:m.settings.workspaceMigrationTitle}),(0,J.jsx)(F,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:m.settings.workspaceMigrationDescription})]}),(0,J.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,J.jsxs)(`div`,{className:`grid gap-2 text-sm`,children:[(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:m.settings.workspaceMode}),(0,J.jsxs)(`div`,{className:`grid gap-2 md:grid-cols-2`,children:[(0,J.jsxs)(`label`,{className:l(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2`,X===`fixed`?`border-accent bg-accent-soft/40 text-fg`:`border-edge bg-surface-base text-fg-muted`),children:[(0,J.jsx)(`input`,{type:`radio`,className:`mt-0.5 size-4`,checked:X===`fixed`,onChange:()=>_n(`fixed`),disabled:cn}),(0,J.jsxs)(`span`,{className:`min-w-0`,children:[(0,J.jsx)(`span`,{className:`block font-medium`,children:m.settings.workspaceModeFixed}),(0,J.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:m.settings.workspaceMigrationFixedHint})]})]}),(0,J.jsxs)(`label`,{className:l(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2`,X===`follow`?`border-accent bg-accent-soft/40 text-fg`:`border-edge bg-surface-base text-fg-muted`),children:[(0,J.jsx)(`input`,{type:`radio`,className:`mt-0.5 size-4`,checked:X===`follow`,onChange:()=>_n(`follow`),disabled:cn}),(0,J.jsxs)(`span`,{className:`min-w-0`,children:[(0,J.jsx)(`span`,{className:`block font-medium`,children:m.settings.workspaceModeFollow}),(0,J.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:m.settings.workspaceHint})]})]})]})]}),X===`fixed`?(0,J.jsx)(kt,{value:vn,onChange:yn,disabled:cn,wd:f,placeholder:m.settings.workspacePlaceholder,inputClassName:An(),autoFocus:!0}):null,(0,J.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:m.settings.workspaceMigrationImpact}),(0,J.jsx)(`div`,{className:`rounded-lg bg-surface-muted px-3 py-2 text-xs leading-5 text-fg-subtle`,children:Tn(m.settings.workspaceCurrent,{workspace:li})})]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,J.jsx)(T,{asChild:!0,children:(0,J.jsx)(C,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:cn,children:m.common.cancel})}),(0,J.jsxs)(C,{type:`button`,variant:`primary`,className:`rounded-lg`,disabled:cn||!ui,onClick:()=>void Br(),children:[(0,J.jsx)(ae,{className:`size-4`,"aria-hidden":!0}),m.settings.workspaceMigrationConfirm]})]})]})]})}),(0,J.jsx)(Et,{open:!!fn,onOpenChange:e=>{e||mn(null)},children:(0,J.jsxs)(we,{children:[(0,J.jsx)(ye,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(xe,{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,J.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,J.jsx)(M,{className:`text-base font-semibold text-fg`,children:m.settings.workspaceMissingTitle}),(0,J.jsx)(F,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:fn?Tn(m.settings.workspaceMissingDescription,{workspace:fn}):null})]}),fn?(0,J.jsx)(`div`,{className:`px-5 py-4`,children:(0,J.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-surface-muted px-3 py-2 text-sm text-fg-muted`,children:[(0,J.jsx)(ne,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:fn})]})}):null,(0,J.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,J.jsx)(C,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:hi,disabled:cn,children:m.settings.workspaceMissingBack}),(0,J.jsxs)(C,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:()=>void Br({createWorkspaceRoot:!0}),disabled:cn,children:[(0,J.jsx)(ae,{className:`size-4`,"aria-hidden":!0}),m.settings.workspaceMissingCreate]})]})]})]})}),(0,J.jsx)(Mt,{open:rr,t:s.goalsPage,chat:s.chat,busy:$n,options:or,onClose:()=>!$n&&ir(!1),onCreate:Ar})]})}export{Gn as ProjectDetailPage};
|
|
@@ -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{t as i}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as a}from"./cn-JdwAhgNB.js";import{t as o}from"./messages-DP6tPKk-.js";import{n as s}from"./locale-store-CTwSy7yW.js";import{Aa as c,Ac as l,As as u,At as d,Bo as f,Fc as p,Fl as ee,Go as m,Ha as h,Ho as g,Iu as _,Ka as v,Mu as y,Pc as te,Pl as b,Pt as x,To as S,Ua as C,Uo as w,Va as T,Vo as E,Wo as D,_t as O,gc as k,ka as A,ro as j,tl as M,xc as N,zo as P}from"./index-C0CGebQ1.js";var F=n(),I=e(t(),1),L=r();function R(e,t){if(e==null)return t;let n=new Date(e);return Number.isNaN(n.getTime())?t:O(n)}function ne(e){return[...e].sort((e,t)=>{let n=Number(!!t.pinnedAt)-Number(!!e.pinnedAt);return n===0?new Date(t.lastActiveAt??t.updatedAt).getTime()-new Date(e.lastActiveAt??e.updatedAt).getTime():n})}function re(){let e=(0,F.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,L.jsx)(`div`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-3`,"aria-busy":!0,children:Array.from({length:6},z)}),e[0]=t):t=e[0],t}function z(e,t){return(0,L.jsx)(j,{className:`h-40 rounded-xl`},t)}function ie(e){let t=(0,F.c)(59),{project:n,busy:r,onTogglePin:a,onToggleArchive:c}=e,l=s(ae),d,f,m,h,g,v,b,x;if(t[0]!==l||t[1]!==n.brief||t[2]!==n.description||t[3]!==n.id||t[4]!==n.lastActiveAt||t[5]!==n.name||t[6]!==n.status||t[7]!==n.updatedAt||t[8]!==n.workspaceRoot){let e=o(l).projectsPage;d=e.management,b=`flex h-full flex-col rounded-xl border border-edge-subtle bg-surface-base p-4`;let r;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,L.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-accent-soft text-accent`,children:(0,L.jsx)(ee,{className:`size-4`,"aria-hidden":!0})}),t[17]=r):r=t[17];let a;t[18]===n.name?a=t[19]:(a=(0,L.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:n.name}),t[18]=n.name,t[19]=a);let s=(0,L.jsxs)(`div`,{className:`min-w-0`,children:[a,(0,L.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:e.statuses[n.status]})]}),c;t[20]===s?c=t[21]:(c=(0,L.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[r,s]}),t[20]=s,t[21]=c);let u;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,L.jsx)(y,{className:`mt-2 size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5`,"aria-hidden":!0}),t[22]=u):u=t[22];let p;t[23]===c?p=t[24]:(p=(0,L.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[c,u]}),t[23]=c,t[24]=p),x=(0,L.jsxs)(i,{to:`/projects/${encodeURIComponent(n.id)}`,className:`group flex min-w-0 flex-1 flex-col rounded-lg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[p,(0,L.jsx)(`p`,{className:`mt-3 line-clamp-2 min-h-10 text-xs leading-5 text-fg-muted`,children:n.description||n.brief||e.noDescription})]}),v=`mt-3 flex shrink-0 items-end justify-between gap-3 border-t border-edge-subtle pt-3`,h=`min-w-0 text-[11px] text-fg-subtle`,g=(0,L.jsx)(`p`,{className:`truncate`,children:n.workspaceRoot||e.agentDefault}),f=`mt-1`,m=R(n.lastActiveAt??n.updatedAt,e.never),t[0]=l,t[1]=n.brief,t[2]=n.description,t[3]=n.id,t[4]=n.lastActiveAt,t[5]=n.name,t[6]=n.status,t[7]=n.updatedAt,t[8]=n.workspaceRoot,t[9]=d,t[10]=f,t[11]=m,t[12]=h,t[13]=g,t[14]=v,t[15]=b,t[16]=x}else d=t[9],f=t[10],m=t[11],h=t[12],g=t[13],v=t[14],b=t[15],x=t[16];let S;t[25]!==f||t[26]!==m?(S=(0,L.jsx)(`p`,{className:f,children:m}),t[25]=f,t[26]=m,t[27]=S):S=t[27];let C;t[28]!==h||t[29]!==g||t[30]!==S?(C=(0,L.jsxs)(`div`,{className:h,children:[g,S]}),t[28]=h,t[29]=g,t[30]=S,t[31]=C):C=t[31];let w=n.pinnedAt?d.unpin:d.pin,T=n.pinnedAt?d.unpin:d.pin,E;t[32]===n.pinnedAt?E=t[33]:(E=n.pinnedAt?(0,L.jsx)(te,{className:`size-4`,"aria-hidden":!0}):(0,L.jsx)(p,{className:`size-4`,"aria-hidden":!0}),t[32]=n.pinnedAt,t[33]=E);let D;t[34]!==r||t[35]!==a||t[36]!==w||t[37]!==T||t[38]!==E?(D=(0,L.jsx)(u,{type:`button`,variant:`ghost`,className:`size-8 p-0`,disabled:r,onClick:a,"aria-label":w,title:T,children:E}),t[34]=r,t[35]=a,t[36]=w,t[37]=T,t[38]=E,t[39]=D):D=t[39];let O=n.status===`archived`?d.restore:d.archive,k=n.status===`archived`?d.restore:d.archive,A;t[40]===n.status?A=t[41]:(A=n.status===`archived`?(0,L.jsx)(N,{className:`size-4`,"aria-hidden":!0}):(0,L.jsx)(_,{className:`size-4`,"aria-hidden":!0}),t[40]=n.status,t[41]=A);let j;t[42]!==r||t[43]!==c||t[44]!==O||t[45]!==k||t[46]!==A?(j=(0,L.jsx)(u,{type:`button`,variant:`ghost`,className:`size-8 p-0`,disabled:r,onClick:c,"aria-label":O,title:k,children:A}),t[42]=r,t[43]=c,t[44]=O,t[45]=k,t[46]=A,t[47]=j):j=t[47];let M;t[48]!==D||t[49]!==j?(M=(0,L.jsxs)(`div`,{className:`flex shrink-0 gap-1`,children:[D,j]}),t[48]=D,t[49]=j,t[50]=M):M=t[50];let P;t[51]!==M||t[52]!==v||t[53]!==C?(P=(0,L.jsxs)(`div`,{className:v,children:[C,M]}),t[51]=M,t[52]=v,t[53]=C,t[54]=P):P=t[54];let I;return t[55]!==P||t[56]!==b||t[57]!==x?(I=(0,L.jsxs)(`article`,{className:b,children:[x,P]}),t[55]=P,t[56]=b,t[57]=x,t[58]=I):I=t[58],I}function ae(e){return e.language}function B(){let e=o(s(e=>e.language)),t=e.projectsPage,n=t.management,r=e.chat.workingDirectory,i=S(e=>e.setPageHeader),p=S(e=>e.clearPageHeader),[_,y]=(0,I.useState)([]),[te,O]=(0,I.useState)(!0),[j,N]=(0,I.useState)(null),[F,R]=(0,I.useState)(``),[z,ae]=(0,I.useState)(`active`),[B,V]=(0,I.useState)(null),[oe,H]=(0,I.useState)(!1),[U,W]=(0,I.useState)(null),[G,K]=(0,I.useState)(!1),[q,J]=(0,I.useState)(``),[Y,X]=(0,I.useState)(``),[Z,se]=(0,I.useState)(``),Q=x({initialPath:Z,onPicked:se}),$=(0,I.useCallback)(async()=>{O(!0),N(null);try{y(ne((await T({limit:100,sortBy:`updatedAt`,sortOrder:`desc`})).items))}catch(e){N(e instanceof Error?e.message:String(e))}finally{O(!1)}},[]);(0,I.useEffect)(()=>{$()},[$]);let ce=(0,I.useMemo)(()=>{let e=F.trim().toLocaleLowerCase();return _.filter(e=>z===`all`||e.status===z).filter(t=>!e||[t.name,t.description,t.brief,t.workspaceRoot].filter(Boolean).some(t=>t.toLocaleLowerCase().includes(e)))},[z,_,F]),le=(0,I.useMemo)(()=>(0,L.jsxs)(u,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>H(!0),children:[(0,L.jsx)(l,{className:`size-4`,"aria-hidden":!0}),t.create]}),[t.create]);(0,I.useLayoutEffect)(()=>(i({startExtra:null,main:(0,L.jsxs)(`div`,{className:`min-w-0`,children:[(0,L.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n.title}),(0,L.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:n.subtitle})]}),end:le}),()=>p()),[p,le,n.subtitle,n.title,i]);let ue=(0,I.useCallback)(async e=>{e.preventDefault();let t=q.trim(),n=Z.trim();if(!(!t||!n||G)){K(!0),W(null);try{let e=await c({name:t,...Y.trim()?{description:Y.trim()}:{},workspaceRoot:n});y(t=>[e,...t.filter(t=>t.id!==e.id)]),J(``),X(``),se(``),H(!1),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}catch(e){W(e instanceof Error?e.message:String(e))}finally{K(!1)}}},[G,Y,q,Z]),de=(0,I.useCallback)(async(e,t)=>{V(e.id),N(null);try{let n;n=t===`pin`?e.pinnedAt?await v(e.id):await h(e.id):e.status===`archived`?await C(e.id):await A(e.id),y(e=>e.map(e=>e.id===n.id?n:e)),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}catch(e){N(e instanceof Error?e.message:String(e))}finally{V(null)}},[]),fe=[{id:`active`,label:t.statuses.active},{id:`paused`,label:t.statuses.paused},{id:`archived`,label:t.statuses.archived},{id:`all`,label:t.all}];return(0,L.jsxs)(`main`,{className:`flex w-full flex-1 flex-col gap-5 px-3 py-6 sm:px-5 xl:px-6`,children:[(0,L.jsx)(P,{open:oe,onOpenChange:e=>{H(e),e||W(null)},children:(0,L.jsxs)(D,{children:[(0,L.jsx)(w,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,L.jsxs)(E,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(34rem,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,L.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,L.jsx)(m,{className:`text-base font-semibold text-fg`,children:t.createTitle}),(0,L.jsx)(g,{className:`mt-1 text-sm text-fg-muted`,children:t.createDescription})]}),(0,L.jsxs)(`form`,{onSubmit:ue,className:`flex min-h-0 flex-1 flex-col`,children:[(0,L.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,L.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-fg`,children:[t.projectName,(0,L.jsx)(`input`,{className:`h-10 rounded-lg border border-edge bg-surface-base px-3 font-normal outline-none focus:border-accent focus:ring-2 focus:ring-accent/20`,value:q,onChange:e=>J(e.target.value),maxLength:160})]}),(0,L.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-fg`,children:[n.descriptionLabel,(0,L.jsx)(`textarea`,{className:`min-h-28 resize-none rounded-lg border border-edge bg-surface-base px-3 py-2 font-normal leading-6 outline-none focus:border-accent focus:ring-2 focus:ring-accent/20`,value:Y,onChange:e=>X(e.target.value),maxLength:2e3,placeholder:n.descriptionPlaceholder})]}),(0,L.jsxs)(`div`,{className:`grid gap-1.5 text-sm`,children:[(0,L.jsx)(`span`,{className:`font-medium text-fg`,children:t.workspaceRoot}),(0,L.jsxs)(`button`,{type:`button`,className:`flex min-h-12 w-full items-center gap-3 rounded-lg border border-edge bg-surface-base px-3 py-2 text-left outline-none transition-colors hover:bg-surface-hover focus-visible:border-accent focus-visible:ring-2 focus-visible:ring-accent/20 disabled:cursor-not-allowed disabled:opacity-60`,onClick:Q.pick,disabled:G||Q.picking,children:[Q.picking?(0,L.jsx)(M,{className:`size-5 shrink-0 animate-spin text-accent`,"aria-hidden":!0}):(0,L.jsx)(b,{className:`size-5 shrink-0 text-accent`,"aria-hidden":!0}),(0,L.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,L.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:Z?r.chooseFolder:r.selectWorkingDirectory}),(0,L.jsx)(`span`,{className:a(`mt-0.5 block truncate font-mono text-xs font-normal`,Z?`text-fg-muted`:`text-fg-subtle`),title:Z||void 0,children:Z||t.workspaceSelectionPlaceholder})]})]}),(0,L.jsx)(`p`,{className:`text-xs font-normal text-fg-subtle`,children:t.workspaceSelectionHint})]}),U?(0,L.jsx)(`p`,{className:`rounded-lg bg-danger-soft px-3 py-2 text-xs text-danger`,role:`alert`,children:U}):null]}),(0,L.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,L.jsx)(f,{asChild:!0,children:(0,L.jsx)(u,{type:`button`,variant:`ghost`,children:t.cancel})}),(0,L.jsx)(u,{type:`submit`,variant:`primary`,disabled:G||!q.trim()||!Z.trim(),children:G?t.workHome.creating:t.create})]})]})]})]})}),Q.hasNativePicker?null:(0,L.jsx)(d,{open:Q.modalOpen,onOpenChange:Q.setModalOpen,initialAbsolutePath:Z||void 0,onConfirm:Q.confirmPick,wd:r}),(0,L.jsxs)(`section`,{className:`flex flex-col gap-3 rounded-xl border border-edge-subtle bg-surface-base p-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,L.jsx)(`div`,{className:`flex flex-wrap gap-1`,"aria-label":n.filterLabel,children:fe.map(e=>(0,L.jsx)(`button`,{type:`button`,className:a(`rounded-lg px-3 py-1.5 text-xs font-medium transition-colors`,z===e.id?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),onClick:()=>ae(e.id),children:e.label},e.id))}),(0,L.jsxs)(`label`,{className:`relative block min-w-0 sm:w-64`,children:[(0,L.jsx)(k,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,L.jsx)(`input`,{className:`h-9 w-full rounded-lg border border-edge bg-surface-panel pl-9 pr-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`,value:F,onChange:e=>R(e.target.value),placeholder:t.searchPlaceholder,"aria-label":t.searchPlaceholder})]})]}),j?(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl border border-danger/25 bg-danger-soft px-4 py-3 text-sm text-danger`,role:`alert`,children:[(0,L.jsx)(`span`,{children:j}),(0,L.jsx)(u,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>void $(),children:t.workHome.retry})]}):null,te?(0,L.jsx)(re,{}):ce.length?(0,L.jsx)(`section`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-3`,children:ce.map(e=>(0,L.jsx)(ie,{project:e,busy:B===e.id,onTogglePin:()=>void de(e,`pin`),onToggleArchive:()=>void de(e,`archive`)},e.id))}):(0,L.jsxs)(`section`,{className:`rounded-xl border border-dashed border-edge p-10 text-center`,children:[(0,L.jsx)(ee,{className:`mx-auto size-7 text-fg-subtle`,"aria-hidden":!0}),(0,L.jsx)(`h2`,{className:`mt-3 text-sm font-semibold text-fg`,children:n.emptyTitle}),(0,L.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:n.emptyHint})]})]})}export{B as ProjectsPage};
|